gzkx-package 0.1.1 → 0.1.2
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +231 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty,e=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"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(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const n in t)if("default"!==n){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}return e.default=t,Object.freeze(e)}const h=u(r),d="currentUserId",f=(t,e)=>{if(e)return`user_${e}_${t}`;const n=localStorage.getItem(d);return n?`user_${n}_${t}`:t},p={setCurrentUserId:t=>{localStorage.setItem(d,t)},getCurrentUserId:()=>localStorage.getItem(d),getToken:()=>localStorage.getItem(f("token")),setToken:t=>{localStorage.setItem(f("token"),t)},getRefreshToken:()=>localStorage.getItem(f("refreshToken")),setRefreshToken:t=>{localStorage.setItem(f("refreshToken"),t)},removeToken:()=>{const t=p.getCurrentUserId();t&&(localStorage.removeItem(f("token",t)),localStorage.removeItem(f("userInfo",t)),localStorage.removeItem(f("refreshToken",t)))},isLoggedIn:()=>!!localStorage.getItem(f("token")),getUserInfo:()=>{const t=localStorage.getItem(f("userInfo"));return t?JSON.parse(t):null},setUserInfo:t=>{(null==t?void 0:t.userId)&&p.setCurrentUserId(t.userId),localStorage.setItem(f("userInfo"),JSON.stringify(t))},setOrgList:t=>{localStorage.setItem(f("orgList"),JSON.stringify(t))},getOrgList:()=>localStorage.getItem(f("orgList")),setFunctionAuth:t=>{localStorage.setItem(f("functionAuth"),JSON.stringify(t))},getFunctionAuth:()=>JSON.parse(localStorage.getItem(f("functionAuth"))||"[]"),setAppInfo:t=>{localStorage.setItem(f("appInfo"),JSON.stringify(t))},getAppInfo:()=>JSON.parse(localStorage.getItem(f("appInfo"))||"[]"),setOrgInfo:t=>{localStorage.setItem(f("orgInfo"),JSON.stringify(t))},getOrgInfo:()=>JSON.parse(localStorage.getItem(f("orgInfo"))||"{}"),setDeptInfo:t=>{localStorage.setItem(f("deptInfo"),JSON.stringify(t))},getDeptInfo:()=>JSON.parse(localStorage.getItem(f("deptInfo"))||"{}"),setMenu:t=>{localStorage.setItem(f("menu"),JSON.stringify(t))},getMenu:()=>JSON.parse(localStorage.getItem(f("menu"))||"[]"),setLoginConfig:t=>{localStorage.setItem("loginConfig",JSON.stringify(t))},getLoginConfig:()=>{const t=localStorage.getItem("loginConfig");return t?JSON.parse(t):null},setFavicon:t=>{try{if(!t){const e=p.getLoginConfig();t=null==e?void 0:e.loginIcon}if(!t)return;document.querySelectorAll('link[rel*="icon"]').forEach(t=>t.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=`data:image/png;base64,${t}`,document.head.appendChild(e)}catch(e){}},setWebTitle:t=>{try{if(!t){const e=p.getLoginConfig();t=null==e?void 0:e.webTitle}t&&(document.title=t)}catch(e){}},clearAuth:()=>{const t=p.getCurrentUserId();t&&(localStorage.removeItem(f("token",t)),localStorage.removeItem(f("userInfo",t)),localStorage.removeItem(f("refreshToken",t)),localStorage.removeItem(f("orgList",t)),localStorage.removeItem(f("functionAuth",t)),localStorage.removeItem(f("appInfo",t)),localStorage.removeItem(f("orgInfo",t)),localStorage.removeItem(f("deptInfo",t)),localStorage.removeItem(f("menu",t)),localStorage.removeItem(f("menu-storage",t)),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=t=>{v.forEach(e=>e(t)),v=[]},x=["/image/generateValidateCode","/sso/doLogin","/sso/refreshToken"],w=[],N=()=>{w.forEach(t=>{t.cancel("请求被取消:token已过期")}),w.length=0},E=s.create({baseURL:m,timeout:g,headers:{"Content-Type":"application/json"}}),k=async()=>{try{const t=await s.post(`${m}/account/sso/refreshToken`,{refreshToken:p.getRefreshToken()},{headers:{"Content-Type":"application/json"}});return t.data&&"object"==typeof t.data?t.data:t}catch(t){throw t}};function A(t,e,n){return E.post(t,e,n)}function S(t,e){return A(e,t)}E.interceptors.request.use(t=>{if(!x.some(e=>{var n;return null==(n=t.url)?void 0:n.includes(e)})){const e=p.getToken();if(!p.getRefreshToken())return i.Modal.confirm({title:"登录提示",content:"您还未登录,请先登录后再进行操作",okText:"前往登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("请先登录"));t.headers.Authorization=`Bearer ${e}`,t.headers.accessToken=`${e}`}const e=s.CancelToken.source();return t.cancelToken=e.token,w.push(e),t},t=>Promise.reject(t)),E.interceptors.response.use(async t=>{const{data:e,config:n}=t,r=w.findIndex(t=>t.token===n.cancelToken);if(r>-1&&w.splice(r,1),"blob"===n.responseType)return t;if(200===e.code)return e;if(461===e.code)return p.clearAuth(),N(),i.Modal.confirm({title:"登录已过期",content:"您的登录状态已过期,请重新登录后继续操作",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("登录已过期"));if(401!==e.code)return i.Modal.confirm({title:"操作提示",content:e.msg||`请求失败,错误码:${e.code}`,okText:"确定",cancelButtonProps:{style:{display:"none"}},onOk:()=>{}}),e;N();try{const t=await k();if(200===t.code){const e=t.data.accessToken;return p.setToken(e),y(e),n.headers.Authorization=`Bearer ${e}`,n.headers.accessToken=e,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 t=>{if(s.isCancel(t))return Promise.reject(t);if(t.response){const{status:n,config:r}=t.response;if(401===n&&!x.some(t=>{var e;return null==(e=r.url)?void 0:e.includes(t)})){if(b)return new Promise(t=>{var e;e=e=>{r.headers.Authorization=`Bearer ${e}`,r.headers.accessToken=e,t(E(r))},v.push(e)});b=!0;try{const t=await k();if(200===t.code){const e=t.data.accessToken;return p.setToken(e),y(e),r.headers.Authorization=`Bearer ${e}`,r.headers.accessToken=e,E(r)}return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("刷新token失败"))}catch(e){return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(e)}finally{b=!1}}}else t.request&&i.Modal.confirm({title:"网络异常",content:"请求超时或网络不可用,请检查您的网络连接后重试",okText:"确定",cancelText:"取消",onOk:()=>{}});return Promise.reject(t)});const C="_smartSelectDropdown_srnp9_2",j=({dataSource:t,treeData:e,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=t||e||[],{maxTagCount:y,maxTagPlaceholder:x,showSearch:w,filterOption:N,filterTreeNode:E,treeCheckable:k,treeDefaultExpandAll:A,treeDefaultExpandedKeys:S,treeNodeFilterProp:j,..._}=b,q=r.useMemo(()=>{if(!v||!Array.isArray(v)||0===v.length)return 0;if(!v.some(t=>(t=>{const e=t[(null==h?void 0:h.children)||"children"];return Array.isArray(e)&&e.length>0})(t)))return 1;const t=(e,n=1)=>{let r=n;for(const i of e){const e=i[(null==h?void 0:h.children)||"children"];if(Array.isArray(e)&&e.length>0){const i=t(e,n+1);r=Math.max(r,i)}}return r};return t(v)},[v,h])<=1,O=r.useMemo(()=>{if(!q||!v)return[];const t=(null==h?void 0:h.label)||"label",e=(null==h?void 0:h.value)||"value";return v.map(n=>{const r={label:n[t]||n.title||n.label,value:n[e]||n.key||n.value};return Object.keys(n).forEach(t=>{["label","value"].includes(t)||(r[t]=n[t])}),r})},[v,q,h]),T=r.useMemo(()=>{if(q||!v)return[];const t=(null==h?void 0:h.label)||"label",e=(null==h?void 0:h.value)||"value",n=(null==h?void 0:h.children)||"children",r=i=>{const s={title:i[t]||i.title||i.label,value:i[e]||i.key||i.value,key:i.key||i[e]||i.value};return Object.keys(i).forEach(t=>{["title","value","key","children"].includes(t)||(s[t]=i[t])}),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 t=[C];return o&&t.push(`smart-select-${L.current}`),t.join(" ")},[o]);if(r.useEffect(()=>{if(!o)return;const t="number"==typeof o?`${o}px`:o,e=`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.${e} {\n\t\t\t\tmin-width: ${t} !important;\n\t\t\t\twidth: ${t} !important;\n\t\t\t}\n\t\t`,document.head.appendChild(i);const s=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1===e.nodeType){const n=e;(n.classList.contains("ant-select-dropdown")||n.classList.contains("ant-select-tree-dropdown"))&&I.split(" ").some(t=>n.classList.contains(t))&&(n.style.minWidth=t,n.style.width=t,setTimeout(()=>{const e=Array.from(document.querySelectorAll(".ant-select, .ant-select-selector"));let r=null,i=1/0;if(e.forEach(t=>{const e=t.getBoundingClientRect(),s=n.getBoundingClientRect(),o=Math.abs(e.bottom-s.top);o<i&&o<50&&(i=o,r=t)}),r){const e=r.getBoundingClientRect(),i=parseFloat(t),s=e.right-i,o=Math.max(0,s);n.style.left=`${o}px`,n.style.right="auto",n.style.transform="none"}else{const e=n.getBoundingClientRect(),r=parseFloat(t),i=window.innerWidth;if(e.right>i){const t=Math.max(0,i-r);n.style.left=`${t}px`,n.style.right="auto",n.style.transform="none"}}},10))}})})});return s.observe(document.body,{childList:!0,subtree:!1}),()=>{s.disconnect();const t=document.getElementById(n);t&&t.remove()}},[o,I]),q){const t=void 0!==N?N:E,e=r.useMemo(()=>t&&!0!==t?(e,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 t(e,r)}:t,[t]),o={...d,...void 0!==e&&{filterOption:e},...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?(t,e)=>{const n={...e,name:(null==e?void 0:e.name)||(null==e?void 0:e.title),code:(null==e?void 0:e.code)||(null==e?void 0:e.code),title:(null==e?void 0:e.title)||(null==e?void 0:e.name),label:(null==e?void 0:e.title)||(null==e?void 0:e.label)||(null==e?void 0:e.name)};return R(t,n)}:R,[R]),B=r.useMemo(()=>{if(!R||!0===R)return j||"title"},[R,j]),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},..._};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:_}=i.DatePicker,q=r.forwardRef(({config:t,onFinish:e,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,...b},v)=>{var y;const[x]=i.Form.useForm();r.useImperativeHandle(v,()=>x);const w=null==(y=p.getOrgInfo())?void 0:y.orgId,[N,E]=r.useState(w),k=r.useMemo(()=>t.some(t=>"deptSelect"===t.type),[t]),A=r.useMemo(()=>t.some(t=>"orgSelect"===t.type),[t]);r.useEffect(()=>{k&&L()},[N,k]),r.useEffect(()=>{A&&I()},[A]);const[C,q]=r.useState([]),[O,T]=r.useState([]),L=async()=>{const t=await S({orgId:N,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");200===t.code&&q((null==t?void 0:t.data)||[])},I=async()=>{const t=await S({loginOrgId:w,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===t.code&&T((null==t?void 0:t.data)||[])},R=t=>{const{type:e,name:r,placeholder:s,options:o,rules:l,...a}=t;switch(t.initialValue&&x.setFieldsValue({[r]:t.initialValue}),e){case"input":return n.jsx(i.Input,{placeholder:s||`请输入${t.label}`,...a});case"password":return n.jsx(i.Input.Password,{placeholder:s||`请输入${t.label}`,...a});case"select":return n.jsx(j,{allowClear:!0,placeholder:s||`请选择${t.label}`,options:o,...a});case"radio":return n.jsx(i.Radio.Group,{...a,children:null==o?void 0:o.map(t=>n.jsx(i.Radio,{value:t.value,children:t.label},t.value))});case"rangePicker":return n.jsx(_,{style:{width:"100%"},...a});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:s||`请选择${t.label}`,...a});case"treeSelect":return n.jsx(j,{style:{width:"100%"},placeholder:s||`请选择${t.label}`,treeData:t.options,...a});case"deptSelect":return n.jsx(j,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:s||`请选择${t.label}`,options:C,...a});case"orgSelect":return n.jsx(j,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:s||`请选择${t.label}`,options:O,...a});default:return n.jsx(i.Input,{placeholder:s,...a})}};return n.jsx(i.Form,{form:x,layout:c,labelCol:"horizontal"===c?u:void 0,wrapperCol:"horizontal"===c?h:void 0,onFinish:e,initialValues:l,onFieldsChange:e=>{const n=e[0].name[0],r=e[0].value,i=t.find(t=>t.name===n);if("orgSelect"===(null==i?void 0:i.type)){E(r);const t=i.connect;t&&x.setFieldsValue({[t]:""}),L()}},...b,children:n.jsxs(i.Row,{gutter:24,children:[" ",t.map(t=>n.jsxs(i.Col,{span:t.colSpan||6,children:[" ",n.jsx(i.Form.Item,{label:t.label,name:t.name,rules:t.rules,labelCol:{span:t.labelCol||5},wrapperCol:{span:t.wrapperCol||19},children:R(t)})]},t.name)),n.jsx(i.Col,{span:2,children:n.jsxs(i.Form.Item,{children:[" ",n.jsxs(i.Space,{children:[t.length>0&&n.jsx(i.Button,{type:"primary",htmlType:"submit",onClick:()=>(()=>{const e={...x.getFieldsValue()};t.forEach(t=>{var n;"radio"===t.type&&void 0!==e[t.name]&&(null==(n=t.options)?void 0:n.some(t=>"number"==typeof t.value))&&"string"==typeof e[t.name]&&/^-?\d+$/.test(e[t.name])&&(e[t.name]=parseInt(e[t.name],10))}),o&&o(e)})(),children:d}),!m&&g&&n.jsx(i.Button,{onClick:()=>(x.resetFields(),void(s&&s(x))),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(x):a]})})]})})});var O=r.createContext({});function T(){return T=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},T.apply(null,arguments)}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,s,o,l=[],a=!0,c=!1;try{if(s=(n=n.call(t)).next,0===e);else for(;!(a=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);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}}(t,e)||function(t,e){if(t){if("string"==typeof t)return L(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(t,e):void 0}}(t,e)||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 R(t){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==R(e)?e:e+""}function B(t,e,n){return(e=M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var P="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function U(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F,z,$={exports:{}};
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"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(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const n in t)if("default"!==n){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}return e.default=t,Object.freeze(e)}const h=u(r),d="currentUserId",f=(t,e)=>{if(e)return`user_${e}_${t}`;const n=localStorage.getItem(d);return n?`user_${n}_${t}`:t},p={setCurrentUserId:t=>{localStorage.setItem(d,t)},getCurrentUserId:()=>localStorage.getItem(d),getToken:()=>localStorage.getItem(f("token")),setToken:t=>{localStorage.setItem(f("token"),t)},getRefreshToken:()=>localStorage.getItem(f("refreshToken")),setRefreshToken:t=>{localStorage.setItem(f("refreshToken"),t)},removeToken:()=>{const t=p.getCurrentUserId();t&&(localStorage.removeItem(f("token",t)),localStorage.removeItem(f("userInfo",t)),localStorage.removeItem(f("refreshToken",t)))},isLoggedIn:()=>!!localStorage.getItem(f("token")),getUserInfo:()=>{const t=localStorage.getItem(f("userInfo"));return t?JSON.parse(t):null},setUserInfo:t=>{(null==t?void 0:t.userId)&&p.setCurrentUserId(t.userId),localStorage.setItem(f("userInfo"),JSON.stringify(t))},setOrgList:t=>{localStorage.setItem(f("orgList"),JSON.stringify(t))},getOrgList:()=>localStorage.getItem(f("orgList")),setFunctionAuth:t=>{localStorage.setItem(f("functionAuth"),JSON.stringify(t))},getFunctionAuth:()=>JSON.parse(localStorage.getItem(f("functionAuth"))||"[]"),setAppInfo:t=>{localStorage.setItem(f("appInfo"),JSON.stringify(t))},getAppInfo:()=>JSON.parse(localStorage.getItem(f("appInfo"))||"[]"),setOrgInfo:t=>{localStorage.setItem(f("orgInfo"),JSON.stringify(t))},getOrgInfo:()=>JSON.parse(localStorage.getItem(f("orgInfo"))||"{}"),setDeptInfo:t=>{localStorage.setItem(f("deptInfo"),JSON.stringify(t))},getDeptInfo:()=>JSON.parse(localStorage.getItem(f("deptInfo"))||"{}"),setMenu:t=>{localStorage.setItem(f("menu"),JSON.stringify(t))},getMenu:()=>JSON.parse(localStorage.getItem(f("menu"))||"[]"),setLoginConfig:t=>{localStorage.setItem("loginConfig",JSON.stringify(t))},getLoginConfig:()=>{const t=localStorage.getItem("loginConfig");return t?JSON.parse(t):null},setFavicon:t=>{try{if(!t){const e=p.getLoginConfig();t=null==e?void 0:e.loginIcon}if(!t)return;document.querySelectorAll('link[rel*="icon"]').forEach(t=>t.remove());const e=document.createElement("link");e.rel="icon",e.type="image/png",e.href=`data:image/png;base64,${t}`,document.head.appendChild(e)}catch(e){}},setWebTitle:t=>{try{if(!t){const e=p.getLoginConfig();t=null==e?void 0:e.webTitle}t&&(document.title=t)}catch(e){}},clearAuth:()=>{const t=p.getCurrentUserId();t&&(localStorage.removeItem(f("token",t)),localStorage.removeItem(f("userInfo",t)),localStorage.removeItem(f("refreshToken",t)),localStorage.removeItem(f("orgList",t)),localStorage.removeItem(f("functionAuth",t)),localStorage.removeItem(f("appInfo",t)),localStorage.removeItem(f("orgInfo",t)),localStorage.removeItem(f("deptInfo",t)),localStorage.removeItem(f("menu",t)),localStorage.removeItem(f("menu-storage",t)),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=t=>{v.forEach(e=>e(t)),v=[]},x=["/image/generateValidateCode","/sso/doLogin","/sso/refreshToken"],w=[],N=()=>{w.forEach(t=>{t.cancel("请求被取消:token已过期")}),w.length=0},E=s.create({baseURL:m,timeout:g,headers:{"Content-Type":"application/json"}}),k=async()=>{try{const t=await s.post(`${m}/account/sso/refreshToken`,{refreshToken:p.getRefreshToken()},{headers:{"Content-Type":"application/json"}});return t.data&&"object"==typeof t.data?t.data:t}catch(t){throw t}};function A(t,e,n){return E.post(t,e,n)}function S(t,e){return A(e,t)}function C(t,e){return function(t,e,n){return E.get(t,{params:e,...n})}(e,t)}E.interceptors.request.use(t=>{if(!x.some(e=>{var n;return null==(n=t.url)?void 0:n.includes(e)})){const e=p.getToken();if(!p.getRefreshToken())return i.Modal.confirm({title:"登录提示",content:"您还未登录,请先登录后再进行操作",okText:"前往登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("请先登录"));t.headers.Authorization=`Bearer ${e}`,t.headers.accessToken=`${e}`}const e=s.CancelToken.source();return t.cancelToken=e.token,w.push(e),t},t=>Promise.reject(t)),E.interceptors.response.use(async t=>{const{data:e,config:n}=t,r=w.findIndex(t=>t.token===n.cancelToken);if(r>-1&&w.splice(r,1),"blob"===n.responseType)return t;if(200===e.code)return e;if(461===e.code)return p.clearAuth(),N(),i.Modal.confirm({title:"登录已过期",content:"您的登录状态已过期,请重新登录后继续操作",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("登录已过期"));if(401!==e.code)return i.Modal.confirm({title:"操作提示",content:e.msg||`请求失败,错误码:${e.code}`,okText:"确定",cancelButtonProps:{style:{display:"none"}},onOk:()=>{}}),e;N();try{const t=await k();if(200===t.code){const e=t.data.accessToken;return p.setToken(e),y(e),n.headers.Authorization=`Bearer ${e}`,n.headers.accessToken=e,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 t=>{if(s.isCancel(t))return Promise.reject(t);if(t.response){const{status:n,config:r}=t.response;if(401===n&&!x.some(t=>{var e;return null==(e=r.url)?void 0:e.includes(t)})){if(b)return new Promise(t=>{var e;e=e=>{r.headers.Authorization=`Bearer ${e}`,r.headers.accessToken=e,t(E(r))},v.push(e)});b=!0;try{const t=await k();if(200===t.code){const e=t.data.accessToken;return p.setToken(e),y(e),r.headers.Authorization=`Bearer ${e}`,r.headers.accessToken=e,E(r)}return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("刷新token失败"))}catch(e){return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(e)}finally{b=!1}}}else t.request&&i.Modal.confirm({title:"网络异常",content:"请求超时或网络不可用,请检查您的网络连接后重试",okText:"确定",cancelText:"取消",onOk:()=>{}});return Promise.reject(t)});const j="_smartSelectDropdown_srnp9_2",_=({dataSource:t,treeData:e,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=t||e||[],{maxTagCount:y,maxTagPlaceholder:x,showSearch:w,filterOption:N,filterTreeNode:E,treeCheckable:k,treeDefaultExpandAll:A,treeDefaultExpandedKeys:S,treeNodeFilterProp:C,..._}=b,q=r.useMemo(()=>{if(!v||!Array.isArray(v)||0===v.length)return 0;if(!v.some(t=>(t=>{const e=t[(null==h?void 0:h.children)||"children"];return Array.isArray(e)&&e.length>0})(t)))return 1;const t=(e,n=1)=>{let r=n;for(const i of e){const e=i[(null==h?void 0:h.children)||"children"];if(Array.isArray(e)&&e.length>0){const i=t(e,n+1);r=Math.max(r,i)}}return r};return t(v)},[v,h])<=1,O=r.useMemo(()=>{if(!q||!v)return[];const t=(null==h?void 0:h.label)||"label",e=(null==h?void 0:h.value)||"value";return v.map(n=>{const r={label:n[t]||n.title||n.label,value:n[e]||n.key||n.value};return Object.keys(n).forEach(t=>{["label","value"].includes(t)||(r[t]=n[t])}),r})},[v,q,h]),T=r.useMemo(()=>{if(q||!v)return[];const t=(null==h?void 0:h.label)||"label",e=(null==h?void 0:h.value)||"value",n=(null==h?void 0:h.children)||"children",r=i=>{const s={title:i[t]||i.title||i.label,value:i[e]||i.key||i.value,key:i.key||i[e]||i.value};return Object.keys(i).forEach(t=>{["title","value","key","children"].includes(t)||(s[t]=i[t])}),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 t=[j];return o&&t.push(`smart-select-${L.current}`),t.join(" ")},[o]);if(r.useEffect(()=>{if(!o)return;const t="number"==typeof o?`${o}px`:o,e=`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.${e} {\n\t\t\t\tmin-width: ${t} !important;\n\t\t\t\twidth: ${t} !important;\n\t\t\t}\n\t\t`,document.head.appendChild(i);const s=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1===e.nodeType){const n=e;(n.classList.contains("ant-select-dropdown")||n.classList.contains("ant-select-tree-dropdown"))&&I.split(" ").some(t=>n.classList.contains(t))&&(n.style.minWidth=t,n.style.width=t,setTimeout(()=>{const e=Array.from(document.querySelectorAll(".ant-select, .ant-select-selector"));let r=null,i=1/0;if(e.forEach(t=>{const e=t.getBoundingClientRect(),s=n.getBoundingClientRect(),o=Math.abs(e.bottom-s.top);o<i&&o<50&&(i=o,r=t)}),r){const e=r.getBoundingClientRect(),i=parseFloat(t),s=e.right-i,o=Math.max(0,s);n.style.left=`${o}px`,n.style.right="auto",n.style.transform="none"}else{const e=n.getBoundingClientRect(),r=parseFloat(t),i=window.innerWidth;if(e.right>i){const t=Math.max(0,i-r);n.style.left=`${t}px`,n.style.right="auto",n.style.transform="none"}}},10))}})})});return s.observe(document.body,{childList:!0,subtree:!1}),()=>{s.disconnect();const t=document.getElementById(n);t&&t.remove()}},[o,I]),q){const t=void 0!==N?N:E,e=r.useMemo(()=>t&&!0!==t?(e,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 t(e,r)}:t,[t]),o={...d,...void 0!==e&&{filterOption:e},...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?(t,e)=>{const n={...e,name:(null==e?void 0:e.name)||(null==e?void 0:e.title),code:(null==e?void 0:e.code)||(null==e?void 0:e.code),title:(null==e?void 0:e.title)||(null==e?void 0:e.name),label:(null==e?void 0:e.title)||(null==e?void 0:e.label)||(null==e?void 0:e.name)};return R(t,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},..._};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:t,onFinish:e,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,...b},v)=>{var y;const[x]=i.Form.useForm();r.useImperativeHandle(v,()=>x);const w=null==(y=p.getOrgInfo())?void 0:y.orgId,[N,E]=r.useState(w),k=r.useMemo(()=>t.some(t=>"deptSelect"===t.type),[t]),A=r.useMemo(()=>t.some(t=>"orgSelect"===t.type),[t]);r.useEffect(()=>{k&&L()},[N,k]),r.useEffect(()=>{A&&I()},[A]);const[C,j]=r.useState([]),[O,T]=r.useState([]),L=async()=>{const t=await S({orgId:N,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");200===t.code&&j((null==t?void 0:t.data)||[])},I=async()=>{const t=await S({loginOrgId:w,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===t.code&&T((null==t?void 0:t.data)||[])},R=t=>{const{type:e,name:r,placeholder:s,options:o,rules:l,...a}=t;switch(t.initialValue&&x.setFieldsValue({[r]:t.initialValue}),e){case"input":return n.jsx(i.Input,{placeholder:s||`请输入${t.label}`,...a});case"password":return n.jsx(i.Input.Password,{placeholder:s||`请输入${t.label}`,...a});case"select":return n.jsx(_,{allowClear:!0,placeholder:s||`请选择${t.label}`,options:o,...a});case"radio":return n.jsx(i.Radio.Group,{...a,children:null==o?void 0:o.map(t=>n.jsx(i.Radio,{value:t.value,children:t.label},t.value))});case"rangePicker":return n.jsx(q,{style:{width:"100%"},...a});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:s||`请选择${t.label}`,...a});case"treeSelect":return n.jsx(_,{style:{width:"100%"},placeholder:s||`请选择${t.label}`,treeData:t.options,...a});case"deptSelect":return n.jsx(_,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:s||`请选择${t.label}`,options:C,...a});case"orgSelect":return n.jsx(_,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:s||`请选择${t.label}`,options:O,...a});default:return n.jsx(i.Input,{placeholder:s,...a})}};return n.jsx(i.Form,{form:x,layout:c,labelCol:"horizontal"===c?u:void 0,wrapperCol:"horizontal"===c?h:void 0,onFinish:e,initialValues:l,onFieldsChange:e=>{const n=e[0].name[0],r=e[0].value,i=t.find(t=>t.name===n);if("orgSelect"===(null==i?void 0:i.type)){E(r);const t=i.connect;t&&x.setFieldsValue({[t]:""}),L()}},...b,children:n.jsxs(i.Row,{gutter:24,children:[" ",t.map(t=>n.jsxs(i.Col,{span:t.colSpan||6,children:[" ",n.jsx(i.Form.Item,{label:t.label,name:t.name,rules:t.rules,labelCol:{span:t.labelCol||5},wrapperCol:{span:t.wrapperCol||19},children:R(t)})]},t.name)),n.jsx(i.Col,{span:2,children:n.jsxs(i.Form.Item,{children:[" ",n.jsxs(i.Space,{children:[t.length>0&&n.jsx(i.Button,{type:"primary",htmlType:"submit",onClick:()=>(()=>{const e={...x.getFieldsValue()};t.forEach(t=>{var n;"radio"===t.type&&void 0!==e[t.name]&&(null==(n=t.options)?void 0:n.some(t=>"number"==typeof t.value))&&"string"==typeof e[t.name]&&/^-?\d+$/.test(e[t.name])&&(e[t.name]=parseInt(e[t.name],10))}),o&&o(e)})(),children:d}),!m&&g&&n.jsx(i.Button,{onClick:()=>(x.resetFields(),void(s&&s(x))),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(x):a]})})]})})});var T=r.createContext({});function L(){return L=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},L.apply(null,arguments)}function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function R(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,s,o,l=[],a=!0,c=!1;try{if(s=(n=n.call(t)).next,0===e);else for(;!(a=(r=s.call(n)).done)&&(l.push(r.value),l.length!==e);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}}(t,e)||function(t,e){if(t){if("string"==typeof t)return I(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(t,e):void 0}}(t,e)||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(t){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t){var e=function(t,e){if("object"!=M(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==M(e)?e:e+""}function D(t,e,n){return(e=B(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function P(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function F(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var z,$,V={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 V=U((F||(F=1,z=$,function(){var t={}.hasOwnProperty;function e(){for(var t="",e=0;e<arguments.length;e++){var i=arguments[e];i&&(t=r(t,n(i)))}return t}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return e.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)t.call(n,s)&&n[s]&&(i=r(i,s));return i}function r(t,e){return e?t?t+" "+e:t+e:t}z.exports?(e.default=e,z.exports=e):window.classNames=e}()),$.exports)),H=Math.round;function K(t,e){const n=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(t=>parseFloat(t));for(let i=0;i<3;i+=1)r[i]=e(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const W=(t,e,n)=>0===n?t:t/100;function Z(t,e){const n=e||255;return t>n?n:t<0?0:t}class G{constructor(t){function e(e){return e[0]in t&&e[1]in t&&e[2]in t}if(B(this,"isValid",!0),B(this,"r",0),B(this,"g",0),B(this,"b",0),B(this,"a",1),B(this,"_h",void 0),B(this,"_s",void 0),B(this,"_l",void 0),B(this,"_v",void 0),B(this,"_max",void 0),B(this,"_min",void 0),B(this,"_brightness",void 0),t)if("string"==typeof t){let e=function(t){return n.startsWith(t)};const n=t.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):e("rgb")?this.fromRgbString(n):e("hsl")?this.fromHslString(n):(e("hsv")||e("hsb"))&&this.fromHsvString(n)}else if(t instanceof G)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(e("rgb"))this.r=Z(t.r),this.g=Z(t.g),this.b=Z(t.b),this.a="number"==typeof t.a?Z(t.a,1):1;else if(e("hsl"))this.fromHsl(t);else{if(!e("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t));this.fromHsv(t)}else;}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const e=this.toHsv();return e.h=t,this._c(e)}getLuminance(){function t(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*t(this.r)+.7152*t(this.g)+.0722*t(this.b)}getHue(){if(void 0===this._h){const t=this.getMax()-this.getMin();this._h=0===t?0:H(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(void 0===this._s){const t=this.getMax()-this.getMin();this._s=0===t?0:t/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(t=10){const e=this.getHue(),n=this.getSaturation();let r=this.getLightness()-t/100;return r<0&&(r=0),this._c({h:e,s:n,l:r,a:this.a})}lighten(t=10){const e=this.getHue(),n=this.getSaturation();let r=this.getLightness()+t/100;return r>1&&(r=1),this._c({h:e,s:n,l:r,a:this.a})}mix(t,e=50){const n=this._c(t),r=e/100,i=t=>(n[t]-this[t])*r+this[t],s={r:H(i("r")),g:H(i("g")),b:H(i("b")),a:H(100*i("a"))/100};return this._c(s)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const e=this._c(t),n=this.a+e.a*(1-this.a),r=t=>H((this[t]*this.a+e[t]*e.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(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const e=(this.r||0).toString(16);t+=2===e.length?e:"0"+e;const n=(this.g||0).toString(16);t+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(t+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const e=H(255*this.a).toString(16);t+=2===e.length?e:"0"+e}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),e=H(100*this.getSaturation()),n=H(100*this.getLightness());return 1!==this.a?`hsla(${t},${e}%,${n}%,${this.a})`:`hsl(${t},${e}%,${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(t,e,n){const r=this.clone();return r[t]=Z(e,n),r}_c(t){return new this.constructor(t)}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(t){const e=t.replace("#","");function n(t,n){return parseInt(e[t]+e[n||t],16)}e.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=e[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=e[6]?n(6,7)/255:1)}fromHsl({h:t,s:e,l:n,a:r}){if(this._h=t%360,this._s=e,this._l=n,this.a="number"==typeof r?r:1,e<=0){const t=H(255*n);this.r=t,this.g=t,this.b=t}let i=0,s=0,o=0;const l=t/60,a=(1-Math.abs(2*n-1))*e,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=H(255*(i+u)),this.g=H(255*(s+u)),this.b=H(255*(o+u))}fromHsv({h:t,s:e,v:n,a:r}){this._h=t%360,this._s=e,this._v=n,this.a="number"==typeof r?r:1;const i=H(255*n);if(this.r=i,this.g=i,this.b=i,e<=0)return;const s=t/60,o=Math.floor(s),l=s-o,a=H(n*(1-e)*255),c=H(n*(1-e*l)*255),u=H(n*(1-e*(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(t){const e=K(t,W);this.fromHsv({h:e[0],s:e[1],v:e[2],a:e[3]})}fromHslString(t){const e=K(t,W);this.fromHsl({h:e[0],s:e[1],l:e[2],a:e[3]})}fromRgbString(t){const e=K(t,(t,e)=>e.includes("%")?H(t/100*255):t);this.r=e[0],this.g=e[1],this.b=e[2],this.a=e[3]}}var Y=[{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 J(t,e,n){var r;return(r=Math.round(t.h)>=60&&Math.round(t.h)<=240?n?Math.round(t.h)-2*e:Math.round(t.h)+2*e:n?Math.round(t.h)+2*e:Math.round(t.h)-2*e)<0?r+=360:r>=360&&(r-=360),r}function X(t,e,n){return 0===t.h&&0===t.s?t.s:((r=n?t.s-.16*e:4===e?t.s+.16:t.s+.05*e)>1&&(r=1),n&&5===e&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function Q(t,e,n){var r;return r=n?t.v+.05*e:t.v-.15*e,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var tt=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function nt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?et(Object(n),!0).forEach(function(e){B(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):et(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}tt.primary=tt[5];var rt="data-rc-order",it="data-rc-priority",st=new Map;function ot(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return t?t.startsWith("data-")?t:"data-".concat(t):"rc-util-key"}function lt(t){return t.attachTo?t.attachTo:document.querySelector("head")||document.body}function at(t){return Array.from((st.get(t)||t).children).filter(function(t){return"STYLE"===t.tagName})}function ct(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=e.csp,r=e.prepend,i=e.priority,s=void 0===i?0:i,o=function(t){return"queue"===t?"prependQueue":t?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(rt,o),l&&s&&a.setAttribute(it,"".concat(s)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=t;var c=lt(e),u=c.firstChild;if(r){if(l){var h=(e.styles||at(c)).filter(function(t){if(!["prepend","prependQueue"].includes(t.getAttribute(rt)))return!1;var e=Number(t.getAttribute(it)||0);return s>=e});if(h.length)return c.insertBefore(a,h[h.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function ut(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=lt(n),i=at(r),s=nt(nt({},n),{},{styles:i});!function(t,e){var n=st.get(t);if(!n||!function(t,e){if(!t)return!1;if(t.contains)return t.contains(e);for(var n=e;n;){if(n===t)return!0;n=n.parentNode}return!1}(document,n)){var r=ct("",e),i=r.parentNode;st.set(t,i),t.removeChild(r)}}(r,s);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=lt(e);return(e.styles||at(n)).find(function(n){return n.getAttribute(ot(e))===t})}(e,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!==t&&(o.innerHTML=t),o}var u=ct(t,s);return u.setAttribute(ot(s),e),u}function ht(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}function dt(t){return function(t){return ht(t)instanceof ShadowRoot}(t)?ht(t):null}var ft={},pt=[];function mt(t,e){if("production"!==process.env.NODE_ENV&&!t&&void 0!==console)pt.reduce(function(t,e){return e(null!=t?t:"","warning")},e)}function gt(t,e){if("production"!==process.env.NODE_ENV&&!t&&void 0!==console)pt.reduce(function(t,e){return e(null!=t?t:"","note")},e)}function bt(t,e,n){e||ft[n]||(t(!1,n),ft[n]=!0)}function vt(t,e){bt(mt,t,e)}function yt(t){return"object"===R(t)&&"string"==typeof t.name&&"string"==typeof t.theme&&("object"===R(t.icon)||"function"==typeof t.icon)}function xt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(t).reduce(function(e,n){var r,i=t[n];if("class"===n)e.className=i,delete e.class;else delete e[n],e[(r=n,r.replace(/-(.)/g,function(t,e){return e.toUpperCase()}))]=i;return e},{})}function wt(t,e,n){return n?r.createElement(t.tag,nt(nt({key:e},xt(t.attrs)),n),(t.children||[]).map(function(n,r){return wt(n,"".concat(e,"-").concat(t.tag,"-").concat(r))})):r.createElement(t.tag,nt({key:e},xt(t.attrs)),(t.children||[]).map(function(n,r){return wt(n,"".concat(e,"-").concat(t.tag,"-").concat(r))}))}function Nt(t){return function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new G(t),i=r.toHsv(),s=5;s>0;s-=1){var o=new G({h:J(i,s,!0),s:X(i,s,!0),v:Q(i,s,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new G({h:J(i,l),s:X(i,l),v:Q(i,l)});n.push(a)}return"dark"===e.theme?Y.map(function(t){var r=t.index,i=t.amount;return new G(e.backgroundColor||"#141414").mix(n[r],i).toHexString()}):n.map(function(t){return t.toHexString()})}(t)[0]}function Et(t){return t?Array.isArray(t)?t:[t]:[]}vt.preMessage=function(t){pt.push(t)},vt.resetWarned=function(){ft={}},vt.noteOnce=function(t,e){bt(gt,t,e)};var kt=["icon","className","onClick","style","primaryColor","secondaryColor"],At={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var St=function(t){var e,n,i,s,o,l,a,c,u=t.icon,d=t.className,f=t.onClick,p=t.style,m=t.primaryColor,g=t.secondaryColor,b=D(t,kt),v=h.useRef(),y=At;if(m&&(y={primaryColor:m,secondaryColor:g||Nt(m)}),e=v,n=r.useContext(O),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 t=dt(e.current);ut(l,"@ant-design-icons",{prepend:!o,csp:i,attachTo:t})},[]),a=yt(u),c="icon should be icon definiton, but got ".concat(u),vt(a,"[@ant-design/icons] ".concat(c)),!yt(u))return null;var x=u;return x&&"function"==typeof x.icon&&(x=nt(nt({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),wt(x.icon,"svg-".concat(x.name),nt(nt({className:d,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},b),{},{ref:v}))};function Ct(t){var e=I(Et(t),2),n=e[0],r=e[1];return St.setTwoToneColors({primaryColor:n,secondaryColor:r})}St.displayName="IconReact",St.getTwoToneColors=function(){return nt({},At)},St.setTwoToneColors=function(t){var e=t.primaryColor,n=t.secondaryColor;At.primaryColor=e,At.secondaryColor=n||Nt(e),At.calculated=!!n};var jt=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];Ct(tt.primary);var _t=h.forwardRef(function(t,e){var n=t.className,r=t.icon,i=t.spin,s=t.rotate,o=t.tabIndex,l=t.onClick,a=t.twoToneColor,c=D(t,jt),u=h.useContext(O),d=u.prefixCls,f=void 0===d?"anticon":d,p=u.rootClassName,m=V(p,f,B(B({},"".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=I(Et(a),2),y=v[0],x=v[1];return h.createElement("span",T({role:"img","aria-label":r.name},c,{ref:e,tabIndex:g,onClick:l,className:m}),h.createElement(St,{icon:r,primaryColor:y,secondaryColor:x,style:b}))});_t.displayName="AntdIcon",_t.getTwoToneColor=function(){var t=St.getTwoToneColors();return t.calculated?[t.primaryColor,t.secondaryColor]:t.primaryColor},_t.setTwoToneColor=Ct;var qt={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"},Ot=function(t,e){return h.createElement(_t,T({},t,{ref:e,icon:qt}))},Tt=h.forwardRef(Ot);"production"!==process.env.NODE_ENV&&(Tt.displayName="DownOutlined");var Lt={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"},It=function(t,e){return h.createElement(_t,T({},t,{ref:e,icon:Lt}))},Rt=h.forwardRef(It);"production"!==process.env.NODE_ENV&&(Rt.displayName="PlusOutlined");var Mt={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"},Bt=function(t,e){return h.createElement(_t,T({},t,{ref:e,icon:Mt}))},Dt=h.forwardRef(Bt);"production"!==process.env.NODE_ENV&&(Dt.displayName="RightOutlined");var Pt={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"},Ut=function(t,e){return h.createElement(_t,T({},t,{ref:e,icon:Pt}))},Ft=h.forwardRef(Ut);"production"!==process.env.NODE_ENV&&(Ft.displayName="SettingOutlined");var zt={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"},$t=function(t,e){return h.createElement(_t,T({},t,{ref:e,icon:zt}))},Vt=h.forwardRef($t);"production"!==process.env.NODE_ENV&&(Vt.displayName="UploadOutlined");const{Option:Ht}=i.Select,Kt=({columns:t,dataSource:e,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([]),[k,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==t?void 0:t.map(t=>t.dataIndex||t.key).join(","))||"",[t]),I=r.useCallback(async()=>{var e,n,r;const i=(null==t?void 0:t.map((t,e)=>({key:t.key||t.dataIndex||`col-${e}`,title:t.title,dataIndex:t.dataIndex,displayTitle:"string"==typeof t.title?t.title:`列 ${e+1}`,headerAlignment:t.align||"left",contentAlignment:t.align||"left",dataFormat:"字符串",width:t.width||100,enabled:!0,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:e+1,render:t.render,fixed:t.fixed,originalColumn:{...t}})))||[];if(E(i),t.length>1)try{if(l){const o=await(s={userId:q.userId,tableId:l||""},A("/platform/business/common/getTableConfigByUser",s));if(null==(e=null==o?void 0:o.data)?void 0:e.content){const e=null==(r=JSON.parse(null==(n=null==o?void 0:o.data)?void 0:n.content))?void 0:r.map(e=>{var n;const r=null==(n=t.find(t=>t.key===e.key))?void 0:n.render;return{...e,render:r,originalColumn:{...e.originalColumn,render:r}}});w(e),S(e)}else w(i),S(i)}else w(i),S(i)}catch(o){w(i),S(i)}else w(i),S(i);var s},[t,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 t=x.filter(t=>t.enabled).sort((t,e)=>t.sort-e.sort).map(t=>({...t.originalColumn,key:t.key,title:t.displayTitle,dataIndex:t.dataIndex,align:t.contentAlignment,width:Number(t.width)})),e=[...h?[{title:n.jsxs(i.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(i.Tooltip,{title:"表格配置",children:n.jsx(Ft,{onClick:()=>y(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(t,e,r)=>n.jsx(n.Fragment,{children:n.jsx(n.Fragment,{children:t||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+r+1||r+1})})}]:[],...t].map(t=>{const e=t.render;return{...t,render:(s,o,l)=>e?e(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:t.width,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s?String(s):""})}):""}});m(e)},[x,h,u]),r.useEffect(()=>{const t=null==e?void 0:e.map((t,e)=>({...t,parentId:(null==t?void 0:t.parentId)||null,id:(null==t?void 0:t.id)||e+1,INDEX:(null==t?void 0:t.INDEX)||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+e+1||e+1}));_(null==t?void 0:t.map(t=>t.id)),b(t)},[e]);const M=r.useRef(null),B=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(t,e)=>n.jsx(i.Input,{size:"small",defaultValue:t,onBlur:t=>D(e.key,"displayTitle",t.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(t,e)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:t,onChange:t=>D(e.key,"headerAlignment",t.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:(t,e)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:t,onChange:t=>D(e.key,"contentAlignment",t.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:(t,e)=>n.jsxs(i.Select,{size:"small",defaultValue:t,style:{width:80},onChange:t=>D(e.key,"dataFormat",t),children:[n.jsx(Ht,{value:"字符串",children:"字符串"}),n.jsx(Ht,{value:"数字",children:"数字"}),n.jsx(Ht,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(t,e)=>n.jsx(i.InputNumber,{size:"small",defaultValue:t,style:{width:60},onBlur:t=>D(e.key,"width",t.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(t,e)=>n.jsx(i.Switch,{size:"small",defaultValue:t,onChange:t=>D(e.key,"enabled",t)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(t,e)=>n.jsx(i.Switch,{size:"small",defaultValue:t,onChange:t=>D(e.key,"allowSorting",t)})},{title:"排序",dataIndex:"sort",key:"sort",render:(t,e)=>n.jsx(i.InputNumber,{size:"small",defaultValue:t,style:{width:60},onBlur:t=>D(e.key,"sort",t.target.value)})}],D=(t,e,n)=>{S(r=>r.map(r=>r.key===t?{...r,[e]:n}:r))},P=async()=>{try{const e=await(t={tableId:l||"",userId:null==q?void 0:q.userId,content:JSON.stringify(k)},A("/platform/business/common/saveUserTableConfig",t));w(k),200===(null==e?void 0:e.code)&&(i.message.success("保存成功"),R())}catch(e){}var t},U=()=>{y(!1)},F=(t,e=!1)=>{_(e?j.filter(e=>e!==(null==t?void 0:t.id)):[...j,null==t?void 0:t.id])};return n.jsxs(n.Fragment,{children:[n.jsx(i.Table,{columns:f,dataSource:g,bordered:!0,rowKey:"id",pagination:s,size:"small",onRow:t=>({onClick:e=>{c&&c(t,e)}}),expandable:{expandedRowKeys:j,expandIcon:({expanded:t,onExpand:e,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 t?n.jsx(Tt,{onClick:t=>{e(r,t),F(r,!0)},style:i}):n.jsx(Dt,{onClick:t=>{e(r,t),F(r,!1)},style:i})}return null}},...d}),n.jsx(i.Modal,{title:"表格设置",visible:v,footer:[n.jsx(i.Button,{onClick:async()=>{var t;200===(await(t={userId:q.userId,tableId:l||""},A("/platform/business/common/restoreDefaultTableConfig",t))).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:k.filter(t=>!t.isBuiltIn),rowKey:"key",size:"small",pagination:!1,bordered:!0})})})})]})},Wt=({label:t,id:e,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),[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,z]=r.useState(""),[$,V]=r.useState({}),H=r.useCallback(t=>{o&&o(t)},[o]),K=r.useCallback(async(t,e)=>{switch(t){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:t,parent:e.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(t=>({value:t.code,label:t.name})):[]}catch(n){return[]}finally{switch(t){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(t=>{c(t),$&&(h(s.addProvinceCode),m(s.addProvince))})},[]),r.useEffect(()=>{$&&(A($.addCityCode),T($.addCountyCode),D($.addStreetCode),b($.addCity),y($.addCounty),w($.addStreet),z($.address))},[$]),r.useEffect(()=>{u?K(2,u).then(t=>{E(t),$&&(A($.addCityCode),b($.addCity))}):(b(void 0),y(void 0),w(void 0),m(void 0),z(""),A(void 0),E([]),T(void 0),q([]),D(void 0),M([]))},[u,K]),r.useEffect(()=>{k?K(3,k).then(t=>{q(t),$&&(T($.addCountyCode),y($.addCounty))}):(T(void 0),q([]),D(void 0),M([]),z(""))},[k,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(t=>{M(t),$&&(D($.addStreetCode),w($.addStreet),z($.address))}):(D(void 0),M([]),z(""))},[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:k,addCounty:v,addCountyCode:O,addStreet:x,addStreetCode:B,address:F})},[p,g,v,u,k,O,B,x,F]);return n.jsxs("div",{children:[" ",n.jsxs(i.Space,{wrap:!0,id:e,children:[" ",n.jsx(i.Select,{style:{minWidth:100},options:a,value:u,onChange:t=>{var e;t===u&&void 0!==t||(h(t),m(null==(e=a.find(e=>e.value===t))?void 0:e.label))},placeholder:"请选择省",loading:d,disabled:l,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:N,value:k,onChange:t=>{var e;t===k&&void 0!==t||(b(null==(e=N.find(e=>e.value===t))?void 0:e.label),A(t))},placeholder:"请选择市",loading:C,disabled:l||!u||d,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:_,value:O,onChange:t=>{var e;t===O&&void 0!==t||(T(t),y(null==(e=_.find(e=>e.value===t))?void 0:e.label))},placeholder:"请选择区/县",loading:L,disabled:l||!k||C,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:R,value:B,onChange:t=>{var e;t===B&&void 0!==t||(D(t),w(null==(e=R.find(e=>e.value===t))?void 0:e.label))},placeholder:"请选择乡/镇",loading:P,disabled:l||!O||L,allowClear:!0}),n.jsx(i.Input,{placeholder:"请输入详细地址",disabled:l||!B,value:F,onChange:t=>z(t.target.value)})]})]})},Zt=({value:t,onChange:e,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(t?[{uid:"-1",name:"image.png",status:"done",url:t}]:[])},[t]);const v=r.useCallback(t=>{e&&e(t)},[e]),y=n.jsxs("div",{children:[n.jsx(Rt,{}),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 t=>{t.url||t.preview||t.originFileObj&&(t.preview=await(t=>new Promise((e,n)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(r.result),r.onerror=t=>n(t)}))(t.originFileObj)),f(t.url||t.preview),h(!0),m(t.name||t.url.substring(t.url.lastIndexOf("/")+1))},onChange:({file:t,fileList:e})=>{var n,r;if(b(e),"done"===t.status){const r=null==(n=t.response)?void 0:n.data;r?(i.message.success(`${t.name} 文件上传成功`),null==v||v(r)):(i.message.error(`${t.name} 文件上传成功,但未获取到 URL。`),b(e.filter(e=>e.uid!==t.uid)))}else"removed"===t.status?(i.message.success(`${t.name} 文件已移除`),null==v||v(void 0)):"error"===t.status&&(i.message.error(`${t.name} 文件上传失败: ${(null==(r=t.error)?void 0:r.message)||"未知错误"}`),null==v||v(void 0))},customRequest:async t=>{const{onSuccess:e,onError:n,file:r,onProgress:s}=t;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 t=await(l=o,a={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t=>{t.total&&s({percent:t.loaded/t.total*100})}},A("/platform/general/upload",l,a));t&&t.data?(null==v||v(t.data),e(t,r)):n(new Error("上传成功但响应中缺少图片URL"),t)}catch(c){n(c)}var l,a},maxCount:l,disabled:c,onRemove:t=>!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 Gt="object"==typeof global&&global&&global.Object===Object&&global,Yt="object"==typeof self&&self&&self.Object===Object&&self,Jt=Gt||Yt||Function("return this")(),Xt=Jt.Symbol,Qt=Object.prototype,te=Qt.hasOwnProperty,ee=Qt.toString,ne=Xt?Xt.toStringTag:void 0;var re=Object.prototype.toString;var ie=Xt?Xt.toStringTag:void 0;function se(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":ie&&ie in Object(t)?function(t){var e=te.call(t,ne),n=t[ne];try{t[ne]=void 0;var r=!0}catch(s){}var i=ee.call(t);return r&&(e?t[ne]=n:delete t[ne]),i}(t):function(t){return re.call(t)}(t)}function oe(t){return null!=t&&"object"==typeof t}var le=Array.isArray;function ae(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ce(t){return t}function ue(t){if(!ae(t))return!1;var e=se(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var he,de=Jt["__core-js_shared__"],fe=(he=/[^.]+$/.exec(de&&de.keys&&de.keys.IE_PROTO||""))?"Symbol(src)_1."+he:"";var pe=Function.prototype.toString;function me(t){if(null!=t){try{return pe.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var ge=/^\[object .+?Constructor\]$/,be=Function.prototype,ve=Object.prototype,ye=be.toString,xe=ve.hasOwnProperty,we=RegExp("^"+ye.call(xe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ne(t){return!(!ae(t)||(e=t,fe&&fe in e))&&(ue(t)?we:ge).test(me(t));var e}function Ee(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ne(n)?n:void 0}var ke=Ee(Jt,"WeakMap"),Ae=Object.create,Se=function(){function t(){}return function(e){if(!ae(e))return{};if(Ae)return Ae(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Ce=Date.now;var je,_e,qe,Oe=function(){try{var t=Ee(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),Te=Oe?function(t,e){return Oe(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:ce,Le=(je=Te,_e=0,qe=0,function(){var t=Ce(),e=16-(t-qe);if(qe=t,e>0){if(++_e>=800)return arguments[0]}else _e=0;return je.apply(void 0,arguments)});var Ie=/^(?:0|[1-9]\d*)$/;function Re(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ie.test(t))&&t>-1&&t%1==0&&t<e}function Me(t,e,n){"__proto__"==e&&Oe?Oe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Be(t,e){return t===e||t!=t&&e!=e}var De=Object.prototype.hasOwnProperty;function Pe(t,e,n){var r=t[e];De.call(t,e)&&Be(r,n)&&(void 0!==n||e in t)||Me(t,e,n)}var Ue=Math.max;function Fe(t,e){return Le(function(t,e,n){return e=Ue(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=Ue(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=n(o),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,l)}}(t,e,ce),t+"")}function ze(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function $e(t){return null!=t&&ze(t.length)&&!ue(t)}var Ve=Object.prototype;function He(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ve)}function Ke(t){return oe(t)&&"[object Arguments]"==se(t)}var We=Object.prototype,Ze=We.hasOwnProperty,Ge=We.propertyIsEnumerable,Ye=Ke(function(){return arguments}())?Ke:function(t){return oe(t)&&Ze.call(t,"callee")&&!Ge.call(t,"callee")};var Je="object"==typeof exports&&exports&&!exports.nodeType&&exports,Xe=Je&&"object"==typeof module&&module&&!module.nodeType&&module,Qe=Xe&&Xe.exports===Je?Jt.Buffer:void 0,tn=(Qe?Qe.isBuffer:void 0)||function(){return!1},en={};function nn(t){return function(e){return t(e)}}en["[object Float32Array]"]=en["[object Float64Array]"]=en["[object Int8Array]"]=en["[object Int16Array]"]=en["[object Int32Array]"]=en["[object Uint8Array]"]=en["[object Uint8ClampedArray]"]=en["[object Uint16Array]"]=en["[object Uint32Array]"]=!0,en["[object Arguments]"]=en["[object Array]"]=en["[object ArrayBuffer]"]=en["[object Boolean]"]=en["[object DataView]"]=en["[object Date]"]=en["[object Error]"]=en["[object Function]"]=en["[object Map]"]=en["[object Number]"]=en["[object Object]"]=en["[object RegExp]"]=en["[object Set]"]=en["[object String]"]=en["[object WeakMap]"]=!1;var rn="object"==typeof exports&&exports&&!exports.nodeType&&exports,sn=rn&&"object"==typeof module&&module&&!module.nodeType&&module,on=sn&&sn.exports===rn&&Gt.process,ln=function(){try{var t=sn&&sn.require&&sn.require("util").types;return t||on&&on.binding&&on.binding("util")}catch(e){}}(),an=ln&&ln.isTypedArray,cn=an?nn(an):function(t){return oe(t)&&ze(t.length)&&!!en[se(t)]},un=Object.prototype.hasOwnProperty;function hn(t,e){var n=le(t),r=!n&&Ye(t),i=!n&&!r&&tn(t),s=!n&&!r&&!i&&cn(t),o=n||r||i||s,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!e&&!un.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Re(c,a))||l.push(c);return l}function dn(t,e){return function(n){return t(e(n))}}var fn=dn(Object.keys,Object),pn=Object.prototype.hasOwnProperty;function mn(t){return $e(t)?hn(t):function(t){if(!He(t))return fn(t);var e=[];for(var n in Object(t))pn.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var gn=Object.prototype.hasOwnProperty;function bn(t){if(!ae(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=He(t),n=[];for(var r in t)("constructor"!=r||!e&&gn.call(t,r))&&n.push(r);return n}function vn(t){return $e(t)?hn(t,!0):bn(t)}var yn=Ee(Object,"create");var xn=Object.prototype.hasOwnProperty;var wn=Object.prototype.hasOwnProperty;function Nn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function En(t,e){for(var n=t.length;n--;)if(Be(t[n][0],e))return n;return-1}Nn.prototype.clear=function(){this.__data__=yn?yn(null):{},this.size=0},Nn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Nn.prototype.get=function(t){var e=this.__data__;if(yn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xn.call(e,t)?e[t]:void 0},Nn.prototype.has=function(t){var e=this.__data__;return yn?void 0!==e[t]:wn.call(e,t)},Nn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=yn&&void 0===e?"__lodash_hash_undefined__":e,this};var kn=Array.prototype.splice;function An(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}An.prototype.clear=function(){this.__data__=[],this.size=0},An.prototype.delete=function(t){var e=this.__data__,n=En(e,t);return!(n<0)&&(n==e.length-1?e.pop():kn.call(e,n,1),--this.size,!0)},An.prototype.get=function(t){var e=this.__data__,n=En(e,t);return n<0?void 0:e[n][1]},An.prototype.has=function(t){return En(this.__data__,t)>-1},An.prototype.set=function(t,e){var n=this.__data__,r=En(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var Sn=Ee(Jt,"Map");function Cn(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function jn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}jn.prototype.clear=function(){this.size=0,this.__data__={hash:new Nn,map:new(Sn||An),string:new Nn}},jn.prototype.delete=function(t){var e=Cn(this,t).delete(t);return this.size-=e?1:0,e},jn.prototype.get=function(t){return Cn(this,t).get(t)},jn.prototype.has=function(t){return Cn(this,t).has(t)},jn.prototype.set=function(t,e){var n=Cn(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var _n=dn(Object.getPrototypeOf,Object),qn=Function.prototype,On=Object.prototype,Tn=qn.toString,Ln=On.hasOwnProperty,In=Tn.call(Object);function Rn(t){var e=this.__data__=new An(t);this.size=e.size}Rn.prototype.clear=function(){this.__data__=new An,this.size=0},Rn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Rn.prototype.get=function(t){return this.__data__.get(t)},Rn.prototype.has=function(t){return this.__data__.has(t)},Rn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof An){var r=n.__data__;if(!Sn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(t,e),this.size=n.size,this};var Mn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Bn=Mn&&"object"==typeof module&&module&&!module.nodeType&&module,Dn=Bn&&Bn.exports===Mn?Jt.Buffer:void 0,Pn=Dn?Dn.allocUnsafe:void 0;function Un(t,e){if(e)return t.slice();var n=t.length,r=Pn?Pn(n):new t.constructor(n);return t.copy(r),r}var Fn=Object.prototype.propertyIsEnumerable,zn=Object.getOwnPropertySymbols,$n=zn?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}(zn(t),function(e){return Fn.call(t,e)}))}:function(){return[]};function Vn(t){return function(t,e,n){var r=e(t);return le(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,mn,$n)}var Hn=Ee(Jt,"DataView"),Kn=Ee(Jt,"Promise"),Wn=Ee(Jt,"Set"),Zn="[object Map]",Gn="[object Promise]",Yn="[object Set]",Jn="[object WeakMap]",Xn="[object DataView]",Qn=me(Hn),tr=me(Sn),er=me(Kn),nr=me(Wn),rr=me(ke),ir=se;(Hn&&ir(new Hn(new ArrayBuffer(1)))!=Xn||Sn&&ir(new Sn)!=Zn||Kn&&ir(Kn.resolve())!=Gn||Wn&&ir(new Wn)!=Yn||ke&&ir(new ke)!=Jn)&&(ir=function(t){var e=se(t),n="[object Object]"==e?t.constructor:void 0,r=n?me(n):"";if(r)switch(r){case Qn:return Xn;case tr:return Zn;case er:return Gn;case nr:return Yn;case rr:return Jn}return e});var sr=Object.prototype.hasOwnProperty;var or=Jt.Uint8Array;function lr(t){var e=new t.constructor(t.byteLength);return new or(e).set(new or(t)),e}var ar=/\w*$/;var cr=Xt?Xt.prototype:void 0,ur=cr?cr.valueOf:void 0;function hr(t,e){var n=e?lr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function dr(t,e,n){var r,i,s,o,l,a=t.constructor;switch(e){case"[object ArrayBuffer]":return lr(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return l=lr((o=t).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 hr(t,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(s=new(i=t).constructor(i.source,ar.exec(i))).lastIndex=i.lastIndex,s;case"[object Symbol]":return r=t,ur?Object(ur.call(r)):{}}}function fr(t){return"function"!=typeof t.constructor||He(t)?{}:Se(_n(t))}var pr=ln&&ln.isMap,mr=pr?nn(pr):function(t){return oe(t)&&"[object Map]"==ir(t)};var gr=ln&&ln.isSet,br=gr?nn(gr):function(t){return oe(t)&&"[object Set]"==ir(t)},vr="[object Arguments]",yr="[object Function]",xr="[object Object]",wr={};function Nr(t,e,n,r,i,s){var o,l=1&e;if(void 0!==o)return o;if(!ae(t))return t;var a=le(t);if(a)o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&sr.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t);else{var c=ir(t),u=c==yr||"[object GeneratorFunction]"==c;if(tn(t))return Un(t,l);if(c==xr||c==vr||u&&!i)o=u?{}:fr(t);else{if(!wr[c])return i?t:{};o=dr(t,c,l)}}s||(s=new Rn);var h=s.get(t);if(h)return h;s.set(t,o),br(t)?t.forEach(function(r){o.add(Nr(r,e,n,r,t,s))}):mr(t)&&t.forEach(function(r,i){o.set(i,Nr(r,e,n,i,t,s))});var d=a?void 0:Vn(t);return function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););}(d||t,function(r,i){d&&(r=t[i=r]),Pe(o,i,Nr(r,e,n,i,t,s))}),o}wr[vr]=wr["[object Array]"]=wr["[object ArrayBuffer]"]=wr["[object DataView]"]=wr["[object Boolean]"]=wr["[object Date]"]=wr["[object Float32Array]"]=wr["[object Float64Array]"]=wr["[object Int8Array]"]=wr["[object Int16Array]"]=wr["[object Int32Array]"]=wr["[object Map]"]=wr["[object Number]"]=wr[xr]=wr["[object RegExp]"]=wr["[object Set]"]=wr["[object String]"]=wr["[object Symbol]"]=wr["[object Uint8Array]"]=wr["[object Uint8ClampedArray]"]=wr["[object Uint16Array]"]=wr["[object Uint32Array]"]=!0,wr["[object Error]"]=wr[yr]=wr["[object WeakMap]"]=!1;function Er(t){return Nr(t,5)}function kr(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new jn;++e<n;)this.add(t[e])}function Ar(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}kr.prototype.add=kr.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},kr.prototype.has=function(t){return this.__data__.has(t)};function Sr(t,e,n,r,i,s){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(t),u=s.get(e);if(c&&u)return c==e&&u==t;var h=-1,d=!0,f=2&n?new kr:void 0;for(s.set(t,e),s.set(e,t);++h<l;){var p=t[h],m=e[h];if(r)var g=o?r(m,p,h,e,t,s):r(p,m,h,t,e,s);if(void 0!==g){if(g)continue;d=!1;break}if(f){if(!Ar(e,function(t,e){if(o=e,!f.has(o)&&(p===t||i(p,t,n,r,s)))return f.push(e);var o})){d=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){d=!1;break}}return s.delete(t),s.delete(e),d}function Cr(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function jr(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var _r=Xt?Xt.prototype:void 0,qr=_r?_r.valueOf:void 0;var Or=Object.prototype.hasOwnProperty;var Tr="[object Arguments]",Lr="[object Array]",Ir="[object Object]",Rr=Object.prototype.hasOwnProperty;function Mr(t,e,n,r,i,s){var o=le(t),l=le(e),a=o?Lr:ir(t),c=l?Lr:ir(e),u=(a=a==Tr?Ir:a)==Ir,h=(c=c==Tr?Ir:c)==Ir,d=a==c;if(d&&tn(t)){if(!tn(e))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new Rn),o||cn(t)?Sr(t,e,n,r,i,s):function(t,e,n,r,i,s,o){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new or(t),new or(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Be(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=Cr;case"[object Set]":var a=1&r;if(l||(l=jr),t.size!=e.size&&!a)return!1;var c=o.get(t);if(c)return c==e;r|=2,o.set(t,e);var u=Sr(l(t),l(e),r,i,s,o);return o.delete(t),u;case"[object Symbol]":if(qr)return qr.call(t)==qr.call(e)}return!1}(t,e,a,n,r,i,s);if(!(1&n)){var f=u&&Rr.call(t,"__wrapped__"),p=h&&Rr.call(e,"__wrapped__");if(f||p){var m=f?t.value():t,g=p?e.value():e;return s||(s=new Rn),i(m,g,n,r,s)}}return!!d&&(s||(s=new Rn),function(t,e,n,r,i,s){var o=1&n,l=Vn(t),a=l.length;if(a!=Vn(e).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in e:Or.call(e,u)))return!1}var h=s.get(t),d=s.get(e);if(h&&d)return h==e&&d==t;var f=!0;s.set(t,e),s.set(e,t);for(var p=o;++c<a;){var m=t[u=l[c]],g=e[u];if(r)var b=o?r(g,m,u,e,t,s):r(m,g,u,t,e,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=t.constructor,y=e.constructor;v==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(f=!1)}return s.delete(t),s.delete(e),f}(t,e,n,r,i,s))}function Br(t,e,n,r,i){return t===e||(null==t||null==e||!oe(t)&&!oe(e)?t!=t&&e!=e:Mr(t,e,n,r,Br,i))}var Dr=function(t,e,n){for(var r=-1,i=Object(t),s=n(t),o=s.length;o--;){var l=s[++r];if(!1===e(i[l],l,i))break}return t};function Pr(t,e,n){(void 0!==n&&!Be(t[e],n)||void 0===n&&!(e in t))&&Me(t,e,n)}function Ur(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Fr(t){return function(t,e,n){var r=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var o=e[i],l=void 0;void 0===l&&(l=t[o]),r?Me(n,o,l):Pe(n,o,l)}return n}(t,vn(t))}function zr(t,e,n,r,i,s,o){var l=Ur(t,n),a=Ur(e,n),c=o.get(a);if(c)Pr(t,n,c);else{var u,h=s?s(l,a,n+"",t,e,o):void 0,d=void 0===h;if(d){var f=le(a),p=!f&&tn(a),m=!f&&!p&&cn(a);h=a,f||p||m?le(l)?h=l:oe(u=l)&&$e(u)?h=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(l):p?(d=!1,h=Un(a,!0)):m?(d=!1,h=hr(a,!0)):h=[]:function(t){if(!oe(t)||"[object Object]"!=se(t))return!1;var e=_n(t);if(null===e)return!0;var n=Ln.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Tn.call(n)==In}(a)||Ye(a)?(h=l,Ye(l)?h=Fr(l):ae(l)&&!ue(l)||(h=fr(a))):d=!1}d&&(o.set(a,h),i(h,a,r,s,o),o.delete(a)),Pr(t,n,h)}}function $r(t,e,n,r,i){t!==e&&Dr(e,function(s,o){if(i||(i=new Rn),ae(s))zr(t,e,o,n,$r,r,i);else{var l=r?r(Ur(t,o),s,o+"",t,e,i):void 0;void 0===l&&(l=s),Pr(t,o,l)}},vn)}function Vr(t,e){return Br(t,e)}var Hr,Kr=(Hr=function(t,e,n){$r(t,e,n)},Fe(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,s=r>2?e[2]:void 0;for(i=Hr.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(t,e,n){if(!ae(n))return!1;var r=typeof e;return!!("number"==r?$e(n)&&Re(e,n.length):"string"==r&&e in n)&&Be(n[e],t)}(e[0],e[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var o=e[n];o&&Hr(t,o,n,i)}return t})),Wr=(t=>(t[t.TYPE=3]="TYPE",t[t.LEVEL=12]="LEVEL",t[t.ATTRIBUTE=13]="ATTRIBUTE",t[t.BLOT=14]="BLOT",t[t.INLINE=7]="INLINE",t[t.BLOCK=11]="BLOCK",t[t.BLOCK_BLOT=10]="BLOCK_BLOT",t[t.INLINE_BLOT=6]="INLINE_BLOT",t[t.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",t[t.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",t[t.ANY=15]="ANY",t))(Wr||{});class Zr{constructor(t,e,n={}){this.attrName=t,this.keyName=e;const r=Wr.TYPE&Wr.ATTRIBUTE;this.scope=null!=n.scope?n.scope&Wr.LEVEL|r:Wr.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(t){return Array.from(t.attributes).map(t=>t.name)}add(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)}canAdd(t,e){return null==this.whitelist||("string"==typeof e?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1)}remove(t){t.removeAttribute(this.keyName)}value(t){const e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""}}class Gr extends Error{constructor(t){super(t="[Parchment] "+t),this.message=t,this.name=this.constructor.name}}const Yr=class t{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(null==t)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let n=null;try{n=t.parentNode}catch{return null}return this.find(n,e)}return null}create(e,n,r){const i=this.query(n);if(null==i)throw new Gr(`Unable to create ${n} blot`);const s=i,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:s.create(r),l=new s(e,o,r);return t.blots.set(l.domNode,l),l}find(e,n=!1){return t.find(e,n)}query(t,e=Wr.ANY){let n;return"string"==typeof t?n=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof t?t&Wr.LEVEL&Wr.BLOCK?n=this.types.block:t&Wr.LEVEL&Wr.INLINE&&(n=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(t=>(n=this.classes[t],!!n)),n=n||this.tags[t.tagName]),null==n?null:"scope"in n&&e&Wr.LEVEL&n.scope&&e&Wr.TYPE&n.scope?n:null}register(...t){return t.map(t=>{const e="blotName"in t,n="attrName"in t;if(!e&&!n)throw new Gr("Invalid definition");if(e&&"abstract"===t.blotName)throw new Gr("Cannot register abstract class");const r=e?t.blotName:n?t.attrName:void 0;return this.types[r]=t,n?"string"==typeof t.keyName&&(this.attributes[t.keyName]=t):e&&(t.className&&(this.classes[t.className]=t),t.tagName&&(Array.isArray(t.tagName)?t.tagName=t.tagName.map(t=>t.toUpperCase()):t.tagName=t.tagName.toUpperCase(),(Array.isArray(t.tagName)?t.tagName:[t.tagName]).forEach(e=>{(null==this.tags[e]||null==t.className)&&(this.tags[e]=t)}))),t})}};Yr.blots=new WeakMap;let Jr=Yr;function Xr(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(t=>0===t.indexOf(`${e}-`))}const Qr=class extends Zr{static keys(t){return(t.getAttribute("class")||"").split(/\s+/).map(t=>t.split("-").slice(0,-1).join("-"))}add(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(`${this.keyName}-${e}`),!0)}remove(t){Xr(t,this.keyName).forEach(e=>{t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")}value(t){const e=(Xr(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}};function ti(t){const e=t.split("-"),n=e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("");return e[0]+n}const ei=class extends Zr{static keys(t){return(t.getAttribute("style")||"").split(";").map(t=>t.split(":")[0].trim())}add(t,e){return!!this.canAdd(t,e)&&(t.style[ti(this.keyName)]=e,!0)}remove(t){t.style[ti(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[ti(this.keyName)];return this.canAdd(t,e)?e:""}};const ni=class{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=Jr.find(this.domNode);if(null==t)return;const e=Zr.keys(this.domNode),n=Qr.keys(this.domNode),r=ei.keys(this.domNode);e.concat(n).concat(r).forEach(e=>{const n=t.scroll.query(e,Wr.ATTRIBUTE);n instanceof Zr&&(this.attributes[n.attrName]=n)})}copy(t){Object.keys(this.attributes).forEach(e=>{const n=this.attributes[e].value(this.domNode);t.format(e,n)})}move(t){this.copy(t),Object.keys(this.attributes).forEach(t=>{this.attributes[t].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t),{})}},ri=class{constructor(t,e){this.scroll=t,this.domNode=e,Jr.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(null==this.tagName)throw new Gr("Blot definition missing tagName");let e,n;return Array.isArray(this.tagName)?("string"==typeof t?(n=t.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof t&&(n=t),e="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){null!=this.parent&&this.parent.removeChild(this),Jr.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,n,r){const i=this.isolate(t,e);if(null!=this.scroll.query(n,Wr.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,Wr.ATTRIBUTE)){const t=this.scroll.create(this.statics.scope);i.wrap(t),t.format(n,r)}}insertAt(t,e,n){const r=null==n?this.scroll.create("text",e):this.scroll.create(e,n),i=this.split(t);this.parent.insertBefore(r,i||void 0)}isolate(t,e){const n=this.split(t);if(null==n)throw new Error("Attempt to isolate at end");return n.split(e),n}length(){return 1}offset(t=this.parent){return null==this.parent||this===t?0:this.parent.children.offset(this)+this.parent.offset(t)}optimize(t){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(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(t,e){return 0===t?this:this.next}update(t,e){}wrap(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Gr(`Cannot wrap ${t}`);return n.appendChild(this),n}};ri.blotName="abstract";let ii=ri;const si=class extends ii{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};si.scope=Wr.INLINE_BLOT;const oi=si;class li{constructor(){this.head=null,this.tail=null,this.length=0}append(...t){if(this.insertBefore(t[0],null),t.length>1){const e=t.slice(1);this.append(...e)}}at(t){const e=this.iterator();let n=e();for(;n&&t>0;)t-=1,n=e();return n}contains(t){const e=this.iterator();let n=e();for(;n;){if(n===t)return!0;n=e()}return!1}indexOf(t){const e=this.iterator();let n=e(),r=0;for(;n;){if(n===t)return r;r+=1,n=e()}return-1}insertBefore(t,e){null!=t&&(this.remove(t),t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)}offset(t){let e=0,n=this.head;for(;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1}remove(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)}iterator(t=this.head){return()=>{const e=t;return null!=t&&(t=t.next),e}}find(t,e=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(t<i||e&&t===i&&(null==r.next||0!==r.next.length()))return[r,t];t-=i,r=n()}return[null,0]}forEach(t){const e=this.iterator();let n=e();for(;n;)t(n),n=e()}forEachAt(t,e,n){if(e<=0)return;const[r,i]=this.find(t);let s=t-i;const o=this.iterator(r);let l=o();for(;l&&s<t+e;){const r=l.length();t>s?n(l,t-s,Math.min(e,s+r-t)):n(l,0,Math.min(r,t+e-s)),s+=r,l=o()}}map(t){return this.reduce((e,n)=>(e.push(t(n)),e),[])}reduce(t,e){const n=this.iterator();let r=n();for(;r;)e=t(e,r),r=n();return e}}function ai(t,e){const n=e.find(t);if(n)return n;try{return e.create(t)}catch{const n=e.create(Wr.INLINE);return Array.from(t.childNodes).forEach(t=>{n.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(n.domNode,t),n.attach(),n}}const ci=class t extends ii{constructor(t,e){super(t,e),this.uiNode=null,this.build()}appendChild(t){this.insertBefore(t)}attach(){super.attach(),this.children.forEach(t=>{t.attach()})}attachUI(e){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=e,t.uiClass&&this.uiNode.classList.add(t.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new li,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=ai(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Gr)return;throw e}})}deleteAt(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,(t,e,n)=>{t.deleteAt(e,n)})}descendant(e,n=0){const[r,i]=this.children.find(n);return null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e?[r,i]:r instanceof t?r.descendant(e,i):[null,-1]}descendants(e,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&i.push(n),n instanceof t&&(i=i.concat(n.descendants(e,r,s))),s-=o}),i}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let e=!1;this.children.forEach(n=>{e||this.statics.allowedChildren.some(t=>n instanceof t)||(n.statics.scope===Wr.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),e=!0):n instanceof t?n.unwrap():n.remove())})}formatAt(t,e,n,r){this.children.forEachAt(t,e,(t,e,i)=>{t.formatAt(e,i,n,r)})}insertAt(t,e,n){const[r,i]=this.children.find(t);if(r)r.insertAt(i,e,n);else{const t=null==n?this.scroll.create("text",e):this.scroll.create(e,n);this.appendChild(t)}}insertBefore(t,e){null!=t.parent&&t.parent.children.remove(t);let n=null;this.children.insertBefore(t,e||null),t.parent=this,null!=e&&(n=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(t.domNode,n),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(n=>{t.insertBefore(n,e)})}optimize(t){if(super.optimize(t),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 t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove()}path(e,n=!1){const[r,i]=this.children.find(e,n),s=[[this,e]];return r instanceof t?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(t){this.children.remove(t)}replaceWith(e,n){const r="string"==typeof e?this.scroll.create(e,n):e;return r instanceof t&&this.moveChildren(r),super.replaceWith(r)}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(t,this.length(),(t,r,i)=>{const s=t.split(r,e);null!=s&&n.appendChild(s)}),n}splitAfter(t){const e=this.clone();for(;null!=t.next;)e.appendChild(t.next);return this.parent&&this.parent.insertBefore(e,this.next||void 0),e}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(t,e){const n=[],r=[];t.forEach(t=>{t.target===this.domNode&&"childList"===t.type&&(n.push(...t.addedNodes),r.push(...t.removedNodes))}),r.forEach(t=>{if(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const e=this.scroll.find(t);null!=e&&(null==e.domNode.parentNode||e.domNode.parentNode===this.domNode)&&e.detach()}),n.filter(t=>t.parentNode===this.domNode&&t!==this.uiNode).sort((t,e)=>t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(t=>{let e=null;null!=t.nextSibling&&(e=this.scroll.find(t.nextSibling));const n=ai(t,this.scroll);(n.next!==e||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,e||void 0))}),this.enforceAllowedChildren()}};ci.uiClass="";const ui=ci;const hi=class t extends ui{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new ni(this.domNode)}format(e,n){if(e!==this.statics.blotName||n){const t=this.scroll.query(e,Wr.INLINE);if(null==t)return;t instanceof Zr?this.attributes.attribute(t,n):n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n)}else this.children.forEach(e=>{e instanceof t||(e=e.wrap(t.blotName,!0)),this.attributes.copy(e)}),this.unwrap()}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.formats()[n]||this.scroll.query(n,Wr.ATTRIBUTE)?this.isolate(t,e).format(n,r):super.formatAt(t,e,n,r)}optimize(e){super.optimize(e);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof t&&r.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}wrap(e,n){const r=super.wrap(e,n);return r instanceof t&&this.attributes.move(r),r}};hi.allowedChildren=[hi,oi],hi.blotName="inline",hi.scope=Wr.INLINE_BLOT,hi.tagName="SPAN";const di=hi,fi=class t extends ui{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new ni(this.domNode)}format(e,n){const r=this.scroll.query(e,Wr.BLOCK);null!=r&&(r instanceof Zr?this.attributes.attribute(r,n):e!==this.statics.blotName||n?n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n):this.replaceWith(t.blotName))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.scroll.query(n,Wr.BLOCK)?this.format(n,r):super.formatAt(t,e,n,r)}insertAt(t,e,n){if(null==n||null!=this.scroll.query(e,Wr.INLINE))super.insertAt(t,e,n);else{const r=this.split(t);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const t=this.scroll.create(e,n);r.parent.insertBefore(t,r)}}}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}};fi.blotName="block",fi.scope=Wr.BLOCK_BLOT,fi.tagName="P",fi.allowedChildren=[di,fi,oi];const pi=fi,mi=class extends ui{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.enforceAllowedChildren()}insertAt(t,e,n){super.insertAt(t,e,n),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};mi.blotName="container",mi.scope=Wr.BLOCK_BLOT;const gi=mi;const bi=class extends oi{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,n,r){0===t&&e===this.length()?this.format(n,r):super.formatAt(t,e,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},vi={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},yi=class extends ui{constructor(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(t=>{this.update(t)}),this.observer.observe(this.domNode,vi),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const n=this.registry.find(t,e);return n?n.scroll===this?n:e?this.find(n.scroll.domNode.parentNode,!0):null:null}query(t,e=Wr.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),0===t&&e===this.length()?this.children.forEach(t=>{t.remove()}):super.deleteAt(t,e)}formatAt(t,e,n,r){this.update(),super.formatAt(t,e,n,r)}insertAt(t,e,n){this.update(),super.insertAt(t,e,n)}optimize(t=[],e={}){super.optimize(e);const n=e.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)t.push(r.pop());const i=(t,e=!0)=>{null==t||t===this||null!=t.domNode.parentNode&&(n.has(t.domNode)||n.set(t.domNode,[]),e&&i(t.parent))},s=t=>{n.has(t.domNode)&&(t instanceof ui&&t.children.forEach(s),n.delete(t.domNode),t.optimize(e))};let o=t;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(t=>{const e=this.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(i(this.find(t.previousSibling,!1)),Array.from(t.addedNodes).forEach(t=>{const e=this.find(t,!1);i(e,!1),e instanceof ui&&e.children.forEach(t=>{i(t,!1)})})):"attributes"===t.type&&i(e.prev)),i(e))}),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)t.push(r.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const n=new WeakMap;t.map(t=>{const e=this.find(t.target,!0);return null==e?null:n.has(e.domNode)?(n.get(e.domNode).push(t),null):(n.set(e.domNode,[t]),e)}).forEach(t=>{null!=t&&t!==this&&n.has(t.domNode)&&t.update(n.get(t.domNode)||[],e)}),e.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),e),this.optimize(t,e)}};yi.blotName="scroll",yi.defaultChild=pi,yi.allowedChildren=[pi,gi],yi.scope=Wr.BLOCK_BLOT,yi.tagName="DIV";const xi=yi,wi=class t extends oi{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,n){null==n?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,n)}length(){return this.text.length}optimize(e){super.optimize(e),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(t,e){t.some(t=>"characterData"===t.type&&t.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};wi.blotName="text",wi.scope=Wr.INLINE_BLOT;const Ni=wi,Ei=Object.freeze(Object.defineProperty({__proto__:null,Attributor:Zr,AttributorStore:ni,BlockBlot:pi,ClassAttributor:Qr,ContainerBlot:gi,EmbedBlot:bi,InlineBlot:di,LeafBlot:oi,ParentBlot:ui,Registry:Jr,Scope:Wr,ScrollBlot:xi,StyleAttributor:ei,TextBlot:Ni},Symbol.toStringTag,{value:"Module"}));var ki,Ai,Si={exports:{}};function Ci(){if(Ai)return ki;Ai=1;var t=-1;function e(d,f,p,m,b){if(d===f)return d?[[0,d]]:[];if(null!=p){var v=function(t,e,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,i="number"==typeof n?null:n.newRange,s=t.length,o=e.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=t.slice(0,l),c=t.slice(l),u=i?i.index:null,h=l+o-s;if((null===u||u===h)&&!(h<0||h>o)){var d=e.slice(0,h);if((m=e.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=e.slice(0,p),e.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=t.slice(0,r.index),y=t.slice(r.index+r.length);if(!(o<(f=v.length)+(b=y.length))){var x=e.slice(0,f),w=e.slice(o-b);if(v===x&&y===w)return g(v,t.slice(f,s-b),e.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[[t,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]=t),l;if(1===c.length)return[[t,i],[1,o]];var h=function(t,e){var n=t.length>e.length?t:e,i=t.length>e.length?e:t;if(n.length<4||2*i.length<n.length)return null;function o(t,e,n){for(var i,o,l,a,c=t.substring(n,n+Math.floor(t.length/4)),u=-1,h="";-1!==(u=e.indexOf(c,u+1));){var d=r(t.substring(n),e.substring(u)),f=s(t.substring(0,n),e.substring(0,u));h.length<f+d&&(h=e.substring(u-f,u)+e.substring(u,u+d),i=t.substring(0,n-f),o=t.substring(n+d),l=e.substring(0,u-f),a=e.substring(u+d))}return 2*h.length>=t.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;t.length>e.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=e(d,p),v=e(f,m);return b.concat([[0,g]],v)}return function(e,r){for(var i=e.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&&e.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(e,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&&e.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(e,r,S,w)}}}}return[[t,e],[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(e){var n=!1,r=[],d=0,f=null,p=0,m=0,g=0,b=0,v=0;for(;p<e.length;)0==e[p][0]?(r[d++]=p,m=b,g=v,b=0,v=0,f=e[p][1]):(1==e[p][0]?b+=e[p][1].length:v+=e[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(b,v)&&(e.splice(r[d-1],0,[t,f]),e[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(e);(function(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.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&&t.match(c),g=p&&e.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<t.length-1;){if(0==t[n-1][0]&&0==t[n+1][0]){var r=t[n-1][1],i=t[n][1],h=t[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=e(r,i)+e(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=e(r,i)+e(i,h);v>=b&&(b=v,p=r,m=i,g=h)}t[n-1][1]!=p&&(p?t[n-1][1]=p:(t.splice(n-1,1),n--),t[n][1]=m,g?t[n+1][1]=g:(t.splice(n+1,1),n--))}n++}})(e),p=1;for(;p<e.length;){if(e[p-1][0]==t&&1==e[p][0]){var y=e[p-1][1],x=e[p][1],w=i(y,x),N=i(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(e.splice(p,0,[0,x.substring(0,w)]),e[p-1][1]=y.substring(0,y.length-w),e[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(e.splice(p,0,[0,y.substring(0,N)]),e[p-1][0]=1,e[p-1][1]=x.substring(0,x.length-N),e[p+1][0]=t,e[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(t,n,r,i){var s=t.substring(0,r),o=n.substring(0,i),l=t.substring(r),a=n.substring(i),c=e(s,o),u=e(l,a);return c.concat(u)}function r(t,e){if(!t||!e||t.charAt(0)!==e.charAt(0))return 0;for(var n=0,r=Math.min(t.length,e.length),i=r,s=0;n<i;)t.substring(s,i)==e.substring(s,i)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return d(t.charCodeAt(i-1))&&i--,i}function i(t,e){var n=t.length,r=e.length;if(0==n||0==r)return 0;n>r?t=t.substring(n-r):n<r&&(e=e.substring(0,n));var i=Math.min(n,r);if(t==e)return i;for(var s=0,o=1;;){var l=t.substring(i-o),a=e.indexOf(l);if(-1==a)return s;o+=a,0!=a&&t.substring(i-o)!=e.substring(0,o)||(s=o,o++)}}function s(t,e){if(!t||!e||t.slice(-1)!==e.slice(-1))return 0;for(var n=0,r=Math.min(t.length,e.length),i=r,s=0;n<i;)t.substring(t.length-i,t.length-s)==e.substring(e.length-i,e.length-s)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return f(t.charCodeAt(t.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(e,n){e.push([0,""]);for(var i,o=0,l=0,a=0,c="",u="";o<e.length;)if(o<e.length-1&&!e[o][1])e.splice(o,1);else switch(e[o][0]){case 1:a++,u+=e[o][1],o++;break;case t:l++,c+=e[o][1],o++;break;case 0:var d=o-a-l-1;if(n){if(d>=0&&m(e[d][1])){var f=e[d][1].slice(-1);if(e[d][1]=e[d][1].slice(0,-1),c=f+c,u=f+u,!e[d][1]){e.splice(d,1),o--;var g=d-1;e[g]&&1===e[g][0]&&(a++,u=e[g][1]+u,g--),e[g]&&e[g][0]===t&&(l++,c=e[g][1]+c,g--),d=g}}if(p(e[o][1])){f=e[o][1].charAt(0);e[o][1]=e[o][1].slice(1),c+=f,u+=f}}if(o<e.length-1&&!e[o][1]){e.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(i=r(u,c))&&(d>=0?e[d][1]+=u.substring(0,i):(e.splice(0,0,[0,u.substring(0,i)]),o++),u=u.substring(i),c=c.substring(i)),0!==(i=s(u,c))&&(e[o][1]=u.substring(u.length-i)+e[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?(e.splice(o-b,b),o-=b):0===c.length?(e.splice(o-b,b,[1,u]),o=o-b+1):0===u.length?(e.splice(o-b,b,[t,c]),o=o-b+1):(e.splice(o-b,b,[t,c],[1,u]),o=o-b+2)}0!==o&&0===e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,a=0,l=0,c="",u=""}""===e[e.length-1][1]&&e.pop();var v=!1;for(o=1;o<e.length-1;)0===e[o-1][0]&&0===e[o+1][0]&&(e[o][1].substring(e[o][1].length-e[o-1][1].length)===e[o-1][1]?(e[o][1]=e[o-1][1]+e[o][1].substring(0,e[o][1].length-e[o-1][1].length),e[o+1][1]=e[o-1][1]+e[o+1][1],e.splice(o-1,1),v=!0):e[o][1].substring(0,e[o+1][1].length)==e[o+1][1]&&(e[o-1][1]+=e[o+1][1],e[o][1]=e[o][1].substring(e[o+1][1].length)+e[o+1][1],e.splice(o+1,1),v=!0)),o++;v&&h(e,n)}function d(t){return t>=55296&&t<=56319}function f(t){return t>=56320&&t<=57343}function p(t){return f(t.charCodeAt(0))}function m(t){return d(t.charCodeAt(t.length-1))}function g(e,n,r,i){return m(e)||p(i)?null:function(t){for(var e=[],n=0;n<t.length;n++)t[n][1].length>0&&e.push(t[n]);return e}([[0,e],[t,n],[1,r],[0,i]])}function b(t,n,r,i){return e(t,n,r,i,!0)}return b.INSERT=1,b.DELETE=t,b.EQUAL=0,ki=b}var ji,_i={exports:{}};function qi(){return ji||(ji=1,function(t,e){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]",_=/\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[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 P&&P&&P.Object===Object&&P,I="object"==typeof self&&self&&self.Object===Object&&self,R=L||I||Function("return this")(),M=e&&!e.nodeType&&e,B=M&&t&&!t.nodeType&&t,D=B&&B.exports===M;function U(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function z(t,e,n,r){for(var i=-1,s=t?t.length:0;++i<s;)n=e(n,t[i],i,t);return n}function $(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(n){}return e}function V(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function H(t,e){return function(n){return t(e(n))}}function K(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var W=Array.prototype,Z=Function.prototype,G=Object.prototype,Y=R["__core-js_shared__"],J=function(){var t=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),X=Z.toString,Q=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=D?R.Buffer:void 0,rt=R.Symbol,it=R.Uint8Array,st=H(Object.getPrototypeOf,Object),ot=Object.create,lt=G.propertyIsEnumerable,at=W.splice,ct=Object.getOwnPropertySymbols,ut=nt?nt.isBuffer:void 0,ht=H(Object.keys,Object),dt=Bt(R,"DataView"),ft=Bt(R,"Map"),pt=Bt(R,"Promise"),mt=Bt(R,"Set"),gt=Bt(R,"WeakMap"),bt=Bt(Object,"create"),vt=zt(dt),yt=zt(ft),xt=zt(pt),wt=zt(mt),Nt=zt(gt),Et=rt?rt.prototype:void 0,kt=Et?Et.valueOf:void 0;function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function St(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ct(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jt(t){this.__data__=new St(t)}function _t(t,e){var n=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ht(t)}(t)&&Q.call(t,"callee")&&(!lt.call(t,"callee")||tt.call(t)==i)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,s=!!r;for(var o in t)!Q.call(t,o)||s&&("length"==o||Ut(o,r))||n.push(o);return n}function qt(t,e,n){var r=t[e];Q.call(t,e)&&$t(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ot(t,e){for(var n=t.length;n--;)if($t(t[n][0],e))return n;return-1}function Tt(t,e,n,r,d,b,q){var O;if(r&&(O=b?r(t,d,b,q):r(t)),void 0!==O)return O;if(!Zt(t))return t;var L=Vt(t);if(L){if(O=function(t){var e=t.length,n=t.constructor(e);e&&"string"==typeof t[0]&&Q.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!e)return function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(t,O)}else{var I=Pt(t),R=I==l||I==a;if(Kt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(I==h||I==i||R&&!b){if($(t))return b?t:{};if(O=function(t){return"function"!=typeof t.constructor||Ft(t)?{}:(e=st(t),Zt(e)?ot(e):{});var e}(R?{}:t),!e)return function(t,e){return Rt(t,Dt(t),e)}(t,function(t,e){return t&&Rt(e,Gt(e),t)}(O,t))}else{if(!T[I])return b?t:{};O=function(t,e,n,r){var i=t.constructor;switch(e){case v:return It(t);case s:case o:return new i(+t);case y:return function(t,e){var n=e?It(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case x:case w:case N:case E:case k:case A:case S:case C:case j:return function(t,e){var n=e?It(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case c:return function(t,e,n){var r=e?n(V(t),!0):V(t);return z(r,U,new t.constructor)}(t,r,n);case u:case m:return new i(t);case f:return function(t){var e=new t.constructor(t.source,_.exec(t));return e.lastIndex=t.lastIndex,e}(t);case p:return function(t,e,n){var r=e?n(K(t),!0):K(t);return z(r,F,new t.constructor)}(t,r,n);case g:return l=t,kt?Object(kt.call(l)):{}}var l}(t,I,Tt,e)}}q||(q=new jt);var M=q.get(t);if(M)return M;if(q.set(t,O),!L)var B=n?function(t){return function(t,e,n){var r=e(t);return Vt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,Gt,Dt)}(t):Gt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n,t););}(B||t,function(i,s){B&&(i=t[s=i]),qt(O,s,Tt(i,e,n,r,s,t,q))}),O}function Lt(t){return!(!Zt(t)||function(t){return!!J&&J in t}(t))&&(Wt(t)||$(t)?et:q).test(zt(t))}function It(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function Rt(t,e,n,r){n||(n={});for(var i=-1,s=e.length;++i<s;){var o=e[i];qt(n,o,t[o])}return n}function Mt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Bt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Lt(n)?n:void 0}At.prototype.clear=function(){this.__data__=bt?bt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return Q.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Q.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},St.prototype.clear=function(){this.__data__=[]},St.prototype.delete=function(t){var e=this.__data__,n=Ot(e,t);return!(n<0)&&(n==e.length-1?e.pop():at.call(e,n,1),!0)},St.prototype.get=function(t){var e=this.__data__,n=Ot(e,t);return n<0?void 0:e[n][1]},St.prototype.has=function(t){return Ot(this.__data__,t)>-1},St.prototype.set=function(t,e){var n=this.__data__,r=Ot(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Ct.prototype.clear=function(){this.__data__={hash:new At,map:new(ft||St),string:new At}},Ct.prototype.delete=function(t){return Mt(this,t).delete(t)},Ct.prototype.get=function(t){return Mt(this,t).get(t)},Ct.prototype.has=function(t){return Mt(this,t).has(t)},Ct.prototype.set=function(t,e){return Mt(this,t).set(t,e),this},jt.prototype.clear=function(){this.__data__=new St},jt.prototype.delete=function(t){return this.__data__.delete(t)},jt.prototype.get=function(t){return this.__data__.get(t)},jt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof St){var r=n.__data__;if(!ft||r.length<199)return r.push([t,e]),this;n=this.__data__=new Ct(r)}return n.set(t,e),this};var Dt=ct?H(ct,Object):function(){return[]},Pt=function(t){return tt.call(t)};function Ut(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||O.test(t))&&t>-1&&t%1==0&&t<e}function Ft(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function zt(t){if(null!=t){try{return X.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function $t(t,e){return t===e||t!=t&&e!=e}(dt&&Pt(new dt(new ArrayBuffer(1)))!=y||ft&&Pt(new ft)!=c||pt&&Pt(pt.resolve())!=d||mt&&Pt(new mt)!=p||gt&&Pt(new gt)!=b)&&(Pt=function(t){var e=tt.call(t),n=e==h?t.constructor:void 0,r=n?zt(n):void 0;if(r)switch(r){case vt:return y;case yt:return c;case xt:return d;case wt:return p;case Nt:return b}return e});var Vt=Array.isArray;function Ht(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Wt(t)}var Kt=ut||function(){return!1};function Wt(t){var e=Zt(t)?tt.call(t):"";return e==l||e==a}function Zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Ht(t)?_t(t):function(t){if(!Ft(t))return ht(t);var e=[];for(var n in Object(t))Q.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Tt(t,!0,!0)}}(_i,_i.exports)),_i.exports}var Oi,Ti={exports:{}};function Li(){return Oi||(Oi=1,function(t,e){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 P&&P&&P.Object===Object&&P,A="object"==typeof self&&self&&self.Object===Object&&self,S=k||A||Function("return this")(),C=e&&!e.nodeType&&e,j=C&&t&&!t.nodeType&&t,_=j&&j.exports===C,q=_&&k.process,O=function(){try{return q&&q.binding&&q.binding("util")}catch(t){}}(),T=O&&O.isTypedArray;function L(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function I(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function R(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,U=S["__core-js_shared__"],F=B.toString,z=D.hasOwnProperty,$=function(){var t=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),V=D.toString,H=RegExp("^"+F.call(z).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,tt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),et=_t(S,"DataView"),nt=_t(S,"Map"),rt=_t(S,"Promise"),it=_t(S,"Set"),st=_t(S,"WeakMap"),ot=_t(Object,"create"),lt=Lt(et),at=Lt(nt),ct=Lt(rt),ut=Lt(it),ht=Lt(st),dt=W?W.prototype:void 0,ft=dt?dt.valueOf:void 0;function pt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function mt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function gt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function bt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new gt;++e<n;)this.add(t[e])}function vt(t){var e=this.__data__=new mt(t);this.size=e.size}function yt(t,e){var n=Mt(t),r=!n&&Rt(t),i=!n&&!r&&Bt(t),s=!n&&!r&&!i&&zt(t),o=n||r||i||s,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!z.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Tt(c,a))||l.push(c);return l}function xt(t,e){for(var n=t.length;n--;)if(It(t[n][0],e))return n;return-1}function wt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":J&&J in Object(t)?function(t){var e=z.call(t,J),n=t[J];try{t[J]=void 0;var r=!0}catch(s){}var i=V.call(t);r&&(e?t[J]=n:delete t[J]);return i}(t):function(t){return V.call(t)}(t)}function Nt(t){return Ft(t)&&wt(t)==i}function Et(t,e,n,r,c){return t===e||(null==t||null==e||!Ft(t)&&!Ft(e)?t!=t&&e!=e:function(t,e,n,r,c,f){var v=Mt(t),w=Mt(e),N=v?s:Ot(t),E=w?s:Ot(e),k=(N=N==i?d:N)==d,A=(E=E==i?d:E)==d,S=N==E;if(S&&Bt(t)){if(!Bt(e))return!1;v=!0,k=!1}if(S&&!k)return f||(f=new vt),v||zt(t)?St(t,e,n,r,c,f):function(t,e,n,r,i,s,c){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case y:return!(t.byteLength!=e.byteLength||!s(new Z(t),new Z(e)));case o:case l:case h:return It(+t,+e);case a:return t.name==e.name&&t.message==e.message;case p:case g:return t==e+"";case u:var d=I;case m:var f=1&r;if(d||(d=R),t.size!=e.size&&!f)return!1;var v=c.get(t);if(v)return v==e;r|=2,c.set(t,e);var w=St(d(t),d(e),r,i,s,c);return c.delete(t),w;case b:if(ft)return ft.call(t)==ft.call(e)}return!1}(t,e,N,n,r,c,f);if(!(1&n)){var C=k&&z.call(t,"__wrapped__"),j=A&&z.call(e,"__wrapped__");if(C||j){var _=C?t.value():t,q=j?e.value():e;return f||(f=new vt),c(_,q,n,r,f)}}if(!S)return!1;return f||(f=new vt),function(t,e,n,r,i,s){var o=1&n,l=Ct(t),a=l.length,c=Ct(e),u=c.length;if(a!=u&&!o)return!1;var h=a;for(;h--;){var d=l[h];if(!(o?d in e:z.call(e,d)))return!1}var f=s.get(t);if(f&&s.get(e))return f==e;var p=!0;s.set(t,e),s.set(e,t);var m=o;for(;++h<a;){var g=t[d=l[h]],b=e[d];if(r)var v=o?r(b,g,d,e,t,s):r(g,b,d,t,e,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=t.constructor,x=e.constructor;y==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return s.delete(t),s.delete(e),p}(t,e,n,r,c,f)}(t,e,n,r,Et,c))}function kt(t){return!(!Ut(t)||function(t){return!!$&&$ in t}(t))&&(Dt(t)?H:w).test(Lt(t))}function At(t){if(n=(e=t)&&e.constructor,r="function"==typeof n&&n.prototype||D,e!==r)return tt(t);var e,n,r,i=[];for(var s in Object(t))z.call(t,s)&&"constructor"!=s&&i.push(s);return i}function St(t,e,n,r,i,s){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var u=-1,h=!0,d=2&n?new bt:void 0;for(s.set(t,e),s.set(e,t);++u<l;){var f=t[u],p=e[u];if(r)var m=o?r(p,f,u,e,t,s):r(f,p,u,t,e,s);if(void 0!==m){if(m)continue;h=!1;break}if(d){if(!L(e,function(t,e){if(o=e,!d.has(o)&&(f===t||i(f,t,n,r,s)))return d.push(e);var o})){h=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){h=!1;break}}return s.delete(t),s.delete(e),h}function Ct(t){return function(t,e,n){var r=e(t);return Mt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,$t,qt)}function jt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function _t(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return kt(n)?n:void 0}pt.prototype.clear=function(){this.__data__=ot?ot(null):{},this.size=0},pt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pt.prototype.get=function(t){var e=this.__data__;if(ot){var r=e[t];return r===n?void 0:r}return z.call(e,t)?e[t]:void 0},pt.prototype.has=function(t){var e=this.__data__;return ot?void 0!==e[t]:z.call(e,t)},pt.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ot&&void 0===e?n:e,this},mt.prototype.clear=function(){this.__data__=[],this.size=0},mt.prototype.delete=function(t){var e=this.__data__,n=xt(e,t);return!(n<0)&&(n==e.length-1?e.pop():Y.call(e,n,1),--this.size,!0)},mt.prototype.get=function(t){var e=this.__data__,n=xt(e,t);return n<0?void 0:e[n][1]},mt.prototype.has=function(t){return xt(this.__data__,t)>-1},mt.prototype.set=function(t,e){var n=this.__data__,r=xt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},gt.prototype.clear=function(){this.size=0,this.__data__={hash:new pt,map:new(nt||mt),string:new pt}},gt.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},gt.prototype.get=function(t){return jt(this,t).get(t)},gt.prototype.has=function(t){return jt(this,t).has(t)},gt.prototype.set=function(t,e){var n=jt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},bt.prototype.add=bt.prototype.push=function(t){return this.__data__.set(t,n),this},bt.prototype.has=function(t){return this.__data__.has(t)},vt.prototype.clear=function(){this.__data__=new mt,this.size=0},vt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},vt.prototype.get=function(t){return this.__data__.get(t)},vt.prototype.has=function(t){return this.__data__.has(t)},vt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof mt){var r=n.__data__;if(!nt||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new gt(r)}return n.set(t,e),this.size=n.size,this};var qt=X?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}(X(t),function(e){return G.call(t,e)}))}:function(){return[]},Ot=wt;function Tt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||N.test(t))&&t>-1&&t%1==0&&t<e}function Lt(t){if(null!=t){try{return F.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function It(t,e){return t===e||t!=t&&e!=e}(et&&Ot(new et(new ArrayBuffer(1)))!=x||nt&&Ot(new nt)!=u||rt&&Ot(rt.resolve())!=f||it&&Ot(new it)!=m||st&&Ot(new st)!=v)&&(Ot=function(t){var e=wt(t),n=e==d?t.constructor:void 0,r=n?Lt(n):"";if(r)switch(r){case lt:return x;case at:return u;case ct:return f;case ut:return m;case ht:return v}return e});var Rt=Nt(function(){return arguments}())?Nt:function(t){return Ft(t)&&z.call(t,"callee")&&!G.call(t,"callee")},Mt=Array.isArray;var Bt=Q||function(){return!1};function Dt(t){if(!Ut(t))return!1;var e=wt(t);return e==c||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Pt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function Ut(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ft(t){return null!=t&&"object"==typeof t}var zt=T?function(t){return function(e){return t(e)}}(T):function(t){return Ft(t)&&Pt(t.length)&&!!E[wt(t)]};function $t(t){return null!=(e=t)&&Pt(e.length)&&!Dt(e)?yt(t):At(t);var e}t.exports=function(t,e){return Et(t,e)}}(Ti,Ti.exports)),Ti.exports}var Ii,Ri={};var Mi,Bi={};function Di(){return Mi||(Mi=1,Object.defineProperty(Bi,"__esModule",{value:!0}),(t||(t={})).length=function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"object"==typeof t.retain&&null!==t.retain?1:"string"==typeof t.insert?t.insert.length:1},Bi.default=t),Bi;var t}var Pi,Ui,Fi={};var zi=(Ui||(Ui=1,function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.Op=void 0;const n=Ci(),r=qi(),i=Li(),s=function(){if(Ii)return Ri;Ii=1,Object.defineProperty(Ri,"__esModule",{value:!0});const t=qi(),e=Li();var n,r;return(r=n||(n={})).compose=function(e={},n={},r=!1){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});let i=t(n);r||(i=Object.keys(i).reduce((t,e)=>(null!=i[e]&&(t[e]=i[e]),t),{}));for(const t in e)void 0!==e[t]&&void 0===n[t]&&(i[t]=e[t]);return Object.keys(i).length>0?i:void 0},r.diff=function(t={},n={}){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});const r=Object.keys(t).concat(Object.keys(n)).reduce((r,i)=>(e(t[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(t={},e={}){t=t||{};const n=Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0!==t[r]&&(n[r]=e[r]),n),{});return Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0===e[r]&&(n[r]=null),n),n)},r.transform=function(t,e,n=!1){if("object"!=typeof t)return e;if("object"!=typeof e)return;if(!n)return e;const r=Object.keys(e).reduce((n,r)=>(void 0===t[r]&&(n[r]=e[r]),n),{});return Object.keys(r).length>0?r:void 0},Ri.default=n,Ri}();e.AttributeMap=s.default;const o=Di();e.Op=o.default;const l=function(){if(Pi)return Fi;Pi=1,Object.defineProperty(Fi,"__esModule",{value:!0});const t=Di();return Fi.default=class{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);const n=this.ops[this.index];if(n){const r=this.offset,i=t.default.length(n);if(e>=i-r?(e=i-r,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof n.delete)return{delete:e};{const t={};return n.attributes&&(t.attributes=n.attributes),"number"==typeof n.retain?t.retain=e:"object"==typeof n.retain&&null!==n.retain?t.retain=n.retain:"string"==typeof n.insert?t.insert=n.insert.substr(r,e):t.insert=n.insert,t}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?t.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?"number"==typeof t.delete?"delete":"number"==typeof t.retain||"object"==typeof t.retain&&null!==t.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const t=this.offset,e=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=t,this.index=e,[n].concat(r)}}return[]}},Fi}();e.OpIterator=l.default;const a=String.fromCharCode(0),c=(t,e)=>{if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);const n=Object.keys(t)[0];if(!n||n!==Object.keys(e)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(e)[0]}`);return[n,t[n],e[n]]};class u{constructor(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]}static registerEmbed(t,e){this.handlers[t]=e}static unregisterEmbed(t){delete this.handlers[t]}static getHandler(t){const e=this.handlers[t];if(!e)throw new Error(`no handlers for embed type "${t}"`);return e}insert(t,e){const n={};return"string"==typeof t&&0===t.length?this:(n.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))}delete(t){return t<=0?this:this.push({delete:t})}retain(t,e){if("number"==typeof t&&t<=0)return this;const n={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)}push(t){let e=this.ops.length,n=this.ops[e-1];if(t=r(t),"object"==typeof n){if("number"==typeof t.delete&&"number"==typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"==typeof n.delete&&null!=t.insert&&(e-=1,n=this.ops[e-1],"object"!=typeof n))return this.ops.unshift(t),this;if(i(t.attributes,n.attributes)){if("string"==typeof t.insert&&"string"==typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this}chop(){const t=this.ops[this.ops.length-1];return t&&"number"==typeof t.retain&&!t.attributes&&this.ops.pop(),this}filter(t){return this.ops.filter(t)}forEach(t){this.ops.forEach(t)}map(t){return this.ops.map(t)}partition(t){const e=[],n=[];return this.forEach(r=>{(t(r)?e:n).push(r)}),[e,n]}reduce(t,e){return this.ops.reduce(t,e)}changeLength(){return this.reduce((t,e)=>e.insert?t+o.default.length(e):e.delete?t-e.delete:t,0)}length(){return this.reduce((t,e)=>t+o.default.length(e),0)}slice(t=0,e=1/0){const n=[],r=new l.default(this.ops);let i=0;for(;i<e&&r.hasNext();){let s;i<t?s=r.next(t-i):(s=r.next(e-i),n.push(s)),i+=o.default.length(s)}return new u(n)}compose(t){const e=new l.default(this.ops),n=new l.default(t.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let t=o.retain;for(;"insert"===e.peekType()&&e.peekLength()<=t;)t-=e.peekLength(),r.push(e.next());o.retain-t>0&&n.next(o.retain-t)}const a=new u(r);for(;e.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===e.peekType())a.push(e.next());else{const t=Math.min(e.peekLength(),n.peekLength()),r=e.next(t),o=n.next(t);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?t:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const t=null==r.retain?"insert":"retain",[e,n,i]=c(r[t],o.retain),s=u.getHandler(e);l[t]={[e]:s.compose(n,i,"retain"===t)}}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 t=new u(e.rest());return a.concat(t).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(t){const e=new u(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e}diff(t,e){if(this.ops===t.ops)return new u;const r=[this,t].map(e=>e.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],e,!0),h=new l.default(this.ops),d=new l.default(t.ops);return c.forEach(t=>{let e=t[1].length;for(;e>0;){let r=0;switch(t[0]){case n.INSERT:r=Math.min(d.peekLength(),e),o.push(d.next(r));break;case n.DELETE:r=Math.min(e,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),d.peekLength(),e);const t=h.next(r),l=d.next(r);i(t.insert,l.insert)?o.retain(r,s.default.diff(t.attributes,l.attributes)):o.push(l).delete(r)}e-=r}}),o.chop()}eachLine(t,e="\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(e,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===t(r,n.next(1).attributes||{},i))return;i+=1,r=new u}}r.length()>0&&t(r,{},i)}invert(t){const e=new u;return this.reduce((n,r)=>{if(r.insert)e.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return e.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const i=r.delete||r.retain;return t.slice(n,n+i).forEach(t=>{r.delete?e.push(t):r.retain&&r.attributes&&e.retain(o.default.length(t),s.default.invert(r.attributes,t.attributes))}),n+i}if("object"==typeof r.retain&&null!==r.retain){const i=t.slice(n,n+1),o=new l.default(i.ops).next(),[a,h,d]=c(r.retain,o.insert),f=u.getHandler(a);return e.retain({[a]:f.invert(h,d)},s.default.invert(r.attributes,o.attributes)),n+1}}return n},0),e.chop()}transform(t,e=!1){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);const n=t,r=new l.default(this.ops),i=new l.default(n.ops),a=new u;for(;r.hasNext()||i.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===i.peekType())if("insert"===i.peekType())a.push(i.next());else{const t=Math.min(r.peekLength(),i.peekLength()),n=r.next(t),o=i.next(t);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:t;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){const t=Object.keys(r)[0];if(t===Object.keys(i)[0]){const n=u.getHandler(t);n&&(l={[t]:n.transform(r[t],i[t],e)})}}a.retain(l,s.default.transform(n.attributes,o.attributes,e))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(t,e=!1){e=!!e;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=t;){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r<t||!e)&&(t+=i),r+=i):t-=Math.min(i,t-r)}return t}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=s.default,u.handlers={},e.default=u,t.exports=u,t.exports.default=u}(Si,Si.exports)),Si.exports);const $i=U(zi);class Vi extends bi{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Vi.blotName="break",Vi.tagName="BR";let Hi=class extends Ni{};const Ki={"&":"&","<":"<",">":">",'"':""","'":"'"};function Wi(t){return t.replace(/[&<>"']/g,t=>Ki[t])}const Zi=class t extends di{static compare(e,n){const r=t.order.indexOf(e),i=t.order.indexOf(n);return r>=0||i>=0?r-i:e===n?0:e<n?-1:1}formatAt(e,n,r,i){if(t.compare(this.statics.blotName,r)<0&&this.scroll.query(r,Wr.BLOT)){const t=this.isolate(e,n);i&&t.wrap(r,i)}else super.formatAt(e,n,r,i)}optimize(e){if(super.optimize(e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){const t=this.parent.isolate(this.offset(),this.length());this.moveChildren(t),t.wrap(this)}}};e(Zi,"allowedChildren",[Zi,Vi,bi,Hi]),e(Zi,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Gi=Zi;class Yi extends pi{constructor(){super(...arguments),e(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=Xi(this)),this.cache.delta}deleteAt(t,e){super.deleteAt(t,e),this.cache={}}formatAt(t,e,n,r){e<=0||(this.scroll.query(n,Wr.BLOCK)?t+e===this.length()&&this.format(n,r):super.formatAt(t,Math.min(e,this.length()-t-1),n,r),this.cache={})}insertAt(t,e,n){if(null!=n)return super.insertAt(t,e,n),void(this.cache={});if(0===e.length)return;const r=e.split("\n"),i=r.shift();i.length>0&&(t<this.length()-1||null==this.children.tail?super.insertAt(Math.min(t,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let s=this;r.reduce((t,e)=>(s=s.split(t,!0),s.insertAt(0,e),e.length),t+i.length)}insertBefore(t,e){const{head:n}=this.children;super.insertBefore(t,e),n instanceof Vi&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(t,e){super.moveChildren(t,e),this.cache={}}optimize(t){super.optimize(t),this.cache={}}path(t){return super.path(t,!0)}removeChild(t){super.removeChild(t),this.cache={}}split(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&(0===t||t>=this.length()-1)){const e=this.clone();return 0===t?(this.parent.insertBefore(e,this),this):(this.parent.insertBefore(e,this.next),e)}const n=super.split(t,e);return this.cache={},n}}Yi.blotName="block",Yi.tagName="P",Yi.defaultChild=Vi,Yi.allowedChildren=[Vi,Gi,bi,Hi];class Ji extends bi{attach(){super.attach(),this.attributes=new ni(this.domNode)}delta(){return(new $i).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const n=this.scroll.query(t,Wr.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,e)}formatAt(t,e,n,r){this.format(n,r)}insertAt(t,e,n){if(null!=n)return void super.insertAt(t,e,n);const r=e.split("\n"),i=r.pop(),s=r.map(t=>{const e=this.scroll.create(Yi.blotName);return e.insertAt(0,t),e}),o=this.split(t);s.forEach(t=>{this.parent.insertBefore(t,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function Xi(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.descendants(oi).reduce((t,n)=>0===n.length()?t:t.insert(n.value(),Qi(n,{},e)),new $i).insert("\n",Qi(t))}function Qi(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==t?e:("formats"in t&&"function"==typeof t.formats&&(e={...e,...t.formats()},n&&delete e["code-token"]),null==t.parent||"scroll"===t.parent.statics.blotName||t.parent.statics.scope!==t.statics.scope?e:Qi(t.parent,e,n))}Ji.scope=Wr.BLOCK_BLOT;const ts=class t extends bi{static value(){}constructor(e,n,r){super(e,n),this.selection=r,this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(e,n){if(0!==this.savedLength)return void super.format(e,n);let r=this,i=0;for(;null!=r&&r.statics.scope!==Wr.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=t.CONTENTS.length,r.optimize(),r.formatAt(i,t.CONTENTS.length,e,n),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}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 e=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 Hi?this.prev:null,r=n?n.length():0,i=this.next instanceof Hi?this.next:null,s=i?i.text:"",{textNode:o}=this,l=o.data.split(t.CONTENTS).join("");let a;if(o.data=t.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 t=document.createTextNode(l);a=this.scroll.create(t),this.parent.insertBefore(a,this)}if(this.remove(),e){const t=(t,e)=>n&&t===n.domNode?e:t===o?r+e-1:i&&t===i.domNode?r+l.length+e:null,s=t(e.start.node,e.start.offset),c=t(e.end.node,e.end.offset);if(null!==s&&null!==c)return{startNode:a.domNode,startOffset:s,endNode:a.domNode,endOffset:c}}return null}update(t,e){if(t.some(t=>"characterData"===t.type&&t.target===this.textNode)){const t=this.restore();t&&(e.range=t)}}optimize(e){super.optimize(e);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=t.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};e(ts,"blotName","cursor"),e(ts,"className","ql-cursor"),e(ts,"tagName","span"),e(ts,"CONTENTS","\ufeff");let es=ts;var ns,rs={exports:{}};var is=(ns||(ns=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new i(r,s||t,o),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],l]:t._events[a].push(l):(t._events[a]=l,t._eventsCount++),t}function o(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}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 t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},l.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];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(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},l.prototype.emit=function(t,e,r,i,s,o){var l=n?n+t:t;if(!this._events[l])return!1;var a,c,u=this._events[l],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,i),!0;case 5:return u.fn.call(u.context,e,r,i,s),!0;case 6:return u.fn.call(u.context,e,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(t,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,e);break;case 3:u[c].fn.call(u[c].context,e,r);break;case 4:u[c].fn.call(u[c].context,e,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(t,e,n){return s(this,t,e,n,!1)},l.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},l.prototype.removeListener=function(t,e,r,i){var s=n?n+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var l=this._events[s];if(l.fn)l.fn!==e||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!==e||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(t){var e;return t?(e=n?n+t:t,this._events[e]&&o(this,e)):(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,t.exports=l}(rs)),rs.exports);const ss=U(is),os=new WeakMap,ls=["error","warn","log","info"];let as="warn";function cs(t){if(as&&ls.indexOf(t)<=ls.indexOf(as))for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r]}function us(t){return ls.reduce((e,n)=>(e[n]=cs.bind(console,n,t),e),{})}us.level=t=>{as=t},cs.level=us.level;const hs=us("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(t=>{document.addEventListener(t,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(t=>{const n=os.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});class ds extends ss{constructor(){super(),this.domListeners={},this.on("error",hs.error)}emit(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return hs.log.call(hs,...e),super.emit(...e)}handleDOM(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];(this.domListeners[t.type]||[]).forEach(e=>{let{node:r,handler:i}=e;(t.target===r||r.contains(t.target))&&i(t,...n)})}listenDOM(t,e,n){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:n})}}e(ds,"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"}),e(ds,"sources",{API:"api",SILENT:"silent",USER:"user"});const fs=us("quill:selection");class ps{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=t,this.length=e}}class ms{constructor(t,e){this.emitter=e,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new ps(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,ds.sources.USER),1)}),this.emitter.on(ds.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const t=this.getNativeRange();null!=t&&t.start.node!==this.cursor.textNode&&this.emitter.once(ds.events.SCROLL_UPDATE,(e,n)=>{try{this.root.contains(t.start.node)&&this.root.contains(t.end.node)&&this.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset);const r=n.some(t=>"characterData"===t.type||"childList"===t.type||"attributes"===t.type&&t.target===this.root);this.update(r?ds.sources.SILENT:e)}catch(r){}})}),this.emitter.on(ds.events.SCROLL_OPTIMIZE,(t,e)=>{if(e.range){const{startNode:t,startOffset:n,endNode:r,endOffset:i}=e.range;this.setNativeRange(t,n,r,i),this.update(ds.sources.SILENT)}}),this.update(ds.sources.SILENT)}handleComposition(){this.emitter.on(ds.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(ds.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const t=this.cursor.restore();if(!t)return;setTimeout(()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(ds.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(t,Wr.BLOCK)){if(n.start.node!==this.cursor.textNode){const t=this.scroll.find(n.start.node,!1);if(null==t)return;if(t instanceof oi){const e=t.split(n.start.offset);t.parent.insertBefore(this.cursor,e)}else t.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;let[i,s]=this.scroll.leaf(t);if(null==i)return null;if(e>0&&s===i.length()){const[e]=this.scroll.leaf(t+1);if(e){const[n]=this.scroll.line(t),[r]=this.scroll.line(t+1);n===r&&(i=e,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(e>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(t+e),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 t=document.getSelection();if(null==t||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(null==e)return null;const n=this.normalizeNative(e);return fs.info("getNativeRange",n),n}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();if(null==e)return[null,null];return[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&gs(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const n=e.map(t=>{const[e,n]=t,r=this.scroll.find(e,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof oi?i+r.index(e,n):i+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new ps(i,r-i)}normalizeNative(t){if(!gs(this.root,t.startContainer)||!t.collapsed&&!gs(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(t=>{let{node:e,offset:n}=t;for(;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length>0?e.childNodes.length:e.childNodes.length+1}t.node=e,t.offset=n}),e}rangeToNative(t){const e=this.scroll.length(),n=(t,n)=>{t=Math.min(e-1,t);const[r,i]=this.scroll.leaf(t);return r?r.position(i,n):[null,-1]};return[...n(t.index,!1),...n(t.index+t.length,!0)]}setNativeRange(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(fs.info("setNativeRange",t,e,n,r),null!=t&&(null==this.root.parentNode||null==t.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=t){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||t!==o.startContainer||e!==o.startOffset||n!==o.endContainer||r!==o.endOffset){t instanceof Element&&"BR"===t.tagName&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(t,e),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ds.sources.API;if("string"==typeof e&&(n=e,e=!1),fs.info("setRange",t),null!=t){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(n)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ds.sources.USER;const e=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Vr(e,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const t=this.cursor.restore();t&&this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}const n=[ds.events.SELECTION_CHANGE,Er(this.lastRange),Er(e),t];this.emitter.emit(ds.events.EDITOR_CHANGE,...n),t!==ds.sources.SILENT&&this.emitter.emit(...n)}}}function gs(t,e){try{e.parentNode}catch(n){return!1}return t.contains(e)}const bs=/^[ -~]*$/;class vs{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const n=Es(t),r=new $i;return function(t){const e=[];return t.forEach(t=>{if("string"==typeof t.insert){t.insert.split("\n").forEach((n,r)=>{r&&e.push({insert:"\n",attributes:t.attributes}),n&&e.push({insert:n,attributes:t.attributes})})}else e.push(t)}),e}(n.ops.slice()).reduce((t,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")&&(e<=t||!!this.scroll.descendant(Ji,t)[0]),this.scroll.insertAt(t,r);const[i,o]=this.scroll.line(t);let a=Kr({},Qi(i));if(i instanceof Yi){const[t]=i.descendant(oi,o);t&&(a=Kr(a,Qi(t)))}s=zi.AttributeMap.diff(a,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;const i=null!=this.scroll.query(r,Wr.INLINE);if(i)(e<=t||this.scroll.descendant(Ji,t)[0])&&(l=!0);else if(t>0){const[e,n]=this.scroll.descendant(oi,t-1);if(e instanceof Hi){"\n"!==e.value()[n]&&(o=!0)}else e instanceof bi&&e.statics.scope===Wr.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(t,r,n.insert[r]),i){const[e]=this.scroll.descendant(oi,t);if(e){const t=Kr({},Qi(e));s=zi.AttributeMap.diff(t,s)||{}}}}e+=i}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const e=Object.keys(n.retain)[0];if(null==e)return t;this.scroll.updateEmbedAt(t,e,n.retain[e])}Object.keys(s).forEach(e=>{this.scroll.formatAt(t,i,e,s[e])});const a=o?1:0,c=l?1:0;return e+=a+c,r.retain(a),r.delete(c),t+i+a+c},0),r.reduce((t,e)=>"number"==typeof e.delete?(this.scroll.deleteAt(t,e.delete),t):t+zi.Op.length(e),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update((new $i).retain(t).delete(e))}formatLine(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(t,Math.max(e,1)).forEach(t=>{t.format(r,n[r])})}),this.scroll.optimize();const r=(new $i).retain(t).retain(e,Er(n));return this.update(r)}formatText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e,r,n[r])});const r=(new $i).retain(t).retain(e,Er(n));return this.update(r)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new $i)}getFormat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach(t=>{const[e]=t;e instanceof Yi?n.push(e):e instanceof oi&&r.push(e)}):(n=this.scroll.lines(t,e),r=this.scroll.descendants(oi,t,e));const[i,s]=[n,r].map(t=>{const e=t.shift();if(null==e)return{};let n=Qi(e);for(;Object.keys(n).length>0;){const e=t.shift();if(null==e)return n;n=ws(Qi(e),n)}return n});return{...i,...s}}getHTML(t,e){const[n,r]=this.scroll.line(t);if(n){const i=n.length();return!(n.length()>=r+e)||0===r&&e===i?xs(this.scroll,t,e,!0):xs(n,r,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(t=>"string"==typeof t.insert).map(t=>t.insert).join("")}insertContents(t,e){const n=Es(e),r=(new $i).retain(t).concat(n);return this.scroll.insertContents(t,n),this.update(r)}insertEmbed(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new $i).retain(t).insert({[e]:n}))}insertText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e.length,r,n[r])}),this.update((new $i).retain(t).insert(e,Er(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if((null==t?void 0:t.statics.blotName)!==Yi.blotName)return!1;const e=t;return!(e.children.length>1)&&e.children.head instanceof Vi}removeFormat(t,e){const n=this.getText(t,e),[r,i]=this.scroll.line(t+e);let s=0,o=new $i;null!=r&&(s=r.length()-i,o=r.delta().slice(i,i+s-1).insert("\n"));const l=this.getContents(t,e+s).diff((new $i).insert(n).concat(o)),a=(new $i).retain(t).concat(l);return this.applyDelta(a)}update(t){let e=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===e.length&&"characterData"===e[0].type&&e[0].target.data.match(bs)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),s=Qi(i),o=i.offset(this.scroll),l=e[0].oldValue.replace(es.CONTENTS,""),a=(new $i).insert(l),c=(new $i).insert(i.value()),u=n&&{oldRange:ks(n.oldRange,-o),newRange:ks(n.newRange,-o)};t=(new $i).retain(o).concat(a.diff(c,u)).reduce((t,e)=>e.insert?t.insert(e.insert,s):t.push(e),new $i),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&Vr(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}function ys(t,e,n){if(0===t.length){const[t]=Ns(n.pop());return e<=0?`</li></${t}>`:`</li></${t}>${ys([],e-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=t,[c,u]=Ns(l);if(o>e)return n.push(l),o===e+1?`<${c}><li${u}>${xs(r,i,s)}${ys(a,o,n)}`:`<${c}><li>${ys(t,e+1,n)}`;const h=n[n.length-1];if(o===e&&l===h)return`</li><li${u}>${xs(r,i,s)}${ys(a,o,n)}`;const[d]=Ns(n.pop());return`</li></${d}>${ys(t,e-1,n)}`}function xs(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in t&&"function"==typeof t.html)return t.html(e,n);if(t instanceof Hi){return Wi(t.value().slice(e,e+n)).replaceAll(" "," ")}if(t instanceof ui){if("list-container"===t.statics.blotName){const r=[];return t.children.forEachAt(e,n,(t,e,n)=>{const i="formats"in t&&"function"==typeof t.formats?t.formats():{};r.push({child:t,offset:e,length:n,indent:i.indent||0,type:i.list})}),ys(r,-1,[])}const i=[];if(t.children.forEachAt(e,n,(t,e,n)=>{i.push(xs(t,e,n))}),r||"list"===t.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=t.domNode,[l,a]=s.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return t.domNode instanceof Element?t.domNode.outerHTML:""}function ws(t,e){return Object.keys(e).reduce((n,r)=>{if(null==t[r])return n;const i=e[r];return i===t[r]?n[r]=i:Array.isArray(i)?i.indexOf(t[r])<0?n[r]=i.concat([t[r]]):n[r]=i:n[r]=[i,t[r]],n},{})}function Ns(t){const e="ordered"===t?"ol":"ul";switch(t){case"checked":return[e,' data-list="checked"'];case"unchecked":return[e,' data-list="unchecked"'];default:return[e,""]}}function Es(t){return t.reduce((t,e)=>{if("string"==typeof e.insert){const n=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(n,e.attributes)}return t.push(e)},new $i)}function ks(t,e){let{index:n,length:r}=t;return new ps(n+e,r)}class As{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=t,this.options=e}}e(As,"DEFAULTS",{});const Ss="\ufeff";class Cs extends bi{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(t=>{this.contentNode.appendChild(t)}),this.leftGuard=document.createTextNode(Ss),this.rightGuard=document.createTextNode(Ss),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e,n=null;const r=t.data.split(Ss).join("");if(t===this.leftGuard)if(this.prev instanceof Hi){const t=this.prev.length();this.prev.insertAt(t,r),n={startNode:this.prev.domNode,startOffset:t+r.length}}else e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this),n={startNode:e,startOffset:r.length};else t===this.rightGuard&&(this.next instanceof Hi?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this.next),n={startNode:e,startOffset:r.length}));return t.data=Ss,n}update(t,e){t.forEach(t=>{if("characterData"===t.type&&(t.target===this.leftGuard||t.target===this.rightGuard)){const n=this.restore(t.target);n&&(e.range=n)}})}}class js{constructor(t,n){e(this,"isComposing",!1),this.scroll=t,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",t=>{this.isComposing||this.handleCompositionStart(t)}),this.scroll.domNode.addEventListener("compositionend",t=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(t)})})}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;!e||e instanceof Cs||(this.emitter.emit(ds.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(ds.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(ds.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(ds.events.COMPOSITION_END,t),this.isComposing=!1}}const _s=class{constructor(t,n){e(this,"modules",{}),this.quill=t,this.options=n}init(){Object.keys(this.options.modules).forEach(t=>{null==this.modules[t]&&this.addModule(t)})}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}};e(_s,"DEFAULTS",{modules:{}}),e(_s,"themes",{default:_s});let qs=_s;const Os=t=>t.parentElement||t.getRootNode().host||null,Ts=t=>{const e=t.getBoundingClientRect(),n="offsetWidth"in t&&Math.abs(e.width)/t.offsetWidth||1,r="offsetHeight"in t&&Math.abs(e.height)/t.offsetHeight||1;return{top:e.top,right:e.left+t.clientWidth*n,bottom:e.top+t.clientHeight*r,left:e.left}},Ls=t=>{const e=parseInt(t,10);return Number.isNaN(e)?0:e},Is=(t,e,n,r,i,s)=>t<n&&e>r?0:t<n?-(n-t+i):e>r?e-t>r-n?t+i-n:e-r+s:0,Rs=["block","break","cursor","inline","scroll","text"],Ms=us("quill"),Bs=new Jr;ui.uiClass="ql-ui";const Ds=class t{static debug(t){!0===t&&(t="log"),us.level(t)}static find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return os.get(t)||Bs.find(t,e)}static import(t){return null==this.imports[t]&&Ms.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const t=arguments.length<=0?void 0:arguments[0],e=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in t?t.attrName:t.blotName;"string"==typeof n?this.register(`formats/${n}`,t,e):Object.keys(t).forEach(n=>{this.register(n,t[n],e)})}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[t]||n||Ms.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&"boolean"!=typeof e&&"abstract"!==e.blotName&&Bs.register(e),"function"==typeof e.register&&e.register(Bs)}}constructor(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(t,e){const n=Us(t);if(!n)throw new Error("Invalid Quill container");const r=!e.theme||e.theme===Ps.DEFAULTS.theme,i=r?qs:Ps.import(`themes/${e.theme}`);if(!i)throw new Error(`Invalid theme ${e.theme}. Did you register it?`);const{modules:s,...o}=Ps.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=Fs(e.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Kr({},Fs(s),Fs(l),c),h={...o,...zs(a),...zs(e)};let d=e.registry;d?e.formats&&Ms.warn('Ignoring "formats" option because "registry" is specified'):d=e.formats?((t,e,n)=>{const r=new Jr;return Rs.forEach(t=>{const n=e.query(t);n&&r.register(n)}),t.forEach(t=>{let i=e.query(t);i||n.error(`Cannot register "${t}" 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: "${t}"`);break}}),r})(e.formats,h.registry,Ms):h.registry;return{...h,registry:d,container:n,theme:i,modules:Object.entries(u).reduce((t,e)=>{let[n,r]=e;if(!r)return t;const i=Ps.import(`modules/${n}`);return null==i?(Ms.error(`Cannot load ${n} module. Are you sure you registered it?`),t):{...t,[n]:Kr({},i.DEFAULTS||{},r)}},{}),bounds:Us(h.bounds)}}(e,n),this.container=this.options.container,null==this.container)return void Ms.error("Invalid Quill container",e);this.options.debug&&t.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",os.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new ds;const i=xi.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 vs(this.scroll),this.selection=new ms(this.scroll,this.emitter),this.composition=new js(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(ds.events.EDITOR_CHANGE,t=>{t===ds.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(ds.events.SCROLL_UPDATE,(t,e)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;$s.call(this,()=>this.editor.update(null,e,i),t)}),this.emitter.on(ds.events.SCROLL_EMBED_UPDATE,(e,n)=>{const r=this.selection.lastRange,[i]=this.selection.getRange(),s=r&&i?{oldRange:r,newRange:i}:void 0;$s.call(this,()=>{const t=(new $i).retain(e.offset(this)).retain({[e.statics.blotName]:n});return this.editor.update(t,[],s)},t.sources.USER)}),r){const t=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(t)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){const e=t;(t=document.createElement("div")).classList.add(e)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,n){return[t,e,,n]=Vs(t,e,n),$s.call(this,()=>this.editor.deleteText(t,e),n,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ds.sources.API;return $s.call(this,()=>{const n=this.getSelection(!0);let r=new $i;if(null==n)return r;if(this.scroll.query(t,Wr.BLOCK))r=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(0===n.length)return this.selection.format(t,e),r;r=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,ds.sources.SILENT),r},n)}formatLine(t,e,n,r,i){let s;return[t,e,s,i]=Vs(t,e,n,r,i),$s.call(this,()=>this.editor.formatLine(t,e,s),i,t,0)}formatText(t,e,n,r,i){let s;return[t,e,s,i]=Vs(t,e,n,r,i),$s.call(this,()=>this.editor.formatText(t,e,s),i,t,0)}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof t?this.selection.getBounds(t,e):this.selection.getBounds(t.index,t.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t;return[t,e]=Vs(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}getIndex(t){return t.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(t){return this.scroll.leaf(t)}getLine(t){return this.scroll.line(t)}getLines(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}getModule(t){return this.theme.modules[t]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=Vs(t,e),this.editor.getHTML(t,e)}getText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=Vs(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(e,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.sources.API;return $s.call(this,()=>this.editor.insertEmbed(e,n,r),i,e)}insertText(t,e,n,r,i){let s;return[t,,s,i]=Vs(t,0,n,r,i),$s.call(this,()=>this.editor.insertText(t,e,s),i,t,e.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(t,e,n){return[t,e,,n]=Vs(t,e,n),$s.call(this,()=>this.editor.removeFormat(t,e),n,t)}scrollRectIntoView(t){((t,e)=>{var n,r,i;const s=t.ownerDocument;let o=e,l=t;for(;l;){const t=l===s.body,e=t?{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}:Ts(l),a=getComputedStyle(l),c=Is(o.left,o.right,e.left,e.right,Ls(a.scrollPaddingLeft),Ls(a.scrollPaddingRight)),u=Is(o.top,o.bottom,e.top,e.bottom,Ls(a.scrollPaddingTop),Ls(a.scrollPaddingBottom));if(c||u)if(t)null==(i=s.defaultView)||i.scrollBy(c,u);else{const{scrollLeft:t,scrollTop:e}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-t,r=l.scrollTop-e;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=t||"fixed"===a.position?null:Os(l)}})(this.root,t)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ds.sources.API;return $s.call(this,()=>{t=new $i(t);const e=this.getLength(),n=this.editor.deleteText(0,e),r=this.editor.insertContents(0,t),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},e)}setSelection(e,n,r){null==e?this.selection.setRange(null,n||t.sources.API):([e,n,,r]=Vs(e,n,r),this.selection.setRange(new ps(Math.max(0,e),n),r),r!==ds.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ds.sources.API;const n=(new $i).insert(t);return this.setContents(n,e)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ds.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ds.sources.API;return $s.call(this,()=>(t=new $i(t),this.editor.applyDelta(t)),e,!0)}};e(Ds,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Bs,theme:"default"}),e(Ds,"events",ds.events),e(Ds,"sources",ds.sources),e(Ds,"version","2.0.3"),e(Ds,"imports",{delta:$i,parchment:Ei,"core/module":As,"core/theme":qs});let Ps=Ds;function Us(t){return"string"==typeof t?document.querySelector(t):t}function Fs(t){return Object.entries(t??{}).reduce((t,e)=>{let[n,r]=e;return{...t,[n]:!0===r?{}:r}},{})}function zs(t){return Object.fromEntries(Object.entries(t).filter(t=>void 0!==t[1]))}function $s(t,e,n,r){if(!this.isEnabled()&&e===ds.sources.USER&&!this.allowReadOnlyEdits)return new $i;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=t();if(null!=i&&(!0===n&&(n=i.index),null==r?i=Hs(i,o,e):0!==r&&(i=Hs(i,n,r,e)),this.setSelection(i,ds.sources.SILENT)),o.length()>0){const t=[ds.events.TEXT_CHANGE,o,s,e];this.emitter.emit(ds.events.EDITOR_CHANGE,...t),e!==ds.sources.SILENT&&this.emitter.emit(...t)}return o}function Vs(t,e,n,r,i){let s={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(i=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(i=r,r=n,n=e,e=0),"object"==typeof n?(s=n,i=r):"string"==typeof n&&(null!=r?s[n]=r:i=n),[t,e,s,i=i||ds.sources.API]}function Hs(t,e,n,r){const i="number"==typeof n?n:0;if(null==t)return null;let s,o;return e&&"function"==typeof e.transformPosition?[s,o]=[t.index,t.index+t.length].map(t=>e.transformPosition(t,r!==ds.sources.USER)):[s,o]=[t.index,t.index+t.length].map(t=>t<e||t===e&&r===ds.sources.USER?t:i>=0?t+i:Math.max(e,t+i)),new ps(s,o-s)}class Ks extends gi{}function Ws(t){return t instanceof Yi||t instanceof Ji}function Zs(t){return"function"==typeof t.updateContent}class Gs extends xi{constructor(t,e,n){let{emitter:r}=n;super(t,e),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",t=>this.handleDragStart(t))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(ds.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(ds.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(ds.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[n,r]=this.line(t),[i]=this.line(t+e);if(super.deleteAt(t,e),null!=i&&n!==i&&r>0){if(n instanceof Ji||i instanceof Ji)return void this.optimize();const t=i.children.head instanceof Vi?null:i.children.head;n.moveChildren(i,t),n.remove()}this.optimize()}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",t?"true":"false")}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.optimize()}insertAt(t,e,n){if(t>=this.length())if(null==n||null==this.scroll.query(e,Wr.BLOCK)){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t),null==n&&e.endsWith("\n")?t.insertAt(0,e.slice(0,-1),n):t.insertAt(0,e,n)}else{const t=this.scroll.create(e,n);this.appendChild(t)}else super.insertAt(t,e,n);this.optimize()}insertBefore(t,e){if(t.statics.scope===Wr.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(t),super.insertBefore(n,e)}else super.insertBefore(t,e)}insertContents(t,e){const n=this.deltaToRenderBlocks(e.concat((new $i).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const e="block"===i.type&&(0===i.delta.length()||!this.descendant(Ji,t)[0]&&t<this.length()),n="block"===i.type?i.delta:(new $i).insert({[i.key]:i.value});Ys(this,t,n);const r="block"===i.type?1:0,s=t+n.length()+r;e&&this.insertAt(s-1,"\n");const o=Qi(this.line(t)[0]),l=zi.AttributeMap.diff(o,i.attributes)||{};Object.keys(l).forEach(t=>{this.formatAt(s-1,1,t,l[t])}),t=s}let[s,o]=this.children.find(t);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach(t=>{if("block"===t.type){Ys(this.createBlock(t.attributes,s||void 0),0,t.delta)}else{const e=this.create(t.key,t.value);this.insertBefore(e,s||void 0),Object.keys(t.attributes).forEach(n=>{e.format(n,t.attributes[n])})}})),"block"===r.type&&r.delta.length()){Ys(this,s?s.offset(s.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[n,r]=e;return n instanceof oi?[n,r]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(Ws,t)}lines(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(t,e,r)=>{let i=[],s=r;return t.children.forEachAt(e,r,(t,e,r)=>{Ws(t)?i.push(t):t instanceof gi&&(i=i.concat(n(t,e,s))),s-=r}),i};return n(this,t,e)}optimize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(t,e),t.length>0&&this.emitter.emit(ds.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch)return void(Array.isArray(t)&&(this.batch=this.batch.concat(t)));let e=ds.sources.USER;"string"==typeof t&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),(t=t.filter(t=>{let{target:e}=t;const n=this.find(e,!0);return n&&!Zs(n)})).length>0&&this.emitter.emit(ds.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(ds.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,n){const[r]=this.descendant(t=>t instanceof Ji,t);r&&r.statics.blotName===e&&Zs(r)&&r.updateContent(n)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let n=new $i;return t.forEach(t=>{const r=null==t?void 0:t.insert;if(r)if("string"==typeof r){const i=r.split("\n");i.slice(0,-1).forEach(r=>{n.insert(r,t.attributes),e.push({type:"block",delta:n,attributes:t.attributes??{}}),n=new $i});const s=i[i.length-1];s&&n.insert(s,t.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,Wr.INLINE)?n.push(t):(n.length()&&e.push({type:"block",delta:n,attributes:{}}),n=new $i,e.push({type:"blockEmbed",key:i,value:r[i],attributes:t.attributes??{}}))}}),n.length()&&e.push({type:"block",delta:n,attributes:{}}),e}createBlock(t,e){let n;const r={};Object.entries(t).forEach(t=>{let[e,i]=t;null!=this.query(e,Wr.BLOCK&Wr.BLOT)?n=e:r[e]=i});const i=this.create(n||this.statics.defaultChild.blotName,n?t[n]:void 0);this.insertBefore(i,e||void 0);const s=i.length();return Object.entries(r).forEach(t=>{let[e,n]=t;i.formatAt(0,s,e,n)}),i}}function Ys(t,e,n){n.reduce((e,n)=>{const r=zi.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;t.insertAt(e,r);const[s]=t.descendant(oi,e),o=Qi(s);i=zi.AttributeMap.diff(o,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;t.insertAt(e,r,n.insert[r]);if(null!=t.scroll.query(r,Wr.INLINE)){const[n]=t.descendant(oi,e),r=Qi(n);i=zi.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach(n=>{t.formatAt(e,r,n,i[n])}),e+r},e)}e(Gs,"blotName","scroll"),e(Gs,"className","ql-editor"),e(Gs,"tagName","DIV"),e(Gs,"defaultChild",Yi),e(Gs,"allowedChildren",[Yi,Ji,Ks]);const Js={scope:Wr.BLOCK,whitelist:["right","center","justify"]},Xs=new Zr("align","align",Js),Qs=new Qr("align","ql-align",Js),to=new ei("align","text-align",Js);class eo extends ei{value(t){let e=super.value(t);if(!e.startsWith("rgb("))return e;e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${e.split(",").map(t=>`00${parseInt(t,10).toString(16)}`.slice(-2)).join("")}`}}const no=new Qr("color","ql-color",{scope:Wr.INLINE}),ro=new eo("color","color",{scope:Wr.INLINE}),io=new Qr("background","ql-bg",{scope:Wr.INLINE}),so=new eo("background","background-color",{scope:Wr.INLINE});class oo extends Ks{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(t=>t.length()<=1?"":t.domNode.innerText).join("\n").slice(t,t+e)}html(t,e){return`<pre>\n${Wi(this.code(t,e))}\n</pre>`}}class lo extends Yi{static register(){Ps.register(oo)}}e(lo,"TAB"," ");class ao extends Gi{}ao.blotName="code",ao.tagName="CODE",lo.blotName="code-block",lo.className="ql-code-block",lo.tagName="DIV",oo.blotName="code-block-container",oo.className="ql-code-block-container",oo.tagName="DIV",oo.allowedChildren=[lo],lo.allowedChildren=[Hi,Vi,es],lo.requiredContainer=oo;const co={scope:Wr.BLOCK,whitelist:["rtl"]},uo=new Zr("direction","dir",co),ho=new Qr("direction","ql-direction",co),fo=new ei("direction","direction",co),po={scope:Wr.INLINE,whitelist:["serif","monospace"]},mo=new Qr("font","ql-font",po);const go=new class extends ei{value(t){return super.value(t).replace(/["']/g,"")}}("font","font-family",po),bo=new Qr("size","ql-size",{scope:Wr.INLINE,whitelist:["small","large","huge"]}),vo=new ei("size","font-size",{scope:Wr.INLINE,whitelist:["10px","18px","32px"]}),yo=us("quill:keyboard"),xo=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class wo extends As{static match(t,e){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!e[n]!==t[n]&&null!==e[n])&&(e.key===t.key||e.key===t.which)}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(t=>{this.options.bindings[t]&&this.addBinding(this.options.bindings[t])}),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(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(t){if("string"==typeof t||"number"==typeof t)t={key:t};else{if("object"!=typeof t)return null;t=Er(t)}t.shortKey&&(t[xo]=t.shortKey,delete t.shortKey);return t}(t);if(null==r)return void yo.warn("Attempted to add invalid keyboard binding",r);"function"==typeof e&&(e={handler:e}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(t=>{const i={...r,key:t,...e,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing)return;if(229===t.keyCode&&("Enter"===t.key||"Backspace"===t.key))return;const e=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(e=>wo.match(t,e));if(0===e.length)return;const n=Ps.find(t.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 Ni?o.value().slice(0,l):"",h=a instanceof Ni?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:t};e.some(t=>{if(null!=t.collapsed&&t.collapsed!==d.collapsed)return!1;if(null!=t.empty&&t.empty!==d.empty)return!1;if(null!=t.offset&&t.offset!==d.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(t=>null==d.format[t]))return!1}else if("object"==typeof t.format&&!Object.keys(t.format).every(e=>!0===t.format[e]?null!=d.format[e]:!1===t.format[e]?null==d.format[e]:Vr(t.format[e],d.format[e])))return!1;return!(null!=t.prefix&&!t.prefix.test(d.prefix))&&(!(null!=t.suffix&&!t.suffix.test(d.suffix))&&!0!==t.handler.call(this,r,d,t))})&&t.preventDefault()})}handleBackspace(t,e){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(0===t.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(t.index);let s=(new $i).retain(t.index-n).delete(n);if(0===e.offset){const[e]=this.quill.getLine(t.index-1);if(e){if(!("block"===e.statics.blotName&&e.length()<=1)){const e=i.formats(),n=this.quill.getFormat(t.index-1,1);if(r=zi.AttributeMap.diff(e,n)||{},Object.keys(r).length>0){const e=(new $i).retain(t.index+i.length()-2).retain(1,r);s=s.compose(e)}}}}this.quill.updateContents(s,Ps.sources.USER),this.quill.focus()}handleDelete(t,e){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(t.index);let s=(new $i).retain(t.index).delete(n);if(e.offset>=i.length()-1){const[e]=this.quill.getLine(t.index+1);if(e){const n=i.formats(),o=this.quill.getFormat(t.index,1);r=zi.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(e.length()-1).retain(1,r))}}this.quill.updateContents(s,Ps.sources.USER),this.quill.focus()}handleDeleteRange(t){Co({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const n=Object.keys(e.format).reduce((t,n)=>(this.quill.scroll.query(n,Wr.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t),{}),r=(new $i).retain(t.index).delete(t.length).insert("\n",n);this.quill.updateContents(r,Ps.sources.USER),this.quill.setSelection(t.index+1,Ps.sources.SILENT),this.quill.focus()}}const No={bindings:{bold:Ao("bold"),italic:Ao("italic"),underline:Ao("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","+1",Ps.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","-1",Ps.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(t,e){null!=e.format.indent?this.quill.format("indent","-1",Ps.sources.USER):null!=e.format.list&&this.quill.format("list",!1,Ps.sources.USER)}},"indent code-block":Eo(!0),"outdent code-block":Eo(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(t){this.quill.deleteText(t.index-1,1,Ps.sources.USER)}},tab:{key:"Tab",handler(t,e){if(e.format.table)return!0;this.quill.history.cutoff();const n=(new $i).retain(t.index).delete(t.length).insert("\t");return this.quill.updateContents(n,Ps.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index+1,Ps.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,Ps.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(t,e){const n={list:!1};e.format.indent&&(n.indent=!1),this.quill.formatLine(t.index,t.length,n,Ps.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(t){const[e,n]=this.quill.getLine(t.index),r={...e.formats(),list:"checked"},i=(new $i).retain(t.index).insert("\n",r).retain(e.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,Ps.sources.USER),this.quill.setSelection(t.index+1,Ps.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(t,e){const[n,r]=this.quill.getLine(t.index),i=(new $i).retain(t.index).insert("\n",e.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,Ps.sources.USER),this.quill.setSelection(t.index+1,Ps.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(t){const e=this.quill.getModule("table");if(e){const[n,r,i,s]=e.getTable(t),o=function(t,e,n,r){if(null==e.prev&&null==e.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==e.prev)return-1;if(null==e.next)return 1;return null}(0,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const e=(new $i).retain(l).insert("\n");this.quill.updateContents(e,Ps.sources.USER),this.quill.setSelection(t.index+1,t.length,Ps.sources.SILENT)}else if(o>0){l+=n.length();const t=(new $i).retain(l).insert("\n");this.quill.updateContents(t,Ps.sources.USER),this.quill.setSelection(l,Ps.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(t,e){const{event:n,line:r}=e,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,Ps.sources.USER):this.quill.setSelection(i+r.length(),Ps.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(t,e){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=e.prefix,[r,i]=this.quill.getLine(t.index);if(i>n)return!0;let s;switch(e.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(t.index," ",Ps.sources.USER),this.quill.history.cutoff();const o=(new $i).retain(t.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:s});return this.quill.updateContents(o,Ps.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.index-n,Ps.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(t){const[e,n]=this.quill.getLine(t.index);let r=2,i=e;for(;null!=i&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,r-=1,r<=0){const r=(new $i).retain(t.index+e.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Ps.sources.USER),this.quill.setSelection(t.index-1,Ps.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":So(!1),"table up":So(!0)}};function Eo(t){return{key:"Tab",shiftKey:!t,format:{"code-block":!0},handler(e,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===e.length&&!r.shiftKey)return this.quill.insertText(e.index,s,Ps.sources.USER),void this.quill.setSelection(e.index+s.length,Ps.sources.SILENT);const o=0===e.length?this.quill.getLines(e.index,1):this.quill.getLines(e);let{index:l,length:a}=e;o.forEach((e,n)=>{t?(e.insertAt(0,s),0===n?l+=s.length:a+=s.length):e.domNode.textContent.startsWith(s)&&(e.deleteAt(0,s.length),0===n?l-=s.length:a-=s.length)}),this.quill.update(Ps.sources.USER),this.quill.setSelection(l,a,Ps.sources.SILENT)}}}function ko(t,e){const n="ArrowLeft"===t?"prefix":"suffix";return{key:t,shiftKey:e,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===t&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof bi)||("ArrowLeft"===t?e?this.quill.setSelection(n.index-1,n.length+1,Ps.sources.USER):this.quill.setSelection(n.index-1,Ps.sources.USER):e?this.quill.setSelection(n.index,n.length+1,Ps.sources.USER):this.quill.setSelection(n.index+n.length+1,Ps.sources.USER),!1)}}}function Ao(t){return{key:t[0],shortKey:!0,handler(e,n){this.quill.format(t,!n.format[t],Ps.sources.USER)}}}function So(t){return{key:t?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(e,n){const r=t?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let t=s.children.head,e=i;for(;null!=e.prev;)e=e.prev,t=t.next;const r=t.offset(this.quill.scroll)+Math.min(n.offset,t.length()-1);this.quill.setSelection(r,0,Ps.sources.USER)}}else{const e=i.table()[r];null!=e&&(t?this.quill.setSelection(e.offset(this.quill.scroll)+e.length()-1,0,Ps.sources.USER):this.quill.setSelection(e.offset(this.quill.scroll),0,Ps.sources.USER))}return!1}}}function Co(t){let{quill:e,range:n}=t;const r=e.getLines(n);let i={};if(r.length>1){const t=r[0].formats(),e=r[r.length-1].formats();i=zi.AttributeMap.diff(e,t)||{}}e.deleteText(n,Ps.sources.USER),Object.keys(i).length>0&&e.formatLine(n.index,1,i,Ps.sources.USER),e.setSelection(n.index,Ps.sources.SILENT)}wo.DEFAULTS=No;const jo=/font-weight:\s*normal/,_o=["P","OL","UL"],qo=t=>t&&_o.includes(t.tagName);const Oo=/\bmso-list:[^;]*ignore/i,To=/\bmso-list:[^;]*\bl(\d+)/i,Lo=/\bmso-list:[^;]*\blevel(\d+)/i,Io=t=>{var e,n;const r=Array.from(t.querySelectorAll("[style*=mso-list]")),i=[],s=[];r.forEach(t=>{(t.getAttribute("style")||"").match(Oo)?i.push(t):s.push(t)}),i.forEach(t=>{var e;return null==(e=t.parentNode)?void 0:e.removeChild(t)});const o=t.documentElement.innerHTML,l=s.map(t=>((t,e)=>{const n=t.getAttribute("style"),r=null==n?void 0:n.match(To);if(!r)return null;const i=Number(r[1]),s=null==n?void 0:n.match(Lo),o=s?Number(s[1]):1,l=new RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=e.match(l);return{id:i,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:t}})(t,o)).filter(t=>t);for(;l.length;){const t=[];let r=l.shift();for(;r;)t.push(r),r=l.length&&(null==(e=l[0])?void 0:e.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const i=document.createElement("ul");t.forEach(t=>{const e=document.createElement("li");e.setAttribute("data-list",t.type),t.indent>1&&e.setAttribute("class","ql-indent-"+(t.indent-1)),e.innerHTML=t.element.innerHTML,i.appendChild(e)});const s=null==(n=t[0])?void 0:n.element,{parentNode:o}=s??{};s&&(null==o||o.replaceChild(i,s)),t.slice(1).forEach(t=>{let{element:e}=t;null==o||o.removeChild(e)})}};const Ro=[function(t){"urn:schemas-microsoft-com:office:word"===t.documentElement.getAttribute("xmlns:w")&&Io(t)},function(t){t.querySelector('[id^="docs-internal-guid-"]')&&((t=>{Array.from(t.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return null==(e=t.getAttribute("style"))?void 0:e.match(jo)}).forEach(e=>{var n;const r=t.createDocumentFragment();r.append(...e.childNodes),null==(n=e.parentNode)||n.replaceChild(r,e)})})(t),(t=>{Array.from(t.querySelectorAll("br")).filter(t=>qo(t.previousElementSibling)&&qo(t.nextElementSibling)).forEach(t=>{var e;null==(e=t.parentNode)||e.removeChild(t)})})(t))}],Mo=us("quill:clipboard"),Bo=[[Node.TEXT_NODE,function(t,e,n){var r;let i=t.data;if("O:P"===(null==(r=t.parentElement)?void 0:r.tagName))return e.insert(i.trim());if(!Ho(t)){if(0===i.trim().length&&i.includes("\n")&&!function(t,e){return t.previousElementSibling&&t.nextElementSibling&&!$o(t.previousElementSibling,e)&&!$o(t.nextElementSibling,e)}(t,n))return e;i=i.replace(/[^\S\u00a0]/g," "),i=i.replace(/ {2,}/g," "),(null==t.previousSibling&&null!=t.parentElement&&$o(t.parentElement,n)||t.previousSibling instanceof Element&&$o(t.previousSibling,n))&&(i=i.replace(/^ /,"")),(null==t.nextSibling&&null!=t.parentElement&&$o(t.parentElement,n)||t.nextSibling instanceof Element&&$o(t.nextSibling,n))&&(i=i.replace(/ $/,"")),i=i.replaceAll(" "," ")}return e.insert(i)}],[Node.TEXT_NODE,Zo],["br",function(t,e){zo(e,"\n")||e.insert("\n");return e}],[Node.ELEMENT_NODE,Zo],[Node.ELEMENT_NODE,function(t,e,n){const r=n.query(t);if(null==r)return e;if(r.prototype instanceof bi){const e={},i=r.value(t);if(null!=i)return e[r.blotName]=i,(new $i).insert(e,r.formats(t,n))}else if(r.prototype instanceof pi&&!zo(e,"\n")&&e.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return Fo(e,r.blotName,r.formats(t,n),n);return e}],[Node.ELEMENT_NODE,function(t,e,n){const r=Zr.keys(t),i=Qr.keys(t),s=ei.keys(t),o={};return r.concat(i).concat(s).forEach(e=>{let r=n.query(e,Wr.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(r=Do[e],null==r||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),r=Po[e],null==r||r.attrName!==e&&r.keyName!==e||(r=Po[e],o[r.attrName]=r.value(t)||void 0))}),Object.entries(o).reduce((t,e)=>{let[r,i]=e;return Fo(t,r,i,n)},e)}],[Node.ELEMENT_NODE,function(t,e,n){var r;const i={},s=t.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(e=Object.entries(i).reduce((t,e)=>{let[r,i]=e;return Fo(t,r,i,n)},e),parseFloat(s.textIndent||0)>0)return(new $i).insert("\t").concat(e);return e}],["li",function(t,e,n){const r=n.query(t);if(null==r||"list"!==r.blotName||!zo(e,"\n"))return e;let i=-1,s=t.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?e:e.reduce((t,e)=>e.insert?e.attributes&&"number"==typeof e.attributes.indent?t.push(e):t.insert(e.insert,{indent:i,...e.attributes||{}}):t,new $i)}],["ol, ul",function(t,e,n){const r=t;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");s&&(i="true"===s?"checked":"unchecked");return Fo(e,"list",i,n)}],["pre",function(t,e,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(t,n);return Fo(e,"code-block",i,n)}],["tr",function(t,e,n){var r,i;const s="TABLE"===(null==(r=t.parentElement)?void 0:r.tagName)?t.parentElement:null==(i=t.parentElement)?void 0:i.parentElement;if(null!=s){return Fo(e,"table",Array.from(s.querySelectorAll("tr")).indexOf(t)+1,n)}return e}],["b",Wo("bold")],["i",Wo("italic")],["strike",Wo("strike")],["style",function(){return new $i}]],Do=[Xs,uo].reduce((t,e)=>(t[e.keyName]=e,t),{}),Po=[to,so,ro,fo,go,vo].reduce((t,e)=>(t[e.keyName]=e,t),{});class Uo extends As{constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",t=>this.onCaptureCopy(t,!1)),this.quill.root.addEventListener("cut",t=>this.onCaptureCopy(t,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Bo.concat(this.options.matchers??[]).forEach(t=>{let[e,n]=t;this.addMatcher(e,n)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:n}=t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[lo.blotName])return(new $i).insert(n||"",{[lo.blotName]:r[lo.blotName]});if(!e)return(new $i).insert(n||"",r);const i=this.convertHTML(e);return zo(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new $i).retain(i.length()-1).delete(1)):i}normalizeHTML(t){(t=>{t.documentElement&&Ro.forEach(e=>{e(t)})})(t)}convertHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");this.normalizeHTML(e);const n=e.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return Ko(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ps.sources.API;if("string"==typeof t){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,Ps.sources.SILENT)}else{const r=this.convert({html:e,text:""});this.quill.updateContents((new $i).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),Ps.sources.SILENT)}}onCaptureCopy(t){var e,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.defaultPrevented)return;t.preventDefault();const[i]=this.quill.selection.getRange();if(null==i)return;const{html:s,text:o}=this.onCopy(i,r);null==(e=t.clipboardData)||e.setData("text/plain",o),null==(n=t.clipboardData)||n.setData("text/html",s),r&&Co({range:i,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(t=>"#"!==t[0]).join("\n")}onCapturePaste(t){var e,n,r,i,s;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(e=t.clipboardData)?void 0:e.getData("text/html");let a=null==(n=t.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const e=null==(r=t.clipboardData)?void 0:r.getData("text/uri-list");e&&(a=this.normalizeURIList(e))}const c=Array.from((null==(i=t.clipboardData)?void 0:i.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const t=(new DOMParser).parseFromString(l,"text/html");if(1===t.body.childElementCount&&"IMG"===(null==(s=t.body.firstElementChild)?void 0:s.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:n,html:r}=e;const i=this.quill.getFormat(t.index),s=this.convert({text:n,html:r},i);Mo.log("onPaste",s,{text:n,html:r});const o=(new $i).retain(t.index).delete(t.length).concat(s);this.quill.updateContents(o,Ps.sources.USER),this.quill.setSelection(o.length()-t.length,Ps.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){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(t.querySelectorAll(s)).forEach(t=>{if(e.has(t)){const n=e.get(t);null==n||n.push(o)}else e.set(t,[o])})}}),[n,r]}}function Fo(t,e,n,r){return r.query(e)?t.reduce((t,r)=>{if(!r.insert)return t;if(r.attributes&&r.attributes[e])return t.push(r);const i=n?{[e]:n}:{};return t.insert(r.insert,{...i,...r.attributes})},new $i):t}function zo(t,e){let n="";for(let r=t.ops.length-1;r>=0&&n.length<e.length;--r){const e=t.ops[r];if("string"!=typeof e.insert)break;n=e.insert+n}return n.slice(-1*e.length)===e}function $o(t,e){if(!(t instanceof Element))return!1;const n=e.query(t);return!(n&&n.prototype instanceof bi)&&["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(t.tagName.toLowerCase())}e(Uo,"DEFAULTS",{matchers:[]});const Vo=new WeakMap;function Ho(t){return null!=t&&(Vo.has(t)||("PRE"===t.tagName?Vo.set(t,!0):Vo.set(t,Ho(t.parentNode))),Vo.get(t))}function Ko(t,e,n,r,i){return e.nodeType===e.TEXT_NODE?r.reduce((n,r)=>r(e,n,t),new $i):e.nodeType===e.ELEMENT_NODE?Array.from(e.childNodes||[]).reduce((s,o)=>{let l=Ko(t,o,n,r,i);return o.nodeType===e.ELEMENT_NODE&&(l=n.reduce((e,n)=>n(o,e,t),l),l=(i.get(o)||[]).reduce((e,n)=>n(o,e,t),l)),s.concat(l)},new $i):new $i}function Wo(t){return(e,n,r)=>Fo(n,t,!0,r)}function Zo(t,e,n){if(!zo(e,"\n")){if($o(t,n)&&(t.childNodes.length>0||t instanceof HTMLParagraphElement))return e.insert("\n");if(e.length()>0&&t.nextSibling){let r=t.nextSibling;for(;null!=r;){if($o(r,n))return e.insert("\n");const t=n.query(r);if(t&&t.prototype instanceof Ji)return e.insert("\n");r=r.firstChild}}}return e}class Go extends As{constructor(t,n){super(t,n),e(this,"lastRecorded",0),e(this,"ignoreChange",!1),e(this,"stack",{undo:[],redo:[]}),e(this,"currentRange",null),this.quill.on(Ps.events.EDITOR_CHANGE,(t,e,n,r)=>{t===Ps.events.SELECTION_CHANGE?e&&r!==Ps.sources.SILENT&&(this.currentRange=e):t===Ps.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Ps.sources.USER?this.transform(e):this.record(e,n)),this.currentRange=Jo(this.currentRange,e))}),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",t=>{"historyUndo"===t.inputType?(this.undo(),t.preventDefault()):"historyRedo"===t.inputType&&(this.redo(),t.preventDefault())})}change(t,e){if(0===this.stack[t].length)return;const n=this.stack[t].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[e].push({delta:i,range:Jo(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,Ps.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(t,e){if(0===t.ops.length)return;this.stack.redo=[];let n=t.invert(e),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const t=this.stack.undo.pop();t&&(n=n.compose(t.delta),r=t.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(t){Yo(this.stack.undo,t),Yo(this.stack.redo,t)}undo(){this.change("undo","redo")}restoreSelection(t){if(t.range)this.quill.setSelection(t.range,Ps.sources.USER);else{const e=function(t,e){const n=e.reduce((t,e)=>t+(e.delete||0),0);let r=e.length()-n;(function(t,e){const n=e.ops[e.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(e=>null!=t.query(e,Wr.BLOCK));return!1})(t,e)&&(r-=1);return r}(this.quill.scroll,t.delta);this.quill.setSelection(e,Ps.sources.USER)}}}function Yo(t,e){let n=e;for(let r=t.length-1;r>=0;r-=1){const e=t[r];t[r]={delta:n.transform(e.delta,!0),range:e.range&&Jo(e.range,n)},n=e.delta.transform(n),0===t[r].delta.length()&&t.splice(r,1)}}function Jo(t,e){if(!t)return t;const n=e.transformPosition(t.index);return{index:n,length:e.transformPosition(t.index+t.length)-n}}e(Go,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class Xo extends As{constructor(t,e){super(t,e),t.root.addEventListener("drop",e=>{var n;e.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(e.clientX,e.clientY);else if(document.caretPositionFromPoint){const t=document.caretPositionFromPoint(e.clientX,e.clientY);r=document.createRange(),r.setStart(t.offsetNode,t.offset),r.setEnd(t.offsetNode,t.offset)}const i=r&&t.selection.normalizeNative(r);if(i){const r=t.selection.normalizedToRange(i);(null==(n=e.dataTransfer)?void 0:n.files)&&this.upload(r,e.dataTransfer.files)}})}upload(t,e){const n=[];Array.from(e).forEach(t=>{var e;t&&(null==(e=this.options.mimetypes)?void 0:e.includes(t.type))&&n.push(t)}),n.length>0&&this.options.handler.call(this,t,n)}}Xo.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(t,e){if(!this.quill.scroll.query("image"))return;const n=e.map(t=>new Promise(e=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.readAsDataURL(t)}));Promise.all(n).then(e=>{const n=e.reduce((t,e)=>t.insert({image:e}),(new $i).retain(t.index).delete(t.length));this.quill.updateContents(n,ds.sources.USER),this.quill.setSelection(t.index+e.length,ds.sources.SILENT)})}};const Qo=["insertText","insertReplacementText"];const tl=/Mac/i.test(navigator.platform);Ps.register({"blots/block":Yi,"blots/block/embed":Ji,"blots/break":Vi,"blots/container":Ks,"blots/cursor":es,"blots/embed":Cs,"blots/inline":Gi,"blots/scroll":Gs,"blots/text":Hi,"modules/clipboard":Uo,"modules/history":Go,"modules/keyboard":wo,"modules/uploader":Xo,"modules/input":class extends As{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",t=>{this.handleBeforeInput(t)}),/Android/i.test(navigator.userAgent)||t.on(Ps.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){Co({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===t.length)return!1;if(e){const n=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents((new $i).retain(t.index).insert(e,n),Ps.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,Ps.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!Qo.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||!0===e.collapsed)return;const n=function(t){var e;if("string"==typeof t.data)return t.data;if(null==(e=t.dataTransfer)?void 0:e.types.includes("text/plain"))return t.dataTransfer.getData("text/plain");return null}(t);if(null==n)return;const r=this.quill.selection.normalizeNative(e),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}},"modules/uiNode":class extends As{constructor(t,n){super(t,n),e(this,"isListening",!1),e(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(t,e){let{line:n,event:r}=e;if(!(n instanceof ui&&n.uiNode))return!0;const i="rtl"===getComputedStyle(n.domNode).direction;return!!(i&&"ArrowRight"!==r.key||!i&&"ArrowLeft"!==r.key)||(this.quill.setSelection(t.index-1,t.length+(r.shiftKey?1:0),Ps.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",t=>{!t.defaultPrevented&&(t=>"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowUp"===t.key||"ArrowDown"===t.key||"Home"===t.key||!(!tl||"a"!==t.key||!0!==t.ctrlKey))(t)&&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 t=document.getSelection();if(!t)return;const e=t.getRangeAt(0);if(!0!==e.collapsed||0!==e.startOffset)return;const n=this.quill.scroll.find(e.startContainer);if(!(n instanceof ui&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),t.removeAllRanges(),t.addRange(r)}}});const el=new class extends Qr{add(t,e){let n=0;if("+1"===e||"-1"===e){const r=this.value(t)||0;n="+1"===e?r+1:r-1}else"number"==typeof e&&(n=e);return 0===n?(this.remove(t),!0):super.add(t,n.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}("indent","ql-indent",{scope:Wr.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class nl extends Yi{}e(nl,"blotName","blockquote"),e(nl,"tagName","blockquote");class rl extends Yi{static formats(t){return this.tagName.indexOf(t.tagName)+1}}e(rl,"blotName","header"),e(rl,"tagName",["H1","H2","H3","H4","H5","H6"]);class il extends Ks{}il.blotName="list-container",il.tagName="OL";class sl extends Yi{static create(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){Ps.register(il)}constructor(t,e){super(t,e);const n=e.ownerDocument.createElement("span"),r=n=>{if(!t.isEnabled())return;const r=this.statics.formats(e,t);"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(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}sl.blotName="list",sl.tagName="LI",il.allowedChildren=[sl],sl.requiredContainer=il;class ol extends Gi{static create(){return super.create()}static formats(){return!0}optimize(t){super.optimize(t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}e(ol,"blotName","bold"),e(ol,"tagName",["STRONG","B"]);class ll extends ol{}e(ll,"blotName","italic"),e(ll,"tagName",["EM","I"]);class al extends Gi{static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return cl(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("href",this.constructor.sanitize(e)):super.format(t,e)}}function cl(t,e){const n=document.createElement("a");n.href=t;const r=n.href.slice(0,n.href.indexOf(":"));return e.indexOf(r)>-1}e(al,"blotName","link"),e(al,"tagName","A"),e(al,"SANITIZED_URL","about:blank"),e(al,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class ul extends Gi{static create(t){return"super"===t?document.createElement("sup"):"sub"===t?document.createElement("sub"):super.create(t)}static formats(t){return"SUB"===t.tagName?"sub":"SUP"===t.tagName?"super":void 0}}e(ul,"blotName","script"),e(ul,"tagName",["SUB","SUP"]);class hl extends ol{}e(hl,"blotName","strike"),e(hl,"tagName",["S","STRIKE"]);class dl extends Gi{}e(dl,"blotName","underline"),e(dl,"tagName","U");class fl extends Cs{static create(t){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return"string"==typeof t&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`<span>${t}</span>`}}e(fl,"blotName","formula"),e(fl,"className","ql-formula"),e(fl,"tagName","SPAN");const pl=["alt","height","width"];class ml extends bi{static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return pl.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return cl(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){pl.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}e(ml,"blotName","image"),e(ml,"tagName","IMG");const gl=["height","width"];class bl extends Ji{static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return gl.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static sanitize(t){return al.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){gl.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`<a href="${t}">${t}</a>`}}e(bl,"blotName","video"),e(bl,"className","ql-video"),e(bl,"tagName","IFRAME");const vl=new Qr("code-token","hljs",{scope:Wr.INLINE});class yl extends Gi{static formats(t,e){for(;null!=t&&t!==e.domNode;){if(t.classList&&t.classList.contains(lo.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,n){super(t,e,n),vl.add(this.domNode,n)}format(t,e){t!==yl.blotName?super.format(t,e):e?vl.add(this.domNode,e):(vl.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),vl.value(this.domNode)||this.unwrap()}}yl.blotName="code-token",yl.className="ql-token";class xl extends lo{static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),yl.blotName,!1),super.replaceWith(t,e)}}class wl extends oo{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===xl.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(t,e)}))}formatAt(t,e,n,r){n===xl.blotName&&(this.forceNext=!0),super.formatAt(t,e,n,r)}highlight(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).map(t=>t.textContent).join("\n")}\n`,r=xl.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const e=this.children.reduce((t,e)=>t.concat(Xi(e,!1)),new $i),i=t(n,r);e.diff(i).reduce((t,e)=>{let{retain:n,attributes:r}=e;return n?(r&&Object.keys(r).forEach(e=>{[xl.blotName,yl.blotName].includes(e)&&this.formatAt(t,n,e,r[e])}),t+n):t},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[n]=this.children.find(t);return`<pre data-language="${n?xl.formats(n.domNode):"plain"}">\n${Wi(this.code(t,e))}\n</pre>`}optimize(t){if(super.optimize(t),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const t=xl.formats(this.children.head.domNode);t!==this.uiNode.value&&(this.uiNode.value=t)}}}wl.allowedChildren=[xl],xl.requiredContainer=wl,xl.allowedChildren=[yl,es,Hi,Vi];class Nl extends As{static register(){Ps.register(yl,!0),Ps.register(xl,!0),Ps.register(wl,!0)}constructor(t,e){if(super(t,e),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((t,e)=>{let{key:n}=e;return t[n]=!0,t},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Ps.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof wl))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(t=>{let{key:n,label:r}=t;const i=e.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),e.appendChild(i)}),e.addEventListener("change",()=>{t.format(xl.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),null==t.uiNode&&(t.attachUI(e),t.children.head&&(e.value=xl.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(Ps.events.SCROLL_OPTIMIZE,()=>{t&&clearTimeout(t),t=setTimeout(()=>{this.highlight(),t=null},this.options.interval)})}highlight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(Ps.sources.USER);const n=this.quill.getSelection();(null==t?this.quill.scroll.descendants(wl):[t]).forEach(t=>{t.highlight(this.highlightBlot,e)}),this.quill.update(Ps.sources.SILENT),null!=n&&this.quill.setSelection(n,Ps.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(e=this.languages[e]?e:"plain","plain"===e)return Wi(t).split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[lo.blotName]:e}),t.insert(n)),new $i);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(lo.className),n.innerHTML=((t,e,n)=>{if("string"==typeof t.versionString){const r=t.versionString.split(".")[0];if(parseInt(r,10)>=11)return t.highlight(n,{language:e}).value}return t.highlight(e,n).value})(this.options.hljs,e,t),Ko(this.quill.scroll,n,[(t,e)=>{const n=vl.value(t);return n?e.compose((new $i).retain(e.length(),{[yl.blotName]:n})):e}],[(t,n)=>t.data.split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[lo.blotName]:e}),t.insert(n)),n)],new WeakMap)}}Nl.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 El=class t extends Yi{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",jl()),e}static formats(t){if(t.hasAttribute("data-row"))return t.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(e,n){e===t.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(e,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};e(El,"blotName","table"),e(El,"tagName","TD");let kl=El;class Al extends Ks{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const t=this.children.head.formats(),e=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return t.table===e.table&&t.table===n.table&&t.table===r.table}return!1}optimize(t){super.optimize(t),this.children.forEach(t=>{if(null==t.next)return;const e=t.formats(),n=t.next.formats();if(e.table!==n.table){const e=this.splitAfter(t);e&&e.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}e(Al,"blotName","table-row"),e(Al,"tagName","TR");class Sl extends Ks{}e(Sl,"blotName","table-body"),e(Sl,"tagName","TBODY");class Cl extends Ks{balanceCells(){const t=this.descendants(Al),e=t.reduce((t,e)=>Math.max(e.children.length,t),0);t.forEach(t=>{new Array(e-t.children.length).fill(0).forEach(()=>{let e;null!=t.children.head&&(e=kl.formats(t.children.head.domNode));const n=this.scroll.create(kl.blotName,e);t.appendChild(n),n.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(Sl);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t);null!=n&&n.remove()})}insertColumn(t){const[e]=this.descendant(Sl);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t),r=kl.formats(e.children.head.domNode),i=this.scroll.create(kl.blotName,r);e.insertBefore(i,n)})}insertRow(t){const[e]=this.descendant(Sl);if(null==e||null==e.children.head)return;const n=jl(),r=this.scroll.create(Al.blotName);e.children.head.children.forEach(()=>{const t=this.scroll.create(kl.blotName,n);r.appendChild(t)});const i=e.children.at(t);e.insertBefore(r,i)}rows(){const t=this.children.head;return null==t?[]:t.children.map(t=>t)}}function jl(){return`row-${Math.random().toString(36).slice(2,6)}`}e(Cl,"blotName","table-container"),e(Cl,"tagName","TABLE"),Cl.allowedChildren=[Sl],Sl.requiredContainer=Cl,Sl.allowedChildren=[Al],Al.requiredContainer=Sl,Al.allowedChildren=[kl],kl.requiredContainer=Al;const _l=us("quill:toolbar");class ql extends As{constructor(t,e){var n,r;if(super(t,e),Array.isArray(this.options.container)){const e=document.createElement("div");e.setAttribute("role","toolbar"),function(t,e){Array.isArray(e[0])||(e=[e]);e.forEach(e=>{const n=document.createElement("span");n.classList.add("ql-formats"),e.forEach(t=>{if("string"==typeof t)Ol(n,t);else{const e=Object.keys(t)[0],r=t[e];Array.isArray(r)?function(t,e,n){const r=document.createElement("select");r.classList.add(`ql-${e}`),n.forEach(t=>{const e=document.createElement("option");!1!==t?e.setAttribute("value",String(t)):e.setAttribute("selected","selected"),r.appendChild(e)}),t.appendChild(r)}(n,e,r):Ol(n,e,r)}}),t.appendChild(n)})}(e,this.options.container),null==(r=null==(n=t.container)?void 0:n.parentNode)||r.insertBefore(e,t.container),this.container=e}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(t=>{var e;const n=null==(e=this.options.handlers)?void 0:e[t];n&&this.addHandler(t,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(t=>{this.attach(t)}),this.quill.on(Ps.events.EDITOR_CHANGE,()=>{const[t]=this.quill.selection.getRange();this.update(t)})):_l.error("Container required for toolbar",this.options)}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(t=>0===t.indexOf("ql-"));if(!e)return;if(e=e.slice(3),"BUTTON"===t.tagName&&t.setAttribute("type","button"),null==this.handlers[e]&&null==this.quill.scroll.query(e))return void _l.warn("ignoring attaching to nonexistent format",e,t);const n="SELECT"===t.tagName?"change":"click";t.addEventListener(n,n=>{let r;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;const e=t.options[t.selectedIndex];r=!e.hasAttribute("selected")&&(e.value||!1)}else r=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[e])this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof bi){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents((new $i).retain(i.index).delete(i.length).insert({[e]:r}),Ps.sources.USER)}else this.quill.format(e,r,Ps.sources.USER);this.update(i)}),this.controls.push([e,t])}update(t){const e=null==t?{}:this.quill.getFormat(t);this.controls.forEach(n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==t)n=null;else if(null==e[r])n=i.querySelector("option[selected]");else if(!Array.isArray(e[r])){let t=e[r];"string"==typeof t&&(t=t.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${t}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==t)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const t=e[r],n=t===i.getAttribute("value")||null!=t&&t.toString()===i.getAttribute("value")||null==t&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const t=null!=e[r];i.classList.toggle("ql-active",t),i.setAttribute("aria-pressed",t.toString())}})}}function Ol(t,e,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${e}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${e}: ${n}`)):r.setAttribute("aria-label",e),t.appendChild(r)}ql.DEFAULTS={},ql.DEFAULTS={container:null,handlers:{clean(){const t=this.quill.getSelection();if(null!=t)if(0===t.length){const t=this.quill.getFormat();Object.keys(t).forEach(t=>{null!=this.quill.scroll.query(t,Wr.INLINE)&&this.quill.format(t,!1,Ps.sources.USER)})}else this.quill.removeFormat(t.index,t.length,Ps.sources.USER)},direction(t){const{align:e}=this.quill.getFormat();"rtl"===t&&null==e?this.quill.format("align","right",Ps.sources.USER):t||"right"!==e||this.quill.format("align",!1,Ps.sources.USER),this.quill.format("direction",t,Ps.sources.USER)},indent(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e),r=parseInt(n.indent||0,10);if("+1"===t||"-1"===t){let e="+1"===t?1:-1;"rtl"===n.direction&&(e*=-1),this.quill.format("indent",r+e,Ps.sources.USER)}},link(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,Ps.sources.USER)},list(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e);"check"===t?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,Ps.sources.USER):this.quill.format("list","unchecked",Ps.sources.USER):this.quill.format("list",t,Ps.sources.USER)}}};const Tl='<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>',Ll={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:Tl,"code-block":Tl,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 Il=0;function Rl(t,e){t.setAttribute(e,`${!("true"===t.getAttribute(e))}`)}class Ml{constructor(t){this.select=t,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",t=>{switch(t.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),t.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),Rl(this.label,"aria-expanded"),Rl(this.options,"aria-hidden")}buildItem(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const n=t.getAttribute("value");return n&&e.setAttribute("data-value",n),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",()=>{this.selectItem(e,!0)}),e.addEventListener("keydown",t=>{switch(t.key){case"Enter":this.selectItem(e,!0),t.preventDefault();break;case"Escape":this.escape(),t.preventDefault()}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.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>',t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${Il}`,Il+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const n=this.buildItem(e);t.appendChild(n),!0===e.selected&&this.selectItem(n)}),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach(t=>{this.container.setAttribute(t.name,t.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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);const e=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class Bl extends Ml{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(t=>{t.classList.add("ql-primary")})}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const n=this.label.querySelector(".ql-color-label"),r=t&&t.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Dl extends Ml{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(t=>{t.innerHTML=e[t.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const n=t||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Pl{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(t=>{const{overflowY:e}=getComputedStyle(t,null);return"visible"!==e&&"clip"!==e})(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(t){const e=t.left+t.width/2-this.root.offsetWidth/2,n=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}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=`${e+s}px`),i.left<r.left&&(s=r.left-i.left,this.root.style.left=`${e+s}px`),i.bottom>r.bottom){const e=i.bottom-i.top,r=t.bottom-t.top+e;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 Ul=[!1,"center","right","justify"],Fl=["#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"],$l=["1","2","3",!1],Vl=["small",!1,"large","huge"];class Hl extends qs{constructor(t,e){super(t,e);const n=e=>{document.body.contains(t.root)?(null==this.tooltip||this.tooltip.root.contains(e.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(t=>{t.container.contains(e.target)||t.close()})):document.body.removeEventListener("click",n)};t.emitter.listenDOM("click",document.body,n)}addModule(t){const e=super.addModule(t);return"toolbar"===t&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(t=>{(t.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=e[n]))if("direction"===n)t.innerHTML=e[n][""]+e[n].rtl;else if("string"==typeof e[n])t.innerHTML=e[n];else{const r=t.value||"";null!=r&&e[n][r]&&(t.innerHTML=e[n][r])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(t=>{if(t.classList.contains("ql-align")&&(null==t.querySelector("option")&&Wl(t,Ul),"object"==typeof e.align))return new Dl(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){const n=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&Wl(t,Fl,"background"===n?"#ffffff":"#000000"),new Bl(t,e[n])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?Wl(t,zl):t.classList.contains("ql-header")?Wl(t,$l):t.classList.contains("ql-size")&&Wl(t,Vl)),new Ml(t)});this.quill.on(ds.events.EDITOR_CHANGE,()=>{this.pickers.forEach(t=>{t.update()})})}}Hl.DEFAULTS=Kr({},qs.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let t=this.container.querySelector("input.ql-image[type=file]");null==t&&(t=document.createElement("input"),t.setAttribute("type","file"),t.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),t.classList.add("ql-image"),t.addEventListener("change",()=>{const e=this.quill.getSelection(!0);this.quill.uploader.upload(e,t.files),t.value=""}),this.container.appendChild(t)),t.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Kl extends Pl{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",t=>{"Enter"===t.key?(this.save(),t.preventDefault()):"Escape"===t.key&&(this.cancel(),t.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",e=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!=e?this.textbox.value=e:t!==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-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,ds.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,ds.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=function(t){let e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(e)return`${e[1]||"https"}://www.youtube.com/embed/${e[2]}?showinfo=0`;if(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${e[1]||"https"}://player.vimeo.com/video/${e[2]}/`;return t}(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(null!=e){const n=e.index+e.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),t,ds.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",ds.sources.USER),this.quill.setSelection(n+2,ds.sources.USER)}break}}this.textbox.value="",this.hide()}}function Wl(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(e=>{const r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(e)),t.appendChild(r)})}const Zl=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Gl extends Kl{constructor(t,e){super(t,e),this.quill.on(ds.events.EDITOR_CHANGE,(t,e,n,r)=>{if(t===ds.events.SELECTION_CHANGE)if(null!=e&&e.length>0&&r===ds.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const t=this.quill.getLines(e.index,e.length);if(1===t.length){const t=this.quill.getBounds(e);null!=t&&this.position(t)}else{const n=t[t.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,e.index+e.length-r),s=this.quill.getBounds(new ps(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(ds.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const t=this.quill.getSelection();if(null!=t){const e=this.quill.getBounds(t);null!=e&&this.position(e)}},1)})}cancel(){this.show()}position(t){const e=super.position(t),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==e&&(n.style.marginLeft=-1*e-n.offsetWidth/2+"px"),e}}e(Gl,"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 Yl extends Hl{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Zl),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new Gl(this.quill,this.options.bounds),null!=t.container&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),Ll),this.buildPickers(t.container.querySelectorAll("select"),Ll))}}Yl.DEFAULTS=Kr({},Hl.DEFAULTS,{modules:{toolbar:{handlers:{link(t){t?this.quill.theme.tooltip.edit():this.quill.format("link",!1,Ps.sources.USER)}}}}});const Jl=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class Xl extends Kl{constructor(){super(...arguments),e(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",t=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",t=>{if(null!=this.linkRange){const t=this.linkRange;this.restoreFocus(),this.quill.formatText(t,"link",!1,ds.sources.USER),delete this.linkRange}t.preventDefault(),this.hide()}),this.quill.on(ds.events.SELECTION_CHANGE,(t,e,n)=>{if(null!=t){if(0===t.length&&n===ds.sources.USER){const[e,n]=this.quill.scroll.descendant(al,t.index);if(null!=e){this.linkRange=new ps(t.index-n,e.length());const r=al.formats(e.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")}}e(Xl,"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 Ql extends Hl{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Jl),super(t,e),this.quill.container.classList.add("ql-snow")}extendToolbar(t){null!=t.container&&(t.container.classList.add("ql-snow"),this.buildButtons(t.container.querySelectorAll("button"),Ll),this.buildPickers(t.container.querySelectorAll("select"),Ll),this.tooltip=new Xl(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,n)=>{t.handlers.link.call(t,!n.format.link)}))}}Ql.DEFAULTS=Kr({},Hl.DEFAULTS,{modules:{toolbar:{handlers:{link(t){if(t){const t=this.quill.getSelection();if(null==t||0===t.length)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&0!==e.indexOf("mailto:")&&(e=`mailto:${e}`);const{tooltip:n}=this.quill.theme;n.edit("link",e)}else this.quill.format("link",!1,Ps.sources.USER)}}}}}),Ps.register({"attributors/attribute/direction":uo,"attributors/class/align":Qs,"attributors/class/background":io,"attributors/class/color":no,"attributors/class/direction":ho,"attributors/class/font":mo,"attributors/class/size":bo,"attributors/style/align":to,"attributors/style/background":so,"attributors/style/color":ro,"attributors/style/direction":fo,"attributors/style/font":go,"attributors/style/size":vo},!0),Ps.register({"formats/align":Qs,"formats/direction":ho,"formats/indent":el,"formats/background":so,"formats/color":ro,"formats/font":mo,"formats/size":bo,"formats/blockquote":nl,"formats/code-block":lo,"formats/header":rl,"formats/list":sl,"formats/bold":ol,"formats/code":ao,"formats/italic":ll,"formats/link":al,"formats/script":ul,"formats/strike":hl,"formats/underline":dl,"formats/formula":fl,"formats/image":ml,"formats/video":bl,"modules/syntax":Nl,"modules/table":class extends As{static register(){Ps.register(kl),Ps.register(Al),Ps.register(Sl),Ps.register(Cl)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Cl).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();null!=e&&(t.deleteColumn(e.cellOffset()),this.quill.update(Ps.sources.USER))}deleteRow(){const[,t]=this.getTable();null!=t&&(t.remove(),this.quill.update(Ps.sources.USER))}deleteTable(){const[t]=this.getTable();if(null==t)return;const e=t.offset();t.remove(),this.quill.update(Ps.sources.USER),this.quill.setSelection(e,Ps.sources.SILENT)}getTable(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==t)return[null,null,null,-1];const[e,n]=this.quill.getLine(t.index);if(null==e||e.statics.blotName!==kl.blotName)return[null,null,null,-1];const r=e.parent;return[r.parent.parent,r,e,n]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[n,r,i]=this.getTable(e);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+t),this.quill.update(Ps.sources.USER);let o=r.rowOffset();0===t&&(o+=1),this.quill.setSelection(e.index+o,e.length,Ps.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[n,r,i]=this.getTable(e);if(null==i)return;const s=r.rowOffset();n.insertRow(s+t),this.quill.update(Ps.sources.USER),t>0?this.quill.setSelection(e,Ps.sources.SILENT):this.quill.setSelection(e.index+r.children.length,e.length,Ps.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const n=this.quill.getSelection();if(null==n)return;const r=new Array(t).fill(0).reduce(t=>{const n=new Array(e).fill("\n").join("");return t.insert(n,{table:jl()})},(new $i).retain(n.index));this.quill.updateContents(r,Ps.sources.USER),this.quill.setSelection(n.index,Ps.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(Ps.events.SCROLL_OPTIMIZE,t=>{t.some(t=>!!["TD","TR","TBODY","TABLE"].includes(t.target.tagName)&&(this.quill.once(Ps.events.TEXT_CHANGE,(t,e,n)=>{n===Ps.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":ql,"themes/bubble":Yl,"themes/snow":Ql,"ui/icons":Ll,"ui/picker":Ml,"ui/icon-picker":Dl,"ui/color-picker":Bl,"ui/tooltip":Pl},!0);const ta=({value:t,onChange:e,placeholder:i,style:s})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new Ps(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:i});const t=l.current;t.on("text-change",(n,r,i)=>{if("user"===i){const n=t.root.innerHTML;null==e||e("<p><br></p>"===n?"":n)}})}},[i]),r.useEffect(()=>{const e=l.current;if(e&&t!==e.root.innerHTML){const n=0===e.getText().trim().length;!t&&n||e.clipboard.dangerouslyPasteHTML(t||"")}},[t]),n.jsx("div",{ref:o,style:{minHeight:"200px",...s}})},ea="_fileUploadWrapper_byo9w_1",na=({value:t,onChange:e,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([]),[k,A]=r.useState(!1),S=t=>{try{const n=t.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(e){}return r||"未知文件"}catch(n){return"未知文件"}},C=t=>t?Array.isArray(t)?t.filter(Boolean):"string"==typeof t?t.split(",").map(t=>t.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const e=C(t);return JSON.stringify(e)},[t]),_=r.useRef(N);r.useEffect(()=>{_.current=N},[N]),r.useEffect(()=>{if(k)return void A(!1);const e=C(t),n=_.current.filter(t=>"done"===t.status).map(t=>t.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(e))if(e.length>0){const t=e.map((t,e)=>({uid:`-${e+1}`,name:S(t),status:"done",url:t}));E(t)}else E([])},[j,k]);const q=r.useCallback(t=>{e&&e(t)},[e]);return n.jsxs("div",{className:ea,children:[n.jsx(i.Upload,{accept:o,listType:l,fileList:N,onPreview:async t=>{const e=t.url||t.preview,n=t.name||"",r=(t=>{const e=t.substring(t.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(e)?"image":[".txt",".json",".xml",".log"].includes(e)?"text":"none"})(n);y(n),w(r),"image"===r?(t.url||t.preview||!t.originFileObj||(t.preview=await(t=>new Promise((e,n)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(r.result),r.onerror=t=>n(t)}))(t.originFileObj)),b(t.url||t.preview),m(!0)):e?window.open(e,"_blank"):i.message.info("文件预览不可用")},onChange:({file:t,fileList:e})=>{var n,r;if(A(!0),"done"===t.status){if(null==(n=t.response)?void 0:n.data){i.message.success(`${t.name} 文件上传成功`);const n=e.map(e=>{var n;return e.uid===t.uid&&(null==(n=e.response)?void 0:n.data)?{...e,url:e.response.data,name:e.name}:e});E(n);const r=n.filter(t=>"done"===t.status).map(t=>{var e;return(null==(e=t.response)?void 0:e.data)||t.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(`${t.name} 文件上传成功,但未获取到 URL。`),E(e.filter(e=>e.uid!==t.uid))}else if("removed"===t.status){i.message.success(`${t.name} 文件已移除`),E(e);const n=e.filter(t=>"done"===t.status).map(t=>{var e;return(null==(e=t.response)?void 0:e.data)||t.url}).filter(Boolean);1===a?null==q||q(void 0):null==q||q(n.length>0?n:void 0)}else if("error"===t.status){i.message.error(`${t.name} 文件上传失败: ${(null==(r=t.error)?void 0:r.message)||"未知错误"}`),E(e);const n=e.filter(t=>"done"===t.status).map(t=>{var e;return(null==(e=t.response)?void 0:e.data)||t.url}).filter(Boolean);1===a?null==q||q(n[0]||void 0):null==q||q(n.length>0?n:void 0)}else E(e)},customRequest:async t=>{var e;const{onSuccess:n,onError:r,file:o,onProgress:l}=t,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==(e=null==p?void 0:p.getOrgInfo())?void 0:e.orgId;u&&c.append("orgId",u.toString());try{const t=await(async(t,e)=>{const n=p.getToken();try{return(await s.post("/api/sterilization-service/common/uploadFile",t,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==e?void 0:e.headers},onUploadProgress:null==e?void 0:e.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t=>{t.total&&l({percent:t.loaded/t.total*100})}});t&&t.data?n(t,o):r(new Error("上传成功但响应中缺少文件URL"),t)}catch(d){r(d)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:t=>!0,children:N.length>=(a||1)?null:n.jsx(i.Button,{icon:n.jsx(Vt,{}),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})]})]})},ra="_treeselectEllipsis_e4t0j_1",ia="_addonAfterSelect_e4t0j_19",sa="_customDisabled_e4t0j_23",{TextArea:oa}=i.Input,la=r.forwardRef((t,e)=>{var s;const{visible:o,mode:c,config:u,initialValues:h,onOk:d,onCancel:f,title:m,loading:g=!1,oneditFormChange:b,modalProps:v={},CustomModalFooter:y,tab:x=!1}=t,[w]=i.Form.useForm(),N="view"==c;r.useImperativeHandle(e,()=>({setFieldsValue:t=>{w.setFieldsValue(t)},getFieldsValue:()=>w.getFieldsValue()})),r.useEffect(()=>{if(o)if(w.resetFields(),"edit"!==c&&"view"!==c||!h){const t=[];x?u.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})})}):u.forEach(e=>{t.push({...e,defaultValue:e.defaultValue||e.defaultValue})}),(null==t?void 0:t.length)>0&&(null==t||t.forEach(t=>{w.setFieldsValue({[null==t?void 0:t.name]:null==t?void 0:t.defaultValue})})),C(w.getFieldValue("useOrgId")||k)}else if(x){const t={...h},e=[];u.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})})}),e.forEach(e=>{const n=t[e.name];if("datePicker"===e.type&&n)t[e.name]=l(n);else if("rangePicker"===e.type&&n)Array.isArray(n)&&(t[e.name]=n.map(t=>l(t)));else if("treeSelect"===e.type&&e.multiple&&n)"string"==typeof n&&(t[e.name]=n.split(","));else if("Radio"===e.type&&e.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=e.options.find(t=>t.value==n);r&&(t[e.name]=r.value)}}),w.setFieldsValue(t)}else{const t={...h};u.forEach(e=>{const n=t[e.name];if("datePicker"===e.type&&n)t[e.name]=l(n);else if("rangePicker"===e.type&&n)Array.isArray(n)&&(t[e.name]=n.map(t=>l(t)));else if("treeSelect"===e.type&&e.multiple&&n)"string"==typeof n&&(t[e.name]=n.split(","));else if("Radio"===e.type&&e.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=e.options.find(t=>t.value==n);r&&(t[e.name]=r.value)}}),w.setFieldsValue(t)}else w.resetFields()},[o,c,h,w]),r.useEffect(()=>{if(o)if("edit"!==c&&"view"!==c||!h)C(w.getFieldValue("useOrgId")||k);else if(x){const t={...h},e=[];u.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})})}),e.forEach(e=>{"datePicker"===e.type&&t[e.name]?t[e.name]=l(t[e.name]):"rangePicker"===e.type&&t[e.name]?Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>l(t))):"treeSelect"===e.type&&e.multiple&&t[e.name]&&"string"==typeof t[e.name]&&(t[e.name]=t[e.name].split(","))})}else{const t={...h};u.forEach(e=>{"datePicker"===e.type&&t[e.name]?t[e.name]=l(t[e.name]):"rangePicker"===e.type&&t[e.name]?Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>l(t))):"treeSelect"===e.type&&e.multiple&&t[e.name]&&"string"==typeof t[e.name]&&(t[e.name]=t[e.name].split(","))})}else w.resetFields()},[u]);const E=(t,e)=>{if("name"==e.name&&!(null==w?void 0:w.getFieldValue("pyCode"))){const e=(n=t.target.value,a.pinyin(n,{pattern:"first",type:"array",nonZh:"consecutive"}).join("").toUpperCase());w.setFieldsValue({pyCode:e})}var n},k=null==(s=p.getOrgInfo())?void 0:s.orgId,[A,C]=r.useState(k),_=r.useMemo(()=>u.some(t=>x&&t.children?t.children.some(t=>"deptSelect"===t.type):"deptSelect"===t.type),[u,x]),q=r.useMemo(()=>u.some(t=>x&&t.children?t.children.some(t=>"orgSelect"===t.type):"orgSelect"===t.type),[u,x]);r.useEffect(()=>{_&&R()},[A,_]),r.useEffect(()=>{q&&M()},[q]);const[O,T]=r.useState([]),[L,I]=r.useState([]),R=async()=>{const t=await S({orgId:A,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===t.code){const e=[{name:"通用",id:-1},...t.data||[]];T(e||[])}},M=async()=>{const t=await S({loginOrgId:k,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===t.code&&I((null==t?void 0:t.data)||[])},B=t=>{if("view"!==c)return;const e=w.getFieldValue(t);if(null==e||""===e)return void i.message.warning("没有内容可复制");let n="";if("object"==typeof e)if(l.isDayjs(e))n=e.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(e))n=e.map(t=>l.isDayjs(t)?t.format("YYYY-MM-DD HH:mm:ss"):String(t)).join(", ");else if(e.addProvince){const t=[e.addProvince,e.addCity,e.addCounty,e.addStreet,e.address].filter(Boolean);n=t.join("-")}else n=JSON.stringify(e);else n=String(e);navigator.clipboard.writeText(n).then(()=>{i.message.success("已复制到剪贴板")}).catch(()=>{const t=document.createElement("textarea");t.value=n,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),i.message.success("已复制到剪贴板")}catch(e){}document.body.removeChild(t)})},D=t=>{var e,r,s,o;const{type:l,name:a,placeholder:c,options:u,rules:h,...d}=t,f=N?"":c||`请输入${t.label}`,p=N?"":c||`请选择${t.label}`;switch(l){case"input":return n.jsx(i.Input,{placeholder:f,...d,readOnly:N||d.readOnly,onDoubleClick:()=>B(a),onBlur:e=>E(e,t)});case"inputoption":return n.jsx(i.Input,{placeholder:f,...d,readOnly:N||d.readOnly,onDoubleClick:()=>B(a),addonAfter:n.jsx(i.Form.Item,{name:t.optionname,noStyle:!0,initialValue:null==(r=null==(e=t.options)?void 0:e[0])?void 0:r.value,children:n.jsx(j,{disabled:N,options:t.options,allowClear:!N})})});case"inputnumberoption":return n.jsx(i.InputNumber,{className:ia,placeholder:f,addonAfter:n.jsx(i.Form.Item,{name:t.optionname,noStyle:!0,initialValue:null==(o=null==(s=t.options)?void 0:s[0])?void 0:o.value,children:n.jsx(j,{disabled:N,options:t.options,allowClear:!N})}),...d});case"password":return n.jsx(i.Input.Password,{placeholder:f,...d,readOnly:N||d.readOnly,onDoubleClick:()=>B(a)});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:p,...d,disabled:N||d.disabled,allowClear:!N});case"InputNumber":return n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:f,...d,readOnly:N||d.readOnly,onDoubleClick:()=>B(a)});case"Radio":return n.jsx("div",{onDoubleClick:()=>B(a),style:{display:"inline-block"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Radio.Group,{style:{pointerEvents:N?"none":"auto",...d.style},disabled:N||d.disabled,options:u,...d})})});case"treeSelect":{const e=!!t.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=t=>{try{const e=(t||[]).map(t=>{var e,n;return"string"==typeof(null==t?void 0:t.label)?t.label:(null==(n=null==(e=null==t?void 0:t.label)?void 0:e.props)?void 0:n.children)??(null==t?void 0:t.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:e,children:["+",t.length,"…"]})}catch(e){return n.jsxs("span",{children:["+",(null==t?void 0:t.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>B(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(j,{className:ra,allowClear:!N,style:{width:"100%"},placeholder:f,treeData:t.options,...e?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:N||d.disabled})})})}case"select":{const e=!!t.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=t=>{try{const e=(t||[]).map(t=>{var e,n;return"string"==typeof(null==t?void 0:t.label)?t.label:(null==(n=null==(e=null==t?void 0:t.label)?void 0:e.props)?void 0:n.children)??(null==t?void 0:t.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:e,children:["+",t.length,"…"]})}catch(e){return n.jsxs("span",{children:["+",(null==t?void 0:t.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>B(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(j,{className:ra,allowClear:!N,style:{width:"100%"},placeholder:f,treeData:t.options,...e?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:N||d.disabled})})})}case"upload":return n.jsx("div",{style:{pointerEvents:N?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(Zt,{value:t.value,...d},`upload_${t.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:N?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(na,{...d})})});case"textarea":return n.jsx(oa,{rows:4,placeholder:f,...d,readOnly:N||d.readOnly,onDoubleClick:()=>B(a)});case"area":return n.jsx("div",{style:{pointerEvents:N?"none":"auto"},onDoubleClick:()=>B(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(Wt,{...d})})});case"richText":const{style:l,...c}=d;return n.jsx("div",{style:{pointerEvents:N?"none":"auto"},onDoubleClick:()=>B(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:t.firstLabel||"first",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:t.firstPlaceholder||`请输入${t.firstLabel||"最小值"}`,decimalSeparator:".",parser:t=>{if(!t)return"";const e=t.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=e.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):e},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:t.separator||"至"}),n.jsx(i.Form.Item,{name:t.secondLabel||"second",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:t.secondPlaceholder||`请输入${t.secondLabel||"最大值"}`,decimalSeparator:".",parser:t=>{if(!t)return"";const e=t.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=e.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):e},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:t.lastUnit})]});case"deptSelect":return n.jsx(j,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:O,disabled:N||d.disabled,...d});case"orgSelect":return n.jsx(j,{onChange:t=>{C(t)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:L,disabled:N||d.disabled,...d});default:return n.jsx(i.Input,{placeholder:f,...d,readOnly:N||d.readOnly,onDoubleClick:()=>B(a)})}},P=m||("add"===c?"新增":"edit"===c?"编辑":"查看");return n.jsx(i.Modal,{title:P,open:o,onOk:async()=>{try{const t={...await w.validateFields()},e=[];x?u.forEach(t=>{t.children&&e.push(...t.children)}):e.push(...u),e.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(t=>l.isDayjs(t)?t.toISOString():t)),"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 d(t)}catch(t){}},onCancel:f,width:v.width||800,confirmLoading:g,destroyOnClose:!0,maskClosable:!1,footer:(t,{OkBtn:e,CancelBtn:r})=>n.jsxs(n.Fragment,{children:[y&&y(w.getFieldsValue()),n.jsx(r,{}),n.jsx(e,{})]}),...v,children:n.jsx(i.Form,{form:w,name:`modal_form_${c}`,layout:"vertical",onValuesChange:(t,e)=>{b&&b(t,e)},children:x?n.jsx(i.Tabs,{children:u.map(t=>{var e;return n.jsx(i.Tabs.TabPane,{tab:t.label,children:n.jsx(i.Row,{gutter:24,justify:"start",children:null==(e=null==t?void 0:t.children)?void 0:e.map(t=>n.jsx(i.Col,{span:t.colSpan||6,children:n.jsx(i.Form.Item,{label:t.label,name:t.name,rules:t.rules,initialValue:t.defaultValue,className:N||t.disabled?sa:"",children:D(t)},t.name)},t.name))})},t.label)})}):n.jsx(i.Row,{gutter:24,justify:"start",children:u.map(t=>n.jsx(i.Col,{span:t.colSpan||6,children:n.jsx(i.Form.Item,{label:t.label,name:t.name,rules:t.rules,initialValue:t.defaultValue,className:N||t.disabled?sa:"",children:D(t)},t.name)},t.name))})})})}),aa="_container_1onnv_1",ca="_searchForm_1onnv_9",ua="_tableContainer_1onnv_15",ha="_pagination_1onnv_52",da=r.forwardRef(({searchFormConfig:t,addFormConfig:e,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,addisdisabled:w={isdisabled:!1,message:""},tableHeight:N=150,limit:E={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:k,onRowClick:A,onDelete:C,tableId:j,isaddtab:_=!1,...O},T)=>{r.useImperativeHandle(T,()=>({getList:async()=>it(),setFieldsValue:t=>{var e;null==(e=J.current)||e.setFieldsValue(t)},getFieldsValue:()=>{var t;return null==(t=J.current)?void 0:t.getFieldsValue()},reload:()=>{it()}}));const[L,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState({current:1,pageSize:15,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:t=>`共 ${t} 条`}),[P,U]=r.useState(!1),[F,z]=r.useState("add"),[$,V]=r.useState(null),[H,K]=r.useState([]),[W,Z]=r.useState([]),[G,Y]=r.useState([]),J=r.useRef(null),X=r.useRef(f),Q=r.useRef(B),tt=r.useRef(null),[et,nt]=r.useState(0),rt=r.useRef(null);r.useEffect(()=>{X.current=f},[f]),r.useEffect(()=>{Q.current=B},[B]);const it=o.debounce(async t=>{var e,n;if(!(null==l?void 0:l.search))return;const r=rt.current.getFieldsValue();for(const o in r)if(o.includes("/")){const t=o.split("/")[0],e=o.split("/")[1],n=r[o];r[t]=n&&n.length>0?r[o][0].format("YYYY-MM-DD"):null,r[e]=n&&n.length>0?r[o][1].format("YYYY-MM-DD"):null}else r[o]=r[o];const i={...null==(e=X.current)?void 0:e.searchParams,...t,pageNum:Q.current.current,pageSize:Q.current.pageSize,...r};g&&delete i.pageNum,g&&delete i.pageSize,I(!0);try{const t=await S(i,l.search);if(200===t.code){const e=(null==(n=null==t?void 0:t.data)?void 0:n.list)||(null==t?void 0:t.data),r=e.map(t=>(t.hasOwnProperty("addCountyCode")&&(t.alladdress={...t}),t)).map(t=>(t.alladdress={...t},t));M(r||[]),D(e=>{var n,r,i;return{...e,current:null==(n=null==t?void 0:t.data)?void 0:n.pageNum,pageSize:null==(r=null==t?void 0:t.data)?void 0:r.pageSize,total:null==(i=null==t?void 0:t.data)?void 0:i.total}})}else M([]),D(t=>({...t,total:0,current:1}))}catch(s){M([]),D(t=>({...t,total:0,current:1}))}finally{I(!1)}},100);r.useEffect(()=>{(null==l?void 0:l.search)&&it()},[B.current,B.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(tt.current&&G.length>0){const t=tt.current.offsetHeight;nt(t)}},[G]);const st=r.useRef(null);r.useEffect(()=>{const t={title:"操作",key:"action",align:"center",width:k||150,fixed:"right",render:(t,e)=>n.jsx(n.Fragment,{children:n.jsxs(i.Space,{size:"small",ref:st,children:["function"==typeof h?h(e):h,l.edit&&E.editLimit&&n.jsx("a",{onClick:()=>lt(e),children:a||"编辑"}),(l.view||l.edit)&&E.addLimit&&n.jsx("a",{onClick:()=>at(e),children:c||"查看"}),l.delete&&E.delLimit&&n.jsx("a",{onClick:()=>ct(e),style:{color:"#f5222d"},children:u||"删除"})]})})},e=l.edit||l.delete||l.view||h,r=[...s],o=e?[...r,t]:r;Z(o)},[]),r.useEffect(()=>{t&&Y(t)},[t]),r.useEffect(()=>{e&&K(e)},[e]);const ot=()=>{V(null),z("add"),U(!0),y&&y()},lt=t=>{V(t),z("edit"),U(!0),y&&y(t)},at=t=>{V(t),z("view"),U(!0)},ct=async t=>{l.delete&&i.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{I(!0);if(200===(await S({id:t.id,...null==f?void 0:f.delParams},l.delete)).code){C&&C(t),i.message.success(`${u||"删除"}成功`);const e=B.current,n=B.pageSize,r=B.total-1;r>0&&(e-1)*n>=r&&e>1?(D(t=>({...t,current:t.current-1})),setTimeout(()=>{it()},0)):it()}}catch(e){}finally{I(!1)}}})},ut=window.parent!==window.self,ht={"--table-height":ut?`calc(100vh - ${et}px - ${N}px + 63px)`:`calc(100vh - ${et}px - ${N}px)`,height:ut?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:aa,style:ht,children:[G.length>0||!m?n.jsx("div",{className:ca,ref:tt,children:n.jsx(q,{config:G,onSearch:()=>{D(t=>({...t,current:1})),it()},onReset:()=>{D(t=>({...t,current:1})),it()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:b||(()=>l.add&&E.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(i.Tooltip,{title:w.isdisabled?w.message:"",children:n.jsx(i.Button,{type:"primary",onClick:ot,disabled:w.isdisabled,children:"新建"})})})),ref:rt})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:ua,style:{height:`calc(100% - ${et}px-35px)`},children:[n.jsx(Kt,{page:B,virtual:g,tableId:j,scroll:{x:"1200px",y:"calc(100vh - 300px)"},onRowClick:A&&A,columns:W,dataSource:p||R,loading:L,pagination:!1,onChange:t=>{D(e=>({...e,current:t.current,pageSize:t.pageSize}))},rowKey:"id",...O}),!g&&n.jsx("div",{className:ha,children:n.jsx(i.Pagination,{size:"small",onChange:(t,e)=>{D(n=>({...n,current:t,pageSize:e}))},...B,showQuickJumper:!1})})]}),n.jsx(la,{CustomModalFooter:v,ref:J,oneditFormChange:x,visible:P,mode:F,config:"view"===F?H.map(t=>({...t,disabled:!0})):H,initialValues:$,onOk:async t=>{if(t.alladdress&&(t={...t,...t.alladdress}),"view"!==F){I(!0);try{let e;e="add"==F?await S({...t,...null==f?void 0:f.addParams},l.add):await S({id:null==$?void 0:$.id,...t,...null==f?void 0:f.editParams},l.edit),200==e.code&&(i.message.success(("add"===F?"添加":"更新")+"成功"),U(!1),it())}catch(e){}finally{I(!1)}}else U(!1)},onCancel:()=>U(!1),title:(()=>{switch(F){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:L,tab:_,modalProps:"view"===F?{footer:[n.jsx(i.Button,{onClick:()=>U(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),fa=r.memo(da);exports.CommonPage=fa,exports.CustomAdd=la,exports.CustomForm=q,exports.CustomTable=Kt,exports.NomalSelect=j;
|
|
6
|
+
*/const H=F((z||(z=1,$=V,function(){var t={}.hasOwnProperty;function e(){for(var t="",e=0;e<arguments.length;e++){var i=arguments[e];i&&(t=r(t,n(i)))}return t}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return e.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)t.call(n,s)&&n[s]&&(i=r(i,s));return i}function r(t,e){return e?t?t+" "+e:t+e:t}$.exports?(e.default=e,$.exports=e):window.classNames=e}()),V.exports)),K=Math.round;function W(t,e){const n=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(t=>parseFloat(t));for(let i=0;i<3;i+=1)r[i]=e(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=(t,e,n)=>0===n?t:t/100;function G(t,e){const n=e||255;return t>n?n:t<0?0:t}class Y{constructor(t){function e(e){return e[0]in t&&e[1]in t&&e[2]in t}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),t)if("string"==typeof t){let e=function(t){return n.startsWith(t)};const n=t.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):e("rgb")?this.fromRgbString(n):e("hsl")?this.fromHslString(n):(e("hsv")||e("hsb"))&&this.fromHsvString(n)}else if(t instanceof Y)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(e("rgb"))this.r=G(t.r),this.g=G(t.g),this.b=G(t.b),this.a="number"==typeof t.a?G(t.a,1):1;else if(e("hsl"))this.fromHsl(t);else{if(!e("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t));this.fromHsv(t)}else;}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const e=this.toHsv();return e.h=t,this._c(e)}getLuminance(){function t(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*t(this.r)+.7152*t(this.g)+.0722*t(this.b)}getHue(){if(void 0===this._h){const t=this.getMax()-this.getMin();this._h=0===t?0:K(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(void 0===this._s){const t=this.getMax()-this.getMin();this._s=0===t?0:t/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(t=10){const e=this.getHue(),n=this.getSaturation();let r=this.getLightness()-t/100;return r<0&&(r=0),this._c({h:e,s:n,l:r,a:this.a})}lighten(t=10){const e=this.getHue(),n=this.getSaturation();let r=this.getLightness()+t/100;return r>1&&(r=1),this._c({h:e,s:n,l:r,a:this.a})}mix(t,e=50){const n=this._c(t),r=e/100,i=t=>(n[t]-this[t])*r+this[t],s={r:K(i("r")),g:K(i("g")),b:K(i("b")),a:K(100*i("a"))/100};return this._c(s)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const e=this._c(t),n=this.a+e.a*(1-this.a),r=t=>K((this[t]*this.a+e[t]*e.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(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const e=(this.r||0).toString(16);t+=2===e.length?e:"0"+e;const n=(this.g||0).toString(16);t+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(t+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const e=K(255*this.a).toString(16);t+=2===e.length?e:"0"+e}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),e=K(100*this.getSaturation()),n=K(100*this.getLightness());return 1!==this.a?`hsla(${t},${e}%,${n}%,${this.a})`:`hsl(${t},${e}%,${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(t,e,n){const r=this.clone();return r[t]=G(e,n),r}_c(t){return new this.constructor(t)}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(t){const e=t.replace("#","");function n(t,n){return parseInt(e[t]+e[n||t],16)}e.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=e[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=e[6]?n(6,7)/255:1)}fromHsl({h:t,s:e,l:n,a:r}){if(this._h=t%360,this._s=e,this._l=n,this.a="number"==typeof r?r:1,e<=0){const t=K(255*n);this.r=t,this.g=t,this.b=t}let i=0,s=0,o=0;const l=t/60,a=(1-Math.abs(2*n-1))*e,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:t,s:e,v:n,a:r}){this._h=t%360,this._s=e,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,e<=0)return;const s=t/60,o=Math.floor(s),l=s-o,a=K(n*(1-e)*255),c=K(n*(1-e*l)*255),u=K(n*(1-e*(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(t){const e=W(t,Z);this.fromHsv({h:e[0],s:e[1],v:e[2],a:e[3]})}fromHslString(t){const e=W(t,Z);this.fromHsl({h:e[0],s:e[1],l:e[2],a:e[3]})}fromRgbString(t){const e=W(t,(t,e)=>e.includes("%")?K(t/100*255):t);this.r=e[0],this.g=e[1],this.b=e[2],this.a=e[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(t,e,n){var r;return(r=Math.round(t.h)>=60&&Math.round(t.h)<=240?n?Math.round(t.h)-2*e:Math.round(t.h)+2*e:n?Math.round(t.h)+2*e:Math.round(t.h)-2*e)<0?r+=360:r>=360&&(r-=360),r}function Q(t,e,n){return 0===t.h&&0===t.s?t.s:((r=n?t.s-.16*e:4===e?t.s+.16:t.s+.05*e)>1&&(r=1),n&&5===e&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function tt(t,e,n){var r;return r=n?t.v+.05*e:t.v-.15*e,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var et=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function nt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function rt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?nt(Object(n),!0).forEach(function(e){D(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}et.primary=et[5];var it="data-rc-order",st="data-rc-priority",ot=new Map;function lt(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return t?t.startsWith("data-")?t:"data-".concat(t):"rc-util-key"}function at(t){return t.attachTo?t.attachTo:document.querySelector("head")||document.body}function ct(t){return Array.from((ot.get(t)||t).children).filter(function(t){return"STYLE"===t.tagName})}function ut(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=e.csp,r=e.prepend,i=e.priority,s=void 0===i?0:i,o=function(t){return"queue"===t?"prependQueue":t?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(it,o),l&&s&&a.setAttribute(st,"".concat(s)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=t;var c=at(e),u=c.firstChild;if(r){if(l){var h=(e.styles||ct(c)).filter(function(t){if(!["prepend","prependQueue"].includes(t.getAttribute(it)))return!1;var e=Number(t.getAttribute(st)||0);return s>=e});if(h.length)return c.insertBefore(a,h[h.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function ht(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=at(n),i=ct(r),s=rt(rt({},n),{},{styles:i});!function(t,e){var n=ot.get(t);if(!n||!function(t,e){if(!t)return!1;if(t.contains)return t.contains(e);for(var n=e;n;){if(n===t)return!0;n=n.parentNode}return!1}(document,n)){var r=ut("",e),i=r.parentNode;ot.set(t,i),t.removeChild(r)}}(r,s);var o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=at(e);return(e.styles||ct(n)).find(function(n){return n.getAttribute(lt(e))===t})}(e,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!==t&&(o.innerHTML=t),o}var u=ut(t,s);return u.setAttribute(lt(s),e),u}function dt(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}function ft(t){return function(t){return dt(t)instanceof ShadowRoot}(t)?dt(t):null}var pt={},mt=[];function gt(t,e){if("production"!==process.env.NODE_ENV&&!t&&void 0!==console)mt.reduce(function(t,e){return e(null!=t?t:"","warning")},e)}function bt(t,e){if("production"!==process.env.NODE_ENV&&!t&&void 0!==console)mt.reduce(function(t,e){return e(null!=t?t:"","note")},e)}function vt(t,e,n){e||pt[n]||(t(!1,n),pt[n]=!0)}function yt(t,e){vt(gt,t,e)}function xt(t){return"object"===M(t)&&"string"==typeof t.name&&"string"==typeof t.theme&&("object"===M(t.icon)||"function"==typeof t.icon)}function wt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(t).reduce(function(e,n){var r,i=t[n];if("class"===n)e.className=i,delete e.class;else delete e[n],e[(r=n,r.replace(/-(.)/g,function(t,e){return e.toUpperCase()}))]=i;return e},{})}function Nt(t,e,n){return n?r.createElement(t.tag,rt(rt({key:e},wt(t.attrs)),n),(t.children||[]).map(function(n,r){return Nt(n,"".concat(e,"-").concat(t.tag,"-").concat(r))})):r.createElement(t.tag,rt({key:e},wt(t.attrs)),(t.children||[]).map(function(n,r){return Nt(n,"".concat(e,"-").concat(t.tag,"-").concat(r))}))}function Et(t){return function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Y(t),i=r.toHsv(),s=5;s>0;s-=1){var o=new Y({h:X(i,s,!0),s:Q(i,s,!0),v:tt(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:tt(i,l)});n.push(a)}return"dark"===e.theme?J.map(function(t){var r=t.index,i=t.amount;return new Y(e.backgroundColor||"#141414").mix(n[r],i).toHexString()}):n.map(function(t){return t.toHexString()})}(t)[0]}function kt(t){return t?Array.isArray(t)?t:[t]:[]}yt.preMessage=function(t){mt.push(t)},yt.resetWarned=function(){pt={}},yt.noteOnce=function(t,e){vt(bt,t,e)};var At=["icon","className","onClick","style","primaryColor","secondaryColor"],St={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var Ct=function(t){var e,n,i,s,o,l,a,c,u=t.icon,d=t.className,f=t.onClick,p=t.style,m=t.primaryColor,g=t.secondaryColor,b=P(t,At),v=h.useRef(),y=St;if(m&&(y={primaryColor:m,secondaryColor:g||Et(m)}),e=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 t=ft(e.current);ht(l,"@ant-design-icons",{prepend:!o,csp:i,attachTo:t})},[]),a=xt(u),c="icon should be icon definiton, but got ".concat(u),yt(a,"[@ant-design/icons] ".concat(c)),!xt(u))return null;var x=u;return x&&"function"==typeof x.icon&&(x=rt(rt({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),Nt(x.icon,"svg-".concat(x.name),rt(rt({className:d,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},b),{},{ref:v}))};function jt(t){var e=R(kt(t),2),n=e[0],r=e[1];return Ct.setTwoToneColors({primaryColor:n,secondaryColor:r})}Ct.displayName="IconReact",Ct.getTwoToneColors=function(){return rt({},St)},Ct.setTwoToneColors=function(t){var e=t.primaryColor,n=t.secondaryColor;St.primaryColor=e,St.secondaryColor=n||Et(e),St.calculated=!!n};var _t=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];jt(et.primary);var qt=h.forwardRef(function(t,e){var n=t.className,r=t.icon,i=t.spin,s=t.rotate,o=t.tabIndex,l=t.onClick,a=t.twoToneColor,c=P(t,_t),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(kt(a),2),y=v[0],x=v[1];return h.createElement("span",L({role:"img","aria-label":r.name},c,{ref:e,tabIndex:g,onClick:l,className:m}),h.createElement(Ct,{icon:r,primaryColor:y,secondaryColor:x,style:b}))});qt.displayName="AntdIcon",qt.getTwoToneColor=function(){var t=Ct.getTwoToneColors();return t.calculated?[t.primaryColor,t.secondaryColor]:t.primaryColor},qt.setTwoToneColor=jt;var Ot={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"},Tt=function(t,e){return h.createElement(qt,L({},t,{ref:e,icon:Ot}))},Lt=h.forwardRef(Tt);"production"!==process.env.NODE_ENV&&(Lt.displayName="DownOutlined");var It={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"},Rt=function(t,e){return h.createElement(qt,L({},t,{ref:e,icon:It}))},Mt=h.forwardRef(Rt);"production"!==process.env.NODE_ENV&&(Mt.displayName="PlusOutlined");var Bt={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"},Dt=function(t,e){return h.createElement(qt,L({},t,{ref:e,icon:Bt}))},Pt=h.forwardRef(Dt);"production"!==process.env.NODE_ENV&&(Pt.displayName="RightOutlined");var Ut={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"},Ft=function(t,e){return h.createElement(qt,L({},t,{ref:e,icon:Ut}))},zt=h.forwardRef(Ft);"production"!==process.env.NODE_ENV&&(zt.displayName="SettingOutlined");var $t={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"},Vt=function(t,e){return h.createElement(qt,L({},t,{ref:e,icon:$t}))},Ht=h.forwardRef(Vt);"production"!==process.env.NODE_ENV&&(Ht.displayName="UploadOutlined");const{Option:Kt}=i.Select,Wt=({columns:t,dataSource:e,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([]),[k,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==t?void 0:t.map(t=>t.dataIndex||t.key).join(","))||"",[t]),I=r.useCallback(async()=>{var e,n,r;const i=(null==t?void 0:t.map((t,e)=>({key:t.key||t.dataIndex||`col-${e}`,title:t.title,dataIndex:t.dataIndex,displayTitle:"string"==typeof t.title?t.title:`列 ${e+1}`,headerAlignment:t.align||"left",contentAlignment:t.align||"left",dataFormat:"字符串",width:t.width||100,enabled:!0,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:e+1,render:t.render,fixed:t.fixed,originalColumn:{...t}})))||[];if(E(i),t.length>1)try{if(l){const o=await(s={userId:q.userId,tableId:l||""},A("/platform/business/common/getTableConfigByUser",s));if(null==(e=null==o?void 0:o.data)?void 0:e.content){const e=null==(r=JSON.parse(null==(n=null==o?void 0:o.data)?void 0:n.content))?void 0:r.map(e=>{var n;const r=null==(n=t.find(t=>t.key===e.key))?void 0:n.render;return{...e,render:r,originalColumn:{...e.originalColumn,render:r}}});w(e),S(e)}else w(i),S(i)}else w(i),S(i)}catch(o){w(i),S(i)}else w(i),S(i);var s},[t,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 t=x.filter(t=>t.enabled).sort((t,e)=>t.sort-e.sort).map(t=>({...t.originalColumn,key:t.key,title:t.displayTitle,dataIndex:t.dataIndex,align:t.contentAlignment,width:Number(t.width)})),e=[...h?[{title:n.jsxs(i.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(i.Tooltip,{title:"表格配置",children:n.jsx(zt,{onClick:()=>y(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(t,e,r)=>n.jsx(n.Fragment,{children:n.jsx(n.Fragment,{children:t||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+r+1||r+1})})}]:[],...t].map(t=>{const e=t.render;return{...t,render:(s,o,l)=>e?e(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:t.width,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s?String(s):""})}):""}});m(e)},[x,h,u]),r.useEffect(()=>{const t=null==e?void 0:e.map((t,e)=>({...t,parentId:(null==t?void 0:t.parentId)||null,id:(null==t?void 0:t.id)||e+1,INDEX:(null==t?void 0:t.INDEX)||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+e+1||e+1}));_(null==t?void 0:t.map(t=>t.id)),b(t)},[e]);const M=r.useRef(null),B=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(t,e)=>n.jsx(i.Input,{size:"small",defaultValue:t,onBlur:t=>D(e.key,"displayTitle",t.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(t,e)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:t,onChange:t=>D(e.key,"headerAlignment",t.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:(t,e)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:t,onChange:t=>D(e.key,"contentAlignment",t.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:(t,e)=>n.jsxs(i.Select,{size:"small",defaultValue:t,style:{width:80},onChange:t=>D(e.key,"dataFormat",t),children:[n.jsx(Kt,{value:"字符串",children:"字符串"}),n.jsx(Kt,{value:"数字",children:"数字"}),n.jsx(Kt,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(t,e)=>n.jsx(i.InputNumber,{size:"small",defaultValue:t,style:{width:60},onBlur:t=>D(e.key,"width",t.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(t,e)=>n.jsx(i.Switch,{size:"small",defaultValue:t,onChange:t=>D(e.key,"enabled",t)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(t,e)=>n.jsx(i.Switch,{size:"small",defaultValue:t,onChange:t=>D(e.key,"allowSorting",t)})},{title:"排序",dataIndex:"sort",key:"sort",render:(t,e)=>n.jsx(i.InputNumber,{size:"small",defaultValue:t,style:{width:60},onBlur:t=>D(e.key,"sort",t.target.value)})}],D=(t,e,n)=>{S(r=>r.map(r=>r.key===t?{...r,[e]:n}:r))},P=async()=>{try{const e=await(t={tableId:l||"",userId:null==q?void 0:q.userId,content:JSON.stringify(k)},A("/platform/business/common/saveUserTableConfig",t));w(k),200===(null==e?void 0:e.code)&&(i.message.success("保存成功"),R())}catch(e){}var t},U=()=>{y(!1)},F=(t,e=!1)=>{_(e?j.filter(e=>e!==(null==t?void 0:t.id)):[...j,null==t?void 0:t.id])};return n.jsxs(n.Fragment,{children:[n.jsx(i.Table,{columns:f,dataSource:g,bordered:!0,rowKey:"id",pagination:s,size:"small",onRow:t=>({onClick:e=>{c&&c(t,e)}}),expandable:{expandedRowKeys:j,expandIcon:({expanded:t,onExpand:e,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 t?n.jsx(Lt,{onClick:t=>{e(r,t),F(r,!0)},style:i}):n.jsx(Pt,{onClick:t=>{e(r,t),F(r,!1)},style:i})}return null}},...d}),n.jsx(i.Modal,{title:"表格设置",visible:v,footer:[n.jsx(i.Button,{onClick:async()=>{var t;200===(await(t={userId:q.userId,tableId:l||""},A("/platform/business/common/restoreDefaultTableConfig",t))).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:k.filter(t=>!t.isBuiltIn),rowKey:"key",size:"small",pagination:!1,bordered:!0})})})})]})},Zt=({label:t,id:e,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),[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,z]=r.useState(""),[$,V]=r.useState({}),H=r.useCallback(t=>{o&&o(t)},[o]),K=r.useCallback(async(t,e)=>{switch(t){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:t,parent:e.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(t=>({value:t.code,label:t.name})):[]}catch(n){return[]}finally{switch(t){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(t=>{c(t),$&&(h(s.addProvinceCode),m(s.addProvince))})},[]),r.useEffect(()=>{$&&(A($.addCityCode),T($.addCountyCode),D($.addStreetCode),b($.addCity),y($.addCounty),w($.addStreet),z($.address))},[$]),r.useEffect(()=>{u?K(2,u).then(t=>{E(t),$&&(A($.addCityCode),b($.addCity))}):(b(void 0),y(void 0),w(void 0),m(void 0),z(""),A(void 0),E([]),T(void 0),q([]),D(void 0),M([]))},[u,K]),r.useEffect(()=>{k?K(3,k).then(t=>{q(t),$&&(T($.addCountyCode),y($.addCounty))}):(T(void 0),q([]),D(void 0),M([]),z(""))},[k,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(t=>{M(t),$&&(D($.addStreetCode),w($.addStreet),z($.address))}):(D(void 0),M([]),z(""))},[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:k,addCounty:v,addCountyCode:O,addStreet:x,addStreetCode:B,address:F})},[p,g,v,u,k,O,B,x,F]);return n.jsxs("div",{children:[" ",n.jsxs(i.Space,{wrap:!0,id:e,children:[" ",n.jsx(i.Select,{style:{minWidth:100},options:a,value:u,onChange:t=>{var e;t===u&&void 0!==t||(h(t),m(null==(e=a.find(e=>e.value===t))?void 0:e.label))},placeholder:"请选择省",loading:d,disabled:l,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:N,value:k,onChange:t=>{var e;t===k&&void 0!==t||(b(null==(e=N.find(e=>e.value===t))?void 0:e.label),A(t))},placeholder:"请选择市",loading:C,disabled:l||!u||d,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:_,value:O,onChange:t=>{var e;t===O&&void 0!==t||(T(t),y(null==(e=_.find(e=>e.value===t))?void 0:e.label))},placeholder:"请选择区/县",loading:L,disabled:l||!k||C,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:R,value:B,onChange:t=>{var e;t===B&&void 0!==t||(D(t),w(null==(e=R.find(e=>e.value===t))?void 0:e.label))},placeholder:"请选择乡/镇",loading:P,disabled:l||!O||L,allowClear:!0}),n.jsx(i.Input,{placeholder:"请输入详细地址",disabled:l||!B,value:F,onChange:t=>z(t.target.value)})]})]})},Gt=({value:t,onChange:e,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(t?[{uid:"-1",name:"image.png",status:"done",url:t}]:[])},[t]);const v=r.useCallback(t=>{e&&e(t)},[e]),y=n.jsxs("div",{children:[n.jsx(Mt,{}),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 t=>{t.url||t.preview||t.originFileObj&&(t.preview=await(t=>new Promise((e,n)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(r.result),r.onerror=t=>n(t)}))(t.originFileObj)),f(t.url||t.preview),h(!0),m(t.name||t.url.substring(t.url.lastIndexOf("/")+1))},onChange:({file:t,fileList:e})=>{var n,r;if(b(e),"done"===t.status){const r=null==(n=t.response)?void 0:n.data;r?(i.message.success(`${t.name} 文件上传成功`),null==v||v(r)):(i.message.error(`${t.name} 文件上传成功,但未获取到 URL。`),b(e.filter(e=>e.uid!==t.uid)))}else"removed"===t.status?(i.message.success(`${t.name} 文件已移除`),null==v||v(void 0)):"error"===t.status&&(i.message.error(`${t.name} 文件上传失败: ${(null==(r=t.error)?void 0:r.message)||"未知错误"}`),null==v||v(void 0))},customRequest:async t=>{const{onSuccess:e,onError:n,file:r,onProgress:s}=t;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 t=await(l=o,a={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t=>{t.total&&s({percent:t.loaded/t.total*100})}},A("/platform/general/upload",l,a));t&&t.data?(null==v||v(t.data),e(t,r)):n(new Error("上传成功但响应中缺少图片URL"),t)}catch(c){n(c)}var l,a},maxCount:l,disabled:c,onRemove:t=>!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 Yt="object"==typeof global&&global&&global.Object===Object&&global,Jt="object"==typeof self&&self&&self.Object===Object&&self,Xt=Yt||Jt||Function("return this")(),Qt=Xt.Symbol,te=Object.prototype,ee=te.hasOwnProperty,ne=te.toString,re=Qt?Qt.toStringTag:void 0;var ie=Object.prototype.toString;var se=Qt?Qt.toStringTag:void 0;function oe(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":se&&se in Object(t)?function(t){var e=ee.call(t,re),n=t[re];try{t[re]=void 0;var r=!0}catch(s){}var i=ne.call(t);return r&&(e?t[re]=n:delete t[re]),i}(t):function(t){return ie.call(t)}(t)}function le(t){return null!=t&&"object"==typeof t}var ae=Array.isArray;function ce(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ue(t){return t}function he(t){if(!ce(t))return!1;var e=oe(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var de,fe=Xt["__core-js_shared__"],pe=(de=/[^.]+$/.exec(fe&&fe.keys&&fe.keys.IE_PROTO||""))?"Symbol(src)_1."+de:"";var me=Function.prototype.toString;function ge(t){if(null!=t){try{return me.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var be=/^\[object .+?Constructor\]$/,ve=Function.prototype,ye=Object.prototype,xe=ve.toString,we=ye.hasOwnProperty,Ne=RegExp("^"+xe.call(we).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ee(t){return!(!ce(t)||(e=t,pe&&pe in e))&&(he(t)?Ne:be).test(ge(t));var e}function ke(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ee(n)?n:void 0}var Ae=ke(Xt,"WeakMap"),Se=Object.create,Ce=function(){function t(){}return function(e){if(!ce(e))return{};if(Se)return Se(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var je=Date.now;var _e,qe,Oe,Te=function(){try{var t=ke(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),Le=Te?function(t,e){return Te(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:ue,Ie=(_e=Le,qe=0,Oe=0,function(){var t=je(),e=16-(t-Oe);if(Oe=t,e>0){if(++qe>=800)return arguments[0]}else qe=0;return _e.apply(void 0,arguments)});var Re=/^(?:0|[1-9]\d*)$/;function Me(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Re.test(t))&&t>-1&&t%1==0&&t<e}function Be(t,e,n){"__proto__"==e&&Te?Te(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function De(t,e){return t===e||t!=t&&e!=e}var Pe=Object.prototype.hasOwnProperty;function Ue(t,e,n){var r=t[e];Pe.call(t,e)&&De(r,n)&&(void 0!==n||e in t)||Be(t,e,n)}var Fe=Math.max;function ze(t,e){return Ie(function(t,e,n){return e=Fe(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=Fe(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=n(o),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,l)}}(t,e,ue),t+"")}function $e(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ve(t){return null!=t&&$e(t.length)&&!he(t)}var He=Object.prototype;function Ke(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||He)}function We(t){return le(t)&&"[object Arguments]"==oe(t)}var Ze=Object.prototype,Ge=Ze.hasOwnProperty,Ye=Ze.propertyIsEnumerable,Je=We(function(){return arguments}())?We:function(t){return le(t)&&Ge.call(t,"callee")&&!Ye.call(t,"callee")};var Xe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qe=Xe&&"object"==typeof module&&module&&!module.nodeType&&module,tn=Qe&&Qe.exports===Xe?Xt.Buffer:void 0,en=(tn?tn.isBuffer:void 0)||function(){return!1},nn={};function rn(t){return function(e){return t(e)}}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&&Yt.process,an=function(){try{var t=on&&on.require&&on.require("util").types;return t||ln&&ln.binding&&ln.binding("util")}catch(e){}}(),cn=an&&an.isTypedArray,un=cn?rn(cn):function(t){return le(t)&&$e(t.length)&&!!nn[oe(t)]},hn=Object.prototype.hasOwnProperty;function dn(t,e){var n=ae(t),r=!n&&Je(t),i=!n&&!r&&en(t),s=!n&&!r&&!i&&un(t),o=n||r||i||s,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!e&&!hn.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Me(c,a))||l.push(c);return l}function fn(t,e){return function(n){return t(e(n))}}var pn=fn(Object.keys,Object),mn=Object.prototype.hasOwnProperty;function gn(t){return Ve(t)?dn(t):function(t){if(!Ke(t))return pn(t);var e=[];for(var n in Object(t))mn.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var bn=Object.prototype.hasOwnProperty;function vn(t){if(!ce(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Ke(t),n=[];for(var r in t)("constructor"!=r||!e&&bn.call(t,r))&&n.push(r);return n}function yn(t){return Ve(t)?dn(t,!0):vn(t)}var xn=ke(Object,"create");var wn=Object.prototype.hasOwnProperty;var Nn=Object.prototype.hasOwnProperty;function En(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function kn(t,e){for(var n=t.length;n--;)if(De(t[n][0],e))return n;return-1}En.prototype.clear=function(){this.__data__=xn?xn(null):{},this.size=0},En.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},En.prototype.get=function(t){var e=this.__data__;if(xn){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return wn.call(e,t)?e[t]:void 0},En.prototype.has=function(t){var e=this.__data__;return xn?void 0!==e[t]:Nn.call(e,t)},En.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=xn&&void 0===e?"__lodash_hash_undefined__":e,this};var An=Array.prototype.splice;function Sn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Sn.prototype.clear=function(){this.__data__=[],this.size=0},Sn.prototype.delete=function(t){var e=this.__data__,n=kn(e,t);return!(n<0)&&(n==e.length-1?e.pop():An.call(e,n,1),--this.size,!0)},Sn.prototype.get=function(t){var e=this.__data__,n=kn(e,t);return n<0?void 0:e[n][1]},Sn.prototype.has=function(t){return kn(this.__data__,t)>-1},Sn.prototype.set=function(t,e){var n=this.__data__,r=kn(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var Cn=ke(Xt,"Map");function jn(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function _n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];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(t){var e=jn(this,t).delete(t);return this.size-=e?1:0,e},_n.prototype.get=function(t){return jn(this,t).get(t)},_n.prototype.has=function(t){return jn(this,t).has(t)},_n.prototype.set=function(t,e){var n=jn(this,t),r=n.size;return n.set(t,e),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(t){var e=this.__data__=new Sn(t);this.size=e.size}Mn.prototype.clear=function(){this.__data__=new Sn,this.size=0},Mn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Mn.prototype.get=function(t){return this.__data__.get(t)},Mn.prototype.has=function(t){return this.__data__.has(t)},Mn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Sn){var r=n.__data__;if(!Cn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _n(r)}return n.set(t,e),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?Xt.Buffer:void 0,Un=Pn?Pn.allocUnsafe:void 0;function Fn(t,e){if(e)return t.slice();var n=t.length,r=Un?Un(n):new t.constructor(n);return t.copy(r),r}var zn=Object.prototype.propertyIsEnumerable,$n=Object.getOwnPropertySymbols,Vn=$n?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}($n(t),function(e){return zn.call(t,e)}))}:function(){return[]};function Hn(t){return function(t,e,n){var r=e(t);return ae(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,gn,Vn)}var Kn=ke(Xt,"DataView"),Wn=ke(Xt,"Promise"),Zn=ke(Xt,"Set"),Gn="[object Map]",Yn="[object Promise]",Jn="[object Set]",Xn="[object WeakMap]",Qn="[object DataView]",tr=ge(Kn),er=ge(Cn),nr=ge(Wn),rr=ge(Zn),ir=ge(Ae),sr=oe;(Kn&&sr(new Kn(new ArrayBuffer(1)))!=Qn||Cn&&sr(new Cn)!=Gn||Wn&&sr(Wn.resolve())!=Yn||Zn&&sr(new Zn)!=Jn||Ae&&sr(new Ae)!=Xn)&&(sr=function(t){var e=oe(t),n="[object Object]"==e?t.constructor:void 0,r=n?ge(n):"";if(r)switch(r){case tr:return Qn;case er:return Gn;case nr:return Yn;case rr:return Jn;case ir:return Xn}return e});var or=Object.prototype.hasOwnProperty;var lr=Xt.Uint8Array;function ar(t){var e=new t.constructor(t.byteLength);return new lr(e).set(new lr(t)),e}var cr=/\w*$/;var ur=Qt?Qt.prototype:void 0,hr=ur?ur.valueOf:void 0;function dr(t,e){var n=e?ar(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function fr(t,e,n){var r,i,s,o,l,a=t.constructor;switch(e){case"[object ArrayBuffer]":return ar(t);case"[object Boolean]":case"[object Date]":return new a(+t);case"[object DataView]":return l=ar((o=t).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(t,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(t);case"[object RegExp]":return(s=new(i=t).constructor(i.source,cr.exec(i))).lastIndex=i.lastIndex,s;case"[object Symbol]":return r=t,hr?Object(hr.call(r)):{}}}function pr(t){return"function"!=typeof t.constructor||Ke(t)?{}:Ce(qn(t))}var mr=an&&an.isMap,gr=mr?rn(mr):function(t){return le(t)&&"[object Map]"==sr(t)};var br=an&&an.isSet,vr=br?rn(br):function(t){return le(t)&&"[object Set]"==sr(t)},yr="[object Arguments]",xr="[object Function]",wr="[object Object]",Nr={};function Er(t,e,n,r,i,s){var o,l=1&e;if(void 0!==o)return o;if(!ce(t))return t;var a=ae(t);if(a)o=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&or.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t);else{var c=sr(t),u=c==xr||"[object GeneratorFunction]"==c;if(en(t))return Fn(t,l);if(c==wr||c==yr||u&&!i)o=u?{}:pr(t);else{if(!Nr[c])return i?t:{};o=fr(t,c,l)}}s||(s=new Mn);var h=s.get(t);if(h)return h;s.set(t,o),vr(t)?t.forEach(function(r){o.add(Er(r,e,n,r,t,s))}):gr(t)&&t.forEach(function(r,i){o.set(i,Er(r,e,n,i,t,s))});var d=a?void 0:Hn(t);return function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););}(d||t,function(r,i){d&&(r=t[i=r]),Ue(o,i,Er(r,e,n,i,t,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 kr(t){return Er(t,5)}function Ar(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new _n;++e<n;)this.add(t[e])}function Sr(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}Ar.prototype.add=Ar.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ar.prototype.has=function(t){return this.__data__.has(t)};function Cr(t,e,n,r,i,s){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(t),u=s.get(e);if(c&&u)return c==e&&u==t;var h=-1,d=!0,f=2&n?new Ar:void 0;for(s.set(t,e),s.set(e,t);++h<l;){var p=t[h],m=e[h];if(r)var g=o?r(m,p,h,e,t,s):r(p,m,h,t,e,s);if(void 0!==g){if(g)continue;d=!1;break}if(f){if(!Sr(e,function(t,e){if(o=e,!f.has(o)&&(p===t||i(p,t,n,r,s)))return f.push(e);var o})){d=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){d=!1;break}}return s.delete(t),s.delete(e),d}function jr(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function _r(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var qr=Qt?Qt.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(t,e,n,r,i,s){var o=ae(t),l=ae(e),a=o?Ir:sr(t),c=l?Ir:sr(e),u=(a=a==Lr?Rr:a)==Rr,h=(c=c==Lr?Rr:c)==Rr,d=a==c;if(d&&en(t)){if(!en(e))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new Mn),o||un(t)?Cr(t,e,n,r,i,s):function(t,e,n,r,i,s,o){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new lr(t),new lr(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return De(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=jr;case"[object Set]":var a=1&r;if(l||(l=_r),t.size!=e.size&&!a)return!1;var c=o.get(t);if(c)return c==e;r|=2,o.set(t,e);var u=Cr(l(t),l(e),r,i,s,o);return o.delete(t),u;case"[object Symbol]":if(Or)return Or.call(t)==Or.call(e)}return!1}(t,e,a,n,r,i,s);if(!(1&n)){var f=u&&Mr.call(t,"__wrapped__"),p=h&&Mr.call(e,"__wrapped__");if(f||p){var m=f?t.value():t,g=p?e.value():e;return s||(s=new Mn),i(m,g,n,r,s)}}return!!d&&(s||(s=new Mn),function(t,e,n,r,i,s){var o=1&n,l=Hn(t),a=l.length;if(a!=Hn(e).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in e:Tr.call(e,u)))return!1}var h=s.get(t),d=s.get(e);if(h&&d)return h==e&&d==t;var f=!0;s.set(t,e),s.set(e,t);for(var p=o;++c<a;){var m=t[u=l[c]],g=e[u];if(r)var b=o?r(g,m,u,e,t,s):r(m,g,u,t,e,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=t.constructor,y=e.constructor;v==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(f=!1)}return s.delete(t),s.delete(e),f}(t,e,n,r,i,s))}function Dr(t,e,n,r,i){return t===e||(null==t||null==e||!le(t)&&!le(e)?t!=t&&e!=e:Br(t,e,n,r,Dr,i))}var Pr=function(t,e,n){for(var r=-1,i=Object(t),s=n(t),o=s.length;o--;){var l=s[++r];if(!1===e(i[l],l,i))break}return t};function Ur(t,e,n){(void 0!==n&&!De(t[e],n)||void 0===n&&!(e in t))&&Be(t,e,n)}function Fr(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function zr(t){return function(t,e,n){var r=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var o=e[i],l=void 0;void 0===l&&(l=t[o]),r?Be(n,o,l):Ue(n,o,l)}return n}(t,yn(t))}function $r(t,e,n,r,i,s,o){var l=Fr(t,n),a=Fr(e,n),c=o.get(a);if(c)Ur(t,n,c);else{var u,h=s?s(l,a,n+"",t,e,o):void 0,d=void 0===h;if(d){var f=ae(a),p=!f&&en(a),m=!f&&!p&&un(a);h=a,f||p||m?ae(l)?h=l:le(u=l)&&Ve(u)?h=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(l):p?(d=!1,h=Fn(a,!0)):m?(d=!1,h=dr(a,!0)):h=[]:function(t){if(!le(t)||"[object Object]"!=oe(t))return!1;var e=qn(t);if(null===e)return!0;var n=In.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ln.call(n)==Rn}(a)||Je(a)?(h=l,Je(l)?h=zr(l):ce(l)&&!he(l)||(h=pr(a))):d=!1}d&&(o.set(a,h),i(h,a,r,s,o),o.delete(a)),Ur(t,n,h)}}function Vr(t,e,n,r,i){t!==e&&Pr(e,function(s,o){if(i||(i=new Mn),ce(s))$r(t,e,o,n,Vr,r,i);else{var l=r?r(Fr(t,o),s,o+"",t,e,i):void 0;void 0===l&&(l=s),Ur(t,o,l)}},yn)}function Hr(t,e){return Dr(t,e)}var Kr,Wr=(Kr=function(t,e,n){Vr(t,e,n)},ze(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,s=r>2?e[2]:void 0;for(i=Kr.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(t,e,n){if(!ce(n))return!1;var r=typeof e;return!!("number"==r?Ve(n)&&Me(e,n.length):"string"==r&&e in n)&&De(n[e],t)}(e[0],e[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var o=e[n];o&&Kr(t,o,n,i)}return t})),Zr=(t=>(t[t.TYPE=3]="TYPE",t[t.LEVEL=12]="LEVEL",t[t.ATTRIBUTE=13]="ATTRIBUTE",t[t.BLOT=14]="BLOT",t[t.INLINE=7]="INLINE",t[t.BLOCK=11]="BLOCK",t[t.BLOCK_BLOT=10]="BLOCK_BLOT",t[t.INLINE_BLOT=6]="INLINE_BLOT",t[t.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",t[t.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",t[t.ANY=15]="ANY",t))(Zr||{});class Gr{constructor(t,e,n={}){this.attrName=t,this.keyName=e;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(t){return Array.from(t.attributes).map(t=>t.name)}add(t,e){return!!this.canAdd(t,e)&&(t.setAttribute(this.keyName,e),!0)}canAdd(t,e){return null==this.whitelist||("string"==typeof e?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1)}remove(t){t.removeAttribute(this.keyName)}value(t){const e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""}}class Yr extends Error{constructor(t){super(t="[Parchment] "+t),this.message=t,this.name=this.constructor.name}}const Jr=class t{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(null==t)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let n=null;try{n=t.parentNode}catch{return null}return this.find(n,e)}return null}create(e,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(e,o,r);return t.blots.set(l.domNode,l),l}find(e,n=!1){return t.find(e,n)}query(t,e=Zr.ANY){let n;return"string"==typeof t?n=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof t?t&Zr.LEVEL&Zr.BLOCK?n=this.types.block:t&Zr.LEVEL&Zr.INLINE&&(n=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(t=>(n=this.classes[t],!!n)),n=n||this.tags[t.tagName]),null==n?null:"scope"in n&&e&Zr.LEVEL&n.scope&&e&Zr.TYPE&n.scope?n:null}register(...t){return t.map(t=>{const e="blotName"in t,n="attrName"in t;if(!e&&!n)throw new Yr("Invalid definition");if(e&&"abstract"===t.blotName)throw new Yr("Cannot register abstract class");const r=e?t.blotName:n?t.attrName:void 0;return this.types[r]=t,n?"string"==typeof t.keyName&&(this.attributes[t.keyName]=t):e&&(t.className&&(this.classes[t.className]=t),t.tagName&&(Array.isArray(t.tagName)?t.tagName=t.tagName.map(t=>t.toUpperCase()):t.tagName=t.tagName.toUpperCase(),(Array.isArray(t.tagName)?t.tagName:[t.tagName]).forEach(e=>{(null==this.tags[e]||null==t.className)&&(this.tags[e]=t)}))),t})}};Jr.blots=new WeakMap;let Xr=Jr;function Qr(t,e){return(t.getAttribute("class")||"").split(/\s+/).filter(t=>0===t.indexOf(`${e}-`))}const ti=class extends Gr{static keys(t){return(t.getAttribute("class")||"").split(/\s+/).map(t=>t.split("-").slice(0,-1).join("-"))}add(t,e){return!!this.canAdd(t,e)&&(this.remove(t),t.classList.add(`${this.keyName}-${e}`),!0)}remove(t){Qr(t,this.keyName).forEach(e=>{t.classList.remove(e)}),0===t.classList.length&&t.removeAttribute("class")}value(t){const e=(Qr(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}};function ei(t){const e=t.split("-"),n=e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("");return e[0]+n}const ni=class extends Gr{static keys(t){return(t.getAttribute("style")||"").split(";").map(t=>t.split(":")[0].trim())}add(t,e){return!!this.canAdd(t,e)&&(t.style[ei(this.keyName)]=e,!0)}remove(t){t.style[ei(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[ei(this.keyName)];return this.canAdd(t,e)?e:""}};const ri=class{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(null!=t.value(this.domNode)?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=Xr.find(this.domNode);if(null==t)return;const e=Gr.keys(this.domNode),n=ti.keys(this.domNode),r=ni.keys(this.domNode);e.concat(n).concat(r).forEach(e=>{const n=t.scroll.query(e,Zr.ATTRIBUTE);n instanceof Gr&&(this.attributes[n.attrName]=n)})}copy(t){Object.keys(this.attributes).forEach(e=>{const n=this.attributes[e].value(this.domNode);t.format(e,n)})}move(t){this.copy(t),Object.keys(this.attributes).forEach(t=>{this.attributes[t].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t),{})}},ii=class{constructor(t,e){this.scroll=t,this.domNode=e,Xr.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(null==this.tagName)throw new Yr("Blot definition missing tagName");let e,n;return Array.isArray(this.tagName)?("string"==typeof t?(n=t.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof t&&(n=t),e="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){null!=this.parent&&this.parent.removeChild(this),Xr.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,n,r){const i=this.isolate(t,e);if(null!=this.scroll.query(n,Zr.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,Zr.ATTRIBUTE)){const t=this.scroll.create(this.statics.scope);i.wrap(t),t.format(n,r)}}insertAt(t,e,n){const r=null==n?this.scroll.create("text",e):this.scroll.create(e,n),i=this.split(t);this.parent.insertBefore(r,i||void 0)}isolate(t,e){const n=this.split(t);if(null==n)throw new Error("Attempt to isolate at end");return n.split(e),n}length(){return 1}offset(t=this.parent){return null==this.parent||this===t?0:this.parent.children.offset(this)+this.parent.offset(t)}optimize(t){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(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(t,e){return 0===t?this:this.next}update(t,e){}wrap(t,e){const n="string"==typeof t?this.scroll.create(t,e):t;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Yr(`Cannot wrap ${t}`);return n.appendChild(this),n}};ii.blotName="abstract";let si=ii;const oi=class extends si{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>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(...t){if(this.insertBefore(t[0],null),t.length>1){const e=t.slice(1);this.append(...e)}}at(t){const e=this.iterator();let n=e();for(;n&&t>0;)t-=1,n=e();return n}contains(t){const e=this.iterator();let n=e();for(;n;){if(n===t)return!0;n=e()}return!1}indexOf(t){const e=this.iterator();let n=e(),r=0;for(;n;){if(n===t)return r;r+=1,n=e()}return-1}insertBefore(t,e){null!=t&&(this.remove(t),t.next=e,null!=e?(t.prev=e.prev,null!=e.prev&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):null!=this.tail?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)}offset(t){let e=0,n=this.head;for(;null!=n;){if(n===t)return e;e+=n.length(),n=n.next}return-1}remove(t){this.contains(t)&&(null!=t.prev&&(t.prev.next=t.next),null!=t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)}iterator(t=this.head){return()=>{const e=t;return null!=t&&(t=t.next),e}}find(t,e=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(t<i||e&&t===i&&(null==r.next||0!==r.next.length()))return[r,t];t-=i,r=n()}return[null,0]}forEach(t){const e=this.iterator();let n=e();for(;n;)t(n),n=e()}forEachAt(t,e,n){if(e<=0)return;const[r,i]=this.find(t);let s=t-i;const o=this.iterator(r);let l=o();for(;l&&s<t+e;){const r=l.length();t>s?n(l,t-s,Math.min(e,s+r-t)):n(l,0,Math.min(r,t+e-s)),s+=r,l=o()}}map(t){return this.reduce((e,n)=>(e.push(t(n)),e),[])}reduce(t,e){const n=this.iterator();let r=n();for(;r;)e=t(e,r),r=n();return e}}function ci(t,e){const n=e.find(t);if(n)return n;try{return e.create(t)}catch{const n=e.create(Zr.INLINE);return Array.from(t.childNodes).forEach(t=>{n.domNode.appendChild(t)}),t.parentNode&&t.parentNode.replaceChild(n.domNode,t),n.attach(),n}}const ui=class t extends si{constructor(t,e){super(t,e),this.uiNode=null,this.build()}appendChild(t){this.insertBefore(t)}attach(){super.attach(),this.children.forEach(t=>{t.attach()})}attachUI(e){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=e,t.uiClass&&this.uiNode.classList.add(t.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(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=ci(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Yr)return;throw e}})}deleteAt(t,e){if(0===t&&e===this.length())return this.remove();this.children.forEachAt(t,e,(t,e,n)=>{t.deleteAt(e,n)})}descendant(e,n=0){const[r,i]=this.children.find(n);return null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e?[r,i]:r instanceof t?r.descendant(e,i):[null,-1]}descendants(e,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&i.push(n),n instanceof t&&(i=i.concat(n.descendants(e,r,s))),s-=o}),i}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let e=!1;this.children.forEach(n=>{e||this.statics.allowedChildren.some(t=>n instanceof t)||(n.statics.scope===Zr.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),e=!0):n instanceof t?n.unwrap():n.remove())})}formatAt(t,e,n,r){this.children.forEachAt(t,e,(t,e,i)=>{t.formatAt(e,i,n,r)})}insertAt(t,e,n){const[r,i]=this.children.find(t);if(r)r.insertAt(i,e,n);else{const t=null==n?this.scroll.create("text",e):this.scroll.create(e,n);this.appendChild(t)}}insertBefore(t,e){null!=t.parent&&t.parent.children.remove(t);let n=null;this.children.insertBefore(t,e||null),t.parent=this,null!=e&&(n=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(t.domNode,n),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(n=>{t.insertBefore(n,e)})}optimize(t){if(super.optimize(t),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 t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t)}else this.remove()}path(e,n=!1){const[r,i]=this.children.find(e,n),s=[[this,e]];return r instanceof t?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(t){this.children.remove(t)}replaceWith(e,n){const r="string"==typeof e?this.scroll.create(e,n):e;return r instanceof t&&this.moveChildren(r),super.replaceWith(r)}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(t,this.length(),(t,r,i)=>{const s=t.split(r,e);null!=s&&n.appendChild(s)}),n}splitAfter(t){const e=this.clone();for(;null!=t.next;)e.appendChild(t.next);return this.parent&&this.parent.insertBefore(e,this.next||void 0),e}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(t,e){const n=[],r=[];t.forEach(t=>{t.target===this.domNode&&"childList"===t.type&&(n.push(...t.addedNodes),r.push(...t.removedNodes))}),r.forEach(t=>{if(null!=t.parentNode&&"IFRAME"!==t.tagName&&document.body.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const e=this.scroll.find(t);null!=e&&(null==e.domNode.parentNode||e.domNode.parentNode===this.domNode)&&e.detach()}),n.filter(t=>t.parentNode===this.domNode&&t!==this.uiNode).sort((t,e)=>t===e?0:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(t=>{let e=null;null!=t.nextSibling&&(e=this.scroll.find(t.nextSibling));const n=ci(t,this.scroll);(n.next!==e||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,e||void 0))}),this.enforceAllowedChildren()}};ui.uiClass="";const hi=ui;const di=class t extends hi{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new ri(this.domNode)}format(e,n){if(e!==this.statics.blotName||n){const t=this.scroll.query(e,Zr.INLINE);if(null==t)return;t instanceof Gr?this.attributes.attribute(t,n):n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n)}else this.children.forEach(e=>{e instanceof t||(e=e.wrap(t.blotName,!0)),this.attributes.copy(e)}),this.unwrap()}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.formats()[n]||this.scroll.query(n,Zr.ATTRIBUTE)?this.isolate(t,e).format(n,r):super.formatAt(t,e,n,r)}optimize(e){super.optimize(e);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof t&&r.prev===this&&function(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.type)&&this.attributes.build()}wrap(e,n){const r=super.wrap(e,n);return r instanceof t&&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 t extends hi{static create(t){return super.create(t)}static formats(e,n){const r=n.query(t.blotName);if(null==r||e.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return e.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new ri(this.domNode)}format(e,n){const r=this.scroll.query(e,Zr.BLOCK);null!=r&&(r instanceof Gr?this.attributes.attribute(r,n):e!==this.statics.blotName||n?n&&(e!==this.statics.blotName||this.formats()[e]!==n)&&this.replaceWith(e,n):this.replaceWith(t.blotName))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return null!=e&&(t[this.statics.blotName]=e),t}formatAt(t,e,n,r){null!=this.scroll.query(n,Zr.BLOCK)?this.format(n,r):super.formatAt(t,e,n,r)}insertAt(t,e,n){if(null==n||null!=this.scroll.query(e,Zr.INLINE))super.insertAt(t,e,n);else{const r=this.split(t);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const t=this.scroll.create(e,n);r.parent.insertBefore(t,r)}}}replaceWith(t,e){const n=super.replaceWith(t,e);return this.attributes.copy(n),n}update(t,e){super.update(t,e),t.some(t=>t.target===this.domNode&&"attributes"===t.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(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.enforceAllowedChildren()}insertAt(t,e,n){super.insertAt(t,e,n),this.enforceAllowedChildren()}optimize(t){super.optimize(t),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(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,n,r){0===t&&e===this.length()?this.format(n,r):super.formatAt(t,e,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(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(t=>{this.update(t)}),this.observer.observe(this.domNode,yi),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const n=this.registry.find(t,e);return n?n.scroll===this?n:e?this.find(n.scroll.domNode.parentNode,!0):null:null}query(t,e=Zr.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),0===t&&e===this.length()?this.children.forEach(t=>{t.remove()}):super.deleteAt(t,e)}formatAt(t,e,n,r){this.update(),super.formatAt(t,e,n,r)}insertAt(t,e,n){this.update(),super.insertAt(t,e,n)}optimize(t=[],e={}){super.optimize(e);const n=e.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)t.push(r.pop());const i=(t,e=!0)=>{null==t||t===this||null!=t.domNode.parentNode&&(n.has(t.domNode)||n.set(t.domNode,[]),e&&i(t.parent))},s=t=>{n.has(t.domNode)&&(t instanceof hi&&t.children.forEach(s),n.delete(t.domNode),t.optimize(e))};let o=t;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(t=>{const e=this.find(t.target,!0);null!=e&&(e.domNode===t.target&&("childList"===t.type?(i(this.find(t.previousSibling,!1)),Array.from(t.addedNodes).forEach(t=>{const e=this.find(t,!1);i(e,!1),e instanceof hi&&e.children.forEach(t=>{i(t,!1)})})):"attributes"===t.type&&i(e.prev)),i(e))}),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)t.push(r.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const n=new WeakMap;t.map(t=>{const e=this.find(t.target,!0);return null==e?null:n.has(e.domNode)?(n.get(e.domNode).push(t),null):(n.set(e.domNode,[t]),e)}).forEach(t=>{null!=t&&t!==this&&n.has(t.domNode)&&t.update(n.get(t.domNode)||[],e)}),e.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),e),this.optimize(t,e)}};xi.blotName="scroll",xi.defaultChild=mi,xi.allowedChildren=[mi,bi],xi.scope=Zr.BLOCK_BLOT,xi.tagName="DIV";const wi=xi,Ni=class t extends li{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,n){null==n?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,n)}length(){return this.text.length}optimize(e){super.optimize(e),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(0===t)return this;if(t===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(t,e){t.some(t=>"characterData"===t.type&&t.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,ki=Object.freeze(Object.defineProperty({__proto__:null,Attributor:Gr,AttributorStore:ri,BlockBlot:mi,ClassAttributor:ti,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 Ai,Si,Ci={exports:{}};function ji(){if(Si)return Ai;Si=1;var t=-1;function e(d,f,p,m,b){if(d===f)return d?[[0,d]]:[];if(null!=p){var v=function(t,e,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,i="number"==typeof n?null:n.newRange,s=t.length,o=e.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=t.slice(0,l),c=t.slice(l),u=i?i.index:null,h=l+o-s;if((null===u||u===h)&&!(h<0||h>o)){var d=e.slice(0,h);if((m=e.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=e.slice(0,p),e.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=t.slice(0,r.index),y=t.slice(r.index+r.length);if(!(o<(f=v.length)+(b=y.length))){var x=e.slice(0,f),w=e.slice(o-b);if(v===x&&y===w)return g(v,t.slice(f,s-b),e.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[[t,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]=t),l;if(1===c.length)return[[t,i],[1,o]];var h=function(t,e){var n=t.length>e.length?t:e,i=t.length>e.length?e:t;if(n.length<4||2*i.length<n.length)return null;function o(t,e,n){for(var i,o,l,a,c=t.substring(n,n+Math.floor(t.length/4)),u=-1,h="";-1!==(u=e.indexOf(c,u+1));){var d=r(t.substring(n),e.substring(u)),f=s(t.substring(0,n),e.substring(0,u));h.length<f+d&&(h=e.substring(u-f,u)+e.substring(u,u+d),i=t.substring(0,n-f),o=t.substring(n+d),l=e.substring(0,u-f),a=e.substring(u+d))}return 2*h.length>=t.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;t.length>e.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=e(d,p),v=e(f,m);return b.concat([[0,g]],v)}return function(e,r){for(var i=e.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&&e.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(e,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&&e.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(e,r,S,w)}}}}return[[t,e],[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(e){var n=!1,r=[],d=0,f=null,p=0,m=0,g=0,b=0,v=0;for(;p<e.length;)0==e[p][0]?(r[d++]=p,m=b,g=v,b=0,v=0,f=e[p][1]):(1==e[p][0]?b+=e[p][1].length:v+=e[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(b,v)&&(e.splice(r[d-1],0,[t,f]),e[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(e);(function(t){function e(t,e){if(!t||!e)return 6;var n=t.charAt(t.length-1),r=e.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&&t.match(c),g=p&&e.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<t.length-1;){if(0==t[n-1][0]&&0==t[n+1][0]){var r=t[n-1][1],i=t[n][1],h=t[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=e(r,i)+e(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=e(r,i)+e(i,h);v>=b&&(b=v,p=r,m=i,g=h)}t[n-1][1]!=p&&(p?t[n-1][1]=p:(t.splice(n-1,1),n--),t[n][1]=m,g?t[n+1][1]=g:(t.splice(n+1,1),n--))}n++}})(e),p=1;for(;p<e.length;){if(e[p-1][0]==t&&1==e[p][0]){var y=e[p-1][1],x=e[p][1],w=i(y,x),N=i(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(e.splice(p,0,[0,x.substring(0,w)]),e[p-1][1]=y.substring(0,y.length-w),e[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(e.splice(p,0,[0,y.substring(0,N)]),e[p-1][0]=1,e[p-1][1]=x.substring(0,x.length-N),e[p+1][0]=t,e[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(t,n,r,i){var s=t.substring(0,r),o=n.substring(0,i),l=t.substring(r),a=n.substring(i),c=e(s,o),u=e(l,a);return c.concat(u)}function r(t,e){if(!t||!e||t.charAt(0)!==e.charAt(0))return 0;for(var n=0,r=Math.min(t.length,e.length),i=r,s=0;n<i;)t.substring(s,i)==e.substring(s,i)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return d(t.charCodeAt(i-1))&&i--,i}function i(t,e){var n=t.length,r=e.length;if(0==n||0==r)return 0;n>r?t=t.substring(n-r):n<r&&(e=e.substring(0,n));var i=Math.min(n,r);if(t==e)return i;for(var s=0,o=1;;){var l=t.substring(i-o),a=e.indexOf(l);if(-1==a)return s;o+=a,0!=a&&t.substring(i-o)!=e.substring(0,o)||(s=o,o++)}}function s(t,e){if(!t||!e||t.slice(-1)!==e.slice(-1))return 0;for(var n=0,r=Math.min(t.length,e.length),i=r,s=0;n<i;)t.substring(t.length-i,t.length-s)==e.substring(e.length-i,e.length-s)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return f(t.charCodeAt(t.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(e,n){e.push([0,""]);for(var i,o=0,l=0,a=0,c="",u="";o<e.length;)if(o<e.length-1&&!e[o][1])e.splice(o,1);else switch(e[o][0]){case 1:a++,u+=e[o][1],o++;break;case t:l++,c+=e[o][1],o++;break;case 0:var d=o-a-l-1;if(n){if(d>=0&&m(e[d][1])){var f=e[d][1].slice(-1);if(e[d][1]=e[d][1].slice(0,-1),c=f+c,u=f+u,!e[d][1]){e.splice(d,1),o--;var g=d-1;e[g]&&1===e[g][0]&&(a++,u=e[g][1]+u,g--),e[g]&&e[g][0]===t&&(l++,c=e[g][1]+c,g--),d=g}}if(p(e[o][1])){f=e[o][1].charAt(0);e[o][1]=e[o][1].slice(1),c+=f,u+=f}}if(o<e.length-1&&!e[o][1]){e.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(i=r(u,c))&&(d>=0?e[d][1]+=u.substring(0,i):(e.splice(0,0,[0,u.substring(0,i)]),o++),u=u.substring(i),c=c.substring(i)),0!==(i=s(u,c))&&(e[o][1]=u.substring(u.length-i)+e[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?(e.splice(o-b,b),o-=b):0===c.length?(e.splice(o-b,b,[1,u]),o=o-b+1):0===u.length?(e.splice(o-b,b,[t,c]),o=o-b+1):(e.splice(o-b,b,[t,c],[1,u]),o=o-b+2)}0!==o&&0===e[o-1][0]?(e[o-1][1]+=e[o][1],e.splice(o,1)):o++,a=0,l=0,c="",u=""}""===e[e.length-1][1]&&e.pop();var v=!1;for(o=1;o<e.length-1;)0===e[o-1][0]&&0===e[o+1][0]&&(e[o][1].substring(e[o][1].length-e[o-1][1].length)===e[o-1][1]?(e[o][1]=e[o-1][1]+e[o][1].substring(0,e[o][1].length-e[o-1][1].length),e[o+1][1]=e[o-1][1]+e[o+1][1],e.splice(o-1,1),v=!0):e[o][1].substring(0,e[o+1][1].length)==e[o+1][1]&&(e[o-1][1]+=e[o+1][1],e[o][1]=e[o][1].substring(e[o+1][1].length)+e[o+1][1],e.splice(o+1,1),v=!0)),o++;v&&h(e,n)}function d(t){return t>=55296&&t<=56319}function f(t){return t>=56320&&t<=57343}function p(t){return f(t.charCodeAt(0))}function m(t){return d(t.charCodeAt(t.length-1))}function g(e,n,r,i){return m(e)||p(i)?null:function(t){for(var e=[],n=0;n<t.length;n++)t[n][1].length>0&&e.push(t[n]);return e}([[0,e],[t,n],[1,r],[0,i]])}function b(t,n,r,i){return e(t,n,r,i,!0)}return b.INSERT=1,b.DELETE=t,b.EQUAL=0,Ai=b}var _i,qi={exports:{}};function Oi(){return _i||(_i=1,function(t,e){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]",_=/\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[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=e&&!e.nodeType&&e,B=M&&t&&!t.nodeType&&t,D=B&&B.exports===M;function P(t,e){return t.set(e[0],e[1]),t}function F(t,e){return t.add(e),t}function z(t,e,n,r){for(var i=-1,s=t?t.length:0;++i<s;)n=e(n,t[i],i,t);return n}function $(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(n){}return e}function V(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function H(t,e){return function(n){return t(e(n))}}function K(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var W=Array.prototype,Z=Function.prototype,G=Object.prototype,Y=R["__core-js_shared__"],J=function(){var t=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),X=Z.toString,Q=G.hasOwnProperty,tt=G.toString,et=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nt=D?R.Buffer:void 0,rt=R.Symbol,it=R.Uint8Array,st=H(Object.getPrototypeOf,Object),ot=Object.create,lt=G.propertyIsEnumerable,at=W.splice,ct=Object.getOwnPropertySymbols,ut=nt?nt.isBuffer:void 0,ht=H(Object.keys,Object),dt=Bt(R,"DataView"),ft=Bt(R,"Map"),pt=Bt(R,"Promise"),mt=Bt(R,"Set"),gt=Bt(R,"WeakMap"),bt=Bt(Object,"create"),vt=zt(dt),yt=zt(ft),xt=zt(pt),wt=zt(mt),Nt=zt(gt),Et=rt?rt.prototype:void 0,kt=Et?Et.valueOf:void 0;function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function St(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ct(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function jt(t){this.__data__=new St(t)}function _t(t,e){var n=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Ht(t)}(t)&&Q.call(t,"callee")&&(!lt.call(t,"callee")||tt.call(t)==i)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,s=!!r;for(var o in t)!Q.call(t,o)||s&&("length"==o||Ut(o,r))||n.push(o);return n}function qt(t,e,n){var r=t[e];Q.call(t,e)&&$t(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ot(t,e){for(var n=t.length;n--;)if($t(t[n][0],e))return n;return-1}function Tt(t,e,n,r,d,b,q){var O;if(r&&(O=b?r(t,d,b,q):r(t)),void 0!==O)return O;if(!Zt(t))return t;var L=Vt(t);if(L){if(O=function(t){var e=t.length,n=t.constructor(e);e&&"string"==typeof t[0]&&Q.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!e)return function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(t,O)}else{var I=Pt(t),R=I==l||I==a;if(Kt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(I==h||I==i||R&&!b){if($(t))return b?t:{};if(O=function(t){return"function"!=typeof t.constructor||Ft(t)?{}:(e=st(t),Zt(e)?ot(e):{});var e}(R?{}:t),!e)return function(t,e){return Rt(t,Dt(t),e)}(t,function(t,e){return t&&Rt(e,Gt(e),t)}(O,t))}else{if(!T[I])return b?t:{};O=function(t,e,n,r){var i=t.constructor;switch(e){case v:return It(t);case s:case o:return new i(+t);case y:return function(t,e){var n=e?It(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case x:case w:case N:case E:case k:case A:case S:case C:case j:return function(t,e){var n=e?It(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case c:return function(t,e,n){var r=e?n(V(t),!0):V(t);return z(r,P,new t.constructor)}(t,r,n);case u:case m:return new i(t);case f:return function(t){var e=new t.constructor(t.source,_.exec(t));return e.lastIndex=t.lastIndex,e}(t);case p:return function(t,e,n){var r=e?n(K(t),!0):K(t);return z(r,F,new t.constructor)}(t,r,n);case g:return l=t,kt?Object(kt.call(l)):{}}var l}(t,I,Tt,e)}}q||(q=new jt);var M=q.get(t);if(M)return M;if(q.set(t,O),!L)var B=n?function(t){return function(t,e,n){var r=e(t);return Vt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,Gt,Dt)}(t):Gt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n,t););}(B||t,function(i,s){B&&(i=t[s=i]),qt(O,s,Tt(i,e,n,r,s,t,q))}),O}function Lt(t){return!(!Zt(t)||function(t){return!!J&&J in t}(t))&&(Wt(t)||$(t)?et:q).test(zt(t))}function It(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function Rt(t,e,n,r){n||(n={});for(var i=-1,s=e.length;++i<s;){var o=e[i];qt(n,o,t[o])}return n}function Mt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function Bt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Lt(n)?n:void 0}At.prototype.clear=function(){this.__data__=bt?bt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var e=this.__data__;if(bt){var r=e[t];return r===n?void 0:r}return Q.call(e,t)?e[t]:void 0},At.prototype.has=function(t){var e=this.__data__;return bt?void 0!==e[t]:Q.call(e,t)},At.prototype.set=function(t,e){return this.__data__[t]=bt&&void 0===e?n:e,this},St.prototype.clear=function(){this.__data__=[]},St.prototype.delete=function(t){var e=this.__data__,n=Ot(e,t);return!(n<0)&&(n==e.length-1?e.pop():at.call(e,n,1),!0)},St.prototype.get=function(t){var e=this.__data__,n=Ot(e,t);return n<0?void 0:e[n][1]},St.prototype.has=function(t){return Ot(this.__data__,t)>-1},St.prototype.set=function(t,e){var n=this.__data__,r=Ot(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Ct.prototype.clear=function(){this.__data__={hash:new At,map:new(ft||St),string:new At}},Ct.prototype.delete=function(t){return Mt(this,t).delete(t)},Ct.prototype.get=function(t){return Mt(this,t).get(t)},Ct.prototype.has=function(t){return Mt(this,t).has(t)},Ct.prototype.set=function(t,e){return Mt(this,t).set(t,e),this},jt.prototype.clear=function(){this.__data__=new St},jt.prototype.delete=function(t){return this.__data__.delete(t)},jt.prototype.get=function(t){return this.__data__.get(t)},jt.prototype.has=function(t){return this.__data__.has(t)},jt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof St){var r=n.__data__;if(!ft||r.length<199)return r.push([t,e]),this;n=this.__data__=new Ct(r)}return n.set(t,e),this};var Dt=ct?H(ct,Object):function(){return[]},Pt=function(t){return tt.call(t)};function Ut(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||O.test(t))&&t>-1&&t%1==0&&t<e}function Ft(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||G)}function zt(t){if(null!=t){try{return X.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function $t(t,e){return t===e||t!=t&&e!=e}(dt&&Pt(new dt(new ArrayBuffer(1)))!=y||ft&&Pt(new ft)!=c||pt&&Pt(pt.resolve())!=d||mt&&Pt(new mt)!=p||gt&&Pt(new gt)!=b)&&(Pt=function(t){var e=tt.call(t),n=e==h?t.constructor:void 0,r=n?zt(n):void 0;if(r)switch(r){case vt:return y;case yt:return c;case xt:return d;case wt:return p;case Nt:return b}return e});var Vt=Array.isArray;function Ht(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Wt(t)}var Kt=ut||function(){return!1};function Wt(t){var e=Zt(t)?tt.call(t):"";return e==l||e==a}function Zt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Gt(t){return Ht(t)?_t(t):function(t){if(!Ft(t))return ht(t);var e=[];for(var n in Object(t))Q.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Tt(t,!0,!0)}}(qi,qi.exports)),qi.exports}var Ti,Li={exports:{}};function Ii(){return Ti||(Ti=1,function(t,e){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=e&&!e.nodeType&&e,j=C&&t&&!t.nodeType&&t,_=j&&j.exports===C,q=_&&k.process,O=function(){try{return q&&q.binding&&q.binding("util")}catch(t){}}(),T=O&&O.isTypedArray;function L(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function I(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function R(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=S["__core-js_shared__"],F=B.toString,z=D.hasOwnProperty,$=function(){var t=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),V=D.toString,H=RegExp("^"+F.call(z).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,tt=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),et=_t(S,"DataView"),nt=_t(S,"Map"),rt=_t(S,"Promise"),it=_t(S,"Set"),st=_t(S,"WeakMap"),ot=_t(Object,"create"),lt=Lt(et),at=Lt(nt),ct=Lt(rt),ut=Lt(it),ht=Lt(st),dt=W?W.prototype:void 0,ft=dt?dt.valueOf:void 0;function pt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function mt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function gt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function bt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new gt;++e<n;)this.add(t[e])}function vt(t){var e=this.__data__=new mt(t);this.size=e.size}function yt(t,e){var n=Mt(t),r=!n&&Rt(t),i=!n&&!r&&Bt(t),s=!n&&!r&&!i&&zt(t),o=n||r||i||s,l=o?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],a=l.length;for(var c in t)!z.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Tt(c,a))||l.push(c);return l}function xt(t,e){for(var n=t.length;n--;)if(It(t[n][0],e))return n;return-1}function wt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":J&&J in Object(t)?function(t){var e=z.call(t,J),n=t[J];try{t[J]=void 0;var r=!0}catch(s){}var i=V.call(t);r&&(e?t[J]=n:delete t[J]);return i}(t):function(t){return V.call(t)}(t)}function Nt(t){return Ft(t)&&wt(t)==i}function Et(t,e,n,r,c){return t===e||(null==t||null==e||!Ft(t)&&!Ft(e)?t!=t&&e!=e:function(t,e,n,r,c,f){var v=Mt(t),w=Mt(e),N=v?s:Ot(t),E=w?s:Ot(e),k=(N=N==i?d:N)==d,A=(E=E==i?d:E)==d,S=N==E;if(S&&Bt(t)){if(!Bt(e))return!1;v=!0,k=!1}if(S&&!k)return f||(f=new vt),v||zt(t)?St(t,e,n,r,c,f):function(t,e,n,r,i,s,c){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case y:return!(t.byteLength!=e.byteLength||!s(new Z(t),new Z(e)));case o:case l:case h:return It(+t,+e);case a:return t.name==e.name&&t.message==e.message;case p:case g:return t==e+"";case u:var d=I;case m:var f=1&r;if(d||(d=R),t.size!=e.size&&!f)return!1;var v=c.get(t);if(v)return v==e;r|=2,c.set(t,e);var w=St(d(t),d(e),r,i,s,c);return c.delete(t),w;case b:if(ft)return ft.call(t)==ft.call(e)}return!1}(t,e,N,n,r,c,f);if(!(1&n)){var C=k&&z.call(t,"__wrapped__"),j=A&&z.call(e,"__wrapped__");if(C||j){var _=C?t.value():t,q=j?e.value():e;return f||(f=new vt),c(_,q,n,r,f)}}if(!S)return!1;return f||(f=new vt),function(t,e,n,r,i,s){var o=1&n,l=Ct(t),a=l.length,c=Ct(e),u=c.length;if(a!=u&&!o)return!1;var h=a;for(;h--;){var d=l[h];if(!(o?d in e:z.call(e,d)))return!1}var f=s.get(t);if(f&&s.get(e))return f==e;var p=!0;s.set(t,e),s.set(e,t);var m=o;for(;++h<a;){var g=t[d=l[h]],b=e[d];if(r)var v=o?r(b,g,d,e,t,s):r(g,b,d,t,e,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=t.constructor,x=e.constructor;y==x||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return s.delete(t),s.delete(e),p}(t,e,n,r,c,f)}(t,e,n,r,Et,c))}function kt(t){return!(!Ut(t)||function(t){return!!$&&$ in t}(t))&&(Dt(t)?H:w).test(Lt(t))}function At(t){if(n=(e=t)&&e.constructor,r="function"==typeof n&&n.prototype||D,e!==r)return tt(t);var e,n,r,i=[];for(var s in Object(t))z.call(t,s)&&"constructor"!=s&&i.push(s);return i}function St(t,e,n,r,i,s){var o=1&n,l=t.length,a=e.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var u=-1,h=!0,d=2&n?new bt:void 0;for(s.set(t,e),s.set(e,t);++u<l;){var f=t[u],p=e[u];if(r)var m=o?r(p,f,u,e,t,s):r(f,p,u,t,e,s);if(void 0!==m){if(m)continue;h=!1;break}if(d){if(!L(e,function(t,e){if(o=e,!d.has(o)&&(f===t||i(f,t,n,r,s)))return d.push(e);var o})){h=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){h=!1;break}}return s.delete(t),s.delete(e),h}function Ct(t){return function(t,e,n){var r=e(t);return Mt(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,$t,qt)}function jt(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function _t(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return kt(n)?n:void 0}pt.prototype.clear=function(){this.__data__=ot?ot(null):{},this.size=0},pt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pt.prototype.get=function(t){var e=this.__data__;if(ot){var r=e[t];return r===n?void 0:r}return z.call(e,t)?e[t]:void 0},pt.prototype.has=function(t){var e=this.__data__;return ot?void 0!==e[t]:z.call(e,t)},pt.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ot&&void 0===e?n:e,this},mt.prototype.clear=function(){this.__data__=[],this.size=0},mt.prototype.delete=function(t){var e=this.__data__,n=xt(e,t);return!(n<0)&&(n==e.length-1?e.pop():Y.call(e,n,1),--this.size,!0)},mt.prototype.get=function(t){var e=this.__data__,n=xt(e,t);return n<0?void 0:e[n][1]},mt.prototype.has=function(t){return xt(this.__data__,t)>-1},mt.prototype.set=function(t,e){var n=this.__data__,r=xt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},gt.prototype.clear=function(){this.size=0,this.__data__={hash:new pt,map:new(nt||mt),string:new pt}},gt.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},gt.prototype.get=function(t){return jt(this,t).get(t)},gt.prototype.has=function(t){return jt(this,t).has(t)},gt.prototype.set=function(t,e){var n=jt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},bt.prototype.add=bt.prototype.push=function(t){return this.__data__.set(t,n),this},bt.prototype.has=function(t){return this.__data__.has(t)},vt.prototype.clear=function(){this.__data__=new mt,this.size=0},vt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},vt.prototype.get=function(t){return this.__data__.get(t)},vt.prototype.has=function(t){return this.__data__.has(t)},vt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof mt){var r=n.__data__;if(!nt||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new gt(r)}return n.set(t,e),this.size=n.size,this};var qt=X?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}(X(t),function(e){return G.call(t,e)}))}:function(){return[]},Ot=wt;function Tt(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||N.test(t))&&t>-1&&t%1==0&&t<e}function Lt(t){if(null!=t){try{return F.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function It(t,e){return t===e||t!=t&&e!=e}(et&&Ot(new et(new ArrayBuffer(1)))!=x||nt&&Ot(new nt)!=u||rt&&Ot(rt.resolve())!=f||it&&Ot(new it)!=m||st&&Ot(new st)!=v)&&(Ot=function(t){var e=wt(t),n=e==d?t.constructor:void 0,r=n?Lt(n):"";if(r)switch(r){case lt:return x;case at:return u;case ct:return f;case ut:return m;case ht:return v}return e});var Rt=Nt(function(){return arguments}())?Nt:function(t){return Ft(t)&&z.call(t,"callee")&&!G.call(t,"callee")},Mt=Array.isArray;var Bt=Q||function(){return!1};function Dt(t){if(!Ut(t))return!1;var e=wt(t);return e==c||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Pt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function Ut(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ft(t){return null!=t&&"object"==typeof t}var zt=T?function(t){return function(e){return t(e)}}(T):function(t){return Ft(t)&&Pt(t.length)&&!!E[wt(t)]};function $t(t){return null!=(e=t)&&Pt(e.length)&&!Dt(e)?yt(t):At(t);var e}t.exports=function(t,e){return Et(t,e)}}(Li,Li.exports)),Li.exports}var Ri,Mi={};var Bi,Di={};function Pi(){return Bi||(Bi=1,Object.defineProperty(Di,"__esModule",{value:!0}),(t||(t={})).length=function(t){return"number"==typeof t.delete?t.delete:"number"==typeof t.retain?t.retain:"object"==typeof t.retain&&null!==t.retain?1:"string"==typeof t.insert?t.insert.length:1},Di.default=t),Di;var t}var Ui,Fi,zi={};var $i=(Fi||(Fi=1,function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AttributeMap=e.OpIterator=e.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 t=Oi(),e=Ii();var n,r;return(r=n||(n={})).compose=function(e={},n={},r=!1){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});let i=t(n);r||(i=Object.keys(i).reduce((t,e)=>(null!=i[e]&&(t[e]=i[e]),t),{}));for(const t in e)void 0!==e[t]&&void 0===n[t]&&(i[t]=e[t]);return Object.keys(i).length>0?i:void 0},r.diff=function(t={},n={}){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});const r=Object.keys(t).concat(Object.keys(n)).reduce((r,i)=>(e(t[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(t={},e={}){t=t||{};const n=Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0!==t[r]&&(n[r]=e[r]),n),{});return Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0===e[r]&&(n[r]=null),n),n)},r.transform=function(t,e,n=!1){if("object"!=typeof t)return e;if("object"!=typeof e)return;if(!n)return e;const r=Object.keys(e).reduce((n,r)=>(void 0===t[r]&&(n[r]=e[r]),n),{});return Object.keys(r).length>0?r:void 0},Mi.default=n,Mi}();e.AttributeMap=s.default;const o=Pi();e.Op=o.default;const l=function(){if(Ui)return zi;Ui=1,Object.defineProperty(zi,"__esModule",{value:!0});const t=Pi();return zi.default=class{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(e){e||(e=1/0);const n=this.ops[this.index];if(n){const r=this.offset,i=t.default.length(n);if(e>=i-r?(e=i-r,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof n.delete)return{delete:e};{const t={};return n.attributes&&(t.attributes=n.attributes),"number"==typeof n.retain?t.retain=e:"object"==typeof n.retain&&null!==n.retain?t.retain=n.retain:"string"==typeof n.insert?t.insert=n.insert.substr(r,e):t.insert=n.insert,t}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?t.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?"number"==typeof t.delete?"delete":"number"==typeof t.retain||"object"==typeof t.retain&&null!==t.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const t=this.offset,e=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=t,this.index=e,[n].concat(r)}}return[]}},zi}();e.OpIterator=l.default;const a=String.fromCharCode(0),c=(t,e)=>{if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);const n=Object.keys(t)[0];if(!n||n!==Object.keys(e)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(e)[0]}`);return[n,t[n],e[n]]};class u{constructor(t){Array.isArray(t)?this.ops=t:null!=t&&Array.isArray(t.ops)?this.ops=t.ops:this.ops=[]}static registerEmbed(t,e){this.handlers[t]=e}static unregisterEmbed(t){delete this.handlers[t]}static getHandler(t){const e=this.handlers[t];if(!e)throw new Error(`no handlers for embed type "${t}"`);return e}insert(t,e){const n={};return"string"==typeof t&&0===t.length?this:(n.insert=t,null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n))}delete(t){return t<=0?this:this.push({delete:t})}retain(t,e){if("number"==typeof t&&t<=0)return this;const n={retain:t};return null!=e&&"object"==typeof e&&Object.keys(e).length>0&&(n.attributes=e),this.push(n)}push(t){let e=this.ops.length,n=this.ops[e-1];if(t=r(t),"object"==typeof n){if("number"==typeof t.delete&&"number"==typeof n.delete)return this.ops[e-1]={delete:n.delete+t.delete},this;if("number"==typeof n.delete&&null!=t.insert&&(e-=1,n=this.ops[e-1],"object"!=typeof n))return this.ops.unshift(t),this;if(i(t.attributes,n.attributes)){if("string"==typeof t.insert&&"string"==typeof n.insert)return this.ops[e-1]={insert:n.insert+t.insert},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this;if("number"==typeof t.retain&&"number"==typeof n.retain)return this.ops[e-1]={retain:n.retain+t.retain},"object"==typeof t.attributes&&(this.ops[e-1].attributes=t.attributes),this}}return e===this.ops.length?this.ops.push(t):this.ops.splice(e,0,t),this}chop(){const t=this.ops[this.ops.length-1];return t&&"number"==typeof t.retain&&!t.attributes&&this.ops.pop(),this}filter(t){return this.ops.filter(t)}forEach(t){this.ops.forEach(t)}map(t){return this.ops.map(t)}partition(t){const e=[],n=[];return this.forEach(r=>{(t(r)?e:n).push(r)}),[e,n]}reduce(t,e){return this.ops.reduce(t,e)}changeLength(){return this.reduce((t,e)=>e.insert?t+o.default.length(e):e.delete?t-e.delete:t,0)}length(){return this.reduce((t,e)=>t+o.default.length(e),0)}slice(t=0,e=1/0){const n=[],r=new l.default(this.ops);let i=0;for(;i<e&&r.hasNext();){let s;i<t?s=r.next(t-i):(s=r.next(e-i),n.push(s)),i+=o.default.length(s)}return new u(n)}compose(t){const e=new l.default(this.ops),n=new l.default(t.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let t=o.retain;for(;"insert"===e.peekType()&&e.peekLength()<=t;)t-=e.peekLength(),r.push(e.next());o.retain-t>0&&n.next(o.retain-t)}const a=new u(r);for(;e.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===e.peekType())a.push(e.next());else{const t=Math.min(e.peekLength(),n.peekLength()),r=e.next(t),o=n.next(t);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?t:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const t=null==r.retain?"insert":"retain",[e,n,i]=c(r[t],o.retain),s=u.getHandler(e);l[t]={[e]:s.compose(n,i,"retain"===t)}}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 t=new u(e.rest());return a.concat(t).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(t){const e=new u(this.ops.slice());return t.ops.length>0&&(e.push(t.ops[0]),e.ops=e.ops.concat(t.ops.slice(1))),e}diff(t,e){if(this.ops===t.ops)return new u;const r=[this,t].map(e=>e.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(e===t?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],e,!0),h=new l.default(this.ops),d=new l.default(t.ops);return c.forEach(t=>{let e=t[1].length;for(;e>0;){let r=0;switch(t[0]){case n.INSERT:r=Math.min(d.peekLength(),e),o.push(d.next(r));break;case n.DELETE:r=Math.min(e,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),d.peekLength(),e);const t=h.next(r),l=d.next(r);i(t.insert,l.insert)?o.retain(r,s.default.diff(t.attributes,l.attributes)):o.push(l).delete(r)}e-=r}}),o.chop()}eachLine(t,e="\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(e,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===t(r,n.next(1).attributes||{},i))return;i+=1,r=new u}}r.length()>0&&t(r,{},i)}invert(t){const e=new u;return this.reduce((n,r)=>{if(r.insert)e.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return e.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const i=r.delete||r.retain;return t.slice(n,n+i).forEach(t=>{r.delete?e.push(t):r.retain&&r.attributes&&e.retain(o.default.length(t),s.default.invert(r.attributes,t.attributes))}),n+i}if("object"==typeof r.retain&&null!==r.retain){const i=t.slice(n,n+1),o=new l.default(i.ops).next(),[a,h,d]=c(r.retain,o.insert),f=u.getHandler(a);return e.retain({[a]:f.invert(h,d)},s.default.invert(r.attributes,o.attributes)),n+1}}return n},0),e.chop()}transform(t,e=!1){if(e=!!e,"number"==typeof t)return this.transformPosition(t,e);const n=t,r=new l.default(this.ops),i=new l.default(n.ops),a=new u;for(;r.hasNext()||i.hasNext();)if("insert"!==r.peekType()||!e&&"insert"===i.peekType())if("insert"===i.peekType())a.push(i.next());else{const t=Math.min(r.peekLength(),i.peekLength()),n=r.next(t),o=i.next(t);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:t;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){const t=Object.keys(r)[0];if(t===Object.keys(i)[0]){const n=u.getHandler(t);n&&(l={[t]:n.transform(r[t],i[t],e)})}}a.retain(l,s.default.transform(n.attributes,o.attributes,e))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(t,e=!1){e=!!e;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=t;){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r<t||!e)&&(t+=i),r+=i):t-=Math.min(i,t-r)}return t}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=s.default,u.handlers={},e.default=u,t.exports=u,t.exports.default=u}(Ci,Ci.exports)),Ci.exports);const Vi=F($i);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={"&":"&","<":"<",">":">",'"':""","'":"'"};function Zi(t){return t.replace(/[&<>"']/g,t=>Wi[t])}const Gi=class t extends fi{static compare(e,n){const r=t.order.indexOf(e),i=t.order.indexOf(n);return r>=0||i>=0?r-i:e===n?0:e<n?-1:1}formatAt(e,n,r,i){if(t.compare(this.statics.blotName,r)<0&&this.scroll.query(r,Zr.BLOT)){const t=this.isolate(e,n);i&&t.wrap(r,i)}else super.formatAt(e,n,r,i)}optimize(e){if(super.optimize(e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){const t=this.parent.isolate(this.offset(),this.length());this.moveChildren(t),t.wrap(this)}}};e(Gi,"allowedChildren",[Gi,Hi,vi,Ki]),e(Gi,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Yi=Gi;class Ji extends mi{constructor(){super(...arguments),e(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=Qi(this)),this.cache.delta}deleteAt(t,e){super.deleteAt(t,e),this.cache={}}formatAt(t,e,n,r){e<=0||(this.scroll.query(n,Zr.BLOCK)?t+e===this.length()&&this.format(n,r):super.formatAt(t,Math.min(e,this.length()-t-1),n,r),this.cache={})}insertAt(t,e,n){if(null!=n)return super.insertAt(t,e,n),void(this.cache={});if(0===e.length)return;const r=e.split("\n"),i=r.shift();i.length>0&&(t<this.length()-1||null==this.children.tail?super.insertAt(Math.min(t,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let s=this;r.reduce((t,e)=>(s=s.split(t,!0),s.insertAt(0,e),e.length),t+i.length)}insertBefore(t,e){const{head:n}=this.children;super.insertBefore(t,e),n instanceof Hi&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(t,e){super.moveChildren(t,e),this.cache={}}optimize(t){super.optimize(t),this.cache={}}path(t){return super.path(t,!0)}removeChild(t){super.removeChild(t),this.cache={}}split(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&(0===t||t>=this.length()-1)){const e=this.clone();return 0===t?(this.parent.insertBefore(e,this),this):(this.parent.insertBefore(e,this.next),e)}const n=super.split(t,e);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(t,e){const n=this.scroll.query(t,Zr.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,e)}formatAt(t,e,n,r){this.format(n,r)}insertAt(t,e,n){if(null!=n)return void super.insertAt(t,e,n);const r=e.split("\n"),i=r.pop(),s=r.map(t=>{const e=this.scroll.create(Ji.blotName);return e.insertAt(0,t),e}),o=this.split(t);s.forEach(t=>{this.parent.insertBefore(t,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function Qi(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.descendants(li).reduce((t,n)=>0===n.length()?t:t.insert(n.value(),ts(n,{},e)),new Vi).insert("\n",ts(t))}function ts(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==t?e:("formats"in t&&"function"==typeof t.formats&&(e={...e,...t.formats()},n&&delete e["code-token"]),null==t.parent||"scroll"===t.parent.statics.blotName||t.parent.statics.scope!==t.statics.scope?e:ts(t.parent,e,n))}Xi.scope=Zr.BLOCK_BLOT;const es=class t extends vi{static value(){}constructor(e,n,r){super(e,n),this.selection=r,this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(e,n){if(0!==this.savedLength)return void super.format(e,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=t.CONTENTS.length,r.optimize(),r.formatAt(i,t.CONTENTS.length,e,n),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}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 e=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(t.CONTENTS).join("");let a;if(o.data=t.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 t=document.createTextNode(l);a=this.scroll.create(t),this.parent.insertBefore(a,this)}if(this.remove(),e){const t=(t,e)=>n&&t===n.domNode?e:t===o?r+e-1:i&&t===i.domNode?r+l.length+e:null,s=t(e.start.node,e.start.offset),c=t(e.end.node,e.end.offset);if(null!==s&&null!==c)return{startNode:a.domNode,startOffset:s,endNode:a.domNode,endOffset:c}}return null}update(t,e){if(t.some(t=>"characterData"===t.type&&t.target===this.textNode)){const t=this.restore();t&&(e.range=t)}}optimize(e){super.optimize(e);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=t.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};e(es,"blotName","cursor"),e(es,"className","ql-cursor"),e(es,"tagName","span"),e(es,"CONTENTS","\ufeff");let ns=es;var rs,is={exports:{}};var ss=(rs||(rs=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new i(r,s||t,o),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],l]:t._events[a].push(l):(t._events[a]=l,t._eventsCount++),t}function o(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}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 t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},l.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];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(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},l.prototype.emit=function(t,e,r,i,s,o){var l=n?n+t:t;if(!this._events[l])return!1;var a,c,u=this._events[l],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,i),!0;case 5:return u.fn.call(u.context,e,r,i,s),!0;case 6:return u.fn.call(u.context,e,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(t,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,e);break;case 3:u[c].fn.call(u[c].context,e,r);break;case 4:u[c].fn.call(u[c].context,e,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(t,e,n){return s(this,t,e,n,!1)},l.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},l.prototype.removeListener=function(t,e,r,i){var s=n?n+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var l=this._events[s];if(l.fn)l.fn!==e||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!==e||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(t){var e;return t?(e=n?n+t:t,this._events[e]&&o(this,e)):(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,t.exports=l}(is)),is.exports);const os=F(ss),ls=new WeakMap,as=["error","warn","log","info"];let cs="warn";function us(t){if(cs&&as.indexOf(t)<=as.indexOf(cs))for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r]}function hs(t){return as.reduce((e,n)=>(e[n]=us.bind(console,n,t),e),{})}hs.level=t=>{cs=t},us.level=hs.level;const ds=hs("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(t=>{document.addEventListener(t,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(t=>{const n=ls.get(t);n&&n.emitter&&n.emitter.handleDOM(...e)})})});class fs extends os{constructor(){super(),this.domListeners={},this.on("error",ds.error)}emit(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return ds.log.call(ds,...e),super.emit(...e)}handleDOM(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];(this.domListeners[t.type]||[]).forEach(e=>{let{node:r,handler:i}=e;(t.target===r||r.contains(t.target))&&i(t,...n)})}listenDOM(t,e,n){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:n})}}e(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"}),e(fs,"sources",{API:"api",SILENT:"silent",USER:"user"});const ps=hs("quill:selection");class ms{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=t,this.length=e}}class gs{constructor(t,e){this.emitter=e,this.scroll=t,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 t=this.getNativeRange();null!=t&&t.start.node!==this.cursor.textNode&&this.emitter.once(fs.events.SCROLL_UPDATE,(e,n)=>{try{this.root.contains(t.start.node)&&this.root.contains(t.end.node)&&this.setNativeRange(t.start.node,t.start.offset,t.end.node,t.end.offset);const r=n.some(t=>"characterData"===t.type||"childList"===t.type||"attributes"===t.type&&t.target===this.root);this.update(r?fs.sources.SILENT:e)}catch(r){}})}),this.emitter.on(fs.events.SCROLL_OPTIMIZE,(t,e)=>{if(e.range){const{startNode:t,startOffset:n,endNode:r,endOffset:i}=e.range;this.setNativeRange(t,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 t=this.cursor.restore();if(!t)return;setTimeout(()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.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(t,e){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(t,Zr.BLOCK)){if(n.start.node!==this.cursor.textNode){const t=this.scroll.find(n.start.node,!1);if(null==t)return;if(t instanceof li){const e=t.split(n.start.offset);t.parent.insertBefore(this.cursor,e)}else t.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;t=Math.min(t,n-1),e=Math.min(t+e,n-1)-t;let[i,s]=this.scroll.leaf(t);if(null==i)return null;if(e>0&&s===i.length()){const[e]=this.scroll.leaf(t+1);if(e){const[n]=this.scroll.line(t),[r]=this.scroll.line(t+1);n===r&&(i=e,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(e>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(t+e),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 t=document.getSelection();if(null==t||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(null==e)return null;const n=this.normalizeNative(e);return ps.info("getNativeRange",n),n}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();if(null==e)return[null,null];return[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&bs(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const n=e.map(t=>{const[e,n]=t,r=this.scroll.find(e,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof li?i+r.index(e,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(t){if(!bs(this.root,t.startContainer)||!t.collapsed&&!bs(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(t=>{let{node:e,offset:n}=t;for(;!(e instanceof Text)&&e.childNodes.length>0;)if(e.childNodes.length>n)e=e.childNodes[n],n=0;else{if(e.childNodes.length!==n)break;e=e.lastChild,n=e instanceof Text?e.data.length:e.childNodes.length>0?e.childNodes.length:e.childNodes.length+1}t.node=e,t.offset=n}),e}rangeToNative(t){const e=this.scroll.length(),n=(t,n)=>{t=Math.min(e-1,t);const[r,i]=this.scroll.leaf(t);return r?r.position(i,n):[null,-1]};return[...n(t.index,!1),...n(t.index+t.length,!0)]}setNativeRange(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(ps.info("setNativeRange",t,e,n,r),null!=t&&(null==this.root.parentNode||null==t.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=t){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||t!==o.startContainer||e!==o.startOffset||n!==o.endContainer||r!==o.endOffset){t instanceof Element&&"BR"===t.tagName&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(t,e),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(t){let e=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 e&&(n=e,e=!1),ps.info("setRange",t),null!=t){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(n)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fs.sources.USER;const e=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Hr(e,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const t=this.cursor.restore();t&&this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)}const n=[fs.events.SELECTION_CHANGE,kr(this.lastRange),kr(e),t];this.emitter.emit(fs.events.EDITOR_CHANGE,...n),t!==fs.sources.SILENT&&this.emitter.emit(...n)}}}function bs(t,e){try{e.parentNode}catch(n){return!1}return t.contains(e)}const vs=/^[ -~]*$/;class ys{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const n=ks(t),r=new Vi;return function(t){const e=[];return t.forEach(t=>{if("string"==typeof t.insert){t.insert.split("\n").forEach((n,r)=>{r&&e.push({insert:"\n",attributes:t.attributes}),n&&e.push({insert:n,attributes:t.attributes})})}else e.push(t)}),e}(n.ops.slice()).reduce((t,n)=>{const i=$i.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")&&(e<=t||!!this.scroll.descendant(Xi,t)[0]),this.scroll.insertAt(t,r);const[i,o]=this.scroll.line(t);let a=Wr({},ts(i));if(i instanceof Ji){const[t]=i.descendant(li,o);t&&(a=Wr(a,ts(t)))}s=$i.AttributeMap.diff(a,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;const i=null!=this.scroll.query(r,Zr.INLINE);if(i)(e<=t||this.scroll.descendant(Xi,t)[0])&&(l=!0);else if(t>0){const[e,n]=this.scroll.descendant(li,t-1);if(e instanceof Ki){"\n"!==e.value()[n]&&(o=!0)}else e instanceof vi&&e.statics.scope===Zr.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(t,r,n.insert[r]),i){const[e]=this.scroll.descendant(li,t);if(e){const t=Wr({},ts(e));s=$i.AttributeMap.diff(t,s)||{}}}}e+=i}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const e=Object.keys(n.retain)[0];if(null==e)return t;this.scroll.updateEmbedAt(t,e,n.retain[e])}Object.keys(s).forEach(e=>{this.scroll.formatAt(t,i,e,s[e])});const a=o?1:0,c=l?1:0;return e+=a+c,r.retain(a),r.delete(c),t+i+a+c},0),r.reduce((t,e)=>"number"==typeof e.delete?(this.scroll.deleteAt(t,e.delete),t):t+$i.Op.length(e),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update((new Vi).retain(t).delete(e))}formatLine(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(t,Math.max(e,1)).forEach(t=>{t.format(r,n[r])})}),this.scroll.optimize();const r=(new Vi).retain(t).retain(e,kr(n));return this.update(r)}formatText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e,r,n[r])});const r=(new Vi).retain(t).retain(e,kr(n));return this.update(r)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new Vi)}getFormat(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===e?this.scroll.path(t).forEach(t=>{const[e]=t;e instanceof Ji?n.push(e):e instanceof li&&r.push(e)}):(n=this.scroll.lines(t,e),r=this.scroll.descendants(li,t,e));const[i,s]=[n,r].map(t=>{const e=t.shift();if(null==e)return{};let n=ts(e);for(;Object.keys(n).length>0;){const e=t.shift();if(null==e)return n;n=Ns(ts(e),n)}return n});return{...i,...s}}getHTML(t,e){const[n,r]=this.scroll.line(t);if(n){const i=n.length();return!(n.length()>=r+e)||0===r&&e===i?ws(this.scroll,t,e,!0):ws(n,r,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(t=>"string"==typeof t.insert).map(t=>t.insert).join("")}insertContents(t,e){const n=ks(e),r=(new Vi).retain(t).concat(n);return this.scroll.insertContents(t,n),this.update(r)}insertEmbed(t,e,n){return this.scroll.insertAt(t,e,n),this.update((new Vi).retain(t).insert({[e]:n}))}insertText(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(t,e),Object.keys(n).forEach(r=>{this.scroll.formatAt(t,e.length,r,n[r])}),this.update((new Vi).retain(t).insert(e,kr(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if((null==t?void 0:t.statics.blotName)!==Ji.blotName)return!1;const e=t;return!(e.children.length>1)&&e.children.head instanceof Hi}removeFormat(t,e){const n=this.getText(t,e),[r,i]=this.scroll.line(t+e);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(t,e+s).diff((new Vi).insert(n).concat(o)),a=(new Vi).retain(t).concat(l);return this.applyDelta(a)}update(t){let e=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===e.length&&"characterData"===e[0].type&&e[0].target.data.match(vs)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),s=ts(i),o=i.offset(this.scroll),l=e[0].oldValue.replace(ns.CONTENTS,""),a=(new Vi).insert(l),c=(new Vi).insert(i.value()),u=n&&{oldRange:As(n.oldRange,-o),newRange:As(n.newRange,-o)};t=(new Vi).retain(o).concat(a.diff(c,u)).reduce((t,e)=>e.insert?t.insert(e.insert,s):t.push(e),new Vi),this.delta=r.compose(t)}else this.delta=this.getDelta(),t&&Hr(r.compose(t),this.delta)||(t=r.diff(this.delta,n));return t}}function xs(t,e,n){if(0===t.length){const[t]=Es(n.pop());return e<=0?`</li></${t}>`:`</li></${t}>${xs([],e-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=t,[c,u]=Es(l);if(o>e)return n.push(l),o===e+1?`<${c}><li${u}>${ws(r,i,s)}${xs(a,o,n)}`:`<${c}><li>${xs(t,e+1,n)}`;const h=n[n.length-1];if(o===e&&l===h)return`</li><li${u}>${ws(r,i,s)}${xs(a,o,n)}`;const[d]=Es(n.pop());return`</li></${d}>${xs(t,e-1,n)}`}function ws(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in t&&"function"==typeof t.html)return t.html(e,n);if(t instanceof Ki){return Zi(t.value().slice(e,e+n)).replaceAll(" "," ")}if(t instanceof hi){if("list-container"===t.statics.blotName){const r=[];return t.children.forEachAt(e,n,(t,e,n)=>{const i="formats"in t&&"function"==typeof t.formats?t.formats():{};r.push({child:t,offset:e,length:n,indent:i.indent||0,type:i.list})}),xs(r,-1,[])}const i=[];if(t.children.forEachAt(e,n,(t,e,n)=>{i.push(ws(t,e,n))}),r||"list"===t.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=t.domNode,[l,a]=s.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return t.domNode instanceof Element?t.domNode.outerHTML:""}function Ns(t,e){return Object.keys(e).reduce((n,r)=>{if(null==t[r])return n;const i=e[r];return i===t[r]?n[r]=i:Array.isArray(i)?i.indexOf(t[r])<0?n[r]=i.concat([t[r]]):n[r]=i:n[r]=[i,t[r]],n},{})}function Es(t){const e="ordered"===t?"ol":"ul";switch(t){case"checked":return[e,' data-list="checked"'];case"unchecked":return[e,' data-list="unchecked"'];default:return[e,""]}}function ks(t){return t.reduce((t,e)=>{if("string"==typeof e.insert){const n=e.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.insert(n,e.attributes)}return t.push(e)},new Vi)}function As(t,e){let{index:n,length:r}=t;return new ms(n+e,r)}class Ss{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=t,this.options=e}}e(Ss,"DEFAULTS",{});const Cs="\ufeff";class js extends vi{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(t=>{this.contentNode.appendChild(t)}),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(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e,n=null;const r=t.data.split(Cs).join("");if(t===this.leftGuard)if(this.prev instanceof Ki){const t=this.prev.length();this.prev.insertAt(t,r),n={startNode:this.prev.domNode,startOffset:t+r.length}}else e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this),n={startNode:e,startOffset:r.length};else t===this.rightGuard&&(this.next instanceof Ki?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(e=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(e),this.next),n={startNode:e,startOffset:r.length}));return t.data=Cs,n}update(t,e){t.forEach(t=>{if("characterData"===t.type&&(t.target===this.leftGuard||t.target===this.rightGuard)){const n=this.restore(t.target);n&&(e.range=n)}})}}class _s{constructor(t,n){e(this,"isComposing",!1),this.scroll=t,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",t=>{this.isComposing||this.handleCompositionStart(t)}),this.scroll.domNode.addEventListener("compositionend",t=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(t)})})}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;!e||e instanceof js||(this.emitter.emit(fs.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(fs.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(fs.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(fs.events.COMPOSITION_END,t),this.isComposing=!1}}const qs=class{constructor(t,n){e(this,"modules",{}),this.quill=t,this.options=n}init(){Object.keys(this.options.modules).forEach(t=>{null==this.modules[t]&&this.addModule(t)})}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}};e(qs,"DEFAULTS",{modules:{}}),e(qs,"themes",{default:qs});let Os=qs;const Ts=t=>t.parentElement||t.getRootNode().host||null,Ls=t=>{const e=t.getBoundingClientRect(),n="offsetWidth"in t&&Math.abs(e.width)/t.offsetWidth||1,r="offsetHeight"in t&&Math.abs(e.height)/t.offsetHeight||1;return{top:e.top,right:e.left+t.clientWidth*n,bottom:e.top+t.clientHeight*r,left:e.left}},Is=t=>{const e=parseInt(t,10);return Number.isNaN(e)?0:e},Rs=(t,e,n,r,i,s)=>t<n&&e>r?0:t<n?-(n-t+i):e>r?e-t>r-n?t+i-n:e-r+s:0,Ms=["block","break","cursor","inline","scroll","text"],Bs=hs("quill"),Ds=new Xr;hi.uiClass="ql-ui";const Ps=class t{static debug(t){!0===t&&(t="log"),hs.level(t)}static find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ls.get(t)||Ds.find(t,e)}static import(t){return null==this.imports[t]&&Bs.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const t=arguments.length<=0?void 0:arguments[0],e=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in t?t.attrName:t.blotName;"string"==typeof n?this.register(`formats/${n}`,t,e):Object.keys(t).forEach(n=>{this.register(n,t[n],e)})}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[t]||n||Bs.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&"boolean"!=typeof e&&"abstract"!==e.blotName&&Ds.register(e),"function"==typeof e.register&&e.register(Ds)}}constructor(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(t,e){const n=Fs(t);if(!n)throw new Error("Invalid Quill container");const r=!e.theme||e.theme===Us.DEFAULTS.theme,i=r?Os:Us.import(`themes/${e.theme}`);if(!i)throw new Error(`Invalid theme ${e.theme}. Did you register it?`);const{modules:s,...o}=Us.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=zs(e.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Wr({},zs(s),zs(l),c),h={...o,...$s(a),...$s(e)};let d=e.registry;d?e.formats&&Bs.warn('Ignoring "formats" option because "registry" is specified'):d=e.formats?((t,e,n)=>{const r=new Xr;return Ms.forEach(t=>{const n=e.query(t);n&&r.register(n)}),t.forEach(t=>{let i=e.query(t);i||n.error(`Cannot register "${t}" 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: "${t}"`);break}}),r})(e.formats,h.registry,Bs):h.registry;return{...h,registry:d,container:n,theme:i,modules:Object.entries(u).reduce((t,e)=>{let[n,r]=e;if(!r)return t;const i=Us.import(`modules/${n}`);return null==i?(Bs.error(`Cannot load ${n} module. Are you sure you registered it?`),t):{...t,[n]:Wr({},i.DEFAULTS||{},r)}},{}),bounds:Fs(h.bounds)}}(e,n),this.container=this.options.container,null==this.container)return void Bs.error("Invalid Quill container",e);this.options.debug&&t.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,t=>{t===fs.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(fs.events.SCROLL_UPDATE,(t,e)=>{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,e,i),t)}),this.emitter.on(fs.events.SCROLL_EMBED_UPDATE,(e,n)=>{const r=this.selection.lastRange,[i]=this.selection.getRange(),s=r&&i?{oldRange:r,newRange:i}:void 0;Vs.call(this,()=>{const t=(new Vi).retain(e.offset(this)).retain({[e.statics.blotName]:n});return this.editor.update(t,[],s)},t.sources.USER)}),r){const t=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(t)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof t){const e=t;(t=document.createElement("div")).classList.add(e)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,n){return[t,e,,n]=Hs(t,e,n),Vs.call(this,()=>this.editor.deleteText(t,e),n,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){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(t,Zr.BLOCK))r=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(0===n.length)return this.selection.format(t,e),r;r=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,fs.sources.SILENT),r},n)}formatLine(t,e,n,r,i){let s;return[t,e,s,i]=Hs(t,e,n,r,i),Vs.call(this,()=>this.editor.formatLine(t,e,s),i,t,0)}formatText(t,e,n,r,i){let s;return[t,e,s,i]=Hs(t,e,n,r,i),Vs.call(this,()=>this.editor.formatText(t,e,s),i,t,0)}getBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof t?this.selection.getBounds(t,e):this.selection.getBounds(t.index,t.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-t;return[t,e]=Hs(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof t?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}getIndex(t){return t.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(t){return this.scroll.leaf(t)}getLine(t){return this.scroll.line(t)}getLines(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof t?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}getModule(t){return this.theme.modules[t]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=Hs(t,e),this.editor.getHTML(t,e)}getText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return"number"==typeof t&&(e=e??this.getLength()-t),[t,e]=Hs(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(e,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.sources.API;return Vs.call(this,()=>this.editor.insertEmbed(e,n,r),i,e)}insertText(t,e,n,r,i){let s;return[t,,s,i]=Hs(t,0,n,r,i),Vs.call(this,()=>this.editor.insertText(t,e,s),i,t,e.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(t,e,n){return[t,e,,n]=Hs(t,e,n),Vs.call(this,()=>this.editor.removeFormat(t,e),n,t)}scrollRectIntoView(t){((t,e)=>{var n,r,i;const s=t.ownerDocument;let o=e,l=t;for(;l;){const t=l===s.body,e=t?{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,e.left,e.right,Is(a.scrollPaddingLeft),Is(a.scrollPaddingRight)),u=Rs(o.top,o.bottom,e.top,e.bottom,Is(a.scrollPaddingTop),Is(a.scrollPaddingBottom));if(c||u)if(t)null==(i=s.defaultView)||i.scrollBy(c,u);else{const{scrollLeft:t,scrollTop:e}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-t,r=l.scrollTop-e;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=t||"fixed"===a.position?null:Ts(l)}})(this.root,t)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fs.sources.API;return Vs.call(this,()=>{t=new Vi(t);const e=this.getLength(),n=this.editor.deleteText(0,e),r=this.editor.insertContents(0,t),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},e)}setSelection(e,n,r){null==e?this.selection.setRange(null,n||t.sources.API):([e,n,,r]=Hs(e,n,r),this.selection.setRange(new ms(Math.max(0,e),n),r),r!==fs.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fs.sources.API;const n=(new Vi).insert(t);return this.setContents(n,e)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fs.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fs.sources.API;return Vs.call(this,()=>(t=new Vi(t),this.editor.applyDelta(t)),e,!0)}};e(Ps,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Ds,theme:"default"}),e(Ps,"events",fs.events),e(Ps,"sources",fs.sources),e(Ps,"version","2.0.3"),e(Ps,"imports",{delta:Vi,parchment:ki,"core/module":Ss,"core/theme":Os});let Us=Ps;function Fs(t){return"string"==typeof t?document.querySelector(t):t}function zs(t){return Object.entries(t??{}).reduce((t,e)=>{let[n,r]=e;return{...t,[n]:!0===r?{}:r}},{})}function $s(t){return Object.fromEntries(Object.entries(t).filter(t=>void 0!==t[1]))}function Vs(t,e,n,r){if(!this.isEnabled()&&e===fs.sources.USER&&!this.allowReadOnlyEdits)return new Vi;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=t();if(null!=i&&(!0===n&&(n=i.index),null==r?i=Ks(i,o,e):0!==r&&(i=Ks(i,n,r,e)),this.setSelection(i,fs.sources.SILENT)),o.length()>0){const t=[fs.events.TEXT_CHANGE,o,s,e];this.emitter.emit(fs.events.EDITOR_CHANGE,...t),e!==fs.sources.SILENT&&this.emitter.emit(...t)}return o}function Hs(t,e,n,r,i){let s={};return"number"==typeof t.index&&"number"==typeof t.length?"number"!=typeof e?(i=r,r=n,n=e,e=t.length,t=t.index):(e=t.length,t=t.index):"number"!=typeof e&&(i=r,r=n,n=e,e=0),"object"==typeof n?(s=n,i=r):"string"==typeof n&&(null!=r?s[n]=r:i=n),[t,e,s,i=i||fs.sources.API]}function Ks(t,e,n,r){const i="number"==typeof n?n:0;if(null==t)return null;let s,o;return e&&"function"==typeof e.transformPosition?[s,o]=[t.index,t.index+t.length].map(t=>e.transformPosition(t,r!==fs.sources.USER)):[s,o]=[t.index,t.index+t.length].map(t=>t<e||t===e&&r===fs.sources.USER?t:i>=0?t+i:Math.max(e,t+i)),new ms(s,o-s)}class Ws extends bi{}function Zs(t){return t instanceof Ji||t instanceof Xi}function Gs(t){return"function"==typeof t.updateContent}class Ys extends wi{constructor(t,e,n){let{emitter:r}=n;super(t,e),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",t=>this.handleDragStart(t))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(fs.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(fs.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(fs.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[n,r]=this.line(t),[i]=this.line(t+e);if(super.deleteAt(t,e),null!=i&&n!==i&&r>0){if(n instanceof Xi||i instanceof Xi)return void this.optimize();const t=i.children.head instanceof Hi?null:i.children.head;n.moveChildren(i,t),n.remove()}this.optimize()}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",t?"true":"false")}formatAt(t,e,n,r){super.formatAt(t,e,n,r),this.optimize()}insertAt(t,e,n){if(t>=this.length())if(null==n||null==this.scroll.query(e,Zr.BLOCK)){const t=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(t),null==n&&e.endsWith("\n")?t.insertAt(0,e.slice(0,-1),n):t.insertAt(0,e,n)}else{const t=this.scroll.create(e,n);this.appendChild(t)}else super.insertAt(t,e,n);this.optimize()}insertBefore(t,e){if(t.statics.scope===Zr.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(t),super.insertBefore(n,e)}else super.insertBefore(t,e)}insertContents(t,e){const n=this.deltaToRenderBlocks(e.concat((new Vi).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const e="block"===i.type&&(0===i.delta.length()||!this.descendant(Xi,t)[0]&&t<this.length()),n="block"===i.type?i.delta:(new Vi).insert({[i.key]:i.value});Js(this,t,n);const r="block"===i.type?1:0,s=t+n.length()+r;e&&this.insertAt(s-1,"\n");const o=ts(this.line(t)[0]),l=$i.AttributeMap.diff(o,i.attributes)||{};Object.keys(l).forEach(t=>{this.formatAt(s-1,1,t,l[t])}),t=s}let[s,o]=this.children.find(t);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach(t=>{if("block"===t.type){Js(this.createBlock(t.attributes,s||void 0),0,t.delta)}else{const e=this.create(t.key,t.value);this.insertBefore(e,s||void 0),Object.keys(t.attributes).forEach(n=>{e.format(n,t.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(t){const e=this.path(t).pop();if(!e)return[null,-1];const[n,r]=e;return n instanceof li?[n,r]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(Zs,t)}lines(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(t,e,r)=>{let i=[],s=r;return t.children.forEachAt(e,r,(t,e,r)=>{Zs(t)?i.push(t):t instanceof bi&&(i=i.concat(n(t,e,s))),s-=r}),i};return n(this,t,e)}optimize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(t,e),t.length>0&&this.emitter.emit(fs.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch)return void(Array.isArray(t)&&(this.batch=this.batch.concat(t)));let e=fs.sources.USER;"string"==typeof t&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),(t=t.filter(t=>{let{target:e}=t;const n=this.find(e,!0);return n&&!Gs(n)})).length>0&&this.emitter.emit(fs.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(fs.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,n){const[r]=this.descendant(t=>t instanceof Xi,t);r&&r.statics.blotName===e&&Gs(r)&&r.updateContent(n)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let n=new Vi;return t.forEach(t=>{const r=null==t?void 0:t.insert;if(r)if("string"==typeof r){const i=r.split("\n");i.slice(0,-1).forEach(r=>{n.insert(r,t.attributes),e.push({type:"block",delta:n,attributes:t.attributes??{}}),n=new Vi});const s=i[i.length-1];s&&n.insert(s,t.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,Zr.INLINE)?n.push(t):(n.length()&&e.push({type:"block",delta:n,attributes:{}}),n=new Vi,e.push({type:"blockEmbed",key:i,value:r[i],attributes:t.attributes??{}}))}}),n.length()&&e.push({type:"block",delta:n,attributes:{}}),e}createBlock(t,e){let n;const r={};Object.entries(t).forEach(t=>{let[e,i]=t;null!=this.query(e,Zr.BLOCK&Zr.BLOT)?n=e:r[e]=i});const i=this.create(n||this.statics.defaultChild.blotName,n?t[n]:void 0);this.insertBefore(i,e||void 0);const s=i.length();return Object.entries(r).forEach(t=>{let[e,n]=t;i.formatAt(0,s,e,n)}),i}}function Js(t,e,n){n.reduce((e,n)=>{const r=$i.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;t.insertAt(e,r);const[s]=t.descendant(li,e),o=ts(s);i=$i.AttributeMap.diff(o,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;t.insertAt(e,r,n.insert[r]);if(null!=t.scroll.query(r,Zr.INLINE)){const[n]=t.descendant(li,e),r=ts(n);i=$i.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach(n=>{t.formatAt(e,r,n,i[n])}),e+r},e)}e(Ys,"blotName","scroll"),e(Ys,"className","ql-editor"),e(Ys,"tagName","DIV"),e(Ys,"defaultChild",Ji),e(Ys,"allowedChildren",[Ji,Xi,Ws]);const Xs={scope:Zr.BLOCK,whitelist:["right","center","justify"]},Qs=new Gr("align","align",Xs),to=new ti("align","ql-align",Xs),eo=new ni("align","text-align",Xs);class no extends ni{value(t){let e=super.value(t);if(!e.startsWith("rgb("))return e;e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${e.split(",").map(t=>`00${parseInt(t,10).toString(16)}`.slice(-2)).join("")}`}}const ro=new ti("color","ql-color",{scope:Zr.INLINE}),io=new no("color","color",{scope:Zr.INLINE}),so=new ti("background","ql-bg",{scope:Zr.INLINE}),oo=new no("background","background-color",{scope:Zr.INLINE});class lo extends Ws{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(t=>t.length()<=1?"":t.domNode.innerText).join("\n").slice(t,t+e)}html(t,e){return`<pre>\n${Zi(this.code(t,e))}\n</pre>`}}class ao extends Ji{static register(){Us.register(lo)}}e(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 ti("direction","ql-direction",uo),po=new ni("direction","direction",uo),mo={scope:Zr.INLINE,whitelist:["serif","monospace"]},go=new ti("font","ql-font",mo);const bo=new class extends ni{value(t){return super.value(t).replace(/["']/g,"")}}("font","font-family",mo),vo=new ti("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(t,e){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!e[n]!==t[n]&&null!==e[n])&&(e.key===t.key||e.key===t.which)}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(t=>{this.options.bindings[t]&&this.addBinding(this.options.bindings[t])}),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(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(t){if("string"==typeof t||"number"==typeof t)t={key:t};else{if("object"!=typeof t)return null;t=kr(t)}t.shortKey&&(t[wo]=t.shortKey,delete t.shortKey);return t}(t);if(null==r)return void xo.warn("Attempted to add invalid keyboard binding",r);"function"==typeof e&&(e={handler:e}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(t=>{const i={...r,key:t,...e,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing)return;if(229===t.keyCode&&("Enter"===t.key||"Backspace"===t.key))return;const e=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(e=>No.match(t,e));if(0===e.length)return;const n=Us.find(t.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:t};e.some(t=>{if(null!=t.collapsed&&t.collapsed!==d.collapsed)return!1;if(null!=t.empty&&t.empty!==d.empty)return!1;if(null!=t.offset&&t.offset!==d.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(t=>null==d.format[t]))return!1}else if("object"==typeof t.format&&!Object.keys(t.format).every(e=>!0===t.format[e]?null!=d.format[e]:!1===t.format[e]?null==d.format[e]:Hr(t.format[e],d.format[e])))return!1;return!(null!=t.prefix&&!t.prefix.test(d.prefix))&&(!(null!=t.suffix&&!t.suffix.test(d.suffix))&&!0!==t.handler.call(this,r,d,t))})&&t.preventDefault()})}handleBackspace(t,e){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(0===t.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(t.index);let s=(new Vi).retain(t.index-n).delete(n);if(0===e.offset){const[e]=this.quill.getLine(t.index-1);if(e){if(!("block"===e.statics.blotName&&e.length()<=1)){const e=i.formats(),n=this.quill.getFormat(t.index-1,1);if(r=$i.AttributeMap.diff(e,n)||{},Object.keys(r).length>0){const e=(new Vi).retain(t.index+i.length()-2).retain(1,r);s=s.compose(e)}}}}this.quill.updateContents(s,Us.sources.USER),this.quill.focus()}handleDelete(t,e){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(t.index);let s=(new Vi).retain(t.index).delete(n);if(e.offset>=i.length()-1){const[e]=this.quill.getLine(t.index+1);if(e){const n=i.formats(),o=this.quill.getFormat(t.index,1);r=$i.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(e.length()-1).retain(1,r))}}this.quill.updateContents(s,Us.sources.USER),this.quill.focus()}handleDeleteRange(t){jo({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const n=Object.keys(e.format).reduce((t,n)=>(this.quill.scroll.query(n,Zr.BLOCK)&&!Array.isArray(e.format[n])&&(t[n]=e.format[n]),t),{}),r=(new Vi).retain(t.index).delete(t.length).insert("\n",n);this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(t.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(t,e){return!(!e.collapsed||0===e.offset)||(this.quill.format("indent","+1",Us.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(t,e){return!(!e.collapsed||0===e.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(t,e){null!=e.format.indent?this.quill.format("indent","-1",Us.sources.USER):null!=e.format.list&&this.quill.format("list",!1,Us.sources.USER)}},"indent code-block":ko(!0),"outdent code-block":ko(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(t){this.quill.deleteText(t.index-1,1,Us.sources.USER)}},tab:{key:"Tab",handler(t,e){if(e.format.table)return!0;this.quill.history.cutoff();const n=(new Vi).retain(t.index).delete(t.length).insert("\t");return this.quill.updateContents(n,Us.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(t.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(t,e){const n={list:!1};e.format.indent&&(n.indent=!1),this.quill.formatLine(t.index,t.length,n,Us.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(t){const[e,n]=this.quill.getLine(t.index),r={...e.formats(),list:"checked"},i=(new Vi).retain(t.index).insert("\n",r).retain(e.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,Us.sources.USER),this.quill.setSelection(t.index+1,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(t,e){const[n,r]=this.quill.getLine(t.index),i=(new Vi).retain(t.index).insert("\n",e.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,Us.sources.USER),this.quill.setSelection(t.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(t){const e=this.quill.getModule("table");if(e){const[n,r,i,s]=e.getTable(t),o=function(t,e,n,r){if(null==e.prev&&null==e.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==e.prev)return-1;if(null==e.next)return 1;return null}(0,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const e=(new Vi).retain(l).insert("\n");this.quill.updateContents(e,Us.sources.USER),this.quill.setSelection(t.index+1,t.length,Us.sources.SILENT)}else if(o>0){l+=n.length();const t=(new Vi).retain(l).insert("\n");this.quill.updateContents(t,Us.sources.USER),this.quill.setSelection(l,Us.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(t,e){const{event:n,line:r}=e,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(t,e){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=e.prefix,[r,i]=this.quill.getLine(t.index);if(i>n)return!0;let s;switch(e.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(t.index," ",Us.sources.USER),this.quill.history.cutoff();const o=(new Vi).retain(t.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(t.index-n,Us.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(t){const[e,n]=this.quill.getLine(t.index);let r=2,i=e;for(;null!=i&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,r-=1,r<=0){const r=(new Vi).retain(t.index+e.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(t.index-1,Us.sources.SILENT),!1}return!0}},"embed left":Ao("ArrowLeft",!1),"embed left shift":Ao("ArrowLeft",!0),"embed right":Ao("ArrowRight",!1),"embed right shift":Ao("ArrowRight",!0),"table down":Co(!1),"table up":Co(!0)}};function ko(t){return{key:"Tab",shiftKey:!t,format:{"code-block":!0},handler(e,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===e.length&&!r.shiftKey)return this.quill.insertText(e.index,s,Us.sources.USER),void this.quill.setSelection(e.index+s.length,Us.sources.SILENT);const o=0===e.length?this.quill.getLines(e.index,1):this.quill.getLines(e);let{index:l,length:a}=e;o.forEach((e,n)=>{t?(e.insertAt(0,s),0===n?l+=s.length:a+=s.length):e.domNode.textContent.startsWith(s)&&(e.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 Ao(t,e){const n="ArrowLeft"===t?"prefix":"suffix";return{key:t,shiftKey:e,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===t&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof vi)||("ArrowLeft"===t?e?this.quill.setSelection(n.index-1,n.length+1,Us.sources.USER):this.quill.setSelection(n.index-1,Us.sources.USER):e?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(t){return{key:t[0],shortKey:!0,handler(e,n){this.quill.format(t,!n.format[t],Us.sources.USER)}}}function Co(t){return{key:t?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(e,n){const r=t?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let t=s.children.head,e=i;for(;null!=e.prev;)e=e.prev,t=t.next;const r=t.offset(this.quill.scroll)+Math.min(n.offset,t.length()-1);this.quill.setSelection(r,0,Us.sources.USER)}}else{const e=i.table()[r];null!=e&&(t?this.quill.setSelection(e.offset(this.quill.scroll)+e.length()-1,0,Us.sources.USER):this.quill.setSelection(e.offset(this.quill.scroll),0,Us.sources.USER))}return!1}}}function jo(t){let{quill:e,range:n}=t;const r=e.getLines(n);let i={};if(r.length>1){const t=r[0].formats(),e=r[r.length-1].formats();i=$i.AttributeMap.diff(e,t)||{}}e.deleteText(n,Us.sources.USER),Object.keys(i).length>0&&e.formatLine(n.index,1,i,Us.sources.USER),e.setSelection(n.index,Us.sources.SILENT)}No.DEFAULTS=Eo;const _o=/font-weight:\s*normal/,qo=["P","OL","UL"],Oo=t=>t&&qo.includes(t.tagName);const To=/\bmso-list:[^;]*ignore/i,Lo=/\bmso-list:[^;]*\bl(\d+)/i,Io=/\bmso-list:[^;]*\blevel(\d+)/i,Ro=t=>{var e,n;const r=Array.from(t.querySelectorAll("[style*=mso-list]")),i=[],s=[];r.forEach(t=>{(t.getAttribute("style")||"").match(To)?i.push(t):s.push(t)}),i.forEach(t=>{var e;return null==(e=t.parentNode)?void 0:e.removeChild(t)});const o=t.documentElement.innerHTML,l=s.map(t=>((t,e)=>{const n=t.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=e.match(l);return{id:i,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:t}})(t,o)).filter(t=>t);for(;l.length;){const t=[];let r=l.shift();for(;r;)t.push(r),r=l.length&&(null==(e=l[0])?void 0:e.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const i=document.createElement("ul");t.forEach(t=>{const e=document.createElement("li");e.setAttribute("data-list",t.type),t.indent>1&&e.setAttribute("class","ql-indent-"+(t.indent-1)),e.innerHTML=t.element.innerHTML,i.appendChild(e)});const s=null==(n=t[0])?void 0:n.element,{parentNode:o}=s??{};s&&(null==o||o.replaceChild(i,s)),t.slice(1).forEach(t=>{let{element:e}=t;null==o||o.removeChild(e)})}};const Mo=[function(t){"urn:schemas-microsoft-com:office:word"===t.documentElement.getAttribute("xmlns:w")&&Ro(t)},function(t){t.querySelector('[id^="docs-internal-guid-"]')&&((t=>{Array.from(t.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return null==(e=t.getAttribute("style"))?void 0:e.match(_o)}).forEach(e=>{var n;const r=t.createDocumentFragment();r.append(...e.childNodes),null==(n=e.parentNode)||n.replaceChild(r,e)})})(t),(t=>{Array.from(t.querySelectorAll("br")).filter(t=>Oo(t.previousElementSibling)&&Oo(t.nextElementSibling)).forEach(t=>{var e;null==(e=t.parentNode)||e.removeChild(t)})})(t))}],Bo=hs("quill:clipboard"),Do=[[Node.TEXT_NODE,function(t,e,n){var r;let i=t.data;if("O:P"===(null==(r=t.parentElement)?void 0:r.tagName))return e.insert(i.trim());if(!Ko(t)){if(0===i.trim().length&&i.includes("\n")&&!function(t,e){return t.previousElementSibling&&t.nextElementSibling&&!Vo(t.previousElementSibling,e)&&!Vo(t.nextElementSibling,e)}(t,n))return e;i=i.replace(/[^\S\u00a0]/g," "),i=i.replace(/ {2,}/g," "),(null==t.previousSibling&&null!=t.parentElement&&Vo(t.parentElement,n)||t.previousSibling instanceof Element&&Vo(t.previousSibling,n))&&(i=i.replace(/^ /,"")),(null==t.nextSibling&&null!=t.parentElement&&Vo(t.parentElement,n)||t.nextSibling instanceof Element&&Vo(t.nextSibling,n))&&(i=i.replace(/ $/,"")),i=i.replaceAll(" "," ")}return e.insert(i)}],[Node.TEXT_NODE,Go],["br",function(t,e){$o(e,"\n")||e.insert("\n");return e}],[Node.ELEMENT_NODE,Go],[Node.ELEMENT_NODE,function(t,e,n){const r=n.query(t);if(null==r)return e;if(r.prototype instanceof vi){const e={},i=r.value(t);if(null!=i)return e[r.blotName]=i,(new Vi).insert(e,r.formats(t,n))}else if(r.prototype instanceof mi&&!$o(e,"\n")&&e.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return zo(e,r.blotName,r.formats(t,n),n);return e}],[Node.ELEMENT_NODE,function(t,e,n){const r=Gr.keys(t),i=ti.keys(t),s=ni.keys(t),o={};return r.concat(i).concat(s).forEach(e=>{let r=n.query(e,Zr.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(t),o[r.attrName])||(r=Po[e],null==r||r.attrName!==e&&r.keyName!==e||(o[r.attrName]=r.value(t)||void 0),r=Uo[e],null==r||r.attrName!==e&&r.keyName!==e||(r=Uo[e],o[r.attrName]=r.value(t)||void 0))}),Object.entries(o).reduce((t,e)=>{let[r,i]=e;return zo(t,r,i,n)},e)}],[Node.ELEMENT_NODE,function(t,e,n){var r;const i={},s=t.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(e=Object.entries(i).reduce((t,e)=>{let[r,i]=e;return zo(t,r,i,n)},e),parseFloat(s.textIndent||0)>0)return(new Vi).insert("\t").concat(e);return e}],["li",function(t,e,n){const r=n.query(t);if(null==r||"list"!==r.blotName||!$o(e,"\n"))return e;let i=-1,s=t.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?e:e.reduce((t,e)=>e.insert?e.attributes&&"number"==typeof e.attributes.indent?t.push(e):t.insert(e.insert,{indent:i,...e.attributes||{}}):t,new Vi)}],["ol, ul",function(t,e,n){const r=t;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");s&&(i="true"===s?"checked":"unchecked");return zo(e,"list",i,n)}],["pre",function(t,e,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(t,n);return zo(e,"code-block",i,n)}],["tr",function(t,e,n){var r,i;const s="TABLE"===(null==(r=t.parentElement)?void 0:r.tagName)?t.parentElement:null==(i=t.parentElement)?void 0:i.parentElement;if(null!=s){return zo(e,"table",Array.from(s.querySelectorAll("tr")).indexOf(t)+1,n)}return e}],["b",Zo("bold")],["i",Zo("italic")],["strike",Zo("strike")],["style",function(){return new Vi}]],Po=[Qs,ho].reduce((t,e)=>(t[e.keyName]=e,t),{}),Uo=[eo,oo,io,po,bo,yo].reduce((t,e)=>(t[e.keyName]=e,t),{});class Fo extends Ss{constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",t=>this.onCaptureCopy(t,!1)),this.quill.root.addEventListener("cut",t=>this.onCaptureCopy(t,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Do.concat(this.options.matchers??[]).forEach(t=>{let[e,n]=t;this.addMatcher(e,n)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:n}=t,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(!e)return(new Vi).insert(n||"",r);const i=this.convertHTML(e);return $o(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new Vi).retain(i.length()-1).delete(1)):i}normalizeHTML(t){(t=>{t.documentElement&&Mo.forEach(e=>{e(t)})})(t)}convertHTML(t){const e=(new DOMParser).parseFromString(t,"text/html");this.normalizeHTML(e);const n=e.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return Wo(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Us.sources.API;if("string"==typeof t){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,Us.sources.SILENT)}else{const r=this.convert({html:e,text:""});this.quill.updateContents((new Vi).retain(t).concat(r),n),this.quill.setSelection(t+r.length(),Us.sources.SILENT)}}onCaptureCopy(t){var e,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.defaultPrevented)return;t.preventDefault();const[i]=this.quill.selection.getRange();if(null==i)return;const{html:s,text:o}=this.onCopy(i,r);null==(e=t.clipboardData)||e.setData("text/plain",o),null==(n=t.clipboardData)||n.setData("text/html",s),r&&jo({range:i,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(t=>"#"!==t[0]).join("\n")}onCapturePaste(t){var e,n,r,i,s;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(e=t.clipboardData)?void 0:e.getData("text/html");let a=null==(n=t.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const e=null==(r=t.clipboardData)?void 0:r.getData("text/uri-list");e&&(a=this.normalizeURIList(e))}const c=Array.from((null==(i=t.clipboardData)?void 0:i.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const t=(new DOMParser).parseFromString(l,"text/html");if(1===t.body.childElementCount&&"IMG"===(null==(s=t.body.firstElementChild)?void 0:s.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:n,html:r}=e;const i=this.quill.getFormat(t.index),s=this.convert({text:n,html:r},i);Bo.log("onPaste",s,{text:n,html:r});const o=(new Vi).retain(t.index).delete(t.length).concat(s);this.quill.updateContents(o,Us.sources.USER),this.quill.setSelection(o.length()-t.length,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){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(t.querySelectorAll(s)).forEach(t=>{if(e.has(t)){const n=e.get(t);null==n||n.push(o)}else e.set(t,[o])})}}),[n,r]}}function zo(t,e,n,r){return r.query(e)?t.reduce((t,r)=>{if(!r.insert)return t;if(r.attributes&&r.attributes[e])return t.push(r);const i=n?{[e]:n}:{};return t.insert(r.insert,{...i,...r.attributes})},new Vi):t}function $o(t,e){let n="";for(let r=t.ops.length-1;r>=0&&n.length<e.length;--r){const e=t.ops[r];if("string"!=typeof e.insert)break;n=e.insert+n}return n.slice(-1*e.length)===e}function Vo(t,e){if(!(t instanceof Element))return!1;const n=e.query(t);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(t.tagName.toLowerCase())}e(Fo,"DEFAULTS",{matchers:[]});const Ho=new WeakMap;function Ko(t){return null!=t&&(Ho.has(t)||("PRE"===t.tagName?Ho.set(t,!0):Ho.set(t,Ko(t.parentNode))),Ho.get(t))}function Wo(t,e,n,r,i){return e.nodeType===e.TEXT_NODE?r.reduce((n,r)=>r(e,n,t),new Vi):e.nodeType===e.ELEMENT_NODE?Array.from(e.childNodes||[]).reduce((s,o)=>{let l=Wo(t,o,n,r,i);return o.nodeType===e.ELEMENT_NODE&&(l=n.reduce((e,n)=>n(o,e,t),l),l=(i.get(o)||[]).reduce((e,n)=>n(o,e,t),l)),s.concat(l)},new Vi):new Vi}function Zo(t){return(e,n,r)=>zo(n,t,!0,r)}function Go(t,e,n){if(!$o(e,"\n")){if(Vo(t,n)&&(t.childNodes.length>0||t instanceof HTMLParagraphElement))return e.insert("\n");if(e.length()>0&&t.nextSibling){let r=t.nextSibling;for(;null!=r;){if(Vo(r,n))return e.insert("\n");const t=n.query(r);if(t&&t.prototype instanceof Xi)return e.insert("\n");r=r.firstChild}}}return e}class Yo extends Ss{constructor(t,n){super(t,n),e(this,"lastRecorded",0),e(this,"ignoreChange",!1),e(this,"stack",{undo:[],redo:[]}),e(this,"currentRange",null),this.quill.on(Us.events.EDITOR_CHANGE,(t,e,n,r)=>{t===Us.events.SELECTION_CHANGE?e&&r!==Us.sources.SILENT&&(this.currentRange=e):t===Us.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Us.sources.USER?this.transform(e):this.record(e,n)),this.currentRange=Xo(this.currentRange,e))}),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",t=>{"historyUndo"===t.inputType?(this.undo(),t.preventDefault()):"historyRedo"===t.inputType&&(this.redo(),t.preventDefault())})}change(t,e){if(0===this.stack[t].length)return;const n=this.stack[t].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[e].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(t,e){if(0===t.ops.length)return;this.stack.redo=[];let n=t.invert(e),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const t=this.stack.undo.pop();t&&(n=n.compose(t.delta),r=t.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(t){Jo(this.stack.undo,t),Jo(this.stack.redo,t)}undo(){this.change("undo","redo")}restoreSelection(t){if(t.range)this.quill.setSelection(t.range,Us.sources.USER);else{const e=function(t,e){const n=e.reduce((t,e)=>t+(e.delete||0),0);let r=e.length()-n;(function(t,e){const n=e.ops[e.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(e=>null!=t.query(e,Zr.BLOCK));return!1})(t,e)&&(r-=1);return r}(this.quill.scroll,t.delta);this.quill.setSelection(e,Us.sources.USER)}}}function Jo(t,e){let n=e;for(let r=t.length-1;r>=0;r-=1){const e=t[r];t[r]={delta:n.transform(e.delta,!0),range:e.range&&Xo(e.range,n)},n=e.delta.transform(n),0===t[r].delta.length()&&t.splice(r,1)}}function Xo(t,e){if(!t)return t;const n=e.transformPosition(t.index);return{index:n,length:e.transformPosition(t.index+t.length)-n}}e(Yo,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class Qo extends Ss{constructor(t,e){super(t,e),t.root.addEventListener("drop",e=>{var n;e.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(e.clientX,e.clientY);else if(document.caretPositionFromPoint){const t=document.caretPositionFromPoint(e.clientX,e.clientY);r=document.createRange(),r.setStart(t.offsetNode,t.offset),r.setEnd(t.offsetNode,t.offset)}const i=r&&t.selection.normalizeNative(r);if(i){const r=t.selection.normalizedToRange(i);(null==(n=e.dataTransfer)?void 0:n.files)&&this.upload(r,e.dataTransfer.files)}})}upload(t,e){const n=[];Array.from(e).forEach(t=>{var e;t&&(null==(e=this.options.mimetypes)?void 0:e.includes(t.type))&&n.push(t)}),n.length>0&&this.options.handler.call(this,t,n)}}Qo.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(t,e){if(!this.quill.scroll.query("image"))return;const n=e.map(t=>new Promise(e=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.readAsDataURL(t)}));Promise.all(n).then(e=>{const n=e.reduce((t,e)=>t.insert({image:e}),(new Vi).retain(t.index).delete(t.length));this.quill.updateContents(n,fs.sources.USER),this.quill.setSelection(t.index+e.length,fs.sources.SILENT)})}};const tl=["insertText","insertReplacementText"];const el=/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(t,e){super(t,e),t.root.addEventListener("beforeinput",t=>{this.handleBeforeInput(t)}),/Android/i.test(navigator.userAgent)||t.on(Us.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){jo({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===t.length)return!1;if(e){const n=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents((new Vi).retain(t.index).insert(e,n),Us.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,Us.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!tl.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||!0===e.collapsed)return;const n=function(t){var e;if("string"==typeof t.data)return t.data;if(null==(e=t.dataTransfer)?void 0:e.types.includes("text/plain"))return t.dataTransfer.getData("text/plain");return null}(t);if(null==n)return;const r=this.quill.selection.normalizeNative(e),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}},"modules/uiNode":class extends Ss{constructor(t,n){super(t,n),e(this,"isListening",!1),e(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(t,e){let{line:n,event:r}=e;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(t.index-1,t.length+(r.shiftKey?1:0),Us.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",t=>{!t.defaultPrevented&&(t=>"ArrowLeft"===t.key||"ArrowRight"===t.key||"ArrowUp"===t.key||"ArrowDown"===t.key||"Home"===t.key||!(!el||"a"!==t.key||!0!==t.ctrlKey))(t)&&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 t=document.getSelection();if(!t)return;const e=t.getRangeAt(0);if(!0!==e.collapsed||0!==e.startOffset)return;const n=this.quill.scroll.find(e.startContainer);if(!(n instanceof hi&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),t.removeAllRanges(),t.addRange(r)}}});const nl=new class extends ti{add(t,e){let n=0;if("+1"===e||"-1"===e){const r=this.value(t)||0;n="+1"===e?r+1:r-1}else"number"==typeof e&&(n=e);return 0===n?(this.remove(t),!0):super.add(t,n.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}("indent","ql-indent",{scope:Zr.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class rl extends Ji{}e(rl,"blotName","blockquote"),e(rl,"tagName","blockquote");class il extends Ji{static formats(t){return this.tagName.indexOf(t.tagName)+1}}e(il,"blotName","header"),e(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(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){Us.register(sl)}constructor(t,e){super(t,e);const n=e.ownerDocument.createElement("span"),r=n=>{if(!t.isEnabled())return;const r=this.statics.formats(e,t);"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(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}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(t){super.optimize(t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}e(ll,"blotName","bold"),e(ll,"tagName",["STRONG","B"]);class al extends ll{}e(al,"blotName","italic"),e(al,"tagName",["EM","I"]);class cl extends Yi{static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return ul(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("href",this.constructor.sanitize(e)):super.format(t,e)}}function ul(t,e){const n=document.createElement("a");n.href=t;const r=n.href.slice(0,n.href.indexOf(":"));return e.indexOf(r)>-1}e(cl,"blotName","link"),e(cl,"tagName","A"),e(cl,"SANITIZED_URL","about:blank"),e(cl,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class hl extends Yi{static create(t){return"super"===t?document.createElement("sup"):"sub"===t?document.createElement("sub"):super.create(t)}static formats(t){return"SUB"===t.tagName?"sub":"SUP"===t.tagName?"super":void 0}}e(hl,"blotName","script"),e(hl,"tagName",["SUB","SUP"]);class dl extends ll{}e(dl,"blotName","strike"),e(dl,"tagName",["S","STRIKE"]);class fl extends Yi{}e(fl,"blotName","underline"),e(fl,"tagName","U");class pl extends js{static create(t){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return"string"==typeof t&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`<span>${t}</span>`}}e(pl,"blotName","formula"),e(pl,"className","ql-formula"),e(pl,"tagName","SPAN");const ml=["alt","height","width"];class gl extends vi{static create(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return ml.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return ul(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){ml.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}e(gl,"blotName","image"),e(gl,"tagName","IMG");const bl=["height","width"];class vl extends Xi{static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return bl.reduce((e,n)=>(t.hasAttribute(n)&&(e[n]=t.getAttribute(n)),e),{})}static sanitize(t){return cl.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){bl.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`<a href="${t}">${t}</a>`}}e(vl,"blotName","video"),e(vl,"className","ql-video"),e(vl,"tagName","IFRAME");const yl=new ti("code-token","hljs",{scope:Zr.INLINE});class xl extends Yi{static formats(t,e){for(;null!=t&&t!==e.domNode;){if(t.classList&&t.classList.contains(ao.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,n){super(t,e,n),yl.add(this.domNode,n)}format(t,e){t!==xl.blotName?super.format(t,e):e?yl.add(this.domNode,e):(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(t){const e=super.create(t);return"string"==typeof t&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),xl.blotName,!1),super.replaceWith(t,e)}}class Nl extends lo{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===wl.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(t,e)}))}formatAt(t,e,n,r){n===wl.blotName&&(this.forceNext=!0),super.formatAt(t,e,n,r)}highlight(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).map(t=>t.textContent).join("\n")}\n`,r=wl.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const e=this.children.reduce((t,e)=>t.concat(Qi(e,!1)),new Vi),i=t(n,r);e.diff(i).reduce((t,e)=>{let{retain:n,attributes:r}=e;return n?(r&&Object.keys(r).forEach(e=>{[wl.blotName,xl.blotName].includes(e)&&this.formatAt(t,n,e,r[e])}),t+n):t},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[n]=this.children.find(t);return`<pre data-language="${n?wl.formats(n.domNode):"plain"}">\n${Zi(this.code(t,e))}\n</pre>`}optimize(t){if(super.optimize(t),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const t=wl.formats(this.children.head.domNode);t!==this.uiNode.value&&(this.uiNode.value=t)}}}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(t,e){if(super(t,e),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((t,e)=>{let{key:n}=e;return t[n]=!0,t},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Us.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof Nl))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(t=>{let{key:n,label:r}=t;const i=e.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),e.appendChild(i)}),e.addEventListener("change",()=>{t.format(wl.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),null==t.uiNode&&(t.attachUI(e),t.children.head&&(e.value=wl.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(Us.events.SCROLL_OPTIMIZE,()=>{t&&clearTimeout(t),t=setTimeout(()=>{this.highlight(),t=null},this.options.interval)})}highlight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=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==t?this.quill.scroll.descendants(Nl):[t]).forEach(t=>{t.highlight(this.highlightBlot,e)}),this.quill.update(Us.sources.SILENT),null!=n&&this.quill.setSelection(n,Us.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(e=this.languages[e]?e:"plain","plain"===e)return Zi(t).split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[ao.blotName]:e}),t.insert(n)),new Vi);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(ao.className),n.innerHTML=((t,e,n)=>{if("string"==typeof t.versionString){const r=t.versionString.split(".")[0];if(parseInt(r,10)>=11)return t.highlight(n,{language:e}).value}return t.highlight(e,n).value})(this.options.hljs,e,t),Wo(this.quill.scroll,n,[(t,e)=>{const n=yl.value(t);return n?e.compose((new Vi).retain(e.length(),{[xl.blotName]:n})):e}],[(t,n)=>t.data.split("\n").reduce((t,n,r)=>(0!==r&&t.insert("\n",{[ao.blotName]:e}),t.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 kl=class t extends Ji{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",_l()),e}static formats(t){if(t.hasAttribute("data-row"))return t.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(e,n){e===t.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(e,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};e(kl,"blotName","table"),e(kl,"tagName","TD");let Al=kl;class Sl extends Ws{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const t=this.children.head.formats(),e=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return t.table===e.table&&t.table===n.table&&t.table===r.table}return!1}optimize(t){super.optimize(t),this.children.forEach(t=>{if(null==t.next)return;const e=t.formats(),n=t.next.formats();if(e.table!==n.table){const e=this.splitAfter(t);e&&e.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}e(Sl,"blotName","table-row"),e(Sl,"tagName","TR");class Cl extends Ws{}e(Cl,"blotName","table-body"),e(Cl,"tagName","TBODY");class jl extends Ws{balanceCells(){const t=this.descendants(Sl),e=t.reduce((t,e)=>Math.max(e.children.length,t),0);t.forEach(t=>{new Array(e-t.children.length).fill(0).forEach(()=>{let e;null!=t.children.head&&(e=Al.formats(t.children.head.domNode));const n=this.scroll.create(Al.blotName,e);t.appendChild(n),n.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(Cl);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t);null!=n&&n.remove()})}insertColumn(t){const[e]=this.descendant(Cl);null!=e&&null!=e.children.head&&e.children.forEach(e=>{const n=e.children.at(t),r=Al.formats(e.children.head.domNode),i=this.scroll.create(Al.blotName,r);e.insertBefore(i,n)})}insertRow(t){const[e]=this.descendant(Cl);if(null==e||null==e.children.head)return;const n=_l(),r=this.scroll.create(Sl.blotName);e.children.head.children.forEach(()=>{const t=this.scroll.create(Al.blotName,n);r.appendChild(t)});const i=e.children.at(t);e.insertBefore(r,i)}rows(){const t=this.children.head;return null==t?[]:t.children.map(t=>t)}}function _l(){return`row-${Math.random().toString(36).slice(2,6)}`}e(jl,"blotName","table-container"),e(jl,"tagName","TABLE"),jl.allowedChildren=[Cl],Cl.requiredContainer=jl,Cl.allowedChildren=[Sl],Sl.requiredContainer=Cl,Sl.allowedChildren=[Al],Al.requiredContainer=Sl;const ql=hs("quill:toolbar");class Ol extends Ss{constructor(t,e){var n,r;if(super(t,e),Array.isArray(this.options.container)){const e=document.createElement("div");e.setAttribute("role","toolbar"),function(t,e){Array.isArray(e[0])||(e=[e]);e.forEach(e=>{const n=document.createElement("span");n.classList.add("ql-formats"),e.forEach(t=>{if("string"==typeof t)Tl(n,t);else{const e=Object.keys(t)[0],r=t[e];Array.isArray(r)?function(t,e,n){const r=document.createElement("select");r.classList.add(`ql-${e}`),n.forEach(t=>{const e=document.createElement("option");!1!==t?e.setAttribute("value",String(t)):e.setAttribute("selected","selected"),r.appendChild(e)}),t.appendChild(r)}(n,e,r):Tl(n,e,r)}}),t.appendChild(n)})}(e,this.options.container),null==(r=null==(n=t.container)?void 0:n.parentNode)||r.insertBefore(e,t.container),this.container=e}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(t=>{var e;const n=null==(e=this.options.handlers)?void 0:e[t];n&&this.addHandler(t,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(t=>{this.attach(t)}),this.quill.on(Us.events.EDITOR_CHANGE,()=>{const[t]=this.quill.selection.getRange();this.update(t)})):ql.error("Container required for toolbar",this.options)}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(t=>0===t.indexOf("ql-"));if(!e)return;if(e=e.slice(3),"BUTTON"===t.tagName&&t.setAttribute("type","button"),null==this.handlers[e]&&null==this.quill.scroll.query(e))return void ql.warn("ignoring attaching to nonexistent format",e,t);const n="SELECT"===t.tagName?"change":"click";t.addEventListener(n,n=>{let r;if("SELECT"===t.tagName){if(t.selectedIndex<0)return;const e=t.options[t.selectedIndex];r=!e.hasAttribute("selected")&&(e.value||!1)}else r=!t.classList.contains("ql-active")&&(t.value||!t.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[e])this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof vi){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents((new Vi).retain(i.index).delete(i.length).insert({[e]:r}),Us.sources.USER)}else this.quill.format(e,r,Us.sources.USER);this.update(i)}),this.controls.push([e,t])}update(t){const e=null==t?{}:this.quill.getFormat(t);this.controls.forEach(n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==t)n=null;else if(null==e[r])n=i.querySelector("option[selected]");else if(!Array.isArray(e[r])){let t=e[r];"string"==typeof t&&(t=t.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${t}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==t)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const t=e[r],n=t===i.getAttribute("value")||null!=t&&t.toString()===i.getAttribute("value")||null==t&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const t=null!=e[r];i.classList.toggle("ql-active",t),i.setAttribute("aria-pressed",t.toString())}})}}function Tl(t,e,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${e}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${e}: ${n}`)):r.setAttribute("aria-label",e),t.appendChild(r)}Ol.DEFAULTS={},Ol.DEFAULTS={container:null,handlers:{clean(){const t=this.quill.getSelection();if(null!=t)if(0===t.length){const t=this.quill.getFormat();Object.keys(t).forEach(t=>{null!=this.quill.scroll.query(t,Zr.INLINE)&&this.quill.format(t,!1,Us.sources.USER)})}else this.quill.removeFormat(t.index,t.length,Us.sources.USER)},direction(t){const{align:e}=this.quill.getFormat();"rtl"===t&&null==e?this.quill.format("align","right",Us.sources.USER):t||"right"!==e||this.quill.format("align",!1,Us.sources.USER),this.quill.format("direction",t,Us.sources.USER)},indent(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e),r=parseInt(n.indent||0,10);if("+1"===t||"-1"===t){let e="+1"===t?1:-1;"rtl"===n.direction&&(e*=-1),this.quill.format("indent",r+e,Us.sources.USER)}},link(t){!0===t&&(t=prompt("Enter link URL:")),this.quill.format("link",t,Us.sources.USER)},list(t){const e=this.quill.getSelection(),n=this.quill.getFormat(e);"check"===t?"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",t,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(t,e){t.setAttribute(e,`${!("true"===t.getAttribute(e))}`)}class Bl{constructor(t){this.select=t,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",t=>{switch(t.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),t.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(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const n=t.getAttribute("value");return n&&e.setAttribute("data-value",n),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",()=>{this.selectItem(e,!0)}),e.addEventListener("keydown",t=>{switch(t.key){case"Enter":this.selectItem(e,!0),t.preventDefault();break;case"Escape":this.escape(),t.preventDefault()}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.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>',t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${Rl}`,Rl+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const n=this.buildItem(e);t.appendChild(n),!0===e.selected&&this.selectItem(n)}),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach(t=>{this.container.setAttribute(t.name,t.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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");t!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=t&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const e=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(e)}else this.selectItem(null);const e=null!=t&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class Dl extends Bl{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(t=>{t.classList.add("ql-primary")})}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const n=this.label.querySelector(".ql-color-label"),r=t&&t.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Pl extends Bl{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(t=>{t.innerHTML=e[t.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const n=t||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Ul{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(t=>{const{overflowY:e}=getComputedStyle(t,null);return"visible"!==e&&"clip"!==e})(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(t){const e=t.left+t.width/2-this.root.offsetWidth/2,n=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}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=`${e+s}px`),i.left<r.left&&(s=r.left-i.left,this.root.style.left=`${e+s}px`),i.bottom>r.bottom){const e=i.bottom-i.top,r=t.bottom-t.top+e;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"],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"],$l=[!1,"serif","monospace"],Vl=["1","2","3",!1],Hl=["small",!1,"large","huge"];class Kl extends Os{constructor(t,e){super(t,e);const n=e=>{document.body.contains(t.root)?(null==this.tooltip||this.tooltip.root.contains(e.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(t=>{t.container.contains(e.target)||t.close()})):document.body.removeEventListener("click",n)};t.emitter.listenDOM("click",document.body,n)}addModule(t){const e=super.addModule(t);return"toolbar"===t&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(t=>{(t.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=e[n]))if("direction"===n)t.innerHTML=e[n][""]+e[n].rtl;else if("string"==typeof e[n])t.innerHTML=e[n];else{const r=t.value||"";null!=r&&e[n][r]&&(t.innerHTML=e[n][r])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(t=>{if(t.classList.contains("ql-align")&&(null==t.querySelector("option")&&Zl(t,Fl),"object"==typeof e.align))return new Pl(t,e.align);if(t.classList.contains("ql-background")||t.classList.contains("ql-color")){const n=t.classList.contains("ql-background")?"background":"color";return null==t.querySelector("option")&&Zl(t,zl,"background"===n?"#ffffff":"#000000"),new Dl(t,e[n])}return null==t.querySelector("option")&&(t.classList.contains("ql-font")?Zl(t,$l):t.classList.contains("ql-header")?Zl(t,Vl):t.classList.contains("ql-size")&&Zl(t,Hl)),new Bl(t)});this.quill.on(fs.events.EDITOR_CHANGE,()=>{this.pickers.forEach(t=>{t.update()})})}}Kl.DEFAULTS=Wr({},Os.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let t=this.container.querySelector("input.ql-image[type=file]");null==t&&(t=document.createElement("input"),t.setAttribute("type","file"),t.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),t.classList.add("ql-image"),t.addEventListener("change",()=>{const e=this.quill.getSelection(!0);this.quill.uploader.upload(e,t.files),t.value=""}),this.container.appendChild(t)),t.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Wl extends Ul{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",t=>{"Enter"===t.key?(this.save(),t.preventDefault()):"Escape"===t.key&&(this.cancel(),t.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",e=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!=e?this.textbox.value=e:t!==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-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,fs.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,fs.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=function(t){let e=t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||t.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(e)return`${e[1]||"https"}://www.youtube.com/embed/${e[2]}?showinfo=0`;if(e=t.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${e[1]||"https"}://player.vimeo.com/video/${e[2]}/`;return t}(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(null!=e){const n=e.index+e.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),t,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(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.forEach(e=>{const r=document.createElement("option");e===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(e)),t.appendChild(r)})}const Gl=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Yl extends Wl{constructor(t,e){super(t,e),this.quill.on(fs.events.EDITOR_CHANGE,(t,e,n,r)=>{if(t===fs.events.SELECTION_CHANGE)if(null!=e&&e.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 t=this.quill.getLines(e.index,e.length);if(1===t.length){const t=this.quill.getBounds(e);null!=t&&this.position(t)}else{const n=t[t.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,e.index+e.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 t=this.quill.getSelection();if(null!=t){const e=this.quill.getBounds(t);null!=e&&this.position(e)}},1)})}cancel(){this.show()}position(t){const e=super.position(t),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==e&&(n.style.marginLeft=-1*e-n.offsetWidth/2+"px"),e}}e(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(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Gl),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new Yl(this.quill,this.options.bounds),null!=t.container&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),Il),this.buildPickers(t.container.querySelectorAll("select"),Il))}}Jl.DEFAULTS=Wr({},Kl.DEFAULTS,{modules:{toolbar:{handlers:{link(t){t?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),e(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",t=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",t=>{if(null!=this.linkRange){const t=this.linkRange;this.restoreFocus(),this.quill.formatText(t,"link",!1,fs.sources.USER),delete this.linkRange}t.preventDefault(),this.hide()}),this.quill.on(fs.events.SELECTION_CHANGE,(t,e,n)=>{if(null!=t){if(0===t.length&&n===fs.sources.USER){const[e,n]=this.quill.scroll.descendant(cl,t.index);if(null!=e){this.linkRange=new ms(t.index-n,e.length());const r=cl.formats(e.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")}}e(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 ta extends Kl{constructor(t,e){null!=e.modules.toolbar&&null==e.modules.toolbar.container&&(e.modules.toolbar.container=Xl),super(t,e),this.quill.container.classList.add("ql-snow")}extendToolbar(t){null!=t.container&&(t.container.classList.add("ql-snow"),this.buildButtons(t.container.querySelectorAll("button"),Il),this.buildPickers(t.container.querySelectorAll("select"),Il),this.tooltip=new Ql(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,n)=>{t.handlers.link.call(t,!n.format.link)}))}}ta.DEFAULTS=Wr({},Kl.DEFAULTS,{modules:{toolbar:{handlers:{link(t){if(t){const t=this.quill.getSelection();if(null==t||0===t.length)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&0!==e.indexOf("mailto:")&&(e=`mailto:${e}`);const{tooltip:n}=this.quill.theme;n.edit("link",e)}else this.quill.format("link",!1,Us.sources.USER)}}}}}),Us.register({"attributors/attribute/direction":ho,"attributors/class/align":to,"attributors/class/background":so,"attributors/class/color":ro,"attributors/class/direction":fo,"attributors/class/font":go,"attributors/class/size":vo,"attributors/style/align":eo,"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":to,"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(Al),Us.register(Sl),Us.register(Cl),Us.register(jl)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(jl).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();null!=e&&(t.deleteColumn(e.cellOffset()),this.quill.update(Us.sources.USER))}deleteRow(){const[,t]=this.getTable();null!=t&&(t.remove(),this.quill.update(Us.sources.USER))}deleteTable(){const[t]=this.getTable();if(null==t)return;const e=t.offset();t.remove(),this.quill.update(Us.sources.USER),this.quill.setSelection(e,Us.sources.SILENT)}getTable(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==t)return[null,null,null,-1];const[e,n]=this.quill.getLine(t.index);if(null==e||e.statics.blotName!==Al.blotName)return[null,null,null,-1];const r=e.parent;return[r.parent.parent,r,e,n]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[n,r,i]=this.getTable(e);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+t),this.quill.update(Us.sources.USER);let o=r.rowOffset();0===t&&(o+=1),this.quill.setSelection(e.index+o,e.length,Us.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[n,r,i]=this.getTable(e);if(null==i)return;const s=r.rowOffset();n.insertRow(s+t),this.quill.update(Us.sources.USER),t>0?this.quill.setSelection(e,Us.sources.SILENT):this.quill.setSelection(e.index+r.children.length,e.length,Us.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const n=this.quill.getSelection();if(null==n)return;const r=new Array(t).fill(0).reduce(t=>{const n=new Array(e).fill("\n").join("");return t.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,t=>{t.some(t=>!!["TD","TR","TBODY","TABLE"].includes(t.target.tagName)&&(this.quill.once(Us.events.TEXT_CHANGE,(t,e,n)=>{n===Us.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":Ol,"themes/bubble":Jl,"themes/snow":ta,"ui/icons":Il,"ui/picker":Bl,"ui/icon-picker":Pl,"ui/color-picker":Dl,"ui/tooltip":Ul},!0);const ea=({value:t,onChange:e,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 t=l.current;t.on("text-change",(n,r,i)=>{if("user"===i){const n=t.root.innerHTML;null==e||e("<p><br></p>"===n?"":n)}})}},[i]),r.useEffect(()=>{const e=l.current;if(e&&t!==e.root.innerHTML){const n=0===e.getText().trim().length;!t&&n||e.clipboard.dangerouslyPasteHTML(t||"")}},[t]),n.jsx("div",{ref:o,style:{minHeight:"200px",...s}})},na="_fileUploadWrapper_byo9w_1",ra=({value:t,onChange:e,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([]),[k,A]=r.useState(!1),S=t=>{try{const n=t.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(e){}return r||"未知文件"}catch(n){return"未知文件"}},C=t=>t?Array.isArray(t)?t.filter(Boolean):"string"==typeof t?t.split(",").map(t=>t.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const e=C(t);return JSON.stringify(e)},[t]),_=r.useRef(N);r.useEffect(()=>{_.current=N},[N]),r.useEffect(()=>{if(k)return void A(!1);const e=C(t),n=_.current.filter(t=>"done"===t.status).map(t=>t.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(e))if(e.length>0){const t=e.map((t,e)=>({uid:`-${e+1}`,name:S(t),status:"done",url:t}));E(t)}else E([])},[j,k]);const q=r.useCallback(t=>{e&&e(t)},[e]);return n.jsxs("div",{className:na,children:[n.jsx(i.Upload,{accept:o,listType:l,fileList:N,onPreview:async t=>{const e=t.url||t.preview,n=t.name||"",r=(t=>{const e=t.substring(t.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(e)?"image":[".txt",".json",".xml",".log"].includes(e)?"text":"none"})(n);y(n),w(r),"image"===r?(t.url||t.preview||!t.originFileObj||(t.preview=await(t=>new Promise((e,n)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(r.result),r.onerror=t=>n(t)}))(t.originFileObj)),b(t.url||t.preview),m(!0)):e?window.open(e,"_blank"):i.message.info("文件预览不可用")},onChange:({file:t,fileList:e})=>{var n,r;if(A(!0),"done"===t.status){if(null==(n=t.response)?void 0:n.data){i.message.success(`${t.name} 文件上传成功`);const n=e.map(e=>{var n;return e.uid===t.uid&&(null==(n=e.response)?void 0:n.data)?{...e,url:e.response.data,name:e.name}:e});E(n);const r=n.filter(t=>"done"===t.status).map(t=>{var e;return(null==(e=t.response)?void 0:e.data)||t.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(`${t.name} 文件上传成功,但未获取到 URL。`),E(e.filter(e=>e.uid!==t.uid))}else if("removed"===t.status){i.message.success(`${t.name} 文件已移除`),E(e);const n=e.filter(t=>"done"===t.status).map(t=>{var e;return(null==(e=t.response)?void 0:e.data)||t.url}).filter(Boolean);1===a?null==q||q(void 0):null==q||q(n.length>0?n:void 0)}else if("error"===t.status){i.message.error(`${t.name} 文件上传失败: ${(null==(r=t.error)?void 0:r.message)||"未知错误"}`),E(e);const n=e.filter(t=>"done"===t.status).map(t=>{var e;return(null==(e=t.response)?void 0:e.data)||t.url}).filter(Boolean);1===a?null==q||q(n[0]||void 0):null==q||q(n.length>0?n:void 0)}else E(e)},customRequest:async t=>{var e;const{onSuccess:n,onError:r,file:o,onProgress:l}=t,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==(e=null==p?void 0:p.getOrgInfo())?void 0:e.orgId;u&&c.append("orgId",u.toString());try{const t=await(async(t,e)=>{const n=p.getToken();try{return(await s.post("/api/sterilization-service/common/uploadFile",t,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==e?void 0:e.headers},onUploadProgress:null==e?void 0:e.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t=>{t.total&&l({percent:t.loaded/t.total*100})}});t&&t.data?n(t,o):r(new Error("上传成功但响应中缺少文件URL"),t)}catch(d){r(d)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:t=>!0,children:N.length>=(a||1)?null:n.jsx(i.Button,{icon:n.jsx(Ht,{}),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",{TextArea:la}=i.Input,aa=r.forwardRef((t,e)=>{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}=t,[E]=i.Form.useForm(),k="view"==u;r.useImperativeHandle(e,()=>({setFieldsValue:t=>{E.setFieldsValue(t)},getFieldsValue:()=>E.getFieldsValue()})),r.useEffect(()=>{if(c)if(E.resetFields(),"edit"!==u&&"view"!==u||!d){const t=[];w?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})})}):h.forEach(e=>{t.push({...e,defaultValue:e.defaultValue||e.defaultValue})}),(null==t?void 0:t.length)>0&&(null==t||t.forEach(t=>{E.setFieldsValue({[null==t?void 0:t.name]:null==t?void 0:t.defaultValue})})),L(E.getFieldValue("useOrgId")||O)}else if(w){const t={...d},e=[];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})})}),e.forEach(e=>{const n=t[e.name];if("datePicker"===e.type&&n)t[e.name]=l(n);else if("rangePicker"===e.type&&n)Array.isArray(n)&&(t[e.name]=n.map(t=>l(t)));else if("treeSelect"===e.type&&e.multiple&&n)"string"==typeof n&&(t[e.name]=n.split(","));else if("Radio"===e.type&&e.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=e.options.find(t=>t.value==n);r&&(t[e.name]=r.value)}}),E.setFieldsValue(t)}else{const t={...d};h.forEach(e=>{const n=t[e.name];if("datePicker"===e.type&&n)t[e.name]=l(n);else if("rangePicker"===e.type&&n)Array.isArray(n)&&(t[e.name]=n.map(t=>l(t)));else if("treeSelect"===e.type&&e.multiple&&n)"string"==typeof n&&(t[e.name]=n.split(","));else if("Radio"===e.type&&e.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=e.options.find(t=>t.value==n);r&&(t[e.name]=r.value)}}),E.setFieldsValue(t)}else E.resetFields()},[c,u,d,E]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!d)L(E.getFieldValue("useOrgId")||O);else if(w){const t={...d},e=[];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})})}),e.forEach(e=>{"datePicker"===e.type&&t[e.name]?t[e.name]=l(t[e.name]):"rangePicker"===e.type&&t[e.name]?Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>l(t))):"treeSelect"===e.type&&e.multiple&&t[e.name]&&"string"==typeof t[e.name]&&(t[e.name]=t[e.name].split(","))})}else{const t={...d};h.forEach(e=>{"datePicker"===e.type&&t[e.name]?t[e.name]=l(t[e.name]):"rangePicker"===e.type&&t[e.name]?Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(t=>l(t))):"treeSelect"===e.type&&e.multiple&&t[e.name]&&"string"==typeof t[e.name]&&(t[e.name]=t[e.name].split(","))})}else E.resetFields()},[h]);const A=r.useCallback(t=>{if(w){for(const e of h)if(e.children){const n=e.children.find(e=>e.name===t);if(n)return n.label}}else{const e=h.find(e=>e.name===t);if(e)return e.label}return t},[h,w]),j=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const t=N.realtimeDelay||500;return o.debounce((t,e)=>{(async(t,e)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:i="POST",validateParams:s,validateMessage:o="验证失败",union:l=!0}=N,a=e&&r.includes(e)?[e]:r,c=(null==d?void 0:d.id)||(null==d?void 0:d.ID)||null;let u;if(s)u=s(t);else{const e={};a.forEach(n=>{void 0!==t[n]&&null!==t[n]&&""!==t[n]&&(e[n]=t[n])}),u={field:a,value:e,id:c,union:l?1:0}}const h="GET"===i?await C(u,n):await S(u,n);if(200===h.code&&Array.isArray(h.data)){const t=[],e=h.data.filter(t=>!0===t.value);if(l&&e.length>1){const n=e.map(t=>A(t.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else h.data.forEach(e=>{if(!0===e.value){const n=A(e.field);t.push({name:e.field,errors:[n+"重复"]})}else E.setFields([{name:e.field,errors:[]}])});t.length>0&&E.setFields(t)}})(t,e).catch(()=>{})},t)},[N]),q=(t,e)=>{if("name"==e.name&&!(null==E?void 0:E.getFieldValue("pyCode"))){const e=(n=t.target.value,a.pinyin(n,{pattern:"first",type:"array",nonZh:"consecutive"}).join("").toUpperCase());E.setFieldsValue({pyCode:e})}var n},O=null==(s=p.getOrgInfo())?void 0:s.orgId,[T,L]=r.useState(O),I=r.useMemo(()=>h.some(t=>w&&t.children?t.children.some(t=>"deptSelect"===t.type):"deptSelect"===t.type),[h,w]),R=r.useMemo(()=>h.some(t=>w&&t.children?t.children.some(t=>"orgSelect"===t.type):"orgSelect"===t.type),[h,w]);r.useEffect(()=>{I&&U()},[T,I]),r.useEffect(()=>{R&&F()},[R]);const[M,B]=r.useState([]),[D,P]=r.useState([]),U=async()=>{const t=await S({orgId:T,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===t.code){const e=[{name:"通用",id:-1},...t.data||[]];B(e||[])}},F=async()=>{const t=await S({loginOrgId:O,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===t.code&&P((null==t?void 0:t.data)||[])},z=t=>{if("view"!==u)return;const e=E.getFieldValue(t);if(null==e||""===e)return void i.message.warning("没有内容可复制");let n="";if("object"==typeof e)if(l.isDayjs(e))n=e.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(e))n=e.map(t=>l.isDayjs(t)?t.format("YYYY-MM-DD HH:mm:ss"):String(t)).join(", ");else if(e.addProvince){const t=[e.addProvince,e.addCity,e.addCounty,e.addStreet,e.address].filter(Boolean);n=t.join("-")}else n=JSON.stringify(e);else n=String(e);navigator.clipboard.writeText(n).then(()=>{i.message.success("已复制到剪贴板")}).catch(()=>{const t=document.createElement("textarea");t.value=n,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),i.message.success("已复制到剪贴板")}catch(e){}document.body.removeChild(t)})},$=t=>{var e,r,s,o;const{type:l,name:a,placeholder:c,options:u,rules:h,...d}=t,f=k?"":c||`请输入${t.label}`,p=k?"":c||`请选择${t.label}`;switch(l){case"input":return n.jsx(i.Input,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a),onBlur:e=>q(e,t)});case"inputoption":return n.jsx(i.Input,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a),addonAfter:n.jsx(i.Form.Item,{name:t.optionname,noStyle:!0,initialValue:null==(r=null==(e=t.options)?void 0:e[0])?void 0:r.value,children:n.jsx(_,{disabled:k,options:t.options,allowClear:!k})})});case"inputnumberoption":return n.jsx(i.InputNumber,{className:sa,placeholder:f,addonAfter:n.jsx(i.Form.Item,{name:t.optionname,noStyle:!0,initialValue:null==(o=null==(s=t.options)?void 0:s[0])?void 0:o.value,children:n.jsx(_,{disabled:k,options:t.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 e=!!t.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=t=>{try{const e=(t||[]).map(t=>{var e,n;return"string"==typeof(null==t?void 0:t.label)?t.label:(null==(n=null==(e=null==t?void 0:t.label)?void 0:e.props)?void 0:n.children)??(null==t?void 0:t.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:e,children:["+",t.length,"…"]})}catch(e){return n.jsxs("span",{children:["+",(null==t?void 0:t.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:!k,style:{width:"100%"},placeholder:f,treeData:t.options,...e?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:k||d.disabled})})})}case"select":{const e=!!t.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=t=>{try{const e=(t||[]).map(t=>{var e,n;return"string"==typeof(null==t?void 0:t.label)?t.label:(null==(n=null==(e=null==t?void 0:t.label)?void 0:e.props)?void 0:n.children)??(null==t?void 0:t.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:e,children:["+",t.length,"…"]})}catch(e){return n.jsxs("span",{children:["+",(null==t?void 0:t.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:!k,style:{width:"100%"},placeholder:f,treeData:t.options,...e?{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(Gt,{value:t.value,...d},`upload_${t.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(ra,{...d})})});case"textarea":return n.jsx(la,{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(Zt,{...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(ea,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(i.Form.Item,{name:t.firstLabel||"first",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:t.firstPlaceholder||`请输入${t.firstLabel||"最小值"}`,decimalSeparator:".",parser:t=>{if(!t)return"";const e=t.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=e.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):e},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:t.separator||"至"}),n.jsx(i.Form.Item,{name:t.secondLabel||"second",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:t.secondPlaceholder||`请输入${t.secondLabel||"最大值"}`,decimalSeparator:".",parser:t=>{if(!t)return"";const e=t.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=e.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):e},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:t.lastUnit})]});case"deptSelect":return n.jsx(_,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:M,disabled:k||d.disabled,...d});case"orgSelect":return n.jsx(_,{onChange:t=>{L(t)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:D,disabled:k||d.disabled,...d});default:return n.jsx(i.Input,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a)})}},V=g||("add"===u?"新增":"edit"===u?"编辑":"查看");return n.jsx(i.Modal,{title:V,open:c,onOk:async()=>{try{const t=await E.validateFields();N&&await(async t=>{var e,n,r,i,s,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:h="验证失败",union:f=!1}=N,p=(null==d?void 0:d.id)||(null==d?void 0:d.ID)||null;if(u){const r=u(t),i="GET"===c?await C(r,l):await S(r,l);if(200!==i.code){const t=i.msg||h;throw new Error(t)}if(Array.isArray(i.data)){const t=i.data.filter(t=>!0===t.value);if(t.length>0){const e=t.map(t=>({name:t.field,errors:[h]}));throw E.setFields(e),new Error(h)}}else if(!1===i.data||!1===(null==(e=i.data)?void 0:e.valid)){const t=(null==(n=i.data)?void 0:n.message)||i.msg||h;throw new Error(t)}return}if(f){const e={};a.forEach(n=>{void 0!==t[n]&&null!==t[n]&&(e[n]=t[n])});const n={field:a,value:e,id:p,union:f?1:0},s="GET"===c?await C(n,l):await S(n,l);if(200!==s.code){const t=s.msg||h;throw new Error(t)}if(Array.isArray(s.data)){const t=s.data.filter(t=>!0===t.value);if(t.length>0){let e=[],n=h;if(f&&t.length>1){const r=t.map(t=>A(t.field));n=r.join("、")+"同时重复",e=t.map(t=>({name:t.field,errors:[n]}))}else e=t.map(t=>{const e=A(t.field);return{name:t.field,errors:[e+"重复"]}}),1===t.length&&(n=A(t[0].field)+"重复");throw E.setFields(e),new Error(n)}}else if(!1===s.data||!1===(null==(r=s.data)?void 0:r.valid)){const t=(null==(i=s.data)?void 0:i.message)||s.msg||h;throw new Error(t)}}else for(const d of a){const e=t[d];if(null==e||""===e)continue;const n={field:[d],value:{[d]:e},id:p},r="GET"===c?await C(n,l):await S(n,l);if(200!==r.code){const t=r.msg||h;throw new Error(t)}if(Array.isArray(r.data)){if(r.data.find(t=>t.field===d&&!0===t.value)){const t=A(d)+"重复";throw E.setFields([{name:d,errors:[t]}]),new Error(t)}}else if(!1===r.data||!1===(null==(s=r.data)?void 0:s.valid)){const t=(null==(o=r.data)?void 0:o.message)||r.msg||h;throw new Error(t)}}})(t);const e={...t},n=[];w?h.forEach(t=>{t.children&&n.push(...t.children)}):n.push(...h),n.forEach(t=>{var n,r;if(void 0===t.defaultValue||void 0!==e[t.name]&&null!==e[t.name]||(e[t.name]=t.defaultValue),"datePicker"===t.type&&e[t.name]?l.isDayjs(e[t.name])&&(e[t.name]=e[t.name].toISOString()):"rangePicker"===t.type&&e[t.name]&&Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(t=>l.isDayjs(t)?t.toISOString():t)),"select"===t.type&&t.labelName){const r=null==(n=t.options)?void 0:n.find(n=>n[t.fieldNames.value]===e[t.name]),i=t.fieldNames.label,s=r?r[i]:void 0;e[t.labelName]=s}if("treeSelect"===t.type&&t.multiple&&(e[t.name]=null==(r=e[t.name])?void 0:r.join(",")),"Radio"===t.type&&t.options&&void 0!==e[t.name]&&null!==e[t.name]){const n=t.options.find(n=>n.value==e[t.name]);n&&"number"==typeof n.value&&(e[t.name]=Number(e[t.name]))}}),await f(e)}catch(t){(null==t?void 0:t.message)&&(null==t?void 0:t.errorFields)&&E.setFields(t.errorFields)}},onCancel:m,width:y.width||800,confirmLoading:b,destroyOnClose:!0,maskClosable:!1,footer:(t,{OkBtn:e,CancelBtn:r})=>n.jsxs(n.Fragment,{children:[x&&x(E.getFieldsValue()),n.jsx(r,{}),n.jsx(e,{})]}),...y,children:n.jsx(i.Form,{form:E,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(t,e)=>{if(v&&v(t,e),null==N?void 0:N.realtime){const n=Object.keys(t)[0];j(e,n)}},children:w?n.jsx(i.Tabs,{children:h.map(t=>{var e;return n.jsx(i.Tabs.TabPane,{tab:t.label,children:n.jsx(i.Row,{gutter:24,justify:"start",children:null==(e=null==t?void 0:t.children)?void 0:e.map(t=>n.jsx(i.Col,{span:t.colSpan||6,children:n.jsx(i.Form.Item,{label:t.label,name:t.name,rules:t.rules,initialValue:t.defaultValue,className:k||t.disabled?oa:"",children:$(t)},t.name)},t.name))})},t.label)})}):n.jsx(i.Row,{gutter:24,justify:"start",children:h.map(t=>n.jsx(i.Col,{span:t.colSpan||6,children:n.jsx(i.Form.Item,{label:t.label,name:t.name,rules:t.rules,initialValue:t.defaultValue,className:k||t.disabled?oa:"",children:$(t)},t.name)},t.name))})})})}),ca="_container_1onnv_1",ua="_searchForm_1onnv_9",ha="_tableContainer_1onnv_15",da="_pagination_1onnv_52",fa=r.forwardRef(({searchFormConfig:t,addFormConfig:e,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,addisdisabled:w={isdisabled:!1,message:""},tableHeight:N=150,limit:E={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:k,onRowClick:A,onDelete:C,tableId:j,isaddtab:_=!1,validateConfig:q,...T},L)=>{r.useImperativeHandle(L,()=>({getList:async()=>st(),setFieldsValue:t=>{var e;null==(e=X.current)||e.setFieldsValue(t)},getFieldsValue:()=>{var t;return null==(t=X.current)?void 0:t.getFieldsValue()},reload:()=>{st()}}));const[I,R]=r.useState(!1),[M,B]=r.useState([]),[D,P]=r.useState({current:1,pageSize:15,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:t=>`共 ${t} 条`}),[U,F]=r.useState(!1),[z,$]=r.useState("add"),[V,H]=r.useState(null),[K,W]=r.useState([]),[Z,G]=r.useState([]),[Y,J]=r.useState([]),X=r.useRef(null),Q=r.useRef(f),tt=r.useRef(D),et=r.useRef(null),[nt,rt]=r.useState(0),it=r.useRef(null);r.useEffect(()=>{Q.current=f},[f]),r.useEffect(()=>{tt.current=D},[D]);const st=o.debounce(async t=>{var e,n;if(!(null==l?void 0:l.search))return;const r=it.current.getFieldsValue();for(const o in r)if(o.includes("/")){const t=o.split("/")[0],e=o.split("/")[1],n=r[o];r[t]=n&&n.length>0?r[o][0].format("YYYY-MM-DD"):null,r[e]=n&&n.length>0?r[o][1].format("YYYY-MM-DD"):null}else r[o]=r[o];const i={...null==(e=Q.current)?void 0:e.searchParams,...t,pageNum:tt.current.current,pageSize:tt.current.pageSize,...r};g&&delete i.pageNum,g&&delete i.pageSize,R(!0);try{const t=await S(i,l.search);if(200===t.code){const e=(null==(n=null==t?void 0:t.data)?void 0:n.list)||(null==t?void 0:t.data),r=e.map(t=>(t.hasOwnProperty("addCountyCode")&&(t.alladdress={...t}),t)).map(t=>(t.alladdress={...t},t));B(r||[]),P(e=>{var n,r,i;return{...e,current:null==(n=null==t?void 0:t.data)?void 0:n.pageNum,pageSize:null==(r=null==t?void 0:t.data)?void 0:r.pageSize,total:null==(i=null==t?void 0:t.data)?void 0:i.total}})}else B([]),P(t=>({...t,total:0,current:1}))}catch(s){B([]),P(t=>({...t,total:0,current:1}))}finally{R(!1)}},100);r.useEffect(()=>{(null==l?void 0:l.search)&&st()},[D.current,D.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(et.current&&Y.length>0){const t=et.current.offsetHeight;rt(t)}},[Y]);const ot=r.useRef(null);r.useEffect(()=>{const t={title:"操作",key:"action",align:"center",width:k||150,fixed:"right",render:(t,e)=>n.jsx(n.Fragment,{children:n.jsxs(i.Space,{size:"small",ref:ot,children:["function"==typeof h?h(e):h,l.edit&&E.editLimit&&n.jsx("a",{onClick:()=>at(e),children:a||"编辑"}),(l.view||l.edit)&&E.addLimit&&n.jsx("a",{onClick:()=>ct(e),children:c||"查看"}),l.delete&&E.delLimit&&n.jsx("a",{onClick:()=>ut(e),style:{color:"#f5222d"},children:u||"删除"})]})})},e=l.edit||l.delete||l.view||h,r=[...s],o=e?[...r,t]:r;G(o)},[]),r.useEffect(()=>{t&&J(t)},[t]),r.useEffect(()=>{e&&W(e)},[e]);const lt=()=>{H(null),$("add"),F(!0),y&&y()},at=t=>{H(t),$("edit"),F(!0),y&&y(t)},ct=t=>{H(t),$("view"),F(!0)},ut=async t=>{l.delete&&i.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{R(!0);if(200===(await S({id:t.id,...null==f?void 0:f.delParams},l.delete)).code){C&&C(t),i.message.success(`${u||"删除"}成功`);const e=D.current,n=D.pageSize,r=D.total-1;r>0&&(e-1)*n>=r&&e>1?(P(t=>({...t,current:t.current-1})),setTimeout(()=>{st()},0)):st()}}catch(e){}finally{R(!1)}}})},ht=window.parent!==window.self,dt={"--table-height":ht?`calc(100vh - ${nt}px - ${N}px + 63px)`:`calc(100vh - ${nt}px - ${N}px)`,height:ht?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:ca,style:dt,children:[Y.length>0||!m?n.jsx("div",{className:ua,ref:et,children:n.jsx(O,{config:Y,onSearch:()=>{P(t=>({...t,current:1})),st()},onReset:()=>{P(t=>({...t,current:1})),st()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:b||(()=>l.add&&E.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(i.Tooltip,{title:w.isdisabled?w.message:"",children:n.jsx(i.Button,{type:"primary",onClick:lt,disabled:w.isdisabled,children:"新建"})})})),ref:it})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:ha,style:{height:`calc(100% - ${nt}px-35px)`},children:[n.jsx(Wt,{page:D,virtual:g,tableId:j,scroll:{x:"1200px",y:"calc(100vh - 300px)"},onRowClick:A&&A,columns:Z,dataSource:p||M,loading:I,pagination:!1,onChange:t=>{P(e=>({...e,current:t.current,pageSize:t.pageSize}))},rowKey:"id",...T}),!g&&n.jsx("div",{className:da,children:n.jsx(i.Pagination,{size:"small",onChange:(t,e)=>{P(n=>({...n,current:t,pageSize:e}))},...D,showQuickJumper:!1})})]}),n.jsx(aa,{validateConfig:q,CustomModalFooter:v,ref:X,oneditFormChange:x,visible:U,mode:z,config:"view"===z?K.map(t=>({...t,disabled:!0})):K,initialValues:V,onOk:async t=>{if(t.alladdress&&(t={...t,...t.alladdress}),"view"!==z){R(!0);try{let e;e="add"==z?await S({...t,...null==f?void 0:f.addParams},l.add):await S({id:null==V?void 0:V.id,...t,...null==f?void 0:f.editParams},l.edit),200==e.code&&(i.message.success(("add"===z?"添加":"更新")+"成功"),F(!1),st())}catch(e){}finally{R(!1)}}else F(!1)},onCancel:()=>F(!1),title:(()=>{switch(z){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:I,tab:_,modalProps:"view"===z?{footer:[n.jsx(i.Button,{onClick:()=>F(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),pa=r.memo(fa);exports.CommonPage=pa,exports.CustomAdd=aa,exports.CustomForm=O,exports.CustomTable=Wt,exports.NomalSelect=_;
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|