@steedos-labs/plugin-workflow 3.0.42 → 3.0.43
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/designer/dist/amis-renderer/amis-renderer.css +1 -1
- package/designer/dist/amis-renderer/amis-renderer.js +1 -1
- package/designer/dist/assets/index-C3K_lyOl.css +1 -0
- package/designer/dist/assets/index-XZWBSnmF.js +943 -0
- package/designer/dist/index.html +2 -2
- package/main/default/routes/api_workflow_nav.router.js +2 -1
- package/main/default/utils/designerManager.js +4 -0
- package/package.json +1 -1
- package/public/amis-renderer/amis-renderer.css +1 -1
- package/public/amis-renderer/amis-renderer.js +1 -1
- package/designer/dist/assets/index-B1eKIobX.css +0 -1
- package/designer/dist/assets/index-BsqTuhsm.js +0 -943
- package/main/default/applications/desktop.app.yml +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t,n){"use strict";function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const o=r(e);var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,l={exports:{}};function c(){return a||(a=1,l.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",s="hour",a="day",l="week",c="month",u="quarter",d="year",h="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},y=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:y,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+y(r,2,"0")+":"+y(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,s=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-s:s-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:a,D:h,h:s,m:i,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},v="en",w={};w[v]=g;var x="$isDayjsObject",k=function(e){return e instanceof C||!(!e||!e[x])},S=function e(t,n,r){var o;if(!t)return v;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var s=t.split("-");if(!o&&s.length>1)return e(s[0])}else{var a=t.name;w[a]=t,o=a}return!r&&o&&(v=o),o||!r&&v},E=function(e,t){if(k(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new C(n)},M=b;M.l=S,M.i=k,M.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function g(e){this.$L=S(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var y=g.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(M.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(f);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return M},y.isValid=function(){return!(this.$d.toString()===p)},y.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},y.isAfter=function(e,t){return E(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<E(e)},y.$g=function(e,t,n){return M.u(e)?this[t]:this.set(n,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var n=this,r=!!M.u(t)||t,u=M.p(e),p=function(e,t){var o=M.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(a)},f=function(e,t){return M.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,g=this.$M,y=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case d:return r?p(1,0):p(31,11);case c:return r?p(1,g):p(0,g+1);case l:var v=this.$locale().weekStart||0,w=(m<v?m+7:m)-v;return p(r?y-w:y+(6-w),g);case a:case h:return f(b+"Hours",0);case s:return f(b+"Minutes",1);case i:return f(b+"Seconds",2);case o:return f(b+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var n,l=M.p(e),u="set"+(this.$u?"UTC":""),p=(n={},n[a]=u+"Date",n[h]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[s]=u+"Hours",n[i]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],f=l===a?this.$D+(t-this.$W):t;if(l===c||l===d){var m=this.clone().set(h,1);m.$d[p](f),m.init(),this.$d=m.set(h,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[M.p(e)]()},y.add=function(r,u){var h,p=this;r=Number(r);var f=M.p(u),m=function(e){var t=E(p);return M.w(t.date(t.date()+Math.round(e*r)),p)};if(f===c)return this.set(c,this.$M+r);if(f===d)return this.set(d,this.$y+r);if(f===a)return m(1);if(f===l)return m(7);var g=(h={},h[i]=t,h[s]=n,h[o]=e,h)[f]||1,y=this.$d.getTime()+r*g;return M.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=M.z(this),i=this.$H,s=this.$m,a=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},h=function(e){return M.s(i%12||12,e,"0")},f=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return M.s(t.$y,4,"0");case"M":return a+1;case"MM":return M.s(a+1,2,"0");case"MMM":return d(n.monthsShort,a,c,3);case"MMMM":return d(c,a);case"D":return t.$D;case"DD":return M.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(i);case"HH":return M.s(i,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return f(i,s,!0);case"A":return f(i,s,!1);case"m":return String(s);case"mm":return M.s(s,2,"0");case"s":return String(t.$s);case"ss":return M.s(t.$s,2,"0");case"SSS":return M.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,h,p){var f,m=this,g=M.p(h),y=E(r),b=(y.utcOffset()-this.utcOffset())*t,v=this-y,w=function(){return M.m(m,y)};switch(g){case d:f=w()/12;break;case c:f=w();break;case u:f=w()/3;break;case l:f=(v-b)/6048e5;break;case a:f=(v-b)/864e5;break;case s:f=v/n;break;case i:f=v/t;break;case o:f=v/e;break;default:f=v}return p?f:M.a(f)},y.daysInMonth=function(){return this.endOf(c).$D},y.$locale=function(){return w[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=S(e,t,!0);return r&&(n.$L=r),n},y.clone=function(){return M.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},g}(),R=C.prototype;return E.prototype=R,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",d],["$D",h]].forEach(function(e){R[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,C,E),e.$i=!0),E},E.locale=S,E.isDayjs=k,E.unix=function(e){return E(1e3*e)},E.en=w[v],E.Ls=w,E.p={},E}()),l.exports}const u=s(c());var d,h={exports:{}};const p=s((d||(d=1,h.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}}),h.exports));var f,m={exports:{}};const g=s((f||(f=1,m.exports=function(e,t,n){var r=t.prototype,o=function(e){return e&&(e.indexOf?e:e.s)},i=function(e,t,n,r,i){var s=e.name?e:e.$locale(),a=o(s[t]),l=o(s[n]),c=a||l.map(function(e){return e.slice(0,r)});if(!i)return c;var u=s.weekStart;return c.map(function(e,t){return c[(t+(u||0))%7]})},s=function(){return n.Ls[n.locale()]},a=function(e,t){return e.formats[t]||e.formats[t.toUpperCase()].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})},l=function(){var e=this;return{months:function(t){return t?t.format("MMMM"):i(e,"months")},monthsShort:function(t){return t?t.format("MMM"):i(e,"monthsShort","months",3)},firstDayOfWeek:function(){return e.$locale().weekStart||0},weekdays:function(t){return t?t.format("dddd"):i(e,"weekdays")},weekdaysMin:function(t){return t?t.format("dd"):i(e,"weekdaysMin","weekdays",2)},weekdaysShort:function(t){return t?t.format("ddd"):i(e,"weekdaysShort","weekdays",3)},longDateFormat:function(t){return a(e.$locale(),t)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return l.bind(this)()},n.localeData=function(){var e=s();return{firstDayOfWeek:function(){return e.weekStart||0},weekdays:function(){return n.weekdays()},weekdaysShort:function(){return n.weekdaysShort()},weekdaysMin:function(){return n.weekdaysMin()},months:function(){return n.months()},monthsShort:function(){return n.monthsShort()},longDateFormat:function(t){return a(e,t)},meridiem:e.meridiem,ordinal:e.ordinal}},n.months=function(){return i(s(),"months")},n.monthsShort=function(){return i(s(),"monthsShort","months",3)},n.weekdays=function(e){return i(s(),"weekdays",null,null,e)},n.weekdaysShort=function(e){return i(s(),"weekdaysShort","weekdays",3,e)},n.weekdaysMin=function(e){return i(s(),"weekdaysMin","weekdays",2,e)}}),m.exports));var y,b={exports:{}};const v=s((y||(y=1,b.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return(e=+e)+(e>68?1900:2e3)},l=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var o=1;o<=24;o+=1)if(e.indexOf(r(o,0,t))>-1){n=o>12;break}}else n=e===(t?"pm":"PM");return n},h={A:[i,function(e){this.afternoon=d(e,!1)}],a:[i,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[o,l("seconds")],ss:[o,l("seconds")],m:[o,l("minutes")],mm:[o,l("minutes")],H:[o,l("hours")],h:[o,l("hours")],HH:[o,l("hours")],hh:[o,l("hours")],D:[o,l("day")],DD:[r,l("day")],Do:[i,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[o,l("week")],ww:[r,l("week")],M:[o,l("month")],MM:[r,l("month")],MMM:[i,function(e){var t=u("months"),n=(u("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,l("year")],YY:[r,function(e){this.year=a(e)}],YYYY:[/\d{4}/,l("year")],Z:c,ZZ:c};function p(n){var r,o;r=n,o=s&&s.formats;for(var i=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})).match(t),a=i.length,l=0;l<a;l+=1){var c=i[l],u=h[c],d=u&&u[0],p=u&&u[1];i[l]=p?{regex:d,parser:p}:c.replace(/^\[|\]$/g,"")}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var o=i[n];if("string"==typeof o)r+=o.length;else{var s=o.regex,l=o.parser,c=e.slice(r),u=s.exec(c)[0];l.call(t,u),e=e.replace(u,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,o=r.parse;r.parse=function(e){var t=e.date,r=e.utc,i=e.args;this.$u=r;var a=i[1];if("string"==typeof a){var l=!0===i[2],c=!0===i[3],u=l||c,d=i[2];c&&(d=i[2]),s=this.$locale(),!l&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var o=p(t)(e),i=o.year,s=o.month,a=o.day,l=o.hours,c=o.minutes,u=o.seconds,d=o.milliseconds,h=o.zone,f=o.week,m=new Date,g=a||(i||s?1:m.getDate()),y=i||m.getFullYear(),b=0;i&&!s||(b=s>0?s-1:m.getMonth());var v,w=l||0,x=c||0,k=u||0,S=d||0;return h?new Date(Date.UTC(y,b,g,w,x,k,S+60*h.offset*1e3)):n?new Date(Date.UTC(y,b,g,w,x,k,S)):(v=new Date(y,b,g,w,x,k,S),f&&(v=r(v).week(f).toDate()),v)}catch(E){return new Date("")}}(t,a,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={}}else if(a instanceof Array)for(var h=a.length,f=1;f<=h;f+=1){i[1]=a[f-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}f===h&&(this.$d=new Date(""))}else o.call(this,e)}}}()),b.exports));var w,x={exports:{}};w||(w=1,x.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,t){return"W"===t?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,t){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};return n.default.locale(r,null,!0),r}(c()));var k,S,E,M={exports:{}};function C(e,t,n){e&&Object.isFrozen(e)&&(e=function(e,t=!0){const n=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return t&&e&&Object.keys(e).forEach(t=>n[t]=e[t]),n}(e));const r=e?Object.create(e,{...n,__super:{value:e,writable:!1,enumerable:!1}}):Object.create(Object.prototype,n);return t&&function(e){const t=typeof e;return e&&"string"!==t&&"number"!==t&&"boolean"!==t&&"function"!==t&&!Array.isArray(e)}(t)&&Object.keys(t).forEach(e=>r[e]=t[e]),r}function R(e){if(Array.isArray(e))return e;if("string"==typeof e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}return[]}function O(e,t,n,r,o,i,s){const a=e=>{for(const t of n){if(t.name===e)return t;if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n}}};return{getFieldValue(t){const n=a(t),r=e[t];return"table"===n?.type?R(r):r??""},setFieldValue(e,n){t(e,n&&"object"==typeof n?n:null==n?"":String(n))},setFieldVisible(e,t){const n=a(e);n&&r&&r(n._id,{hidden:!t})},setFieldHidden(e,t){const n=a(e);n&&r&&r(n._id,{hidden:t})},setFieldRequired(e,t){const n=a(e);n&&r&&r(n._id,{required:t})},setFieldReadonly(e,t){const n=a(e);n&&r&&r(n._id,{readonly:t})},getFieldOptions(e){const t=a(e);return t?.options||[]},setFieldOptions(e,t){const n=a(e);n&&r&&r(n._id,{options:t})},getTableRows:t=>R(e[t]),setTableRows(e,n){t(e,JSON.stringify(Array.isArray(n)?n:[]))},addTableRow(n,r={}){const o=R(e[n]);o.push(r),t(n,JSON.stringify(o))},removeTableRow(n,r){const o=R(e[n]);r>=0&&r<o.length&&(o.splice(r,1),t(n,JSON.stringify(o)))},message:{success:e=>o?.success(e),error:e=>o?.error(e),warning:e=>o?.warning(e),info:e=>o?.info(e),loading:e=>o?.loading(e)},context:i||{},currentStep:s||{}}}async function T(e,t){if(!e||!e.trim())return;let n;if(t.values&&t.form){if(n={...t.values},t.fields)n=function(e,t){const n={...e};for(const r of t)"table"===r.type&&(n[r.name]=R(n[r.name]));return n}(t.values,t.fields);else for(const[i,s]of Object.entries(n))if("string"==typeof s&&s.startsWith("["))try{const e=JSON.parse(s);Array.isArray(e)&&(n[i]=e)}catch{}}else n=t.values;let r=t.value;"table"===t.field?.type&&"string"==typeof t.value&&(r=R(t.value));try{const o=new Function("form","field","value","oldValue","values","fields","fetch","currentStep",`return (async () => { ${e} })();`);return await o(t.form,t.field,r,t.oldValue,n,t.fields,fetch.bind(window),t.form?.currentStep)}catch(o){throw console.error("[fieldDataService] executeFormEvent error:",o),o}}function N(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=N(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}k||(k=1,S=M,E=M.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",o=32,s=128,a=256,l=1/0,c=9007199254740991,u=NaN,d=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",a]],p="[object Arguments]",f="[object Array]",m="[object Boolean]",g="[object Date]",y="[object Error]",b="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",k="[object Object]",M="[object Promise]",C="[object RegExp]",R="[object Set]",O="[object String]",T="[object Symbol]",N="[object WeakMap]",_="[object ArrayBuffer]",A="[object DataView]",D="[object Float32Array]",$="[object Float64Array]",L="[object Int8Array]",I="[object Int16Array]",j="[object Int32Array]",z="[object Uint8Array]",P="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",H=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,Y=RegExp(q.source),J=RegExp(W.source),K=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,oe=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,we=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",ke="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",Me="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Oe="['’]",Te="["+xe+"]",Ne="["+Re+"]",_e="["+ke+"]",Ae="\\d+",De="["+Se+"]",$e="["+Ee+"]",Le="[^"+xe+Re+Ae+Se+Ee+Me+"]",Ie="\\ud83c[\\udffb-\\udfff]",je="[^"+xe+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Me+"]",Be="\\u200d",He="(?:"+$e+"|"+Le+")",Ve="(?:"+Fe+"|"+Le+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+_e+"|"+Ie+")?",Ye="["+Ce+"]?",Je=Ye+We+"(?:"+Be+"(?:"+[je,ze,Pe].join("|")+")"+Ye+We+")*",Ke="(?:"+[De,ze,Pe].join("|")+")"+Je,Ge="(?:"+[je+_e+"?",_e,ze,Pe,Te].join("|")+")",Ze=RegExp(Oe,"g"),Qe=RegExp(_e,"g"),Xe=RegExp(Ie+"(?="+Ie+")|"+Ge+Je,"g"),et=RegExp([Fe+"?"+$e+"+"+Ue+"(?="+[Ne,Fe,"$"].join("|")+")",Ve+"+"+qe+"(?="+[Ne,Fe+He,"$"].join("|")+")",Fe+"?"+He+"+"+Ue,Fe+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ae,Ke].join("|"),"g"),tt=RegExp("["+Be+xe+ke+Ce+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,it={};it[D]=it[$]=it[L]=it[I]=it[j]=it[z]=it[P]=it[F]=it[B]=!0,it[p]=it[f]=it[_]=it[m]=it[A]=it[g]=it[y]=it[b]=it[w]=it[x]=it[k]=it[C]=it[R]=it[O]=it[N]=!1;var st={};st[p]=st[f]=st[_]=st[A]=st[m]=st[g]=st[D]=st[$]=st[L]=st[I]=st[j]=st[w]=st[x]=st[k]=st[C]=st[R]=st[O]=st[T]=st[z]=st[P]=st[F]=st[B]=!0,st[y]=st[b]=st[N]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ct=parseInt,ut="object"==typeof i&&i&&i.Object===Object&&i,dt="object"==typeof self&&self&&self.Object===Object&&self,ht=ut||dt||Function("return this")(),pt=E&&!E.nodeType&&E,ft=pt&&S&&!S.nodeType&&S,mt=ft&&ft.exports===pt,gt=mt&&ut.process,yt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||gt&>.binding&>.binding("util")}catch(t){}}(),bt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,wt=yt&&yt.isMap,xt=yt&&yt.isRegExp,kt=yt&&yt.isSet,St=yt&&yt.isTypedArray;function Et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Mt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Ot(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Tt(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}function Nt(e,t){return!(null==e||!e.length)&&Ft(e,t,0)>-1}function _t(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function At(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function Dt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function $t(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Lt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function It(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var jt=Ut("length");function zt(e,t,n){var r;return n(e,function(e,n,o){if(t(e,n,o))return r=n,!1}),r}function Pt(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function Ft(e,t,n){return t==t?function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):Pt(e,Ht,n)}function Bt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Ht(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?Yt(e,t)/n:u}function Ut(t){return function(n){return null==n?e:n[t]}}function qt(t){return function(n){return null==t?e:t[n]}}function Wt(e,t,n,r,o){return o(e,function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)}),n}function Yt(t,n){for(var r,o=-1,i=t.length;++o<i;){var s=n(t[o]);s!==e&&(r=r===e?s:r+s)}return r}function Jt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Kt(e){return e?e.slice(0,hn(e)+1).replace(re,""):e}function Gt(e){return function(t){return e(t)}}function Zt(e,t){return At(t,function(t){return e[t]})}function Qt(e,t){return e.has(t)}function Xt(e,t){for(var n=-1,r=e.length;++n<r&&Ft(t,e[n],0)>-1;);return n}function en(e,t){for(var n=e.length;n--&&Ft(t,e[n],0)>-1;);return n}var tn=qt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=qt({"&":"&","<":"<",">":">",'"':""","'":"'"});function rn(e){return"\\"+at[e]}function on(e){return tt.test(e)}function sn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function an(e,t){return function(n){return e(t(n))}}function ln(e,t){for(var n=-1,o=e.length,i=0,s=[];++n<o;){var a=e[n];a!==t&&a!==r||(e[n]=r,s[i++]=n)}return s}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function un(e){return on(e)?function(e){for(var t=Xe.lastIndex=0;Xe.test(e);)++t;return t}(e):jt(e)}function dn(e){return on(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function hn(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var pn=qt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),fn=function i(S){var E,oe=(S=null==S?ht:fn.defaults(ht.Object(),S,fn.pick(ht,rt))).Array,xe=S.Date,ke=S.Error,Se=S.Function,Ee=S.Math,Me=S.Object,Ce=S.RegExp,Re=S.String,Oe=S.TypeError,Te=oe.prototype,Ne=Se.prototype,_e=Me.prototype,Ae=S["__core-js_shared__"],De=Ne.toString,$e=_e.hasOwnProperty,Le=0,Ie=(E=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",je=_e.toString,ze=De.call(Me),Pe=ht._,Fe=Ce("^"+De.call($e).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=mt?S.Buffer:e,He=S.Symbol,Ve=S.Uint8Array,Ue=Be?Be.allocUnsafe:e,qe=an(Me.getPrototypeOf,Me),We=Me.create,Ye=_e.propertyIsEnumerable,Je=Te.splice,Ke=He?He.isConcatSpreadable:e,Ge=He?He.iterator:e,Xe=He?He.toStringTag:e,tt=function(){try{var e=ui(Me,"defineProperty");return e({},"",{}),e}catch(t){}}(),at=S.clearTimeout!==ht.clearTimeout&&S.clearTimeout,ut=xe&&xe.now!==ht.Date.now&&xe.now,dt=S.setTimeout!==ht.setTimeout&&S.setTimeout,pt=Ee.ceil,ft=Ee.floor,gt=Me.getOwnPropertySymbols,yt=Be?Be.isBuffer:e,jt=S.isFinite,qt=Te.join,mn=an(Me.keys,Me),gn=Ee.max,yn=Ee.min,bn=xe.now,vn=S.parseInt,wn=Ee.random,xn=Te.reverse,kn=ui(S,"DataView"),Sn=ui(S,"Map"),En=ui(S,"Promise"),Mn=ui(S,"Set"),Cn=ui(S,"WeakMap"),Rn=ui(Me,"create"),On=Cn&&new Cn,Tn={},Nn=Pi(kn),_n=Pi(Sn),An=Pi(En),Dn=Pi(Mn),$n=Pi(Cn),Ln=He?He.prototype:e,In=Ln?Ln.valueOf:e,jn=Ln?Ln.toString:e;function zn(e){if(na(e)&&!qs(e)&&!(e instanceof Hn)){if(e instanceof Bn)return e;if($e.call(e,"__wrapped__"))return Fi(e)}return new Bn(e)}var Pn=function(){function t(){}return function(n){if(!ta(n))return{};if(We)return We(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function Fn(){}function Bn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Un(e);this.size=t.size}function Jn(e,t){var n=qs(e),r=!n&&Us(e),o=!n&&!r&&Ks(e),i=!n&&!r&&!o&&ua(e),s=n||r||o||i,a=s?Jt(e.length,Re):[],l=a.length;for(var c in e)!t&&!$e.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yi(c,l))||a.push(c);return a}function Kn(t){var n=t.length;return n?t[Wr(0,n-1)]:e}function Gn(e,t){return Di(Oo(e),ir(t,0,e.length))}function Zn(e){return Di(Oo(e))}function Qn(t,n,r){(r!==e&&!Bs(t[n],r)||r===e&&!(n in t))&&rr(t,n,r)}function Xn(t,n,r){var o=t[n];$e.call(t,n)&&Bs(o,r)&&(r!==e||n in t)||rr(t,n,r)}function er(e,t){for(var n=e.length;n--;)if(Bs(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,function(e,o,i){t(r,e,n(e),i)}),r}function nr(e,t){return e&&To(t,Aa(t),e)}function rr(e,t,n){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(t,n){for(var r=-1,o=n.length,i=oe(o),s=null==t;++r<o;)i[r]=s?e:Ra(t,n[r]);return i}function ir(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function sr(t,n,r,o,i,s){var a,l=1&n,c=2&n,u=4&n;if(r&&(a=i?r(t,o,i,s):r(t)),a!==e)return a;if(!ta(t))return t;var d=qs(t);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!l)return Oo(t,a)}else{var h=pi(t),f=h==b||h==v;if(Ks(t))return ko(t,l);if(h==k||h==p||f&&!i){if(a=c||f?{}:mi(t),!l)return c?function(e,t){return To(e,hi(e),t)}(t,function(e,t){return e&&To(t,Da(t),e)}(a,t)):function(e,t){return To(e,di(e),t)}(t,nr(a,t))}else{if(!st[h])return i?t:{};a=function(e,t,n){var r,o=e.constructor;switch(t){case _:return So(e);case m:case g:return new o(+e);case A:return function(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case D:case $:case L:case I:case j:case z:case P:case F:case B:return Eo(e,n);case w:return new o;case x:case O:return new o(e);case C:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new o;case T:return r=e,In?Me(In.call(r)):{}}}(t,h,l)}}s||(s=new Yn);var y=s.get(t);if(y)return y;s.set(t,a),aa(t)?t.forEach(function(e){a.add(sr(e,n,r,e,t,s))}):ra(t)&&t.forEach(function(e,o){a.set(o,sr(e,n,r,o,t,s))});var S=d?e:(u?c?ri:ni:c?Da:Aa)(t);return Ct(S||t,function(e,o){S&&(e=t[o=e]),Xn(a,o,sr(e,n,r,o,t,s))}),a}function ar(t,n,r){var o=r.length;if(null==t)return!o;for(t=Me(t);o--;){var i=r[o],s=n[i],a=t[i];if(a===e&&!(i in t)||!s(a))return!1}return!0}function lr(n,r,o){if("function"!=typeof n)throw new Oe(t);return Ti(function(){n.apply(e,o)},r)}function cr(e,t,n,r){var o=-1,i=Nt,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=At(t,Gt(n))),r?(i=_t,s=!1):t.length>=200&&(i=Qt,s=!1,t=new Wn(t));e:for(;++o<a;){var u=e[o],d=null==n?u:n(u);if(u=r||0!==u?u:0,s&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else i(t,d,r)||l.push(u)}return l}zn.templateSettings={escape:K,evaluate:G,interpolate:Z,variable:"",imports:{_:zn}},zn.prototype=Fn.prototype,zn.prototype.constructor=zn,Bn.prototype=Pn(Fn.prototype),Bn.prototype.constructor=Bn,Hn.prototype=Pn(Fn.prototype),Hn.prototype.constructor=Hn,Vn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Vn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Vn.prototype.get=function(t){var r=this.__data__;if(Rn){var o=r[t];return o===n?e:o}return $e.call(r,t)?r[t]:e},Vn.prototype.has=function(t){var n=this.__data__;return Rn?n[t]!==e:$e.call(n,t)},Vn.prototype.set=function(t,r){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=Rn&&r===e?n:r,this},Un.prototype.clear=function(){this.__data__=[],this.size=0},Un.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,0))},Un.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},Un.prototype.has=function(e){return er(this.__data__,e)>-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Vn,map:new(Sn||Un),string:new Vn}},qn.prototype.delete=function(e){var t=li(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return li(this,e).get(e)},qn.prototype.has=function(e){return li(this,e).has(e)},qn.prototype.set=function(e,t){var n=li(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,n),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Un,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ao(br),dr=Ao(vr,!0);function hr(e,t){var n=!0;return ur(e,function(e,r,o){return n=!!t(e,r,o)}),n}function pr(t,n,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=n(s);if(null!=a&&(l===e?a==a&&!ca(a):r(a,l)))var l=a,c=s}return c}function fr(e,t){var n=[];return ur(e,function(e,r,o){t(e,r,o)&&n.push(e)}),n}function mr(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=gi),o||(o=[]);++i<s;){var a=e[i];t>0&&n(a)?t>1?mr(a,t-1,n,r,o):Dt(o,a):r||(o[o.length]=a)}return o}var gr=Do(),yr=Do(!0);function br(e,t){return e&&gr(e,t,Aa)}function vr(e,t){return e&&yr(e,t,Aa)}function wr(e,t){return Tt(t,function(t){return Qs(e[t])})}function xr(t,n){for(var r=0,o=(n=bo(n,t)).length;null!=t&&r<o;)t=t[zi(n[r++])];return r&&r==o?t:e}function kr(e,t,n){var r=t(e);return qs(e)?r:Dt(r,n(e))}function Sr(t){return null==t?t===e?"[object Undefined]":"[object Null]":Xe&&Xe in Me(t)?function(t){var n=$e.call(t,Xe),r=t[Xe];try{t[Xe]=e;var o=!0}catch(s){}var i=je.call(t);return o&&(n?t[Xe]=r:delete t[Xe]),i}(t):function(e){return je.call(e)}(t)}function Er(e,t){return e>t}function Mr(e,t){return null!=e&&$e.call(e,t)}function Cr(e,t){return null!=e&&t in Me(e)}function Rr(t,n,r){for(var o=r?_t:Nt,i=t[0].length,s=t.length,a=s,l=oe(s),c=1/0,u=[];a--;){var d=t[a];a&&n&&(d=At(d,Gt(n))),c=yn(d.length,c),l[a]=!r&&(n||i>=120&&d.length>=120)?new Wn(a&&d):e}d=t[0];var h=-1,p=l[0];e:for(;++h<i&&u.length<c;){var f=d[h],m=n?n(f):f;if(f=r||0!==f?f:0,!(p?Qt(p,m):o(u,m,r))){for(a=s;--a;){var g=l[a];if(!(g?Qt(g,m):o(t[a],m,r)))continue e}p&&p.push(m),u.push(f)}}return u}function Or(t,n,r){var o=null==(t=Ci(t,n=bo(n,t)))?t:t[zi(Zi(n))];return null==o?e:Et(o,t,r)}function Tr(e){return na(e)&&Sr(e)==p}function Nr(t,n,r,o,i){return t===n||(null==t||null==n||!na(t)&&!na(n)?t!=t&&n!=n:function(t,n,r,o,i,s){var a=qs(t),l=qs(n),c=a?f:pi(t),u=l?f:pi(n),d=(c=c==p?k:c)==k,h=(u=u==p?k:u)==k,b=c==u;if(b&&Ks(t)){if(!Ks(n))return!1;a=!0,d=!1}if(b&&!d)return s||(s=new Yn),a||ua(t)?ei(t,n,r,o,i,s):function(e,t,n,r,o,i,s){switch(n){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case m:case g:case x:return Bs(+e,+t);case y:return e.name==t.name&&e.message==t.message;case C:case O:return e==t+"";case w:var a=sn;case R:var l=1&r;if(a||(a=cn),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=2,s.set(e,t);var u=ei(a(e),a(t),r,o,i,s);return s.delete(e),u;case T:if(In)return In.call(e)==In.call(t)}return!1}(t,n,c,r,o,i,s);if(!(1&r)){var v=d&&$e.call(t,"__wrapped__"),S=h&&$e.call(n,"__wrapped__");if(v||S){var E=v?t.value():t,M=S?n.value():n;return s||(s=new Yn),i(E,M,r,o,s)}}return!!b&&(s||(s=new Yn),function(t,n,r,o,i,s){var a=1&r,l=ni(t),c=l.length,u=ni(n),d=u.length;if(c!=d&&!a)return!1;for(var h=c;h--;){var p=l[h];if(!(a?p in n:$e.call(n,p)))return!1}var f=s.get(t),m=s.get(n);if(f&&m)return f==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var y=a;++h<c;){var b=t[p=l[h]],v=n[p];if(o)var w=a?o(v,b,p,n,t,s):o(b,v,p,t,n,s);if(!(w===e?b===v||i(b,v,r,o,s):w)){g=!1;break}y||(y="constructor"==p)}if(g&&!y){var x=t.constructor,k=n.constructor;x==k||!("constructor"in t)||!("constructor"in n)||"function"==typeof x&&x instanceof x&&"function"==typeof k&&k instanceof k||(g=!1)}return s.delete(t),s.delete(n),g}(t,n,r,o,i,s))}(t,n,r,o,Nr,i))}function _r(t,n,r,o){var i=r.length,s=i,a=!o;if(null==t)return!s;for(t=Me(t);i--;){var l=r[i];if(a&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++i<s;){var c=(l=r[i])[0],u=t[c],d=l[1];if(a&&l[2]){if(u===e&&!(c in t))return!1}else{var h=new Yn;if(o)var p=o(u,d,c,t,n,h);if(!(p===e?Nr(d,u,3,o,h):p))return!1}}return!0}function Ar(e){return!(!ta(e)||(t=e,Ie&&Ie in t))&&(Qs(e)?Fe:me).test(Pi(e));var t}function Dr(e){return"function"==typeof e?e:null==e?ol:"object"==typeof e?qs(e)?Pr(e[0],e[1]):zr(e):pl(e)}function $r(e){if(!ki(e))return mn(e);var t=[];for(var n in Me(e))$e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Lr(e){if(!ta(e))return function(e){var t=[];if(null!=e)for(var n in Me(e))t.push(n);return t}(e);var t=ki(e),n=[];for(var r in e)("constructor"!=r||!t&&$e.call(e,r))&&n.push(r);return n}function Ir(e,t){return e<t}function jr(e,t){var n=-1,r=Ys(e)?oe(e.length):[];return ur(e,function(e,o,i){r[++n]=t(e,o,i)}),r}function zr(e){var t=ci(e);return 1==t.length&&t[0][2]?Ei(t[0][0],t[0][1]):function(n){return n===e||_r(n,e,t)}}function Pr(t,n){return vi(t)&&Si(n)?Ei(zi(t),n):function(r){var o=Ra(r,t);return o===e&&o===n?Oa(r,t):Nr(n,o,3)}}function Fr(t,n,r,o,i){t!==n&&gr(n,function(s,a){if(i||(i=new Yn),ta(s))!function(t,n,r,o,i,s,a){var l=Ri(t,r),c=Ri(n,r),u=a.get(c);if(u)Qn(t,r,u);else{var d=s?s(l,c,r+"",t,n,a):e,h=d===e;if(h){var p=qs(c),f=!p&&Ks(c),m=!p&&!f&&ua(c);d=c,p||f||m?qs(l)?d=l:Js(l)?d=Oo(l):f?(h=!1,d=ko(c,!0)):m?(h=!1,d=Eo(c,!0)):d=[]:ia(c)||Us(c)?(d=l,Us(l)?d=ba(l):ta(l)&&!Qs(l)||(d=mi(c))):h=!1}h&&(a.set(c,d),i(d,c,o,s,a),a.delete(c)),Qn(t,r,d)}}(t,n,a,r,Fr,o,i);else{var l=o?o(Ri(t,a),s,a+"",t,n,i):e;l===e&&(l=s),Qn(t,a,l)}},Da)}function Br(t,n){var r=t.length;if(r)return yi(n+=n<0?r:0,r)?t[n]:e}function Hr(e,t,n){t=t.length?At(t,function(e){return qs(e)?function(t){return xr(t,1===e.length?e[0]:e)}:e}):[ol];var r=-1;return t=At(t,Gt(ai())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(jr(e,function(e,n,o){return{criteria:At(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return function(e,t,n){for(var r=-1,o=e.criteria,i=t.criteria,s=o.length,a=n.length;++r<s;){var l=Mo(o[r],i[r]);if(l)return r>=a?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function Vr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],a=xr(e,s);n(a,s)&&Zr(i,bo(s,e),a)}return i}function Ur(e,t,n,r){var o=r?Bt:Ft,i=-1,s=t.length,a=e;for(e===t&&(t=Oo(t)),n&&(a=At(e,Gt(n)));++i<s;)for(var l=0,c=t[i],u=n?n(c):c;(l=o(a,u,l,r))>-1;)a!==e&&Je.call(a,l,1),Je.call(e,l,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;yi(o)?Je.call(e,o,1):co(e,o)}}return e}function Wr(e,t){return e+ft(wn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return Ni(Mi(e,t,ol),e+"")}function Kr(e){return Kn(Ba(e))}function Gr(e,t){var n=Ba(e);return Di(n,ir(t,0,n.length))}function Zr(t,n,r,o){if(!ta(t))return t;for(var i=-1,s=(n=bo(n,t)).length,a=s-1,l=t;null!=l&&++i<s;){var c=zi(n[i]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=a){var d=l[c];(u=o?o(d,c,l):e)===e&&(u=ta(d)?d:yi(n[i+1])?[]:{})}Xn(l,c,u),l=l[c]}return t}var Qr=On?function(e,t){return On.set(e,t),e}:ol,Xr=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:tl(t),writable:!0})}:ol;function eo(e){return Di(Ba(e))}function to(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=oe(o);++r<o;)i[r]=e[r+t];return i}function no(e,t){var n;return ur(e,function(e,r,o){return!(n=t(e,r,o))}),!!n}function ro(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=e[i];null!==s&&!ca(s)&&(n?s<=t:s<t)?r=i+1:o=i}return o}return oo(e,t,ol,n)}function oo(t,n,r,o){var i=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(n=r(n))!=n,l=null===n,c=ca(n),u=n===e;i<s;){var d=ft((i+s)/2),h=r(t[d]),p=h!==e,f=null===h,m=h==h,g=ca(h);if(a)var y=o||m;else y=u?m&&(o||p):l?m&&p&&(o||!f):c?m&&p&&!f&&(o||!g):!f&&!g&&(o?h<=n:h<n);y?i=d+1:s=d}return yn(s,4294967294)}function io(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!Bs(a,l)){var l=a;i[o++]=0===s?0:s}}return i}function so(e){return"number"==typeof e?e:ca(e)?u:+e}function ao(e){if("string"==typeof e)return e;if(qs(e))return At(e,ao)+"";if(ca(e))return jn?jn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function lo(e,t,n){var r=-1,o=Nt,i=e.length,s=!0,a=[],l=a;if(n)s=!1,o=_t;else if(i>=200){var c=t?null:Jo(e);if(c)return cn(c);s=!1,o=Qt,l=new Wn}else l=t?[]:a;e:for(;++r<i;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,s&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),a.push(u)}else o(l,d,n)||(l!==a&&l.push(d),a.push(u))}return a}function co(e,t){var n=-1,r=(t=bo(t,e)).length;if(!r)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<r;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!$e.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<r&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=Ci(e,t);return null==s||delete s[zi(Zi(t))]}function uo(e,t,n,r){return Zr(e,t,n(xr(e,t)),r)}function ho(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?to(e,r?0:i,r?i+1:o):to(e,r?i+1:0,r?o:i)}function po(e,t){var n=e;return n instanceof Hn&&(n=n.value()),$t(t,function(e,t){return t.func.apply(t.thisArg,Dt([e],t.args))},n)}function fo(e,t,n){var r=e.length;if(r<2)return r?lo(e[0]):[];for(var o=-1,i=oe(r);++o<r;)for(var s=e[o],a=-1;++a<r;)a!=o&&(i[o]=cr(i[o]||s,e[a],t,n));return lo(mr(i,1),t,n)}function mo(t,n,r){for(var o=-1,i=t.length,s=n.length,a={};++o<i;){var l=o<s?n[o]:e;r(a,t[o],l)}return a}function go(e){return Js(e)?e:[]}function yo(e){return"function"==typeof e?e:ol}function bo(e,t){return qs(e)?e:vi(e,t)?[e]:ji(va(e))}var vo=Jr;function wo(t,n,r){var o=t.length;return r=r===e?o:r,!n&&r>=o?t:to(t,n,r)}var xo=at||function(e){return ht.clearTimeout(e)};function ko(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function So(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function Eo(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Mo(t,n){if(t!==n){var r=t!==e,o=null===t,i=t==t,s=ca(t),a=n!==e,l=null===n,c=n==n,u=ca(n);if(!l&&!u&&!s&&t>n||s&&a&&c&&!l&&!u||o&&a&&c||!r&&c||!i)return 1;if(!o&&!s&&!u&&t<n||u&&r&&i&&!o&&!s||l&&r&&i||!a&&i||!c)return-1}return 0}function Co(e,t,n,r){for(var o=-1,i=e.length,s=n.length,a=-1,l=t.length,c=gn(i-s,0),u=oe(l+c),d=!r;++a<l;)u[a]=t[a];for(;++o<s;)(d||o<i)&&(u[n[o]]=e[o]);for(;c--;)u[a++]=e[o++];return u}function Ro(e,t,n,r){for(var o=-1,i=e.length,s=-1,a=n.length,l=-1,c=t.length,u=gn(i-a,0),d=oe(u+c),h=!r;++o<u;)d[o]=e[o];for(var p=o;++l<c;)d[p+l]=t[l];for(;++s<a;)(h||o<i)&&(d[p+n[s]]=e[o++]);return d}function Oo(e,t){var n=-1,r=e.length;for(t||(t=oe(r));++n<r;)t[n]=e[n];return t}function To(t,n,r,o){var i=!r;r||(r={});for(var s=-1,a=n.length;++s<a;){var l=n[s],c=o?o(r[l],t[l],l,r,t):e;c===e&&(c=t[l]),i?rr(r,l,c):Xn(r,l,c)}return r}function No(e,t){return function(n,r){var o=qs(n)?Mt:tr,i=t?t():{};return o(n,e,ai(r,2),i)}}function _o(t){return Jr(function(n,r){var o=-1,i=r.length,s=i>1?r[i-1]:e,a=i>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(i--,s):e,a&&bi(r[0],r[1],a)&&(s=i<3?e:s,i=1),n=Me(n);++o<i;){var l=r[o];l&&t(n,l,o,s)}return n})}function Ao(e,t){return function(n,r){if(null==n)return n;if(!Ys(n))return e(n,r);for(var o=n.length,i=t?o:-1,s=Me(n);(t?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function Do(e){return function(t,n,r){for(var o=-1,i=Me(t),s=r(t),a=s.length;a--;){var l=s[e?a:++o];if(!1===n(i[l],l,i))break}return t}}function $o(t){return function(n){var r=on(n=va(n))?dn(n):e,o=r?r[0]:n.charAt(0),i=r?wo(r,1).join(""):n.slice(1);return o[t]()+i}}function Lo(e){return function(t){return $t(Qa(Ua(t).replace(Ze,"")),e,"")}}function Io(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Pn(e.prototype),r=e.apply(n,t);return ta(r)?r:n}}function jo(t){return function(n,r,o){var i=Me(n);if(!Ys(n)){var s=ai(r,3);n=Aa(n),r=function(e){return s(i[e],e,i)}}var a=t(n,r,o);return a>-1?i[s?n[a]:a]:e}}function zo(n){return ti(function(r){var o=r.length,i=o,s=Bn.prototype.thru;for(n&&r.reverse();i--;){var a=r[i];if("function"!=typeof a)throw new Oe(t);if(s&&!l&&"wrapper"==ii(a))var l=new Bn([],!0)}for(i=l?i:o;++i<o;){var c=ii(a=r[i]),u="wrapper"==c?oi(a):e;l=u&&wi(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[ii(u[0])].apply(l,u[3]):1==a.length&&wi(a)?l[c]():l.thru(a)}return function(){var e=arguments,t=e[0];if(l&&1==e.length&&qs(t))return l.plant(t).value();for(var n=0,i=o?r[n].apply(this,e):t;++n<o;)i=r[n].call(this,i);return i}})}function Po(t,n,r,o,i,a,l,c,u,d){var h=n&s,p=1&n,f=2&n,m=24&n,g=512&n,y=f?e:Io(t);return function s(){for(var b=arguments.length,v=oe(b),w=b;w--;)v[w]=arguments[w];if(m)var x=si(s),k=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(v,x);if(o&&(v=Co(v,o,i,m)),a&&(v=Ro(v,a,l,m)),b-=k,m&&b<d){var S=ln(v,x);return Wo(t,n,Po,s.placeholder,r,v,S,c,u,d-b)}var E=p?r:this,M=f?E[t]:t;return b=v.length,c?v=function(t,n){for(var r=t.length,o=yn(n.length,r),i=Oo(t);o--;){var s=n[o];t[o]=yi(s,r)?i[s]:e}return t}(v,c):g&&b>1&&v.reverse(),h&&u<b&&(v.length=u),this&&this!==ht&&this instanceof s&&(M=y||Io(M)),M.apply(E,v)}}function Fo(e,t){return function(n,r){return function(e,t,n,r){return br(e,function(e,o,i){t(r,n(e),o,i)}),r}(n,e,t(r),{})}}function Bo(t,n){return function(r,o){var i;if(r===e&&o===e)return n;if(r!==e&&(i=r),o!==e){if(i===e)return o;"string"==typeof r||"string"==typeof o?(r=ao(r),o=ao(o)):(r=so(r),o=so(o)),i=t(r,o)}return i}}function Ho(e){return ti(function(t){return t=At(t,Gt(ai())),Jr(function(n){var r=this;return e(t,function(e){return Et(e,r,n)})})})}function Vo(t,n){var r=(n=n===e?" ":ao(n)).length;if(r<2)return r?Yr(n,t):n;var o=Yr(n,pt(t/un(n)));return on(n)?wo(dn(o),0,t).join(""):o.slice(0,t)}function Uo(t){return function(n,r,o){return o&&"number"!=typeof o&&bi(n,r,o)&&(r=o=e),n=fa(n),r===e?(r=n,n=0):r=fa(r),function(e,t,n,r){for(var o=-1,i=gn(pt((t-e)/(n||1)),0),s=oe(i);i--;)s[r?i:++o]=e,e+=n;return s}(n,r,o=o===e?n<r?1:-1:fa(o),t)}}function qo(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ya(t),n=ya(n)),e(t,n)}}function Wo(t,n,r,i,s,a,l,c,u,d){var h=8&n;n|=h?o:64,4&(n&=~(h?64:o))||(n&=-4);var p=[t,n,s,h?a:e,h?l:e,h?e:a,h?e:l,c,u,d],f=r.apply(e,p);return wi(t)&&Oi(f,p),f.placeholder=i,_i(f,t,n)}function Yo(e){var t=Ee[e];return function(e,n){if(e=ya(e),(n=null==n?0:yn(ma(n),292))&&jt(e)){var r=(va(e)+"e").split("e");return+((r=(va(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Jo=Mn&&1/cn(new Mn([,-0]))[1]==l?function(e){return new Mn(e)}:cl;function Ko(e){return function(t){var n=pi(t);return n==w?sn(t):n==R?function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}(t):function(e,t){return At(t,function(t){return[t,e[t]]})}(t,e(t))}}function Go(n,i,l,c,u,d,h,p){var f=2&i;if(!f&&"function"!=typeof n)throw new Oe(t);var m=c?c.length:0;if(m||(i&=-97,c=u=e),h=h===e?h:gn(ma(h),0),p=p===e?p:ma(p),m-=u?u.length:0,64&i){var g=c,y=u;c=u=e}var b=f?e:oi(n),v=[n,i,l,c,u,g,y,d,h,p];if(b&&function(e,t){var n=e[1],o=t[1],i=n|o,l=i<131,c=o==s&&8==n||o==s&&n==a&&e[7].length<=t[8]||384==o&&t[7].length<=t[8]&&8==n;if(!l&&!c)return e;1&o&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Co(d,u,t[4]):u,e[4]=d?ln(e[3],r):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ro(d,u,t[6]):u,e[6]=d?ln(e[5],r):t[6]),(u=t[7])&&(e[7]=u),o&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),n=v[0],i=v[1],l=v[2],c=v[3],u=v[4],!(p=v[9]=v[9]===e?f?0:n.length:gn(v[9]-m,0))&&24&i&&(i&=-25),i&&1!=i)w=8==i||16==i?function(t,n,r){var o=Io(t);return function i(){for(var s=arguments.length,a=oe(s),l=s,c=si(i);l--;)a[l]=arguments[l];var u=s<3&&a[0]!==c&&a[s-1]!==c?[]:ln(a,c);return(s-=u.length)<r?Wo(t,n,Po,i.placeholder,e,a,u,e,e,r-s):Et(this&&this!==ht&&this instanceof i?o:t,this,a)}}(n,i,p):i!=o&&33!=i||u.length?Po.apply(e,v):function(e,t,n,r){var o=1&t,i=Io(e);return function t(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=oe(c+a),d=this&&this!==ht&&this instanceof t?i:e;++l<c;)u[l]=r[l];for(;a--;)u[l++]=arguments[++s];return Et(d,o?n:this,u)}}(n,i,l,c);else var w=function(e,t,n){var r=1&t,o=Io(e);return function t(){return(this&&this!==ht&&this instanceof t?o:e).apply(r?n:this,arguments)}}(n,i,l);return _i((b?Qr:Oi)(w,v),n,i)}function Zo(t,n,r,o){return t===e||Bs(t,_e[r])&&!$e.call(o,r)?n:t}function Qo(t,n,r,o,i,s){return ta(t)&&ta(n)&&(s.set(n,t),Fr(t,n,e,Qo,s),s.delete(n)),t}function Xo(t){return ia(t)?e:t}function ei(t,n,r,o,i,s){var a=1&r,l=t.length,c=n.length;if(l!=c&&!(a&&c>l))return!1;var u=s.get(t),d=s.get(n);if(u&&d)return u==n&&d==t;var h=-1,p=!0,f=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++h<l;){var m=t[h],g=n[h];if(o)var y=a?o(g,m,h,n,t,s):o(m,g,h,t,n,s);if(y!==e){if(y)continue;p=!1;break}if(f){if(!It(n,function(e,t){if(!Qt(f,t)&&(m===e||i(m,e,r,o,s)))return f.push(t)})){p=!1;break}}else if(m!==g&&!i(m,g,r,o,s)){p=!1;break}}return s.delete(t),s.delete(n),p}function ti(t){return Ni(Mi(t,e,Wi),t+"")}function ni(e){return kr(e,Aa,di)}function ri(e){return kr(e,Da,hi)}var oi=On?function(e){return On.get(e)}:cl;function ii(e){for(var t=e.name+"",n=Tn[t],r=$e.call(Tn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function si(e){return($e.call(zn,"placeholder")?zn:e).placeholder}function ai(){var e=zn.iteratee||il;return e=e===il?Dr:e,arguments.length?e(arguments[0],arguments[1]):e}function li(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ci(e){for(var t=Aa(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Si(o)]}return t}function ui(t,n){var r=function(t,n){return null==t?e:t[n]}(t,n);return Ar(r)?r:e}var di=gt?function(e){return null==e?[]:(e=Me(e),Tt(gt(e),function(t){return Ye.call(e,t)}))}:gl,hi=gt?function(e){for(var t=[];e;)Dt(t,di(e)),e=qe(e);return t}:gl,pi=Sr;function fi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var s=zi(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&ea(o)&&yi(s,o)&&(qs(e)||Us(e))}function mi(e){return"function"!=typeof e.constructor||ki(e)?{}:Pn(qe(e))}function gi(e){return qs(e)||Us(e)||!!(Ke&&e&&e[Ke])}function yi(e,t){var n=typeof e;return!!(t=null==t?c:t)&&("number"==n||"symbol"!=n&&ye.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ta(n))return!1;var r=typeof t;return!!("number"==r?Ys(n)&&yi(t,n.length):"string"==r&&t in n)&&Bs(n[t],e)}function vi(e,t){if(qs(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ca(e))||X.test(e)||!Q.test(e)||null!=t&&e in Me(t)}function wi(e){var t=ii(e),n=zn[t];if("function"!=typeof n||!(t in Hn.prototype))return!1;if(e===n)return!0;var r=oi(n);return!!r&&e===r[0]}(kn&&pi(new kn(new ArrayBuffer(1)))!=A||Sn&&pi(new Sn)!=w||En&&pi(En.resolve())!=M||Mn&&pi(new Mn)!=R||Cn&&pi(new Cn)!=N)&&(pi=function(t){var n=Sr(t),r=n==k?t.constructor:e,o=r?Pi(r):"";if(o)switch(o){case Nn:return A;case _n:return w;case An:return M;case Dn:return R;case $n:return N}return n});var xi=Ae?Qs:yl;function ki(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function Si(e){return e==e&&!ta(e)}function Ei(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in Me(r))}}function Mi(t,n,r){return n=gn(n===e?t.length-1:n,0),function(){for(var e=arguments,o=-1,i=gn(e.length-n,0),s=oe(i);++o<i;)s[o]=e[n+o];o=-1;for(var a=oe(n+1);++o<n;)a[o]=e[o];return a[n]=r(s),Et(t,this,a)}}function Ci(e,t){return t.length<2?e:xr(e,to(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Oi=Ai(Qr),Ti=dt||function(e,t){return ht.setTimeout(e,t)},Ni=Ai(Xr);function _i(e,t,n){var r=t+"";return Ni(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ct(h,function(n){var r="_."+n[0];t&n[1]&&!Nt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(r),n)))}function Ai(t){var n=0,r=0;return function(){var o=bn(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Di(t,n){var r=-1,o=t.length,i=o-1;for(n=n===e?o:n;++r<n;){var s=Wr(r,i),a=t[s];t[s]=t[r],t[r]=a}return t.length=n,t}var $i,Li,Ii,ji=($i=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,function(e,n,r,o){t.push(r?o.replace(ue,"$1"):n||e)}),t},Li=Ls($i,function(e){return 500===Ii.size&&Ii.clear(),e}),Ii=Li.cache,Li);function zi(e){if("string"==typeof e||ca(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Pi(e){if(null!=e){try{return De.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Fi(e){if(e instanceof Hn)return e.clone();var t=new Bn(e.__wrapped__,e.__chain__);return t.__actions__=Oo(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Bi=Jr(function(e,t){return Js(e)?cr(e,mr(t,1,Js,!0)):[]}),Hi=Jr(function(t,n){var r=Zi(n);return Js(r)&&(r=e),Js(t)?cr(t,mr(n,1,Js,!0),ai(r,2)):[]}),Vi=Jr(function(t,n){var r=Zi(n);return Js(r)&&(r=e),Js(t)?cr(t,mr(n,1,Js,!0),e,r):[]});function Ui(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=gn(r+o,0)),Pt(e,ai(t,3),o)}function qi(t,n,r){var o=null==t?0:t.length;if(!o)return-1;var i=o-1;return r!==e&&(i=ma(r),i=r<0?gn(o+i,0):yn(i,o-1)),Pt(t,ai(n,3),i,!0)}function Wi(e){return null!=e&&e.length?mr(e,1):[]}function Yi(t){return t&&t.length?t[0]:e}var Ji=Jr(function(e){var t=At(e,go);return t.length&&t[0]===e[0]?Rr(t):[]}),Ki=Jr(function(t){var n=Zi(t),r=At(t,go);return n===Zi(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Rr(r,ai(n,2)):[]}),Gi=Jr(function(t){var n=Zi(t),r=At(t,go);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Rr(r,e,n):[]});function Zi(t){var n=null==t?0:t.length;return n?t[n-1]:e}var Qi=Jr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Ur(e,t):e}var es=ti(function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,At(t,function(e){return yi(e,n)?+e:e}).sort(Mo)),r});function ts(e){return null==e?e:xn.call(e)}var ns=Jr(function(e){return lo(mr(e,1,Js,!0))}),rs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),lo(mr(t,1,Js,!0),ai(n,2))}),os=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,lo(mr(t,1,Js,!0),e,n)});function is(e){if(!e||!e.length)return[];var t=0;return e=Tt(e,function(e){if(Js(e))return t=gn(e.length,t),!0}),Jt(t,function(t){return At(e,Ut(t))})}function ss(t,n){if(!t||!t.length)return[];var r=is(t);return null==n?r:At(r,function(t){return Et(n,e,t)})}var as=Jr(function(e,t){return Js(e)?cr(e,t):[]}),ls=Jr(function(e){return fo(Tt(e,Js))}),cs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),fo(Tt(t,Js),ai(n,2))}),us=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,fo(Tt(t,Js),e,n)}),ds=Jr(is),hs=Jr(function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,ss(t,r)});function ps(e){var t=zn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ms=ti(function(t){var n=t.length,r=n?t[0]:0,o=this.__wrapped__,i=function(e){return or(e,t)};return!(n>1||this.__actions__.length)&&o instanceof Hn&&yi(r)?((o=o.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[i],thisArg:e}),new Bn(o,this.__chain__).thru(function(t){return n&&!t.length&&t.push(e),t})):this.thru(i)}),gs=No(function(e,t,n){$e.call(e,n)?++e[n]:rr(e,n,1)}),ys=jo(Ui),bs=jo(qi);function vs(e,t){return(qs(e)?Ct:ur)(e,ai(t,3))}function ws(e,t){return(qs(e)?Rt:dr)(e,ai(t,3))}var xs=No(function(e,t,n){$e.call(e,n)?e[n].push(t):rr(e,n,[t])}),ks=Jr(function(e,t,n){var r=-1,o="function"==typeof t,i=Ys(e)?oe(e.length):[];return ur(e,function(e){i[++r]=o?Et(t,e,n):Or(e,t,n)}),i}),Ss=No(function(e,t,n){rr(e,n,t)});function Es(e,t){return(qs(e)?At:jr)(e,ai(t,3))}var Ms=No(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Cs=Jr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,mr(t,1),[])}),Rs=ut||function(){return ht.Date.now()};function Os(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Go(t,s,e,e,e,e,n)}function Ts(n,r){var o;if("function"!=typeof r)throw new Oe(t);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=e),o}}var Ns=Jr(function(e,t,n){var r=1;if(n.length){var i=ln(n,si(Ns));r|=o}return Go(e,r,t,n,i)}),_s=Jr(function(e,t,n){var r=3;if(n.length){var i=ln(n,si(_s));r|=o}return Go(t,r,e,n,i)});function As(n,r,o){var i,s,a,l,c,u,d=0,h=!1,p=!1,f=!0;if("function"!=typeof n)throw new Oe(t);function m(t){var r=i,o=s;return i=s=e,d=t,l=n.apply(o,r)}function g(t){var n=t-u;return u===e||n>=r||n<0||p&&t-d>=a}function y(){var e=Rs();if(g(e))return b(e);c=Ti(y,function(e){var t=r-(e-u);return p?yn(t,a-(e-d)):t}(e))}function b(t){return c=e,f&&i?m(t):(i=s=e,l)}function v(){var t=Rs(),n=g(t);if(i=arguments,s=this,u=t,n){if(c===e)return function(e){return d=e,c=Ti(y,r),h?m(e):l}(u);if(p)return xo(c),c=Ti(y,r),m(u)}return c===e&&(c=Ti(y,r)),l}return r=ya(r)||0,ta(o)&&(h=!!o.leading,a=(p="maxWait"in o)?gn(ya(o.maxWait)||0,r):a,f="trailing"in o?!!o.trailing:f),v.cancel=function(){c!==e&&xo(c),d=0,i=u=s=c=e},v.flush=function(){return c===e?l:b(Rs())},v}var Ds=Jr(function(e,t){return lr(e,1,t)}),$s=Jr(function(e,t,n){return lr(e,ya(t)||0,n)});function Ls(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Oe(t);var r=function(){var t=arguments,o=n?n.apply(this,t):t[0],i=r.cache;if(i.has(o))return i.get(o);var s=e.apply(this,t);return r.cache=i.set(o,s)||i,s};return r.cache=new(Ls.Cache||qn),r}function Is(e){if("function"!=typeof e)throw new Oe(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ls.Cache=qn;var js=vo(function(e,t){var n=(t=1==t.length&&qs(t[0])?At(t[0],Gt(ai())):At(mr(t,1),Gt(ai()))).length;return Jr(function(r){for(var o=-1,i=yn(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return Et(e,this,r)})}),zs=Jr(function(t,n){var r=ln(n,si(zs));return Go(t,o,e,n,r)}),Ps=Jr(function(t,n){var r=ln(n,si(Ps));return Go(t,64,e,n,r)}),Fs=ti(function(t,n){return Go(t,a,e,e,e,n)});function Bs(e,t){return e===t||e!=e&&t!=t}var Hs=qo(Er),Vs=qo(function(e,t){return e>=t}),Us=Tr(function(){return arguments}())?Tr:function(e){return na(e)&&$e.call(e,"callee")&&!Ye.call(e,"callee")},qs=oe.isArray,Ws=bt?Gt(bt):function(e){return na(e)&&Sr(e)==_};function Ys(e){return null!=e&&ea(e.length)&&!Qs(e)}function Js(e){return na(e)&&Ys(e)}var Ks=yt||yl,Gs=vt?Gt(vt):function(e){return na(e)&&Sr(e)==g};function Zs(e){if(!na(e))return!1;var t=Sr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ia(e)}function Qs(e){if(!ta(e))return!1;var t=Sr(e);return t==b||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xs(e){return"number"==typeof e&&e==ma(e)}function ea(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function ta(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function na(e){return null!=e&&"object"==typeof e}var ra=wt?Gt(wt):function(e){return na(e)&&pi(e)==w};function oa(e){return"number"==typeof e||na(e)&&Sr(e)==x}function ia(e){if(!na(e)||Sr(e)!=k)return!1;var t=qe(e);if(null===t)return!0;var n=$e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==ze}var sa=xt?Gt(xt):function(e){return na(e)&&Sr(e)==C},aa=kt?Gt(kt):function(e){return na(e)&&pi(e)==R};function la(e){return"string"==typeof e||!qs(e)&&na(e)&&Sr(e)==O}function ca(e){return"symbol"==typeof e||na(e)&&Sr(e)==T}var ua=St?Gt(St):function(e){return na(e)&&ea(e.length)&&!!it[Sr(e)]},da=qo(Ir),ha=qo(function(e,t){return e<=t});function pa(e){if(!e)return[];if(Ys(e))return la(e)?dn(e):Oo(e);if(Ge&&e[Ge])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ge]());var t=pi(e);return(t==w?sn:t==R?cn:Ba)(e)}function fa(e){return e?(e=ya(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ma(e){var t=fa(e),n=t%1;return t==t?n?t-n:t:0}function ga(e){return e?ir(ma(e),0,d):0}function ya(e){if("number"==typeof e)return e;if(ca(e))return u;if(ta(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ta(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=fe.test(e);return n||ge.test(e)?ct(e.slice(2),n?2:8):pe.test(e)?u:+e}function ba(e){return To(e,Da(e))}function va(e){return null==e?"":ao(e)}var wa=_o(function(e,t){if(ki(t)||Ys(t))To(t,Aa(t),e);else for(var n in t)$e.call(t,n)&&Xn(e,n,t[n])}),xa=_o(function(e,t){To(t,Da(t),e)}),ka=_o(function(e,t,n,r){To(t,Da(t),e,r)}),Sa=_o(function(e,t,n,r){To(t,Aa(t),e,r)}),Ea=ti(or),Ma=Jr(function(t,n){t=Me(t);var r=-1,o=n.length,i=o>2?n[2]:e;for(i&&bi(n[0],n[1],i)&&(o=1);++r<o;)for(var s=n[r],a=Da(s),l=-1,c=a.length;++l<c;){var u=a[l],d=t[u];(d===e||Bs(d,_e[u])&&!$e.call(t,u))&&(t[u]=s[u])}return t}),Ca=Jr(function(t){return t.push(e,Qo),Et(La,e,t)});function Ra(t,n,r){var o=null==t?e:xr(t,n);return o===e?r:o}function Oa(e,t){return null!=e&&fi(e,t,Cr)}var Ta=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=n},tl(ol)),Na=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),$e.call(e,t)?e[t].push(n):e[t]=[n]},ai),_a=Jr(Or);function Aa(e){return Ys(e)?Jn(e):$r(e)}function Da(e){return Ys(e)?Jn(e,!0):Lr(e)}var $a=_o(function(e,t,n){Fr(e,t,n)}),La=_o(function(e,t,n,r){Fr(e,t,n,r)}),Ia=ti(function(e,t){var n={};if(null==e)return n;var r=!1;t=At(t,function(t){return t=bo(t,e),r||(r=t.length>1),t}),To(e,ri(e),n),r&&(n=sr(n,7,Xo));for(var o=t.length;o--;)co(n,t[o]);return n}),ja=ti(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Oa(e,n)})}(e,t)});function za(e,t){if(null==e)return{};var n=At(ri(e),function(e){return[e]});return t=ai(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Pa=Ko(Aa),Fa=Ko(Da);function Ba(e){return null==e?[]:Zt(e,Aa(e))}var Ha=Lo(function(e,t,n){return t=t.toLowerCase(),e+(n?Va(t):t)});function Va(e){return Za(va(e).toLowerCase())}function Ua(e){return(e=va(e))&&e.replace(be,tn).replace(Qe,"")}var qa=Lo(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Wa=Lo(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Ya=$o("toLowerCase"),Ja=Lo(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Ka=Lo(function(e,t,n){return e+(n?" ":"")+Za(t)}),Ga=Lo(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Za=$o("toUpperCase");function Qa(t,n,r){return t=va(t),(n=r?e:n)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(et)||[]}(t):function(e){return e.match(le)||[]}(t):t.match(n)||[]}var Xa=Jr(function(t,n){try{return Et(t,e,n)}catch(r){return Zs(r)?r:new ke(r)}}),el=ti(function(e,t){return Ct(t,function(t){t=zi(t),rr(e,t,Ns(e[t],e))}),e});function tl(e){return function(){return e}}var nl=zo(),rl=zo(!0);function ol(e){return e}function il(e){return Dr("function"==typeof e?e:sr(e,1))}var sl=Jr(function(e,t){return function(n){return Or(n,e,t)}}),al=Jr(function(e,t){return function(n){return Or(e,n,t)}});function ll(e,t,n){var r=Aa(t),o=wr(t,r);null!=n||ta(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=wr(t,Aa(t)));var i=!(ta(n)&&"chain"in n&&!n.chain),s=Qs(e);return Ct(o,function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Oo(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Dt([this.value()],arguments))})}),e}function cl(){}var ul=Ho(At),dl=Ho(Ot),hl=Ho(It);function pl(e){return vi(e)?Ut(zi(e)):function(e){return function(t){return xr(t,e)}}(e)}var fl=Uo(),ml=Uo(!0);function gl(){return[]}function yl(){return!1}var bl,vl=Bo(function(e,t){return e+t},0),wl=Yo("ceil"),xl=Bo(function(e,t){return e/t},1),kl=Yo("floor"),Sl=Bo(function(e,t){return e*t},1),El=Yo("round"),Ml=Bo(function(e,t){return e-t},0);return zn.after=function(e,n){if("function"!=typeof n)throw new Oe(t);return e=ma(e),function(){if(--e<1)return n.apply(this,arguments)}},zn.ary=Os,zn.assign=wa,zn.assignIn=xa,zn.assignInWith=ka,zn.assignWith=Sa,zn.at=Ea,zn.before=Ts,zn.bind=Ns,zn.bindAll=el,zn.bindKey=_s,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qs(e)?e:[e]},zn.chain=ps,zn.chunk=function(t,n,r){n=(r?bi(t,n,r):n===e)?1:gn(ma(n),0);var o=null==t?0:t.length;if(!o||n<1)return[];for(var i=0,s=0,a=oe(pt(o/n));i<o;)a[s++]=to(t,i,i+=n);return a},zn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},zn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=oe(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Dt(qs(n)?Oo(n):[n],mr(t,1))},zn.cond=function(e){var n=null==e?0:e.length,r=ai();return e=n?At(e,function(e){if("function"!=typeof e[1])throw new Oe(t);return[r(e[0]),e[1]]}):[],Jr(function(t){for(var r=-1;++r<n;){var o=e[r];if(Et(o[0],this,t))return Et(o[1],this,t)}})},zn.conforms=function(e){return function(e){var t=Aa(e);return function(n){return ar(n,e,t)}}(sr(e,1))},zn.constant=tl,zn.countBy=gs,zn.create=function(e,t){var n=Pn(e);return null==t?n:nr(n,t)},zn.curry=function t(n,r,o){var i=Go(n,8,e,e,e,e,e,r=o?e:r);return i.placeholder=t.placeholder,i},zn.curryRight=function t(n,r,o){var i=Go(n,16,e,e,e,e,e,r=o?e:r);return i.placeholder=t.placeholder,i},zn.debounce=As,zn.defaults=Ma,zn.defaultsDeep=Ca,zn.defer=Ds,zn.delay=$s,zn.difference=Bi,zn.differenceBy=Hi,zn.differenceWith=Vi,zn.drop=function(t,n,r){var o=null==t?0:t.length;return o?to(t,(n=r||n===e?1:ma(n))<0?0:n,o):[]},zn.dropRight=function(t,n,r){var o=null==t?0:t.length;return o?to(t,0,(n=o-(n=r||n===e?1:ma(n)))<0?0:n):[]},zn.dropRightWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!0):[]},zn.fill=function(t,n,r,o){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&bi(t,n,r)&&(r=0,o=i),function(t,n,r,o){var i=t.length;for((r=ma(r))<0&&(r=-r>i?0:i+r),(o=o===e||o>i?i:ma(o))<0&&(o+=i),o=r>o?0:ga(o);r<o;)t[r++]=n;return t}(t,n,r,o)):[]},zn.filter=function(e,t){return(qs(e)?Tt:fr)(e,ai(t,3))},zn.flatMap=function(e,t){return mr(Es(e,t),1)},zn.flatMapDeep=function(e,t){return mr(Es(e,t),l)},zn.flatMapDepth=function(t,n,r){return r=r===e?1:ma(r),mr(Es(t,n),r)},zn.flatten=Wi,zn.flattenDeep=function(e){return null!=e&&e.length?mr(e,l):[]},zn.flattenDepth=function(t,n){return null!=t&&t.length?mr(t,n=n===e?1:ma(n)):[]},zn.flip=function(e){return Go(e,512)},zn.flow=nl,zn.flowRight=rl,zn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},zn.functions=function(e){return null==e?[]:wr(e,Aa(e))},zn.functionsIn=function(e){return null==e?[]:wr(e,Da(e))},zn.groupBy=xs,zn.initial=function(e){return null!=e&&e.length?to(e,0,-1):[]},zn.intersection=Ji,zn.intersectionBy=Ki,zn.intersectionWith=Gi,zn.invert=Ta,zn.invertBy=Na,zn.invokeMap=ks,zn.iteratee=il,zn.keyBy=Ss,zn.keys=Aa,zn.keysIn=Da,zn.map=Es,zn.mapKeys=function(e,t){var n={};return t=ai(t,3),br(e,function(e,r,o){rr(n,t(e,r,o),e)}),n},zn.mapValues=function(e,t){var n={};return t=ai(t,3),br(e,function(e,r,o){rr(n,r,t(e,r,o))}),n},zn.matches=function(e){return zr(sr(e,1))},zn.matchesProperty=function(e,t){return Pr(e,sr(t,1))},zn.memoize=Ls,zn.merge=$a,zn.mergeWith=La,zn.method=sl,zn.methodOf=al,zn.mixin=ll,zn.negate=Is,zn.nthArg=function(e){return e=ma(e),Jr(function(t){return Br(t,e)})},zn.omit=Ia,zn.omitBy=function(e,t){return za(e,Is(ai(t)))},zn.once=function(e){return Ts(2,e)},zn.orderBy=function(t,n,r,o){return null==t?[]:(qs(n)||(n=null==n?[]:[n]),qs(r=o?e:r)||(r=null==r?[]:[r]),Hr(t,n,r))},zn.over=ul,zn.overArgs=js,zn.overEvery=dl,zn.overSome=hl,zn.partial=zs,zn.partialRight=Ps,zn.partition=Ms,zn.pick=ja,zn.pickBy=za,zn.property=pl,zn.propertyOf=function(t){return function(n){return null==t?e:xr(t,n)}},zn.pull=Qi,zn.pullAll=Xi,zn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ur(e,t,ai(n,2)):e},zn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?Ur(t,n,e,r):t},zn.pullAt=es,zn.range=fl,zn.rangeRight=ml,zn.rearg=Fs,zn.reject=function(e,t){return(qs(e)?Tt:fr)(e,Is(ai(t,3)))},zn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=ai(t,3);++r<i;){var s=e[r];t(s,r,e)&&(n.push(s),o.push(r))}return qr(e,o),n},zn.rest=function(n,r){if("function"!=typeof n)throw new Oe(t);return Jr(n,r=r===e?r:ma(r))},zn.reverse=ts,zn.sampleSize=function(t,n,r){return n=(r?bi(t,n,r):n===e)?1:ma(n),(qs(t)?Gn:Gr)(t,n)},zn.set=function(e,t,n){return null==e?e:Zr(e,t,n)},zn.setWith=function(t,n,r,o){return o="function"==typeof o?o:e,null==t?t:Zr(t,n,r,o)},zn.shuffle=function(e){return(qs(e)?Zn:eo)(e)},zn.slice=function(t,n,r){var o=null==t?0:t.length;return o?(r&&"number"!=typeof r&&bi(t,n,r)?(n=0,r=o):(n=null==n?0:ma(n),r=r===e?o:ma(r)),to(t,n,r)):[]},zn.sortBy=Cs,zn.sortedUniq=function(e){return e&&e.length?io(e):[]},zn.sortedUniqBy=function(e,t){return e&&e.length?io(e,ai(t,2)):[]},zn.split=function(t,n,r){return r&&"number"!=typeof r&&bi(t,n,r)&&(n=r=e),(r=r===e?d:r>>>0)?(t=va(t))&&("string"==typeof n||null!=n&&!sa(n))&&!(n=ao(n))&&on(t)?wo(dn(t),0,r):t.split(n,r):[]},zn.spread=function(e,n){if("function"!=typeof e)throw new Oe(t);return n=null==n?0:gn(ma(n),0),Jr(function(t){var r=t[n],o=wo(t,0,n);return r&&Dt(o,r),Et(e,this,o)})},zn.tail=function(e){var t=null==e?0:e.length;return t?to(e,1,t):[]},zn.take=function(t,n,r){return t&&t.length?to(t,0,(n=r||n===e?1:ma(n))<0?0:n):[]},zn.takeRight=function(t,n,r){var o=null==t?0:t.length;return o?to(t,(n=o-(n=r||n===e?1:ma(n)))<0?0:n,o):[]},zn.takeRightWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?ho(e,ai(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,n,r){var o=!0,i=!0;if("function"!=typeof e)throw new Oe(t);return ta(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),As(e,n,{leading:o,maxWait:n,trailing:i})},zn.thru=fs,zn.toArray=pa,zn.toPairs=Pa,zn.toPairsIn=Fa,zn.toPath=function(e){return qs(e)?At(e,zi):ca(e)?[e]:Oo(ji(va(e)))},zn.toPlainObject=ba,zn.transform=function(e,t,n){var r=qs(e),o=r||Ks(e)||ua(e);if(t=ai(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ta(e)&&Qs(i)?Pn(qe(e)):{}}return(o?Ct:br)(e,function(e,r,o){return t(n,e,r,o)}),n},zn.unary=function(e){return Os(e,1)},zn.union=ns,zn.unionBy=rs,zn.unionWith=os,zn.uniq=function(e){return e&&e.length?lo(e):[]},zn.uniqBy=function(e,t){return e&&e.length?lo(e,ai(t,2)):[]},zn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?lo(t,e,n):[]},zn.unset=function(e,t){return null==e||co(e,t)},zn.unzip=is,zn.unzipWith=ss,zn.update=function(e,t,n){return null==e?e:uo(e,t,yo(n))},zn.updateWith=function(t,n,r,o){return o="function"==typeof o?o:e,null==t?t:uo(t,n,yo(r),o)},zn.values=Ba,zn.valuesIn=function(e){return null==e?[]:Zt(e,Da(e))},zn.without=as,zn.words=Qa,zn.wrap=function(e,t){return zs(yo(t),e)},zn.xor=ls,zn.xorBy=cs,zn.xorWith=us,zn.zip=ds,zn.zipObject=function(e,t){return mo(e||[],t||[],Xn)},zn.zipObjectDeep=function(e,t){return mo(e||[],t||[],Zr)},zn.zipWith=hs,zn.entries=Pa,zn.entriesIn=Fa,zn.extend=xa,zn.extendWith=ka,ll(zn,zn),zn.add=vl,zn.attempt=Xa,zn.camelCase=Ha,zn.capitalize=Va,zn.ceil=wl,zn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=ya(r))==r?r:0),n!==e&&(n=(n=ya(n))==n?n:0),ir(ya(t),n,r)},zn.clone=function(e){return sr(e,4)},zn.cloneDeep=function(e){return sr(e,5)},zn.cloneDeepWith=function(t,n){return sr(t,5,n="function"==typeof n?n:e)},zn.cloneWith=function(t,n){return sr(t,4,n="function"==typeof n?n:e)},zn.conformsTo=function(e,t){return null==t||ar(e,t,Aa(t))},zn.deburr=Ua,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=xl,zn.endsWith=function(t,n,r){t=va(t),n=ao(n);var o=t.length,i=r=r===e?o:ir(ma(r),0,o);return(r-=n.length)>=0&&t.slice(r,i)==n},zn.eq=Bs,zn.escape=function(e){return(e=va(e))&&J.test(e)?e.replace(W,nn):e},zn.escapeRegExp=function(e){return(e=va(e))&&ne.test(e)?e.replace(te,"\\$&"):e},zn.every=function(t,n,r){var o=qs(t)?Ot:hr;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.find=ys,zn.findIndex=Ui,zn.findKey=function(e,t){return zt(e,ai(t,3),br)},zn.findLast=bs,zn.findLastIndex=qi,zn.findLastKey=function(e,t){return zt(e,ai(t,3),vr)},zn.floor=kl,zn.forEach=vs,zn.forEachRight=ws,zn.forIn=function(e,t){return null==e?e:gr(e,ai(t,3),Da)},zn.forInRight=function(e,t){return null==e?e:yr(e,ai(t,3),Da)},zn.forOwn=function(e,t){return e&&br(e,ai(t,3))},zn.forOwnRight=function(e,t){return e&&vr(e,ai(t,3))},zn.get=Ra,zn.gt=Hs,zn.gte=Vs,zn.has=function(e,t){return null!=e&&fi(e,t,Mr)},zn.hasIn=Oa,zn.head=Yi,zn.identity=ol,zn.includes=function(e,t,n,r){e=Ys(e)?e:Ba(e),n=n&&!r?ma(n):0;var o=e.length;return n<0&&(n=gn(o+n,0)),la(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Ft(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=gn(r+o,0)),Ft(e,t,o)},zn.inRange=function(t,n,r){return n=fa(n),r===e?(r=n,n=0):r=fa(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(t=ya(t),n,r)},zn.invoke=_a,zn.isArguments=Us,zn.isArray=qs,zn.isArrayBuffer=Ws,zn.isArrayLike=Ys,zn.isArrayLikeObject=Js,zn.isBoolean=function(e){return!0===e||!1===e||na(e)&&Sr(e)==m},zn.isBuffer=Ks,zn.isDate=Gs,zn.isElement=function(e){return na(e)&&1===e.nodeType&&!ia(e)},zn.isEmpty=function(e){if(null==e)return!0;if(Ys(e)&&(qs(e)||"string"==typeof e||"function"==typeof e.splice||Ks(e)||ua(e)||Us(e)))return!e.length;var t=pi(e);if(t==w||t==R)return!e.size;if(ki(e))return!$r(e).length;for(var n in e)if($e.call(e,n))return!1;return!0},zn.isEqual=function(e,t){return Nr(e,t)},zn.isEqualWith=function(t,n,r){var o=(r="function"==typeof r?r:e)?r(t,n):e;return o===e?Nr(t,n,e,r):!!o},zn.isError=Zs,zn.isFinite=function(e){return"number"==typeof e&&jt(e)},zn.isFunction=Qs,zn.isInteger=Xs,zn.isLength=ea,zn.isMap=ra,zn.isMatch=function(e,t){return e===t||_r(e,t,ci(t))},zn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,_r(t,n,ci(n),r)},zn.isNaN=function(e){return oa(e)&&e!=+e},zn.isNative=function(e){if(xi(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ar(e)},zn.isNil=function(e){return null==e},zn.isNull=function(e){return null===e},zn.isNumber=oa,zn.isObject=ta,zn.isObjectLike=na,zn.isPlainObject=ia,zn.isRegExp=sa,zn.isSafeInteger=function(e){return Xs(e)&&e>=-9007199254740991&&e<=c},zn.isSet=aa,zn.isString=la,zn.isSymbol=ca,zn.isTypedArray=ua,zn.isUndefined=function(t){return t===e},zn.isWeakMap=function(e){return na(e)&&pi(e)==N},zn.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":qt.call(e,t)},zn.kebabCase=qa,zn.last=Zi,zn.lastIndexOf=function(t,n,r){var o=null==t?0:t.length;if(!o)return-1;var i=o;return r!==e&&(i=(i=ma(r))<0?gn(o+i,0):yn(i,o-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,i):Pt(t,Ht,i,!0)},zn.lowerCase=Wa,zn.lowerFirst=Ya,zn.lt=da,zn.lte=ha,zn.max=function(t){return t&&t.length?pr(t,ol,Er):e},zn.maxBy=function(t,n){return t&&t.length?pr(t,ai(n,2),Er):e},zn.mean=function(e){return Vt(e,ol)},zn.meanBy=function(e,t){return Vt(e,ai(t,2))},zn.min=function(t){return t&&t.length?pr(t,ol,Ir):e},zn.minBy=function(t,n){return t&&t.length?pr(t,ai(n,2),Ir):e},zn.stubArray=gl,zn.stubFalse=yl,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Sl,zn.nth=function(t,n){return t&&t.length?Br(t,ma(n)):e},zn.noConflict=function(){return ht._===this&&(ht._=Pe),this},zn.noop=cl,zn.now=Rs,zn.pad=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Vo(ft(o),n)+e+Vo(pt(o),n)},zn.padEnd=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;return t&&r<t?e+Vo(t-r,n):e},zn.padStart=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;return t&&r<t?Vo(t-r,n)+e:e},zn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),vn(va(e).replace(re,""),t||0)},zn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&bi(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=fa(t),n===e?(n=t,t=0):n=fa(n)),t>n){var o=t;t=n,n=o}if(r||t%1||n%1){var i=wn();return yn(t+i*(n-t+lt("1e-"+((i+"").length-1))),n)}return Wr(t,n)},zn.reduce=function(e,t,n){var r=qs(e)?$t:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,ur)},zn.reduceRight=function(e,t,n){var r=qs(e)?Lt:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,dr)},zn.repeat=function(t,n,r){return n=(r?bi(t,n,r):n===e)?1:ma(n),Yr(va(t),n)},zn.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(t,n,r){var o=-1,i=(n=bo(n,t)).length;for(i||(i=1,t=e);++o<i;){var s=null==t?e:t[zi(n[o])];s===e&&(o=i,s=r),t=Qs(s)?s.call(t):s}return t},zn.round=El,zn.runInContext=i,zn.sample=function(e){return(qs(e)?Kn:Kr)(e)},zn.size=function(e){if(null==e)return 0;if(Ys(e))return la(e)?un(e):e.length;var t=pi(e);return t==w||t==R?e.size:$r(e).length},zn.snakeCase=Ja,zn.some=function(t,n,r){var o=qs(t)?It:no;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.sortedIndex=function(e,t){return ro(e,t)},zn.sortedIndexBy=function(e,t,n){return oo(e,t,ai(n,2))},zn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ro(e,t);if(r<n&&Bs(e[r],t))return r}return-1},zn.sortedLastIndex=function(e,t){return ro(e,t,!0)},zn.sortedLastIndexBy=function(e,t,n){return oo(e,t,ai(n,2),!0)},zn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ro(e,t,!0)-1;if(Bs(e[n],t))return n}return-1},zn.startCase=Ka,zn.startsWith=function(e,t,n){return e=va(e),n=null==n?0:ir(ma(n),0,e.length),t=ao(t),e.slice(n,n+t.length)==t},zn.subtract=Ml,zn.sum=function(e){return e&&e.length?Yt(e,ol):0},zn.sumBy=function(e,t){return e&&e.length?Yt(e,ai(t,2)):0},zn.template=function(t,n,r){var o=zn.templateSettings;r&&bi(t,n,r)&&(n=e),t=va(t),n=ka({},n,o,Zo);var i,s,a=ka({},n.imports,o.imports,Zo),l=Aa(a),c=Zt(a,l),u=0,d=n.interpolate||ve,h="__p += '",p=Ce((n.escape||ve).source+"|"+d.source+"|"+(d===Z?de:ve).source+"|"+(n.evaluate||ve).source+"|$","g"),f="//# sourceURL="+($e.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";t.replace(p,function(e,n,r,o,a,l){return r||(r=o),h+=t.slice(u,l).replace(we,rn),n&&(i=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+e.length,e}),h+="';\n";var m=$e.call(n,"variable")&&n.variable;if(m){if(ce.test(m))throw new ke("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(H,""):h).replace(V,"$1").replace(U,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Xa(function(){return Se(l,f+"return "+h).apply(e,c)});if(g.source=h,Zs(g))throw g;return g},zn.times=function(e,t){if((e=ma(e))<1||e>c)return[];var n=d,r=yn(e,d);t=ai(t),e-=d;for(var o=Jt(r,t);++n<e;)t(n);return o},zn.toFinite=fa,zn.toInteger=ma,zn.toLength=ga,zn.toLower=function(e){return va(e).toLowerCase()},zn.toNumber=ya,zn.toSafeInteger=function(e){return e?ir(ma(e),-9007199254740991,c):0===e?e:0},zn.toString=va,zn.toUpper=function(e){return va(e).toUpperCase()},zn.trim=function(t,n,r){if((t=va(t))&&(r||n===e))return Kt(t);if(!t||!(n=ao(n)))return t;var o=dn(t),i=dn(n);return wo(o,Xt(o,i),en(o,i)+1).join("")},zn.trimEnd=function(t,n,r){if((t=va(t))&&(r||n===e))return t.slice(0,hn(t)+1);if(!t||!(n=ao(n)))return t;var o=dn(t);return wo(o,0,en(o,dn(n))+1).join("")},zn.trimStart=function(t,n,r){if((t=va(t))&&(r||n===e))return t.replace(re,"");if(!t||!(n=ao(n)))return t;var o=dn(t);return wo(o,Xt(o,dn(n))).join("")},zn.truncate=function(t,n){var r=30,o="...";if(ta(n)){var i="separator"in n?n.separator:i;r="length"in n?ma(n.length):r,o="omission"in n?ao(n.omission):o}var s=(t=va(t)).length;if(on(t)){var a=dn(t);s=a.length}if(r>=s)return t;var l=r-un(o);if(l<1)return o;var c=a?wo(a,0,l).join(""):t.slice(0,l);if(i===e)return c+o;if(a&&(l+=c.length-l),sa(i)){if(t.slice(l).search(i)){var u,d=c;for(i.global||(i=Ce(i.source,va(he.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var h=u.index;c=c.slice(0,h===e?l:h)}}else if(t.indexOf(ao(i),l)!=l){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+o},zn.unescape=function(e){return(e=va(e))&&Y.test(e)?e.replace(q,pn):e},zn.uniqueId=function(e){var t=++Le;return va(e)+t},zn.upperCase=Ga,zn.upperFirst=Za,zn.each=vs,zn.eachRight=ws,zn.first=Yi,ll(zn,(bl={},br(zn,function(e,t){$e.call(zn.prototype,t)||(bl[t]=e)}),bl),{chain:!1}),zn.VERSION="4.17.23",Ct(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){zn[e].placeholder=zn}),Ct(["drop","take"],function(t,n){Hn.prototype[t]=function(r){r=r===e?1:gn(ma(r),0);var o=this.__filtered__&&!n?new Hn(this):this.clone();return o.__filtered__?o.__takeCount__=yn(r,o.__takeCount__):o.__views__.push({size:yn(r,d),type:t+(o.__dir__<0?"Right":"")}),o},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ct(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Hn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ai(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Ct(["head","last"],function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}}),Ct(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Hn.prototype[e]=function(){return this.__filtered__?new Hn(this):this[n](1)}}),Hn.prototype.compact=function(){return this.filter(ol)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=Jr(function(e,t){return"function"==typeof e?new Hn(this):this.map(function(n){return Or(n,e,t)})}),Hn.prototype.reject=function(e){return this.filter(Is(ai(e)))},Hn.prototype.slice=function(t,n){t=ma(t);var r=this;return r.__filtered__&&(t>0||n<0)?new Hn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=ma(n))<0?r.dropRight(-n):r.take(n-t)),r)},Hn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hn.prototype.toArray=function(){return this.take(d)},br(Hn.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),o=/^(?:head|last)$/.test(n),i=zn[o?"take"+("last"==n?"Right":""):n],s=o||/^find/.test(n);i&&(zn.prototype[n]=function(){var n=this.__wrapped__,a=o?[1]:arguments,l=n instanceof Hn,c=a[0],u=l||qs(n),d=function(e){var t=i.apply(zn,Dt([e],a));return o&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,m=l&&!p;if(!s&&u){n=m?n:new Hn(this);var g=t.apply(n,a);return g.__actions__.push({func:fs,args:[d],thisArg:e}),new Bn(g,h)}return f&&m?t.apply(this,a):(g=this.thru(d),f?o?g.value()[0]:g.value():g)})}),Ct(["pop","push","shift","sort","splice","unshift"],function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(qs(o)?o:[],e)}return this[n](function(n){return t.apply(qs(n)?n:[],e)})}}),br(Hn.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";$e.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}}),Tn[Po(e,2).name]=[{name:"wrapper",func:e}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Oo(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Oo(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Oo(this.__views__),e},Hn.prototype.reverse=function(){if(this.__filtered__){var e=new Hn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qs(e),r=t<0,o=n?e.length:0,i=function(e,t,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=yn(t,e+s);break;case"takeRight":e=gn(e,t-s)}}return{start:e,end:t}}(0,o,this.__views__),s=i.start,a=i.end,l=a-s,c=r?a:s-1,u=this.__iteratees__,d=u.length,h=0,p=yn(l,this.__takeCount__);if(!n||!r&&o==l&&p==l)return po(e,this.__actions__);var f=[];e:for(;l--&&h<p;){for(var m=-1,g=e[c+=t];++m<d;){var y=u[m],b=y.iteratee,v=y.type,w=b(g);if(2==v)g=w;else if(!w){if(1==v)continue e;break e}}f[h++]=g}return f},zn.prototype.at=ms,zn.prototype.chain=function(){return ps(this)},zn.prototype.commit=function(){return new Bn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===e&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},zn.prototype.plant=function(t){for(var n,r=this;r instanceof Fn;){var o=Fi(r);o.__index__=0,o.__values__=e,n?i.__wrapped__=o:n=o;var i=o;r=r.__wrapped__}return i.__wrapped__=t,n},zn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var n=t;return this.__actions__.length&&(n=new Hn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[ts],thisArg:e}),new Bn(n,this.__chain__)}return this.thru(ts)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return po(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Ge&&(zn.prototype[Ge]=function(){return this}),zn}();ft?((ft.exports=fn)._=fn,pt._=fn):ht._=fn}.call(M.exports));const _=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),A="-",D=[],$=e=>{const t=j(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return I(e);const n=e.split(A),r=""===n[0]&&n.length>1?1:0;return L(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],o=n[e];return t?o?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(o,t):t:o||D}return n[e]||D}}},L=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=L(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(A):e.slice(t).join(A),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},I=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),j=e=>{const{theme:t,classGroups:n}=e;return z(n,t)},z=(e,t)=>{const n=_();for(const r in e){const o=e[r];P(o,n,r,t)}return n},P=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];F(o,t,n,r)}},F=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?V(e,t,n,r):H(e,t,n,r):B(e,t,n)},B=(e,t,n)=>{(""===e?t:U(t,e)).classGroupId=n},H=(e,t,n,r)=>{q(e)?P(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},V=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];P(i,U(t,e),n,r)}},U=(e,t)=>{let n=e;const r=t.split(A),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=_(),n.nextPart.set(e,t)),n=t}return n},q=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,W=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set(e,t){e in n?n[e]=t:o(e,t)}}},Y=[],J=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),K=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,i=0;const s=e.length;for(let u=0;u<s;u++){const s=e[u];if(0===r&&0===o){if(":"===s){t.push(e.slice(i,u)),i=u+1;continue}if("/"===s){n=u;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.slice(i);let l=a,c=!1;a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0);return J(t,c,l,n&&n>i?n-i:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):J(Y,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},G=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let o=0;o<e.length;o++){const i=e[o],s="["===i[0],a=t.has(i);s||a?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(i)):r.push(i)}return r.length>0&&(r.sort(),n.push(...r)),n}},Z=/\s+/,Q=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Q(e[r]))&&(n&&(n+=" "),n+=t);return n},X=[],ee=e=>{const t=t=>t[e]||X;return t.isThemeGetter=!0,t},te=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,re=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,oe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,se=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,le=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=e=>re.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),de=e=>!!e&&Number.isInteger(Number(e)),he=e=>e.endsWith("%")&&ue(e.slice(0,-1)),pe=e=>oe.test(e),fe=()=>!0,me=e=>ie.test(e)&&!se.test(e),ge=()=>!1,ye=e=>ae.test(e),be=e=>le.test(e),ve=e=>!xe(e)&&!Te(e),we=e=>je(e,Be,ge),xe=e=>te.test(e),ke=e=>je(e,He,me),Se=e=>je(e,Ve,ue),Ee=e=>je(e,qe,fe),Me=e=>je(e,Ue,ge),Ce=e=>je(e,Pe,ge),Re=e=>je(e,Fe,be),Oe=e=>je(e,We,ye),Te=e=>ne.test(e),Ne=e=>ze(e,He),_e=e=>ze(e,Ue),Ae=e=>ze(e,Pe),De=e=>ze(e,Be),$e=e=>ze(e,Fe),Le=e=>ze(e,We,!0),Ie=e=>ze(e,qe,!0),je=(e,t,n)=>{const r=te.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},ze=(e,t,n=!1)=>{const r=ne.exec(e);return!!r&&(r[1]?t(r[1]):n)},Pe=e=>"position"===e||"percentage"===e,Fe=e=>"image"===e||"url"===e,Be=e=>"length"===e||"size"===e||"bg-size"===e,He=e=>"length"===e,Ve=e=>"number"===e,Ue=e=>"family-name"===e,qe=e=>"number"===e||"weight"===e,We=e=>"shadow"===e,Ye=((e,...t)=>{let n,r,o,i;const s=e=>{const t=r(e);if(t)return t;const i=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(Z);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let f=!!p,m=r(f?h.substring(0,p):h);if(!m){if(!f){l=e+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=e+(l.length>0?" "+l:l);continue}f=!1}const g=0===u.length?"":1===u.length?u[0]:i(u).join(":"),y=d?g+"!":g,b=y+m;if(s.indexOf(b)>-1)continue;s.push(b);const v=o(m,f);for(let n=0;n<v.length;++n){const e=v[n];s.push(y+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i};return i=a=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:W(e.cacheSize),parseClassName:K(e),sortModifiers:G(e),...$(e)}))(l),r=n.cache.get,o=n.cache.set,i=s,s(a)},(...e)=>i(((...e)=>{let t,n,r=0,o="";for(;r<e.length;)(t=e[r++])&&(n=Q(t))&&(o&&(o+=" "),o+=n);return o})(...e))})(()=>{const e=ee("color"),t=ee("font"),n=ee("text"),r=ee("font-weight"),o=ee("tracking"),i=ee("leading"),s=ee("breakpoint"),a=ee("container"),l=ee("spacing"),c=ee("radius"),u=ee("shadow"),d=ee("inset-shadow"),h=ee("text-shadow"),p=ee("drop-shadow"),f=ee("blur"),m=ee("perspective"),g=ee("aspect"),y=ee("ease"),b=ee("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Te,xe],w=()=>[Te,xe,l],x=()=>[ce,"full","auto",...w()],k=()=>[de,"none","subgrid",Te,xe],S=()=>["auto",{span:["full",de,Te,xe]},de,Te,xe],E=()=>[de,"auto",Te,xe],M=()=>["auto","min","max","fr",Te,xe],C=()=>["auto",...w()],R=()=>[ce,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],O=()=>[ce,"screen","full","dvw","lvw","svw","min","max","fit",...w()],T=()=>[ce,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],N=()=>[e,Te,xe],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ae,Ce,{position:[Te,xe]}],A=()=>["auto","cover","contain",De,we,{size:[Te,xe]}],D=()=>[he,Ne,ke],$=()=>["","none","full",c,Te,xe],L=()=>["",ue,Ne,ke],I=()=>[ue,he,Ae,Ce],j=()=>["","none",f,Te,xe],z=()=>["none",ue,Te,xe],P=()=>["none",ue,Te,xe],F=()=>[ue,Te,xe],B=()=>[ce,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pe],breakpoint:[pe],color:[fe],container:[pe],"drop-shadow":[pe],ease:["in","out","in-out"],font:[ve],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pe],shadow:[pe],spacing:["px",ue],text:[pe],"text-shadow":[pe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ce,xe,Te,g]}],container:["container"],columns:[{columns:[ue,xe,Te,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[de,"auto",Te,xe]}],basis:[{basis:[ce,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,ce,"auto","initial","none",xe]}],grow:[{grow:["",ue,Te,xe]}],shrink:[{shrink:["",ue,Te,xe]}],order:[{order:[de,"first","last","none",Te,xe]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mbs:[{mbs:C()}],mbe:[{mbe:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...T()]}],"min-block-size":[{"min-block":["auto",...T()]}],"max-block-size":[{"max-block":["none",...T()]}],w:[{w:[a,"screen",...R()]}],"min-w":[{"min-w":[a,"screen","none",...R()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Ne,ke]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ie,Ee]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",he,xe]}],"font-family":[{font:[_e,Me,t]}],"font-features":[{"font-features":[xe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Te,xe]}],"line-clamp":[{"line-clamp":[ue,"none",Te,Se]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Te,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Te,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",Te,ke]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[ue,"auto",Te,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},de,Te,xe],radial:["",Te,xe],conic:[de,Te,xe]},$e,Re]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[ue,Te,xe]}],"outline-w":[{outline:["",ue,Ne,ke]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",u,Le,Oe]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",d,Le,Oe]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[ue,ke]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",h,Le,Oe]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[ue,Te,xe]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Te,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Te,xe]}],filter:[{filter:["","none",Te,xe]}],blur:[{blur:j()}],brightness:[{brightness:[ue,Te,xe]}],contrast:[{contrast:[ue,Te,xe]}],"drop-shadow":[{"drop-shadow":["","none",p,Le,Oe]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",ue,Te,xe]}],"hue-rotate":[{"hue-rotate":[ue,Te,xe]}],invert:[{invert:["",ue,Te,xe]}],saturate:[{saturate:[ue,Te,xe]}],sepia:[{sepia:["",ue,Te,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Te,xe]}],"backdrop-blur":[{"backdrop-blur":j()}],"backdrop-brightness":[{"backdrop-brightness":[ue,Te,xe]}],"backdrop-contrast":[{"backdrop-contrast":[ue,Te,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,Te,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,Te,xe]}],"backdrop-invert":[{"backdrop-invert":["",ue,Te,xe]}],"backdrop-opacity":[{"backdrop-opacity":[ue,Te,xe]}],"backdrop-saturate":[{"backdrop-saturate":[ue,Te,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,Te,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Te,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",Te,xe]}],ease:[{ease:["linear","initial",y,Te,xe]}],delay:[{delay:[ue,Te,xe]}],animate:[{animate:["none",b,Te,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Te,xe]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:z()}],"rotate-x":[{"rotate-x":z()}],"rotate-y":[{"rotate-y":z()}],"rotate-z":[{"rotate-z":z()}],scale:[{scale:P()}],"scale-x":[{"scale-x":P()}],"scale-y":[{"scale-y":P()}],"scale-z":[{"scale-z":P()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Te,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:B()}],"translate-x":[{"translate-x":B()}],"translate-y":[{"translate-y":B()}],"translate-z":[{"translate-z":B()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te,xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te,xe]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[ue,Ne,ke,Se]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Je(...e){return Ye(function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=N(e))&&(r&&(r+=" "),r+=t);return r}(e))}const Ke=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Ge=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Qe=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},Xe=e.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:s,iconNode:a,...l},c)=>e.createElement("svg",{ref:c,...Ze,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:Ke("lucide",i),...!s&&!Qe(l)&&{"aria-hidden":"true"},...l},[...a.map(([t,n])=>e.createElement(t,n)),...Array.isArray(s)?s:[s]])),et=(t,n)=>{const r=e.forwardRef(({className:r,...o},i)=>{return e.createElement(Xe,{ref:i,iconNode:n,className:Ke(`lucide-${s=Ge(t),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,r),...o});var s});return r.displayName=Ge(t),r},tt=et("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),nt=et("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),rt=et("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),ot=et("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),it=et("highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]),st=et("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),at=et("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),lt=et("list-indent-decrease",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]),ct=et("list-indent-increase",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]),ut=et("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]),dt=et("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ht=et("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),pt=et("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),ft=et("paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]),mt=et("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),gt=et("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),yt=et("remove-formatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]),bt=et("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),vt=et("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),wt=et("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),xt=et("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),kt=et("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),St=et("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),Et=et("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Mt=et("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]),Ct=et("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Rt=e.createContext({});function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ot.apply(null,arguments)}function Tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _t(e){return(_t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function At(e){var t=function(e,t){if("object"!=_t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=_t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_t(t)?t:t+""}function Dt(e,t,n){return(t=At(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $t(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Lt,It={exports:{}};var jt=(Lt||(Lt=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var i in e)t.call(e,i)&&e[i]&&(r=o(r,i));return r}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(It)),It.exports);const zt=s(jt),Pt=Math.round;function Ft(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Bt=(e,t,n)=>0===n?e:e/100;function Ht(e,t){const n=t||255;return e>n?n:e<0?0:e}class Vt{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(Dt(this,"isValid",!0),Dt(this,"r",0),Dt(this,"g",0),Dt(this,"b",0),Dt(this,"a",1),Dt(this,"_h",void 0),Dt(this,"_s",void 0),Dt(this,"_l",void 0),Dt(this,"_v",void 0),Dt(this,"_max",void 0),Dt(this,"_min",void 0),Dt(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof Vt)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=Ht(e.r),this.g=Ht(e.g),this.b=Ht(e.b),this.a="number"==typeof e.a?Ht(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:Pt(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,o=e=>(n[e]-this[e])*r+this[e],i={r:Pt(o("r")),g:Pt(o("g")),b:Pt(o("b")),a:Pt(100*o("a"))/100};return this._c(i)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>Pt((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=Pt(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=Pt(100*this.getSaturation()),n=Pt(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=Ht(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=Pt(255*n);this.r=e,this.g=e,this.b=e}let o=0,i=0,s=0;const a=e/60,l=(1-Math.abs(2*n-1))*t,c=l*(1-Math.abs(a%2-1));a>=0&&a<1?(o=l,i=c):a>=1&&a<2?(o=c,i=l):a>=2&&a<3?(i=l,s=c):a>=3&&a<4?(i=c,s=l):a>=4&&a<5?(o=c,s=l):a>=5&&a<6&&(o=l,s=c);const u=n-l/2;this.r=Pt(255*(o+u)),this.g=Pt(255*(i+u)),this.b=Pt(255*(s+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const o=Pt(255*n);if(this.r=o,this.g=o,this.b=o,t<=0)return;const i=e/60,s=Math.floor(i),a=i-s,l=Pt(n*(1-t)*255),c=Pt(n*(1-t*a)*255),u=Pt(n*(1-t*(1-a))*255);switch(s){case 0:this.g=u,this.b=l;break;case 1:this.r=c,this.b=l;break;case 2:this.r=l,this.b=u;break;case 3:this.r=l,this.g=c;break;case 4:this.r=u,this.g=l;break;default:this.g=l,this.b=c}}fromHsvString(e){const t=Ft(e,Bt);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Ft(e,Bt);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Ft(e,(e,t)=>t.includes("%")?Pt(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var Ut=[{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 qt(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function Wt(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function Yt(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var Jt=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kt(Object(n),!0).forEach(function(t){Dt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Jt.primary=Jt[5];var Zt="data-rc-order",Qt="data-rc-priority",Xt=new Map;function en(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function tn(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function nn(e){return Array.from((Xt.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,o=t.priority,i=void 0===o?0:o,s=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),a="prependQueue"===s,l=document.createElement("style");l.setAttribute(Zt,s),a&&i&&l.setAttribute(Qt,"".concat(i)),null!=n&&n.nonce&&(l.nonce=null==n?void 0:n.nonce),l.innerHTML=e;var c=tn(t),u=c.firstChild;if(r){if(a){var d=(t.styles||nn(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(Zt)))return!1;var t=Number(e.getAttribute(Qt)||0);return i>=t});if(d.length)return c.insertBefore(l,d[d.length-1].nextSibling),l}c.insertBefore(l,u)}else c.appendChild(l);return l}function on(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=tn(n),o=nn(r),i=Gt(Gt({},n),{},{styles:o});!function(e,t){var n=Xt.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=rn("",t),o=r.parentNode;Xt.set(e,o),e.removeChild(r)}}(r,i);var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=tn(t);return(t.styles||nn(n)).find(function(n){return n.getAttribute(en(t))===e})}(t,i);if(s){var a,l,c;if(null!==(a=i.csp)&&void 0!==a&&a.nonce&&s.nonce!==(null===(l=i.csp)||void 0===l?void 0:l.nonce))s.nonce=null===(c=i.csp)||void 0===c?void 0:c.nonce;return s.innerHTML!==e&&(s.innerHTML=e),s}var u=rn(e,i);return u.setAttribute(en(i),t),u}function sn(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function an(e){return function(e){return sn(e)instanceof ShadowRoot}(e)?sn(e):null}var ln={};function cn(e,t){}function un(e,t){}function dn(e,t,n){t||ln[n]||(e(!1,n),ln[n]=!0)}function hn(e,t){dn(cn,e,t)}function pn(e){return"object"===_t(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===_t(e.icon)||"function"==typeof e.icon)}function fn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,o=e[n];if("class"===n)t.className=o,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=o;return t},{})}function mn(t,n,r){return r?e.createElement(t.tag,Gt(Gt({key:n},fn(t.attrs)),r),(t.children||[]).map(function(e,r){return mn(e,"".concat(n,"-").concat(t.tag,"-").concat(r))})):e.createElement(t.tag,Gt({key:n},fn(t.attrs)),(t.children||[]).map(function(e,r){return mn(e,"".concat(n,"-").concat(t.tag,"-").concat(r))}))}function gn(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Vt(e),o=r.toHsv(),i=5;i>0;i-=1){var s=new Vt({h:qt(o,i,!0),s:Wt(o,i,!0),v:Yt(o,i,!0)});n.push(s)}n.push(r);for(var a=1;a<=4;a+=1){var l=new Vt({h:qt(o,a),s:Wt(o,a),v:Yt(o,a)});n.push(l)}return"dark"===t.theme?Ut.map(function(e){var r=e.index,o=e.amount;return new Vt(t.backgroundColor||"#141414").mix(n[r],o).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function yn(e){return e?Array.isArray(e)?e:[e]:[]}hn.preMessage=function(e){},hn.resetWarned=function(){ln={}},hn.noteOnce=function(e,t){dn(un,e,t)};var bn=["icon","className","onClick","style","primaryColor","secondaryColor"],vn={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var wn=function(t){var n,r,i,s,a,l,c,u,d=t.icon,h=t.className,p=t.onClick,f=t.style,m=t.primaryColor,g=t.secondaryColor,y=$t(t,bn),b=o.useRef(),v=vn;if(m&&(v={primaryColor:m,secondaryColor:g||gn(m)}),n=b,r=e.useContext(Rt),i=r.csp,s=r.prefixCls,a=r.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)),a&&(l="@layer ".concat(a," {\n").concat(l,"\n}")),e.useEffect(function(){var e=an(n.current);on(l,"@ant-design-icons",{prepend:!a,csp:i,attachTo:e})},[]),c=pn(d),u="icon should be icon definiton, but got ".concat(d),hn(c,"[@ant-design/icons] ".concat(u)),!pn(d))return null;var w=d;return w&&"function"==typeof w.icon&&(w=Gt(Gt({},w),{},{icon:w.icon(v.primaryColor,v.secondaryColor)})),mn(w.icon,"svg-".concat(w.name),Gt(Gt({className:h,onClick:p,style:f,"data-icon":w.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function xn(e){var t=Nt(yn(e),2),n=t[0],r=t[1];return wn.setTwoToneColors({primaryColor:n,secondaryColor:r})}wn.displayName="IconReact",wn.getTwoToneColors=function(){return Gt({},vn)},wn.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;vn.primaryColor=t,vn.secondaryColor=n||gn(t),vn.calculated=!!n};var kn=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];xn(Jt.primary);var Sn=o.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,a=e.tabIndex,l=e.onClick,c=e.twoToneColor,u=$t(e,kn),d=o.useContext(Rt),h=d.prefixCls,p=void 0===h?"anticon":h,f=d.rootClassName,m=zt(f,p,Dt(Dt({},"".concat(p,"-").concat(r.name),!!r.name),"".concat(p,"-spin"),!!i||"loading"===r.name),n),g=a;void 0===g&&l&&(g=-1);var y=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,b=Nt(yn(c),2),v=b[0],w=b[1];return o.createElement("span",Ot({role:"img","aria-label":r.name},u,{ref:t,tabIndex:g,onClick:l,className:m}),o.createElement(wn,{icon:r,primaryColor:v,secondaryColor:w,style:y}))});Sn.displayName="AntdIcon",Sn.getTwoToneColor=function(){var e=wn.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Sn.setTwoToneColor=xn;var En,Mn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z"}}]},name:"apartment",theme:"outlined"},Cn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:Mn}))},Rn=o.forwardRef(Cn),On={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},Tn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:On}))},Nn=o.forwardRef(Tn),_n={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},An=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:_n}))},Dn=o.forwardRef(An),$n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},Ln=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:$n}))},In=o.forwardRef(Ln),jn={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"},zn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:jn}))},Pn=o.forwardRef(zn),Fn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},Bn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:Fn}))},Hn=o.forwardRef(Bn),Vn={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"},Un=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:Vn}))},qn=o.forwardRef(Un),Wn={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"},Yn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:Wn}))},Jn=o.forwardRef(Yn),Kn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},Gn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:Kn}))},Zn=o.forwardRef(Gn),Qn={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"},Xn=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:Qn}))},er=o.forwardRef(Xn),tr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},nr=function(e,t){return o.createElement(Sn,Ot({},e,{ref:t,icon:tr}))},rr=o.forwardRef(nr),or={},ir={exports:{}};function sr(){return En||(En=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(ir)),ir.exports}var ar,lr={};var cr,ur={},dr={},hr={},pr={exports:{}},fr={exports:{}},mr={exports:{}},gr={exports:{}};function yr(){return cr||(cr=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(gr)),gr.exports}var br,vr,wr,xr,kr={exports:{}};function Sr(){return vr||(vr=1,function(e){var t=yr().default,n=(br||(br=1,function(e){var t=yr().default;e.exports=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(kr)),kr.exports);e.exports=function(e){var r=n(e,"string");return"symbol"==t(r)?r:r+""},e.exports.__esModule=!0,e.exports.default=e.exports}(mr)),mr.exports}function Er(){return xr||(xr=1,function(e){var t=(wr||(wr=1,function(e){var t=Sr();e.exports=function(e,n,r){return(n=t(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}(fr)),fr.exports);function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}e.exports=function(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(n){t(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e},e.exports.__esModule=!0,e.exports.default=e.exports}(pr)),pr.exports}var Mr,Cr,Rr={};function Or(){if(Cr)return hr;Cr=1;var e=sr().default;Object.defineProperty(hr,"__esModule",{value:!0}),hr.default=void 0;var t=e(Er()),n=(Mr||(Mr=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.commonLocale=void 0,Rr.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),Rr),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return hr.default=r,hr}var Tr,Nr,_r,Ar,Dr,$r,Lr={};function Ir(){if(Tr)return Lr;Tr=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.default=void 0;return Lr.default={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Lr}function jr(){if(Nr)return dr;Nr=1;var e=sr().default;Object.defineProperty(dr,"__esModule",{value:!0}),dr.default=void 0;var t=e(Or()),n=e(Ir());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",dr.default=r,dr}function zr(){if(_r)return ur;_r=1;var e=sr().default;Object.defineProperty(ur,"__esModule",{value:!0}),ur.default=void 0;var t=e(jr());return ur.default=t.default,ur}function Pr(){if(Ar)return or;Ar=1;var e=sr().default;Object.defineProperty(or,"__esModule",{value:!0}),or.default=void 0;var t=e((ar||(ar=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.default=void 0,lr.default={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"}),lr)),n=e(zr()),r=e(jr()),o=e(Ir());const i="${label}不是一个有效的${type}",s={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:o.default,Calendar:n.default,global:{placeholder:"请选择",close:"关闭"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return or.default=s,or}function Fr(){return $r?Dr:($r=1,Dr=Pr())}const Br=s(Fr());function Hr(e,t){return function(){return e.apply(t,arguments)}}const{toString:Vr}=Object.prototype,{getPrototypeOf:Ur}=Object,{iterator:qr,toStringTag:Wr}=Symbol,Yr=(e=>t=>{const n=Vr.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Jr=e=>(e=e.toLowerCase(),t=>Yr(t)===e),Kr=e=>t=>typeof t===e,{isArray:Gr}=Array,Zr=Kr("undefined");function Qr(e){return null!==e&&!Zr(e)&&null!==e.constructor&&!Zr(e.constructor)&&to(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xr=Jr("ArrayBuffer");const eo=Kr("string"),to=Kr("function"),no=Kr("number"),ro=e=>null!==e&&"object"==typeof e,oo=e=>{if("object"!==Yr(e))return!1;const t=Ur(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Wr in e||qr in e)},io=Jr("Date"),so=Jr("File"),ao=Jr("Blob"),lo=Jr("FileList");const co="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},uo=void 0!==co.FormData?co.FormData:void 0,ho=Jr("URLSearchParams"),[po,fo,mo,go]=["ReadableStream","Request","Response","Headers"].map(Jr);function yo(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Gr(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Qr(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function bo(e,t){if(Qr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const vo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,wo=e=>!Zr(e)&&e!==vo;const xo=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Ur(Uint8Array)),ko=Jr("HTMLFormElement"),So=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Eo=Jr("RegExp"),Mo=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};yo(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Co=Jr("AsyncFunction"),Ro=(Oo="function"==typeof setImmediate,To=to(vo.postMessage),Oo?setImmediate:To?(No=`axios@${Math.random()}`,_o=[],vo.addEventListener("message",({source:e,data:t})=>{e===vo&&t===No&&_o.length&&_o.shift()()},!1),e=>{_o.push(e),vo.postMessage(No,"*")}):e=>setTimeout(e));var Oo,To,No,_o;const Ao="undefined"!=typeof queueMicrotask?queueMicrotask.bind(vo):"undefined"!=typeof process&&process.nextTick||Ro,Do={isArray:Gr,isArrayBuffer:Xr,isBuffer:Qr,isFormData:e=>{let t;return e&&(uo&&e instanceof uo||to(e.append)&&("formdata"===(t=Yr(e))||"object"===t&&to(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Xr(e.buffer),t},isString:eo,isNumber:no,isBoolean:e=>!0===e||!1===e,isObject:ro,isPlainObject:oo,isEmptyObject:e=>{if(!ro(e)||Qr(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:po,isRequest:fo,isResponse:mo,isHeaders:go,isUndefined:Zr,isDate:io,isFile:so,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:ao,isRegExp:Eo,isFunction:to,isStream:e=>ro(e)&&to(e.pipe),isURLSearchParams:ho,isTypedArray:xo,isFileList:lo,forEach:yo,merge:function e(){const{caseless:t,skipUndefined:n}=wo(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t&&bo(r,i)||i;oo(r[s])&&oo(o)?r[s]=e(r[s],o):oo(o)?r[s]=e({},o):Gr(o)?r[s]=o.slice():n&&Zr(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&yo(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(yo(t,(t,r)=>{n&&to(t)?Object.defineProperty(e,r,{value:Hr(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Ur(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Yr,kindOfTest:Jr,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Gr(e))return e;let t=e.length;if(!no(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[qr]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ko,hasOwnProperty:So,hasOwnProp:So,reduceDescriptors:Mo,freezeMethods:e=>{Mo(e,(t,n)=>{if(to(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];to(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Gr(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:bo,global:vo,isContextDefined:wo,isSpecCompliantForm:function(e){return!!(e&&to(e.append)&&"FormData"===e[Wr]&&e[qr])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(ro(e)){if(t.indexOf(e)>=0)return;if(Qr(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Gr(e)?[]:{};return yo(e,(e,t)=>{const i=n(e,r+1);!Zr(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Co,isThenable:e=>e&&(ro(e)||to(e))&&to(e.then)&&to(e.catch),setImmediate:Ro,asap:Ao,isIterable:e=>null!=e&&to(e[qr])};let $o=class e extends Error{static from(t,n,r,o,i,s){const a=new e(t.message,n||t.code,r,o,i);return a.cause=t,a.name=t.name,null!=t.status&&null==a.status&&(a.status=t.status),s&&Object.assign(a,s),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Do.toJSONObject(this.config),code:this.code,status:this.status}}};$o.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",$o.ERR_BAD_OPTION="ERR_BAD_OPTION",$o.ECONNABORTED="ECONNABORTED",$o.ETIMEDOUT="ETIMEDOUT",$o.ERR_NETWORK="ERR_NETWORK",$o.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",$o.ERR_DEPRECATED="ERR_DEPRECATED",$o.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",$o.ERR_BAD_REQUEST="ERR_BAD_REQUEST",$o.ERR_CANCELED="ERR_CANCELED",$o.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",$o.ERR_INVALID_URL="ERR_INVALID_URL";function Lo(e){return Do.isPlainObject(e)||Do.isArray(e)}function Io(e){return Do.endsWith(e,"[]")?e.slice(0,-2):e}function jo(e,t,n){return e?e.concat(t).map(function(e,t){return e=Io(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const zo=Do.toFlatObject(Do,{},null,function(e){return/^is[A-Z]/.test(e)});function Po(e,t,n){if(!Do.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Do.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Do.isUndefined(t[e])})).metaTokens,o=n.visitor||c,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Do.isSpecCompliantForm(t);if(!Do.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Do.isDate(e))return e.toISOString();if(Do.isBoolean(e))return e.toString();if(!a&&Do.isBlob(e))throw new $o("Blob is not supported. Use a Buffer instead.");return Do.isArrayBuffer(e)||Do.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let a=e;if(Do.isReactNative(t)&&Do.isReactNativeBlob(e))return t.append(jo(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(Do.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Do.isArray(e)&&function(e){return Do.isArray(e)&&!e.some(Lo)}(e)||(Do.isFileList(e)||Do.endsWith(n,"[]"))&&(a=Do.toArray(e)))return n=Io(n),a.forEach(function(e,r){!Do.isUndefined(e)&&null!==e&&t.append(!0===s?jo([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!Lo(e)||(t.append(jo(o,n,i),l(e)),!1)}const u=[],d=Object.assign(zo,{defaultVisitor:c,convertValue:l,isVisitable:Lo});if(!Do.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Do.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),Do.forEach(n,function(n,i){!0===(!(Do.isUndefined(n)||null===n)&&o.call(t,n,Do.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function Fo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Bo(e,t){this._pairs=[],e&&Po(e,this,t)}const Ho=Bo.prototype;function Vo(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Uo(e,t,n){if(!t)return e;const r=n&&n.encode||Vo,o=Do.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let s;if(s=i?i(t,o):Do.isURLSearchParams(t)?t.toString():new Bo(t,o).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}Ho.append=function(e,t){this._pairs.push([e,t])},Ho.toString=function(e){const t=e?function(t){return e.call(this,t,Fo)}:Fo;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class qo{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Do.forEach(this.handlers,function(t){null!==t&&e(t)})}}const Wo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Yo={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Bo,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Jo="undefined"!=typeof window&&"undefined"!=typeof document,Ko="object"==typeof navigator&&navigator||void 0,Go=Jo&&(!Ko||["ReactNative","NativeScript","NS"].indexOf(Ko.product)<0),Zo="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Qo=Jo&&window.location.href||"http://localhost",Xo={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Jo,hasStandardBrowserEnv:Go,hasStandardBrowserWebWorkerEnv:Zo,navigator:Ko,origin:Qo},Symbol.toStringTag,{value:"Module"})),...Yo};function ei(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&Do.isArray(r)?r.length:i,a)return Do.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&Do.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Do.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(Do.isFormData(e)&&Do.isFunction(e.entries)){const n={};return Do.forEachEntry(e,(e,r)=>{t(function(e){return Do.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const ti={transitional:Wo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Do.isObject(e);o&&Do.isHTMLForm(e)&&(e=new FormData(e));if(Do.isFormData(e))return r?JSON.stringify(ei(e)):e;if(Do.isArrayBuffer(e)||Do.isBuffer(e)||Do.isStream(e)||Do.isFile(e)||Do.isBlob(e)||Do.isReadableStream(e))return e;if(Do.isArrayBufferView(e))return e.buffer;if(Do.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Po(e,new Xo.classes.URLSearchParams,{visitor:function(e,t,n,r){return Xo.isNode&&Do.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Do.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Po(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Do.isString(e))try{return(t||JSON.parse)(e),Do.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ti.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Do.isResponse(e)||Do.isReadableStream(e))return e;if(e&&Do.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(n){if("SyntaxError"===o.name)throw $o.from(o,$o.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xo.classes.FormData,Blob:Xo.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Do.forEach(["delete","get","head","post","put","patch"],e=>{ti.headers[e]={}});const ni=Do.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ri=Symbol("internals");function oi(e){return e&&String(e).trim().toLowerCase()}function ii(e){return!1===e||null==e?e:Do.isArray(e)?e.map(ii):String(e)}function si(e,t,n,r,o){return Do.isFunction(r)?r.call(this,t,n):(o&&(t=n),Do.isString(t)?Do.isString(r)?-1!==t.indexOf(r):Do.isRegExp(r)?r.test(t):void 0:void 0)}let ai=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=oi(t);if(!o)throw new Error("header name must be a non-empty string");const i=Do.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ii(e))}const i=(e,t)=>Do.forEach(e,(e,n)=>o(e,n,t));if(Do.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Do.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ni[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Do.isObject(e)&&Do.isIterable(e)){let n,r,o={};for(const t of e){if(!Do.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Do.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=oi(e)){const n=Do.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Do.isFunction(t))return t.call(this,e,n);if(Do.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=oi(e)){const n=Do.findKey(this,e);return!(!n||void 0===this[n]||t&&!si(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=oi(e)){const o=Do.findKey(n,e);!o||t&&!si(0,n[o],o,t)||(delete n[o],r=!0)}}return Do.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!si(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Do.forEach(this,(r,o)=>{const i=Do.findKey(n,o);if(i)return t[i]=ii(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=ii(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Do.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Do.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ri]=this[ri]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=oi(e);t[r]||(!function(e,t){const n=Do.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Do.isArray(e)?e.forEach(r):r(e),this}};function li(e,t){const n=this||ti,r=t||n,o=ai.from(r.headers);let i=r.data;return Do.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ci(e){return!(!e||!e.__CANCEL__)}ai.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Do.reduceDescriptors(ai.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Do.freezeMethods(ai);let ui=class extends $o{constructor(e,t,n){super(null==e?"canceled":e,$o.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function di(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new $o("Request failed with status code "+n.status,[$o.ERR_BAD_REQUEST,$o.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const hi=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=r[s];o||(o=l),n[i]=a,r[i]=l;let u=s,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),l-o<t)return;const h=c&&l-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,l=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&i<=s?(s-i)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pi=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},fi=e=>(...t)=>Do.asap(()=>e(...t)),mi=Xo.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Xo.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Xo.origin),Xo.navigator&&/(msie|trident)/i.test(Xo.navigator.userAgent)):()=>!0,gi=Xo.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Do.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Do.isString(r)&&a.push(`path=${r}`),Do.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),Do.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function yi(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const bi=e=>e instanceof ai?{...e}:e;function vi(e,t){t=t||{};const n={};function r(e,t,n,r){return Do.isPlainObject(e)&&Do.isPlainObject(t)?Do.merge.call({caseless:r},e,t):Do.isPlainObject(t)?Do.merge({},t):Do.isArray(t)?t.slice():t}function o(e,t,n,o){return Do.isUndefined(t)?Do.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Do.isUndefined(t))return r(void 0,t)}function s(e,t){return Do.isUndefined(t)?Do.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(bi(e),bi(t),0,!0)};return Do.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Do.hasOwnProp(l,r)?l[r]:o,s=i(e[r],t[r],r);Do.isUndefined(s)&&i!==a||(n[r]=s)}),n}const wi=e=>{const t=vi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=ai.from(s),t.url=Uo(yi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Do.isFormData(n))if(Xo.hasStandardBrowserEnv||Xo.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Do.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(Xo.hasStandardBrowserEnv&&(r&&Do.isFunction(r)&&(r=r(t)),r||!1!==r&&mi(t.url))){const e=o&&i&&gi.read(i);e&&s.set(o,e)}return t},xi="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=wi(e);let o=r.data;const i=ai.from(r.headers).normalize();let s,a,l,c,u,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){c&&c(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=ai.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());di(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new $o("Request aborted",$o.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new $o(r,$o.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Wo;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new $o(t,o.clarifyTimeoutError?$o.ETIMEDOUT:$o.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&Do.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Do.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([l,u]=hi(p,!0),m.addEventListener("progress",l)),h&&m.upload&&([a,c]=hi(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new ui(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===Xo.protocols.indexOf(y)?n(new $o("Unsupported protocol "+y+":",$o.ERR_BAD_REQUEST,e)):m.send(o||null)})},ki=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof $o?t:new ui(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new $o(`timeout of ${t}ms exceeded`,$o.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>Do.asap(s),a}},Si=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Ei=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Mi=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Ei(e))yield*Si(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Ci}=Do,Ri=(({Request:e,Response:t})=>({Request:e,Response:t}))(Do.global),{ReadableStream:Oi,TextEncoder:Ti}=Do.global,Ni=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},_i=e=>{e=Do.merge.call({skipUndefined:!0},Ri,e);const{fetch:t,Request:n,Response:r}=e,o=t?Ci(t):"function"==typeof fetch,i=Ci(n),s=Ci(r);if(!o)return!1;const a=o&&Ci(Oi),l=o&&("function"==typeof Ti?(e=>t=>e.encode(t))(new Ti):async e=>new Uint8Array(await new n(e).arrayBuffer())),c=i&&a&&Ni(()=>{let e=!1;const t=new n(Xo.origin,{body:new Oi,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&Ni(()=>Do.isReadableStream(new r("").body)),d={stream:u&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new $o(`Response type '${e}' is not supported`,$o.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=Do.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Do.isBlob(e))return e.size;if(Do.isSpecCompliantForm(e)){const t=new n(Xo.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Do.isArrayBufferView(e)||Do.isArrayBuffer(e)?e.byteLength:(Do.isURLSearchParams(e)&&(e+=""),Do.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:l,cancelToken:p,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:w}=wi(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let k=ki([l,p&&p.toAbortSignal()],f),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let M;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(M=await h(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(Do.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=pi(M,hi(fi(g)));a=Mi(t.body,65536,e,n)}}Do.isString(v)||(v=v?"include":"omit");const t=i&&"credentials"in n.prototype,l={...w,signal:k,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};S=i&&new n(o,l);let p=await(i?x(S,w):x(o,l));const f=u&&("stream"===y||"response"===y);if(u&&(m||f&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=Do.toFiniteNumber(p.headers.get("content-length")),[n,o]=m&&pi(t,hi(fi(m),!0))||[];p=new r(Mi(p.body,65536,n,()=>{o&&o(),E&&E()}),e)}y=y||"text";let C=await d[Do.findKey(d,y)||"text"](p,e);return!f&&E&&E(),await new Promise((t,n)=>{di(t,n,{data:C,headers:ai.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:S})})}catch(C){if(E&&E(),C&&"TypeError"===C.name&&/Load failed|fetch/i.test(C.message))throw Object.assign(new $o("Network Error",$o.ERR_NETWORK,e,S,C&&C.response),{cause:C.cause||C});throw $o.from(C,C&&C.code,e,S,C&&C.response)}}},Ai=new Map,Di=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,l=i.length,c=Ai;for(;l--;)s=i[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:_i(t)),c=a;return a};Di();const $i={http:null,xhr:xi,fetch:{get:Di}};Do.forEach($i,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const Li=e=>`- ${e}`,Ii=e=>Do.isFunction(e)||null===e||!1===e;const ji={getAdapter:function(e,t){e=Do.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ii(r)&&(o=$i[(n=String(r)).toLowerCase()],void 0===o))throw new $o(`Unknown adapter '${n}'`);if(o&&(Do.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Li).join("\n"):" "+Li(e[0]):"as no adapter specified";throw new $o("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:$i};function zi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ui(null,e)}function Pi(e){zi(e),e.headers=ai.from(e.headers),e.data=li.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ji.getAdapter(e.adapter||ti.adapter,e)(e).then(function(t){return zi(e),t.data=li.call(e,e.transformResponse,t),t.headers=ai.from(t.headers),t},function(t){return ci(t)||(zi(e),t&&t.response&&(t.response.data=li.call(e,e.transformResponse,t.response),t.response.headers=ai.from(t.response.headers))),Promise.reject(t)})}const Fi="1.13.6",Bi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Bi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Hi={};Bi.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Fi+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new $o(r(o," has been removed"+(t?" in "+t:"")),$o.ERR_DEPRECATED);return t&&!Hi[o]&&(Hi[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Bi.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Vi={assertOptions:function(e,t,n){if("object"!=typeof e)throw new $o("options must be an object",$o.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new $o("option "+i+" must be "+n,$o.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new $o("Unknown option "+i,$o.ERR_BAD_OPTION)}},validators:Bi},Ui=Vi.validators;let qi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new qo,response:new qo}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=vi(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Vi.assertOptions(n,{silentJSONParsing:Ui.transitional(Ui.boolean),forcedJSONParsing:Ui.transitional(Ui.boolean),clarifyTimeoutError:Ui.transitional(Ui.boolean),legacyInterceptorReqResOrdering:Ui.transitional(Ui.boolean)},!1),null!=r&&(Do.isFunction(r)?t.paramsSerializer={serialize:r}:Vi.assertOptions(r,{encode:Ui.function,serialize:Ui.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Vi.assertOptions(t,{baseUrl:Ui.spelling("baseURL"),withXsrfToken:Ui.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Do.merge(o.common,o[t.method]);o&&Do.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ai.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||Wo;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[Pi.bind(this),void 0];for(e.unshift(...s),e.push(...l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=s.length;let h=t;for(;d<u;){const e=s[d++],t=s[d++];try{h=e(h)}catch(p){t.call(this,p);break}}try{c=Pi.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return Uo(yi((e=vi(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Do.forEach(["delete","get","head","options"],function(e){qi.prototype[e]=function(t,n){return this.request(vi(n||{},{method:e,url:t,data:(n||{}).data}))}}),Do.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(vi(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}qi.prototype[e]=t(),qi.prototype[e+"Form"]=t(!0)});const Wi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Wi).forEach(([e,t])=>{Wi[t]=e});const Yi=function e(t){const n=new qi(t),r=Hr(qi.prototype.request,n);return Do.extend(r,qi.prototype,n,{allOwnKeys:!0}),Do.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(vi(t,n))},r}(ti);Yi.Axios=qi,Yi.CanceledError=ui,Yi.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ui(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Yi.isCancel=ci,Yi.VERSION=Fi,Yi.toFormData=Po,Yi.AxiosError=$o,Yi.Cancel=Yi.CanceledError,Yi.all=function(e){return Promise.all(e)},Yi.spread=function(e){return function(t){return e.apply(null,t)}},Yi.isAxiosError=function(e){return Do.isObject(e)&&!0===e.isAxiosError},Yi.mergeConfig=vi,Yi.AxiosHeaders=ai,Yi.formToJSON=e=>ei(Do.isHTMLForm(e)?new FormData(e):e),Yi.getAdapter=ji.getAdapter,Yi.HttpStatusCode=Wi,Yi.default=Yi;const{Axios:Ji,AxiosError:Ki,CanceledError:Gi,isCancel:Zi,CancelToken:Qi,VERSION:Xi,all:es,Cancel:ts,isAxiosError:ns,spread:rs,toFormData:is,AxiosHeaders:ss,HttpStatusCode:as,formToJSON:ls,getAdapter:cs,mergeConfig:us}=Yi;const ds=Yi.create({baseURL:"/api/v6",timeout:3e5});async function hs(e,t){const n=await ds.get(`/data/${e}`,{params:{...t,top:t.top??20,skip:t.skip??0}}),r=n.data?.data||[];return{data:r,total:n.data?.totalCount??n.data?.total??r.length}}async function ps(e,t){const{objectName:n="",recordId:r="",parent:o="",collectionName:i="cfs.files.filerecord"}=t||{},s=new FormData;s.append("file",e),n&&s.append("object_name",n),r&&s.append("record_id",r),o&&s.append("parent",o);const a={},l=localStorage.getItem("steedos:spaceId"),c=localStorage.getItem("steedos:auth_token");l&&c&&(a.Authorization=`Bearer ${l},${c}`);return(await ds.post(`/files/${i}`,s,{headers:a,timeout:6e4})).data}function fs(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}ds.interceptors.request.use(e=>e);const ms=new Map,gs=new Map;function ys(e,t){return 0===e.length?"":t?e.join(","):e[0]}function bs({field:t,value:n,onChange:r,onFillFields:o,isTableMode:i=!1,hasError:s=!1,formValues:a}){const[l,c]=e.useState(!1),u=t.reference_to||"",d=!!t.pickerMultiple,h=t.lookupDisplayFields||["name"],p=h[0]||"name",f=e.useMemo(()=>!d&&t.lookupFillRules||[],[d,t.lookupFillRules]),m=e.useMemo(()=>{return e=t.lookupFilters,n=a||{},e?e.replace(/\{(\w+)\}/g,(e,t)=>n[t]??""):e;var e,n},[t.lookupFilters,a]),g=e.useMemo(()=>function(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>"object"==typeof e&&null!==e&&"_id"in e?e._id:String(e)).filter(Boolean);if("object"==typeof t&&null!==t&&"_id"in t)return[t._id]}catch{}return e.split(",").map(e=>e.trim()).filter(Boolean)}(n),[n]),[y,b]=e.useState(new Map);e.useEffect(()=>{if(!u||0===g.length)return;const e=g.filter(e=>!y.has(e));if(0===e.length)return;const t=JSON.stringify(["_id","in",e]);hs(u,{filters:t,fields:`_id,${p}`,top:e.length}).then(({data:e})=>{b(t=>{const n=new Map(t);for(const r of e)n.set(r._id,r[p]||r._id);return n})})},[u,g.join(","),p]);const v=e.useCallback(e=>{const t=g.filter(t=>t!==e);r(ys(t,d))},[g,r,d]),w=e.useCallback((e,t,n)=>{if(r(ys(e,d)),b(e=>{const n=new Map(e);for(const[r,o]of t)n.set(r,o);return n}),c(!1),!d&&f.length>0&&1===e.length&&o){const t=e=>{const t={};for(const n of f)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(t[n.targetField]=String(e[n.sourceField]));Object.keys(t).length>0&&o(t)};if(n){const r=f.map(e=>e.sourceField).filter(Boolean);if(r.every(e=>e in n))t(n);else{const n=JSON.stringify(["_id","=",e[0]]),o=["_id",...r].join(",");hs(u,{filters:n,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}else{const n=f.map(e=>e.sourceField).filter(Boolean),r=JSON.stringify(["_id","=",e[0]]),o=["_id",...n].join(",");hs(u,{filters:r,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}},[r,d,f,o,u]);return t.readonly?React.createElement("div",{className:(i?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-2")+" bg-gray-50/60 min-h-[34px]"},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},y.get(e)||e))):React.createElement("span",{className:"text-[13px] text-gray-400"},"—")):React.createElement(React.Fragment,null,React.createElement("div",{onClick:()=>u&&c(!0),className:"cursor-pointer smooth-transition "+(i?"w-full px-2.5 py-1.5 min-h-[34px] "+(s?"bg-red-100/90":"bg-amber-50/80 hover:bg-amber-50"):"border rounded-md px-3 py-2 min-h-[38px] "+(s?"border-red-200 bg-red-50":"border-gray-300 bg-white hover:border-indigo-300"))},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5 items-center"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] bg-indigo-50 text-indigo-700 border border-indigo-200 rounded-md px-2 py-0.5 max-w-[200px]"},React.createElement("span",{className:"truncate"},y.get(e)||e),React.createElement(Ct,{className:"w-3 h-3 text-indigo-300 hover:text-red-500 shrink-0 cursor-pointer",onClick:t=>{t.stopPropagation(),v(e)}})))):React.createElement("div",{className:"flex items-center gap-2 text-gray-400"},React.createElement(ot,{className:"w-4 h-4 shrink-0"}),React.createElement("span",{className:"text-[13px]"},u?"选择数据":"请先配置关联对象"),React.createElement(nt,{className:"w-3.5 h-3.5 ml-auto shrink-0"}))),l&&React.createElement(vs,{objectName:u,displayFields:h,multiple:d,selectedIds:g,filters:m,onConfirm:w,onClose:()=>c(!1)}))}function vs({objectName:n,displayFields:r,multiple:o,selectedIds:i,filters:s,onConfirm:a,onClose:l}){const[c,u]=e.useState([]),[d,h]=e.useState(0),[p,f]=e.useState(!1),[m,g]=e.useState(1),[y,b]=e.useState(""),[v,w]=e.useState(new Set(i)),[x,k]=e.useState([]),S=e.useRef(void 0),E=r[0]||"name";e.useEffect(()=>{(async function(e){if(!e)return[];const t=ms.get(e);if(t)return t;const n=gs.get(e);if(n)return n;const r=(async()=>{try{let t="";const n={},r=await fetch(`${t}/service/api/amis-metadata-objects/objects/${encodeURIComponent(e)}/fields/options`,{headers:n}),o=await r.json(),i=o?.data?.options??[];return ms.set(e,i),i}catch{return[]}finally{gs.delete(e)}})();return gs.set(e,r),r})(n).then(k)},[n]);const M=e.useMemo(()=>{const e=new Map;for(const t of x)e.set(t.value,t.label);return e},[x]),C=e.useCallback(async(e,t)=>{f(!0);try{const o=[];let i;s&&o.push(s),t&&o.push(JSON.stringify([E,"contains",t])),2===o.length?i=JSON.stringify([JSON.parse(o[0]),"and",JSON.parse(o[1])]):1===o.length&&(i=o[0]);const a=["_id",...r].join(","),l=await hs(n,{filters:i,fields:a,top:10,skip:10*(e-1),sort:`${E} asc`});u(l.data),h(l.total)}finally{f(!1)}},[n,r,E,s]);e.useEffect(()=>{C(m,y)},[m]);const R=e.useCallback(e=>{b(e),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{g(1),C(1,e)},300)},[C]),O=e.useMemo(()=>r.map(e=>({title:M.get(e)||e,dataIndex:e,key:e,ellipsis:!0,render:e=>null!=e?String(e):"-"})),[r,M]),T=e.useMemo(()=>({type:o?"checkbox":"radio",selectedRowKeys:[...v],onChange:e=>{if(w(new Set(e)),!o&&e.length>0){const t=e[0],n=c.find(e=>e._id===t),r=new Map;n&&r.set(t,n[E]||t),a([t],r,n)}}}),[o,v,c,E,a]);return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Modal,{open:!0,title:React.createElement("div",{className:"flex items-center gap-2"},React.createElement(ot,{className:"w-4 h-4 text-indigo-500"}),React.createElement("span",null,"选择数据")),width:Math.min(960,window.innerWidth-32),onCancel:l,onOk:o?()=>{const e=new Map;for(const t of c){const n=t._id;v.has(n)&&e.set(n,t[E]||n)}a([...v],e)}:void 0,okText:o?"确定"+(v.size>0?` (${v.size})`:""):void 0,cancelText:"取消",footer:o?void 0:null,destroyOnClose:!0,styles:{body:{padding:"12px 0"}}},React.createElement("div",{style:{padding:"0 0 12px"}},React.createElement(t.Input.Search,{placeholder:`搜索 ${M.get(E)||E}...`,allowClear:!0,onChange:e=>R(e.target.value),style:{width:"100%"}})),React.createElement(t.Table,{rowKey:"_id",columns:O,dataSource:c,loading:p,rowSelection:T,pagination:{current:m,pageSize:10,total:d,size:"small",showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>g(e)},size:"small",scroll:{x:"max-content"},style:{fontSize:13},onRow:e=>({onClick:()=>{const t=e._id;if(o)w(e=>{const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});else{const n=new Map;n.set(t,e[E]||t),a([t],n,e)}},style:{cursor:"pointer"}})})))}const ws=n=>{const{visible:r,multiple:o,loading:i,users:s,searchKeyword:a,searchInputValue:l,tempSelectedUsers:c,clearable:u,rootDeptInfo:d,deptPath:h,currentLevelDepts:p,showSelectedPanel:f,onDrillDown:m,onMobileBack:g,onDrillBack:y,onBackToRoot:b,onToggleSelectedPanel:v,onUserSearch:w,onAddUser:x,onRemoveUser:k,onToggleUser:S,onToggleSelectAll:E,onReorderUsers:M,onOk:C,onCancel:R,onClearAll:O}=n,T=s.length>0&&s.every(e=>c.find(t=>t._id===e._id)),N=!!a,{visibleCount:_,scrollContainerRef:A}=function(t,n=50,r=[]){const[o,i]=e.useState(n),s=e.useRef(null),[a,l]=e.useState(!1);e.useEffect(()=>{e.startTransition(()=>i(n)),s.current&&(s.current.scrollTop=0)},[...r,t,n]);const c=e.useCallback(e=>{s.current=e,l(!!e)},[]);return e.useEffect(()=>{const e=s.current;if(!e)return;const r=()=>{i(r=>r>=t?r:e.scrollHeight-e.scrollTop-e.clientHeight<120?Math.min(r+n,t):r)};e.addEventListener("scroll",r,{passive:!0});const o=requestAnimationFrame(()=>r());return()=>{e.removeEventListener("scroll",r),cancelAnimationFrame(o)}},[t,n,a]),{visibleCount:o,scrollContainerRef:c}}(s.length,50,[h.length,a]),D=e.useRef({dragging:!1,startIndex:-1,currentIndex:-1,startY:0,itemHeight:56,clone:null,listEl:null}),$=e.useRef(null),[L,I]=e.useState(null),[j,z]=e.useState(null),P=e.useCallback((e,t)=>{if(e.target.closest(".steedos-selected-remove-btn"))return;const n=e.touches[0],r=e.currentTarget,o=r.getBoundingClientRect(),i=r.cloneNode(!0);i.style.position="fixed",i.style.left=`${o.left}px`,i.style.top=`${o.top}px`,i.style.width=`${o.width}px`,i.style.zIndex="9999",i.style.boxShadow="0 8px 24px rgba(0,0,0,0.15)",i.style.borderRadius="8px",i.style.opacity="0.92",i.style.transition="box-shadow 0.2s",i.style.pointerEvents="none",document.body.appendChild(i),D.current={dragging:!0,startIndex:t,currentIndex:t,startY:n.clientY,itemHeight:o.height,clone:i,listEl:$.current},I(t),z(t),navigator.vibrate&&navigator.vibrate(20)},[]),F=e.useCallback(e=>{const t=D.current;if(!t.dragging||!t.clone)return;e.preventDefault();const n=e.touches[0].clientY-t.startY;t.clone.style.transform=`translateY(${n}px) scale(1.02)`;const r=Math.round(n/t.itemHeight)+t.startIndex,o=Math.max(0,Math.min(r,c.length-1));o!==t.currentIndex&&(t.currentIndex=o,z(o),navigator.vibrate&&navigator.vibrate(10))},[c.length]),B=e.useCallback(()=>{const e=D.current;if(!e.dragging)return;e.clone&&(e.clone.remove(),e.clone=null);const t=e.startIndex,n=e.currentIndex;e.dragging=!1,I(null),z(null),t!==n&&t>=0&&n>=0&&M(t,n)},[M]);return e.createElement(t.Drawer,{open:r,placement:"bottom",height:"100vh",closable:!1,destroyOnClose:!0,rootClassName:"steedos-mobile-drawer",onClose:R,styles:{body:{padding:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}}},e.createElement("style",null,"\n.steedos-mobile-drawer .ant-drawer-content-wrapper {\n border-radius: 0 !important;\n overflow: hidden;\n}\n.steedos-mobile-drawer .ant-drawer-header {\n padding: 12px 16px;\n border-bottom: none;\n}\n.steedos-mobile-drawer .ant-drawer-body {\n padding: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n.steedos-mobile-dept-card {\n display: flex;\n align-items: center;\n padding: 14px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-dept-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-user-card {\n display: flex;\n align-items: center;\n padding: 12px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-user-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-bottom-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 16px;\n padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));\n border-top: 1px solid #f0f0f0;\n background: #fff;\n}\n.steedos-mobile-selected-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: #fff;\n z-index: 20;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n"),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px 8px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:28,minWidth:60}},h.length>0&&e.createElement("span",{onClick:g,style:{color:"#1890ff",fontSize:18,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Hn,null)),e.createElement("span",{onClick:R,style:{color:"#666",fontSize:16,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Dn,null))),e.createElement("span",{style:{fontWeight:600,fontSize:16}},"选择人员"),e.createElement("div",{style:{minWidth:60,display:"flex",justifyContent:"flex-end"}},o&&s.length>0&&!N&&h.length>0&&e.createElement("span",{onClick:E,style:{fontSize:14,color:"#1890ff",cursor:"pointer",WebkitTapHighlightColor:"transparent"}},T?"取消全选":"全选"))),e.createElement("div",{style:{padding:"4px 16px 8px",flexShrink:0}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Zn,null),value:l,onChange:e=>w(e.target.value),allowClear:!0,size:"large"})),h.length>0&&!N&&e.createElement("div",{style:{height:8,background:"#f5f5f5",flexShrink:0}}),h.length>0&&!N&&(()=>{const t=h.length>2,n=h.length>2?h.slice(-2):h,r=h.length>2?h.length-2:0,o=e=>e.length>8?e.slice(0,8)+"…":e;return e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",fontSize:13,color:"#999",overflow:"hidden",whiteSpace:"nowrap",flexShrink:0,borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{onClick:b,style:{color:"#1890ff",cursor:"pointer",flexShrink:0,WebkitTapHighlightColor:"transparent"}},"联系人"),t&&e.createElement(e.Fragment,null,e.createElement(Jn,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),e.createElement("span",{style:{color:"#999",flexShrink:0,display:"flex",alignItems:"center",lineHeight:1}},"···")),n.map((t,n)=>{const i=r+n,s=i===h.length-1;return e.createElement(e.Fragment,{key:t.id},e.createElement(Jn,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),s?e.createElement("span",{style:{color:"#999",overflow:"hidden",textOverflow:"ellipsis"}},o(t.name)):e.createElement("span",{onClick:()=>y(i),style:{color:"#1890ff",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",WebkitTapHighlightColor:"transparent"}},o(t.name)))}))})(),e.createElement("div",{ref:A,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},e.createElement(t.Spin,{spinning:i},N||h.length>0||!d?null:e.createElement(e.Fragment,null,e.createElement("div",{className:"steedos-mobile-dept-card",onClick:()=>m(d.id,d.name)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(Rn,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15}},"通讯录")),e.createElement(Jn,{style:{color:"#ccc",fontSize:14,flexShrink:0}})),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),N||0===h.length||0===p.length?null:e.createElement(e.Fragment,null,p.map(t=>e.createElement("div",{key:t._id||t.id||t.key||t.value,className:"steedos-mobile-dept-card",onClick:()=>m(t._id||t.id||t.key||t.value,t.title||t.name||t.label)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(Rn,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.title||t.name||t.label)),e.createElement(Jn,{style:{color:"#ccc",fontSize:14,flexShrink:0}}))),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),e.createElement(e.Fragment,null,s.length>0?e.createElement(e.Fragment,null,s.slice(0,_).map(n=>{const r=!!c.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:"steedos-mobile-user-card",onClick:()=>S(n)},o&&e.createElement("div",{style:{width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:r?"#1890ff":"transparent",border:r?"none":"1.5px solid #d9d9d9"}},r&&e.createElement(Nn,{style:{color:"#fff",fontSize:11}})),e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:void 0,size:40,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:2}},n.organization?.name,n.position?` · ${n.position}`:""),(n.email||n.mobile||n.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},n.email||n.mobile||n.username)))}),_<s.length&&e.createElement("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13}},"加载更多...")):i?null:e.createElement(t.Empty,{description:a?"未找到匹配的人员":"暂无人员",style:{marginTop:60}})))),f&&e.createElement("div",{className:"steedos-mobile-selected-overlay"},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{style:{fontWeight:600,fontSize:16}},"已选中 (",c.length,")"),e.createElement(t.Button,{type:"text",onClick:v,style:{padding:0,color:"#666"}},"返回")),u&&c.length>0&&e.createElement("div",{style:{padding:"4px 16px",display:"flex",justifyContent:"flex-end"}},e.createElement(t.Button,{type:"link",danger:!0,size:"small",onClick:O,style:{padding:0}},"清空全部")),o&&c.length>1&&e.createElement("div",{style:{padding:"0 16px 6px",fontSize:12,color:"#999"}},"长按拖拽可调整顺序"),e.createElement("div",{ref:$,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},c.length>0?c.map((n,r)=>{const i=L===r,s=j===r&&null!==L&&L!==r;return e.createElement("div",{key:n._id,onTouchStart:o?e=>P(e,r):void 0,onTouchMove:o?F:void 0,onTouchEnd:o?B:void 0,style:{display:"flex",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid #f5f5f5",gap:10,opacity:i?.3:1,background:s?"#e6f7ff":"#fff",borderTop:s?"2px solid #1890ff":"2px solid transparent",transition:"background 0.15s, border-top 0.15s, opacity 0.15s",touchAction:"none",userSelect:"none"}},o&&e.createElement(In,{style:{color:"#bbb",fontSize:16,flexShrink:0,cursor:"grab"}}),e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:void 0,size:36,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),(n.email||n.mobile||n.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},n.email||n.mobile||n.username)),u&&e.createElement(Dn,{className:"steedos-selected-remove-btn",onClick:()=>k(n._id),style:{fontSize:14,color:"#ff4d4f",padding:8,flexShrink:0}}))}):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE}))),o?e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:c.length>0?"#1890ff":"#666",cursor:"pointer"},onClick:c.length>0?v:void 0},"已选 ",c.length," 人 ",c.length>0&&!f?"▲":c.length>0&&f?"▼":""),e.createElement(t.Button,{type:"primary",onClick:C},"确定")):e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:"#666"}},c.length>0?`已选: ${c[0]?.name}`:"请选择人员"),e.createElement(t.Button,{type:"primary",onClick:C,disabled:0===c.length},"确定")))};function xs(e){return e}function ks(e={}){return{...e}}async function Ss(e){const t=`{rows:space_users(filters: [${[[["user_accepted","=",!0]],"and",[["organization","=",e]]].map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}}}`,n=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function Es(e,t){if(!e&&!t)return[];const n=[];n.push([["user_accepted","=",!0]]),n.push("and"),t?n.push([[["name","contains",t],"or",["email","contains",t]],"or",["username","contains",t]]):e&&n.push([["organizations_parents","in",[e]]]);const r=`{rows:space_users(filters: [${n.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}},count:space_users__count(filters:[${n.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}])}`,o=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:r})}),i=await o.json();return(i.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function Ms(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 1000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.fullname||e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,sort_no,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}{const e=await fetch("/service/api/organizations/root",{headers:ks()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}}const Cs=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择人员",fetchUsers:a=Es,fetchDeptTree:l=Ms,style:c,dispatchEvent:u,clearable:d=!0,isTableMode:h=!1,hasError:p=!1,formalTableMode:f=!1,minimal:m=!1,pickerFillRules:g,onFillFields:y,valueFormat:b="object"}=n,[v,w]=e.useState(!1),[x,k]=e.useState([]),[S,E]=e.useState([]),[M,C]=e.useState(null),[R,O]=e.useState([]),[T,N]=e.useState([]),[_,A]=e.useState(!1),[D,$]=e.useState(""),[L,I]=e.useState(""),[j,z]=e.useState(""),[P,F]=e.useState(null),[B,H]=e.useState([]),[V,U]=e.useState(null),[q,W]=e.useState(!1),[Y,J]=e.useState(0),[K,G]=e.useState(null),Z=e.useRef(null),Q=e.useRef(null),X=e.useRef(0),ee=e.useRef(null),te=function(){const[t,n]=e.useState(()=>"undefined"!=typeof window&&window.innerWidth<768);return e.useEffect(()=>{const e=()=>n(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t}(),[,ne]=e.useState("dept"),[,re]=e.useState(""),[oe,ie]=e.useState([]),[se,ae]=e.useState([]),[le,ce]=e.useState(!1),[ue,de]=e.useState(null),{visibleCount:he,sentinelRef:pe}=function(t,n=50,r=[]){const[o,i]=e.useState(n),s=e.useRef(null),a=e.useRef(null);return e.useEffect(()=>{i(n)},[...r,t,n]),e.useEffect(()=>{if(a.current&&a.current.disconnect(),s.current&&!(o>=t))return a.current=new IntersectionObserver(e=>{e[0]?.isIntersecting&&i(e=>Math.min(e+n,t))},{threshold:.1}),a.current.observe(s.current),()=>{a.current&&a.current.disconnect()}},[t,n,o]),{visibleCount:o,sentinelRef:s}}(S.length,50,[M,D]);e.useEffect(()=>{ee.current={props:n}}),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id)return void O([{_id:r.id,user:r.id,name:r.name||""}]);if(Array.isArray(r)&&r.length>0&&"object"==typeof r[0]&&r[0].id)return void O(r.map(e=>({_id:e.id,user:e.id,name:e.name||""})));const e=Array.isArray(r)?r.map(String).map(e=>e.trim()).filter(Boolean):r?i?String(r).split(",").map(e=>e.trim()).filter(Boolean):[String(r).trim()]:[];if(e.length>0){const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,email,mobile,position,username,avatar,organization}}`;fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(t=>{let n=(t.data?.rows||[]).map(e=>({_id:e._id,name:e.name,user:e.user,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}));n=e.map(e=>n.find(t=>t.user===e)).filter(e=>!!e),O(n)})}else O([])},[r,i]),e.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current),Q.current&&clearTimeout(Q.current)},[]),e.useEffect(()=>{if(v){A(!0),J(e=>e+1),re(""),k([]),H([]),C(null),z(""),$(""),I("");let e=!1;l().then(t=>{const n=t;k(n);const r=n.map(e=>e.key);if(H(r),r.length>0)if(te&&n[0]){re(String(n[0].title||""));const t=String(n[0].key),r=String(n[0].title||"");de({id:t,name:r}),ie([]),C(t),e=!0,a(t).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>{A(!1)})}else C(String(r[0]));n.forEach(e=>{e.isLeaf||l(String(e.key)).then(t=>{k(n=>{const r=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:r(e.children,t,n)}:e);return r(n,e.key,t)})})})}).finally(()=>{e||A(!1)})}},[v,l,a,te]),e.useEffect(()=>{te||(M||D?(A(!0),a(M||void 0,D||void 0).then(e=>E(e)).finally(()=>A(!1))):E([]))},[M,D,a,te]);const fe=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:fe(e.children,t,n)}:e),me=e=>{I(e),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{$(e),e?(C(null),re(""),te&&(A(!0),a(void 0,e).then(e=>E(e)).finally(()=>A(!1)))):te?ue&&(ie([]),ae([]),C(ue.id),A(!0),a(ue.id).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>A(!1))):x.length>0&&C(String(x[0].key))},300)},ge=e=>{if(i){if(!T.find(t=>t._id===e._id)){const t=[...T,e];N(t)}}else N([e]),te?setTimeout(()=>{we([e])},0):(G(e._id),setTimeout(()=>{G(null),we([e])},300))},ye=e=>{N(T.filter(t=>t._id!==e))},be=()=>{F(null)},ve=()=>{if(S.length>0&&S.every(e=>T.find(t=>t._id===e._id))){const e=new Set(S.map(e=>e._id));N(T.filter(t=>!e.has(t._id)))}else{const e=[...T];S.forEach(t=>{e.find(e=>e._id===t._id)||e.push(t)}),N(e)}},we=async e=>{if(O(e),o||u){const t=await async function(e){if(0===e.length)return[];const t=e.map(e=>e.user).filter(Boolean);if(0===t.length)return[];const n=`{rows:space_users(filters: [["user","in",[${t.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,sort_no,organization,organizations}}`;let r=[];try{const e=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),t=await e.json();r=t.data?.rows||[]}catch{}const o=new Set;for(const s of r)if(s.organization&&o.add(s.organization),Array.isArray(s.organizations))for(const e of s.organizations)e&&o.add(e);const i=new Map;if(o.size>0){const e=`{rows:organizations(filters: [["_id","in",[${[...o].map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,name,fullname}}`;try{const t=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await t.json();for(const e of n.data?.rows||[])i.set(e._id,{name:e.name||"",fullname:e.fullname||""})}catch{}}return e.map(e=>{const t=r.find(t=>t.user===e.user)||e,n=i.get(t.organization)||{name:"",fullname:""},o=Array.isArray(t.organizations)?t.organizations.map(e=>i.get(e)).filter(Boolean):n.name?[n]:[];return{id:t.user,name:t.name||"",sort_no:t.sort_no||0,organization:{name:n.name,fullname:n.fullname},organizations:{name:o.map(e=>e.name),fullname:o.map(e=>e.fullname)},hr:{},roles:[]}})}(e);let n=i?t:t[0]||null;"string"===b&&(n=i?t.map(e=>e.id):t[0]?.id||null),u&&await u("change",{value:n},ee.current),o&&o(n)}if(w(!1),!i&&g&&g.length>0&&1===e.length&&y){const t=e[0],n=[],r=new Map;for(const e of g){if(!e.sourceField||!e.targetField)continue;const t=e.sourceField.indexOf(".");if(t>0){const n=e.sourceField.substring(0,t),o=e.sourceField.substring(t+1);r.has(n)||r.set(n,[]),r.get(n).push({subField:o,targetField:e.targetField})}else n.push(e)}const o={};if(n.length>0){const e=n.map(e=>e.sourceField).filter(Boolean),r=e=>{for(const t of n)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(o[t.targetField]=String(e[t.sourceField]))};if(e.every(e=>e in t&&null!=t[e]))r(t);else try{const n=`{rows:space_users(filters: [["user","=","${t.user}"]], top: 1){${["_id",...e].join(",")}}}`,o=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),i=await o.json(),s=i.data?.rows||[];s.length>0&&r(s[0])}catch{}}const i={organization:"organizations"};for(const[e,s]of r){const n=i[e];if(!n)continue;let r=t[e];if(!r)try{const n=`{rows:space_users(filters: [["user","=","${t.user}"]], top: 1){_id,${e}}}`,o=await fetch(xs("/graphql"),{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),i=await o.json();r=i.data?.rows?.[0]?.[e]}catch{}if(!r)continue;const a=s.map(e=>e.subField);try{const e=`{rows:${n}(filters: [["_id","=","${r}"]], top: 1){${["_id",...a].join(",")}}}`,t=await fetch(xs("/graphql"),{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),i=await t.json(),l=i.data?.rows?.[0];if(l)for(const n of s)null!=l[n.subField]&&(o[n.targetField]=String(l[n.subField]))}catch{}}Object.keys(o).length>0&&y(o)}},xe=async()=>{await we(T)},ke=()=>{N([...R]),w(!1)},Se=e.useCallback(async(e,t)=>{ie(n=>[...n,{id:e,name:t}]),C(e),$(""),I(""),A(!0);try{const[t,n]=await Promise.all([l(e),Ss(e)]);ae(t),E(n)}catch{ae([]),E([])}finally{A(!1)}},[l]),Ee=e.useCallback(async e=>{if(e<0)return;const t=oe.slice(0,e+1);ie(t);const n=t[t.length-1];C(n.id),$(""),I(""),A(!0);try{const[e,t]=await Promise.all([l(n.id),Ss(n.id)]);ae(e),E(t)}catch{ae([]),E([])}finally{A(!1)}},[oe,l]),Me=e.useCallback(async()=>{if(ue){ie([]),C(ue.id),$(""),I(""),ae([]),A(!0);try{const e=await a(ue.id);E(e)}catch{E([])}finally{A(!1)}}},[ue,a]),Ce=e.useCallback(async()=>{if(!(oe.length<=0))if(1===oe.length)await Me();else{const e=oe.slice(0,-1);ie(e);const t=e[e.length-1];C(t.id),$(""),I(""),A(!0);try{const[e,n]=await Promise.all([l(t.id),Ss(t.id)]);ae(e),E(n)}catch{ae([]),E([])}finally{A(!1)}}},[oe,Me,l]),Re=e.useCallback((e,t)=>{if(e<0||t<0||e>=T.length||t>=T.length)return;const n=[...T],[r]=n.splice(e,1);n.splice(t,0,r),N(n)},[T]),Oe=e.useCallback(e=>{T.find(t=>t._id===e._id)?ye(e._id):ge(e)},[T,i,ge,ye]),Te=d&&R.length>0&&(te||q);return e.createElement("div",{style:{...c},className:"steedos-user-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:R.map(e=>e.name).join(", "),onClick:()=>{w(!0),N([...R]),te&&(ne("users"),re(""),ce(!1),ie([]),ae([]),de(null))},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),variant:h||m?"borderless":"outlined",className:h?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...h?{backgroundColor:p?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{}},suffix:m?null:Te?e.createElement(Dn,{style:{color:"#ff4d4f",cursor:"pointer",padding:te?4:0},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),onClick:async e=>{e.stopPropagation(),O([]);const t=i?[]:null;u&&await u("change",{value:t},ee.current),o&&o(t),W(!1)}}):e.createElement(rr,{style:{color:"#999"},onMouseEnter:()=>!te&&R.length>0&&W(!0),onMouseLeave:()=>!te&&W(!1)})}),!te&&e.createElement(t.Modal,{title:i?"选择人员 (多选)":"选择人员",open:v,onOk:i?xe:void 0,onCancel:ke,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:1200,destroyOnClose:!0,bodyStyle:{height:600,overflow:"hidden",padding:0}},e.createElement("div",{style:{display:"flex",height:"100%"}},e.createElement("div",{style:{width:240,borderRight:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement(t.Input,{placeholder:"搜索部门",prefix:e.createElement(Zn,null),value:j,onChange:e=>(e=>{if(Q.current&&clearTimeout(Q.current),z(e),!e)return A(!0),void l().then(e=>{const t=e.map(e=>({...e,children:void 0}));k(t),J(e=>e+1);const n=t.map(e=>e.key);H(n),n.length>0&&C(String(n[0]))}).finally(()=>A(!1));Q.current=setTimeout(()=>{A(!0),l(void 0,e).then(e=>k(e)).finally(()=>A(!1))},300)})(e.target.value),allowClear:!0,style:{marginBottom:12},size:"small"}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(t.Spin,{spinning:_&&!M&&!D},e.createElement(t.Tree,{key:Y,treeData:x,onSelect:(e,t)=>{e.length>0?(C(String(e[0])),$(""),I(""),te&&t?.node&&(re(String(t.node.title||"")),ne("users"))):x.length>0&&C(String(x[0].key))},loadData:j?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await l(String(e));k(t=>fe(t,e,n))},showLine:!0,selectedKeys:M?[M]:[],expandedKeys:B,onExpand:H})))),e.createElement("div",{style:{flex:1,padding:16,display:"flex",flexDirection:"column"}},e.createElement("style",null,"\n .steedos-user-selector-item:hover {\n background-color: #f0f7ff !important;\n border-color: #1890ff !important;\n }\n "),e.createElement("div",{style:{display:"flex",gap:8,marginBottom:12}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Zn,null),value:L,onChange:e=>me(e.target.value),allowClear:!0,style:{flex:1}}),i&&S.length>0&&e.createElement(t.Button,{onClick:ve},S.every(e=>T.find(t=>t._id===e._id))?"取消":"全选")),e.createElement("div",{style:{flex:1,overflowY:"auto",border:"1px solid #f0f0f0",borderRadius:4,position:"relative"}},e.createElement(t.Spin,{spinning:_},S.length>0?e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"4px",padding:"0 8px"}},S.slice(0,he).map(n=>{const r=!!T.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:r&&i?"":"steedos-user-selector-item",onClick:()=>{i&&r||ge(n)},style:{padding:"10px 12px",borderRadius:4,cursor:"pointer",backgroundColor:K===n._id?"#e6f7ff":r&&i?"#f5f5f5":"transparent",borderColor:K===n._id||r&&i?"#1890ff":"transparent",borderWidth:1,borderStyle:"solid",transition:"all 0.2s",opacity:r&&i?.6:1,display:"flex",alignItems:"center",gap:12,minWidth:0}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:40,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,marginBottom:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.organization?.name&&e.createElement("span",null,n.organization.name),n.position&&e.createElement("span",null," · ",n.position)),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.email||n.mobile||n.username)),r&&e.createElement(Nn,{style:{color:"#1890ff",flexShrink:0}}))})),he<S.length&&e.createElement("div",{ref:pe,style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13,marginTop:8}},"滚动加载更多...")):!M&&!D||_?_?null:e.createElement(t.Empty,{description:"请选择部门或搜索",style:{marginTop:60}}):e.createElement(t.Empty,{description:"暂无人员",style:{marginTop:60}})))),e.createElement("div",{style:{width:240,borderLeft:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement("div",{style:{marginBottom:12,fontSize:14}},e.createElement("span",{style:{fontWeight:500}},"已选中"),e.createElement("span",{style:{marginLeft:8,color:"#999"}},"(",T.length,")")),e.createElement("div",{style:{flex:1,overflowY:"auto"}},T.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},T.map((n,r)=>e.createElement("div",{key:n._id,draggable:i,onDragStart:()=>(e=>{F(e)})(r),onDragEnd:be,onDragOver:e=>((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===P||P===t)return;const n=Date.now();if(n-X.current<100)return;X.current=n;const r=[...T],o=r[P];r.splice(P,1),r.splice(t,0,o),N(r),F(t)})(e,r),onMouseEnter:()=>U(n._id),onMouseLeave:()=>U(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:P===r?"#e6f7ff":"#f5f5f5",borderRadius:4,position:"relative",cursor:i?"grab":"default",transition:"all 0.3s ease",opacity:P===r?.5:1,border:P===r?"1px dashed #1890ff":"1px solid transparent",transform:P===r?"scale(0.98)":"scale(1)",boxShadow:P===r?"0 2px 8px rgba(0,0,0,0.1)":"none"}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:32,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),d&&V===n._id&&e.createElement(Dn,{onClick:()=>ye(n._id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f"}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),d&&T.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>N([]),style:{marginTop:8,padding:0}},"清空全部")))),te&&v&&e.createElement(ws,{visible:v,multiple:i,loading:_,users:S,searchKeyword:D,searchInputValue:L,tempSelectedUsers:T,clearable:d,rootDeptInfo:ue,deptPath:oe,currentLevelDepts:se,showSelectedPanel:le,onDrillDown:Se,onMobileBack:Ce,onDrillBack:Ee,onBackToRoot:Me,onToggleSelectedPanel:()=>ce(e=>!e),onUserSearch:me,onAddUser:ge,onRemoveUser:ye,onToggleUser:Oe,onToggleSelectAll:ve,onReorderUsers:Re,onOk:xe,onCancel:ke,onClearAll:()=>N([])}))};function Rs(e={}){return{...e}}async function Os(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 100, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}{const e=await fetch("/service/api/organizations/root",{headers:Rs()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}}function Ts(e,t){for(const n of e){if(n.key===t)return n;if(n.children){const e=Ts(n.children,t);if(e)return e}}return null}async function Ns(e,t){try{const n=`{node:organizations(filters: [["_id","=","${e}"]], top: 1){_id,name,fullname}}`,r=await fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json(),i=o.data?.node?.[0];if(!i)return t;if(i.fullname)return i.fullname;const s=[i.name];let a=i.parent;for(;a;)s.unshift(a.name),a=a.parent;return s.join(" / ")}catch{return t}}const _s=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择部门/分组",fetchDeptTree:a=Os,style:l,dispatchEvent:c,data:u,isTableMode:d=!1,hasError:h=!1,formalTableMode:p=!1,pickerFillRules:f,onFillFields:m,valueFormat:g="object"}=n,[y,b]=e.useState([]),v=e.useRef(null),[w,x]=e.useState(!1),[k,S]=e.useState(new Map),[E,M]=e.useState([]),[R,O]=e.useState(""),T=e.useRef(null),N=e.useRef([]),_=e.useRef(new Map),A=e.useRef([]),D=e=>"object"==typeof e&&e?.id?String(e.id).trim():String(e).trim(),$=e.useMemo(()=>i?Array.isArray(r)?r.map(e=>D(e)).filter(Boolean):r?"object"==typeof r&&r.id?[D(r)]:String(r).split(",").map(e=>e.trim()).filter(Boolean):[]:[],[r,i]),L=e.useCallback(e=>{if(!e)return"";if("object"==typeof e)return e.id?String(e.id).trim():e._id?String(e._id).trim():"";if("string"==typeof e){const t=e.trim();if(!t)return"";if(t.startsWith("{")&&t.endsWith("}"))try{const e=JSON.parse(t);if(e?.id)return String(e.id).trim();if(e?._id)return String(e._id).trim()}catch{}return t}return String(e).trim()},[]),I=e.useMemo(()=>i?r:L(r)||void 0,[r,i,L]);e.useEffect(()=>{v.current={props:n}}),e.useEffect(()=>{e.startTransition(()=>x(!0)),a().then(e=>{b(e);const t=e.map(e=>String(e.key));M(t);const n=(e,t="")=>e.map(e=>{const r=e.fullname||(t?`${t} / ${e.title}`:e.title);return{...e,pathLabel:r,children:e.children?n(e.children,r):void 0}}),r=n(e);b(r);const o=new Map,i=e=>{e.forEach(e=>{o.set(e.key,e.pathLabel),e.children&&i(e.children)})};i(r),S(o),N.current=r,_.current=o,A.current=t}).finally(()=>x(!1))},[a]),e.useEffect(()=>{const e=i?$:L(r)?[L(r)]:[];if(0===e.length)return;const t=(e,n)=>{for(const r of e){if(r.key===n)return!0;if(r.children&&t(r.children,n))return!0}return!1},n=e.filter(e=>!t(y,String(e)));if(n.length>0){const e=`{rows:organizations(filters: [["_id","in",${JSON.stringify(n)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(async e=>{const t=(e.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!0,pathLabel:e.fullname||e.name,isExtra:!0}));t.length>0&&(b(e=>{const n=new Set,r=e=>{e.forEach(e=>{n.add(e.key),e.children&&r(e.children)})};r(e);const o=t.filter(e=>!n.has(e.key));return 0===o.length?e:[...e,...o]}),S(e=>{const n=new Map(e);return t.forEach(e=>n.set(e.key,e.pathLabel)),n}))})}},[r,y,i,$,L]);const j=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:j(e.children,t,n)}:e),z=()=>{N.current.length>0&&(b(N.current),S(_.current),M(A.current))},P=e=>{const t=Ts(y,e),n=t?.title||"";return{id:e,name:n,fullname:t?.fullname||k.get(e)||n}};return e.createElement(t.Spin,{spinning:w,className:"steedos-org-selector"},e.createElement(t.TreeSelect,{treeData:y,className:"w-full "+(d?"picker-table-mode":""),value:i?$.map(e=>({value:String(e),label:k.get(String(e))||e})):I||void 0,onChange:async(e,t,n)=>{let r=e;if(i&&e&&(Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&"value"in e[0]?r=e.map(e=>e.value):Array.isArray(e)?r=e:"object"==typeof e&&"value"in e&&(r=e.value)),o||c){const e=async e=>{const t=await(c?.("change",e?C(u,{value:e}):u,v.current));t?.prevented||o?.(e)};if(Array.isArray(r)){await Promise.all(r.map(async e=>{const t=k.get(String(e));if(!t||!t.includes("/")){const t=Ts(y,String(e));if(t){const n=await Ns(String(e),t.title),r=new Map(k);r.set(String(e),n),S(r)}}}));const t=r.map(e=>P(String(e)));e("string"===g?t.map(e=>e.id):t)}else if(r){const t=k.get(String(r));if(!t||!t.includes("/")){const e=Ts(y,String(r));if(e){const t=await Ns(String(r),e.title),n=new Map(k);n.set(String(r),t),S(n)}}const n=P(String(r));e("string"===g?n.id:n)}else await e(void 0)}if(!i&&f&&f.length>0&&m&&r&&!Array.isArray(r)){const e=`{rows:organizations(filters: [["_id","=","${String(r)}"]], top: 1){${["_id",...f.map(e=>e.sourceField).filter(Boolean)].join(",")}}}`;fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];if(t.length>0){const e=t[0],n={};for(const t of f)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(n[t.targetField]=String(e[t.sourceField]));Object.keys(n).length>0&&m(n)}})}},treeCheckable:i,showCheckedStrategy:i?void 0:t.TreeSelect.SHOW_PARENT,placeholder:s,variant:d?"borderless":"outlined",style:{minWidth:196,...l,...d?{backgroundColor:h?"rgba(254,226,226,0.9)":p?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,width:"100%",fontSize:13}:{}},loadData:async e=>{if(e.children)return;x(!0);const t=await a(String(e.key));b(n=>{const r=new Set(t.map(e=>e.key)),o=n.filter(e=>!(e.isExtra&&r.has(e.key))),i=e.pathLabel||e.title,s=t.map(e=>({...e,pathLabel:e.fullname||`${i} / ${e.title}`})),a=j(o,String(e.key),s),l=new Map(k);return s.forEach(e=>{l.set(e.key,e.pathLabel)}),S(l),N.current=a,_.current=l,a}),x(!1)},treeDefaultExpandAll:!1,treeExpandedKeys:E,onTreeExpand:e=>{M(e.map(e=>String(e)))},allowClear:!0,multiple:i,treeCheckStrictly:i,treeLine:!0,styles:{popup:{root:{minWidth:400,maxWidth:450,maxHeight:700,overflow:"auto",zIndex:3e3}}},treeNodeLabelProp:"pathLabel",showSearch:!0,searchValue:R,onSearch:e=>{O(e),T.current&&clearTimeout(T.current),e?(x(!0),T.current=setTimeout(async()=>{const t=(await a(void 0,e)).map(e=>({...e,title:e.fullname||e.title,pathLabel:e.fullname||e.title}));b(t);const n=new Map;t.forEach(e=>{n.set(e.key,e.pathLabel)}),S(n),x(!1)},300)):z()},onDropdownVisibleChange:e=>{e&&R&&(O(""),z()),!e&&R&&(O(""),z())},filterTreeNode:!1,maxTagCount:"responsive",listHeight:600}))};function As(e={}){return{...e}}function Ds({value:t,isTableMode:n=!1}){const[r,o]=e.useState(new Map),{names:i,unresolvedIds:s}=function(e){return e?"object"==typeof e&&!Array.isArray(e)&&e.id?{names:[e.name||e.id],unresolvedIds:[]}:Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&e[0].id?{names:e.map(e=>e.name||e.id),unresolvedIds:[]}:{names:[],unresolvedIds:("string"==typeof e?e:Array.isArray(e)?e.join(","):String(e)).split(",").map(e=>e.trim()).filter(Boolean)}:{names:[],unresolvedIds:[]}}(t);e.useEffect(()=>{if(0===s.length)return;const e=s.filter(e=>!r.has(e));if(0===e.length)return;const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name}}`;fetch("/graphql",{method:"POST",headers:As({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];o(e=>{const n=new Map(e);for(const r of t)r.user&&r.name&&n.set(r.user,r.name);return n})}).catch(()=>{})},[t]);const a=n?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return i.length>0?React.createElement("div",{className:a},React.createElement("div",{className:"flex flex-wrap gap-1.5"},i.map((e,t)=>React.createElement("span",{key:t,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},e)))):0===s.length?React.createElement("div",{className:a}):React.createElement("div",{className:a},React.createElement("div",{className:"flex flex-wrap gap-1.5"},s.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},r.get(e)||e))))}function $s(e={}){return{...e}}function Ls({value:t,isTableMode:n=!1}){const r=function(e){return e?"object"==typeof e&&!Array.isArray(e)&&e.id?[{id:e.id,name:e.name||"",fullname:e.fullname||""}]:Array.isArray(e)?e.length>0&&"object"==typeof e[0]&&e[0].id?e.map(e=>({id:e.id,name:e.name||"",fullname:e.fullname||""})):e.map(e=>({id:String(e),name:"",fullname:""})):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean).map(e=>({id:e,name:"",fullname:""})):[]:[]}(t),[o,i]=e.useState(new Map);e.useEffect(()=>{if(0===r.length)return;const e=r.filter(e=>!e.name&&!o.has(e.id)).map(e=>e.id);if(0===e.length)return;const t=`{rows:organizations(filters: [["_id","in",${JSON.stringify(e)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:$s({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];i(e=>{const n=new Map(e);for(const r of t)r._id&&n.set(r._id,r.fullname||r.name||r._id);return n})}).catch(()=>{})},[t]);const s=n?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return 0===r.length?React.createElement("div",{className:s}):React.createElement("div",{className:s},React.createElement("div",{className:"flex flex-wrap gap-1.5"},r.map(e=>React.createElement("span",{key:e.id,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},e.fullname||e.name||o.get(e.id)||e.id))))}var Is,js,zs={exports:{}},Ps={};function Fs(){return js||(js=1,zs.exports=function(){if(Is)return Ps;Is=1;var t=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function a(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(o){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=r({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i(function(){c.value=n,c.getSnapshot=t,a(c)&&u({inst:c})},[e,n,t]),o(function(){return a(c)&&u({inst:c}),e(function(){a(c)&&u({inst:c})})},[e]),s(n),n};return Ps.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,Ps}()),zs.exports}var Bs=Fs();function Hs(t,n,r){const{children:o,...i}=n;return void 0!==r&&(i.key=r),void 0!==o?e.createElement(t,i,o):e.createElement(t,i)}function Vs(t,n,r){const{children:o,...i}=n;return Array.isArray(o)?e.createElement(t,i,...o):void 0!==o?e.createElement(t,i,o):e.createElement(t,i)}const Us=e.Fragment;function qs(e){this.content=e}function Ws(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=Ws(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Ys(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=Ys(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}qs.prototype={constructor:qs,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new qs(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new qs(n)},addToStart:function(e,t){return new qs([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new qs(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new qs(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=qs.from(e)).size?new qs(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=qs.from(e)).size?new qs(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=qs.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},qs.from=function(e){if(e instanceof qs)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new qs(t)};class Js{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new Js(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Js(n,r)}cutByIndex(e,t){return e==t?Js.empty:0==e&&t==this.content.length?this:new Js(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Js(r,o)}addToStart(e){return new Js([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Js(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ws(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ys(this,e,t,n)}findIndex(e){if(0==e)return Gs(0,e);if(e==this.size)return Gs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Gs(t+1,r):Gs(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Js.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Js(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Js.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new Js(t||e,n)}static from(e){if(!e)return Js.empty;if(e instanceof Js)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Js([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Js.empty=new Js([],0);const Ks={index:0,offset:0};function Gs(e,t){return Ks.index=e,Ks.offset=t,Ks}function Zs(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Zs(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Zs(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Qs=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Qs.none=[];class Xs extends Error{}class ea{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=na(this.content,e+this.openStart,t);return n&&new ea(n,this.openStart,this.openEnd)}removeBetween(e,t){return new ea(ta(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ea.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new ea(Js.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new ea(e,n,r)}}function ta(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(ta(i.content,t-o-1,n-o-1)))}function na(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=na(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function ra(e,t,n){if(n.openStart>e.depth)throw new Xs("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Xs("Inconsistent open depths");return oa(e,t,n,0)}function oa(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=oa(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)r=t.node(o).copy(Js.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return ca(i,ua(e,o,s,t,r))}{let r=e.parent,o=r.content;return ca(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return ca(i,da(e,t,r))}function ia(e,t){if(!t.type.compatibleContent(e.type))throw new Xs("Cannot join "+t.type.name+" onto "+e.type.name)}function sa(e,t,n){let r=e.node(n);return ia(r,t.node(n)),r}function aa(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function la(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(aa(e.nodeAfter,r),i++));for(let a=i;a<s;a++)aa(o.child(a),r);t&&t.depth==n&&t.textOffset&&aa(t.nodeBefore,r)}function ca(e,t){return e.type.checkContent(t),e.copy(t)}function ua(e,t,n,r,o){let i=e.depth>o&&sa(e,t,o+1),s=r.depth>o&&sa(n,r,o+1),a=[];return la(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(ia(i,s),aa(ca(i,ua(e,t,n,r,o+1)),a)):(i&&aa(ca(i,da(e,t,o+1)),a),la(t,n,o,a),s&&aa(ca(s,da(n,r,o+1)),a)),la(r,null,o,a),new Js(a)}function da(e,t,n){let r=[];if(la(null,e,n,r),e.depth>n){aa(ca(sa(e,t,n+1),da(e,t,n+1)),r)}return la(t,null,n,r),new Js(r)}ea.empty=new ea(Js.empty,0,0);class ha{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Qs.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ga(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(o),s=o-t;if(n.push(i,e,r+t),!s)break;if(i=i.child(e),i.isText)break;o=s-1,r+=t+1}return new ha(t,n,o)}static resolveCached(e,t){let n=ma.get(e);if(n)for(let o=0;o<n.elts.length;o++){let e=n.elts[o];if(e.pos==t)return e}else ma.set(e,n=new pa);let r=n.elts[n.i]=ha.resolve(e,t);return n.i=(n.i+1)%fa,r}}class pa{constructor(){this.elts=[],this.i=0}}const fa=12,ma=new WeakMap;class ga{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ya=Object.create(null);class ba{constructor(e,t,n,r=Qs.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Js.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Zs(this.attrs,t||e.defaultAttrs||ya)&&Qs.sameSet(this.marks,n||Qs.none)}copy(e=null){return e==this.content?this:new ba(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ba(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return ea.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new ea(a,r.depth-i,o.depth-i)}replace(e,t,n){return ra(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ha.resolveCached(this,e)}resolveNoCache(e){return ha.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),wa(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Js.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let a=r;a<o;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Qs.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Qs.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Js.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}ba.prototype.text=void 0;class va extends ba{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new va(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new va(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function wa(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class xa{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new ka(e,t);if(null==n.next)return xa.empty;let r=Sa(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(Ta(e,0));function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);Ta(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new xa(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Oa);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}(function(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}function i(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(i(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),o(i(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(i(e.expr,t),s),o(i(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,s),t),s=t}if(-1==e.max)o(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),o(i(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(e.exprs[r],t);if(r==e.exprs.length-1)return s;o(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Js.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}xa.empty=new xa(!0);class ka{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Sa(e){let t=[];do{t.push(Ea(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Ea(e){let t=[];do{t.push(Ma(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Ma(e){let t=function(e){if(e.eat("(")){let t=Sa(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let e=n[i];e.isInGroup(t)&&o.push(e)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Ra(e,t)}return t}function Ca(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ra(e,t){let n=Ca(e),r=n;return e.eat(",")&&(r="}"!=e.next?Ca(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Oa(e,t){return t-e}function Ta(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(Oa)}function Na(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function _a(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function Aa(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let n=e[o];n.validate&&n.validate(t[o])}}function Da(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new La(e,r,t[r]);return n}let $a=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Da(e,n.attrs),this.defaultAttrs=Na(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xa.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:_a(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ba(this,this.computeAttrs(e),Js.from(t),Qs.setFrom(n))}createChecked(e=null,t,n){return t=Js.from(t),this.checkContent(t),new ba(this,this.computeAttrs(e),t,Qs.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Js.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(Js.empty,!0);return o?new ba(this,e,t.append(o),Qs.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Aa(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Qs.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,o)=>r[t]=new e(t,n,o));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class La{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Ia{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Da(e,r.attrs),this.excluded=null;let o=Na(this.attrs);this.instance=o?new Qs(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Qs(this,_a(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new Ia(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Aa(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ja{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=qs.from(e.nodes),t.marks=qs.from(e.marks||{}),this.nodes=$a.compile(this.spec.nodes,this),this.marks=Ia.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let e=this.nodes[r],t=e.spec.content||"",o=e.spec.marks;if(e.contentMatch=n[t]||(n[t]=xa.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==o?null:o?za(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:za(this,t.split(" "))}this.nodeFromJSON=e=>ba.fromJSON(this,e),this.markFromJSON=e=>Qs.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof $a))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new va(n,n.defaultAttrs,e,Qs.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function za(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Pa{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new qa(this,t,!1);return n.addAll(e,Qs.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new qa(this,t,!0);return n.addAll(e,Qs.none,t.from,t.to),ea.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Wa(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Ya(e)),e.mark||e.ignore||e.clearMark||(e.mark=r)})}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Ya(e)),e.node||e.ignore||e.mark||(e.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Pa(e,Pa.schemaRules(e)))}}const Fa={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ba={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ha={ol:!0,ul:!0};function Va(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Ua{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Qs.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Js.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Js.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Js.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Fa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qa{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=Va(null,t.preserveWhitespace,0)|(n?4:0);r=o?new Ua(o.type,o.attrs,Qs.none,!0,t.topMatch||o.type.contentMatch,i):new Ua(n?null:e.schema.topNodeType,null,Qs.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();Ha.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Ha.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Ba.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Fa.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let e=this.parser.matchedStyles[r],o=n.getPropertyValue(e);if(o)for(let n;;){let r=this.parser.matchStyle(e,o,this,n);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;n=r}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let i=this.open,s=0;i>=0;i--){let t=this.nodes[i],a=t.findWrapping(e);if(a&&(!r||r.length>a.length+s)&&(r=a,o=t,!a.length))break;if(t.solid){if(n)break;s+=2}}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)t=this.enterInner(r[i],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Qs.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):Ja(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=Va(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Qs.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):Ja(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new Ua(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function Wa(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ya(e){let t={};for(let n in e)t[n]=e[n];return t}function Ja(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Ka{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Za(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=el(Za(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&el(Za(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return el(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ka(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ga(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Ga(e.marks)}}function Ga(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Za(e){return e.document||window.document}const Qa=new WeakMap;function Xa(e){let t=Qa.get(e);return void 0===t&&Qa.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function el(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Xa(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],u=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){u=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let d=u;d<t.length;d++){let o=t[d];if(0===o){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:i}=el(e,o,n,r);if(l.appendChild(t),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}const tl=Math.pow(2,16);function nl(e,t){return e+t*tl}function rl(e){return 65535&e}class ol{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class il{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&il.empty)return il.empty}recover(e){let t=0,n=rl(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/tl}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],u=a+l;if(e<=u){let o=a+r+((l?e==a?-1:e==u?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:u)?null:nl(s/3,e-a),d=e==a?2:e==u?1:4;return(t<0?e!=a:e!=u)&&(d|=8),new ol(o,d,i)}r+=c-l}return n?e+r:new ol(e+r,0,null)}touches(e,t){let n=0,r=rl(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let t=this.ranges[s]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[s+o];if(e<=t+a&&s==3*r)return!0;n+=this.ranges[s+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new il(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?il.empty:new il(e<0?[0,-e,0]:[0,0,e])}}il.empty=new il([]);class sl{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new sl(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new sl;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this._maps[o].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(o);if(null!=t&&t>o&&t<this.to){o=t,e=this._maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new ol(e,r,null)}}const al=Object.create(null);class ll{getMap(){return il.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=al[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in al)throw new RangeError("Duplicate use of step JSON ID "+e);return al[e]=t,t.prototype.jsonID=e,t}}class cl{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new cl(e,null)}static fail(e){return new cl(null,e)}static fromReplace(e,t,n,r){try{return cl.ok(e.replace(t,n,r))}catch(o){if(o instanceof Xs)return cl.fail(o.message);throw o}}}function ul(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(ul(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Js.fromArray(r)}class dl extends ll{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new ea(ul(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return cl.fromReplace(e,this.from,this.to,o)}invert(){return new hl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new dl(t.pos,n.pos,this.mark)}merge(e){return e instanceof dl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new dl(t.from,t.to,e.markFromJSON(t.mark))}}ll.jsonID("addMark",dl);class hl extends ll{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new ea(ul(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return cl.fromReplace(e,this.from,this.to,n)}invert(){return new dl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new hl(t.pos,n.pos,this.mark)}merge(e){return e instanceof hl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new hl(t.from,t.to,e.markFromJSON(t.mark))}}ll.jsonID("removeMark",hl);class pl extends ll{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cl.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return cl.fromReplace(e,this.pos,this.pos+1,new ea(Js.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new pl(this.pos,t.marks[n]);return new pl(this.pos,this.mark)}}return new fl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pl(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pl(t.pos,e.markFromJSON(t.mark))}}ll.jsonID("addNodeMark",pl);class fl extends ll{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cl.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return cl.fromReplace(e,this.pos,this.pos+1,new ea(Js.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new pl(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new fl(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new fl(t.pos,e.markFromJSON(t.mark))}}ll.jsonID("removeNodeMark",fl);class ml extends ll{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&yl(e,this.from,this.to)?cl.fail("Structure replace would overwrite content"):cl.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new il([this.from,this.to-this.from,this.slice.size])}invert(e){return new ml(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new ml(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ml)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?ea.empty:new ea(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ml(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?ea.empty:new ea(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ml(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ml(t.from,t.to,ea.fromJSON(e,t.slice),!!t.structure)}}ll.jsonID("replace",ml);class gl extends ll{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(yl(e,this.from,this.gapFrom)||yl(e,this.gapTo,this.to)))return cl.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return cl.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?cl.fromReplace(e,this.from,this.to,n):cl.fail("Content does not fit in gap")}getMap(){return new il([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new gl(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new gl(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new gl(t.from,t.to,t.gapFrom,t.gapTo,ea.fromJSON(e,t.slice),t.insert,!!t.structure)}}function yl(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function bl(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let t=i.child(l),c=a+t.nodeSize,u=r.matchType(t.type);if(u){r=u;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new hl(a,c,t.marks[r]));if(o&&t.isText&&"pre"!=n.whitespace){let e,r,o=/\r?\n|\r/g;for(;e=o.exec(t.text);)r||(r=new ea(Js.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new ml(a+e.index,a+e.index+e[0].length,r))}}else s.push(new ml(a,c,ea.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Js.empty,!0);e.replace(a,a,new ea(t,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function vl(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function wl(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!vl(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function xl(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(kl).concat({type:t,attrs:n}).concat(i.map(kl)):null}function kl(e){return{type:e,attrs:null}}function Sl(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function El(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function Ml(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let e=o.node(c),t=o.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=r&&r[u+1];i&&(n=n.replaceChild(0,i.type.create(i.attrs)));let s=r&&r[u]||e;if(!e.canReplace(t+1,e.childCount)||!s.type.validContent(n))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Cl(e,t){let n=e.resolve(t),r=n.index();return Rl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rl(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function Ol(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let e,i,s=r.index(o);if(o==r.depth?(e=r.nodeBefore,i=r.nodeAfter):n>0?(e=r.node(o+1),s++,i=r.node(o).maybeChild(s)):(e=r.node(o).maybeChild(s-1),i=r.node(o+1)),e&&!e.isTextblock&&Rl(e,i)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}}function Tl(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),s=r.node(e),a=!1;if(1==i)a=s.canReplace(n,n,o);else{let e=s.contentMatchAt(n).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(n,n,e[0])}if(a)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}function Nl(e,t,n=t,r=ea.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return _l(o,i,r)?new ml(t,n,r):new Al(o,i,r).fit()}function _l(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ll.jsonID("replaceAround",gl);class Al{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Js.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Js.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new ea(o,i,s);return e>-1?new gl(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new ml(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ll(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let i=this.depth;i>=0;i--){let e,{type:s,match:a}=this.frontier[i],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Js.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:i,parent:r,inject:l};if(2==t&&o&&(e=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:i,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ll(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new ea(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ll(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new ea(Dl(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new ea(Dl(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let f=0;f<o.length;f++)this.openFrontierNode(o[f]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));u=u.matchFragment(r)}let h=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=u.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(u=t,c.push(Il(e.mark(d.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=$l(this.placed,t,Js.from(c)),this.frontier[t].match=u,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=s;f<h;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?ea.empty:new ea(Dl(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new ea(Dl(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!jl(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=jl(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=jl(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=$l(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=$l(this.placed,this.depth,Js.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Js.empty,!0);e.childCount&&(this.placed=$l(this.placed,this.frontier.length,e))}}function Dl(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Dl(e.firstChild.content,t-1,n)))}function $l(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy($l(e.lastChild.content,t-1,n)))}function Ll(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Il(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Il(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Js.empty,!0)))),e.copy(r)}function jl(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function zl(e){return e.spec.defining||e.spec.definingForContent}function Pl(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Pl(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Js.empty,!0))}return e}function Fl(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Bl extends ll{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return cl.fail("No node at attribute step's position");let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return cl.fromReplace(e,this.pos,this.pos+1,new ea(Js.from(r),0,t.isLeaf?0:1))}getMap(){return il.empty}invert(e){return new Bl(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bl(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bl(t.pos,t.attr,t.value)}}ll.jsonID("attr",Bl);class Hl extends ll{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return cl.ok(n)}getMap(){return il.empty}invert(e){return new Hl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Hl(t.attr,t.value)}}ll.jsonID("docAttr",Hl);let Vl=class extends Error{};Vl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Vl.prototype=Object.create(Error.prototype)).constructor=Vl,Vl.prototype.name="TransformError";class Ul{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new sl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Vl(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=ea.empty){let r=Nl(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new ea(Js.from(n),0,0))}delete(e,t){return this.replace(e,t,ea.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(_l(o,i,r))return e.step(new ml(t,n,r));let s=Fl(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let e=o.node(h).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;s.indexOf(h)>-1?a=h:o.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let e=h.firstChild;if(c.push(e),p==r.openStart)break;h=e.content}for(let h=u-1;h>=0;h--){let e=c[h],t=zl(e.type);if(t&&!e.sameMarkup(o.node(Math.abs(a)-1)))u=h;else if(t||!e.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let t=(h+u+1)%(r.openStart+1),a=c[t];if(a)for(let c=0;c<s.length;c++){let u=s[(c+l)%s.length],d=!0;u<0&&(d=!1,u=-u);let h=o.node(u-1),p=o.index(u-1);if(h.canReplaceWith(p,p,a.type,a.marks))return e.replace(o.before(u),d?i.after(u):n,new ea(Pl(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let h=s.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>d));h--){let e=s[h];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let e=r.index(o);if(r.node(o).canReplaceWith(e,e,n))return r.before(o+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let e=r.indexAfter(o);if(r.node(o).canReplaceWith(e,e,n))return r.after(o+1);if(e<r.node(o).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new ea(Js.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=Fl(r,o);for(let s=0;s<i.length;s++){let t=i[s],n=s==i.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),o.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),o.indexAfter(t-1))))return e.delete(r.before(t),o.after(t))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=Js.empty,d=0;for(let f=i,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,u=Js.from(r.node(f).copy(u)),d++):l--;let h=Js.empty,p=0;for(let f=i,m=!1;f>n;f--)m||o.after(f+1)<o.end(f)?(m=!0,h=Js.from(o.node(f).copy(h)),p++):c++;e.step(new gl(l,c,s,a,new ea(u.append(h),d,p),u.size-d,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);El(e,r.node(),r.before(),a)}s.inlineContent&&bl(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new ml(c,l.map(t+n,-1),ea.empty,!0)),!0===r){let t=e.doc.resolve(c);Sl(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Js.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let e=n[s].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Js.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new gl(o,i,o,i,new ea(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&El(e,t,n,i),bl(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new gl(l,c,l+1,c-1,new ea(Js.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&Sl(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new gl(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ea(Js.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Bl(e,t,n)),this}setDocAttribute(e,t){return this.step(new Hl(e,t)),this}addNodeMark(e,t){return this.step(new pl(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Qs)t.isInSet(n.marks)&&this.step(new fl(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new fl(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=Js.empty,s=Js.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=Js.from(o.node(a).copy(i));let e=r&&r[c];s=Js.from(e?e.type.create(e.attrs,s):o.node(a).copy(s))}e.step(new ml(t,t,new ea(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new hl(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new dl(c,d,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof Ia){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new hl(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return bl(this,e,t,n),this}}const ql=Object.create(null);class Wl{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Yl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ea.empty){let n=t.content.lastChild,r=null;for(let s=0;s<t.openEnd;s++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?ea.empty:t),0==s&&rc(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),rc(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Gl(e):nc(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let r=t<0?nc(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):nc(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ec(e.node(0))}static atStart(e){return nc(e,e,0,0,1)||new ec(e)}static atEnd(e){return nc(e,e,e.content.size,e.childCount,-1)||new ec(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ql[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ql)throw new RangeError("Duplicate use of selection JSON ID "+e);return ql[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Gl.between(this.$anchor,this.$head).getBookmark()}}Wl.prototype.visible=!0;class Yl{constructor(e,t){this.$from=e,this.$to=t}}let Jl=!1;function Kl(e){Jl||e.parent.inlineContent||(Jl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Gl extends Wl{constructor(e,t=e){Kl(e),Kl(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Wl.near(n);let r=e.resolve(t.map(this.anchor));return new Gl(r.parent.inlineContent?r:n,n)}replace(e,t=ea.empty){if(super.replace(e,t),t==ea.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Gl&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Zl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Gl(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Wl.findFrom(t,n,!0)||Wl.findFrom(t,-n,!0);if(!e)return Wl.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Wl.findFrom(e,-n,!0)||Wl.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Gl(e,t)}}Wl.jsonID("text",Gl);class Zl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Zl(e.map(this.anchor),e.map(this.head))}resolve(e){return Gl.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ql extends Wl{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Wl.near(o):new Ql(o)}content(){return new ea(Js.from(this.node),0,0)}eq(e){return e instanceof Ql&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Xl(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ql(e.resolve(t.anchor))}static create(e,t){return new Ql(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Ql.prototype.visible=!1,Wl.jsonID("node",Ql);class Xl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Zl(n,n):new Xl(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Ql.isSelectable(n)?new Ql(t):Wl.near(t)}}class ec extends Wl{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ea.empty){if(t==ea.empty){e.delete(0,e.doc.content.size);let t=Wl.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ec(e)}map(e){return new ec(e)}eq(e){return e instanceof ec}getBookmark(){return tc}}Wl.jsonID("all",ec);const tc={map(){return this},resolve:e=>new ec(e)};function nc(e,t,n,r,o,i=!1){if(t.inlineContent)return Gl.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Ql.isSelectable(r))return Ql.create(e,n-(o<0?r.nodeSize:0))}else{let t=nc(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function rc(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof ml||i instanceof gl)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Wl.near(e.doc.resolve(o),n)))}class oc extends Ul{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Qs.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Qs.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Wl.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ic(e,t){return t&&e?e.bind(t):e}class sc{constructor(e,t,n){this.name=e,this.init=ic(t.init,n),this.apply=ic(t.apply,n)}}const ac=[new sc("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new sc("selection",{init:(e,t)=>e.selection||Wl.atStart(t.doc),apply:e=>e.selection}),new sc("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new sc("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class lc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ac.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new sc(e.key,e.spec.state,e))})}}class cc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new cc(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new oc(this)}static create(e){let t=new lc(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new cc(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new lc(this.schema,e.plugins),n=t.fields,r=new cc(t);for(let o=0;o<n.length;o++){let t=n[o].name;r[t]=this.hasOwnProperty(t)?this[t]:n[o].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new lc(e.schema,e.plugins),o=new cc(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=ba.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Wl.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function uc(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=uc(o,t,{})),n[r]=o}return n}class dc{constructor(e){this.spec=e,this.props={},e.props&&uc(e.props,this,this.props),this.key=e.key?e.key.key:pc("plugin")}getState(e){return e[this.key]}}const hc=Object.create(null);function pc(e){return e in hc?e+"$"+ ++hc[e]:(hc[e]=0,e+"$")}class fc{constructor(e="key"){this.key=pc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const mc=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function gc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const yc=(e,t,n)=>{let r=gc(e,n);if(!r)return!1;let o=xc(r);if(!o){let n=r.blockRange(),o=n&&wl(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(_c(e,o,t,-1))return!0;if(0==r.parent.content.size&&(vc(i,"end")||Ql.isSelectable(i)))for(let s=r.depth;;s--){let n=Nl(e.doc,r.before(s),r.after(s),ea.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(vc(i,"end")?Wl.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):Ql.create(r.doc,o.pos-i.nodeSize)),t(r.scrollIntoView())}return!0}if(1==s||r.node(s-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function bc(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=Nl(e.doc,o,s,ea.empty);if(!a||a.from!=o||a instanceof ml&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Gl.create(t.doc,o)),n(t.scrollIntoView())}return!0}function vc(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const wc=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=xc(r)}let s=i&&i.nodeBefore;return!(!s||!Ql.isSelectable(s))&&(t&&t(e.tr.setSelection(Ql.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function xc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function kc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Sc=(e,t,n)=>{let r=kc(e,n);if(!r)return!1;let o=Mc(r);if(!o)return!1;let i=o.nodeAfter;if(_c(e,o,t,1))return!0;if(0==r.parent.content.size&&(vc(i,"start")||Ql.isSelectable(i))){let n=Nl(e.doc,r.before(),r.after(),ea.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(vc(i,"start")?Wl.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Ql.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},Ec=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Mc(r)}let s=i&&i.nodeAfter;return!(!s||!Ql.isSelectable(s))&&(t&&t(e.tr.setSelection(Ql.create(e.doc,i.pos)).scrollIntoView()),!0)};function Mc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const Cc=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function Rc(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Oc=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof ec||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Rc(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Gl.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Tc=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Ml(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&wl(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const Nc=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Ql&&e.selection.node.isBlock)return!(!n.parentOffset||!Ml(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let h=n.depth;;h--){if(n.node(h).isBlock){a=n.end(h)==n.pos+(n.depth-h),l=n.start(h)==n.pos-(n.depth-h),i=Rc(n.node(h-1).contentMatchAt(n.indexAfter(h-1))),s.unshift(a&&i?{type:i}:null),o=h;break}if(1==h)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Gl||e.selection instanceof ec)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=Ml(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=Ml(c.doc,u,s.length,s)),!d)return!1;if(c.split(u,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0};function _c(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Cl(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=Js.empty;for(let e=o.length-1;e>=0;e--)i=Js.from(o[e].create(null,i));i=Js.from(s.copy(i));let l=e.tr.step(new gl(t.pos-1,r,t.pos,r,new ea(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Cl(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&l?null:Wl.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),h=d&&wl(d);if(null!=h&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(c&&vc(a,"start",!0)&&vc(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Js.empty;for(let e=o.length-1;e>=0;e--)r=Js.from(o[e].copy(r));n(e.tr.step(new gl(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new ea(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Ac(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Gl.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Dc=Ac(-1),$c=Ac(1);function Lc(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(r,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Ic(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}function jc(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new ga(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ga(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=xl(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=Js.empty;for(let u=n.length-1;u>=0;u--)i=Js.from(n[u].type.create(n[u].attrs,i));e.step(new gl(t.start-(r?2:0),t.end,t.start,t.end,new ea(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,h=!0;u<d;u++,h=!1)!h&&Ml(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize}(e,t,a,o,n);return!0}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}function zc(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,t=>t.childCount>0&&t.firstChild.type==e);return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new gl(i-1,s,i,s,new ea(Js.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ga(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=wl(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);Cl(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos);return t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)p-=o.child(f).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?Js.empty:Js.from(o))))return!1;let d=i.pos,h=d+s.nodeSize;return r.step(new gl(d-(a?1:0),h+(l?1:0),d+1,h-1,new ea((a?Js.empty:Js.from(o.copy(Js.empty))).append(l?Js.empty:Js.from(o.copy(Js.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}Ic(mc,yc,wc),Ic(mc,Sc,Ec),Ic(Cc,Oc,Tc,Nc),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const Pc=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Fc=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Bc=null;const Hc=function(e,t,n){let r=Bc||(Bc=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Vc=function(e,t,n,r){return n&&(qc(e,t,n,r,-1)||qc(e,t,n,r,1))},Uc=/^(img|br|input|textarea|hr)$/i;function qc(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Wc(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Yc(e)||Uc.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Pc(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Wc(e):0}}}}function Wc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Yc(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Jc=function(e){return e.focusNode&&Vc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Kc(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Gc="undefined"!=typeof navigator?navigator:null,Zc="undefined"!=typeof document?document:null,Qc=Gc&&Gc.userAgent||"",Xc=/Edge\/(\d+)/.exec(Qc),eu=/MSIE \d/.exec(Qc),tu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qc),nu=!!(eu||tu||Xc),ru=eu?document.documentMode:tu?+tu[1]:Xc?+Xc[1]:0,ou=!nu&&/gecko\/(\d+)/i.test(Qc);ou&&(/Firefox\/(\d+)/.exec(Qc)||[0,0])[1];const iu=!nu&&/Chrome\/(\d+)/.exec(Qc),su=!!iu,au=iu?+iu[1]:0,lu=!nu&&!!Gc&&/Apple Computer/.test(Gc.vendor),cu=lu&&(/Mobile\/\w+/.test(Qc)||!!Gc&&Gc.maxTouchPoints>2),uu=cu||!!Gc&&/Mac/.test(Gc.platform),du=!!Gc&&/Win/.test(Gc.platform),hu=/Android \d/.test(Qc),pu=!!Zc&&"webkitFontSmoothing"in Zc.documentElement.style,fu=pu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function mu(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function gu(e,t){return"number"==typeof e?e:e[t]}function yu(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function bu(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Fc(s);continue}let e=s,n=e==i.body,a=n?mu(i):yu(e),l=0,c=0;if(t.top<a.top+gu(r,"top")?c=-(a.top-t.top+gu(o,"top")):t.bottom>a.bottom-gu(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+gu(o,"top")-a.top:t.bottom-a.bottom+gu(o,"bottom")),t.left<a.left+gu(r,"left")?l=-(a.left-t.left+gu(o,"left")):t.right>a.right-gu(r,"right")&&(l=t.right-a.right+gu(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let u=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(u))break;s="absolute"==u?s.offsetParent:Fc(s)}}function vu(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Fc(r));return t}function wu(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let xu=null;function ku(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(1==u.nodeType)e=u.getClientRects();else{if(3!=u.nodeType)continue;e=Hc(u).getClientRects()}for(let h=0;h<e.length;h++){let p=e[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=u,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&e&&(a=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=u,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=Ru(o,1);if(r.top!=r.bottom&&Su(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:ku(n,r)}function Su(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Eu(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Su(t,o))return Eu(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Mu(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Wc(r.offsetNode),r.offset)}}catch(r){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Wc(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Su(t,n))return null;if(a=Eu(e.dom,t,n),!a)return null}if(lu)for(let c=a;n&&c;c=Fc(c))c.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(ou&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;pu&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let t,n=e.docView.nearestDesc(i,!0);if(!n)return null;if(1==n.dom.nodeType&&(n.node.isBlock&&n.parent||!n.contentDOM)&&((t=n.dom.getBoundingClientRect()).width||t.height)&&(n.node.isBlock&&n.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(n.dom.nodeName)&&(!s&&t.left>r.left||t.top>r.top?o=n.posBefore:(!s&&t.right<r.left||t.bottom<r.top)&&(o=n.posAfter),s=!0),!n.contentDOM&&o<0&&!n.node.isText))return(n.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?n.posBefore:n.posAfter;i=n.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=ku(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Cu(e){return e.top<e.bottom||e.left<e.right}function Ru(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Cu(e))return e}return Array.prototype.find.call(n,Cu)||e.getBoundingClientRect()}const Ou=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Tu(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=pu||ou;if(3==r.nodeType){if(!s||!Ou.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Nu(Ru(Hc(r,e,t),i),i<0)}{let e=Ru(Hc(r,o,o),n);if(ou&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Ru(Hc(r,o-1,o-1),-1);if(t.top==e.top){let n=Ru(Hc(r,o,o+1),-1);if(n.top!=e.top)return Nu(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Wc(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return _u(e.getBoundingClientRect(),!1)}if(null==i&&o<Wc(r)){let e=r.childNodes[o];if(1==e.nodeType)return _u(e.getBoundingClientRect(),!0)}return _u(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Wc(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Hc(e,Wc(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Nu(Ru(t,1),!1)}if(null==i&&o<Wc(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Hc(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Nu(Ru(t,-1),!0)}return Nu(Ru(3==r.nodeType?Hc(r):r,-n),n>=0)}function Nu(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function _u(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Au(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Du=/[\u0590-\u08ac]/;let $u=null,Lu=null,Iu=!1;function ju(e,t,n){return $u==t&&Lu==n?Iu:($u=t,Lu=n,Iu="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Au(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Tu(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Hc(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Du.test(r.parent.textContent)&&a.modify?Au(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),h=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(p){}return null!=l&&(a.caretBidiLevel=l),h}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class zu{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Pc(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let o=0;n<this.children.length;n++){let t=this.children[n],i=o+t.size;if(i>e||t instanceof qu){r=e-o;break}o=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Pu&&o.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Pc(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Pc(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Pc(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=Pc(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let p=0,f=0;p<this.children.length;p++){let s=this.children[p],a=f+s.size;if(o>f&&i<a)return s.setSelection(e-f-s.border,t-f-s.border,n,r);f=a}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),u=!1;if((ou||lu)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(u=!(!t||"\n"!=e.nodeValue[t-1]),u&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:Pc(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(ou&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||u&&lu)&&Vc(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Vc(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((l.extend||e==t)&&(!u||!ou)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(h){}}if(!d){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Pu extends zu{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Fu extends zu{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Bu extends zu{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Ka.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Bu(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=Bu.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=od(o,t,i,n)),e>0&&(o=od(o,0,e,n));for(let s=0;s<o.length;s++)o[s].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Hu extends zu{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),c=l&&l.dom,u=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Ka.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:u}=e)}u||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let d=c;return c=Xu(c,n,t),l?s=new Wu(e,t,n,r,c,u||null,d,l,o,i+1):t.isText?new Uu(e,t,n,r,c,d,o):new Hu(e,t,n,r,c,u||null,d,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Js.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ed(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new nd(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d,h,p;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(u?(d||(d=[u])).push(e):u=e)}if(u)if(d){d.sort(rd);for(let e=0;e<d.length;e++)n(d[e],c,!!l)}else n(u,c,!!l);if(l)p=-1,h=l,l=null;else{if(!(c<e.childCount))break;p=c,h=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+h.nodeSize;if(h.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-i),h=h.cut(0,e-i),f=e,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(h,h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,h),p),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Qs.none:this.node.child(o).marks,n,e,o),a.placeWidget(t,e,r)},(t,i,l,c)=>{let u;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,u,e)||a.updateNextNode(t,i,l,e,c,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Yu(this.contentDOM,this.children,e),cu&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Gl)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Fu(this,o,t,r);e.input.compositionNodes.push(i),this.children=od(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ed(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Zu(this.dom,this.nodeDOM,Gu(this.outerDeco,this.node,t),Gu(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Vu(e,t,n,r,o){Xu(r,t,e);let i=new Hu(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Uu extends Hu{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Uu(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class qu extends zu{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Wu extends Hu{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Yu(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=td(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Bu){let t=r?r.previousSibling:e.lastChild;Yu(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=td(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Ju=function(e){e&&(this.nodeName=e)};Ju.prototype=Object.create(null);const Ku=[new Ju];function Gu(e,t,n){if(0==e.length)return Ku;let r=n?Ku[0]:new Ju,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Ju(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Ju(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function Zu(e,t,n,r){if(n==Ku&&r==Ku)return t;let o=t;for(let i=0;i<r.length;i++){let t=r[i],s=n[i];if(i){let n;s&&s.nodeName==t.nodeName&&o!=e&&(n=o.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(o),s=Ku[0]),o=n}Qu(o,s||Ku[0],t)}return o}function Qu(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Xu(e,t,n){return Zu(e,e,Ku,Gu(t,n,1!=e.nodeType))}function ed(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function td(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class nd{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Bu)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=Bu.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){let r=this.top.children[s];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Hu){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,u=a.dom,d=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&ed(t,a.outerDeco));if(!d&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ed(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Hu.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Hu.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Pu(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Bu;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Uu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((lu||su)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new qu(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function rd(e,t){return e.type.side-t.type.side}function od(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function id(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Jc(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Ql.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Wc(e);r||o;){if(e==n)return!0;let t=Pc(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Wc(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new Ql(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!l){l=fd(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function sd(e){return e.editable?e.hasFocus():gd(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ad(e,t=!1){let n=e.state.selection;if(hd(e,n),sd(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&su){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Vc(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,Pc(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&nu&&ru<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!ld||n instanceof Gl||(n.$from.parent.inlineContent||(r=cd(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=cd(e,n.to))),e.docView.setSelection(i,s,e,t),ld&&(r&&dd(r),o&&dd(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{sd(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const ld=lu||su&&au<63;function cd(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(lu&&o&&"false"==o.contentEditable)return ud(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return ud(o);if(i)return ud(i)}}function ud(e){return e.contentEditable="true",lu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function dd(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function hd(e,t){if(t instanceof Ql){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(pd(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else pd(e)}function pd(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function fd(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Gl.between(t,n,r)}function md(e){return!(e.editable&&!e.hasFocus())&&gd(e)}function gd(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(n){return!1}}function yd(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Wl.findFrom(i,t)}function bd(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vd(e,t,n){let r=e.state.selection;if(!(r instanceof Gl)){if(r instanceof Ql&&r.node.isInline)return bd(e,new Gl(t>0?r.$to:r.$from));{let n=yd(e.state,t);return!!n&&bd(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return bd(e,new Gl(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=yd(e.state,t);return!!(n&&n instanceof Ql)&&bd(e,n)}if(!(uu&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Ql.isSelectable(i)?bd(e,new Ql(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!pu&&bd(e,new Gl(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function wd(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function xd(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function kd(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;ou&&1==n.nodeType&&r<wd(n)&&xd(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(xd(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Sd(n))break;{let t=n.previousSibling;for(;t&&xd(t,-1);)o=n.parentNode,i=Pc(t),t=t.previousSibling;if(t)n=t,r=wd(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Ed(e,n,r):o&&Ed(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=wd(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!xd(n.childNodes[r],1))break;o=n,i=++r}else{if(Sd(n))break;{let t=n.nextSibling;for(;t&&xd(t,1);)o=t.parentNode,i=Pc(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=wd(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Ed(e,o,i)}(e)}function Sd(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ed(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Yc(e);)t=Pc(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Yc(e);)t=Pc(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Jc(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&ad(e)},50)}function Md(e,t){let n=e.state.doc.resolve(t);if(!su&&!du&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Cd(e,t,n){let r=e.state.selection;if(r instanceof Gl&&!r.empty||n.indexOf("s")>-1)return!1;if(uu&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=yd(e.state,t);if(n&&n instanceof Ql)return bd(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof ec?Wl.near(n,t):Wl.findFrom(n,t);return!!s&&bd(e,s)}return!1}function Rd(e,t){if(!(e.state.selection instanceof Gl))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Od(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Td(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||uu&&72==n&&"c"==r)return Rd(e,-1)||kd(e,-1);if(46==n&&!t.shiftKey||uu&&68==n&&"c"==r)return Rd(e,1)||kd(e,1);if(13==n||27==n)return!0;if(37==n||uu&&66==n&&"c"==r){let t=37==n?"ltr"==Md(e,e.state.selection.from)?-1:1:-1;return vd(e,t,r)||kd(e,t)}if(39==n||uu&&70==n&&"c"==r){let t=39==n?"ltr"==Md(e,e.state.selection.from)?1:-1:1;return vd(e,t,r)||kd(e,t)}return 38==n||uu&&80==n&&"c"==r?Cd(e,-1,r)||kd(e,-1):40==n||uu&&78==n&&"c"==r?function(e){if(!lu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Od(e,n,"true"),setTimeout(()=>Od(e,n,"false"),20)}return!1}(e)||Cd(e,1,r)||kd(e,1):r==(uu?"m":"c")&&(66==n||73==n||89==n||90==n)}function Nd(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Ka.fromSchema(e.state.schema),a=Fd(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,d=0;for(;u&&1==u.nodeType&&(c=zd[u.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),d++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function _d(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new ea(Js.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Ka.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Fd().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&zd[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Bd||(Bd=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Bd.createHTML(e)}(e),n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),pu&&function(e){let t=e.querySelectorAll(su?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Pa.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ad.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(u)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(a){return e}let{content:o,openStart:i,openEnd:s}=e;for(let l=n.length-2;l>=0;l-=2){let e=r.nodes[n[l]];if(!e||e.hasRequiredAttrs())break;o=Js.from(e.create(n[l+1],o)),i++,s++}return new ea(o,i,s)}(jd(s,+u[1],+u[2]),u[4]);else if(s=ea.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&$d(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ld(i[i.length-1],r.length));let t=Dd(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return Js.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let n=s.content.firstChild;e<s.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=s.content.lastChild;t<s.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);s=jd(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Ad=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Dd(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Js.from(e));return e}function $d(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=$d(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(Js.from(Dd(n,e,o+1))))}}function Ld(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ld(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Js.empty,!0);return e.copy(n.append(r))}function Id(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Id(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Js.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function jd(e,t,n){return t<e.openStart&&(e=new ea(Id(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ea(Id(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const zd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Pd=null;function Fd(){return Pd||(Pd=document.implementation.createHTMLDocument("title"))}let Bd=null;const Hd={},Vd={},Ud={touchstart:!0,touchmove:!0};class qd{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Wd(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Yd(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Jd(e,t))})}function Jd(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Kd(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Gd(e){return{left:e.clientX,top:e.clientY}}function Zd(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,t=>s>i.depth?t(e,n,i.nodeAfter,i.before(s),o,!0):t(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Qd(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function Xd(e,t,n,r,o){return Zd(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Ql&&(n=o.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let e=s>i.depth?i.nodeAfter:i.node(s);if(Ql.isSelectable(e)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(Qd(e,Ql.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Ql.isSelectable(r))&&(Qd(e,new Ql(n)),!0)}(e,n))}function eh(e,t,n,r){return Zd(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function th(e,t,n,r){return Zd(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Qd(e,Gl.create(r,0,r.content.size)),!0);let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let t=i>o.depth?o.nodeAfter:o.node(i),n=o.before(i);if(t.inlineContent)Qd(e,Gl.create(r,n+1,n+1+t.content.size));else{if(!Ql.isSelectable(t))continue;Qd(e,Ql.create(r,n))}return!0}}(e,n,r)}function nh(e){return uh(e)}Vd.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!ih(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!hu||!su||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!cu||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Td(e,n)?n.preventDefault():Wd(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Vd.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Vd.keypress=(e,t)=>{let n=t;if(ih(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||uu&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Gl&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const rh=uu?"metaKey":"ctrlKey";Hd.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=nh(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[rh]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Gd(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new oh(e,s,n,!!r)):("doubleClick"==i?eh:th)(e,s.pos,s.inside,n)?n.preventDefault():Wd(e,"pointer"))};class oh{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[rh],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Ql&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!ou||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wd(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ad(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Gd(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wd(this.view,"pointer"):Xd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||lu&&this.mightDrag&&!this.mightDrag.node.isAtom||su&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Qd(this.view,Wl.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Wd(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wd(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function ih(e,t){return!!e.composing||!!(lu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Hd.touchstart=e=>{e.input.lastTouch=Date.now(),nh(e),Wd(e,"pointer")},Hd.touchmove=e=>{e.input.lastTouch=Date.now(),Wd(e,"pointer")},Hd.contextmenu=e=>nh(e);const sh=hu?5e3:-1;function ah(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>uh(e),t))}function lh(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ch(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Wc(e=e.childNodes[t-1])}else{if(!e.parentNode||Yc(e))return null;t=Pc(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Yc(e))return null;t=Pc(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function uh(e,t=!1){if(!(hu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),lh(e),t||e.docView&&e.docView.dirty){let n=id(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Vd.compositionstart=Vd.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Gl&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||su&&du&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),uh(e,!0),e.markCursor=null;else if(uh(e,!t.selection.empty),ou&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}ah(e,sh)},Vd.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ah(e,20))};const dh=nu&&ru<15||cu&&fu<604;function hh(e,t,n,r,o){let i=_d(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||ea.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ph(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Hd.copy=Vd.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=dh?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Nd(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Vd.paste=(e,t)=>{let n=t;if(e.composing&&!hu)return;let r=dh?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&hh(e,ph(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?hh(e,r.value,null,o,t):hh(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class fh{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const mh=uu?"altKey":"ctrlKey";function gh(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[mh]}Hd.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Gd(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Ql?i.to-1:i.to));else if(r&&r.mightDrag)o=Ql.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Ql.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:u}=Nd(e,a);(!n.dataTransfer.files.length||!su||au>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(dh?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",dh||n.dataTransfer.setData("text/plain",c),e.dragging=new fh(u,gh(e,n),o)},Hd.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Vd.dragover=Vd.dragenter=(e,t)=>t.preventDefault(),Vd.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Gd(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=_d(e,ph(t.dataTransfer),dh?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!gh(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||ea.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?Tl(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=l.doc;u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i);if(l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&Ql.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Ql(h));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(fd(e,h,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Hd.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ad(e)},20))},Hd.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Hd.beforeinput=(e,t)=>{if(su&&hu&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Kc(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let os in Vd)Hd[os]=Vd[os];function yh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class bh{constructor(e,t){this.toDOM=e,this.spec=t||Sh,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new xh(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof bh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&yh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class vh{constructor(e,t){this.attrs=e,this.spec=t||Sh}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new xh(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof vh&&yh(this.attrs,e.attrs)&&yh(this.spec,e.spec)}static is(e){return e.type instanceof vh}destroy(){}}class wh{constructor(e,t){this.attrs=e,this.spec=t||Sh}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new xh(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof wh&&yh(this.attrs,e.attrs)&&yh(this.spec,e.spec)}destroy(){}}class xh{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new xh(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new xh(e,e,new bh(t,n))}static inline(e,t,n,r){return new xh(e,t,new vh(n,r))}static node(e,t,n,r){return new xh(e,t,new wh(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof vh}get widget(){return this.type instanceof bh}}const kh=[],Sh={};class Eh{constructor(e,t){this.local=e.length?e:kh,this.children=t.length?t:kh}static create(e,t){return t.length?Nh(t,e,0,Sh):Mh}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Mh||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Sh)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach((t,n,r,o)=>{let i=o-r-(n-t);for(let s=0;s<a.length;s+=3){let r=a[s+1];if(r<0||t>r+u-e)continue;let o=a[s]+u-e;n>=o?a[s+1]=t<=o?-2:-1:t>=u&&i&&(a[s]+=i,a[s+1]+=i)}e+=i}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(-2==a[c+1]){l=!0,a[c+1]=-1;continue}let t=n.map(e[c]+i),u=t-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[c+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(u),f=r.maybeChild(h);if(f&&p==u&&p+f.nodeSize==d){let r=a[c+2].mapInner(n,f,t+1,e[c]+i+1,s);r!=Mh?(a[c]=u,a[c+1]=d,a[c+2]=r):(a[c+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}(a,e,t,n,o,i,s),c=Nh(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Eh(t.sort(_h),a)}(this.children,i||[],e,t,n,r,o):i?new Eh(i.sort(_h),kh):Mh}add(e,t){return t.length?this==Mh?Eh.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=Oh(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Nh(s,e,a+1,Sh)),o+=3}});let i=Rh(o?Th(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Eh(i.length?this.local.concat(i).sort(_h):this.local,r||this.children)}remove(e){return 0==e.length||this==Mh?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,s=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[o+2].removeInner(r,i+1);a!=Mh?n[o+2]=a:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<e.length;i++)if(o=e[i])for(let e=0;e<r.length;e++)r[e].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Eh(r,n):Mh}forChild(e,t){if(this==Mh)return this;if(t.isLeaf)return Eh.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let o=e+1,i=o+t.content.size;for(let s=0;s<this.local.length;s++){let e=this.local[s];if(e.from<i&&e.to>o&&e.type instanceof vh){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new Eh(r.sort(_h),kh);return n?new Ch([e,n]):e}return n||Mh}eq(e){if(this==e)return!0;if(!(e instanceof Eh)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ah(this.localsInner(e))}localsInner(e){if(this==Mh)return kh;if(e.inlineContent||!this.local.some(vh.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof vh||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Eh.empty=new Eh([],[]),Eh.removeOverlap=Ah;const Mh=Eh.empty;class Ch{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,Sh));return Ch.from(n)}forChild(e,t){if(t.isLeaf)return Eh.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Mh&&(o instanceof Ch?n=n.concat(o.members):n.push(o))}return Ch.from(n)}eq(e){if(!(e instanceof Ch)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Ah(n?t:t.sort(_h)):kh}static from(e){switch(e.length){case 0:return Mh;case 1:return e[0];default:return new Ch(e.every(e=>e instanceof Eh)?e:e.reduce((e,t)=>e.concat(t instanceof Eh?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Rh(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new xh(o.from+t,o.to+t,o.type))}return n}function Oh(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i,s=0;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[s]=null);return o}function Th(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Nh(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Oh(e,t,s+n);if(a){i=!0;let e=Nh(a,t,n+s+1,r);e!=Mh&&o.push(s,s+t.nodeSize,e)}});let s=Rh(i?Th(e):e,-n).sort(_h);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Eh(s,o):Mh}function _h(e,t){return e.from-t.from||e.to-t.to}function Ah(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Dh(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Dh(t,o+1,i.copy(r.to,i.to)))}}return t}function Dh(e,t,n){for(;t<e.length&&_h(n,e[t])>0;)t++;e.splice(t,0,n)}function $h(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Mh&&t.push(r)}),e.cursorWrapper&&t.push(Eh.create(e.state.doc,[e.cursorWrapper.deco])),Ch.from(t)}const Lh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ih=nu&&ru<=11;class jh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class zh{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new jh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);nu&&ru<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():lu&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ih&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Lh)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(md(this.view)){if(this.suppressingSelectionUpdates)return ad(this.view);if(nu&&ru<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Vc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let o=e.focusNode;o;o=Fc(o))n.add(o);for(let o=e.anchorNode;o;o=Fc(o))if(n.has(o)){t=o;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&md(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let c=0;c<t.length;c++){let e=this.registerMutation(t[c],a);e&&(o=o<0?e.from:Math.min(e.from,o),i=i<0?e.to:Math.max(e.to,i),e.typeOver&&(s=!0))}if(!a.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(ou&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Hh(e,n)==t||r.remove()}}}}else for(let c of a)if("BR"==c.nodeName&&c.parentNode){let e=c.nextSibling;e&&1==e.nodeType&&"false"==e.contentEditable&&c.parentNode.removeChild(c)}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Jc(n)&&(l=id(e))&&l.eq(Wl.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ad(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(Ph.has(e))return;if(Ph.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=ou,Fh)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Fh=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ad(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(nu&&ru<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?Pc(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Pc(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ph=new WeakMap,Fh=!1;function Bh(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Vc(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Hh(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Vh(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(lu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||lu&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Uh=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function qh(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=id(e,t);if(n&&!e.state.selection.eq(n)){if(su&&hu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,u=e.state.selection,d=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(r=[{node:u,offset:c.anchorOffset}],Jc(c)||r.push({node:c.focusNode,offset:c.focusOffset})),su&&8===e.input.lastKeyCode)for(let g=s;g>i;g--){let e=o.childNodes[g-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){s=g;break}if(!t||t.size)break}let d=e.state.doc,h=e.someProp("domParser")||Pa.fromSchema(e.state.schema),p=d.resolve(a),f=null,m=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Vh,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),h=e.state.doc,p=h.slice(d.from,d.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){r-=s+Math.max(0,i-Math.min(s,a))-i}if(s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&Jh(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&Jh(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(p.content,d.doc.content,d.from,l,c);if(f&&e.input.domChangeCount++,(cu&&e.input.lastIOSEnter>Date.now()-225||hu)&&o.some(e=>1==e.nodeType&&!Uh.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&u instanceof Gl&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=Wh(e,e.state.doc,d.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:u.from,endA:u.to,endB:u.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Gl&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),nu&&ru<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>d.from&&" "==d.doc.textBetween(f.start-d.from-1,f.start-d.from+1)&&(f.start--,f.endA--,f.endB--);let m=d.doc.resolveNoCache(f.start-d.from),g=d.doc.resolveNoCache(f.endB-d.from),y=h.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA;if((cu&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&m.pos<d.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(d.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Yh(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Yh(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Yh(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Kc(8,"Backspace"))))return void(hu&&su&&e.domObserver.suppressSelectionUpdates());su&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),hu&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==f.endA&&(f.endB-=2,g=d.doc.resolveNoCache(f.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Kc(13,"Enter"))})},20));let v,w=f.start,x=f.endA,k=t=>{let n=t||e.state.tr.replace(w,x,d.doc.slice(f.start-d.from,f.endB-d.from));if(d.sel){let t=Wh(e,n.doc,d.sel);t&&!(su&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(x)-1)||nu&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){nu&&ru<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ad(e),20));let t=k(e.state.tr.delete(w,x)),n=h.resolve(f.start).marksAcross(h.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(v=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let u=0;u<s.length;u++)a=s[u].removeFromSet(a);for(let u=0;u<i.length;u++)l=i[u].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let u=0;u<t.childCount;u++)c.push(o(t.child(u)));if(Js.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start())))){let t=k(e.state.tr);"add"==v.type?t.addMark(w,x,v.mark):t.removeMark(w,x,v.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,w,x));e.someProp("handleTextInput",r=>r(e,w,x,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}function Wh(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:fd(e,t.resolve(n.anchor),t.resolve(n.head))}function Yh(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function Jh(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class Kh{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new qd,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ep),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Qh(this),Zh(this),this.nodeViews=Xh(this),this.docView=Vu(this.state.doc,Gh(this),$h(this),this.dom,this),this.domObserver=new zh(this,(e,t,n,r)=>qh(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Hd){let n=Hd[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Kd(e,t)||Jd(e,t)||!e.editable&&t.type in Vd||n(e,t)},Ud[t]?{passive:!0}:void 0)}lu&&e.dom.addEventListener("input",()=>null),Yd(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Yd(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ep),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(lh(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Xh(this);(function(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Yd(this),this.editable=Qh(this),Zh(this);let a=$h(this),l=Gh(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(e.doc,l,a);!u&&e.selection.eq(r.selection)||(i=!0);let d="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:vu(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(nu||su)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(u){let n=su?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ch(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Vu(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Vc(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?ad(this,t):(hd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;wu(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Ql){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&bu(this,t.getBoundingClientRect(),e)}else bu(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new fh(e.slice,e.move,r<0?void 0:Ql.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[e];if(null!=r&&(n=t?t(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(nu){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(xu)return e.focus(xu);let t=vu(e);e.focus(null==xu?{get preventScroll(){return xu={preventScroll:!0},!0}}:void 0),xu||(xu=!1,wu(t,0))}(this.dom),ad(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Mu(this,e)}coordsAtPos(e,t=1){return Tu(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return ju(this,t||this.state,e)}pasteHTML(e,t){return hh(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return hh(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Nd(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$h(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Bc=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Jd(e,t)||!Hd[t.type]||!e.editable&&t.type in Vd||Hd[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?lu&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Bh(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Bh(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Gh(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[xh.node(0,e.state.doc.content.size,t)]}function Zh(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:xh.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Qh(e){return!e.someProp("editable",t=>!1===t(e.state))}function Xh(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function ep(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Kh.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var tp={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},np={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rp="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),op="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ip=0;ip<10;ip++)tp[48+ip]=tp[96+ip]=String(ip);for(ip=1;ip<=24;ip++)tp[ip+111]="F"+ip;for(ip=65;ip<=90;ip++)tp[ip]=String.fromCharCode(ip+32),np[ip]=String.fromCharCode(ip);for(var sp in tp)np.hasOwnProperty(sp)||(np[sp]=tp[sp]);const ap="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lp="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function cp(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let a=0;a<i.length-1;a++){let e=i[a];if(/^(cmd|meta|m)$/i.test(e))o=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);ap?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function up(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function dp(e){let t=function(e){let t=Object.create(null);for(let n in e)t[cp(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(rp&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||op&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?np:tp)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[up(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[up(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(lp&&n.ctrlKey&&n.altKey)&&(r=tp[n.keyCode])&&r!=o){let o=t[up(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var hp=Object.defineProperty,pp=(e,t)=>{for(var n in t)hp(e,n,{get:t[n],enumerable:!0})};function fp(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var mp=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:fp({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},gp={};pp(gp,{blur:()=>yp,clearContent:()=>bp,clearNodes:()=>vp,command:()=>wp,createParagraphNear:()=>xp,cut:()=>kp,deleteCurrentNode:()=>Sp,deleteNode:()=>Mp,deleteRange:()=>Cp,deleteSelection:()=>Rp,enter:()=>Op,exitCode:()=>Tp,extendMarkRange:()=>Ip,first:()=>jp,focus:()=>Vp,forEach:()=>Up,insertContent:()=>qp,insertContentAt:()=>Kp,joinBackward:()=>Qp,joinDown:()=>Zp,joinForward:()=>Xp,joinItemBackward:()=>ef,joinItemForward:()=>tf,joinTextblockBackward:()=>nf,joinTextblockForward:()=>rf,joinUp:()=>Gp,keyboardShortcut:()=>sf,lift:()=>lf,liftEmptyBlock:()=>cf,liftListItem:()=>uf,newlineInCode:()=>df,resetAttributes:()=>ff,scrollIntoView:()=>mf,selectAll:()=>gf,selectNodeBackward:()=>yf,selectNodeForward:()=>bf,selectParentNode:()=>vf,selectTextblockEnd:()=>wf,selectTextblockStart:()=>xf,setContent:()=>Sf,setMark:()=>om,setMeta:()=>im,setNode:()=>sm,setNodeSelection:()=>am,setTextDirection:()=>lm,setTextSelection:()=>cm,sinkListItem:()=>um,splitBlock:()=>hm,splitListItem:()=>pm,toggleList:()=>gm,toggleMark:()=>ym,toggleNode:()=>bm,toggleWrap:()=>vm,undoInputRule:()=>wm,unsetAllMarks:()=>xm,unsetMark:()=>km,unsetTextDirection:()=>Sm,updateAttributes:()=>Em,wrapIn:()=>Mm,wrapInList:()=>Cm});var yp=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),bp=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),vp=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=wl(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},wp=e=>t=>e(t),xp=()=>({state:e,dispatch:t})=>Oc(e,t),kp=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Gl(r.doc.resolve(Math.max(s-1,0)))),!0},Sp=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1){if(o.node(i).type===r.type){if(t){const t=o.before(i),n=o.after(i);e.delete(t,n).scrollIntoView()}return!0}}return!1};function Ep(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Mp=e=>({tr:t,state:n,dispatch:r})=>{const o=Ep(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1){if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}}return!1},Cp=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},Rp=()=>({state:e,dispatch:t})=>mc(e,t),Op=()=>({commands:e})=>e.keyboardShortcut("Enter"),Tp=()=>({state:e,dispatch:t})=>((e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Rc(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Wl.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t);function Np(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function _p(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Np(t[r])?t[r].test(e[r]):t[r]===e[r])}function Ap(e,t,n={}){return e.find(e=>e.type===t&&_p(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Dp(e,t,n={}){return!!Ap(e,t,n)}function $p(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some(e=>e.type===t)||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(e=>e.type===t))return;n=n||(null==(r=o.node.marks[0])?void 0:r.attrs);if(!Ap([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&Dp([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Dp([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Lp(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Ip=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Lp(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const e=$p(l,i,t);if(e&&e.from<=c&&e.to>=u){const t=Gl.create(s,e.from,e.to);n.setSelection(t)}}return!0},jp=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function zp(e){return e instanceof Gl}function Pp(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Fp(e,t=null){if(!t)return null;const n=Wl.atStart(e),r=Wl.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Gl.create(e,Pp(0,o,i),Pp(e.content.size,o,i)):Gl.create(e,Pp(t,o,i),Pp(t,o,i))}function Bp(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function Hp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Vp=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(Hp()||Bp())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||Hp()||Bp()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!zp(n.state.selection))return s(),!0;const a=Fp(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Up=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),qp=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Wp=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Wp(r)}return e};function Yp(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Wp(n)}function Jp(e,t,n){if(e instanceof ba||e instanceof Js)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Js.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),Jp("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new ja({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?Pa.fromSchema(i).parseSlice(Yp(e),n.parseOptions):Pa.fromSchema(i).parse(Yp(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=Pa.fromSchema(t);return n.slice?r.parseSlice(Yp(e),n.parseOptions).content:r.parse(Yp(e),n.parseOptions)}return Jp("",t,n)}var Kp=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const l=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Jp(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(a){l(a)}try{o=Jp(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(a){return l(a),!1}let{from:u,to:d}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,p=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),h=!!h&&(e.isText&&0===e.marks.length),p=!!p&&e.isBlock}),u===d&&p){const{parent:e}=r.doc.resolve(u);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(u-=1,d+=1)}let f;if(h){if(Array.isArray(t))f=t.map(e=>e.text||"").join("");else if(t instanceof Js){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f="object"==typeof t&&t&&t.text?t.text:t;r.insertText(f,u,d)}else{f=o;const e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&(u=Math.max(0,u-1)),r.replaceWith(u,d,f)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof ml||o instanceof gl))return;const i=e.mapping.maps[r];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(Wl.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:f}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:f})}return!0},Gp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof Ql;if(o){if(r.node.isTextblock||!Cl(e.doc,r.from))return!1;n=r.from}else if(n=Ol(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(Ql.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Zp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof Ql){if(r.node.isTextblock||!Cl(e.doc,r.to))return!1;n=r.to}else if(n=Ol(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Qp=()=>({state:e,dispatch:t})=>yc(e,t),Xp=()=>({state:e,dispatch:t})=>Sc(e,t),ef=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Ol(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},tf=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Ol(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},nf=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=gc(e,n);if(!r)return!1;let o=xc(r);return!!o&&bc(e,o,t)})(e,t),rf=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=kc(e,n);if(!r)return!1;let o=Mc(r);return!!o&&bc(e,o,t)})(e,t);function of(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var sf=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let a=0;a<t.length-1;a+=1){const e=t[a];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))n=!0;else if(/^(c|ctrl|control)$/i.test(e))r=!0;else if(/^s(hift)?$/i.test(e))o=!0;else{if(!/^mod$/i.test(e))throw new Error(`Unrecognized modifier name: ${e}`);Hp()||of()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function af(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?Ep(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>_p(e.node.attrs,n,{strict:!1}));if(i)return!!c.length;return c.reduce((e,t)=>e+t.to-t.from,0)>=l}var lf=(e,t={})=>({state:n,dispatch:r})=>!!af(n,Ep(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&wl(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),cf=()=>({state:e,dispatch:t})=>Tc(e,t),uf=e=>({state:t,dispatch:n})=>zc(Ep(e,t.schema))(t,n),df=()=>({state:e,dispatch:t})=>Cc(e,t);function hf(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function pf(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ff=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=hf("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=Ep(e,r.schema)),"mark"===a&&(s=Lp(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,pf(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(pf(i.attrs,t))))})})}),l},mf=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),gf=()=>({tr:e,dispatch:t})=>{if(t){const t=new ec(e.doc);e.setSelection(t)}return!0},yf=()=>({state:e,dispatch:t})=>wc(e,t),bf=()=>({state:e,dispatch:t})=>Ec(e,t),vf=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(Ql.create(e.doc,n))),!0)})(e,t),wf=()=>({state:e,dispatch:t})=>$c(e,t),xf=()=>({state:e,dispatch:t})=>Dc(e,t);function kf(e,t,n={},r={}){return Jp(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Sf=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=kf(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function Ef(e,t){const n=Lp(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function Mf(e,t){const n=new Ul(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Cf(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function Rf(e,t,n){if(void 0===e.config[t]&&e.parent)return Rf(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?Rf(e.parent,t,n):null})}return e.config[t]}function Of(e){return e.map(e=>{const t=Rf(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Of(t())]:e}).flat(10)}function Tf(e,t){const n=Ka.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Nf(e){return"function"==typeof e}function _f(e,t=void 0,...n){return Nf(e)?t?e.bind(t)(...n):e(...n):e}function Af(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Df(e){const t=[],{nodeExtensions:n,markExtensions:r}=Af(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=Rf(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});if(!n)return;n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Rf(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function $f(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let o=0;o<r;o+=1){const e=n[o],r=e.indexOf(":");if(-1===r)continue;const i=e.slice(0,r).trim(),s=e.slice(r+1).trim();i&&s&&t.push([i,s])}return t}function Lf(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...$f(n[e]),...$f(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function If(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Lf(e,t),{})}function jf(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function zf(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Pf(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function Ff(e){return e.sort((e,t)=>{const n=Rf(e,"priority")||100,r=Rf(t,"priority")||100;return n>r?-1:n<r?1:0})}function Bf(e){const t=Ff(Of(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function Hf(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,c)=>{var u;e.isBlock&&n>r&&(a+=i);const d=null==s?void 0:s[e.type.name];if(d)return l&&(a+=d({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(u=null==e?void 0:e.text)?void 0:u.slice(Math.max(r,n)-n,o-n))}),a}function Vf(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Uf(e,t){const n=hf("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=Ep(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?Ef(e,t):{}}function qf(e){const t=function(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Wf(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),qf(r)}function Yf(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=$p(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function Jf(e,t){return t.nodes[e]||t.marks[e]||null}function Kf(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Gf(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Lp(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>_p(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>_p(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function Zf(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Qf(e,t){const{nodeExtensions:n}=Af(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=_f(Rf(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Xf(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Xf(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function em(e){return e instanceof Ql}var tm=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function nm(e,t){const n=t.mapping.mapResult(e.position);return{position:new tm(n.pos),mapResult:n}}function rm(e){return new tm(e)}var om=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Lp(e,r.schema);if(o)if(s){const e=Ef(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(zp(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},im=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sm=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=Ep(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!Lc(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Lc(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},am=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=Pp(e,0,n.content.size),o=Ql.create(n,r);t.setSelection(o)}return!0},lm=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},cm=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Gl.atStart(n).from,s=Gl.atEnd(n).to,a=Pp(r,i,s),l=Pp(o,i,s),c=Gl.create(n,a,l);t.setSelection(c)}return!0},um=e=>({state:t,dispatch:n})=>{const r=Ep(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,e=>e.childCount>0&&e.firstChild.type==o);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=Js.from(n?o.create():null),s=new ea(Js.from(o.create(null,Js.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new gl(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function dm(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var hm=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Kf(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof Ql&&i.node.isBlock)return!(!a.parentOffset||!Ml(s,a.pos))&&(r&&(e&&dm(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,d=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=u&&d?[{type:d,attrs:c}]:void 0,p=Ml(t.doc,t.mapping.map(a.pos),1,h);if(h||p||!Ml(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)||(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(i instanceof Gl&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),d&&!u&&!a.parentOffset&&a.parent.type!==d)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,d)&&t.setNodeMarkup(t.mapping.map(a.before()),d)}e&&dm(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},pm=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=Ep(e,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=Js.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=Js.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={...Kf(h,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(Js.from(a.createAndFill(null,c)||void 0));const u=l.before(l.depth-(r-1));n.replace(u,l.after(-o),new ea(e,4-r,0));let d=-1;n.doc.nodesBetween(u,n.doc.content.size,(e,t)=>{if(d>-1)return!1;e.isTextblock&&0===e.content.size&&(d=t+1)}),d>-1&&n.setSelection(Gl.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...Kf(h,d.type.name,d.attrs),...t},m={...Kf(h,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!Ml(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const c=a.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},fm=(e,t)=>{const n=Cf(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Cl(e.doc,n.pos)||(e.join(n.pos),!0)},mm=(e,t)=>{const n=Cf(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Cl(e.doc,r)||(e.join(r),!0)},gm=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=o.extensionManager,p=Ep(e,s.schema),f=Ep(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,v=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const x=Cf(e=>Qf(e.type.name,d))(m);if(v.depth>=1&&x&&v.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(f);if(Qf(x.node.type.name,d)&&p.validContent(x.node.content)&&a)return l().command(()=>(i.setNodeMarkup(x.pos,p),!0)).command(()=>fm(i,p)).command(()=>mm(i,p)).run()}return n&&w&&a?l().command(()=>{const e=u().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>fm(i,p)).command(()=>mm(i,p)).run():l().command(()=>!!u().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>fm(i,p)).command(()=>mm(i,p)).run()},ym=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Lp(e,r.schema);return Gf(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},bm=(e,t,n={})=>({state:r,commands:o})=>{const i=Ep(e,r.schema),s=Ep(t,r.schema),a=af(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},vm=(e,t={})=>({state:n,commands:r})=>{const o=Ep(e,n.schema);return af(n,o,t)?r.lift(o):r.wrapIn(o,t)},wm=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},xm=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},km=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Lp(e,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find(e=>e.type===l))?void 0:i.attrs,o=$p(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else d.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},Sm=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},Em=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=hf("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=Ep(e,r.schema)),"mark"===a&&(s=Lp(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let u,d,h,p;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,h=Math.max(t,a),p=Math.min(t+e.nodeSize,c),u=t,d=e)}):r.doc.nodesBetween(a,c,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,h=Math.max(r,a),p=Math.min(r+e.nodeSize,c),u=r,d=e),r>=a&&r<=c&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,c);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),d&&(void 0!==u&&o&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),s&&d.marks.length&&d.marks.forEach(e=>{s===e.type&&o&&n.addMark(h,p,s.create({...e.attrs,...t}))}))}),l},Mm=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&xl(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(Ep(e,n.schema),t)(n,r),Cm=(e,t={})=>({state:n,dispatch:r})=>jc(Ep(e,n.schema),t)(n,r),Rm=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Om=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Tm(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let u=!1;const d=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+i;return s.forEach(e=>{if(u)return;const t=((e,t)=>{if(Np(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(d,e.find);if(!t)return;const s=l.state.tr,c=fp({state:l.state,transaction:s}),h={from:r-(t[0].length-i.length),to:o},{commands:p,chain:f,can:m}=new mp({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),u=!0)}),u}function Nm(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function _m(e,t){const n={...e};return Nm(e)&&Nm(t)&&Object.keys(t).forEach(r=>{Nm(t[r])&&Nm(e[r])?n[r]=_m(e[r],t[r]):n[r]=t[r]}),n}var Am=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{..._f(Rf(this,"addOptions",{name:this.name}))||{}}}get storage(){return{..._f(Rf(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>_m(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Dm=class e extends Am{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};var $m=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Lm(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:u}=new mp({editor:t,state:n}),d=[];n.doc.nodesBetween(r,o,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),v=Math.min(o,t+y);if(b>=v)return;((e,t,n)=>{if(Np(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,v-t,void 0,""),i.find,s).forEach(e=>{if(void 0===e.index)return;const t=b+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(h)})});return d.every(e=>null!==e)}var Im=null;function jm(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,c=fp({state:e,transaction:l});if(Lm({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new dc({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(Im=t)},r=()=>{Im&&(Im=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=Im;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],c="paste"===o.getMeta("uiEvent")&&!i,u="drop"===o.getMeta("uiEvent")&&!s,d=o.getMeta("applyPasteRules"),h=!!d;if(!c&&!u&&!h)return;if(h){let{text:t}=d;"string"==typeof t||(t=Tf(Js.from(t),r.schema));const{from:n}=d,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const p=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&f&&p!==f.b?l({rule:e,state:r,from:p,to:f,pasteEvt:a}):void 0}}))}var zm=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Bf(e),this.schema=function(e,t){var n;const r=Df(e),{nodeExtensions:o,markExtensions:i}=Af(e),s=null==(n=o.find(e=>Rf(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=zf({...e.reduce((e,t)=>{const r=Rf(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:_f(Rf(n,"content",i)),marks:_f(Rf(n,"marks",i)),group:_f(Rf(n,"group",i)),inline:_f(Rf(n,"inline",i)),atom:_f(Rf(n,"atom",i)),selectable:_f(Rf(n,"selectable",i)),draggable:_f(Rf(n,"draggable",i)),code:_f(Rf(n,"code",i)),whitespace:_f(Rf(n,"whitespace",i)),linebreakReplacement:_f(Rf(n,"linebreakReplacement",i)),defining:_f(Rf(n,"defining",i)),isolating:_f(Rf(n,"isolating",i)),attrs:Object.fromEntries(o.map(Pf))}),a=_f(Rf(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>jf(e,o)));const l=Rf(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:If(e,o)}));const c=Rf(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=zf({...e.reduce((e,t)=>{const r=Rf(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:_f(Rf(n,"inclusive",i)),excludes:_f(Rf(n,"excludes",i)),group:_f(Rf(n,"group",i)),spanning:_f(Rf(n,"spanning",i)),code:_f(Rf(n,"code",i)),attrs:Object.fromEntries(o.map(Pf))}),a=_f(Rf(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>jf(e,o)));const l=Rf(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:If(e,o)})),[n.name,s]}));return new ja({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Rf(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Jf(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this;return Ff([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Jf(t.name,this.schema)},r=[],o=Rf(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Rf(t,"exitable",n)&&(i.ArrowRight=()=>Dm.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=new dc({props:{handleKeyDown:dp(i)}});r.push(s);const a=Rf(t,"addInputRules",n);if(Zf(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new dc({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=Tf(Js.from(e),i.schema));const{from:o}=a,s=o+e.length;Tm({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Tm({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Tm({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Tm({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=Rf(t,"addPasteRules",n);if(Zf(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=jm({editor:e,rules:t});r.push(...n)}}const c=Rf(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r})}get attributes(){return Df(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Af(this.extensions);return Object.fromEntries(t.filter(e=>!!Rf(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ep(t.name,this.schema)},o=Rf(t,"addNodeView",r);if(!o)return[];const i=o();if(!i)return[];return[t.name,(r,o,s,a,l)=>{const c=If(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]}))}dispatchTransaction(e){const{editor:t}=this;return Ff([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Jf(n.name,this.schema)},o=Rf(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return Ff([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Jf(n.name,this.schema)},o=Rf(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=Af(this.extensions);return Object.fromEntries(t.filter(e=>!!Rf(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Lp(t.name,this.schema)},o=Rf(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=If(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(c=!0)}),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Jf(e.name,this.schema)};if("mark"===e.type){(null==(t=_f(Rf(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=Rf(e,"onBeforeCreate",n),o=Rf(e,"onCreate",n),i=Rf(e,"onUpdate",n),s=Rf(e,"onSelectionUpdate",n),a=Rf(e,"onTransaction",n),l=Rf(e,"onFocus",n),c=Rf(e,"onBlur",n),u=Rf(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}};zm.resolve=Bf,zm.sort=Ff,zm.flatten=Of;pp({},{ClipboardTextSerializer:()=>Fm,Commands:()=>Bm,Delete:()=>Hm,Drop:()=>Vm,Editable:()=>Um,FocusEvents:()=>Wm,Keymap:()=>Ym,Paste:()=>Jm,Tabindex:()=>Km,TextDirection:()=>Gm,focusEventsPluginKey:()=>qm});var Pm=class e extends Am{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Fm=Pm.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new dc({key:new fc("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=Vf(n);return Hf(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Bm=Pm.create({name:"commands",addCommands:()=>({...gp})}),Hm=Pm.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=Mf(e.before,[e,...t]);Wf(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof hl){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),u=a.invert().map(l),d=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark)),h=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:u},newRange:{from:i,to:l},partial:Boolean(h||d),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),Vm=Pm.create({name:"drop",addProseMirrorPlugins(){return[new dc({key:new fc("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Um=Pm.create({name:"editable",addProseMirrorPlugins(){return[new dc({key:new fc("editable"),props:{editable:()=>this.editor.options.editable}})]}}),qm=new fc("focusEvents"),Wm=Pm.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new dc({key:qm,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Ym=Pm.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,u=i.pos-i.parentOffset,d=c&&1===l.parent.childCount?u===i.pos:Wl.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!d||d&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Hp()||of()?o:r},addProseMirrorPlugins(){return[new dc({key:new fc("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Wl.atStart(t.doc).from,c=Wl.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!Xf(n.doc))return;const u=n.tr,d=fp({state:n,transaction:u}),{commands:h}=new mp({editor:this.editor,state:d});return h.clearNodes(),u.steps.length?u:void 0}})]}}),Jm=Pm.create({name:"paste",addProseMirrorPlugins(){return[new dc({key:new fc("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Km=Pm.create({name:"tabindex",addProseMirrorPlugins(){return[new dc({key:new fc("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Gm=Pm.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Af(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new dc({key:new fc("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Zm=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new e(l,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{if(!(n&&r.length>0)){if(i.node.type.name===e){o.every(e=>t[e]===i.node.attrs[e])&&r.push(i)}n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n)))}}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};var Qm=class extends Rm{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:nm,createMappablePosition:rm},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Fp(t,this.options.autofocus);this.editorState=cc.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=Nf(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[Um,Fm.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Bm,Wm,Ym,Km,Vm,Jm,Hm,Gm.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new zm(n,this)}createCommandManager(){this.commandManager=new mp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=kf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=kf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Kh(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Uf(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return af(e,null,n)||Gf(e,null,n);const r=hf(t,e.schema);return"node"===r?af(e,t,n):"mark"===r&&Gf(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Tf(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Hf(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...Vf(this.schema),...n}})}get isEmpty(){return Xf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Zm(t,this)}get $doc(){return this.$pos(0)}};function Xm(e){return new Om({find:e.find,handler:({state:t,range:n,match:r})=>{const o=_f(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Yf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const u=n.from+r+s.length;i.addMark(n.from+r,u,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function eg(e){return new Om({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=_f(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function tg(e){return new Om({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=_f(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&xl(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&Cl(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function ng(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();if(s){s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)})}return t}function rg(e){if(!e||0===Object.keys(e).length)return"";const t=[];if(e.class){String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`))}return e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function og(e){const{nodeName:t,name:n,parseAttributes:r=ng,serializeAttributes:o=rg,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const c=a[1]||"",u=r(c);return s.find(e=>!(e in u))?void 0:{type:t,raw:a[0],attributes:u}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function ig(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=ng,serializeAttributes:i=rg,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[u,d=""]=l,h=o(d);let p=1;const f=u.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(y);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)p+=1;else if(p-=1,0===p){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${c}${o}\n\n${s}\n\n:::`}}}function sg(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function ag(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function lg(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=sg,serializeAttributes:i=ag,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),s=e.match(i);if(!s)return;let l="",c="";if(a){const[,e]=s;c=e}else{const[,e,t]=s;c=e,l=t||""}const d=o(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:d}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function cg(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let c="",u=0;const d=t.baseIndentSize||2;for(;u<a.length;){const e=a[u],h=e.match(t.itemPattern);if(!h){if(l.length>0)break;if(""===e.trim()){u+=1,c=`${c}${e}\n`;continue}return}const p=t.extractItemData(h),{indentLevel:f,mainContent:m}=p;c=`${c}${e}\n`;const g=[m];for(u+=1;u<a.length;){const e=a[u];if(""===e.trim()){const t=a.slice(u+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[u+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),c=`${c}${e}\n`,u+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),c=`${c}${e}\n`,u+=1}let y;const b=g.slice(1);if(b.length>0){const e=b.map(e=>e.slice(f+d)).join("\n");e.trim()&&(y=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const v=t.createToken(p,y);l.push(v)}if(0!==l.length)return{items:l,raw:c}}function ug(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content,a=[`${o}${t.renderChildren([i])}`];return s&&s.length>0&&s.forEach(e=>{const n=t.renderChildren([e]);if(n){const e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}pp({},{createAtomBlockMarkdownSpec:()=>og,createBlockMarkdownSpec:()=>ig,createInlineMarkdownSpec:()=>lg,parseAttributes:()=>ng,parseIndentedBlocks:()=>cg,renderNestedMarkdownContent:()=>ug,serializeAttributes:()=>rg});var dg=class e extends Am{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function hg(e){return new $m({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=_f(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),u=o+a.length;if(Yf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>o).length)return null;u<n.to&&s.delete(u,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:pg,getOwnPropertySymbols:fg}=Object,{hasOwnProperty:mg}=Object.prototype;function gg(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function yg(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);const{cache:o}=r,i=o.get(t),s=o.get(n);if(i&&s)return i===n&&s===t;o.set(t,n),o.set(n,t);const a=e(t,n,r);return o.delete(t),o.delete(n),a}}function bg(e){return pg(e).concat(fg(e))}const vg=Object.hasOwn||((e,t)=>mg.call(e,t));function wg(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:xg,keys:kg}=Object;function Sg(e,t){return e.byteLength===t.byteLength&&Ig(new Uint8Array(e),new Uint8Array(t))}function Eg(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Mg(e,t){return e.byteLength===t.byteLength&&Ig(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Cg(e,t){return wg(e.getTime(),t.getTime())}function Rg(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Og(e,t){return e===t}function Tg(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,a,l=0;for(;(s=i.next())&&!s.done;){const r=t.entries();let i=!1,c=0;for(;(a=r.next())&&!a.done;){if(o[c]){c++;continue}const r=s.value,u=a.value;if(n.equals(r[0],u[0],l,c,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){i=o[c]=!0;break}c++}if(!i)return!1;l++}return!0}const Ng=wg;function _g(e,t,n){const r=kg(e);let o=r.length;if(kg(t).length!==o)return!1;for(;o-- >0;)if(!zg(e,t,n,r[o]))return!1;return!0}function Ag(e,t,n){const r=bg(e);let o,i,s,a=r.length;if(bg(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!zg(e,t,n,o))return!1;if(i=xg(e,o),s=xg(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function Dg(e,t){return wg(e.valueOf(),t.valueOf())}function $g(e,t){return e.source===t.source&&e.flags===t.flags}function Lg(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,a;for(;(s=i.next())&&!s.done;){const r=t.values();let i=!1,l=0;for(;(a=r.next())&&!a.done;){if(!o[l]&&n.equals(s.value,a.value,s.value,a.value,e,t,n)){i=o[l]=!0;break}l++}if(!i)return!1}return!0}function Ig(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function jg(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function zg(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||vg(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Pg={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Fg=Object.prototype.toString;function Bg({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&i(m,g,y);const v=m.constructor;if(v!==g.constructor)return!1;if(v===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(v===Date)return r(m,g,y);if(v===RegExp)return u(m,g,y);if(v===Map)return s(m,g,y);if(v===Set)return d(m,g,y);const w=Fg.call(m);if("[object Date]"===w)return r(m,g,y);if("[object RegExp]"===w)return u(m,g,y);if("[object Map]"===w)return s(m,g,y);if("[object Set]"===w)return d(m,g,y);if("[object Object]"===w)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===w)return p(m,g,y);if("[object Error]"===w)return o(m,g,y);if("[object Arguments]"===w)return l(m,g,y);if(Pg[w])return h(m,g,y);if("[object ArrayBuffer]"===w)return e(m,g,y);if("[object DataView]"===w)return n(m,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return c(m,g,y);if(f){let e=f[w];if(!e){const t=null!=(x=m)?x[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}var x;return!1}}const Hg=Vg();function Vg(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Sg,areArraysEqual:n?Ag:Eg,areDataViewsEqual:Mg,areDatesEqual:Cg,areErrorsEqual:Rg,areFunctionsEqual:Og,areMapsEqual:n?gg(Tg,Ag):Tg,areNumbersEqual:Ng,areObjectsEqual:n?Ag:_g,arePrimitiveWrappersEqual:Dg,areRegExpsEqual:$g,areSetsEqual:n?gg(Lg,Ag):Lg,areTypedArraysEqual:n?gg(Ig,Ag):Ig,areUrlsEqual:jg,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=yg(r.areArraysEqual),t=yg(r.areMapsEqual),n=yg(r.areObjectsEqual),o=yg(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=Bg(i);var a;return function({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(i,s){const{cache:a=(e?new WeakMap:void 0),meta:l}=n();return t(i,s,{cache:a,equals:r,meta:l,strict:o})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(e,n){return t(e,n,i)}}({circular:t,comparator:s,createState:r,equals:n?n(s):(a=s,function(e,t,n,r,o,i,s){return a(e,t,s)}),strict:o})}Vg({strict:!0}),Vg({circular:!0}),Vg({circular:!0,strict:!0}),Vg({createInternalComparator:()=>wg}),Vg({strict:!0,createInternalComparator:()=>wg}),Vg({circular:!0,createInternalComparator:()=>wg}),Vg({circular:!0,createInternalComparator:()=>wg,strict:!0});var Ug,qg,Wg={exports:{}},Yg={};var Jg=(qg||(qg=1,Wg.exports=function(){if(Ug)return Yg;Ug=1;var t=e,n=Fs(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Yg.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=a(function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,r(o,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,i=n)}var o,i,s=!1,a=void 0===n?null:n;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]},[t,n,c,u]);var p=o(e,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=p},[p]),l(p),p},Yg}()),Wg.exports),Kg=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},Gg=({contentComponent:e})=>{const t=Bs.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return Hs(Us,{children:Object.values(t)})};var Zg=class extends e.Component{constructor(t){var n;super(t),this.editorContentRef=e.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(n=t.editor)?void 0:n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(r,o){t={...t,[r]:n.createPortal(o.reactElement,o.element,r)},e.forEach(e=>e())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(e=>e())}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return Vs(Us,{children:[Hs("div",{ref:Kg(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&Hs(Gg,{contentComponent:e.contentComponent})]})}},Qg=e.forwardRef((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(Zg,{key:r,innerRef:n,...t})}),Xg=e.memo(Qg),ey="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,ty=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var ny="undefined"==typeof window,ry=ny||Boolean("undefined"!=typeof window&&window.next),oy=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?ny||ry?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new Qm(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function iy(t={},n=[]){const r=e.useRef(t);r.current=t;const[o]=e.useState(()=>new oy(r)),i=Bs.useSyncExternalStore(o.subscribe,o.getEditor,o.getServerSnapshot);return e.useDebugValue(i),e.useEffect(o.onRender(n)),function(t){var n;const[r]=e.useState(()=>new ty(t.editor)),o=Jg.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:Hg);ey(()=>r.watch(t.editor),[t.editor,r]),e.useDebugValue(o)}({editor:i,selector:({transactionNumber:e})=>!1===t.shouldRerenderOnTransaction||void 0===t.shouldRerenderOnTransaction?null:t.immediatelyRender&&0===e?0:e+1}),i}var sy=e.createContext({editor:null});sy.Consumer;var ay=e.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});e.forwardRef((t,n)=>{const{onDragStart:r}=e.useContext(ay);return Hs(t.as||"div",{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})}),e.createContext({markViewContentRef:()=>{}});var ly=e.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});ly.displayName="TiptapContext";function cy({editor:t,instance:n,children:r}){const o=null!=t?t:n;if(!o)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=e.useMemo(()=>({editor:o}),[o]),s=e.useMemo(()=>({editor:o}),[o]);return Hs(sy.Provider,{value:s,children:Hs(ly.Provider,{value:i,children:r})})}function uy({...t}){const{editor:n}=e.useContext(ly);return Hs(Xg,{editor:n,...t})}cy.displayName="Tiptap",uy.displayName="Tiptap.Content",Object.assign(cy,{Content:uy});var dy=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},hy=/^\s*>\s$/,py=dg.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return dy("blockquote",{...Lf(this.options.HTMLAttributes,e),children:dy("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach(e=>{const r=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(r.join("\n"))}),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[tg({find:hy,type:this.type})]}}),fy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,my=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,gy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,yy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,by=Dm.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return dy("strong",{...Lf(this.options.HTMLAttributes,e),children:dy("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Xm({find:fy,type:this.type}),Xm({find:gy,type:this.type})]},addPasteRules(){return[hg({find:my,type:this.type}),hg({find:yy,type:this.type})]}}),vy=/(^|[^`])`([^`]+)`(?!`)$/,wy=/(^|[^`])`([^`]+)`(?!`)/g,xy=Dm.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Xm({find:vy,type:this.type})]},addPasteRules(){return[hg({find:wy,type:this.type})]}}),ky=/^```([a-z]+)?[\s\n]$/,Sy=/^~~~([a-z]+)?[\s\n]$/,Ey=dg.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",Lf(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=e.raw)?void 0:r.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=(null==(n=e.attrs)?void 0:n.language)||"";if(e.content){r=[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n")}else r=`\`\`\`${o}\n\n\`\`\``;return r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,i=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(i)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=i,s=i.start(),a=i.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n");let c=0,u=0;const d=o-s;for(let n=0;n<l.length;n+=1){if(u+l[n].length>=d){c=n;break}u+=l[n].length+1}const h=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",p=Math.min(h.length,n);if(0===p)return!0;let f=s;for(let n=0;n<c;n+=1)f+=l[n].length+1;e.delete(f,f+p);return o-f<=p&&e.setSelection(Gl.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:i}=o,s=r.doc.textBetween(t,i,"\n","\n").split("\n").map(e=>{var t;const r=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(r.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,i,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(Wl.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[eg({find:ky,type:this.type,getAttributes:e=>({language:e[1]})}),eg({find:Sy,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new dc({key:new fc("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Gl.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),My=dg.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),Cy=dg.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Lf(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ry=dg.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Lf(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>eg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Oy=dg.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Lf(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Ql){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return em(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){const{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Gl.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Ql.create(t.doc,n.pos)):t.setSelection(Gl.create(t.doc,n.pos));else{const o=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,i=null==o?void 0:o.create();i&&(t.insert(r,i),t.setSelection(Gl.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Om({find:e.find,handler:({state:t,range:n,match:r})=>{const o=_f(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable}))];var e}}),Ty=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ny=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_y=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ay=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dy=Dm.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Lf(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Xm({find:Ty,type:this.type}),Xm({find:_y,type:this.type})]},addPasteRules(){return[hg({find:Ny,type:this.type}),hg({find:Ay,type:this.type})]}});const $y="numeric",Ly="ascii",Iy="alpha",jy="asciinumeric",zy="alphanumeric",Py="domain",Fy="emoji",By="scheme",Hy="slashscheme",Vy="whitespace";function Uy(e,t){return e in t||(t[e]=[]),t[e]}function qy(e,t,n){t[$y]&&(t[jy]=!0,t[zy]=!0),t[Ly]&&(t[jy]=!0,t[Iy]=!0),t[jy]&&(t[zy]=!0),t[Iy]&&(t[zy]=!0),t[zy]&&(t[Py]=!0),t[Fy]&&(t[Py]=!0);for(const r in t){const t=Uy(r,n);t.indexOf(e)<0&&t.push(e)}}function Wy(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Wy.groups={},Wy.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const n=t.jr[r][0],o=t.jr[r][1];if(o&&n.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Wy.groups,t&&t.j?o=t:(o=new Wy(t),n&&r&&qy(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(e[s]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Wy.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Wy,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Wy,i){if(r)if(s.t&&"string"==typeof s.t){const e=Object.assign(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);qy(i,e,r)}else n&&qy(i,n,r);s.t=i}return o.j[e]=s,s}};const Yy=(e,t,n,r,o)=>e.ta(t,n,r,o),Jy=(e,t,n,r,o)=>e.tr(t,n,r,o),Ky=(e,t,n,r,o)=>e.ts(t,n,r,o),Gy=(e,t,n,r,o)=>e.tt(t,n,r,o),Zy="WORD",Qy="UWORD",Xy="ASCIINUMERICAL",eb="ALPHANUMERICAL",tb="LOCALHOST",nb="TLD",rb="UTLD",ob="SCHEME",ib="SLASH_SCHEME",sb="NUM",ab="WS",lb="NL",cb="OPENBRACE",ub="CLOSEBRACE",db="OPENBRACKET",hb="CLOSEBRACKET",pb="OPENPAREN",fb="CLOSEPAREN",mb="OPENANGLEBRACKET",gb="CLOSEANGLEBRACKET",yb="FULLWIDTHLEFTPAREN",bb="FULLWIDTHRIGHTPAREN",vb="LEFTCORNERBRACKET",wb="RIGHTCORNERBRACKET",xb="LEFTWHITECORNERBRACKET",kb="RIGHTWHITECORNERBRACKET",Sb="FULLWIDTHLESSTHAN",Eb="FULLWIDTHGREATERTHAN",Mb="AMPERSAND",Cb="APOSTROPHE",Rb="ASTERISK",Ob="AT",Tb="BACKSLASH",Nb="BACKTICK",_b="CARET",Ab="COLON",Db="COMMA",$b="DOLLAR",Lb="DOT",Ib="EQUALS",jb="EXCLAMATION",zb="HYPHEN",Pb="PERCENT",Fb="PIPE",Bb="PLUS",Hb="POUND",Vb="QUERY",Ub="QUOTE",qb="FULLWIDTHMIDDLEDOT",Wb="SEMI",Yb="SLASH",Jb="TILDE",Kb="UNDERSCORE",Gb="EMOJI",Zb="SYM";var Qb=Object.freeze({__proto__:null,ALPHANUMERICAL:eb,AMPERSAND:Mb,APOSTROPHE:Cb,ASCIINUMERICAL:Xy,ASTERISK:Rb,AT:Ob,BACKSLASH:Tb,BACKTICK:Nb,CARET:_b,CLOSEANGLEBRACKET:gb,CLOSEBRACE:ub,CLOSEBRACKET:hb,CLOSEPAREN:fb,COLON:Ab,COMMA:Db,DOLLAR:$b,DOT:Lb,EMOJI:Gb,EQUALS:Ib,EXCLAMATION:jb,FULLWIDTHGREATERTHAN:Eb,FULLWIDTHLEFTPAREN:yb,FULLWIDTHLESSTHAN:Sb,FULLWIDTHMIDDLEDOT:qb,FULLWIDTHRIGHTPAREN:bb,HYPHEN:zb,LEFTCORNERBRACKET:vb,LEFTWHITECORNERBRACKET:xb,LOCALHOST:tb,NL:lb,NUM:sb,OPENANGLEBRACKET:mb,OPENBRACE:cb,OPENBRACKET:db,OPENPAREN:pb,PERCENT:Pb,PIPE:Fb,PLUS:Bb,POUND:Hb,QUERY:Vb,QUOTE:Ub,RIGHTCORNERBRACKET:wb,RIGHTWHITECORNERBRACKET:kb,SCHEME:ob,SEMI:Wb,SLASH:Yb,SLASH_SCHEME:ib,SYM:Zb,TILDE:Jb,TLD:nb,UNDERSCORE:Kb,UTLD:rb,UWORD:Qy,WORD:Zy,WS:ab});const Xb=/[a-z]/,ev=new RegExp("\\p{L}","u"),tv=new RegExp("\\p{Emoji}","u"),nv=/\d/,rv=/\s/;let ov=null,iv=null;function sv(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,u=null,d=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,h=0,u=a):d>=0&&(d+=n[s].length,h++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=h,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function av(e,t,n,r,o){let i;const s=t.length;for(let a=0;a<s-1;a++){const n=t[a];e.j[n]?i=e.j[n]:(i=new Wy(r),i.jr=o.slice(),e.j[n]=i),e=i}return i=new Wy(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function lv(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const cv={defaultProtocol:"http",events:null,format:dv,formatHref:dv,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function uv(e,t=null){let n=Object.assign({},cv);e&&(n=Object.assign(n,e instanceof uv?e.o:e));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function dv(e){return e}function hv(e,t){this.t="token",this.v=e,this.tk=t}function pv(e,t){class n extends hv{constructor(t,n){super(t,n),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}uv.prototype={o:cv,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:cv[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},hv.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=cv.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};const fv=pv("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),mv=pv("text"),gv=pv("nl"),yv=pv("url",{isLink:!0,toHref(e=cv.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==tb&&e[1].t===Ab}}),bv=e=>new Wy(e);function vv(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const wv="undefined"!=typeof console&&console&&console.warn||(()=>{}),xv={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kv(e,t=!1){if(xv.initialized&&wv(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');xv.customSchemes.push([e,t])}function Sv(){xv.scanner=function(e=[]){const t={};Wy.groups=t;const n=new Wy;null==ov&&(ov=lv("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==iv&&(iv=lv("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Gy(n,"'",Cb),Gy(n,"{",cb),Gy(n,"}",ub),Gy(n,"[",db),Gy(n,"]",hb),Gy(n,"(",pb),Gy(n,")",fb),Gy(n,"<",mb),Gy(n,">",gb),Gy(n,"(",yb),Gy(n,")",bb),Gy(n,"「",vb),Gy(n,"」",wb),Gy(n,"『",xb),Gy(n,"』",kb),Gy(n,"<",Sb),Gy(n,">",Eb),Gy(n,"&",Mb),Gy(n,"*",Rb),Gy(n,"@",Ob),Gy(n,"`",Nb),Gy(n,"^",_b),Gy(n,":",Ab),Gy(n,",",Db),Gy(n,"$",$b),Gy(n,".",Lb),Gy(n,"=",Ib),Gy(n,"!",jb),Gy(n,"-",zb),Gy(n,"%",Pb),Gy(n,"|",Fb),Gy(n,"+",Bb),Gy(n,"#",Hb),Gy(n,"?",Vb),Gy(n,'"',Ub),Gy(n,"/",Yb),Gy(n,";",Wb),Gy(n,"~",Jb),Gy(n,"_",Kb),Gy(n,"\\",Tb),Gy(n,"・",qb);const r=Jy(n,nv,sb,{[$y]:!0});Jy(r,nv,r);const o=Jy(r,Xb,Xy,{[jy]:!0}),i=Jy(r,ev,eb,{[zy]:!0}),s=Jy(n,Xb,Zy,{[Ly]:!0});Jy(s,nv,o),Jy(s,Xb,s),Jy(o,nv,o),Jy(o,Xb,o);const a=Jy(n,ev,Qy,{[Iy]:!0});Jy(a,Xb),Jy(a,nv,i),Jy(a,ev,a),Jy(i,nv,i),Jy(i,Xb),Jy(i,ev,i);const l=Gy(n,"\n",lb,{[Vy]:!0}),c=Gy(n,"\r",ab,{[Vy]:!0}),u=Jy(n,rv,ab,{[Vy]:!0});Gy(n,"",u),Gy(c,"\n",l),Gy(c,"",u),Jy(c,rv,u),Gy(u,"\r"),Gy(u,"\n"),Jy(u,rv,u),Gy(u,"",u);const d=Jy(n,tv,Gb,{[Fy]:!0});Gy(d,"#"),Jy(d,tv,d),Gy(d,"️",d);const h=Gy(d,"");Gy(h,"#"),Jy(h,tv,d);const p=[[Xb,s],[nv,o]],f=[[Xb,null],[ev,a],[nv,i]];for(let m=0;m<ov.length;m++)av(n,ov[m],nb,Zy,p);for(let m=0;m<iv.length;m++)av(n,iv[m],rb,Qy,f);qy(nb,{tld:!0,ascii:!0},t),qy(rb,{utld:!0,alpha:!0},t),av(n,"file",ob,Zy,p),av(n,"mailto",ob,Zy,p),av(n,"http",ib,Zy,p),av(n,"https",ib,Zy,p),av(n,"ftp",ib,Zy,p),av(n,"ftps",ib,Zy,p),qy(ob,{scheme:!0,ascii:!0},t),qy(ib,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let m=0;m<e.length;m++){const t=e[m][0],r=e[m][1]?{[By]:!0}:{[Hy]:!0};t.indexOf("-")>=0?r[Py]=!0:Xb.test(t)?nv.test(t)?r[jy]=!0:r[Ly]=!0:r[$y]=!0,Ky(n,t,t,r)}return Ky(n,"localhost",tb,{ascii:!0}),n.jd=new Wy(Zb),{start:n,tokens:Object.assign({groups:t},Qb)}}(xv.customSchemes);for(let e=0;e<xv.tokenQueue.length;e++)xv.tokenQueue[e][1]({scanner:xv.scanner});xv.parser=function({groups:e}){const t=e.domain.concat([Mb,Rb,Ob,Tb,Nb,_b,$b,Ib,zb,sb,Pb,Fb,Bb,Hb,Yb,Zb,Jb,Kb]),n=[Cb,Ab,Db,Lb,jb,Pb,Vb,Ub,Wb,mb,gb,cb,ub,hb,db,pb,fb,yb,bb,vb,wb,xb,kb,Sb,Eb],r=[Mb,Cb,Rb,Tb,Nb,_b,$b,Ib,zb,cb,ub,Pb,Fb,Bb,Hb,Vb,Yb,Zb,Jb,Kb],o=bv(),i=Gy(o,Jb);Yy(i,r,i),Yy(i,e.domain,i);const s=bv(),a=bv(),l=bv();Yy(o,e.domain,s),Yy(o,e.scheme,a),Yy(o,e.slashscheme,l),Yy(s,r,i),Yy(s,e.domain,s);const c=Gy(s,Ob);Gy(i,Ob,c),Gy(a,Ob,c),Gy(l,Ob,c);const u=Gy(i,Lb);Yy(u,r,i),Yy(u,e.domain,i);const d=bv();Yy(c,e.domain,d),Yy(d,e.domain,d);const h=Gy(d,Lb);Yy(h,e.domain,d);const p=bv(fv);Yy(h,e.tld,p),Yy(h,e.utld,p),Gy(c,tb,p);const f=Gy(d,zb);Gy(f,zb,f),Yy(f,e.domain,d),Yy(p,e.domain,d),Gy(p,Lb,h),Gy(p,zb,f);const m=Gy(p,Ab);Yy(m,e.numeric,fv);const g=Gy(s,zb),y=Gy(s,Lb);Gy(g,zb,g),Yy(g,e.domain,s),Yy(y,r,i),Yy(y,e.domain,s);const b=bv(yv);Yy(y,e.tld,b),Yy(y,e.utld,b),Yy(b,e.domain,s),Yy(b,r,i),Gy(b,Lb,y),Gy(b,zb,g),Gy(b,Ob,c);const v=Gy(b,Ab),w=bv(yv);Yy(v,e.numeric,w);const x=bv(yv),k=bv();Yy(x,t,x),Yy(x,n,k),Yy(k,t,x),Yy(k,n,k),Gy(b,Yb,x),Gy(w,Yb,x);const S=Gy(a,Ab),E=Gy(l,Ab),M=Gy(E,Yb),C=Gy(M,Yb);Yy(a,e.domain,s),Gy(a,Lb,y),Gy(a,zb,g),Yy(l,e.domain,s),Gy(l,Lb,y),Gy(l,zb,g),Yy(S,e.domain,x),Gy(S,Yb,x),Gy(S,Vb,x),Yy(C,e.domain,x),Yy(C,t,x),Gy(C,Yb,x);const R=[[cb,ub],[db,hb],[pb,fb],[mb,gb],[yb,bb],[vb,wb],[xb,kb],[Sb,Eb]];for(let O=0;O<R.length;O++){const[e,r]=R[O],o=Gy(x,e);Gy(k,e,o),Gy(o,r,x);const i=bv(yv);Yy(o,t,i);const s=bv();Yy(o,n),Yy(i,t,i),Yy(i,n,s),Yy(s,t,i),Yy(s,n,s),Gy(i,r,x),Gy(s,r,x)}return Gy(o,tb,b),Gy(o,lb,gv),{start:o,tokens:Qb}}(xv.scanner.tokens);for(let e=0;e<xv.pluginQueue.length;e++)xv.pluginQueue[e][1]({scanner:xv.scanner,parser:xv.parser});return xv.initialized=!0,xv}function Ev(e){return xv.initialized||Sv(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,u=0,d=null,h=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(h=0,d=a):h>=0&&h++,o++,u++;if(h<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(vv(mv,t,s)),s=[]),o-=h,u-=h;const e=d.t,r=n.slice(o-u,o);i.push(vv(e,t,r))}}return s.length>0&&i.push(vv(mv,t,s)),i}(xv.parser.start,e,sv(xv.scanner.start,e))}function Mv(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new uv(n),o=Ev(e),i=[];for(let s=0;s<o.length;s++){const e=o[s];!e.isLink||t&&e.t!==t||!r.check(e)||i.push(e.toFormattedObject(r))}return i}Ev.scan=sv;var Cv="[\0- -\u2029 ]",Rv=new RegExp(Cv),Ov=new RegExp(`${Cv}$`),Tv=new RegExp(Cv,"g");function Nv(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(Tv,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var _v=Dm.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!=typeof e?kv(e.scheme,e.optionalSlashes):kv(e)})},onDestroy(){Wy.groups={},xv.scanner=null,xv.parser=null,xv.tokenQueue=[],xv.pluginQueue=[],xv.customSchemes=[],xv.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Nv(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Nv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Nv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Lf(this.options.HTMLAttributes,e),0]:["a",Lf(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Nv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Nv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hg({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=Mv(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Nv(e,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;var r;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Nv(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new dc({key:new fc("autolink"),appendTransaction:(e,t,n)=>{const o=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=n;return Wf(Mf(t.doc,[...e])).forEach(({newRange:e})=>{const t=function(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}(n.doc,e,e=>e.isTextblock);let o,i;if(t.length>1)o=t[0],i=n.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(t.length){const r=n.doc.textBetween(e.from,e.to," "," ");if(!Ov.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(Rv).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],l=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=Ev(t).map(e=>e.toObject(r.defaultProtocol));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code)).filter(e=>r.validate(e.value)).filter(e=>r.shouldAutoLink(e.value)).forEach(e=>{Yf(e.from,e.to,n.doc).some(e=>e.mark.type===r.type)||s.addMark(e.from,e.to,r.type.create({href:e.href}))})}var a}),s.steps.length?s:void 0}}))),e.push(function(e){return new dc({key:new fc("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=Uf(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,l=null!=(i=s.target)?i:n.target;r&&(window.open(r,l),a=!0)}return a}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new dc({key:new fc("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});const c=Mv(l,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!(!l||!c||void 0!==o&&!o(c.value))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Av=_v,Dv=Object.defineProperty,$v="textStyle",Lv=/^\s*([-+*])\s$/,Iv=dg.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes($v)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=tg({find:Lv,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tg({find:Lv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes($v),editor:this.editor})),[e]}}),jv=dg.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let n=[];if(e.tokens&&e.tokens.length>0){if(e.tokens.some(e=>"paragraph"===e.type))n=t.parseChildren(e.tokens);else{const r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){const r=e.tokens.slice(1),o=t.parseChildren(r);n.push(...o)}}else n=t.parseChildren(e.tokens)}}return 0===n.length&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>ug(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){return`${((null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1)+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)Dv(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>zv,getNextListDepth:()=>Pv,handleBackspace:()=>Vv,handleDelete:()=>Wv,hasListBefore:()=>Fv,hasListItemAfter:()=>Yv,hasListItemBefore:()=>Bv,listItemHasSubList:()=>Hv,nextListIsDeeper:()=>Uv,nextListIsHigher:()=>qv});var zv=(e,t)=>{const{$from:n}=t.selection,r=Ep(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},Pv=(e,t)=>{const n=zv(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Fv=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Bv=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},Hv=(e,t,n)=>{if(!n)return!1;const r=Ep(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},Vv=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!af(e.state,t)&&Fv(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})});const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!af(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=zv(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Hv(t,e.state,o);return Bv(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Uv=(e,t)=>{const n=Pv(e,t),r=zv(e,t);return!(!r||!n)&&n>r.depth},qv=(e,t)=>{const n=Pv(e,t),r=zv(e,t);return!(!r||!n)&&n<r.depth},Wv=(e,t)=>{if(!af(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=Cf(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Uv(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():qv(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Yv=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},Jv=Pm.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Wv(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Wv(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Vv(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Vv(e,n,r)&&(t=!0)}),t}}}}),Kv=/^(\s*)(\d+)\.\s+(.*)$/,Gv=/^\s/;function Zv(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const a=s.content.split("\n"),l=(null==(r=a[0])?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join("\n").trim();if(u){const e=n.blockTokens(u);c.push(...e)}let d=i+1;const h=[];for(;d<e.length&&e[d].indent>t;)h.push(e[d]),d+=1;if(h.length>0){const e=Math.min(...h.map(e=>e.indent)),t=Zv(h,e,n);c.push({type:"list",ordered:!0,start:h[0].number,items:t,raw:h.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return o}var Qv="textStyle",Xv=/^(\d+)\.\s$/,ew=dg.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",Lf(this.options.HTMLAttributes,n),0]:["ol",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const n=e.start||1,r=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{const r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}(e.items,t):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split("\n"),[i,s]=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match(Kv);if(!i)break;const[,s,a,l]=i,c=s.length;let u=l,d=n+1;const h=[o];for(;d<e.length;){const t=e[d];if(t.match(Kv))break;if(""===t.trim())h.push(t),u+="\n",d+=1;else{if(!t.match(Gv))break;h.push(t),u+=`\n${t.slice(c+2)}`,d+=1}}t.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:h.join("\n")}),r=d,n=d}return[t,r]}(o);if(0===i.length)return;const a=Zv(i,0,n);if(0===a.length)return;return{type:"list",ordered:!0,start:(null==(r=i[0])?void 0:r.number)||1,items:a,raw:o.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Qv)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=tg({find:Xv,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tg({find:Xv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Qv)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),tw=/^\s*(\[([( |x])?\])\s$/,nw=dg.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Lf(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return ug(e,t,`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach(([e,t])=>{o.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:o,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);const t=If(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),i=this.options.HTMLAttributes;return u.forEach(e=>{n.has(e)||(e in i?o.setAttribute(e,i[e]):o.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in i?o.setAttribute(e,i[e]):o.removeAttribute(e):o.setAttribute(e,t)}),u=n,!0}}}},addInputRules(){return[tg({find:tw,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),rw=dg.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Lf(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){const r=e=>{const t=cg(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},o=cg(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Pm.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(Iv.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(jv.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Jv.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(ew.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(nw.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(rw.configure(this.options.taskList)),e}});var ow=" ",iw=dg.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",Lf(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==r.length||"text"!==r[0].type||r[0].text!==ow&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return 0===n.length?ow:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lw=Dm.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Xm({find:sw,type:this.type})]},addPasteRules(){return[hg({find:aw,type:this.type})]}}),cw=dg.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),uw=Dm.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",Lf(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),dw=uw;function hw(e={}){return new dc({view:t=>new pw(t,e)})}class pw{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;a=e.left-c.scrollLeft*t,l=e.top-c.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Tl(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fw extends Wl{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return fw.valid(n)?new fw(n):Wl.near(n)}content(){return ea.empty}eq(e){return e instanceof fw&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new fw(e.resolve(t.pos))}getBookmark(){return new mw(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||gw(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||gw(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&fw.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(fw.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Ql.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(fw.valid(s))return s}return null}}}fw.prototype.visible=!1,fw.findFrom=fw.findGapCursorFrom,Wl.jsonID("gapcursor",fw);class mw{constructor(e){this.pos=e}map(e){return new mw(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return fw.valid(t)?new fw(t):Wl.near(t)}}function gw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const yw=dp({ArrowLeft:bw("horiz",-1),ArrowRight:bw("horiz",1),ArrowUp:bw("vert",-1),ArrowDown:bw("vert",1)});function bw(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Gl){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=fw.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new fw(l))),!0)}}function vw(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!fw.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Ql.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new fw(r))),!0)}function ww(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof fw))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Js.empty;for(let s=r.length-1;s>=0;s--)o=Js.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new ea(o,0,0));return i.setSelection(Gl.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function xw(e){if(!(e.selection instanceof fw))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Eh.create(e.doc,[xh.widget(e.selection.head,t,{key:"gapcursor"})])}var kw=200,Sw=function(){};Sw.prototype.append=function(e){return e.length?(e=Sw.from(e),!this.length&&e||e.length<kw&&this.leafAppend(e)||this.length<kw&&e.leafPrepend(this)||this.appendInner(e)):this},Sw.prototype.prepend=function(e){return e.length?Sw.from(e).append(this):this},Sw.prototype.appendInner=function(e){return new Mw(this,e)},Sw.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Sw.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Sw.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Sw.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Sw.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Sw.from=function(e){return e instanceof Sw?e:e&&e.length?new Ew(e):Sw.empty};var Ew=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=kw)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=kw)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Sw);Sw.empty=new Ew([]);var Mw=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Sw);class Cw{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new Rw(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new Rw(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new Cw(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let n,l=e.steps[c].invert(e.docs[c]),u=new Rw(e.mapping.maps[c],l,t);(n=a&&a.merge(u))&&(u=n,c?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>Tw&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new Cw(s.append(o),i)}remapping(e,t){let n=new sl;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new Cw(this.items.append(e.map(e=>new Rw(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new Rw(l,i,c))}else n.push(new Rw(l))},r);let l=[];for(let d=t;d<i;d++)l.push(new Rw(o.maps[d]));let c=this.items.slice(0,r).append(l).append(n),u=new Cw(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new Rw(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--},this.items.length,0),new Cw(Sw.from(r.reverse()),o)}}Cw.empty=new Cw(Sw.empty,0);class Rw{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Rw(t.getMap().invert(),t,this.selection)}}}class Ow{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Tw=20;function Nw(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function _w(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let Aw=!1,Dw=null;function $w(e){let t=e.plugins;if(Dw!=t){Aw=!1,Dw=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Aw=!0;break}}return Aw}const Lw=new fc("history"),Iw=new fc("closeHistory");function jw(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new dc({key:Lw,state:{init:()=>new Ow(Cw.empty,Cw.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Lw);if(i)return i.historyState;n.getMeta(Iw)&&(e=new Ow(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Lw))return s.getMeta(Lw).redo?new Ow(e.done.addTransform(n,void 0,r,$w(t)),e.undone,Nw(n.mapping.maps),e.prevTime,e.prevComposition):new Ow(e.done,e.undone.addTransform(n,void 0,r,$w(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Ow(e.done.rebased(n,o),e.undone.rebased(n,o),_w(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Ow(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),_w(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?_w(e.prevRanges,n.mapping):Nw(n.mapping.maps);return new Ow(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,$w(t)),Cw.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Pw:"historyRedo"==n?Fw:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function zw(e,t){return(n,r)=>{let o=Lw.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=$w(t),o=Lw.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Ow(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Lw,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Pw=zw(!1,!0),Fw=zw(!0,!0);Pm.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new dc({key:new fc("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;e.deleteRange(s,a);return!(this.storage.characters({node:e.doc})>n)}})]}});var Bw=Pm.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[hw(this.options)]}});Pm.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new dc({key:new fc("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return Eh.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(e.isText)return;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;s+=1});let a=0;return e.descendants((e,t)=>{if(e.isText)return!1;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;a+=1;if("deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)return"deepest"===this.options.mode;i.push(xh.node(t,t+e.nodeSize,{class:this.options.className}))}),Eh.create(e,i)}}})]}});var Hw=Pm.create({name:"gapCursor",addProseMirrorPlugins:()=>[new dc({props:{decorations:xw,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&fw.valid(n)?new fw(n):null,handleClick:vw,handleKeyDown:yw,handleDOMEvents:{beforeinput:ww}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=_f(Rf(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),Vw="placeholder";var Uw=Pm.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Vw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${t=this.options.dataAttribute,t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${Vw}`;var t;return[new dc({key:new fc("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((t,n)=>{const r=o>=n&&o<=n+t.nodeSize,a=!t.isLeaf&&Xf(t);if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=xh.node(n,n+t.nodeSize,{class:o.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});i.push(a)}return this.options.includeChildren}),Eh.create(t,i)}}})]}});function qw({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Pm.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new dc({key:new fc("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||em(n.selection)||e.view.dragging?null:Eh.create(n.doc,[xh.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Ww=Pm.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new fc(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new dc({key:t,appendTransaction:(e,r,o)=>{const{doc:i,tr:s,schema:a}=o,l=t.getState(o),c=i.content.size,u=a.nodes[n];if(l)return s.insert(c,u.create())},state:{init:(e,t)=>!qw({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!qw({node:e.doc.lastChild,types:r})}}})]}}),Yw=Pm.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Pw(e,t),redo:()=>({state:e,dispatch:t})=>Fw(e,t)}),addProseMirrorPlugins(){return[jw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Jw=Pm.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(by.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(py.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(Iv.configure(this.options.bulletList)),!1!==this.options.code&&o.push(xy.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(Ey.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(My.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Bw.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Hw.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(Cy.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(Ry.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(Yw.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(Oy.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Dy.configure(this.options.italic)),!1!==this.options.listItem&&o.push(jv.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(Jv.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(_v.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(ew.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(iw.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(lw.configure(this.options.strike)),!1!==this.options.text&&o.push(cw.configure(this.options.text)),!1!==this.options.underline&&o.push(uw.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Ww.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),Kw=Pm.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Gw=Uw,Zw=(e,t=0)=>{const n=[];return!e.children.length||t>20||Array.from(e.children).forEach(e=>{"SPAN"===e.tagName?n.push(e):e.children.length&&n.push(...Zw(e,t+1))}),n},Qw=Dm.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{},mergeNestedSpanStyles:!0}),parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>!!e.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(e=>{if(!e.children.length)return;const t=Zw(e);t&&t.forEach(e=>{var t,n;const r=e.getAttribute("style"),o=null==(n=null==(t=e.parentElement)?void 0:t.closest("span"))?void 0:n.getAttribute("style");e.setAttribute("style",`${o};${r}`)})})(e),{})}]},renderHTML({HTMLAttributes:e}){return["span",Lf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),Xw=Pm.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("background-color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.backgroundColor)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands:()=>({setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()})}),ex=Pm.create({name:"color",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.color)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands:()=>({setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()})}),tx=Pm.create({name:"fontFamily",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands:()=>({setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()})}),nx=Pm.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands:()=>({setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})}),rx=Pm.create({name:"lineHeight",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands:()=>({setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()})});Pm.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(Xw.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(ex.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(tx.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(nx.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(rx.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(Qw.configure(this.options.textStyle)),e}});var ox=ex,ix=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,sx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ax=Dm.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",Lf(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){const r=/^(==)([^=]+)(==)/.exec(e);if(r){const e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Xm({find:ix,type:this.type})]},addPasteRules(){return[hg({find:sx,type:this.type})]}}),lx=ax;function cx({onClick:e,active:t,disabled:n,title:r,children:o}){return React.createElement("button",{type:"button",onMouseDown:t=>{t.preventDefault(),e()},disabled:n,title:r,className:"p-1 rounded hover:bg-gray-200 smooth-transition "+(n?"text-gray-300 cursor-not-allowed":t?"bg-gray-200 text-indigo-600":"text-gray-500")},o)}const ux=["#000000","#434343","#666666","#999999","#cccccc","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#6366f1","#8b5cf6","#ec4899","#f43f5e","#991b1b","#9a3412","#854d0e","#166534","#115e59","#1e40af","#3730a3","#5b21b6","#9d174d","#be123c"];function dx({currentColor:t,onSelect:r,icon:o,title:i}){const[s,a]=e.useState(!1),[l,c]=e.useState({top:0,left:0}),u=e.useRef(null),d=e.useRef(null);e.useEffect(()=>{if(!s)return;const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);const h=e.useCallback(e=>{if(e.preventDefault(),!s&&u.current){const e=u.current.getBoundingClientRect();c({top:e.bottom+4,left:e.left})}a(e=>!e)},[s]);return React.createElement("div",{className:"relative"},React.createElement("button",{ref:u,type:"button",title:i,className:"flex items-center p-1 rounded hover:bg-gray-200 smooth-transition text-gray-500",onMouseDown:h},React.createElement("span",{className:"relative"},o,t&&React.createElement("span",{className:"absolute -bottom-0.5 left-0 right-0 h-[3px] rounded-sm",style:{backgroundColor:t}})),React.createElement(nt,{className:"w-2.5 h-2.5 ml-0.5"})),s&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:d,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg p-2.5",style:{top:l.top,left:l.left}},React.createElement("div",{className:"flex flex-wrap gap-1.5",style:{width:164}},ux.map(e=>React.createElement("button",{key:e,type:"button",title:e,className:"w-7 h-7 rounded-md border-2 smooth-transition flex items-center justify-center "+(e===t?"border-gray-800 shadow-sm scale-110":"border-transparent hover:border-gray-300"),style:{backgroundColor:e},onMouseDown:t=>{t.preventDefault(),r(e),a(!1)}}))),React.createElement("button",{type:"button",className:"w-full mt-2 text-[11px] text-gray-500 hover:text-gray-700 py-1 rounded-md hover:bg-gray-100 smooth-transition",onMouseDown:e=>{e.preventDefault(),r(null),a(!1)}},"清除颜色"))),document.body))}function hx({editor:t}){const[r,o]=e.useState(!1),[i,s]=e.useState({top:0,left:0}),a=e.useRef(null),l=e.useRef(null);e.useEffect(()=>{if(!r)return;const e=e=>{a.current&&!a.current.contains(e.target)&&l.current&&!l.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]);const c=e.useCallback(e=>{if(e.preventDefault(),!r&&a.current){const e=a.current.getBoundingClientRect();s({top:e.bottom+4,left:e.left})}o(e=>!e)},[r]),u=[{label:"正文",active:!t.isActive("heading"),action:()=>t.chain().focus().setParagraph().run()},{label:"标题 1",active:t.isActive("heading",{level:1}),action:()=>t.chain().focus().toggleHeading({level:1}).run(),className:"text-[16px] font-bold"},{label:"标题 2",active:t.isActive("heading",{level:2}),action:()=>t.chain().focus().toggleHeading({level:2}).run(),className:"text-[15px] font-bold"},{label:"标题 3",active:t.isActive("heading",{level:3}),action:()=>t.chain().focus().toggleHeading({level:3}).run(),className:"text-[14px] font-semibold"}],d=u.find(e=>e.active)?.label||"正文";return React.createElement("div",{className:"relative"},React.createElement("button",{ref:a,type:"button",className:"flex items-center gap-0.5 px-1.5 py-1 rounded hover:bg-gray-200 smooth-transition text-gray-600 text-[12px] font-medium min-w-[56px]",onMouseDown:c},d,React.createElement(nt,{className:"w-3 h-3"})),r&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:l,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg py-1 min-w-[120px]",style:{top:i.top,left:i.left}},u.map(e=>React.createElement("button",{key:e.label,type:"button",className:`w-full text-left px-3 py-1.5 hover:bg-gray-100 smooth-transition ${e.active?"bg-indigo-50 text-indigo-600":"text-gray-700"} ${e.className||"text-[13px]"}`,onMouseDown:t=>{t.preventDefault(),e.action(),o(!1)}},e.label)))),document.body))}function px({editor:r,iconSize:o}){const[i,s]=e.useState(!1),[a,l]=e.useState(""),[c,u]=e.useState({top:0,left:0}),d=e.useRef(null),h=e.useRef(null),p=e.useRef(null);e.useEffect(()=>{if(!i)return;const e=e=>{d.current&&!d.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const f=()=>{s(!1),a&&"https://"!==a?r.chain().focus().extendMarkRange("link").setLink({href:a}).run():r.chain().focus().extendMarkRange("link").unsetLink().run()};return React.createElement("div",{className:"relative"},React.createElement("button",{ref:d,type:"button",title:"插入链接",className:"p-1 rounded hover:bg-gray-200 smooth-transition "+(r.isActive("link")?"bg-gray-200 text-indigo-600":"text-gray-500"),onMouseDown:e=>{e.preventDefault(),(()=>{const e=r.getAttributes("link").href||"";if(l(e||"https://"),d.current){const e=d.current.getBoundingClientRect();u({top:e.bottom+4,left:Math.max(8,e.right-320)})}s(!i),setTimeout(()=>p.current?.focus(),50)})()}},React.createElement(at,{className:o})),i&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:h,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg p-3 w-[320px]",style:{top:c.top,left:c.left},onMouseDown:e=>e.stopPropagation()},React.createElement("label",{className:"block text-[12px] font-medium text-gray-600 mb-1"},"链接地址"),React.createElement(t.Input,{ref:p,value:a,onChange:e=>l(e.target.value),placeholder:"https://",size:"small",onPressEnter:f}),React.createElement("div",{className:"flex justify-end gap-1.5 mt-2"},React.createElement("button",{type:"button",className:"px-2.5 py-1 text-[12px] text-gray-500 hover:text-gray-700 rounded hover:bg-gray-100 smooth-transition",onMouseDown:e=>{e.preventDefault(),s(!1)}},"取消"),React.createElement("button",{type:"button",className:"px-2.5 py-1 text-[12px] text-white bg-indigo-500 hover:bg-indigo-600 rounded smooth-transition",onMouseDown:e=>{e.preventDefault(),f()}},"确定")))),document.body))}function fx({editor:t}){const n="w-3.5 h-3.5",[,r]=e.useState(0);e.useEffect(()=>{const e=()=>r(e=>e+1);return t.on("transaction",e),()=>{t.off("transaction",e)}},[t]);const o=t.getAttributes("textStyle").color,i=t.getAttributes("highlight").color;return React.createElement(React.Fragment,null,React.createElement("div",{className:"flex flex-wrap items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-gray-50/80"},React.createElement(hx,{editor:t}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().toggleBold().run(),active:t.isActive("bold"),title:"加粗"},React.createElement(tt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"斜体"},React.createElement(st,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"下划线"},React.createElement(St,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"删除线"},React.createElement(bt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(dx,{currentColor:o,onSelect:e=>{e?t.chain().focus().setColor(e).run():t.chain().focus().unsetColor().run()},icon:React.createElement(ft,{className:n}),title:"字体颜色"}),React.createElement(dx,{currentColor:i,onSelect:e=>{e?t.chain().focus().setHighlight({color:e}).run():t.chain().focus().unsetHighlight().run()},icon:React.createElement(it,{className:n}),title:"背景色"}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().toggleBulletList().run(),active:t.isActive("bulletList"),title:"无序列表"},React.createElement(dt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"有序列表"},React.createElement(ut,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().sinkListItem("listItem").run(),disabled:!t.can().sinkListItem("listItem"),title:"增加缩进"},React.createElement(ct,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().liftListItem("listItem").run(),disabled:!t.can().liftListItem("listItem"),title:"减少缩进"},React.createElement(lt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().setTextAlign("left").run(),active:t.isActive({textAlign:"left"}),title:"左对齐"},React.createElement(xt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().setTextAlign("center").run(),active:t.isActive({textAlign:"center"}),title:"居中"},React.createElement(vt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().setTextAlign("right").run(),active:t.isActive({textAlign:"right"}),title:"右对齐"},React.createElement(wt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(px,{editor:t,iconSize:n}),React.createElement(cx,{onClick:()=>t.chain().focus().unsetLink().run(),disabled:!t.isActive("link"),title:"取消链接"},React.createElement(Mt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().unsetAllMarks().clearNodes().run(),title:"清除格式"},React.createElement(yt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo(),title:"撤销"},React.createElement(Et,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo(),title:"重做"},React.createElement(gt,{className:n}))))}function mx({value:t,onChange:n,readonly:r=!1,placeholder:o="请输入内容...",isTableMode:i=!1,hasError:s=!1,minHeight:a=120}){const l=iy({extensions:[Jw,dw,Qw,ox,lx.configure({multicolor:!0}),Av.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),Kw.configure({types:["heading","paragraph"]}),Gw.configure({placeholder:o})],content:t||"",editable:!r,onUpdate:({editor:e})=>{n(e.getHTML())}});if(e.useEffect(()=>{l?.setEditable(!r)},[l,r]),e.useEffect(()=>{if(!l)return;if(l.isFocused)return;const e=l.getHTML(),n=t||"";("<p></p>"===e?"":e)!==n&&l.commands.setContent(n,{emitUpdate:!1})},[l,t]),r){const e=i?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:t||""}})}const c=i?"w-full "+(s?"bg-red-100/90":"bg-white"):"w-full border rounded-md "+(s?"border-red-200 bg-red-50":"border-gray-300 bg-white focus-within:border-indigo-400 focus-within:ring-2 focus-within:ring-indigo-100");return React.createElement("div",{className:c},l&&React.createElement(fx,{editor:l}),React.createElement(Xg,{editor:l,className:"tiptap-editor rich-text-content overflow-hidden rounded-b-md",style:{minHeight:`${a}px`}}))}function gx(e){return e.filter(e=>"done"===e.status).map(e=>e.response?._id||e.uid).join(",")}function yx(e){const t=e.autoNumberPrefix||"",n=e.autoNumberSuffix||"",r=e.autoNumberPadding??4,o=e.autoNumberDateFormat??"YYYYMM",i="1".padStart(r,"0"),s=new Date;let a="";"YYYY"===o?a=`${s.getFullYear()}`:"YYYYMM"===o?a=`${s.getFullYear()}${String(s.getMonth()+1).padStart(2,"0")}`:"YYYYMMDD"===o&&(a=`${s.getFullYear()}${String(s.getMonth()+1).padStart(2,"0")}${String(s.getDate()).padStart(2,"0")}`);const l=[t,a,i,n].filter(Boolean);return a?`${t}${a}-${i}${n}`:`${t}${i}${n}`||l.join("")}function bx({field:n,value:r,onChange:o,isTableMode:i=!1,hasError:s=!1,minimal:a=!1,onFillFields:l,formValues:c,formalTableMode:d=!1,historyApproves:h=[],previewMode:p=!1}){const[f,m]=e.useState(()=>{if(("file"===n.type||"image"===n.type)&&r){const e=String(r).split(",").map(e=>e.trim()).filter(Boolean),t="image"===n.type?"cfs.images.filerecord":"cfs.files.filerecord";if(e.length>0)return e.map(e=>({uid:e,name:e,status:"done",url:fs(e,void 0,t),response:{_id:e}}))}return[]});e.useEffect(()=>{if("file"!==n.type&&"image"!==n.type)return;const e=f.filter(e=>"done"===e.status&&e.name===e.uid).map(e=>e.uid);if(0===e.length)return;const t="image"===n.type?"cfs.images.filerecord":"cfs.files.filerecord";(async function(e,t="cfs.files.filerecord"){if(!e.length)return{};const n=t.replace(/\./g,"_");try{const t=await ds.get(`/data/${n}`,{params:{filters:JSON.stringify(["_id","in",e]),fields:"_id,original",top:e.length,skip:0}}),r=t.data?.data||[],o={};for(const e of r)e._id&&e.original?.name&&(o[e._id]=e.original.name);return o}catch{return{}}})(e,t).then(e=>{0!==Object.keys(e).length&&m(r=>r.map(r=>{const o=e[r.uid];return o?{...r,name:o,url:fs(r.uid,o,t),..."image"===n.type?{thumbUrl:fs(r.uid,o,t)}:{}}:r}))})},[]);const[g,y]=e.useState(!1),[b,v]=e.useState(""),[w,x]=e.useState(!1),k=d?s?"bg-red-100/90 focus:bg-red-50":"bg-transparent focus:bg-blue-50/30":s?"bg-red-100/90 focus:bg-red-50":"bg-amber-50/80 focus:bg-amber-50",S=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(s?"border-red-200 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100"),E=n.readonly?"bg-gray-50 cursor-not-allowed text-gray-500":"",[M,C]=e.useState(null),R=e.useCallback(e=>{if(!e)return void C(null);const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);C(t?null:"邮箱格式不正确")},[]),O=e.useCallback(e=>{if(!e)return void C(null);const t=/^https?:\/\/.+/i.test(e);C(t?null:"链接格式不正确,需以 http:// 或 https:// 开头")},[]);if(n.readonly){const e=i?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";if("formula"===n.type||"approvalComments"===n.type);else{if("checkbox"===n.type)return React.createElement("label",{className:"flex items-center gap-2 py-1 "+(i?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===r,disabled:!0,readOnly:!0,className:"w-4 h-4 rounded border-gray-300 text-indigo-600"}),!i&&React.createElement("span",{className:"text-[13px] text-gray-500"},n.label));if("radio"===n.type)return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1")},(n.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-default text-[13px] "+(e.value===r?"text-gray-700":"text-gray-400")},React.createElement("input",{type:"radio",name:n._id,checked:r===e.value,disabled:!0,readOnly:!0,className:"w-4 h-4 text-indigo-600 border-gray-300"}),e.label)));if("select"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label||r||"")}if("file"===n.type)return 0===f.length?React.createElement("div",{className:e}):React.createElement("div",{className:`${e} flex flex-wrap gap-2`},f.map(e=>{const t=e.url||(e.response?._id?fs(e.response._id,e.name,"cfs.files.filerecord"):"");return t?React.createElement("a",{key:e.uid,href:t,target:"_blank",rel:"noopener noreferrer",className:"text-gray-900 hover:underline cursor-pointer text-[13px]",title:`下载 ${e.name}`},e.name):React.createElement("span",{key:e.uid,className:"text-gray-500 text-[13px]"},e.name)}));if("image"===n.type);else{if("member"===n.type||"memberMulti"===n.type)return React.createElement(Ds,{value:r,isTableMode:i});if("org"===n.type||"orgMulti"===n.type)return React.createElement(Ls,{value:r,isTableMode:i});if("lookup"===n.type);else{if("email"===n.type)return React.createElement("div",{className:e},r?React.createElement("a",{href:`mailto:${r}`,className:"text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",title:"发送邮件"},r):"");if("url"===n.type)return React.createElement("div",{className:e},r?React.createElement(React.Fragment,null,React.createElement("span",{role:"link",tabIndex:0,className:"text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",title:r,onClick:()=>x(!0),onKeyDown:e=>{"Enter"===e.key&&x(!0)}},r),React.createElement(t.Modal,{title:"即将离开当前页面",open:w,okText:"继续访问",cancelText:"取消",onOk:()=>{x(!1),window.open(r,"_blank","noopener,noreferrer")},onCancel:()=>x(!1)},React.createElement("p",{className:"text-gray-500 mb-2"},"您即将打开以下外部链接:"),React.createElement("p",{className:"break-all text-blue-600 bg-gray-50 rounded px-3 py-2 text-[13px] font-mono"},r))):"");if("password"===n.type)return React.createElement("div",{className:e},"••••••••");if("qrcode"!==n.type)return"autoNumber"===n.type?React.createElement("div",{className:`${e} flex items-center gap-1.5 text-gray-400`},React.createElement("span",null,r||yx(n))):"richtext"===n.type?React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:r||""}}):React.createElement("div",{className:e},r||"")}}}}switch(n.type){case"text":return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入",readOnly:n.readonly,maxLength:n.maxLength,className:`${S} ${E}`});case"email":case"url":{const e="email"===n.type,t=s||!!M,a=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${t?"bg-red-100/90 focus:bg-red-50":k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(t?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100");return React.createElement("div",{className:"w-full"},React.createElement("input",{type:e?"email":"url",value:r,onChange:t=>{o(t.target.value),M&&(e?R(t.target.value):O(t.target.value))},onBlur:t=>{e?R(t.target.value):O(t.target.value)},placeholder:n.placeholder||(e?"请输入邮箱地址":"请输入链接地址"),readOnly:n.readonly,maxLength:n.maxLength,className:`${a} ${E}`}),M&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},M))}case"textarea":return React.createElement("textarea",{value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,maxLength:n.maxLength,rows:3,className:`${S} ${E} resize-none`});case"number":{const e=e=>{if(!n.thousandSeparator||""===e||void 0===e)return e;const t=Number(e);return isNaN(t)?e:null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN")};return n.thousandSeparator&&!n.readonly?React.createElement("input",{type:"text",defaultValue:e(r),key:`num-${n._id}-${r}`,onFocus:e=>{e.target.value=r},onBlur:t=>{const n=t.target.value.replace(/,/g,"");o(n),t.target.value=e(n)},placeholder:n.placeholder||"请输入数字",className:`${S}`}):React.createElement("input",{type:"number",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入数字",readOnly:n.readonly,min:n.min,max:n.max,step:n.precision?Math.pow(10,-n.precision):void 0,className:`${S} ${E}`})}case"date":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.DatePicker,{value:r?u(r):null,onChange:(e,t)=>o("string"==typeof t?t:""),disabled:n.readonly,placeholder:"选择日期",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"datetime":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.DatePicker,{showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",value:r?u(r):null,onChange:(e,t)=>o("string"==typeof t?t:""),disabled:n.readonly,placeholder:"选择日期时间",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"time":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.TimePicker,{value:r?u(r,"HH:mm"):null,onChange:(e,t)=>o("string"==typeof t?t:""),format:"HH:mm",disabled:n.readonly,placeholder:"选择时间",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"select":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Select,{value:r||void 0,onChange:e=>o(e??""),disabled:n.readonly,placeholder:"请选择",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"multiSelect":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Select,{mode:"multiple",value:r?Array.isArray(r)?r:String(r).split(",").filter(Boolean):[],onChange:e=>o(e.join(",")),disabled:n.readonly,placeholder:"请选择(多选)",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,minHeight:34,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"radio":return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1")},(n.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-pointer text-[13px] text-gray-700"},React.createElement("input",{type:"radio",name:n._id,value:e.value,checked:r===e.value,onChange:e=>o(e.target.value),disabled:n.readonly,className:"w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-200"}),e.label)),(!n.options||0===n.options.length)&&React.createElement("span",{className:"text-[12px] text-gray-400 italic"},"未配置选项"));case"checkbox":return React.createElement("label",{className:"flex items-center gap-2 cursor-pointer py-1 "+(i?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===r,onChange:e=>o(e.target.checked?"true":"false"),disabled:n.readonly,className:"w-4 h-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-200"}),!i&&React.createElement("span",{className:"text-[13px] text-gray-700"},n.label));case"file":{const e=!!n.multiple,r={fileList:f,multiple:e,maxCount:e?void 0:1,accept:n.accept||void 0,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await ps(e);n?.(t)}catch(o){const e=o instanceof Error?o.message:"未知错误";t.message.error(`上传失败: ${e}`),r?.(o instanceof Error?o:new Error(e))}},onChange:e=>{m(e.fileList),o(gx(e.fileList))},onRemove:e=>{const t=f.filter(t=>t.uid!==e.uid);m(t),o(gx(t))}};return React.createElement(t.ConfigProvider,{locale:Br},i?React.createElement(t.Upload,{...r},React.createElement(t.Button,{size:"small",icon:React.createElement(er,null),disabled:n.readonly},n.readonly?"仅读":"上传文件")):React.createElement(t.Upload.Dragger,{...r},React.createElement("p",{className:"ant-upload-drag-icon"},React.createElement(Pn,null)),React.createElement("p",{className:"ant-upload-text text-[13px]"},n.readonly?"仅读模式":e?"点击或拖拽文件到此区域上传(可多选)":"点击或拖拽文件到此区域上传"),n.accept&&React.createElement("p",{className:"ant-upload-hint text-[11px]"},"支持格式: ",n.accept)))}case"image":{const e=!!n.pickerMultiple,r=async e=>{const t=e.url||e.thumbUrl||"";v(t),y(!0)},i={listType:"picture-card",fileList:f,accept:"image/*",multiple:e,maxCount:e?void 0:1,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await ps(e,{collectionName:"cfs.images.filerecord"});n?.(t)}catch(o){const e=o instanceof Error?o.message:"未知错误";t.message.error(`上传失败: ${e}`),r?.(o instanceof Error?o:new Error(e))}},onChange:e=>{const t=e.fileList.map(e=>{if("done"===e.status&&e.response?._id&&!e.url){const t=fs(e.response._id,e.name,"cfs.images.filerecord");return{...e,url:t,thumbUrl:t}}return e});m(t),o(gx(t))},onRemove:e=>{const t=f.filter(t=>t.uid!==e.uid);m(t),o(gx(t))},onPreview:r};return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Upload,{...i},!n.readonly&&React.createElement("div",{className:"flex flex-col items-center justify-center"},React.createElement(qn,null),React.createElement("span",{className:"text-[11px] mt-1"},"上传"))),b&&React.createElement(t.Image,{wrapperStyle:{display:"none"},preview:{visible:g,onVisibleChange:e=>{y(e),e||v("")}},src:b}))}case"member":return React.createElement(Cs,{value:r,onChange:o,multiple:!1,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,pickerFillRules:n.pickerFillRules,onFillFields:l,valueFormat:n.valueFormat});case"memberMulti":return React.createElement(Cs,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,valueFormat:n.valueFormat});case"org":return React.createElement(_s,{value:r,onChange:o,multiple:!1,isTableMode:i,hasError:s,formalTableMode:d,pickerFillRules:n.pickerFillRules,onFillFields:l,valueFormat:n.valueFormat});case"orgMulti":return React.createElement(_s,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,valueFormat:n.valueFormat});case"lookup":return React.createElement(bs,{field:n,value:r,onChange:o,onFillFields:l,isTableMode:i,hasError:s,formValues:c});case"formula":return React.createElement("div",{className:`${i?"overflow-hidden":"border border-gray-200 rounded-md bg-gray-50"} px-3 py-2 text-[13px] font-mono ${r.startsWith("#ERR")?"text-red-400 text-[11px]":r?"text-gray-800":"text-gray-400"} truncate`,title:r.startsWith("#ERR")?r:n.formula?`= ${n.formula}`:""},i?r.startsWith("#ERR")?r:r||"—":r||(n.formula?`= ${n.formula}`:"(自动计算)"));case"approvalComments":{const e=n.approvalCommentSteps||[];let t=Array.isArray(h)&&h.length?h:function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(r);return p&&0===t.length&&e.length>0&&(t=e.map(e=>({name:e.stepLabel||e.stepId||"审批步骤",type:"trace",judge:"",judgeValue:"approved",step_type:"sign",step_id:e.stepId,children:[{name:"",user_name:"张三",finish_date:"2026-03-14 10:30",judge:"已核准",judgeValue:"approved",opinion:e.defaultComment||"已审阅,同意。",type:"approve",approve_type:"",step_type:"sign",step_id:e.stepId}]}))),0===e.length?React.createElement("div",{className:(i?"px-2.5 py-2":"border border-dashed border-purple-300 rounded-md px-4 py-3")+" flex items-center gap-2 text-gray-400"},React.createElement(pt,{className:"w-4 h-4 shrink-0 text-purple-400"}),React.createElement("span",{className:"text-[12px]"},"审批意见(未绑定步骤)")):React.createElement("div",{className:(i?"":"border border-purple-200 rounded-md")+" bg-white overflow-hidden"},e.map((e,n)=>(()=>{const r=t.filter(t=>{const n=String(t?.step_id||""),r=String(t?.name||"");return n===e.stepId||r===e.stepLabel||r===e.stepId}).flatMap(e=>Array.isArray(e.children)?e.children:[]).filter(t=>{const n="cc"===t?.approve_type;return!(!e.showCirculateComments||!e.showHandlerComments)||(e.showCirculateComments?n:!!e.showHandlerComments&&!n)});if(0===r.length)return null;const o=t=>r.map((n,r)=>{const o=String(n?.user_name||""),i=function(e){if(!e)return"";const t=e.match(/<img[^>]*src=["']([^"']+)["'][^>]*>/i);return t?.[1]||""}(o),s=((a=o)?a.replace(/<img[^>]*>/gi,"").replace(/<[^>]+>/g,"").trim():"")||"审批人";var a;const l=(n?.opinion||"").trim()||e.defaultComment||"";return React.createElement("div",{key:`${n?.step_id||e.stepId||"step"}-${r}`,className:""+(t?"px-2 py-1.5":"px-2.5 py-2")},l&&React.createElement("p",{className:"text-[12px] text-gray-700 leading-snug break-words mb-1"},l),React.createElement("div",{className:"flex items-center gap-1.5 pl-3"},e.showSignature&&i?React.createElement("img",{src:i,alt:s,className:"max-w-[90px] max-h-[60px] object-contain"}):React.createElement("span",{className:"text-[12px] font-medium text-gray-600"},s),n?.finish_date&&React.createElement("span",{className:"text-[12px] text-gray-600 shrink-0"},String(n.finish_date).split(" ")[0])))});return i?React.createElement("div",{key:e.stepId||n,className:n>0?"border-gray-100":""},o(!0)):React.createElement("div",{key:e.stepId||n,className:""+(n>0?"border-gray-100":"")},o(!1))})()))}case"password":return React.createElement(t.Input.Password,{value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入密码",readOnly:n.readonly,disabled:n.readonly,className:i?"picker-table-mode":"",variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}}});case"richtext":return React.createElement(mx,{value:r,onChange:o,readonly:n.readonly,placeholder:n.placeholder||"请输入富文本内容...",isTableMode:i,hasError:s,formalTableMode:d});case"autoNumber":return React.createElement("div",{className:(i?"px-2.5 py-2 flex items-center gap-1.5":"border border-gray-200 rounded-md px-3 py-2 flex items-center gap-1.5")+" text-[13px] text-gray-400 bg-gray-50"},React.createElement("span",null,r||yx(n)));case"qrcode":return React.createElement("div",{className:(i?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-3")+" flex flex-col items-center gap-2"},r?React.createElement(t.QRCode,{value:r,size:i?80:120}):React.createElement(t.QRCode,{value:"-",size:i?80:120,status:"expired"}),!n.readonly&&React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"输入二维码内容",className:`${S} mt-1`}));default:return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:"请输入",className:S})}}function vx(e){const t=Number(e);if(isNaN(t)||!isFinite(t))return"";if(0===t)return"零元整";const n=t<0,r=Math.abs(t),o=Math.floor(r),i=Math.round(100*(r-o)),s=Math.floor(i/10),a=i%10,l=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],c=["","拾","佰","仟"],u=["","万","亿","兆"];function d(e){if(0===e)return"";let t="",n=!1;for(let r=3;r>=0;r--){const o=Math.floor(e/Math.pow(10,r))%10;0===o?t.length>0&&(n=!0):(n&&(t+="零",n=!1),t+=l[o]+c[r])}return t}let h=(function(e){if(0===e)return"";const t=[];let n=e;for(;n>0;)t.push(n%1e4),n=Math.floor(n/1e4);let r="";for(let o=t.length-1;o>=0;o--){const e=t[o];if(0===e)r.length>0&&!r.endsWith("零")&&(r+="零");else{const t=d(e);r.length>0&&e<1e3&&!r.endsWith("零")&&(r+="零"),r+=t+u[o]}}return r.replace(/零+$/,"")}(o)||"零")+"元";return 0===s&&0===a?h+="整":0===s?h+="零"+l[a]+"分":(h+=l[s]+"角",h+=a>0?l[a]+"分":"整"),(n?"负":"")+h}function wx(e){const t=[],n=e=>{Array.isArray(e)?e.forEach(n):t.push(e)};return e.forEach(n),t}function xx(e){if("number"==typeof e)return isFinite(e)?e:0;if(null==e||""===e)return 0;if("string"==typeof e){const t=e.replace(/,/g,"").trim();if(!t)return 0;const n=Number(t);return isNaN(n)||!isFinite(n)?0:n}const t=Number(e);return isNaN(t)||!isFinite(t)?0:t}u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn");const kx={SUM:(...e)=>wx(e).reduce((e,t)=>e+xx(t),0),AVG:(...e)=>{const t=wx(e);return t.length?t.reduce((e,t)=>e+xx(t),0)/t.length:0},AVERAGE:(...e)=>{const t=wx(e);return t.length?t.reduce((e,t)=>e+xx(t),0)/t.length:0},MAX:(...e)=>{const t=wx(e);return 0===t.length?0:Math.max(...t.map(xx))},MIN:(...e)=>{const t=wx(e);return 0===t.length?0:Math.min(...t.map(xx))},COUNT:(...e)=>wx(e).filter(e=>0!==e&&""!==e&&null!=e).length,ABS:e=>Math.abs(Number(e)),ROUND:(e,t=0)=>{const n=Math.pow(10,Number(t));return Math.round(Number(e)*n)/n},FLOOR:e=>Math.floor(Number(e)),CEIL:e=>Math.ceil(Number(e)),INT:e=>Math.trunc(Number(e)),MOD:(e,t)=>Number(e)%Number(t),POWER:(e,t)=>Math.pow(Number(e),Number(t)),SQRT:e=>Math.sqrt(Number(e)),IF:(e,t,n)=>e?t:n,AND:(...e)=>e.every(e=>!!e),OR:(...e)=>e.some(e=>!!e),NOT:e=>!e,ISNULL:e=>null==e||""===e,ISBLANK:e=>null==e||""===e,TODAY:()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},NOW:()=>(new Date).toISOString(),DATE:(e,t,n)=>new Date(Number(e),Number(t)-1,Number(n)).toISOString().split("T")[0],YEAR:e=>(e?new Date(e):new Date).getFullYear(),MONTH:e=>(e?new Date(e):new Date).getMonth()+1,DAY:e=>(e?new Date(e):new Date).getDate(),DATEDIF:(e,t,n)=>{if(!e||!t)return 0;const r=new Date(e),o=new Date(t),i=o.getTime()-r.getTime(),s=String(n).toUpperCase();return"D"===s?Math.floor(i/864e5):"M"===s?12*(o.getFullYear()-r.getFullYear())+(o.getMonth()-r.getMonth()):"Y"===s?o.getFullYear()-r.getFullYear():Math.floor(i/864e5)},DAYS:(e,t)=>t&&e?Math.floor((new Date(e).getTime()-new Date(t).getTime())/864e5):0,CONCAT:(...e)=>e.join(""),LEFT:(e,t)=>String(e).substring(0,Number(t)),RIGHT:(e,t)=>{const n=String(e);return n.substring(n.length-Number(t))},MID:(e,t,n)=>String(e).substring(Number(t)-1,Number(t)-1+Number(n)),LEN:e=>String(e).length,UPPER:e=>String(e).toUpperCase(),LOWER:e=>String(e).toLowerCase(),TRIM:e=>String(e).trim(),REPLACE:(e,t,n)=>String(e).split(String(t)).join(String(n)),FIND:(e,t)=>{const n=String(t).indexOf(String(e));return n>=0?n+1:0},TEXT:(e,t)=>{const n=String(t||"");if("rmb"===n.toLowerCase()||n.includes("[DBNum2]")||n.includes("DBNum2"))return vx(e);const r=Number(e);if(isNaN(r))return String(e);if(n.includes(".")){const e=n.split(".")[1]?.length||0;return r.toFixed(e)}return String(r)},RMB:e=>vx(e),CNY:e=>vx(e)},Sx=Object.keys(kx),Ex=Object.values(kx);function Mx(e,t){if(!e)return"";const n=e.includes("${")?e:`\${${e}}`;try{const e=Object.keys(t),r=[],o=[];for(const n of e){const i=t[n];if("string"!=typeof i||!i.trim())continue;let s;try{s=JSON.parse(i)}catch{continue}if(!Array.isArray(s)||0===s.length)continue;if(!s.every(e=>e&&"object"==typeof e&&!Array.isArray(e)))continue;const a=new Map;for(const e of s)Object.keys(e).forEach(t=>{a.has(t)||a.set(t,[]),a.get(t).push(e[t])});for(const[t,l]of a.entries()){e.includes(t)||r.includes(t)||(r.push(t),o.push(l));const i=`${n}_${t}`;e.includes(i)||r.includes(i)||(r.push(i),o.push(l))}}const i=e.map(e=>{const n=t[e];if(null==n||""===n)return 0;const r=Number(n);return isNaN(r)?n:r});return n.replace(/\$\{([^}]+)\}/g,(t,n)=>{try{const t=[],s=[],a=new Set([...Sx,...e,...r]),l=n.match(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)||[];for(const e of l)a.has(e)||(a.add(e),t.push(e),s.push(0));const c=new Function(...Sx,...e,...r,...t,`return (${n});`)(...Ex,...i,...o,...s);return null==c?"":"number"==typeof c?isNaN(c)?"":isFinite(c)?String(Math.round(1e4*c)/1e4):"#ERR: 除以零":String(c)}catch(s){return`#ERR: ${s instanceof Error?s.message:String(s)}`}})}catch(r){const t=r instanceof Error?r.message:String(r);return console.warn("[Formula]",e,t),`#ERR: ${t}`}}function Cx(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Rx({field:n,isTableMode:r=!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,value:a,onChange:l,fieldPermissions:c}){const u=n.children||[],d=e.useMemo(()=>c?u.filter(e=>"hidden"!==c[e.name]).map(e=>{const t=c[e.name];return"editable"===t?e:"readonly"===t?{...e,readonly:!0}:e}):u,[u,c]),h=void 0!==l,[p,f]=e.useState([{}]),m=h?Cx(a).length>0?Cx(a):[{}]:p,[g,y]=e.useState(a);h&&a!==g&&y(a);const b=e=>{h?l(JSON.stringify(e)):f(e)},v=null==n.maxRows||m.length<n.maxRows,w=m.length>1&&(null==n.minRows||m.length>n.minRows),x=d.filter(e=>"formula"===e.type&&e.formula),k=e=>{if(0===x.length)return e;let t={...e};for(const n of x){const e=Mx(n.formula,t);t[n.name]!==e&&(t={...t,[n.name]:e})}return t},S=e.useMemo(()=>0===x.length?m:m.map(k),[m,x.map(e=>e.name+":"+e.formula).join(",")]),[E,M]=e.useState(null),[C,R]=e.useState({}),O=e.useCallback(e=>{M(e),R({...m[e]||{}})},[m]),T=e.useCallback((e,t)=>{R(n=>{const r={...n,[e]:t};return k(r)})},[k]),N=e.useCallback(()=>{if(null===E)return;const e=[...m];e[E]=k(C),b(e),M(null)},[E,C,m,b,k]),_=e.useCallback(()=>{M(null)},[]),A=r?"border-black":"border-gray-200",D=!!n.readonly,[$,L]=t.message.useMessage(),I=e.useMemo(()=>(n.children||[]).filter(e=>"formula"!==e.type&&!e.readonly).map(e=>e.name),[n.children]),j=e.useCallback(e=>{if(!e.trim())return[];const t=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").filter(e=>e.trim());if(0===t.length)return[];const n=t[0].includes("\t")?"\t":",";return t.map(e=>{const t="\t"===n?e.split("\t"):function(e){const t=[];let n="",r=!1;for(let o=0;o<e.length;o++){const i=e[o];r?'"'===i?o+1<e.length&&'"'===e[o+1]?(n+='"',o++):r=!1:n+=i:'"'===i?r=!0:","===i?(t.push(n),n=""):n+=i}return t.push(n),t}(e),r={};return I.forEach((e,n)=>{n<t.length&&(r[e]=t[n].trim())}),r})},[I]),z=e.useCallback(e=>{if(D)return;const t=e.target?.tagName?.toLowerCase();if("input"===t||"textarea"===t||"select"===t)return;const r=e.clipboardData.getData("text/plain");if(!r?.trim())return;const o=j(r);if(0===o.length)return;e.preventDefault();const i=null!=n.maxRows?Math.max(0,n.maxRows-m.length):o.length;if(0===i)return void $.warning(`已达到最大行数 ${n.maxRows}`);const s=o.slice(0,i).map(k);b([...m,...s]),$.success(`已粘贴 ${s.length} 行数据`)},[D,j,m,n.maxRows,k,b,$]),P=e.useCallback(async()=>{if(!D)try{const e=await navigator.clipboard.readText();if(!e?.trim())return void $.info("剪贴板为空");const t=j(e);if(0===t.length)return void $.info("未解析到有效数据");const r=null!=n.maxRows?Math.max(0,n.maxRows-m.length):t.length;if(0===r)return void $.warning(`已达到最大行数 ${n.maxRows}`);const o=t.slice(0,r).map(k);b([...m,...o]),$.success(`已粘贴 ${o.length} 行数据`)}catch{$.error("无法读取剪贴板,请使用 Ctrl+V / ⌘+V 粘贴")}},[D,j,m,n.maxRows,k,b,$]);if(0===d.length)return React.createElement("div",{className:"text-[12px] text-gray-400 italic py-2 text-center"},"未配置子字段");const F=e.useMemo(()=>0===x.length?C:k(C),[C,x.map(e=>e.name+":"+e.formula).join(",")]),B=null!==E&&React.createElement(t.Modal,{open:!0,title:`${n.label} - 第 ${E+1} 行`,onCancel:_,onOk:N,footer:React.createElement("div",{className:"flex justify-end gap-2 pt-2"},React.createElement(t.Button,{onClick:_},"取消"),React.createElement(t.Button,{type:"primary",onClick:N},"确认")),width:"min(780px, 95vw)",destroyOnClose:!0,styles:{body:{maxHeight:"70vh",overflowY:"auto",padding:"16px 0 24px"}}},React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-5 gap-y-5"},d.map(e=>{const t="textarea"===e.type||"html"===e.type;return React.createElement("div",{key:e._id,className:t?"md:col-span-2":""},React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&!D&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement(bx,{field:D?{...e,readonly:!0}:e,value:F[e.name]||"",onChange:t=>T(e.name,t),isTableMode:!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s}))})));return React.createElement("div",{className:r?"":"mt-1",onPaste:z},L,React.createElement("div",{className:r?(!1!==n.showLabel?"border-t border-black ":"")+"overflow-hidden":"border border-gray-300 rounded-md overflow-hidden"},React.createElement("div",{className:"overflow-x-auto"},React.createElement("table",{className:"w-full text-[13px]",style:{minWidth:d.length>3?120*d.length+80+"px":void 0}},React.createElement("thead",null,React.createElement("tr",{className:`bg-gray-50 border-b ${A}`},!1!==n.showRowNumber&&React.createElement("th",{className:`w-10 px-2 py-2 text-center text-gray-500 font-medium border-r ${A} sticky left-0 bg-gray-50 z-[1]`},"#"),d.map(e=>React.createElement("th",{key:e._id,className:`px-3 py-2 text-left font-medium text-gray-600 border-r ${A} last:border-r-0 whitespace-nowrap`},e.label,e.required&&!e.readonly&&!D&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*"))),!D&&React.createElement("th",{className:"w-16 px-2 py-2 text-center text-gray-500 font-medium sticky right-0 bg-gray-50 z-[1]"},"操作"))),React.createElement("tbody",null,S.map((e,t)=>React.createElement("tr",{key:t,className:`border-b ${r?"border-black":"border-gray-100"} last:border-b-0 hover:bg-gray-50/50`},!1!==n.showRowNumber&&React.createElement("td",{className:`px-2 py-1.5 text-center text-gray-400 text-[12px] border-r ${A} sticky left-0 bg-white z-[1]`},t+1),d.map(n=>React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${A} last:border-r-0 ${!r||n.readonly||D?"":"bg-amber-50/80"}`},React.createElement(bx,{field:D?{...n,readonly:!0}:n,value:e[n.name]||"",onChange:e=>((e,t,n)=>{const r=[...m];r[e]={...r[e],[t]:n},r[e]=k(r[e]),b(r)})(t,n.name,e),isTableMode:r,formalTableMode:!0,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s}))),!D&&React.createElement("td",{className:"px-1 py-1.5 text-center sticky right-0 bg-white z-[1]"},React.createElement("div",{className:"flex items-center justify-center gap-0.5"},React.createElement("button",{onClick:()=>O(t),className:"rounded p-0.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"弹窗编辑"},React.createElement(ht,{className:"w-3 h-3"})),w&&React.createElement("button",{onClick:()=>{return e=t,void(w&&(b(m.filter((t,n)=>n!==e)),E===e?M(null):null!==E&&E>e&&M(E-1)));var e},className:"rounded p-0.5 text-gray-400 hover:text-red-500 hover:bg-red-50 smooth-transition"},React.createElement(kt,{className:"w-3 h-3"}))))))))),!D&&React.createElement("div",{className:r?"border-t border-black":"border-t border-gray-100"},React.createElement("div",{className:"flex items-center gap-2 px-3 py-1.5"},v&&React.createElement("button",{onClick:()=>{v&&b([...m,{}])},className:"flex items-center gap-1 text-[12px] text-indigo-600 hover:text-indigo-700 smooth-transition"},React.createElement(mt,{className:"w-3.5 h-3.5"})," 添加一行"),v&&React.createElement("button",{onClick:P,className:"flex items-center gap-1 text-[12px] text-gray-500 hover:text-indigo-600 smooth-transition",title:"从Excel或CSV粘贴数据(也可以直接 Ctrl+V / ⌘+V)"},React.createElement(rt,{className:"w-3.5 h-3.5"})," 粘贴")))),B)}function Ox(e,t){return`${e}_${t}`}function Tx({field:t,isTableMode:n=!1,formValues:r,onUpdateValue:o,onFillFields:i,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c,formMode:u="editable",compact:d=!1}){const h=t.gridRows||3,p=t.gridCols||4,f=t.gridData||[],m=t.children||[],g=e.useMemo(()=>"editable"!==u?m.map(e=>({...e,readonly:!0})):c?m.map(e=>{const t=c[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}):m,[m,c,u]),y=e.useMemo(()=>{const e=new Map;for(const t of g)e.set(t._id,t);return e},[g]),b=e.useMemo(()=>function(e){const t=new Set;for(const n of e){const e=n.rowspan||1,r=n.colspan||1;for(let o=0;o<e;o++)for(let e=0;e<r;e++)0===o&&0===e||t.add(Ox(n.row+o,n.col+e))}return t}(f),[f]),v=e.useMemo(()=>{const e=f.filter(e=>"formula"===e.cellType&&e.value);if(0===e.length)return{};const t={};for(const n of e){t[Ox(n.row,n.col)]=Mx(n.value,r)}return t},[r,f]),w=n?"border-black":"border-gray-300",x=t.gridColumnWidths,k=!!t.gridScrollable||d;return React.createElement("div",{className:n?"":"mt-1"},React.createElement("div",{className:n?""+(!1!==t.showLabel?"border-t border-black":""):`border ${w}`,style:n?{overflow:"hidden"}:void 0},React.createElement("div",{className:k?"overflow-x-auto":""},React.createElement("table",{className:"w-full text-[13px] border-collapse "+(k?"table-fixed":""),style:{minWidth:k&&p>4?100*p+"px":void 0,...n?{margin:"-1px",width:"calc(100% + 2px)"}:{}}},React.createElement("colgroup",null,Array.from({length:p},(e,t)=>React.createElement("col",{key:t,style:x?.[t]?{width:`${x[t]}%`}:void 0}))),React.createElement("tbody",null,Array.from({length:h},(e,t)=>React.createElement("tr",{key:t,className:""+(t<h-1?`border-b ${w}`:"")},Array.from({length:p},(e,d)=>{const h=Ox(t,d);if(b.has(h))return null;const m=function(e,t,n){return e.find(e=>e.row===t&&e.col===n)}(f,t,d),g=m?.rowspan||1,x=m?.colspan||1,S=d+x>=p,E=m?.cellType||"input",M={textAlign:m?.align||("label"===E?"center":"left")};if(m?.color&&(M.color=m.color),m?.backgroundColor&&(M.backgroundColor=m.backgroundColor),m?.fontWeight&&(M.fontWeight=m.fontWeight),m?.borderStyle&&(M.borderStyle=m.borderStyle),"label"===E)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:`px-3 py-2 ${S?"":`border-r ${w}`} ${m?.backgroundColor?"":"bg-white"} ${m?.color?"":"text-gray-600"} ${m?.fontWeight?"":"font-medium"}`,style:M},m?.value||"");if("formula"===E){const e=v[h]||"";return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:`px-3 py-2 ${S?"":`border-r ${w}`} ${m?.backgroundColor?"":n?"bg-amber-50/50":""} ${m?.color?"":"text-gray-700"}`,style:k?{...M,maxWidth:0}:M},React.createElement("div",{className:k?"truncate":"",title:e},e))}const C=m?.fieldId?y.get(m.fieldId):null;if(!C&&!m?.fieldType)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"px-3 py-2 "+(S?"":`border-r ${w}`),style:M}," ");if(C){if(C.hidden)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"px-3 py-2 "+(S?"":`border-r ${w}`),style:M}," ");const e=C.name,t=r[e]||C.defaultValue||"";if("table"===C.type)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"p-0 "+(S?"":`border-r ${w}`),style:M},React.createElement(Rx,{field:C,isTableMode:n,value:t,onChange:t=>o(e,t),searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c}));const u=!C.readonly&&n?"bg-amber-50/80":"",h=C.required&&!C.readonly;return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:`p-0 ${S?"":`border-r ${w}`} ${u} ${k?"overflow-hidden":""}`,style:k?{...M,maxWidth:0}:M},React.createElement("div",{className:"relative"},h&&React.createElement("span",{className:"absolute top-0.5 right-1 text-red-500 text-[10px] font-bold z-10"},"*"),React.createElement(bx,{field:C,value:t,onChange:t=>o(e,t),isTableMode:!0,formalTableMode:!0,searchUsersFn:s,searchOrgsFn:a,onFillFields:i,formValues:r})))}const R="editable"!==u;return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"p-0 "+(S?"":`border-r ${w}`),style:M},React.createElement("input",{type:"number"===m?.fieldType?"number":"text",className:"w-full h-full px-3 py-2 text-[13px] bg-transparent outline-none "+(R?"cursor-not-allowed text-gray-500 bg-gray-50":"focus:bg-blue-50/50"),value:r[h]||"",onChange:e=>!R&&o(h,e.target.value),readOnly:R,placeholder:m?.fieldLabel||m?.value||""}))}))))))))}const Nx=e=>(e.colspan??6)>=12,_x=e=>"section"===e||"table"===e||"grid"===e;const Ax=[{name:"indigo",label:"靛蓝",primary:"#6366f1",title:"#4338ca",bg:"#eef2ff",border:"#818cf8",desc:"#818cf8"},{name:"emerald",label:"翡翠绿",primary:"#10b981",title:"#047857",bg:"#ecfdf5",border:"#34d399",desc:"#6ee7b7"},{name:"amber",label:"琥珀",primary:"#f59e0b",title:"#92400e",bg:"#fffbeb",border:"#fbbf24",desc:"#fbbf24"},{name:"rose",label:"玫瑰红",primary:"#f43f5e",title:"#be123c",bg:"#fff1f2",border:"#fb7185",desc:"#fda4af"},{name:"sky",label:"天蓝",primary:"#0ea5e9",title:"#0369a1",bg:"#f0f9ff",border:"#38bdf8",desc:"#7dd3fc"},{name:"violet",label:"紫罗兰",primary:"#8b5cf6",title:"#6d28d9",bg:"#f5f3ff",border:"#a78bfa",desc:"#c4b5fd"},{name:"slate",label:"石板灰",primary:"#64748b",title:"#334155",bg:"#f8fafc",border:"#94a3b8",desc:"#94a3b8"},{name:"orange",label:"橙色",primary:"#f97316",title:"#c2410c",bg:"#fff7ed",border:"#fb923c",desc:"#fdba74"},{name:"teal",label:"青色",primary:"#14b8a6",title:"#0f766e",bg:"#f0fdfa",border:"#2dd4bf",desc:"#5eead4"}];function Dx(e){const t=e.replace("#","");return 3===t.length?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)}:6===t.length?{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}:null}function $x(e,t,n){return"#"+[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function Lx(e,t){const n=Dx(e);return n?$x(n.r+(255-n.r)*t,n.g+(255-n.g)*t,n.b+(255-n.b)*t):e}function Ix(e,t){const n=Dx(e);return n?$x(n.r*(1-t),n.g*(1-t),n.b*(1-t)):e}function jx(e){if(e.sectionColor){const n={name:"custom",label:"自定义",primary:t=e.sectionColor,title:Ix(t,.35),bg:Lx(t,.92),border:Lx(t,.35),desc:Lx(t,.35)};return{...n,title:e.titleColor||n.title}}var t;const n=Ax.find(t=>t.name===e.colorScheme)||Ax[0];return{...n,title:e.titleColor||n.title}}function zx(e,t,n){if(!e?.length)return!1;const r=e.map(e=>function(e,t){const n=String(t[e.field]??"");switch(e.operator){case"eq":return n===e.value;case"neq":return n!==e.value;case"contains":return n.includes(e.value||"");case"notContains":return!n.includes(e.value||"");case"empty":return""===n;case"notEmpty":return""!==n;default:return!1}}(e,n));return"or"===(t||"and")?r.some(Boolean):r.every(Boolean)}function Px({fields:e,columns:t=2,formValues:n,updateValue:r,fieldErrors:o,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,labelClassName:l,onFillFields:c,fieldPermissions:u,formMode:d="editable",resolveValue:h,historyApproves:p,previewMode:f}){const m=[];let g=0,y=0;if(e.forEach(e=>{const n=_x(e.type),r=Nx(e),o=n||r?t:Math.min(e.tableColspan||1,t);if(g>0&&(n||r||g+o>t)){const e=t-g;e>0&&m.push({type:"empty",cs:e,key:"empty-"+y++}),g=0}m.push({type:"field",field:e}),n||r?g=0:(g+=o,g>=t&&(g=0))}),g>0){const e=t-g;e>0&&m.push({type:"empty",cs:e,key:"empty-"+y++})}const b={minWidth:0,backgroundColor:"#fff"};return React.createElement("div",{className:"border-2 border-black overflow-hidden workflow-form-v2-body",style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"1px",backgroundColor:"#000"}},m.map(e=>{if("empty"===e.type)return React.createElement("div",{key:e.key,style:{...b,gridColumn:`span ${e.cs}`}});const{field:m}=e,g=_x(m.type),y=Nx(m),v={gridColumn:`span ${g||y?t:Math.min(m.tableColspan||1,t)}`,minWidth:0,backgroundColor:"#fff"};if("section"===m.type){const e=jx(m);return React.createElement("div",{key:m._id,style:{...v,backgroundColor:e.bg},"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} px-3 py-2`},React.createElement("div",{className:"flex items-center gap-2"},React.createElement("span",{className:"text-[13px] font-semibold",style:{color:e.title}},m.label)),m.description&&React.createElement("div",{className:"text-[11px] mt-0.5 ml-[22px]",style:{color:e.desc},dangerouslySetInnerHTML:{__html:m.description}}))}if("table"===m.type){const e=!1!==m.showLabel&&(m.colorScheme||m.sectionColor)?jx(m):null;return React.createElement("div",{key:m._id,style:v,"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} p-0`},!1!==m.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"rgba(238,242,255,0.6)"}},React.createElement("span",{className:"text-[13px] font-semibold table-label",style:{color:e?.title||"#374151"}},m.label),m.required&&!m.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==m.showLabel&&m.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#9ca3af",backgroundColor:e?.bg||"rgba(238,242,255,0.6)"},dangerouslySetInnerHTML:{__html:m.description}}),React.createElement(Rx,{field:m,isTableMode:!0,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,value:n[m.name],onChange:e=>r(m.name,e),fieldPermissions:u}))}if("grid"===m.type){const e=!1!==m.showLabel&&(m.colorScheme||m.sectionColor)?jx(m):null;return React.createElement("div",{key:m._id,style:v,"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} p-0`},!1!==m.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"rgba(240,253,250,0.6)"}},React.createElement("span",{className:"text-[13px] grid-label font-semibold",style:{color:e?.title||"#374151"}},m.label)),!1!==m.showLabel&&m.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#9ca3af",backgroundColor:e?.bg||"rgba(240,253,250,0.6)"},dangerouslySetInnerHTML:{__html:m.description}}),React.createElement(Tx,{field:m,isTableMode:!0,formValues:n,onUpdateValue:r,onFillFields:c,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,fieldPermissions:u,formMode:d}))}const w=!!o?.[m.name];return React.createElement("div",{key:m._id,style:v,"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} p-0`},React.createElement("div",{className:"flex h-full min-w-0 overflow-hidden"},!1!==m.showLabel&&React.createElement("div",{"data-field-label":"",className:Je("field-label w-28 lg:w-32 shrink-0 border-r border-black px-2.5 py-2 flex items-center justify-center",w?"bg-red-50":"bg-gray-50/30",m.labelClassName||l)},React.createElement("span",{className:Je("text-[13px] font-medium break-words text-center leading-snug",w?"text-red-700":"text-gray-600",m.labelClassName||l)},m.label),m.required&&!m.readonly&&React.createElement("span",{className:"text-red-500 text-[10px] font-bold ml-0.5"},"*")),React.createElement("div",{"data-field-item":"",className:Je("field-item flex-1 min-w-0 overflow-hidden flex flex-col justify-center",!m.readonly&&(w?"bg-red-100/90":"bg-amber-50/80"))},React.createElement(bx,{field:m,value:(h||Bx)(n[m.name]??m.defaultValue??""),onChange:e=>r(m.name,e),isTableMode:!0,hasError:w,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,onFillFields:c,formValues:n,historyApproves:p,previewMode:f}),w&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 px-2 py-0.5 leading-tight"},o[m.name]))))}))}function Fx(e){if(!e)return"";if("__TODAY__"===e){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}if("__NOW__"===e){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}if("__CURRENT_TIME__"===e){const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}return"__CURRENT_USER__"===e||"__CURRENT_USER_ORG__"===e?e:e.includes("${")?Mx(e,{}):e}function Bx(e){return e&&"string"==typeof e&&e.includes("${")?Fx(e):e}function Hx(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0");return`${n}-${r}-${String(t.getDate()).padStart(2,"0")}`}catch{return e}}const Vx=e.forwardRef(({fields:n,values:r,onChange:o,onSubmit:i,formName:s,viewMode:a="form",readOnly:l=!1,formMode:c="editable",fieldPermissions:u,formEvents:d,showButtons:h=!0,searchUsersFn:p,searchOrgsFn:f,tableColumns:m=2,searchObjectFn:g,className:y,labelClassName:b,onUpdateField:v,compact:w=!1,showFormName:x=!0,currentUser:k,state:S="draft",submitDate:E,context:M,currentStep:C={},historyApproves:R=[],previewMode:N=!1,formColumns:_=2},A)=>{const[D,$]=t.message.useMessage(),L=e.useCallback(e=>{const t=Bx(e||"");return"__CURRENT_USER__"===t?k?.user||"":"__CURRENT_USER_ORG__"===t?k?.organization?._id||"":t},[k?.user,k?.organization?._id]),I=e.useMemo(()=>{const e=k?.organization;if(e?._id)return{id:e._id,name:e.name||"",fullname:e.fullname||""}},[k?.organization]),j=e.useMemo(()=>n.map(e=>{const t=e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:Fx(e.defaultValue)}:e;if(t.children?.length){const e=t.children.map(e=>e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:Fx(e.defaultValue)}:e);return{...t,children:e}}return t}),[n.map(e=>`${e.name}:${e.defaultValue??""}:${(e.children||[]).map(e=>`${e.name}:${e.defaultValue??""}`).join(",")}`).join("|")]),z=l||"readonly"===c||"print"===c,P=z?"print"===c?"print":"readonly":c,F=e.useMemo(()=>j.map(e=>{if(z)return{...e,readonly:!0};if(!u)return e;const t=u[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}),[j,u,z]);console.log("FormRenderer externalValues",r);const B=e.useMemo(()=>{const e={_id:"__applicant__system",name:"__applicant",label:"申请人",type:"member",required:!1,readonly:"draft"!==S,hidden:!1,pickerMultiple:!1,defaultValue:k?.user,valueFormat:"string"};return F.some(e=>"__applicant"===e.name)?F:[...F,e]},[F,k,S]),[H,V]=e.useState(()=>{const e={};for(const t of n){if(t.defaultValue){const n=Fx(t.defaultValue);"__CURRENT_USER__"===n?k?.user&&(e[t.name]=k.user):"__CURRENT_USER_ORG__"===n?k?.organization?._id&&(e[t.name]={id:k.organization._id,name:k.organization.name||"",fullname:k.organization.fullname||""}):e[t.name]=n}if(t.children?.length)for(const n of t.children)if(n.defaultValue){const t=Fx(n.defaultValue);"__CURRENT_USER__"===t?k?.user&&(e[n.name]=k.user):"__CURRENT_USER_ORG__"===t?k?.organization?._id&&(e[n.name]={id:k.organization._id,name:k.organization.name||"",fullname:k.organization.fullname||""}):e[n.name]=t}}return{...e,...r||{}}}),[U,q]=e.useState({}),W=e.useRef(H);e.useEffect(()=>{W.current=H},[H]),e.useEffect(()=>{V(e=>{const t={};for(const n of j){if(n.defaultValue&&null==e[n.name]){const e=n.defaultValue;"__CURRENT_USER__"===e?k?.user&&(t[n.name]=k.user):"__CURRENT_USER_ORG__"===e?I&&(t[n.name]=I):t[n.name]=e}if(n.children?.length)for(const r of n.children)if(r.defaultValue&&null==e[r.name]){const e=r.defaultValue;"__CURRENT_USER__"===e?k?.user&&(t[r.name]=k.user):"__CURRENT_USER_ORG__"===e?I&&(t[r.name]=I):t[r.name]=e}}return Object.keys(t).length>0?{...e,...t}:e})},[j,k?.user,I]);const Y=e.useRef("");e.useEffect(()=>{if(!r)return;const e=JSON.stringify(r);e!==Y.current&&(Y.current=e,V(e=>{const t={...e};let n=!1;for(const[o,i]of Object.entries(r)){const e=L(i);t[o]!==e&&(t[o]=e,n=!0)}return n?t:e}))},[r,L]);const J=e.useMemo(()=>{const e=String(C?.name??"");return{...H,stepName:e}},[H,C]),K=B.filter(e=>!e.hidden&&(!e.visibilityRules?.length||zx(e.visibilityRules,e.visibilityLogic,J))).map(e=>{let t=e;if(t.requiredRules?.length){const e=zx(t.requiredRules,t.requiredLogic,J);e!==t.required&&(t={...t,required:t.required||e})}if(["table","grid"].includes(t.type)&&t.children?.length){const n=t.children.filter(e=>!e.hidden&&(!e.visibilityRules?.length||zx(e.visibilityRules,e.visibilityLogic,J))).map(e=>{if(!e.requiredRules?.length)return e;const t=zx(e.requiredRules,e.requiredLogic,J);return t!==e.required?{...e,required:e.required||t}:e});t=t===e?{...e,children:n}:{...t,children:n}}return t}),G=function(e,t=2){const n=[];let r=[],o=0;for(const i of e)if(!i.hidden)if(Nx(i)||_x(i.type))r.length&&(n.push(r),r=[],o=0),n.push([i]);else{const e=Math.min(i.tableColspan||1,t);o+e>t&&(r.length&&(n.push(r),r=[]),o=0),r.push(i),o+=e,o>=t&&(n.push(r),r=[],o=0)}return r.length&&n.push(r),n}(K,"table"===a?m:_),Z=[...B.filter(e=>"formula"===e.type&&e.formula),...B.filter(e=>["grid","table"].includes(e.type)&&e.children).flatMap(e=>e.children.filter(e=>"formula"===e.type&&e.formula))];e.useEffect(()=>{let e=!1;const t={...H};for(const n of Z){const r=Mx(n.formula,H);t[n.name]!==r&&(t[n.name]=r,e=!0)}e&&(V(t),o?.(t))},[H,Z.map(e=>e.name+":"+e.formula).join(",")]);const Q=e.useRef(!1);e.useEffect(()=>{if(Q.current)return;if(!d?.onInit)return;Q.current=!0;const e=O(W.current,(e,t)=>{V(n=>{const r={...n,[e]:t};return o?.(r),r})},B,v,D,M,C);T(d.onInit,{form:e,fields:B,values:W.current}).catch(e=>{console.error("[FormRenderer] onInit error:",e)})},[d?.onInit]);const X=e.useMemo(()=>{const e=[];for(const t of K)"grid"===t.type&&t.children?.length?e.push(...t.children):e.push(t);return e},[K]);e.useImperativeHandle(A,()=>({getValues:()=>{const e={};return X.forEach(t=>{e[t.name]=H[t.name]??t.defaultValue??""}),e},validate:async()=>{const e=[],t={};if(X.forEach(n=>{const r=H[n.name]??n.defaultValue??"";if(n.required&&!n.readonly&&!r){const r=`${n.label} 不能为空`;e.push(r),t[n.name]=r}}),q(t),e.length>0){D.error({content:1===e.length?e[0]:`以下字段不能为空:${e.map(e=>e.replace(" 不能为空","")).join("、")}`,duration:3});const n=X.find(e=>t[e.name]);n&&setTimeout(()=>{const e=document.querySelector(`[data-field-name="${n.name}"]`);e?.scrollIntoView({behavior:"smooth",block:"center"})},0)}return{isValid:0===e.length,errors:e}}}),[H,X,q,D]);const ee=e.useCallback((e,t)=>{q(t=>{if(!t[e])return t;const n={...t};return delete n[e],n}),V(n=>{const r={...n,[e]:t};return o?.(r),r})},[o]),te=e.useCallback((e,t)=>{const n=W.current[e]||"";if(ee(e,t),d?.onValueChange){let r=B.find(t=>t.name===e);if(!r)for(const t of B)if(t.children){const n=t.children.find(t=>t.name===e);if(n){r=n;break}}const o={...W.current,[e]:t},i=O(o,ee,B,v,D,M,C);T(d.onValueChange,{field:r?{name:r.name,label:r.label,type:r.type}:{name:e},value:t,oldValue:n,form:i,values:o,fields:B}).catch(e=>{console.error("[FormRenderer] onValueChange error:",e)})}},[d?.onValueChange,B,ee,v,D,M,C]),ne=e.useCallback(e=>{q(t=>{const n=Object.keys(e);if(n.every(e=>!t[e]))return t;const r={...t};for(const e of n)delete r[e];return r}),V(t=>{const n={...t,...e};return o?.(n),n})},[o]),re=e.useCallback(async()=>{if(d?.onSubmit){const t=O(W.current,ee,B,v,D,M,C);try{if(!1===await T(d.onSubmit,{form:t,values:{...W.current},fields:B}))return}catch(e){return void console.error("[FormRenderer] onSubmit error:",e)}}i?.(W.current)},[d?.onSubmit,B,ee,v,D,M,C,i]);if(0===B.length)return React.createElement("div",{className:`h-full flex items-center justify-center ${y||""}`},$,React.createElement("p",{className:"text-[13px] text-gray-400"},"表单为空,请先添加字段"));if("table"===a){const e=K.filter(e=>"__applicant__system"!==e._id),t=K.find(e=>"__applicant__system"===e._id),n=t?U[t.name]:void 0;return React.createElement("div",{className:`p-6 max-w-4xl m-auto h-full overflow-y-auto custom-scrollbar ${"print"===P?"workflow-form-print":""} ${y||""}`},$,React.createElement("div",{className:"mx-auto"},x&&s&&React.createElement("div",{className:"mb-4 text-center"},React.createElement("h2",{className:"text-xl font-bold text-gray-800"},s)),React.createElement(Px,{fields:e,columns:m,formValues:H,updateValue:te,fieldErrors:U,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,labelClassName:b,onFillFields:ne,fieldPermissions:u,formMode:P,resolveValue:L,historyApproves:R,previewMode:N}),t&&React.createElement("div",{className:"flex items-center","data-field-name":t.name},React.createElement("div",{className:"flex items-center",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},t.label,t.required&&!t.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&_.field-input-wrapper]:!border-0 [&_.field-input-wrapper]:!shadow-none [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(bx,{field:t,value:L(H[t.name]??t.defaultValue??""),onChange:e=>te(t.name,e),hasError:!!n,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:N,minimal:!0})),n&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 ml-2 flex items-center gap-1"},React.createElement("span",null,"⚠"),n)),"draft"!==S&&E&&React.createElement("div",{className:"flex items-center justify-end ml-4",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Hx(E))))))}return React.createElement("div",{className:`h-full overflow-y-auto custom-scrollbar ${w?"bg-white":"bg-gray-50/50"} ${"print"===P?"workflow-form-print":""} ${y||""}`},$,React.createElement("div",{className:w?"px-3 py-3":"p-6 max-w-3xl mx-auto"},x&&s&&React.createElement("div",{className:w?"mb-3 text-center":"mb-6 text-center"},React.createElement("h2",{className:w?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800"},s)),React.createElement("div",{className:w?"":"bg-white rounded-xl border border-gray-200 shadow-sm p-6"},React.createElement("div",{className:w?"space-y-3":"grid gap-x-6 gap-y-5",style:w?void 0:{gridTemplateColumns:`repeat(${_}, minmax(0, 1fr))`}},G.map((e,t)=>{const n=e[0];if("section"===n.type){const e=jx(n);return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${_}`}},React.createElement("div",{className:"flex items-center gap-2 mb-1"},React.createElement("h3",{className:(w?"text-[13px]":"text-[15px]")+" font-semibold",style:{color:n.titleColor||e.title}},n.label)),n.description&&React.createElement("div",{className:"text-[12px] ml-6",style:{color:e.desc},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement("div",{className:w?"mt-1 mb-1":"mt-2 mb-1",style:{borderBottom:`2px solid ${e.border}`}}))}if("table"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?jx(n):null;return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${_}`}},!1!==n.showLabel&&React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement("label",{className:"text-[13px] font-medium",style:{color:e?.title||"#374151"}},n.label),n.required&&!n.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#9ca3af"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Rx,{field:n,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,value:H[n.name],onChange:e=>te(n.name,e),fieldPermissions:u}))}if("grid"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?jx(n):null;return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${_}`}},!1!==n.showLabel&&React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement("label",{className:"text-[13px] font-medium",style:{color:e?.title||"#374151"}},n.label)),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#9ca3af"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Tx,{field:n,formValues:H,onUpdateValue:te,onFillFields:ne,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,fieldPermissions:u,formMode:P,compact:w}))}return e.map(e=>{const t=Nx(e)||_x(e.type),n=!1!==e.showLabel&&"checkbox"!==e.type,r=U[e.name],o="__applicant__system"===e._id;return React.createElement("div",{key:e._id,"data-field-name":e.name,className:"",style:w?void 0:t?{gridColumn:`span ${_}`}:void 0},o&&w?React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"[&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(bx,{field:e,value:L(H[e.name]??e.defaultValue??""),onChange:t=>te(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:N,minimal:!0})),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),r),"draft"!==S&&E&&React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1 mt-3"},"提交日期"),React.createElement("span",{className:"block text-[13px] text-gray-800"},Hx(E)))):o?React.createElement("div",{className:"flex items-center gap-2",style:{gridColumn:`span ${_}`}},React.createElement("div",{className:"flex items-center flex-1 min-w-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(bx,{field:e,value:L(H[e.name]??e.defaultValue??""),onChange:t=>te(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:N,minimal:!0}))),"draft"!==S&&E&&React.createElement("div",{className:"flex items-center shrink-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Hx(E))),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 flex items-center gap-1 w-full"},React.createElement("span",null,"⚠"),r)):React.createElement(React.Fragment,null,n&&React.createElement("label",{className:`block text-[13px] font-medium ${r?"text-red-600":"text-gray-700"} ${w?"mb-1":"mb-1.5"}`},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),n&&e.description&&React.createElement("p",{className:"text-[11px] text-gray-400 "+(w?"mb-1":"mb-1.5")},e.description),React.createElement(bx,{field:e,value:L(H[e.name]??e.defaultValue??""),onChange:t=>te(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:N}),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),r)))})})),h&&"editable"===P&&React.createElement("div",{className:(w?"mt-4 pt-3":"mt-8 pt-5")+" border-t border-gray-100 flex justify-end gap-3"},React.createElement("button",{className:`rounded-md border border-gray-300 bg-white ${w?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition`},"取消"),React.createElement("button",{onClick:re,className:`rounded-md bg-indigo-600 ${w?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-white hover:bg-indigo-700 smooth-transition`},"提交")))))}),Ux={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:(e,t)=>"W"===t?e+"周":e+"日",weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:(e,t)=>{const n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};function qx(e,t){const n={...e};for(const r of t)if("table"===r.type){const e=n[r.name];if("string"==typeof e)if(""===e)n[r.name]=[];else try{const t=JSON.parse(e);n[r.name]=Array.isArray(t)?t:[]}catch{n[r.name]=[]}else Array.isArray(e)||(n[r.name]=[])}return n}!function(){const e=window.dayjs;e&&"function"==typeof e.extend&&(e.extend(p),e.extend(g),e.extend(v),e.locale(Ux,null,!0),e.locale("zh-cn")),u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn")}(),function(){if("undefined"==typeof amisRequire)return void console.error("[workflow-form-v2] amisRequire is not defined. Make sure the amis SDK is loaded first.");const e=amisRequire("react"),t=amisRequire("amis");t?.Renderer?(t.Renderer({type:"workflow-form-v2",autoVar:!0})(function(n){const{$schema:r,data:o,dispatchEvent:i,currentUser:s,state:a,submit_date:l,currentStep:c}=n,u=t.ScopedContext,d=e.useContext(u),h=e.useRef(null),p={getValues:()=>qx(h.current?.getValues()||y,m),validate:async()=>{const e=await(h.current?h.current.validate():Promise.resolve({isValid:!0,errors:[]}));return console.log("[workflow-form-v2] validate result",e),e.isValid}},f=e.useRef(null);null===f.current?f.current={...p}:Object.assign(f.current,p),Object.defineProperty(f.current,"props",{get:()=>n,configurable:!0}),e.useEffect(()=>{if(d&&(r.id||n.id))return d.registerComponent(f.current),()=>{d.unRegisterComponent(f.current)}},[r.id||n.id]);let m=[];Array.isArray(r.fields)?m=r.fields:"string"==typeof r.fields&&o&&(m=o[r.fields.replace(/^\$\{|\}$/g,"")]||[]),!m.length&&Array.isArray(o?.fields)&&(m=o.fields);let g={};r.values&&"object"==typeof r.values?g=r.values:"string"==typeof r.values&&o&&(g=o[r.values.replace(/^\$\{|\}$/g,"")]||{}),!Object.keys(g).length&&o?.values&&"object"==typeof o.values&&(g=o.values);const y=e.useMemo(()=>function(e){const t={};for(const[n,r]of Object.entries(e))Array.isArray(r)?r.length>0&&"object"==typeof r[0]&&r[0]?.id?t[n]=r:t[n]=JSON.stringify(r):"object"==typeof r&&null!==r&&r.id?t[n]=r:t[n]=null==r?"":String(r);return t}(g),[JSON.stringify(g)]),[b,v]=e.useState(!1);e.useEffect(()=>{const e=()=>{v(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const w=b?"form":r.viewMode||"form",x=b?1:r.tableColumns||2,k=r.layout??r.formColumns,S=b||"single"===k?1:"double"===k?2:Math.min(Math.max(Number(k)||2,1),3),E=r.readOnly??r.static??!1,M=r.formMode||"editable",R=r.formName||o?.formName||"",O=r.showButtons??!0,T=!!b||(r.compact??!1),N=r.showFormName??!0,_=r.formEvents;let A,D=[];Array.isArray(r.historyApproves)?D=r.historyApproves:"string"==typeof r.historyApproves&&o&&(D=o[r.historyApproves.replace(/^\$\{|\}$/g,"")]||[]),Array.isArray(D)&&0!==D.length||!Array.isArray(o?.historyApproves)||(D=o.historyApproves),"editable"===M&&(r.fieldPermissions&&"object"==typeof r.fieldPermissions?A=r.fieldPermissions:"string"==typeof r.fieldPermissions&&o&&(A=o[r.fieldPermissions.replace(/^\$\{|\}$/g,"")]),!A&&o?.fieldPermissions&&(A=o.fieldPermissions));const $=r.apiBaseUrl||o?.context?.rootUrl||o?.rootUrl||"",L=r.authToken||o?.context?.authToken||o?.authToken||"",I=r.spaceId||o?.context?.spaceId||o?.spaceId||"",j=e.useCallback(async e=>{if(!$)return[];try{const t=`${$}/api/v6/space_users?$top=20&$select=name,user,mobile&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${I},${L}`}}),r=await n.json();return(r?.value||r?.data||r||[]).map(e=>({_id:e.user||e._id,label:e.name||e.label||"",description:e.mobile||""}))}catch(t){return console.warn("[workflow-form-v2] searchUsers error:",t),[]}},[$,L,I]),z=e.useCallback(async e=>{if(!$)return[];try{const t=`${$}/api/v6/organizations?$top=20&$select=name,fullname&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${I},${L}`}}),r=await n.json();return(r?.value||r?.data||r||[]).map(e=>({_id:e._id,label:e.name||e.label||"",description:e.fullname||""}))}catch(t){return console.warn("[workflow-form-v2] searchOrgs error:",t),[]}},[$,L,I]),P=e.useCallback((e,t)=>async n=>{if(!$||!e)return[];try{const r=n?`&$filter=contains(${encodeURIComponent(t)},'${encodeURIComponent(n)}')`:"",o=`${$}/api/v6/${encodeURIComponent(e)}?$top=20&$select=_id,${encodeURIComponent(t)}${r}`,i=await fetch(o,{headers:{Authorization:`Bearer ${I},${L}`}}),s=await i.json();return(s?.value||s?.data||s||[]).map(e=>({_id:e._id,label:e[t]||e.name||e._id,description:""}))}catch(r){return console.warn("[workflow-form-v2] searchObject error:",r),[]}},[$,L,I]),F={props:n,getValues:p.getValues,validate:p.validate};return e.createElement(Vx,{fields:m,values:y,ref:h,onChange:e=>{const t=qx(e,m);i?.("change",t?C(o,{value:t}):o,F)},onSubmit:e=>{const t=qx(e,m);i?.("submit",t?C(o,{value:t}):o,F)},formName:R,viewMode:w,tableColumns:x,formColumns:S,readOnly:E,formMode:M,fieldPermissions:A,formEvents:_,showButtons:O,compact:T,showFormName:N,searchUsersFn:j,searchOrgsFn:z,searchObjectFn:P,currentUser:s,state:a,submitDate:l,currentStep:c||r.currentStep||{},historyApproves:Array.isArray(D)?D:[],className:["workflow-form-v2",n.className].filter(Boolean).join(" ")})}),console.log("[workflow-form-v2] amis Renderer registered successfully.")):console.error("[workflow-form-v2] amis.Renderer not found.")}()}(amisRequire("react"),antd,amisRequire("react-dom"));
|
|
1
|
+
!function(e,t,n){"use strict";function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const o=r(e);var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,l={exports:{}};function c(){return a||(a=1,l.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",s="hour",a="day",l="week",c="month",u="quarter",d="year",h="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},y=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:y,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+y(r,2,"0")+":"+y(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,s=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-s:s-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:a,D:h,h:s,m:i,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},v="en",w={};w[v]=g;var x="$isDayjsObject",k=function(e){return e instanceof M||!(!e||!e[x])},S=function e(t,n,r){var o;if(!t)return v;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var s=t.split("-");if(!o&&s.length>1)return e(s[0])}else{var a=t.name;w[a]=t,o=a}return!r&&o&&(v=o),o||!r&&v},E=function(e,t){if(k(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new M(n)},C=b;C.l=S,C.i=k,C.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var M=function(){function g(e){this.$L=S(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var y=g.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(C.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(f);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return C},y.isValid=function(){return!(this.$d.toString()===p)},y.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},y.isAfter=function(e,t){return E(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<E(e)},y.$g=function(e,t,n){return C.u(e)?this[t]:this.set(n,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var n=this,r=!!C.u(t)||t,u=C.p(e),p=function(e,t){var o=C.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(a)},f=function(e,t){return C.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,g=this.$M,y=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case d:return r?p(1,0):p(31,11);case c:return r?p(1,g):p(0,g+1);case l:var v=this.$locale().weekStart||0,w=(m<v?m+7:m)-v;return p(r?y-w:y+(6-w),g);case a:case h:return f(b+"Hours",0);case s:return f(b+"Minutes",1);case i:return f(b+"Seconds",2);case o:return f(b+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var n,l=C.p(e),u="set"+(this.$u?"UTC":""),p=(n={},n[a]=u+"Date",n[h]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[s]=u+"Hours",n[i]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],f=l===a?this.$D+(t-this.$W):t;if(l===c||l===d){var m=this.clone().set(h,1);m.$d[p](f),m.init(),this.$d=m.set(h,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[C.p(e)]()},y.add=function(r,u){var h,p=this;r=Number(r);var f=C.p(u),m=function(e){var t=E(p);return C.w(t.date(t.date()+Math.round(e*r)),p)};if(f===c)return this.set(c,this.$M+r);if(f===d)return this.set(d,this.$y+r);if(f===a)return m(1);if(f===l)return m(7);var g=(h={},h[i]=t,h[s]=n,h[o]=e,h)[f]||1,y=this.$d.getTime()+r*g;return C.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=C.z(this),i=this.$H,s=this.$m,a=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},h=function(e){return C.s(i%12||12,e,"0")},f=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return C.s(t.$y,4,"0");case"M":return a+1;case"MM":return C.s(a+1,2,"0");case"MMM":return d(n.monthsShort,a,c,3);case"MMMM":return d(c,a);case"D":return t.$D;case"DD":return C.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(i);case"HH":return C.s(i,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return f(i,s,!0);case"A":return f(i,s,!1);case"m":return String(s);case"mm":return C.s(s,2,"0");case"s":return String(t.$s);case"ss":return C.s(t.$s,2,"0");case"SSS":return C.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,h,p){var f,m=this,g=C.p(h),y=E(r),b=(y.utcOffset()-this.utcOffset())*t,v=this-y,w=function(){return C.m(m,y)};switch(g){case d:f=w()/12;break;case c:f=w();break;case u:f=w()/3;break;case l:f=(v-b)/6048e5;break;case a:f=(v-b)/864e5;break;case s:f=v/n;break;case i:f=v/t;break;case o:f=v/e;break;default:f=v}return p?f:C.a(f)},y.daysInMonth=function(){return this.endOf(c).$D},y.$locale=function(){return w[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=S(e,t,!0);return r&&(n.$L=r),n},y.clone=function(){return C.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},g}(),R=M.prototype;return E.prototype=R,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",d],["$D",h]].forEach(function(e){R[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,M,E),e.$i=!0),E},E.locale=S,E.isDayjs=k,E.unix=function(e){return E(1e3*e)},E.en=w[v],E.Ls=w,E.p={},E}()),l.exports}const u=s(c());var d,h={exports:{}};const p=s((d||(d=1,h.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}}),h.exports));var f,m={exports:{}};const g=s((f||(f=1,m.exports=function(e,t,n){var r=t.prototype,o=function(e){return e&&(e.indexOf?e:e.s)},i=function(e,t,n,r,i){var s=e.name?e:e.$locale(),a=o(s[t]),l=o(s[n]),c=a||l.map(function(e){return e.slice(0,r)});if(!i)return c;var u=s.weekStart;return c.map(function(e,t){return c[(t+(u||0))%7]})},s=function(){return n.Ls[n.locale()]},a=function(e,t){return e.formats[t]||e.formats[t.toUpperCase()].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})},l=function(){var e=this;return{months:function(t){return t?t.format("MMMM"):i(e,"months")},monthsShort:function(t){return t?t.format("MMM"):i(e,"monthsShort","months",3)},firstDayOfWeek:function(){return e.$locale().weekStart||0},weekdays:function(t){return t?t.format("dddd"):i(e,"weekdays")},weekdaysMin:function(t){return t?t.format("dd"):i(e,"weekdaysMin","weekdays",2)},weekdaysShort:function(t){return t?t.format("ddd"):i(e,"weekdaysShort","weekdays",3)},longDateFormat:function(t){return a(e.$locale(),t)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return l.bind(this)()},n.localeData=function(){var e=s();return{firstDayOfWeek:function(){return e.weekStart||0},weekdays:function(){return n.weekdays()},weekdaysShort:function(){return n.weekdaysShort()},weekdaysMin:function(){return n.weekdaysMin()},months:function(){return n.months()},monthsShort:function(){return n.monthsShort()},longDateFormat:function(t){return a(e,t)},meridiem:e.meridiem,ordinal:e.ordinal}},n.months=function(){return i(s(),"months")},n.monthsShort=function(){return i(s(),"monthsShort","months",3)},n.weekdays=function(e){return i(s(),"weekdays",null,null,e)},n.weekdaysShort=function(e){return i(s(),"weekdaysShort","weekdays",3,e)},n.weekdaysMin=function(e){return i(s(),"weekdaysMin","weekdays",2,e)}}),m.exports));var y,b={exports:{}};const v=s((y||(y=1,b.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return(e=+e)+(e>68?1900:2e3)},l=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var o=1;o<=24;o+=1)if(e.indexOf(r(o,0,t))>-1){n=o>12;break}}else n=e===(t?"pm":"PM");return n},h={A:[i,function(e){this.afternoon=d(e,!1)}],a:[i,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[o,l("seconds")],ss:[o,l("seconds")],m:[o,l("minutes")],mm:[o,l("minutes")],H:[o,l("hours")],h:[o,l("hours")],HH:[o,l("hours")],hh:[o,l("hours")],D:[o,l("day")],DD:[r,l("day")],Do:[i,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[o,l("week")],ww:[r,l("week")],M:[o,l("month")],MM:[r,l("month")],MMM:[i,function(e){var t=u("months"),n=(u("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,l("year")],YY:[r,function(e){this.year=a(e)}],YYYY:[/\d{4}/,l("year")],Z:c,ZZ:c};function p(n){var r,o;r=n,o=s&&s.formats;for(var i=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})).match(t),a=i.length,l=0;l<a;l+=1){var c=i[l],u=h[c],d=u&&u[0],p=u&&u[1];i[l]=p?{regex:d,parser:p}:c.replace(/^\[|\]$/g,"")}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var o=i[n];if("string"==typeof o)r+=o.length;else{var s=o.regex,l=o.parser,c=e.slice(r),u=s.exec(c)[0];l.call(t,u),e=e.replace(u,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,o=r.parse;r.parse=function(e){var t=e.date,r=e.utc,i=e.args;this.$u=r;var a=i[1];if("string"==typeof a){var l=!0===i[2],c=!0===i[3],u=l||c,d=i[2];c&&(d=i[2]),s=this.$locale(),!l&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var o=p(t)(e),i=o.year,s=o.month,a=o.day,l=o.hours,c=o.minutes,u=o.seconds,d=o.milliseconds,h=o.zone,f=o.week,m=new Date,g=a||(i||s?1:m.getDate()),y=i||m.getFullYear(),b=0;i&&!s||(b=s>0?s-1:m.getMonth());var v,w=l||0,x=c||0,k=u||0,S=d||0;return h?new Date(Date.UTC(y,b,g,w,x,k,S+60*h.offset*1e3)):n?new Date(Date.UTC(y,b,g,w,x,k,S)):(v=new Date(y,b,g,w,x,k,S),f&&(v=r(v).week(f).toDate()),v)}catch(E){return new Date("")}}(t,a,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={}}else if(a instanceof Array)for(var h=a.length,f=1;f<=h;f+=1){i[1]=a[f-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}f===h&&(this.$d=new Date(""))}else o.call(this,e)}}}()),b.exports));var w,x={exports:{}};w||(w=1,x.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,t){return"W"===t?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,t){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};return n.default.locale(r,null,!0),r}(c()));var k,S,E,C={exports:{}};function M(e,t,n){e&&Object.isFrozen(e)&&(e=function(e,t=!0){const n=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return t&&e&&Object.keys(e).forEach(t=>n[t]=e[t]),n}(e));const r=e?Object.create(e,{...n,__super:{value:e,writable:!1,enumerable:!1}}):Object.create(Object.prototype,n);return t&&function(e){const t=typeof e;return e&&"string"!==t&&"number"!==t&&"boolean"!==t&&"function"!==t&&!Array.isArray(e)}(t)&&Object.keys(t).forEach(e=>r[e]=t[e]),r}function R(e){if(Array.isArray(e))return e;if("string"==typeof e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}return[]}function N(e,t,n,r,o,i,s){const a=e=>{for(const t of n){if(t.name===e)return t;if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n}}};return{getFieldValue(t){const n=a(t),r=e[t];return"table"===n?.type?R(r):r??""},setFieldValue(e,n){t(e,n&&"object"==typeof n?n:null==n?"":String(n))},setFieldVisible(e,t){const n=a(e);n&&r&&r(n._id,{hidden:!t})},setFieldHidden(e,t){const n=a(e);n&&r&&r(n._id,{hidden:t})},setFieldRequired(e,t){const n=a(e);n&&r&&r(n._id,{required:t})},setFieldReadonly(e,t){const n=a(e);n&&r&&r(n._id,{readonly:t})},getFieldOptions(e){const t=a(e);return t?.options||[]},setFieldOptions(e,t){const n=a(e);n&&r&&r(n._id,{options:t})},getTableRows:t=>R(e[t]),setTableRows(e,n){t(e,JSON.stringify(Array.isArray(n)?n:[]))},addTableRow(n,r={}){const o=R(e[n]);o.push(r),t(n,JSON.stringify(o))},removeTableRow(n,r){const o=R(e[n]);r>=0&&r<o.length&&(o.splice(r,1),t(n,JSON.stringify(o)))},message:{success:e=>o?.success(e),error:e=>o?.error(e),warning:e=>o?.warning(e),info:e=>o?.info(e),loading:e=>o?.loading(e)},context:i||{},currentStep:s||{}}}async function O(e,t){if(!e||!e.trim())return;let n;if(t.values&&t.form){if(n={...t.values},t.fields)n=function(e,t){const n={...e};for(const r of t)"table"===r.type&&(n[r.name]=R(n[r.name]));return n}(t.values,t.fields);else for(const[i,s]of Object.entries(n))if("string"==typeof s&&s.startsWith("["))try{const e=JSON.parse(s);Array.isArray(e)&&(n[i]=e)}catch{}}else n=t.values;let r=t.value;"table"===t.field?.type&&"string"==typeof t.value&&(r=R(t.value));try{const o=new Function("form","field","value","oldValue","values","fields","fetch","currentStep",`return (async () => { ${e} })();`);return await o(t.form,t.field,r,t.oldValue,n,t.fields,fetch.bind(window),t.form?.currentStep)}catch(o){throw console.error("[fieldDataService] executeFormEvent error:",o),o}}function T(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=T(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}k||(k=1,S=C,E=C.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",o=32,s=128,a=256,l=1/0,c=9007199254740991,u=NaN,d=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",a]],p="[object Arguments]",f="[object Array]",m="[object Boolean]",g="[object Date]",y="[object Error]",b="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",k="[object Object]",C="[object Promise]",M="[object RegExp]",R="[object Set]",N="[object String]",O="[object Symbol]",T="[object WeakMap]",_="[object ArrayBuffer]",A="[object DataView]",D="[object Float32Array]",$="[object Float64Array]",L="[object Int8Array]",I="[object Int16Array]",j="[object Int32Array]",z="[object Uint8Array]",P="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",H=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,Y=RegExp(q.source),J=RegExp(W.source),K=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,oe=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,we=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",ke="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",Ce="A-Z\\xc0-\\xd6\\xd8-\\xde",Me="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ne="['’]",Oe="["+xe+"]",Te="["+Re+"]",_e="["+ke+"]",Ae="\\d+",De="["+Se+"]",$e="["+Ee+"]",Le="[^"+xe+Re+Ae+Se+Ee+Ce+"]",Ie="\\ud83c[\\udffb-\\udfff]",je="[^"+xe+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Ce+"]",Be="\\u200d",He="(?:"+$e+"|"+Le+")",Ve="(?:"+Fe+"|"+Le+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+_e+"|"+Ie+")?",Ye="["+Me+"]?",Je=Ye+We+"(?:"+Be+"(?:"+[je,ze,Pe].join("|")+")"+Ye+We+")*",Ke="(?:"+[De,ze,Pe].join("|")+")"+Je,Ge="(?:"+[je+_e+"?",_e,ze,Pe,Oe].join("|")+")",Ze=RegExp(Ne,"g"),Qe=RegExp(_e,"g"),Xe=RegExp(Ie+"(?="+Ie+")|"+Ge+Je,"g"),et=RegExp([Fe+"?"+$e+"+"+Ue+"(?="+[Te,Fe,"$"].join("|")+")",Ve+"+"+qe+"(?="+[Te,Fe+He,"$"].join("|")+")",Fe+"?"+He+"+"+Ue,Fe+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ae,Ke].join("|"),"g"),tt=RegExp("["+Be+xe+ke+Me+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,it={};it[D]=it[$]=it[L]=it[I]=it[j]=it[z]=it[P]=it[F]=it[B]=!0,it[p]=it[f]=it[_]=it[m]=it[A]=it[g]=it[y]=it[b]=it[w]=it[x]=it[k]=it[M]=it[R]=it[N]=it[T]=!1;var st={};st[p]=st[f]=st[_]=st[A]=st[m]=st[g]=st[D]=st[$]=st[L]=st[I]=st[j]=st[w]=st[x]=st[k]=st[M]=st[R]=st[N]=st[O]=st[z]=st[P]=st[F]=st[B]=!0,st[y]=st[b]=st[T]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ct=parseInt,ut="object"==typeof i&&i&&i.Object===Object&&i,dt="object"==typeof self&&self&&self.Object===Object&&self,ht=ut||dt||Function("return this")(),pt=E&&!E.nodeType&&E,ft=pt&&S&&!S.nodeType&&S,mt=ft&&ft.exports===pt,gt=mt&&ut.process,yt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||gt&>.binding&>.binding("util")}catch(t){}}(),bt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,wt=yt&&yt.isMap,xt=yt&&yt.isRegExp,kt=yt&&yt.isSet,St=yt&&yt.isTypedArray;function Et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Ct(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}function Mt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Nt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Ot(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}function Tt(e,t){return!(null==e||!e.length)&&Ft(e,t,0)>-1}function _t(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function At(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function Dt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function $t(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Lt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function It(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var jt=Ut("length");function zt(e,t,n){var r;return n(e,function(e,n,o){if(t(e,n,o))return r=n,!1}),r}function Pt(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function Ft(e,t,n){return t==t?function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):Pt(e,Ht,n)}function Bt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Ht(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?Yt(e,t)/n:u}function Ut(t){return function(n){return null==n?e:n[t]}}function qt(t){return function(n){return null==t?e:t[n]}}function Wt(e,t,n,r,o){return o(e,function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)}),n}function Yt(t,n){for(var r,o=-1,i=t.length;++o<i;){var s=n(t[o]);s!==e&&(r=r===e?s:r+s)}return r}function Jt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Kt(e){return e?e.slice(0,hn(e)+1).replace(re,""):e}function Gt(e){return function(t){return e(t)}}function Zt(e,t){return At(t,function(t){return e[t]})}function Qt(e,t){return e.has(t)}function Xt(e,t){for(var n=-1,r=e.length;++n<r&&Ft(t,e[n],0)>-1;);return n}function en(e,t){for(var n=e.length;n--&&Ft(t,e[n],0)>-1;);return n}var tn=qt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=qt({"&":"&","<":"<",">":">",'"':""","'":"'"});function rn(e){return"\\"+at[e]}function on(e){return tt.test(e)}function sn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function an(e,t){return function(n){return e(t(n))}}function ln(e,t){for(var n=-1,o=e.length,i=0,s=[];++n<o;){var a=e[n];a!==t&&a!==r||(e[n]=r,s[i++]=n)}return s}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function un(e){return on(e)?function(e){for(var t=Xe.lastIndex=0;Xe.test(e);)++t;return t}(e):jt(e)}function dn(e){return on(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function hn(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var pn=qt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),fn=function i(S){var E,oe=(S=null==S?ht:fn.defaults(ht.Object(),S,fn.pick(ht,rt))).Array,xe=S.Date,ke=S.Error,Se=S.Function,Ee=S.Math,Ce=S.Object,Me=S.RegExp,Re=S.String,Ne=S.TypeError,Oe=oe.prototype,Te=Se.prototype,_e=Ce.prototype,Ae=S["__core-js_shared__"],De=Te.toString,$e=_e.hasOwnProperty,Le=0,Ie=(E=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",je=_e.toString,ze=De.call(Ce),Pe=ht._,Fe=Me("^"+De.call($e).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=mt?S.Buffer:e,He=S.Symbol,Ve=S.Uint8Array,Ue=Be?Be.allocUnsafe:e,qe=an(Ce.getPrototypeOf,Ce),We=Ce.create,Ye=_e.propertyIsEnumerable,Je=Oe.splice,Ke=He?He.isConcatSpreadable:e,Ge=He?He.iterator:e,Xe=He?He.toStringTag:e,tt=function(){try{var e=ui(Ce,"defineProperty");return e({},"",{}),e}catch(t){}}(),at=S.clearTimeout!==ht.clearTimeout&&S.clearTimeout,ut=xe&&xe.now!==ht.Date.now&&xe.now,dt=S.setTimeout!==ht.setTimeout&&S.setTimeout,pt=Ee.ceil,ft=Ee.floor,gt=Ce.getOwnPropertySymbols,yt=Be?Be.isBuffer:e,jt=S.isFinite,qt=Oe.join,mn=an(Ce.keys,Ce),gn=Ee.max,yn=Ee.min,bn=xe.now,vn=S.parseInt,wn=Ee.random,xn=Oe.reverse,kn=ui(S,"DataView"),Sn=ui(S,"Map"),En=ui(S,"Promise"),Cn=ui(S,"Set"),Mn=ui(S,"WeakMap"),Rn=ui(Ce,"create"),Nn=Mn&&new Mn,On={},Tn=Pi(kn),_n=Pi(Sn),An=Pi(En),Dn=Pi(Cn),$n=Pi(Mn),Ln=He?He.prototype:e,In=Ln?Ln.valueOf:e,jn=Ln?Ln.toString:e;function zn(e){if(na(e)&&!qs(e)&&!(e instanceof Hn)){if(e instanceof Bn)return e;if($e.call(e,"__wrapped__"))return Fi(e)}return new Bn(e)}var Pn=function(){function t(){}return function(n){if(!ta(n))return{};if(We)return We(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function Fn(){}function Bn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Un(e);this.size=t.size}function Jn(e,t){var n=qs(e),r=!n&&Us(e),o=!n&&!r&&Ks(e),i=!n&&!r&&!o&&ua(e),s=n||r||o||i,a=s?Jt(e.length,Re):[],l=a.length;for(var c in e)!t&&!$e.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yi(c,l))||a.push(c);return a}function Kn(t){var n=t.length;return n?t[Wr(0,n-1)]:e}function Gn(e,t){return Di(No(e),ir(t,0,e.length))}function Zn(e){return Di(No(e))}function Qn(t,n,r){(r!==e&&!Bs(t[n],r)||r===e&&!(n in t))&&rr(t,n,r)}function Xn(t,n,r){var o=t[n];$e.call(t,n)&&Bs(o,r)&&(r!==e||n in t)||rr(t,n,r)}function er(e,t){for(var n=e.length;n--;)if(Bs(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,function(e,o,i){t(r,e,n(e),i)}),r}function nr(e,t){return e&&Oo(t,Aa(t),e)}function rr(e,t,n){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(t,n){for(var r=-1,o=n.length,i=oe(o),s=null==t;++r<o;)i[r]=s?e:Ra(t,n[r]);return i}function ir(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function sr(t,n,r,o,i,s){var a,l=1&n,c=2&n,u=4&n;if(r&&(a=i?r(t,o,i,s):r(t)),a!==e)return a;if(!ta(t))return t;var d=qs(t);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!l)return No(t,a)}else{var h=pi(t),f=h==b||h==v;if(Ks(t))return ko(t,l);if(h==k||h==p||f&&!i){if(a=c||f?{}:mi(t),!l)return c?function(e,t){return Oo(e,hi(e),t)}(t,function(e,t){return e&&Oo(t,Da(t),e)}(a,t)):function(e,t){return Oo(e,di(e),t)}(t,nr(a,t))}else{if(!st[h])return i?t:{};a=function(e,t,n){var r,o=e.constructor;switch(t){case _:return So(e);case m:case g:return new o(+e);case A:return function(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case D:case $:case L:case I:case j:case z:case P:case F:case B:return Eo(e,n);case w:return new o;case x:case N:return new o(e);case M:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new o;case O:return r=e,In?Ce(In.call(r)):{}}}(t,h,l)}}s||(s=new Yn);var y=s.get(t);if(y)return y;s.set(t,a),aa(t)?t.forEach(function(e){a.add(sr(e,n,r,e,t,s))}):ra(t)&&t.forEach(function(e,o){a.set(o,sr(e,n,r,o,t,s))});var S=d?e:(u?c?ri:ni:c?Da:Aa)(t);return Mt(S||t,function(e,o){S&&(e=t[o=e]),Xn(a,o,sr(e,n,r,o,t,s))}),a}function ar(t,n,r){var o=r.length;if(null==t)return!o;for(t=Ce(t);o--;){var i=r[o],s=n[i],a=t[i];if(a===e&&!(i in t)||!s(a))return!1}return!0}function lr(n,r,o){if("function"!=typeof n)throw new Ne(t);return Oi(function(){n.apply(e,o)},r)}function cr(e,t,n,r){var o=-1,i=Tt,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=At(t,Gt(n))),r?(i=_t,s=!1):t.length>=200&&(i=Qt,s=!1,t=new Wn(t));e:for(;++o<a;){var u=e[o],d=null==n?u:n(u);if(u=r||0!==u?u:0,s&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else i(t,d,r)||l.push(u)}return l}zn.templateSettings={escape:K,evaluate:G,interpolate:Z,variable:"",imports:{_:zn}},zn.prototype=Fn.prototype,zn.prototype.constructor=zn,Bn.prototype=Pn(Fn.prototype),Bn.prototype.constructor=Bn,Hn.prototype=Pn(Fn.prototype),Hn.prototype.constructor=Hn,Vn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Vn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Vn.prototype.get=function(t){var r=this.__data__;if(Rn){var o=r[t];return o===n?e:o}return $e.call(r,t)?r[t]:e},Vn.prototype.has=function(t){var n=this.__data__;return Rn?n[t]!==e:$e.call(n,t)},Vn.prototype.set=function(t,r){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=Rn&&r===e?n:r,this},Un.prototype.clear=function(){this.__data__=[],this.size=0},Un.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,0))},Un.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},Un.prototype.has=function(e){return er(this.__data__,e)>-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Vn,map:new(Sn||Un),string:new Vn}},qn.prototype.delete=function(e){var t=li(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return li(this,e).get(e)},qn.prototype.has=function(e){return li(this,e).has(e)},qn.prototype.set=function(e,t){var n=li(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,n),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Un,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ao(br),dr=Ao(vr,!0);function hr(e,t){var n=!0;return ur(e,function(e,r,o){return n=!!t(e,r,o)}),n}function pr(t,n,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=n(s);if(null!=a&&(l===e?a==a&&!ca(a):r(a,l)))var l=a,c=s}return c}function fr(e,t){var n=[];return ur(e,function(e,r,o){t(e,r,o)&&n.push(e)}),n}function mr(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=gi),o||(o=[]);++i<s;){var a=e[i];t>0&&n(a)?t>1?mr(a,t-1,n,r,o):Dt(o,a):r||(o[o.length]=a)}return o}var gr=Do(),yr=Do(!0);function br(e,t){return e&&gr(e,t,Aa)}function vr(e,t){return e&&yr(e,t,Aa)}function wr(e,t){return Ot(t,function(t){return Qs(e[t])})}function xr(t,n){for(var r=0,o=(n=bo(n,t)).length;null!=t&&r<o;)t=t[zi(n[r++])];return r&&r==o?t:e}function kr(e,t,n){var r=t(e);return qs(e)?r:Dt(r,n(e))}function Sr(t){return null==t?t===e?"[object Undefined]":"[object Null]":Xe&&Xe in Ce(t)?function(t){var n=$e.call(t,Xe),r=t[Xe];try{t[Xe]=e;var o=!0}catch(s){}var i=je.call(t);return o&&(n?t[Xe]=r:delete t[Xe]),i}(t):function(e){return je.call(e)}(t)}function Er(e,t){return e>t}function Cr(e,t){return null!=e&&$e.call(e,t)}function Mr(e,t){return null!=e&&t in Ce(e)}function Rr(t,n,r){for(var o=r?_t:Tt,i=t[0].length,s=t.length,a=s,l=oe(s),c=1/0,u=[];a--;){var d=t[a];a&&n&&(d=At(d,Gt(n))),c=yn(d.length,c),l[a]=!r&&(n||i>=120&&d.length>=120)?new Wn(a&&d):e}d=t[0];var h=-1,p=l[0];e:for(;++h<i&&u.length<c;){var f=d[h],m=n?n(f):f;if(f=r||0!==f?f:0,!(p?Qt(p,m):o(u,m,r))){for(a=s;--a;){var g=l[a];if(!(g?Qt(g,m):o(t[a],m,r)))continue e}p&&p.push(m),u.push(f)}}return u}function Nr(t,n,r){var o=null==(t=Mi(t,n=bo(n,t)))?t:t[zi(Zi(n))];return null==o?e:Et(o,t,r)}function Or(e){return na(e)&&Sr(e)==p}function Tr(t,n,r,o,i){return t===n||(null==t||null==n||!na(t)&&!na(n)?t!=t&&n!=n:function(t,n,r,o,i,s){var a=qs(t),l=qs(n),c=a?f:pi(t),u=l?f:pi(n),d=(c=c==p?k:c)==k,h=(u=u==p?k:u)==k,b=c==u;if(b&&Ks(t)){if(!Ks(n))return!1;a=!0,d=!1}if(b&&!d)return s||(s=new Yn),a||ua(t)?ei(t,n,r,o,i,s):function(e,t,n,r,o,i,s){switch(n){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case m:case g:case x:return Bs(+e,+t);case y:return e.name==t.name&&e.message==t.message;case M:case N:return e==t+"";case w:var a=sn;case R:var l=1&r;if(a||(a=cn),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=2,s.set(e,t);var u=ei(a(e),a(t),r,o,i,s);return s.delete(e),u;case O:if(In)return In.call(e)==In.call(t)}return!1}(t,n,c,r,o,i,s);if(!(1&r)){var v=d&&$e.call(t,"__wrapped__"),S=h&&$e.call(n,"__wrapped__");if(v||S){var E=v?t.value():t,C=S?n.value():n;return s||(s=new Yn),i(E,C,r,o,s)}}return!!b&&(s||(s=new Yn),function(t,n,r,o,i,s){var a=1&r,l=ni(t),c=l.length,u=ni(n),d=u.length;if(c!=d&&!a)return!1;for(var h=c;h--;){var p=l[h];if(!(a?p in n:$e.call(n,p)))return!1}var f=s.get(t),m=s.get(n);if(f&&m)return f==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var y=a;++h<c;){var b=t[p=l[h]],v=n[p];if(o)var w=a?o(v,b,p,n,t,s):o(b,v,p,t,n,s);if(!(w===e?b===v||i(b,v,r,o,s):w)){g=!1;break}y||(y="constructor"==p)}if(g&&!y){var x=t.constructor,k=n.constructor;x==k||!("constructor"in t)||!("constructor"in n)||"function"==typeof x&&x instanceof x&&"function"==typeof k&&k instanceof k||(g=!1)}return s.delete(t),s.delete(n),g}(t,n,r,o,i,s))}(t,n,r,o,Tr,i))}function _r(t,n,r,o){var i=r.length,s=i,a=!o;if(null==t)return!s;for(t=Ce(t);i--;){var l=r[i];if(a&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++i<s;){var c=(l=r[i])[0],u=t[c],d=l[1];if(a&&l[2]){if(u===e&&!(c in t))return!1}else{var h=new Yn;if(o)var p=o(u,d,c,t,n,h);if(!(p===e?Tr(d,u,3,o,h):p))return!1}}return!0}function Ar(e){return!(!ta(e)||(t=e,Ie&&Ie in t))&&(Qs(e)?Fe:me).test(Pi(e));var t}function Dr(e){return"function"==typeof e?e:null==e?ol:"object"==typeof e?qs(e)?Pr(e[0],e[1]):zr(e):pl(e)}function $r(e){if(!ki(e))return mn(e);var t=[];for(var n in Ce(e))$e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Lr(e){if(!ta(e))return function(e){var t=[];if(null!=e)for(var n in Ce(e))t.push(n);return t}(e);var t=ki(e),n=[];for(var r in e)("constructor"!=r||!t&&$e.call(e,r))&&n.push(r);return n}function Ir(e,t){return e<t}function jr(e,t){var n=-1,r=Ys(e)?oe(e.length):[];return ur(e,function(e,o,i){r[++n]=t(e,o,i)}),r}function zr(e){var t=ci(e);return 1==t.length&&t[0][2]?Ei(t[0][0],t[0][1]):function(n){return n===e||_r(n,e,t)}}function Pr(t,n){return vi(t)&&Si(n)?Ei(zi(t),n):function(r){var o=Ra(r,t);return o===e&&o===n?Na(r,t):Tr(n,o,3)}}function Fr(t,n,r,o,i){t!==n&&gr(n,function(s,a){if(i||(i=new Yn),ta(s))!function(t,n,r,o,i,s,a){var l=Ri(t,r),c=Ri(n,r),u=a.get(c);if(u)Qn(t,r,u);else{var d=s?s(l,c,r+"",t,n,a):e,h=d===e;if(h){var p=qs(c),f=!p&&Ks(c),m=!p&&!f&&ua(c);d=c,p||f||m?qs(l)?d=l:Js(l)?d=No(l):f?(h=!1,d=ko(c,!0)):m?(h=!1,d=Eo(c,!0)):d=[]:ia(c)||Us(c)?(d=l,Us(l)?d=ba(l):ta(l)&&!Qs(l)||(d=mi(c))):h=!1}h&&(a.set(c,d),i(d,c,o,s,a),a.delete(c)),Qn(t,r,d)}}(t,n,a,r,Fr,o,i);else{var l=o?o(Ri(t,a),s,a+"",t,n,i):e;l===e&&(l=s),Qn(t,a,l)}},Da)}function Br(t,n){var r=t.length;if(r)return yi(n+=n<0?r:0,r)?t[n]:e}function Hr(e,t,n){t=t.length?At(t,function(e){return qs(e)?function(t){return xr(t,1===e.length?e[0]:e)}:e}):[ol];var r=-1;return t=At(t,Gt(ai())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(jr(e,function(e,n,o){return{criteria:At(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return function(e,t,n){for(var r=-1,o=e.criteria,i=t.criteria,s=o.length,a=n.length;++r<s;){var l=Co(o[r],i[r]);if(l)return r>=a?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function Vr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],a=xr(e,s);n(a,s)&&Zr(i,bo(s,e),a)}return i}function Ur(e,t,n,r){var o=r?Bt:Ft,i=-1,s=t.length,a=e;for(e===t&&(t=No(t)),n&&(a=At(e,Gt(n)));++i<s;)for(var l=0,c=t[i],u=n?n(c):c;(l=o(a,u,l,r))>-1;)a!==e&&Je.call(a,l,1),Je.call(e,l,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;yi(o)?Je.call(e,o,1):co(e,o)}}return e}function Wr(e,t){return e+ft(wn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return Ti(Ci(e,t,ol),e+"")}function Kr(e){return Kn(Ba(e))}function Gr(e,t){var n=Ba(e);return Di(n,ir(t,0,n.length))}function Zr(t,n,r,o){if(!ta(t))return t;for(var i=-1,s=(n=bo(n,t)).length,a=s-1,l=t;null!=l&&++i<s;){var c=zi(n[i]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=a){var d=l[c];(u=o?o(d,c,l):e)===e&&(u=ta(d)?d:yi(n[i+1])?[]:{})}Xn(l,c,u),l=l[c]}return t}var Qr=Nn?function(e,t){return Nn.set(e,t),e}:ol,Xr=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:tl(t),writable:!0})}:ol;function eo(e){return Di(Ba(e))}function to(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=oe(o);++r<o;)i[r]=e[r+t];return i}function no(e,t){var n;return ur(e,function(e,r,o){return!(n=t(e,r,o))}),!!n}function ro(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=e[i];null!==s&&!ca(s)&&(n?s<=t:s<t)?r=i+1:o=i}return o}return oo(e,t,ol,n)}function oo(t,n,r,o){var i=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(n=r(n))!=n,l=null===n,c=ca(n),u=n===e;i<s;){var d=ft((i+s)/2),h=r(t[d]),p=h!==e,f=null===h,m=h==h,g=ca(h);if(a)var y=o||m;else y=u?m&&(o||p):l?m&&p&&(o||!f):c?m&&p&&!f&&(o||!g):!f&&!g&&(o?h<=n:h<n);y?i=d+1:s=d}return yn(s,4294967294)}function io(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!Bs(a,l)){var l=a;i[o++]=0===s?0:s}}return i}function so(e){return"number"==typeof e?e:ca(e)?u:+e}function ao(e){if("string"==typeof e)return e;if(qs(e))return At(e,ao)+"";if(ca(e))return jn?jn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function lo(e,t,n){var r=-1,o=Tt,i=e.length,s=!0,a=[],l=a;if(n)s=!1,o=_t;else if(i>=200){var c=t?null:Jo(e);if(c)return cn(c);s=!1,o=Qt,l=new Wn}else l=t?[]:a;e:for(;++r<i;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,s&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),a.push(u)}else o(l,d,n)||(l!==a&&l.push(d),a.push(u))}return a}function co(e,t){var n=-1,r=(t=bo(t,e)).length;if(!r)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<r;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!$e.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<r&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=Mi(e,t);return null==s||delete s[zi(Zi(t))]}function uo(e,t,n,r){return Zr(e,t,n(xr(e,t)),r)}function ho(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?to(e,r?0:i,r?i+1:o):to(e,r?i+1:0,r?o:i)}function po(e,t){var n=e;return n instanceof Hn&&(n=n.value()),$t(t,function(e,t){return t.func.apply(t.thisArg,Dt([e],t.args))},n)}function fo(e,t,n){var r=e.length;if(r<2)return r?lo(e[0]):[];for(var o=-1,i=oe(r);++o<r;)for(var s=e[o],a=-1;++a<r;)a!=o&&(i[o]=cr(i[o]||s,e[a],t,n));return lo(mr(i,1),t,n)}function mo(t,n,r){for(var o=-1,i=t.length,s=n.length,a={};++o<i;){var l=o<s?n[o]:e;r(a,t[o],l)}return a}function go(e){return Js(e)?e:[]}function yo(e){return"function"==typeof e?e:ol}function bo(e,t){return qs(e)?e:vi(e,t)?[e]:ji(va(e))}var vo=Jr;function wo(t,n,r){var o=t.length;return r=r===e?o:r,!n&&r>=o?t:to(t,n,r)}var xo=at||function(e){return ht.clearTimeout(e)};function ko(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function So(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function Eo(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Co(t,n){if(t!==n){var r=t!==e,o=null===t,i=t==t,s=ca(t),a=n!==e,l=null===n,c=n==n,u=ca(n);if(!l&&!u&&!s&&t>n||s&&a&&c&&!l&&!u||o&&a&&c||!r&&c||!i)return 1;if(!o&&!s&&!u&&t<n||u&&r&&i&&!o&&!s||l&&r&&i||!a&&i||!c)return-1}return 0}function Mo(e,t,n,r){for(var o=-1,i=e.length,s=n.length,a=-1,l=t.length,c=gn(i-s,0),u=oe(l+c),d=!r;++a<l;)u[a]=t[a];for(;++o<s;)(d||o<i)&&(u[n[o]]=e[o]);for(;c--;)u[a++]=e[o++];return u}function Ro(e,t,n,r){for(var o=-1,i=e.length,s=-1,a=n.length,l=-1,c=t.length,u=gn(i-a,0),d=oe(u+c),h=!r;++o<u;)d[o]=e[o];for(var p=o;++l<c;)d[p+l]=t[l];for(;++s<a;)(h||o<i)&&(d[p+n[s]]=e[o++]);return d}function No(e,t){var n=-1,r=e.length;for(t||(t=oe(r));++n<r;)t[n]=e[n];return t}function Oo(t,n,r,o){var i=!r;r||(r={});for(var s=-1,a=n.length;++s<a;){var l=n[s],c=o?o(r[l],t[l],l,r,t):e;c===e&&(c=t[l]),i?rr(r,l,c):Xn(r,l,c)}return r}function To(e,t){return function(n,r){var o=qs(n)?Ct:tr,i=t?t():{};return o(n,e,ai(r,2),i)}}function _o(t){return Jr(function(n,r){var o=-1,i=r.length,s=i>1?r[i-1]:e,a=i>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(i--,s):e,a&&bi(r[0],r[1],a)&&(s=i<3?e:s,i=1),n=Ce(n);++o<i;){var l=r[o];l&&t(n,l,o,s)}return n})}function Ao(e,t){return function(n,r){if(null==n)return n;if(!Ys(n))return e(n,r);for(var o=n.length,i=t?o:-1,s=Ce(n);(t?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function Do(e){return function(t,n,r){for(var o=-1,i=Ce(t),s=r(t),a=s.length;a--;){var l=s[e?a:++o];if(!1===n(i[l],l,i))break}return t}}function $o(t){return function(n){var r=on(n=va(n))?dn(n):e,o=r?r[0]:n.charAt(0),i=r?wo(r,1).join(""):n.slice(1);return o[t]()+i}}function Lo(e){return function(t){return $t(Qa(Ua(t).replace(Ze,"")),e,"")}}function Io(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Pn(e.prototype),r=e.apply(n,t);return ta(r)?r:n}}function jo(t){return function(n,r,o){var i=Ce(n);if(!Ys(n)){var s=ai(r,3);n=Aa(n),r=function(e){return s(i[e],e,i)}}var a=t(n,r,o);return a>-1?i[s?n[a]:a]:e}}function zo(n){return ti(function(r){var o=r.length,i=o,s=Bn.prototype.thru;for(n&&r.reverse();i--;){var a=r[i];if("function"!=typeof a)throw new Ne(t);if(s&&!l&&"wrapper"==ii(a))var l=new Bn([],!0)}for(i=l?i:o;++i<o;){var c=ii(a=r[i]),u="wrapper"==c?oi(a):e;l=u&&wi(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[ii(u[0])].apply(l,u[3]):1==a.length&&wi(a)?l[c]():l.thru(a)}return function(){var e=arguments,t=e[0];if(l&&1==e.length&&qs(t))return l.plant(t).value();for(var n=0,i=o?r[n].apply(this,e):t;++n<o;)i=r[n].call(this,i);return i}})}function Po(t,n,r,o,i,a,l,c,u,d){var h=n&s,p=1&n,f=2&n,m=24&n,g=512&n,y=f?e:Io(t);return function s(){for(var b=arguments.length,v=oe(b),w=b;w--;)v[w]=arguments[w];if(m)var x=si(s),k=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(v,x);if(o&&(v=Mo(v,o,i,m)),a&&(v=Ro(v,a,l,m)),b-=k,m&&b<d){var S=ln(v,x);return Wo(t,n,Po,s.placeholder,r,v,S,c,u,d-b)}var E=p?r:this,C=f?E[t]:t;return b=v.length,c?v=function(t,n){for(var r=t.length,o=yn(n.length,r),i=No(t);o--;){var s=n[o];t[o]=yi(s,r)?i[s]:e}return t}(v,c):g&&b>1&&v.reverse(),h&&u<b&&(v.length=u),this&&this!==ht&&this instanceof s&&(C=y||Io(C)),C.apply(E,v)}}function Fo(e,t){return function(n,r){return function(e,t,n,r){return br(e,function(e,o,i){t(r,n(e),o,i)}),r}(n,e,t(r),{})}}function Bo(t,n){return function(r,o){var i;if(r===e&&o===e)return n;if(r!==e&&(i=r),o!==e){if(i===e)return o;"string"==typeof r||"string"==typeof o?(r=ao(r),o=ao(o)):(r=so(r),o=so(o)),i=t(r,o)}return i}}function Ho(e){return ti(function(t){return t=At(t,Gt(ai())),Jr(function(n){var r=this;return e(t,function(e){return Et(e,r,n)})})})}function Vo(t,n){var r=(n=n===e?" ":ao(n)).length;if(r<2)return r?Yr(n,t):n;var o=Yr(n,pt(t/un(n)));return on(n)?wo(dn(o),0,t).join(""):o.slice(0,t)}function Uo(t){return function(n,r,o){return o&&"number"!=typeof o&&bi(n,r,o)&&(r=o=e),n=fa(n),r===e?(r=n,n=0):r=fa(r),function(e,t,n,r){for(var o=-1,i=gn(pt((t-e)/(n||1)),0),s=oe(i);i--;)s[r?i:++o]=e,e+=n;return s}(n,r,o=o===e?n<r?1:-1:fa(o),t)}}function qo(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ya(t),n=ya(n)),e(t,n)}}function Wo(t,n,r,i,s,a,l,c,u,d){var h=8&n;n|=h?o:64,4&(n&=~(h?64:o))||(n&=-4);var p=[t,n,s,h?a:e,h?l:e,h?e:a,h?e:l,c,u,d],f=r.apply(e,p);return wi(t)&&Ni(f,p),f.placeholder=i,_i(f,t,n)}function Yo(e){var t=Ee[e];return function(e,n){if(e=ya(e),(n=null==n?0:yn(ma(n),292))&&jt(e)){var r=(va(e)+"e").split("e");return+((r=(va(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Jo=Cn&&1/cn(new Cn([,-0]))[1]==l?function(e){return new Cn(e)}:cl;function Ko(e){return function(t){var n=pi(t);return n==w?sn(t):n==R?function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}(t):function(e,t){return At(t,function(t){return[t,e[t]]})}(t,e(t))}}function Go(n,i,l,c,u,d,h,p){var f=2&i;if(!f&&"function"!=typeof n)throw new Ne(t);var m=c?c.length:0;if(m||(i&=-97,c=u=e),h=h===e?h:gn(ma(h),0),p=p===e?p:ma(p),m-=u?u.length:0,64&i){var g=c,y=u;c=u=e}var b=f?e:oi(n),v=[n,i,l,c,u,g,y,d,h,p];if(b&&function(e,t){var n=e[1],o=t[1],i=n|o,l=i<131,c=o==s&&8==n||o==s&&n==a&&e[7].length<=t[8]||384==o&&t[7].length<=t[8]&&8==n;if(!l&&!c)return e;1&o&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Mo(d,u,t[4]):u,e[4]=d?ln(e[3],r):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ro(d,u,t[6]):u,e[6]=d?ln(e[5],r):t[6]),(u=t[7])&&(e[7]=u),o&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),n=v[0],i=v[1],l=v[2],c=v[3],u=v[4],!(p=v[9]=v[9]===e?f?0:n.length:gn(v[9]-m,0))&&24&i&&(i&=-25),i&&1!=i)w=8==i||16==i?function(t,n,r){var o=Io(t);return function i(){for(var s=arguments.length,a=oe(s),l=s,c=si(i);l--;)a[l]=arguments[l];var u=s<3&&a[0]!==c&&a[s-1]!==c?[]:ln(a,c);return(s-=u.length)<r?Wo(t,n,Po,i.placeholder,e,a,u,e,e,r-s):Et(this&&this!==ht&&this instanceof i?o:t,this,a)}}(n,i,p):i!=o&&33!=i||u.length?Po.apply(e,v):function(e,t,n,r){var o=1&t,i=Io(e);return function t(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=oe(c+a),d=this&&this!==ht&&this instanceof t?i:e;++l<c;)u[l]=r[l];for(;a--;)u[l++]=arguments[++s];return Et(d,o?n:this,u)}}(n,i,l,c);else var w=function(e,t,n){var r=1&t,o=Io(e);return function t(){return(this&&this!==ht&&this instanceof t?o:e).apply(r?n:this,arguments)}}(n,i,l);return _i((b?Qr:Ni)(w,v),n,i)}function Zo(t,n,r,o){return t===e||Bs(t,_e[r])&&!$e.call(o,r)?n:t}function Qo(t,n,r,o,i,s){return ta(t)&&ta(n)&&(s.set(n,t),Fr(t,n,e,Qo,s),s.delete(n)),t}function Xo(t){return ia(t)?e:t}function ei(t,n,r,o,i,s){var a=1&r,l=t.length,c=n.length;if(l!=c&&!(a&&c>l))return!1;var u=s.get(t),d=s.get(n);if(u&&d)return u==n&&d==t;var h=-1,p=!0,f=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++h<l;){var m=t[h],g=n[h];if(o)var y=a?o(g,m,h,n,t,s):o(m,g,h,t,n,s);if(y!==e){if(y)continue;p=!1;break}if(f){if(!It(n,function(e,t){if(!Qt(f,t)&&(m===e||i(m,e,r,o,s)))return f.push(t)})){p=!1;break}}else if(m!==g&&!i(m,g,r,o,s)){p=!1;break}}return s.delete(t),s.delete(n),p}function ti(t){return Ti(Ci(t,e,Wi),t+"")}function ni(e){return kr(e,Aa,di)}function ri(e){return kr(e,Da,hi)}var oi=Nn?function(e){return Nn.get(e)}:cl;function ii(e){for(var t=e.name+"",n=On[t],r=$e.call(On,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function si(e){return($e.call(zn,"placeholder")?zn:e).placeholder}function ai(){var e=zn.iteratee||il;return e=e===il?Dr:e,arguments.length?e(arguments[0],arguments[1]):e}function li(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ci(e){for(var t=Aa(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Si(o)]}return t}function ui(t,n){var r=function(t,n){return null==t?e:t[n]}(t,n);return Ar(r)?r:e}var di=gt?function(e){return null==e?[]:(e=Ce(e),Ot(gt(e),function(t){return Ye.call(e,t)}))}:gl,hi=gt?function(e){for(var t=[];e;)Dt(t,di(e)),e=qe(e);return t}:gl,pi=Sr;function fi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var s=zi(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&ea(o)&&yi(s,o)&&(qs(e)||Us(e))}function mi(e){return"function"!=typeof e.constructor||ki(e)?{}:Pn(qe(e))}function gi(e){return qs(e)||Us(e)||!!(Ke&&e&&e[Ke])}function yi(e,t){var n=typeof e;return!!(t=null==t?c:t)&&("number"==n||"symbol"!=n&&ye.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ta(n))return!1;var r=typeof t;return!!("number"==r?Ys(n)&&yi(t,n.length):"string"==r&&t in n)&&Bs(n[t],e)}function vi(e,t){if(qs(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ca(e))||X.test(e)||!Q.test(e)||null!=t&&e in Ce(t)}function wi(e){var t=ii(e),n=zn[t];if("function"!=typeof n||!(t in Hn.prototype))return!1;if(e===n)return!0;var r=oi(n);return!!r&&e===r[0]}(kn&&pi(new kn(new ArrayBuffer(1)))!=A||Sn&&pi(new Sn)!=w||En&&pi(En.resolve())!=C||Cn&&pi(new Cn)!=R||Mn&&pi(new Mn)!=T)&&(pi=function(t){var n=Sr(t),r=n==k?t.constructor:e,o=r?Pi(r):"";if(o)switch(o){case Tn:return A;case _n:return w;case An:return C;case Dn:return R;case $n:return T}return n});var xi=Ae?Qs:yl;function ki(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function Si(e){return e==e&&!ta(e)}function Ei(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in Ce(r))}}function Ci(t,n,r){return n=gn(n===e?t.length-1:n,0),function(){for(var e=arguments,o=-1,i=gn(e.length-n,0),s=oe(i);++o<i;)s[o]=e[n+o];o=-1;for(var a=oe(n+1);++o<n;)a[o]=e[o];return a[n]=r(s),Et(t,this,a)}}function Mi(e,t){return t.length<2?e:xr(e,to(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ni=Ai(Qr),Oi=dt||function(e,t){return ht.setTimeout(e,t)},Ti=Ai(Xr);function _i(e,t,n){var r=t+"";return Ti(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Mt(h,function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(r),n)))}function Ai(t){var n=0,r=0;return function(){var o=bn(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Di(t,n){var r=-1,o=t.length,i=o-1;for(n=n===e?o:n;++r<n;){var s=Wr(r,i),a=t[s];t[s]=t[r],t[r]=a}return t.length=n,t}var $i,Li,Ii,ji=($i=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,function(e,n,r,o){t.push(r?o.replace(ue,"$1"):n||e)}),t},Li=Ls($i,function(e){return 500===Ii.size&&Ii.clear(),e}),Ii=Li.cache,Li);function zi(e){if("string"==typeof e||ca(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Pi(e){if(null!=e){try{return De.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Fi(e){if(e instanceof Hn)return e.clone();var t=new Bn(e.__wrapped__,e.__chain__);return t.__actions__=No(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Bi=Jr(function(e,t){return Js(e)?cr(e,mr(t,1,Js,!0)):[]}),Hi=Jr(function(t,n){var r=Zi(n);return Js(r)&&(r=e),Js(t)?cr(t,mr(n,1,Js,!0),ai(r,2)):[]}),Vi=Jr(function(t,n){var r=Zi(n);return Js(r)&&(r=e),Js(t)?cr(t,mr(n,1,Js,!0),e,r):[]});function Ui(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=gn(r+o,0)),Pt(e,ai(t,3),o)}function qi(t,n,r){var o=null==t?0:t.length;if(!o)return-1;var i=o-1;return r!==e&&(i=ma(r),i=r<0?gn(o+i,0):yn(i,o-1)),Pt(t,ai(n,3),i,!0)}function Wi(e){return null!=e&&e.length?mr(e,1):[]}function Yi(t){return t&&t.length?t[0]:e}var Ji=Jr(function(e){var t=At(e,go);return t.length&&t[0]===e[0]?Rr(t):[]}),Ki=Jr(function(t){var n=Zi(t),r=At(t,go);return n===Zi(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Rr(r,ai(n,2)):[]}),Gi=Jr(function(t){var n=Zi(t),r=At(t,go);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Rr(r,e,n):[]});function Zi(t){var n=null==t?0:t.length;return n?t[n-1]:e}var Qi=Jr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Ur(e,t):e}var es=ti(function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,At(t,function(e){return yi(e,n)?+e:e}).sort(Co)),r});function ts(e){return null==e?e:xn.call(e)}var ns=Jr(function(e){return lo(mr(e,1,Js,!0))}),rs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),lo(mr(t,1,Js,!0),ai(n,2))}),os=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,lo(mr(t,1,Js,!0),e,n)});function is(e){if(!e||!e.length)return[];var t=0;return e=Ot(e,function(e){if(Js(e))return t=gn(e.length,t),!0}),Jt(t,function(t){return At(e,Ut(t))})}function ss(t,n){if(!t||!t.length)return[];var r=is(t);return null==n?r:At(r,function(t){return Et(n,e,t)})}var as=Jr(function(e,t){return Js(e)?cr(e,t):[]}),ls=Jr(function(e){return fo(Ot(e,Js))}),cs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),fo(Ot(t,Js),ai(n,2))}),us=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,fo(Ot(t,Js),e,n)}),ds=Jr(is),hs=Jr(function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,ss(t,r)});function ps(e){var t=zn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ms=ti(function(t){var n=t.length,r=n?t[0]:0,o=this.__wrapped__,i=function(e){return or(e,t)};return!(n>1||this.__actions__.length)&&o instanceof Hn&&yi(r)?((o=o.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[i],thisArg:e}),new Bn(o,this.__chain__).thru(function(t){return n&&!t.length&&t.push(e),t})):this.thru(i)}),gs=To(function(e,t,n){$e.call(e,n)?++e[n]:rr(e,n,1)}),ys=jo(Ui),bs=jo(qi);function vs(e,t){return(qs(e)?Mt:ur)(e,ai(t,3))}function ws(e,t){return(qs(e)?Rt:dr)(e,ai(t,3))}var xs=To(function(e,t,n){$e.call(e,n)?e[n].push(t):rr(e,n,[t])}),ks=Jr(function(e,t,n){var r=-1,o="function"==typeof t,i=Ys(e)?oe(e.length):[];return ur(e,function(e){i[++r]=o?Et(t,e,n):Nr(e,t,n)}),i}),Ss=To(function(e,t,n){rr(e,n,t)});function Es(e,t){return(qs(e)?At:jr)(e,ai(t,3))}var Cs=To(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Ms=Jr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,mr(t,1),[])}),Rs=ut||function(){return ht.Date.now()};function Ns(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Go(t,s,e,e,e,e,n)}function Os(n,r){var o;if("function"!=typeof r)throw new Ne(t);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=e),o}}var Ts=Jr(function(e,t,n){var r=1;if(n.length){var i=ln(n,si(Ts));r|=o}return Go(e,r,t,n,i)}),_s=Jr(function(e,t,n){var r=3;if(n.length){var i=ln(n,si(_s));r|=o}return Go(t,r,e,n,i)});function As(n,r,o){var i,s,a,l,c,u,d=0,h=!1,p=!1,f=!0;if("function"!=typeof n)throw new Ne(t);function m(t){var r=i,o=s;return i=s=e,d=t,l=n.apply(o,r)}function g(t){var n=t-u;return u===e||n>=r||n<0||p&&t-d>=a}function y(){var e=Rs();if(g(e))return b(e);c=Oi(y,function(e){var t=r-(e-u);return p?yn(t,a-(e-d)):t}(e))}function b(t){return c=e,f&&i?m(t):(i=s=e,l)}function v(){var t=Rs(),n=g(t);if(i=arguments,s=this,u=t,n){if(c===e)return function(e){return d=e,c=Oi(y,r),h?m(e):l}(u);if(p)return xo(c),c=Oi(y,r),m(u)}return c===e&&(c=Oi(y,r)),l}return r=ya(r)||0,ta(o)&&(h=!!o.leading,a=(p="maxWait"in o)?gn(ya(o.maxWait)||0,r):a,f="trailing"in o?!!o.trailing:f),v.cancel=function(){c!==e&&xo(c),d=0,i=u=s=c=e},v.flush=function(){return c===e?l:b(Rs())},v}var Ds=Jr(function(e,t){return lr(e,1,t)}),$s=Jr(function(e,t,n){return lr(e,ya(t)||0,n)});function Ls(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Ne(t);var r=function(){var t=arguments,o=n?n.apply(this,t):t[0],i=r.cache;if(i.has(o))return i.get(o);var s=e.apply(this,t);return r.cache=i.set(o,s)||i,s};return r.cache=new(Ls.Cache||qn),r}function Is(e){if("function"!=typeof e)throw new Ne(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ls.Cache=qn;var js=vo(function(e,t){var n=(t=1==t.length&&qs(t[0])?At(t[0],Gt(ai())):At(mr(t,1),Gt(ai()))).length;return Jr(function(r){for(var o=-1,i=yn(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return Et(e,this,r)})}),zs=Jr(function(t,n){var r=ln(n,si(zs));return Go(t,o,e,n,r)}),Ps=Jr(function(t,n){var r=ln(n,si(Ps));return Go(t,64,e,n,r)}),Fs=ti(function(t,n){return Go(t,a,e,e,e,n)});function Bs(e,t){return e===t||e!=e&&t!=t}var Hs=qo(Er),Vs=qo(function(e,t){return e>=t}),Us=Or(function(){return arguments}())?Or:function(e){return na(e)&&$e.call(e,"callee")&&!Ye.call(e,"callee")},qs=oe.isArray,Ws=bt?Gt(bt):function(e){return na(e)&&Sr(e)==_};function Ys(e){return null!=e&&ea(e.length)&&!Qs(e)}function Js(e){return na(e)&&Ys(e)}var Ks=yt||yl,Gs=vt?Gt(vt):function(e){return na(e)&&Sr(e)==g};function Zs(e){if(!na(e))return!1;var t=Sr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ia(e)}function Qs(e){if(!ta(e))return!1;var t=Sr(e);return t==b||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xs(e){return"number"==typeof e&&e==ma(e)}function ea(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function ta(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function na(e){return null!=e&&"object"==typeof e}var ra=wt?Gt(wt):function(e){return na(e)&&pi(e)==w};function oa(e){return"number"==typeof e||na(e)&&Sr(e)==x}function ia(e){if(!na(e)||Sr(e)!=k)return!1;var t=qe(e);if(null===t)return!0;var n=$e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==ze}var sa=xt?Gt(xt):function(e){return na(e)&&Sr(e)==M},aa=kt?Gt(kt):function(e){return na(e)&&pi(e)==R};function la(e){return"string"==typeof e||!qs(e)&&na(e)&&Sr(e)==N}function ca(e){return"symbol"==typeof e||na(e)&&Sr(e)==O}var ua=St?Gt(St):function(e){return na(e)&&ea(e.length)&&!!it[Sr(e)]},da=qo(Ir),ha=qo(function(e,t){return e<=t});function pa(e){if(!e)return[];if(Ys(e))return la(e)?dn(e):No(e);if(Ge&&e[Ge])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ge]());var t=pi(e);return(t==w?sn:t==R?cn:Ba)(e)}function fa(e){return e?(e=ya(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ma(e){var t=fa(e),n=t%1;return t==t?n?t-n:t:0}function ga(e){return e?ir(ma(e),0,d):0}function ya(e){if("number"==typeof e)return e;if(ca(e))return u;if(ta(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ta(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=fe.test(e);return n||ge.test(e)?ct(e.slice(2),n?2:8):pe.test(e)?u:+e}function ba(e){return Oo(e,Da(e))}function va(e){return null==e?"":ao(e)}var wa=_o(function(e,t){if(ki(t)||Ys(t))Oo(t,Aa(t),e);else for(var n in t)$e.call(t,n)&&Xn(e,n,t[n])}),xa=_o(function(e,t){Oo(t,Da(t),e)}),ka=_o(function(e,t,n,r){Oo(t,Da(t),e,r)}),Sa=_o(function(e,t,n,r){Oo(t,Aa(t),e,r)}),Ea=ti(or),Ca=Jr(function(t,n){t=Ce(t);var r=-1,o=n.length,i=o>2?n[2]:e;for(i&&bi(n[0],n[1],i)&&(o=1);++r<o;)for(var s=n[r],a=Da(s),l=-1,c=a.length;++l<c;){var u=a[l],d=t[u];(d===e||Bs(d,_e[u])&&!$e.call(t,u))&&(t[u]=s[u])}return t}),Ma=Jr(function(t){return t.push(e,Qo),Et(La,e,t)});function Ra(t,n,r){var o=null==t?e:xr(t,n);return o===e?r:o}function Na(e,t){return null!=e&&fi(e,t,Mr)}var Oa=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=n},tl(ol)),Ta=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),$e.call(e,t)?e[t].push(n):e[t]=[n]},ai),_a=Jr(Nr);function Aa(e){return Ys(e)?Jn(e):$r(e)}function Da(e){return Ys(e)?Jn(e,!0):Lr(e)}var $a=_o(function(e,t,n){Fr(e,t,n)}),La=_o(function(e,t,n,r){Fr(e,t,n,r)}),Ia=ti(function(e,t){var n={};if(null==e)return n;var r=!1;t=At(t,function(t){return t=bo(t,e),r||(r=t.length>1),t}),Oo(e,ri(e),n),r&&(n=sr(n,7,Xo));for(var o=t.length;o--;)co(n,t[o]);return n}),ja=ti(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Na(e,n)})}(e,t)});function za(e,t){if(null==e)return{};var n=At(ri(e),function(e){return[e]});return t=ai(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Pa=Ko(Aa),Fa=Ko(Da);function Ba(e){return null==e?[]:Zt(e,Aa(e))}var Ha=Lo(function(e,t,n){return t=t.toLowerCase(),e+(n?Va(t):t)});function Va(e){return Za(va(e).toLowerCase())}function Ua(e){return(e=va(e))&&e.replace(be,tn).replace(Qe,"")}var qa=Lo(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Wa=Lo(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Ya=$o("toLowerCase"),Ja=Lo(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Ka=Lo(function(e,t,n){return e+(n?" ":"")+Za(t)}),Ga=Lo(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Za=$o("toUpperCase");function Qa(t,n,r){return t=va(t),(n=r?e:n)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(et)||[]}(t):function(e){return e.match(le)||[]}(t):t.match(n)||[]}var Xa=Jr(function(t,n){try{return Et(t,e,n)}catch(r){return Zs(r)?r:new ke(r)}}),el=ti(function(e,t){return Mt(t,function(t){t=zi(t),rr(e,t,Ts(e[t],e))}),e});function tl(e){return function(){return e}}var nl=zo(),rl=zo(!0);function ol(e){return e}function il(e){return Dr("function"==typeof e?e:sr(e,1))}var sl=Jr(function(e,t){return function(n){return Nr(n,e,t)}}),al=Jr(function(e,t){return function(n){return Nr(e,n,t)}});function ll(e,t,n){var r=Aa(t),o=wr(t,r);null!=n||ta(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=wr(t,Aa(t)));var i=!(ta(n)&&"chain"in n&&!n.chain),s=Qs(e);return Mt(o,function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=No(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Dt([this.value()],arguments))})}),e}function cl(){}var ul=Ho(At),dl=Ho(Nt),hl=Ho(It);function pl(e){return vi(e)?Ut(zi(e)):function(e){return function(t){return xr(t,e)}}(e)}var fl=Uo(),ml=Uo(!0);function gl(){return[]}function yl(){return!1}var bl,vl=Bo(function(e,t){return e+t},0),wl=Yo("ceil"),xl=Bo(function(e,t){return e/t},1),kl=Yo("floor"),Sl=Bo(function(e,t){return e*t},1),El=Yo("round"),Cl=Bo(function(e,t){return e-t},0);return zn.after=function(e,n){if("function"!=typeof n)throw new Ne(t);return e=ma(e),function(){if(--e<1)return n.apply(this,arguments)}},zn.ary=Ns,zn.assign=wa,zn.assignIn=xa,zn.assignInWith=ka,zn.assignWith=Sa,zn.at=Ea,zn.before=Os,zn.bind=Ts,zn.bindAll=el,zn.bindKey=_s,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qs(e)?e:[e]},zn.chain=ps,zn.chunk=function(t,n,r){n=(r?bi(t,n,r):n===e)?1:gn(ma(n),0);var o=null==t?0:t.length;if(!o||n<1)return[];for(var i=0,s=0,a=oe(pt(o/n));i<o;)a[s++]=to(t,i,i+=n);return a},zn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},zn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=oe(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Dt(qs(n)?No(n):[n],mr(t,1))},zn.cond=function(e){var n=null==e?0:e.length,r=ai();return e=n?At(e,function(e){if("function"!=typeof e[1])throw new Ne(t);return[r(e[0]),e[1]]}):[],Jr(function(t){for(var r=-1;++r<n;){var o=e[r];if(Et(o[0],this,t))return Et(o[1],this,t)}})},zn.conforms=function(e){return function(e){var t=Aa(e);return function(n){return ar(n,e,t)}}(sr(e,1))},zn.constant=tl,zn.countBy=gs,zn.create=function(e,t){var n=Pn(e);return null==t?n:nr(n,t)},zn.curry=function t(n,r,o){var i=Go(n,8,e,e,e,e,e,r=o?e:r);return i.placeholder=t.placeholder,i},zn.curryRight=function t(n,r,o){var i=Go(n,16,e,e,e,e,e,r=o?e:r);return i.placeholder=t.placeholder,i},zn.debounce=As,zn.defaults=Ca,zn.defaultsDeep=Ma,zn.defer=Ds,zn.delay=$s,zn.difference=Bi,zn.differenceBy=Hi,zn.differenceWith=Vi,zn.drop=function(t,n,r){var o=null==t?0:t.length;return o?to(t,(n=r||n===e?1:ma(n))<0?0:n,o):[]},zn.dropRight=function(t,n,r){var o=null==t?0:t.length;return o?to(t,0,(n=o-(n=r||n===e?1:ma(n)))<0?0:n):[]},zn.dropRightWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!0):[]},zn.fill=function(t,n,r,o){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&bi(t,n,r)&&(r=0,o=i),function(t,n,r,o){var i=t.length;for((r=ma(r))<0&&(r=-r>i?0:i+r),(o=o===e||o>i?i:ma(o))<0&&(o+=i),o=r>o?0:ga(o);r<o;)t[r++]=n;return t}(t,n,r,o)):[]},zn.filter=function(e,t){return(qs(e)?Ot:fr)(e,ai(t,3))},zn.flatMap=function(e,t){return mr(Es(e,t),1)},zn.flatMapDeep=function(e,t){return mr(Es(e,t),l)},zn.flatMapDepth=function(t,n,r){return r=r===e?1:ma(r),mr(Es(t,n),r)},zn.flatten=Wi,zn.flattenDeep=function(e){return null!=e&&e.length?mr(e,l):[]},zn.flattenDepth=function(t,n){return null!=t&&t.length?mr(t,n=n===e?1:ma(n)):[]},zn.flip=function(e){return Go(e,512)},zn.flow=nl,zn.flowRight=rl,zn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},zn.functions=function(e){return null==e?[]:wr(e,Aa(e))},zn.functionsIn=function(e){return null==e?[]:wr(e,Da(e))},zn.groupBy=xs,zn.initial=function(e){return null!=e&&e.length?to(e,0,-1):[]},zn.intersection=Ji,zn.intersectionBy=Ki,zn.intersectionWith=Gi,zn.invert=Oa,zn.invertBy=Ta,zn.invokeMap=ks,zn.iteratee=il,zn.keyBy=Ss,zn.keys=Aa,zn.keysIn=Da,zn.map=Es,zn.mapKeys=function(e,t){var n={};return t=ai(t,3),br(e,function(e,r,o){rr(n,t(e,r,o),e)}),n},zn.mapValues=function(e,t){var n={};return t=ai(t,3),br(e,function(e,r,o){rr(n,r,t(e,r,o))}),n},zn.matches=function(e){return zr(sr(e,1))},zn.matchesProperty=function(e,t){return Pr(e,sr(t,1))},zn.memoize=Ls,zn.merge=$a,zn.mergeWith=La,zn.method=sl,zn.methodOf=al,zn.mixin=ll,zn.negate=Is,zn.nthArg=function(e){return e=ma(e),Jr(function(t){return Br(t,e)})},zn.omit=Ia,zn.omitBy=function(e,t){return za(e,Is(ai(t)))},zn.once=function(e){return Os(2,e)},zn.orderBy=function(t,n,r,o){return null==t?[]:(qs(n)||(n=null==n?[]:[n]),qs(r=o?e:r)||(r=null==r?[]:[r]),Hr(t,n,r))},zn.over=ul,zn.overArgs=js,zn.overEvery=dl,zn.overSome=hl,zn.partial=zs,zn.partialRight=Ps,zn.partition=Cs,zn.pick=ja,zn.pickBy=za,zn.property=pl,zn.propertyOf=function(t){return function(n){return null==t?e:xr(t,n)}},zn.pull=Qi,zn.pullAll=Xi,zn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ur(e,t,ai(n,2)):e},zn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?Ur(t,n,e,r):t},zn.pullAt=es,zn.range=fl,zn.rangeRight=ml,zn.rearg=Fs,zn.reject=function(e,t){return(qs(e)?Ot:fr)(e,Is(ai(t,3)))},zn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=ai(t,3);++r<i;){var s=e[r];t(s,r,e)&&(n.push(s),o.push(r))}return qr(e,o),n},zn.rest=function(n,r){if("function"!=typeof n)throw new Ne(t);return Jr(n,r=r===e?r:ma(r))},zn.reverse=ts,zn.sampleSize=function(t,n,r){return n=(r?bi(t,n,r):n===e)?1:ma(n),(qs(t)?Gn:Gr)(t,n)},zn.set=function(e,t,n){return null==e?e:Zr(e,t,n)},zn.setWith=function(t,n,r,o){return o="function"==typeof o?o:e,null==t?t:Zr(t,n,r,o)},zn.shuffle=function(e){return(qs(e)?Zn:eo)(e)},zn.slice=function(t,n,r){var o=null==t?0:t.length;return o?(r&&"number"!=typeof r&&bi(t,n,r)?(n=0,r=o):(n=null==n?0:ma(n),r=r===e?o:ma(r)),to(t,n,r)):[]},zn.sortBy=Ms,zn.sortedUniq=function(e){return e&&e.length?io(e):[]},zn.sortedUniqBy=function(e,t){return e&&e.length?io(e,ai(t,2)):[]},zn.split=function(t,n,r){return r&&"number"!=typeof r&&bi(t,n,r)&&(n=r=e),(r=r===e?d:r>>>0)?(t=va(t))&&("string"==typeof n||null!=n&&!sa(n))&&!(n=ao(n))&&on(t)?wo(dn(t),0,r):t.split(n,r):[]},zn.spread=function(e,n){if("function"!=typeof e)throw new Ne(t);return n=null==n?0:gn(ma(n),0),Jr(function(t){var r=t[n],o=wo(t,0,n);return r&&Dt(o,r),Et(e,this,o)})},zn.tail=function(e){var t=null==e?0:e.length;return t?to(e,1,t):[]},zn.take=function(t,n,r){return t&&t.length?to(t,0,(n=r||n===e?1:ma(n))<0?0:n):[]},zn.takeRight=function(t,n,r){var o=null==t?0:t.length;return o?to(t,(n=o-(n=r||n===e?1:ma(n)))<0?0:n,o):[]},zn.takeRightWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?ho(e,ai(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,n,r){var o=!0,i=!0;if("function"!=typeof e)throw new Ne(t);return ta(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),As(e,n,{leading:o,maxWait:n,trailing:i})},zn.thru=fs,zn.toArray=pa,zn.toPairs=Pa,zn.toPairsIn=Fa,zn.toPath=function(e){return qs(e)?At(e,zi):ca(e)?[e]:No(ji(va(e)))},zn.toPlainObject=ba,zn.transform=function(e,t,n){var r=qs(e),o=r||Ks(e)||ua(e);if(t=ai(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ta(e)&&Qs(i)?Pn(qe(e)):{}}return(o?Mt:br)(e,function(e,r,o){return t(n,e,r,o)}),n},zn.unary=function(e){return Ns(e,1)},zn.union=ns,zn.unionBy=rs,zn.unionWith=os,zn.uniq=function(e){return e&&e.length?lo(e):[]},zn.uniqBy=function(e,t){return e&&e.length?lo(e,ai(t,2)):[]},zn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?lo(t,e,n):[]},zn.unset=function(e,t){return null==e||co(e,t)},zn.unzip=is,zn.unzipWith=ss,zn.update=function(e,t,n){return null==e?e:uo(e,t,yo(n))},zn.updateWith=function(t,n,r,o){return o="function"==typeof o?o:e,null==t?t:uo(t,n,yo(r),o)},zn.values=Ba,zn.valuesIn=function(e){return null==e?[]:Zt(e,Da(e))},zn.without=as,zn.words=Qa,zn.wrap=function(e,t){return zs(yo(t),e)},zn.xor=ls,zn.xorBy=cs,zn.xorWith=us,zn.zip=ds,zn.zipObject=function(e,t){return mo(e||[],t||[],Xn)},zn.zipObjectDeep=function(e,t){return mo(e||[],t||[],Zr)},zn.zipWith=hs,zn.entries=Pa,zn.entriesIn=Fa,zn.extend=xa,zn.extendWith=ka,ll(zn,zn),zn.add=vl,zn.attempt=Xa,zn.camelCase=Ha,zn.capitalize=Va,zn.ceil=wl,zn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=ya(r))==r?r:0),n!==e&&(n=(n=ya(n))==n?n:0),ir(ya(t),n,r)},zn.clone=function(e){return sr(e,4)},zn.cloneDeep=function(e){return sr(e,5)},zn.cloneDeepWith=function(t,n){return sr(t,5,n="function"==typeof n?n:e)},zn.cloneWith=function(t,n){return sr(t,4,n="function"==typeof n?n:e)},zn.conformsTo=function(e,t){return null==t||ar(e,t,Aa(t))},zn.deburr=Ua,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=xl,zn.endsWith=function(t,n,r){t=va(t),n=ao(n);var o=t.length,i=r=r===e?o:ir(ma(r),0,o);return(r-=n.length)>=0&&t.slice(r,i)==n},zn.eq=Bs,zn.escape=function(e){return(e=va(e))&&J.test(e)?e.replace(W,nn):e},zn.escapeRegExp=function(e){return(e=va(e))&&ne.test(e)?e.replace(te,"\\$&"):e},zn.every=function(t,n,r){var o=qs(t)?Nt:hr;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.find=ys,zn.findIndex=Ui,zn.findKey=function(e,t){return zt(e,ai(t,3),br)},zn.findLast=bs,zn.findLastIndex=qi,zn.findLastKey=function(e,t){return zt(e,ai(t,3),vr)},zn.floor=kl,zn.forEach=vs,zn.forEachRight=ws,zn.forIn=function(e,t){return null==e?e:gr(e,ai(t,3),Da)},zn.forInRight=function(e,t){return null==e?e:yr(e,ai(t,3),Da)},zn.forOwn=function(e,t){return e&&br(e,ai(t,3))},zn.forOwnRight=function(e,t){return e&&vr(e,ai(t,3))},zn.get=Ra,zn.gt=Hs,zn.gte=Vs,zn.has=function(e,t){return null!=e&&fi(e,t,Cr)},zn.hasIn=Na,zn.head=Yi,zn.identity=ol,zn.includes=function(e,t,n,r){e=Ys(e)?e:Ba(e),n=n&&!r?ma(n):0;var o=e.length;return n<0&&(n=gn(o+n,0)),la(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Ft(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=gn(r+o,0)),Ft(e,t,o)},zn.inRange=function(t,n,r){return n=fa(n),r===e?(r=n,n=0):r=fa(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(t=ya(t),n,r)},zn.invoke=_a,zn.isArguments=Us,zn.isArray=qs,zn.isArrayBuffer=Ws,zn.isArrayLike=Ys,zn.isArrayLikeObject=Js,zn.isBoolean=function(e){return!0===e||!1===e||na(e)&&Sr(e)==m},zn.isBuffer=Ks,zn.isDate=Gs,zn.isElement=function(e){return na(e)&&1===e.nodeType&&!ia(e)},zn.isEmpty=function(e){if(null==e)return!0;if(Ys(e)&&(qs(e)||"string"==typeof e||"function"==typeof e.splice||Ks(e)||ua(e)||Us(e)))return!e.length;var t=pi(e);if(t==w||t==R)return!e.size;if(ki(e))return!$r(e).length;for(var n in e)if($e.call(e,n))return!1;return!0},zn.isEqual=function(e,t){return Tr(e,t)},zn.isEqualWith=function(t,n,r){var o=(r="function"==typeof r?r:e)?r(t,n):e;return o===e?Tr(t,n,e,r):!!o},zn.isError=Zs,zn.isFinite=function(e){return"number"==typeof e&&jt(e)},zn.isFunction=Qs,zn.isInteger=Xs,zn.isLength=ea,zn.isMap=ra,zn.isMatch=function(e,t){return e===t||_r(e,t,ci(t))},zn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,_r(t,n,ci(n),r)},zn.isNaN=function(e){return oa(e)&&e!=+e},zn.isNative=function(e){if(xi(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ar(e)},zn.isNil=function(e){return null==e},zn.isNull=function(e){return null===e},zn.isNumber=oa,zn.isObject=ta,zn.isObjectLike=na,zn.isPlainObject=ia,zn.isRegExp=sa,zn.isSafeInteger=function(e){return Xs(e)&&e>=-9007199254740991&&e<=c},zn.isSet=aa,zn.isString=la,zn.isSymbol=ca,zn.isTypedArray=ua,zn.isUndefined=function(t){return t===e},zn.isWeakMap=function(e){return na(e)&&pi(e)==T},zn.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":qt.call(e,t)},zn.kebabCase=qa,zn.last=Zi,zn.lastIndexOf=function(t,n,r){var o=null==t?0:t.length;if(!o)return-1;var i=o;return r!==e&&(i=(i=ma(r))<0?gn(o+i,0):yn(i,o-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,i):Pt(t,Ht,i,!0)},zn.lowerCase=Wa,zn.lowerFirst=Ya,zn.lt=da,zn.lte=ha,zn.max=function(t){return t&&t.length?pr(t,ol,Er):e},zn.maxBy=function(t,n){return t&&t.length?pr(t,ai(n,2),Er):e},zn.mean=function(e){return Vt(e,ol)},zn.meanBy=function(e,t){return Vt(e,ai(t,2))},zn.min=function(t){return t&&t.length?pr(t,ol,Ir):e},zn.minBy=function(t,n){return t&&t.length?pr(t,ai(n,2),Ir):e},zn.stubArray=gl,zn.stubFalse=yl,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Sl,zn.nth=function(t,n){return t&&t.length?Br(t,ma(n)):e},zn.noConflict=function(){return ht._===this&&(ht._=Pe),this},zn.noop=cl,zn.now=Rs,zn.pad=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Vo(ft(o),n)+e+Vo(pt(o),n)},zn.padEnd=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;return t&&r<t?e+Vo(t-r,n):e},zn.padStart=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;return t&&r<t?Vo(t-r,n)+e:e},zn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),vn(va(e).replace(re,""),t||0)},zn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&bi(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=fa(t),n===e?(n=t,t=0):n=fa(n)),t>n){var o=t;t=n,n=o}if(r||t%1||n%1){var i=wn();return yn(t+i*(n-t+lt("1e-"+((i+"").length-1))),n)}return Wr(t,n)},zn.reduce=function(e,t,n){var r=qs(e)?$t:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,ur)},zn.reduceRight=function(e,t,n){var r=qs(e)?Lt:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,dr)},zn.repeat=function(t,n,r){return n=(r?bi(t,n,r):n===e)?1:ma(n),Yr(va(t),n)},zn.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(t,n,r){var o=-1,i=(n=bo(n,t)).length;for(i||(i=1,t=e);++o<i;){var s=null==t?e:t[zi(n[o])];s===e&&(o=i,s=r),t=Qs(s)?s.call(t):s}return t},zn.round=El,zn.runInContext=i,zn.sample=function(e){return(qs(e)?Kn:Kr)(e)},zn.size=function(e){if(null==e)return 0;if(Ys(e))return la(e)?un(e):e.length;var t=pi(e);return t==w||t==R?e.size:$r(e).length},zn.snakeCase=Ja,zn.some=function(t,n,r){var o=qs(t)?It:no;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.sortedIndex=function(e,t){return ro(e,t)},zn.sortedIndexBy=function(e,t,n){return oo(e,t,ai(n,2))},zn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ro(e,t);if(r<n&&Bs(e[r],t))return r}return-1},zn.sortedLastIndex=function(e,t){return ro(e,t,!0)},zn.sortedLastIndexBy=function(e,t,n){return oo(e,t,ai(n,2),!0)},zn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ro(e,t,!0)-1;if(Bs(e[n],t))return n}return-1},zn.startCase=Ka,zn.startsWith=function(e,t,n){return e=va(e),n=null==n?0:ir(ma(n),0,e.length),t=ao(t),e.slice(n,n+t.length)==t},zn.subtract=Cl,zn.sum=function(e){return e&&e.length?Yt(e,ol):0},zn.sumBy=function(e,t){return e&&e.length?Yt(e,ai(t,2)):0},zn.template=function(t,n,r){var o=zn.templateSettings;r&&bi(t,n,r)&&(n=e),t=va(t),n=ka({},n,o,Zo);var i,s,a=ka({},n.imports,o.imports,Zo),l=Aa(a),c=Zt(a,l),u=0,d=n.interpolate||ve,h="__p += '",p=Me((n.escape||ve).source+"|"+d.source+"|"+(d===Z?de:ve).source+"|"+(n.evaluate||ve).source+"|$","g"),f="//# sourceURL="+($e.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";t.replace(p,function(e,n,r,o,a,l){return r||(r=o),h+=t.slice(u,l).replace(we,rn),n&&(i=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+e.length,e}),h+="';\n";var m=$e.call(n,"variable")&&n.variable;if(m){if(ce.test(m))throw new ke("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(H,""):h).replace(V,"$1").replace(U,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Xa(function(){return Se(l,f+"return "+h).apply(e,c)});if(g.source=h,Zs(g))throw g;return g},zn.times=function(e,t){if((e=ma(e))<1||e>c)return[];var n=d,r=yn(e,d);t=ai(t),e-=d;for(var o=Jt(r,t);++n<e;)t(n);return o},zn.toFinite=fa,zn.toInteger=ma,zn.toLength=ga,zn.toLower=function(e){return va(e).toLowerCase()},zn.toNumber=ya,zn.toSafeInteger=function(e){return e?ir(ma(e),-9007199254740991,c):0===e?e:0},zn.toString=va,zn.toUpper=function(e){return va(e).toUpperCase()},zn.trim=function(t,n,r){if((t=va(t))&&(r||n===e))return Kt(t);if(!t||!(n=ao(n)))return t;var o=dn(t),i=dn(n);return wo(o,Xt(o,i),en(o,i)+1).join("")},zn.trimEnd=function(t,n,r){if((t=va(t))&&(r||n===e))return t.slice(0,hn(t)+1);if(!t||!(n=ao(n)))return t;var o=dn(t);return wo(o,0,en(o,dn(n))+1).join("")},zn.trimStart=function(t,n,r){if((t=va(t))&&(r||n===e))return t.replace(re,"");if(!t||!(n=ao(n)))return t;var o=dn(t);return wo(o,Xt(o,dn(n))).join("")},zn.truncate=function(t,n){var r=30,o="...";if(ta(n)){var i="separator"in n?n.separator:i;r="length"in n?ma(n.length):r,o="omission"in n?ao(n.omission):o}var s=(t=va(t)).length;if(on(t)){var a=dn(t);s=a.length}if(r>=s)return t;var l=r-un(o);if(l<1)return o;var c=a?wo(a,0,l).join(""):t.slice(0,l);if(i===e)return c+o;if(a&&(l+=c.length-l),sa(i)){if(t.slice(l).search(i)){var u,d=c;for(i.global||(i=Me(i.source,va(he.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var h=u.index;c=c.slice(0,h===e?l:h)}}else if(t.indexOf(ao(i),l)!=l){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+o},zn.unescape=function(e){return(e=va(e))&&Y.test(e)?e.replace(q,pn):e},zn.uniqueId=function(e){var t=++Le;return va(e)+t},zn.upperCase=Ga,zn.upperFirst=Za,zn.each=vs,zn.eachRight=ws,zn.first=Yi,ll(zn,(bl={},br(zn,function(e,t){$e.call(zn.prototype,t)||(bl[t]=e)}),bl),{chain:!1}),zn.VERSION="4.17.23",Mt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){zn[e].placeholder=zn}),Mt(["drop","take"],function(t,n){Hn.prototype[t]=function(r){r=r===e?1:gn(ma(r),0);var o=this.__filtered__&&!n?new Hn(this):this.clone();return o.__filtered__?o.__takeCount__=yn(r,o.__takeCount__):o.__views__.push({size:yn(r,d),type:t+(o.__dir__<0?"Right":"")}),o},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Mt(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Hn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ai(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Mt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}}),Mt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Hn.prototype[e]=function(){return this.__filtered__?new Hn(this):this[n](1)}}),Hn.prototype.compact=function(){return this.filter(ol)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=Jr(function(e,t){return"function"==typeof e?new Hn(this):this.map(function(n){return Nr(n,e,t)})}),Hn.prototype.reject=function(e){return this.filter(Is(ai(e)))},Hn.prototype.slice=function(t,n){t=ma(t);var r=this;return r.__filtered__&&(t>0||n<0)?new Hn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=ma(n))<0?r.dropRight(-n):r.take(n-t)),r)},Hn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hn.prototype.toArray=function(){return this.take(d)},br(Hn.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),o=/^(?:head|last)$/.test(n),i=zn[o?"take"+("last"==n?"Right":""):n],s=o||/^find/.test(n);i&&(zn.prototype[n]=function(){var n=this.__wrapped__,a=o?[1]:arguments,l=n instanceof Hn,c=a[0],u=l||qs(n),d=function(e){var t=i.apply(zn,Dt([e],a));return o&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,m=l&&!p;if(!s&&u){n=m?n:new Hn(this);var g=t.apply(n,a);return g.__actions__.push({func:fs,args:[d],thisArg:e}),new Bn(g,h)}return f&&m?t.apply(this,a):(g=this.thru(d),f?o?g.value()[0]:g.value():g)})}),Mt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Oe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(qs(o)?o:[],e)}return this[n](function(n){return t.apply(qs(n)?n:[],e)})}}),br(Hn.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";$e.call(On,r)||(On[r]=[]),On[r].push({name:t,func:n})}}),On[Po(e,2).name]=[{name:"wrapper",func:e}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=No(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=No(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=No(this.__views__),e},Hn.prototype.reverse=function(){if(this.__filtered__){var e=new Hn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qs(e),r=t<0,o=n?e.length:0,i=function(e,t,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=yn(t,e+s);break;case"takeRight":e=gn(e,t-s)}}return{start:e,end:t}}(0,o,this.__views__),s=i.start,a=i.end,l=a-s,c=r?a:s-1,u=this.__iteratees__,d=u.length,h=0,p=yn(l,this.__takeCount__);if(!n||!r&&o==l&&p==l)return po(e,this.__actions__);var f=[];e:for(;l--&&h<p;){for(var m=-1,g=e[c+=t];++m<d;){var y=u[m],b=y.iteratee,v=y.type,w=b(g);if(2==v)g=w;else if(!w){if(1==v)continue e;break e}}f[h++]=g}return f},zn.prototype.at=ms,zn.prototype.chain=function(){return ps(this)},zn.prototype.commit=function(){return new Bn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===e&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},zn.prototype.plant=function(t){for(var n,r=this;r instanceof Fn;){var o=Fi(r);o.__index__=0,o.__values__=e,n?i.__wrapped__=o:n=o;var i=o;r=r.__wrapped__}return i.__wrapped__=t,n},zn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var n=t;return this.__actions__.length&&(n=new Hn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[ts],thisArg:e}),new Bn(n,this.__chain__)}return this.thru(ts)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return po(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Ge&&(zn.prototype[Ge]=function(){return this}),zn}();ft?((ft.exports=fn)._=fn,pt._=fn):ht._=fn}.call(C.exports));const _=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),A="-",D=[],$=e=>{const t=j(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return I(e);const n=e.split(A),r=""===n[0]&&n.length>1?1:0;return L(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],o=n[e];return t?o?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(o,t):t:o||D}return n[e]||D}}},L=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=L(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(A):e.slice(t).join(A),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},I=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),j=e=>{const{theme:t,classGroups:n}=e;return z(n,t)},z=(e,t)=>{const n=_();for(const r in e){const o=e[r];P(o,n,r,t)}return n},P=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];F(o,t,n,r)}},F=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?V(e,t,n,r):H(e,t,n,r):B(e,t,n)},B=(e,t,n)=>{(""===e?t:U(t,e)).classGroupId=n},H=(e,t,n,r)=>{q(e)?P(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},V=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];P(i,U(t,e),n,r)}},U=(e,t)=>{let n=e;const r=t.split(A),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=_(),n.nextPart.set(e,t)),n=t}return n},q=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,W=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set(e,t){e in n?n[e]=t:o(e,t)}}},Y=[],J=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),K=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,i=0;const s=e.length;for(let u=0;u<s;u++){const s=e[u];if(0===r&&0===o){if(":"===s){t.push(e.slice(i,u)),i=u+1;continue}if("/"===s){n=u;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.slice(i);let l=a,c=!1;a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0);return J(t,c,l,n&&n>i?n-i:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):J(Y,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},G=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let o=0;o<e.length;o++){const i=e[o],s="["===i[0],a=t.has(i);s||a?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(i)):r.push(i)}return r.length>0&&(r.sort(),n.push(...r)),n}},Z=/\s+/,Q=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Q(e[r]))&&(n&&(n+=" "),n+=t);return n},X=[],ee=e=>{const t=t=>t[e]||X;return t.isThemeGetter=!0,t},te=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,re=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,oe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,se=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,le=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=e=>re.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),de=e=>!!e&&Number.isInteger(Number(e)),he=e=>e.endsWith("%")&&ue(e.slice(0,-1)),pe=e=>oe.test(e),fe=()=>!0,me=e=>ie.test(e)&&!se.test(e),ge=()=>!1,ye=e=>ae.test(e),be=e=>le.test(e),ve=e=>!xe(e)&&!Oe(e),we=e=>je(e,Be,ge),xe=e=>te.test(e),ke=e=>je(e,He,me),Se=e=>je(e,Ve,ue),Ee=e=>je(e,qe,fe),Ce=e=>je(e,Ue,ge),Me=e=>je(e,Pe,ge),Re=e=>je(e,Fe,be),Ne=e=>je(e,We,ye),Oe=e=>ne.test(e),Te=e=>ze(e,He),_e=e=>ze(e,Ue),Ae=e=>ze(e,Pe),De=e=>ze(e,Be),$e=e=>ze(e,Fe),Le=e=>ze(e,We,!0),Ie=e=>ze(e,qe,!0),je=(e,t,n)=>{const r=te.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},ze=(e,t,n=!1)=>{const r=ne.exec(e);return!!r&&(r[1]?t(r[1]):n)},Pe=e=>"position"===e||"percentage"===e,Fe=e=>"image"===e||"url"===e,Be=e=>"length"===e||"size"===e||"bg-size"===e,He=e=>"length"===e,Ve=e=>"number"===e,Ue=e=>"family-name"===e,qe=e=>"number"===e||"weight"===e,We=e=>"shadow"===e,Ye=((e,...t)=>{let n,r,o,i;const s=e=>{const t=r(e);if(t)return t;const i=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(Z);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let f=!!p,m=r(f?h.substring(0,p):h);if(!m){if(!f){l=e+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=e+(l.length>0?" "+l:l);continue}f=!1}const g=0===u.length?"":1===u.length?u[0]:i(u).join(":"),y=d?g+"!":g,b=y+m;if(s.indexOf(b)>-1)continue;s.push(b);const v=o(m,f);for(let n=0;n<v.length;++n){const e=v[n];s.push(y+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i};return i=a=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:W(e.cacheSize),parseClassName:K(e),sortModifiers:G(e),...$(e)}))(l),r=n.cache.get,o=n.cache.set,i=s,s(a)},(...e)=>i(((...e)=>{let t,n,r=0,o="";for(;r<e.length;)(t=e[r++])&&(n=Q(t))&&(o&&(o+=" "),o+=n);return o})(...e))})(()=>{const e=ee("color"),t=ee("font"),n=ee("text"),r=ee("font-weight"),o=ee("tracking"),i=ee("leading"),s=ee("breakpoint"),a=ee("container"),l=ee("spacing"),c=ee("radius"),u=ee("shadow"),d=ee("inset-shadow"),h=ee("text-shadow"),p=ee("drop-shadow"),f=ee("blur"),m=ee("perspective"),g=ee("aspect"),y=ee("ease"),b=ee("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Oe,xe],w=()=>[Oe,xe,l],x=()=>[ce,"full","auto",...w()],k=()=>[de,"none","subgrid",Oe,xe],S=()=>["auto",{span:["full",de,Oe,xe]},de,Oe,xe],E=()=>[de,"auto",Oe,xe],C=()=>["auto","min","max","fr",Oe,xe],M=()=>["auto",...w()],R=()=>[ce,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[ce,"screen","full","dvw","lvw","svw","min","max","fit",...w()],O=()=>[ce,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],T=()=>[e,Oe,xe],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ae,Me,{position:[Oe,xe]}],A=()=>["auto","cover","contain",De,we,{size:[Oe,xe]}],D=()=>[he,Te,ke],$=()=>["","none","full",c,Oe,xe],L=()=>["",ue,Te,ke],I=()=>[ue,he,Ae,Me],j=()=>["","none",f,Oe,xe],z=()=>["none",ue,Oe,xe],P=()=>["none",ue,Oe,xe],F=()=>[ue,Oe,xe],B=()=>[ce,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pe],breakpoint:[pe],color:[fe],container:[pe],"drop-shadow":[pe],ease:["in","out","in-out"],font:[ve],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pe],shadow:[pe],spacing:["px",ue],text:[pe],"text-shadow":[pe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ce,xe,Oe,g]}],container:["container"],columns:[{columns:[ue,xe,Oe,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[de,"auto",Oe,xe]}],basis:[{basis:[ce,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,ce,"auto","initial","none",xe]}],grow:[{grow:["",ue,Oe,xe]}],shrink:[{shrink:["",ue,Oe,xe]}],order:[{order:[de,"first","last","none",Oe,xe]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":C()}],"auto-rows":[{"auto-rows":C()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],"inline-size":[{inline:["auto",...N()]}],"min-inline-size":[{"min-inline":["auto",...N()]}],"max-inline-size":[{"max-inline":["none",...N()]}],"block-size":[{block:["auto",...O()]}],"min-block-size":[{"min-block":["auto",...O()]}],"max-block-size":[{"max-block":["none",...O()]}],w:[{w:[a,"screen",...R()]}],"min-w":[{"min-w":[a,"screen","none",...R()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Te,ke]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ie,Ee]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",he,xe]}],"font-family":[{font:[_e,Ce,t]}],"font-features":[{"font-features":[xe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Oe,xe]}],"line-clamp":[{"line-clamp":[ue,"none",Oe,Se]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Oe,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",Oe,ke]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[ue,"auto",Oe,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oe,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},de,Oe,xe],radial:["",Oe,xe],conic:[de,Oe,xe]},$e,Re]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[ue,Oe,xe]}],"outline-w":[{outline:["",ue,Te,ke]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",u,Le,Ne]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",d,Le,Ne]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[ue,ke]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,Le,Ne]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[ue,Oe,xe]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[Oe,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,xe]}],filter:[{filter:["","none",Oe,xe]}],blur:[{blur:j()}],brightness:[{brightness:[ue,Oe,xe]}],contrast:[{contrast:[ue,Oe,xe]}],"drop-shadow":[{"drop-shadow":["","none",p,Le,Ne]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",ue,Oe,xe]}],"hue-rotate":[{"hue-rotate":[ue,Oe,xe]}],invert:[{invert:["",ue,Oe,xe]}],saturate:[{saturate:[ue,Oe,xe]}],sepia:[{sepia:["",ue,Oe,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,xe]}],"backdrop-blur":[{"backdrop-blur":j()}],"backdrop-brightness":[{"backdrop-brightness":[ue,Oe,xe]}],"backdrop-contrast":[{"backdrop-contrast":[ue,Oe,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,Oe,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,Oe,xe]}],"backdrop-invert":[{"backdrop-invert":["",ue,Oe,xe]}],"backdrop-opacity":[{"backdrop-opacity":[ue,Oe,xe]}],"backdrop-saturate":[{"backdrop-saturate":[ue,Oe,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,Oe,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",Oe,xe]}],ease:[{ease:["linear","initial",y,Oe,xe]}],delay:[{delay:[ue,Oe,xe]}],animate:[{animate:["none",b,Oe,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Oe,xe]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:z()}],"rotate-x":[{"rotate-x":z()}],"rotate-y":[{"rotate-y":z()}],"rotate-z":[{"rotate-z":z()}],scale:[{scale:P()}],"scale-x":[{"scale-x":P()}],"scale-y":[{"scale-y":P()}],"scale-z":[{"scale-z":P()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Oe,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:B()}],"translate-x":[{"translate-x":B()}],"translate-y":[{"translate-y":B()}],"translate-z":[{"translate-z":B()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe,xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe,xe]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[ue,Te,ke,Se]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Je(...e){return Ye(function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=T(e))&&(r&&(r+=" "),r+=t);return r}(e))}const Ke=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Ge=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Qe=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},Xe=e.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:s,iconNode:a,...l},c)=>e.createElement("svg",{ref:c,...Ze,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:Ke("lucide",i),...!s&&!Qe(l)&&{"aria-hidden":"true"},...l},[...a.map(([t,n])=>e.createElement(t,n)),...Array.isArray(s)?s:[s]])),et=(t,n)=>{const r=e.forwardRef(({className:r,...o},i)=>{return e.createElement(Xe,{ref:i,iconNode:n,className:Ke(`lucide-${s=Ge(t),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,r),...o});var s});return r.displayName=Ge(t),r},tt=et("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),nt=et("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),rt=et("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),ot=et("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),it=et("highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]),st=et("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),at=et("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),lt=et("list-indent-decrease",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]),ct=et("list-indent-increase",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]),ut=et("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]),dt=et("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ht=et("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),pt=et("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),ft=et("paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]),mt=et("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),gt=et("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),yt=et("remove-formatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]),bt=et("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),vt=et("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),wt=et("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),xt=et("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),kt=et("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),St=et("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),Et=et("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),Ct=et("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]),Mt=et("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Rt=e.createContext({});function Nt(){return Nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nt.apply(null,arguments)}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _t(e){return(_t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function At(e){var t=function(e,t){if("object"!=_t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=_t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_t(t)?t:t+""}function Dt(e,t,n){return(t=At(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $t(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Lt,It={exports:{}};var jt=(Lt||(Lt=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var i in e)t.call(e,i)&&e[i]&&(r=o(r,i));return r}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(It)),It.exports);const zt=s(jt),Pt=Math.round;function Ft(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Bt=(e,t,n)=>0===n?e:e/100;function Ht(e,t){const n=t||255;return e>n?n:e<0?0:e}class Vt{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(Dt(this,"isValid",!0),Dt(this,"r",0),Dt(this,"g",0),Dt(this,"b",0),Dt(this,"a",1),Dt(this,"_h",void 0),Dt(this,"_s",void 0),Dt(this,"_l",void 0),Dt(this,"_v",void 0),Dt(this,"_max",void 0),Dt(this,"_min",void 0),Dt(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof Vt)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=Ht(e.r),this.g=Ht(e.g),this.b=Ht(e.b),this.a="number"==typeof e.a?Ht(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:Pt(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,o=e=>(n[e]-this[e])*r+this[e],i={r:Pt(o("r")),g:Pt(o("g")),b:Pt(o("b")),a:Pt(100*o("a"))/100};return this._c(i)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>Pt((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=Pt(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=Pt(100*this.getSaturation()),n=Pt(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=Ht(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=Pt(255*n);this.r=e,this.g=e,this.b=e}let o=0,i=0,s=0;const a=e/60,l=(1-Math.abs(2*n-1))*t,c=l*(1-Math.abs(a%2-1));a>=0&&a<1?(o=l,i=c):a>=1&&a<2?(o=c,i=l):a>=2&&a<3?(i=l,s=c):a>=3&&a<4?(i=c,s=l):a>=4&&a<5?(o=c,s=l):a>=5&&a<6&&(o=l,s=c);const u=n-l/2;this.r=Pt(255*(o+u)),this.g=Pt(255*(i+u)),this.b=Pt(255*(s+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const o=Pt(255*n);if(this.r=o,this.g=o,this.b=o,t<=0)return;const i=e/60,s=Math.floor(i),a=i-s,l=Pt(n*(1-t)*255),c=Pt(n*(1-t*a)*255),u=Pt(n*(1-t*(1-a))*255);switch(s){case 0:this.g=u,this.b=l;break;case 1:this.r=c,this.b=l;break;case 2:this.r=l,this.b=u;break;case 3:this.r=l,this.g=c;break;case 4:this.r=u,this.g=l;break;default:this.g=l,this.b=c}}fromHsvString(e){const t=Ft(e,Bt);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Ft(e,Bt);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Ft(e,(e,t)=>t.includes("%")?Pt(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var Ut=[{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 qt(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function Wt(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function Yt(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var Jt=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kt(Object(n),!0).forEach(function(t){Dt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Jt.primary=Jt[5];var Zt="data-rc-order",Qt="data-rc-priority",Xt=new Map;function en(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function tn(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function nn(e){return Array.from((Xt.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function rn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,o=t.priority,i=void 0===o?0:o,s=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),a="prependQueue"===s,l=document.createElement("style");l.setAttribute(Zt,s),a&&i&&l.setAttribute(Qt,"".concat(i)),null!=n&&n.nonce&&(l.nonce=null==n?void 0:n.nonce),l.innerHTML=e;var c=tn(t),u=c.firstChild;if(r){if(a){var d=(t.styles||nn(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(Zt)))return!1;var t=Number(e.getAttribute(Qt)||0);return i>=t});if(d.length)return c.insertBefore(l,d[d.length-1].nextSibling),l}c.insertBefore(l,u)}else c.appendChild(l);return l}function on(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=tn(n),o=nn(r),i=Gt(Gt({},n),{},{styles:o});!function(e,t){var n=Xt.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=rn("",t),o=r.parentNode;Xt.set(e,o),e.removeChild(r)}}(r,i);var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=tn(t);return(t.styles||nn(n)).find(function(n){return n.getAttribute(en(t))===e})}(t,i);if(s){var a,l,c;if(null!==(a=i.csp)&&void 0!==a&&a.nonce&&s.nonce!==(null===(l=i.csp)||void 0===l?void 0:l.nonce))s.nonce=null===(c=i.csp)||void 0===c?void 0:c.nonce;return s.innerHTML!==e&&(s.innerHTML=e),s}var u=rn(e,i);return u.setAttribute(en(i),t),u}function sn(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function an(e){return function(e){return sn(e)instanceof ShadowRoot}(e)?sn(e):null}var ln={};function cn(e,t){}function un(e,t){}function dn(e,t,n){t||ln[n]||(e(!1,n),ln[n]=!0)}function hn(e,t){dn(cn,e,t)}function pn(e){return"object"===_t(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===_t(e.icon)||"function"==typeof e.icon)}function fn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,o=e[n];if("class"===n)t.className=o,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=o;return t},{})}function mn(t,n,r){return r?e.createElement(t.tag,Gt(Gt({key:n},fn(t.attrs)),r),(t.children||[]).map(function(e,r){return mn(e,"".concat(n,"-").concat(t.tag,"-").concat(r))})):e.createElement(t.tag,Gt({key:n},fn(t.attrs)),(t.children||[]).map(function(e,r){return mn(e,"".concat(n,"-").concat(t.tag,"-").concat(r))}))}function gn(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Vt(e),o=r.toHsv(),i=5;i>0;i-=1){var s=new Vt({h:qt(o,i,!0),s:Wt(o,i,!0),v:Yt(o,i,!0)});n.push(s)}n.push(r);for(var a=1;a<=4;a+=1){var l=new Vt({h:qt(o,a),s:Wt(o,a),v:Yt(o,a)});n.push(l)}return"dark"===t.theme?Ut.map(function(e){var r=e.index,o=e.amount;return new Vt(t.backgroundColor||"#141414").mix(n[r],o).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function yn(e){return e?Array.isArray(e)?e:[e]:[]}hn.preMessage=function(e){},hn.resetWarned=function(){ln={}},hn.noteOnce=function(e,t){dn(un,e,t)};var bn=["icon","className","onClick","style","primaryColor","secondaryColor"],vn={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var wn=function(t){var n,r,i,s,a,l,c,u,d=t.icon,h=t.className,p=t.onClick,f=t.style,m=t.primaryColor,g=t.secondaryColor,y=$t(t,bn),b=o.useRef(),v=vn;if(m&&(v={primaryColor:m,secondaryColor:g||gn(m)}),n=b,r=e.useContext(Rt),i=r.csp,s=r.prefixCls,a=r.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)),a&&(l="@layer ".concat(a," {\n").concat(l,"\n}")),e.useEffect(function(){var e=an(n.current);on(l,"@ant-design-icons",{prepend:!a,csp:i,attachTo:e})},[]),c=pn(d),u="icon should be icon definiton, but got ".concat(d),hn(c,"[@ant-design/icons] ".concat(u)),!pn(d))return null;var w=d;return w&&"function"==typeof w.icon&&(w=Gt(Gt({},w),{},{icon:w.icon(v.primaryColor,v.secondaryColor)})),mn(w.icon,"svg-".concat(w.name),Gt(Gt({className:h,onClick:p,style:f,"data-icon":w.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function xn(e){var t=Tt(yn(e),2),n=t[0],r=t[1];return wn.setTwoToneColors({primaryColor:n,secondaryColor:r})}wn.displayName="IconReact",wn.getTwoToneColors=function(){return Gt({},vn)},wn.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;vn.primaryColor=t,vn.secondaryColor=n||gn(t),vn.calculated=!!n};var kn=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];xn(Jt.primary);var Sn=o.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,a=e.tabIndex,l=e.onClick,c=e.twoToneColor,u=$t(e,kn),d=o.useContext(Rt),h=d.prefixCls,p=void 0===h?"anticon":h,f=d.rootClassName,m=zt(f,p,Dt(Dt({},"".concat(p,"-").concat(r.name),!!r.name),"".concat(p,"-spin"),!!i||"loading"===r.name),n),g=a;void 0===g&&l&&(g=-1);var y=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,b=Tt(yn(c),2),v=b[0],w=b[1];return o.createElement("span",Nt({role:"img","aria-label":r.name},u,{ref:t,tabIndex:g,onClick:l,className:m}),o.createElement(wn,{icon:r,primaryColor:v,secondaryColor:w,style:y}))});Sn.displayName="AntdIcon",Sn.getTwoToneColor=function(){var e=wn.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Sn.setTwoToneColor=xn;var En,Cn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z"}}]},name:"apartment",theme:"outlined"},Mn=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Cn}))},Rn=o.forwardRef(Mn),Nn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},On=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Nn}))},Tn=o.forwardRef(On),_n={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},An=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:_n}))},Dn=o.forwardRef(An),$n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},Ln=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:$n}))},In=o.forwardRef(Ln),jn={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"},zn=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:jn}))},Pn=o.forwardRef(zn),Fn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},Bn=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Fn}))},Hn=o.forwardRef(Bn),Vn={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"},Un=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Vn}))},qn=o.forwardRef(Un),Wn={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"},Yn=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Wn}))},Jn=o.forwardRef(Yn),Kn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},Gn=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Kn}))},Zn=o.forwardRef(Gn),Qn={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"},Xn=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:Qn}))},er=o.forwardRef(Xn),tr={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},nr=function(e,t){return o.createElement(Sn,Nt({},e,{ref:t,icon:tr}))},rr=o.forwardRef(nr),or={},ir={exports:{}};function sr(){return En||(En=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(ir)),ir.exports}var ar,lr={};var cr,ur={},dr={},hr={},pr={exports:{}},fr={exports:{}},mr={exports:{}},gr={exports:{}};function yr(){return cr||(cr=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(gr)),gr.exports}var br,vr,wr,xr,kr={exports:{}};function Sr(){return vr||(vr=1,function(e){var t=yr().default,n=(br||(br=1,function(e){var t=yr().default;e.exports=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(kr)),kr.exports);e.exports=function(e){var r=n(e,"string");return"symbol"==t(r)?r:r+""},e.exports.__esModule=!0,e.exports.default=e.exports}(mr)),mr.exports}function Er(){return xr||(xr=1,function(e){var t=(wr||(wr=1,function(e){var t=Sr();e.exports=function(e,n,r){return(n=t(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}(fr)),fr.exports);function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}e.exports=function(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(n){t(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e},e.exports.__esModule=!0,e.exports.default=e.exports}(pr)),pr.exports}var Cr,Mr,Rr={};function Nr(){if(Mr)return hr;Mr=1;var e=sr().default;Object.defineProperty(hr,"__esModule",{value:!0}),hr.default=void 0;var t=e(Er()),n=(Cr||(Cr=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.commonLocale=void 0,Rr.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),Rr),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return hr.default=r,hr}var Or,Tr,_r,Ar,Dr,$r,Lr={};function Ir(){if(Or)return Lr;Or=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.default=void 0;return Lr.default={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Lr}function jr(){if(Tr)return dr;Tr=1;var e=sr().default;Object.defineProperty(dr,"__esModule",{value:!0}),dr.default=void 0;var t=e(Nr()),n=e(Ir());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",dr.default=r,dr}function zr(){if(_r)return ur;_r=1;var e=sr().default;Object.defineProperty(ur,"__esModule",{value:!0}),ur.default=void 0;var t=e(jr());return ur.default=t.default,ur}function Pr(){if(Ar)return or;Ar=1;var e=sr().default;Object.defineProperty(or,"__esModule",{value:!0}),or.default=void 0;var t=e((ar||(ar=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.default=void 0,lr.default={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"}),lr)),n=e(zr()),r=e(jr()),o=e(Ir());const i="${label}不是一个有效的${type}",s={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:o.default,Calendar:n.default,global:{placeholder:"请选择",close:"关闭"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return or.default=s,or}function Fr(){return $r?Dr:($r=1,Dr=Pr())}const Br=s(Fr());function Hr(e,t){return function(){return e.apply(t,arguments)}}const{toString:Vr}=Object.prototype,{getPrototypeOf:Ur}=Object,{iterator:qr,toStringTag:Wr}=Symbol,Yr=(e=>t=>{const n=Vr.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Jr=e=>(e=e.toLowerCase(),t=>Yr(t)===e),Kr=e=>t=>typeof t===e,{isArray:Gr}=Array,Zr=Kr("undefined");function Qr(e){return null!==e&&!Zr(e)&&null!==e.constructor&&!Zr(e.constructor)&&to(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xr=Jr("ArrayBuffer");const eo=Kr("string"),to=Kr("function"),no=Kr("number"),ro=e=>null!==e&&"object"==typeof e,oo=e=>{if("object"!==Yr(e))return!1;const t=Ur(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Wr in e||qr in e)},io=Jr("Date"),so=Jr("File"),ao=Jr("Blob"),lo=Jr("FileList");const co="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},uo=void 0!==co.FormData?co.FormData:void 0,ho=Jr("URLSearchParams"),[po,fo,mo,go]=["ReadableStream","Request","Response","Headers"].map(Jr);function yo(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Gr(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Qr(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function bo(e,t){if(Qr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const vo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,wo=e=>!Zr(e)&&e!==vo;const xo=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Ur(Uint8Array)),ko=Jr("HTMLFormElement"),So=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Eo=Jr("RegExp"),Co=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};yo(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Mo=Jr("AsyncFunction"),Ro=(No="function"==typeof setImmediate,Oo=to(vo.postMessage),No?setImmediate:Oo?(To=`axios@${Math.random()}`,_o=[],vo.addEventListener("message",({source:e,data:t})=>{e===vo&&t===To&&_o.length&&_o.shift()()},!1),e=>{_o.push(e),vo.postMessage(To,"*")}):e=>setTimeout(e));var No,Oo,To,_o;const Ao="undefined"!=typeof queueMicrotask?queueMicrotask.bind(vo):"undefined"!=typeof process&&process.nextTick||Ro,Do={isArray:Gr,isArrayBuffer:Xr,isBuffer:Qr,isFormData:e=>{let t;return e&&(uo&&e instanceof uo||to(e.append)&&("formdata"===(t=Yr(e))||"object"===t&&to(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Xr(e.buffer),t},isString:eo,isNumber:no,isBoolean:e=>!0===e||!1===e,isObject:ro,isPlainObject:oo,isEmptyObject:e=>{if(!ro(e)||Qr(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:po,isRequest:fo,isResponse:mo,isHeaders:go,isUndefined:Zr,isDate:io,isFile:so,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:ao,isRegExp:Eo,isFunction:to,isStream:e=>ro(e)&&to(e.pipe),isURLSearchParams:ho,isTypedArray:xo,isFileList:lo,forEach:yo,merge:function e(){const{caseless:t,skipUndefined:n}=wo(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t&&bo(r,i)||i;oo(r[s])&&oo(o)?r[s]=e(r[s],o):oo(o)?r[s]=e({},o):Gr(o)?r[s]=o.slice():n&&Zr(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&yo(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(yo(t,(t,r)=>{n&&to(t)?Object.defineProperty(e,r,{value:Hr(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Ur(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Yr,kindOfTest:Jr,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Gr(e))return e;let t=e.length;if(!no(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[qr]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ko,hasOwnProperty:So,hasOwnProp:So,reduceDescriptors:Co,freezeMethods:e=>{Co(e,(t,n)=>{if(to(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];to(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Gr(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:bo,global:vo,isContextDefined:wo,isSpecCompliantForm:function(e){return!!(e&&to(e.append)&&"FormData"===e[Wr]&&e[qr])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(ro(e)){if(t.indexOf(e)>=0)return;if(Qr(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Gr(e)?[]:{};return yo(e,(e,t)=>{const i=n(e,r+1);!Zr(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Mo,isThenable:e=>e&&(ro(e)||to(e))&&to(e.then)&&to(e.catch),setImmediate:Ro,asap:Ao,isIterable:e=>null!=e&&to(e[qr])};let $o=class e extends Error{static from(t,n,r,o,i,s){const a=new e(t.message,n||t.code,r,o,i);return a.cause=t,a.name=t.name,null!=t.status&&null==a.status&&(a.status=t.status),s&&Object.assign(a,s),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Do.toJSONObject(this.config),code:this.code,status:this.status}}};$o.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",$o.ERR_BAD_OPTION="ERR_BAD_OPTION",$o.ECONNABORTED="ECONNABORTED",$o.ETIMEDOUT="ETIMEDOUT",$o.ERR_NETWORK="ERR_NETWORK",$o.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",$o.ERR_DEPRECATED="ERR_DEPRECATED",$o.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",$o.ERR_BAD_REQUEST="ERR_BAD_REQUEST",$o.ERR_CANCELED="ERR_CANCELED",$o.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",$o.ERR_INVALID_URL="ERR_INVALID_URL";function Lo(e){return Do.isPlainObject(e)||Do.isArray(e)}function Io(e){return Do.endsWith(e,"[]")?e.slice(0,-2):e}function jo(e,t,n){return e?e.concat(t).map(function(e,t){return e=Io(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const zo=Do.toFlatObject(Do,{},null,function(e){return/^is[A-Z]/.test(e)});function Po(e,t,n){if(!Do.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Do.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Do.isUndefined(t[e])})).metaTokens,o=n.visitor||c,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Do.isSpecCompliantForm(t);if(!Do.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Do.isDate(e))return e.toISOString();if(Do.isBoolean(e))return e.toString();if(!a&&Do.isBlob(e))throw new $o("Blob is not supported. Use a Buffer instead.");return Do.isArrayBuffer(e)||Do.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let a=e;if(Do.isReactNative(t)&&Do.isReactNativeBlob(e))return t.append(jo(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(Do.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Do.isArray(e)&&function(e){return Do.isArray(e)&&!e.some(Lo)}(e)||(Do.isFileList(e)||Do.endsWith(n,"[]"))&&(a=Do.toArray(e)))return n=Io(n),a.forEach(function(e,r){!Do.isUndefined(e)&&null!==e&&t.append(!0===s?jo([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!Lo(e)||(t.append(jo(o,n,i),l(e)),!1)}const u=[],d=Object.assign(zo,{defaultVisitor:c,convertValue:l,isVisitable:Lo});if(!Do.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Do.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),Do.forEach(n,function(n,i){!0===(!(Do.isUndefined(n)||null===n)&&o.call(t,n,Do.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function Fo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Bo(e,t){this._pairs=[],e&&Po(e,this,t)}const Ho=Bo.prototype;function Vo(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Uo(e,t,n){if(!t)return e;const r=n&&n.encode||Vo,o=Do.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let s;if(s=i?i(t,o):Do.isURLSearchParams(t)?t.toString():new Bo(t,o).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}Ho.append=function(e,t){this._pairs.push([e,t])},Ho.toString=function(e){const t=e?function(t){return e.call(this,t,Fo)}:Fo;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class qo{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Do.forEach(this.handlers,function(t){null!==t&&e(t)})}}const Wo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Yo={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Bo,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Jo="undefined"!=typeof window&&"undefined"!=typeof document,Ko="object"==typeof navigator&&navigator||void 0,Go=Jo&&(!Ko||["ReactNative","NativeScript","NS"].indexOf(Ko.product)<0),Zo="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Qo=Jo&&window.location.href||"http://localhost",Xo={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Jo,hasStandardBrowserEnv:Go,hasStandardBrowserWebWorkerEnv:Zo,navigator:Ko,origin:Qo},Symbol.toStringTag,{value:"Module"})),...Yo};function ei(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&Do.isArray(r)?r.length:i,a)return Do.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&Do.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Do.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(Do.isFormData(e)&&Do.isFunction(e.entries)){const n={};return Do.forEachEntry(e,(e,r)=>{t(function(e){return Do.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const ti={transitional:Wo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Do.isObject(e);o&&Do.isHTMLForm(e)&&(e=new FormData(e));if(Do.isFormData(e))return r?JSON.stringify(ei(e)):e;if(Do.isArrayBuffer(e)||Do.isBuffer(e)||Do.isStream(e)||Do.isFile(e)||Do.isBlob(e)||Do.isReadableStream(e))return e;if(Do.isArrayBufferView(e))return e.buffer;if(Do.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Po(e,new Xo.classes.URLSearchParams,{visitor:function(e,t,n,r){return Xo.isNode&&Do.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Do.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Po(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Do.isString(e))try{return(t||JSON.parse)(e),Do.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ti.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Do.isResponse(e)||Do.isReadableStream(e))return e;if(e&&Do.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(n){if("SyntaxError"===o.name)throw $o.from(o,$o.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xo.classes.FormData,Blob:Xo.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Do.forEach(["delete","get","head","post","put","patch"],e=>{ti.headers[e]={}});const ni=Do.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ri=Symbol("internals");function oi(e){return e&&String(e).trim().toLowerCase()}function ii(e){return!1===e||null==e?e:Do.isArray(e)?e.map(ii):String(e)}function si(e,t,n,r,o){return Do.isFunction(r)?r.call(this,t,n):(o&&(t=n),Do.isString(t)?Do.isString(r)?-1!==t.indexOf(r):Do.isRegExp(r)?r.test(t):void 0:void 0)}let ai=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=oi(t);if(!o)throw new Error("header name must be a non-empty string");const i=Do.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ii(e))}const i=(e,t)=>Do.forEach(e,(e,n)=>o(e,n,t));if(Do.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Do.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ni[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Do.isObject(e)&&Do.isIterable(e)){let n,r,o={};for(const t of e){if(!Do.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Do.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=oi(e)){const n=Do.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Do.isFunction(t))return t.call(this,e,n);if(Do.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=oi(e)){const n=Do.findKey(this,e);return!(!n||void 0===this[n]||t&&!si(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=oi(e)){const o=Do.findKey(n,e);!o||t&&!si(0,n[o],o,t)||(delete n[o],r=!0)}}return Do.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!si(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Do.forEach(this,(r,o)=>{const i=Do.findKey(n,o);if(i)return t[i]=ii(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=ii(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Do.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Do.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ri]=this[ri]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=oi(e);t[r]||(!function(e,t){const n=Do.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Do.isArray(e)?e.forEach(r):r(e),this}};function li(e,t){const n=this||ti,r=t||n,o=ai.from(r.headers);let i=r.data;return Do.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ci(e){return!(!e||!e.__CANCEL__)}ai.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Do.reduceDescriptors(ai.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Do.freezeMethods(ai);let ui=class extends $o{constructor(e,t,n){super(null==e?"canceled":e,$o.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function di(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new $o("Request failed with status code "+n.status,[$o.ERR_BAD_REQUEST,$o.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const hi=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=r[s];o||(o=l),n[i]=a,r[i]=l;let u=s,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),l-o<t)return;const h=c&&l-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,l=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&i<=s?(s-i)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},pi=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},fi=e=>(...t)=>Do.asap(()=>e(...t)),mi=Xo.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Xo.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Xo.origin),Xo.navigator&&/(msie|trident)/i.test(Xo.navigator.userAgent)):()=>!0,gi=Xo.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Do.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Do.isString(r)&&a.push(`path=${r}`),Do.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),Do.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function yi(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const bi=e=>e instanceof ai?{...e}:e;function vi(e,t){t=t||{};const n={};function r(e,t,n,r){return Do.isPlainObject(e)&&Do.isPlainObject(t)?Do.merge.call({caseless:r},e,t):Do.isPlainObject(t)?Do.merge({},t):Do.isArray(t)?t.slice():t}function o(e,t,n,o){return Do.isUndefined(t)?Do.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Do.isUndefined(t))return r(void 0,t)}function s(e,t){return Do.isUndefined(t)?Do.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(bi(e),bi(t),0,!0)};return Do.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Do.hasOwnProp(l,r)?l[r]:o,s=i(e[r],t[r],r);Do.isUndefined(s)&&i!==a||(n[r]=s)}),n}const wi=e=>{const t=vi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=ai.from(s),t.url=Uo(yi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Do.isFormData(n))if(Xo.hasStandardBrowserEnv||Xo.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Do.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(Xo.hasStandardBrowserEnv&&(r&&Do.isFunction(r)&&(r=r(t)),r||!1!==r&&mi(t.url))){const e=o&&i&&gi.read(i);e&&s.set(o,e)}return t},xi="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=wi(e);let o=r.data;const i=ai.from(r.headers).normalize();let s,a,l,c,u,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){c&&c(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=ai.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());di(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new $o("Request aborted",$o.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new $o(r,$o.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Wo;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new $o(t,o.clarifyTimeoutError?$o.ETIMEDOUT:$o.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&Do.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Do.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([l,u]=hi(p,!0),m.addEventListener("progress",l)),h&&m.upload&&([a,c]=hi(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new ui(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===Xo.protocols.indexOf(y)?n(new $o("Unsupported protocol "+y+":",$o.ERR_BAD_REQUEST,e)):m.send(o||null)})},ki=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof $o?t:new ui(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new $o(`timeout of ${t}ms exceeded`,$o.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>Do.asap(s),a}},Si=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Ei=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ci=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Ei(e))yield*Si(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Mi}=Do,Ri=(({Request:e,Response:t})=>({Request:e,Response:t}))(Do.global),{ReadableStream:Ni,TextEncoder:Oi}=Do.global,Ti=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},_i=e=>{e=Do.merge.call({skipUndefined:!0},Ri,e);const{fetch:t,Request:n,Response:r}=e,o=t?Mi(t):"function"==typeof fetch,i=Mi(n),s=Mi(r);if(!o)return!1;const a=o&&Mi(Ni),l=o&&("function"==typeof Oi?(e=>t=>e.encode(t))(new Oi):async e=>new Uint8Array(await new n(e).arrayBuffer())),c=i&&a&&Ti(()=>{let e=!1;const t=new n(Xo.origin,{body:new Ni,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&Ti(()=>Do.isReadableStream(new r("").body)),d={stream:u&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new $o(`Response type '${e}' is not supported`,$o.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=Do.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Do.isBlob(e))return e.size;if(Do.isSpecCompliantForm(e)){const t=new n(Xo.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Do.isArrayBufferView(e)||Do.isArrayBuffer(e)?e.byteLength:(Do.isURLSearchParams(e)&&(e+=""),Do.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:l,cancelToken:p,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:w}=wi(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let k=ki([l,p&&p.toAbortSignal()],f),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let C;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(C=await h(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(Do.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=pi(C,hi(fi(g)));a=Ci(t.body,65536,e,n)}}Do.isString(v)||(v=v?"include":"omit");const t=i&&"credentials"in n.prototype,l={...w,signal:k,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};S=i&&new n(o,l);let p=await(i?x(S,w):x(o,l));const f=u&&("stream"===y||"response"===y);if(u&&(m||f&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=Do.toFiniteNumber(p.headers.get("content-length")),[n,o]=m&&pi(t,hi(fi(m),!0))||[];p=new r(Ci(p.body,65536,n,()=>{o&&o(),E&&E()}),e)}y=y||"text";let M=await d[Do.findKey(d,y)||"text"](p,e);return!f&&E&&E(),await new Promise((t,n)=>{di(t,n,{data:M,headers:ai.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:S})})}catch(M){if(E&&E(),M&&"TypeError"===M.name&&/Load failed|fetch/i.test(M.message))throw Object.assign(new $o("Network Error",$o.ERR_NETWORK,e,S,M&&M.response),{cause:M.cause||M});throw $o.from(M,M&&M.code,e,S,M&&M.response)}}},Ai=new Map,Di=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,l=i.length,c=Ai;for(;l--;)s=i[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:_i(t)),c=a;return a};Di();const $i={http:null,xhr:xi,fetch:{get:Di}};Do.forEach($i,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const Li=e=>`- ${e}`,Ii=e=>Do.isFunction(e)||null===e||!1===e;const ji={getAdapter:function(e,t){e=Do.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ii(r)&&(o=$i[(n=String(r)).toLowerCase()],void 0===o))throw new $o(`Unknown adapter '${n}'`);if(o&&(Do.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Li).join("\n"):" "+Li(e[0]):"as no adapter specified";throw new $o("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:$i};function zi(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ui(null,e)}function Pi(e){zi(e),e.headers=ai.from(e.headers),e.data=li.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ji.getAdapter(e.adapter||ti.adapter,e)(e).then(function(t){return zi(e),t.data=li.call(e,e.transformResponse,t),t.headers=ai.from(t.headers),t},function(t){return ci(t)||(zi(e),t&&t.response&&(t.response.data=li.call(e,e.transformResponse,t.response),t.response.headers=ai.from(t.response.headers))),Promise.reject(t)})}const Fi="1.13.6",Bi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Bi[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Hi={};Bi.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Fi+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new $o(r(o," has been removed"+(t?" in "+t:"")),$o.ERR_DEPRECATED);return t&&!Hi[o]&&(Hi[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Bi.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Vi={assertOptions:function(e,t,n){if("object"!=typeof e)throw new $o("options must be an object",$o.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new $o("option "+i+" must be "+n,$o.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new $o("Unknown option "+i,$o.ERR_BAD_OPTION)}},validators:Bi},Ui=Vi.validators;let qi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new qo,response:new qo}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=vi(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Vi.assertOptions(n,{silentJSONParsing:Ui.transitional(Ui.boolean),forcedJSONParsing:Ui.transitional(Ui.boolean),clarifyTimeoutError:Ui.transitional(Ui.boolean),legacyInterceptorReqResOrdering:Ui.transitional(Ui.boolean)},!1),null!=r&&(Do.isFunction(r)?t.paramsSerializer={serialize:r}:Vi.assertOptions(r,{encode:Ui.function,serialize:Ui.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Vi.assertOptions(t,{baseUrl:Ui.spelling("baseURL"),withXsrfToken:Ui.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Do.merge(o.common,o[t.method]);o&&Do.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ai.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||Wo;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[Pi.bind(this),void 0];for(e.unshift(...s),e.push(...l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=s.length;let h=t;for(;d<u;){const e=s[d++],t=s[d++];try{h=e(h)}catch(p){t.call(this,p);break}}try{c=Pi.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return Uo(yi((e=vi(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Do.forEach(["delete","get","head","options"],function(e){qi.prototype[e]=function(t,n){return this.request(vi(n||{},{method:e,url:t,data:(n||{}).data}))}}),Do.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(vi(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}qi.prototype[e]=t(),qi.prototype[e+"Form"]=t(!0)});const Wi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Wi).forEach(([e,t])=>{Wi[t]=e});const Yi=function e(t){const n=new qi(t),r=Hr(qi.prototype.request,n);return Do.extend(r,qi.prototype,n,{allOwnKeys:!0}),Do.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(vi(t,n))},r}(ti);Yi.Axios=qi,Yi.CanceledError=ui,Yi.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ui(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Yi.isCancel=ci,Yi.VERSION=Fi,Yi.toFormData=Po,Yi.AxiosError=$o,Yi.Cancel=Yi.CanceledError,Yi.all=function(e){return Promise.all(e)},Yi.spread=function(e){return function(t){return e.apply(null,t)}},Yi.isAxiosError=function(e){return Do.isObject(e)&&!0===e.isAxiosError},Yi.mergeConfig=vi,Yi.AxiosHeaders=ai,Yi.formToJSON=e=>ei(Do.isHTMLForm(e)?new FormData(e):e),Yi.getAdapter=ji.getAdapter,Yi.HttpStatusCode=Wi,Yi.default=Yi;const{Axios:Ji,AxiosError:Ki,CanceledError:Gi,isCancel:Zi,CancelToken:Qi,VERSION:Xi,all:es,Cancel:ts,isAxiosError:ns,spread:rs,toFormData:is,AxiosHeaders:ss,HttpStatusCode:as,formToJSON:ls,getAdapter:cs,mergeConfig:us}=Yi;const ds=Yi.create({baseURL:"/api/v6",timeout:3e5});async function hs(e,t){const n=await ds.get(`/data/${e}`,{params:{...t,top:t.top??20,skip:t.skip??0}}),r=n.data?.data||[];return{data:r,total:n.data?.totalCount??n.data?.total??r.length}}async function ps(e,t){const{objectName:n="",recordId:r="",parent:o="",collectionName:i="cfs.files.filerecord"}=t||{},s=new FormData;s.append("file",e),n&&s.append("object_name",n),r&&s.append("record_id",r),o&&s.append("parent",o);const a={},l=localStorage.getItem("steedos:spaceId"),c=localStorage.getItem("steedos:auth_token");l&&c&&(a.Authorization=`Bearer ${l},${c}`);return(await ds.post(`/files/${i}`,s,{headers:a,timeout:6e4})).data}function fs(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}ds.interceptors.request.use(e=>e);const ms=new Map,gs=new Map;function ys(e,t){return 0===e.length?"":t?e.join(","):e[0]}function bs({field:t,value:n,onChange:r,onFillFields:o,isTableMode:i=!1,hasError:s=!1,formValues:a}){const[l,c]=e.useState(!1),u=t.reference_to||"",d=!!t.pickerMultiple,h=t.lookupDisplayFields||["name"],p=h[0]||"name",f=e.useMemo(()=>!d&&t.lookupFillRules||[],[d,t.lookupFillRules]),m=e.useMemo(()=>{return e=t.lookupFilters,n=a||{},e?e.replace(/\{(\w+)\}/g,(e,t)=>n[t]??""):e;var e,n},[t.lookupFilters,a]),g=e.useMemo(()=>function(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>"object"==typeof e&&null!==e&&"_id"in e?e._id:String(e)).filter(Boolean);if("object"==typeof t&&null!==t&&"_id"in t)return[t._id]}catch{}return e.split(",").map(e=>e.trim()).filter(Boolean)}(n),[n]),[y,b]=e.useState(new Map);e.useEffect(()=>{if(!u||0===g.length)return;const e=g.filter(e=>!y.has(e));if(0===e.length)return;const t=JSON.stringify(["_id","in",e]);hs(u,{filters:t,fields:`_id,${p}`,top:e.length}).then(({data:e})=>{b(t=>{const n=new Map(t);for(const r of e)n.set(r._id,r[p]||r._id);return n})})},[u,g.join(","),p]);const v=e.useCallback(e=>{const t=g.filter(t=>t!==e);r(ys(t,d))},[g,r,d]),w=e.useCallback((e,t,n)=>{if(r(ys(e,d)),b(e=>{const n=new Map(e);for(const[r,o]of t)n.set(r,o);return n}),c(!1),!d&&f.length>0&&1===e.length&&o){const t=e=>{const t={};for(const n of f)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(t[n.targetField]=String(e[n.sourceField]));Object.keys(t).length>0&&o(t)};if(n){const r=f.map(e=>e.sourceField).filter(Boolean);if(r.every(e=>e in n))t(n);else{const n=JSON.stringify(["_id","=",e[0]]),o=["_id",...r].join(",");hs(u,{filters:n,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}else{const n=f.map(e=>e.sourceField).filter(Boolean),r=JSON.stringify(["_id","=",e[0]]),o=["_id",...n].join(",");hs(u,{filters:r,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}},[r,d,f,o,u]);return t.readonly?React.createElement("div",{className:(i?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-2")+" bg-gray-50/60 min-h-[34px]"},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},y.get(e)||e))):React.createElement("span",{className:"text-[13px] text-gray-400"},"—")):React.createElement(React.Fragment,null,React.createElement("div",{onClick:()=>u&&c(!0),className:"cursor-pointer smooth-transition "+(i?"w-full px-2.5 py-1.5 min-h-[34px] "+(s?"bg-red-100/90":"bg-amber-50/80 hover:bg-amber-50"):"border rounded-md px-3 py-2 min-h-[38px] "+(s?"border-red-200 bg-red-50":"border-gray-300 bg-white hover:border-indigo-300"))},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5 items-center"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] bg-indigo-50 text-indigo-700 border border-indigo-200 rounded-md px-2 py-0.5 max-w-[200px]"},React.createElement("span",{className:"truncate"},y.get(e)||e),React.createElement(Mt,{className:"w-3 h-3 text-indigo-300 hover:text-red-500 shrink-0 cursor-pointer",onClick:t=>{t.stopPropagation(),v(e)}})))):React.createElement("div",{className:"flex items-center gap-2 text-gray-400"},React.createElement(ot,{className:"w-4 h-4 shrink-0"}),React.createElement("span",{className:"text-[13px]"},u?"选择数据":"请先配置关联对象"),React.createElement(nt,{className:"w-3.5 h-3.5 ml-auto shrink-0"}))),l&&React.createElement(vs,{objectName:u,displayFields:h,multiple:d,selectedIds:g,filters:m,onConfirm:w,onClose:()=>c(!1)}))}function vs({objectName:n,displayFields:r,multiple:o,selectedIds:i,filters:s,onConfirm:a,onClose:l}){const[c,u]=e.useState([]),[d,h]=e.useState(0),[p,f]=e.useState(!1),[m,g]=e.useState(1),[y,b]=e.useState(""),[v,w]=e.useState(new Set(i)),[x,k]=e.useState([]),S=e.useRef(void 0),E=r[0]||"name";e.useEffect(()=>{(async function(e){if(!e)return[];const t=ms.get(e);if(t)return t;const n=gs.get(e);if(n)return n;const r=(async()=>{try{let t="";const n={},r=await fetch(`${t}/service/api/amis-metadata-objects/objects/${encodeURIComponent(e)}/fields/options`,{headers:n}),o=await r.json(),i=o?.data?.options??[];return ms.set(e,i),i}catch{return[]}finally{gs.delete(e)}})();return gs.set(e,r),r})(n).then(k)},[n]);const C=e.useMemo(()=>{const e=new Map;for(const t of x)e.set(t.value,t.label);return e},[x]),M=e.useCallback(async(e,t)=>{f(!0);try{const o=[];let i;s&&o.push(s),t&&o.push(JSON.stringify([E,"contains",t])),2===o.length?i=JSON.stringify([JSON.parse(o[0]),"and",JSON.parse(o[1])]):1===o.length&&(i=o[0]);const a=["_id",...r].join(","),l=await hs(n,{filters:i,fields:a,top:10,skip:10*(e-1),sort:`${E} asc`});u(l.data),h(l.total)}finally{f(!1)}},[n,r,E,s]);e.useEffect(()=>{M(m,y)},[m]);const R=e.useCallback(e=>{b(e),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{g(1),M(1,e)},300)},[M]),N=e.useMemo(()=>r.map(e=>({title:C.get(e)||e,dataIndex:e,key:e,ellipsis:!0,render:e=>null!=e?String(e):"-"})),[r,C]),O=e.useMemo(()=>({type:o?"checkbox":"radio",selectedRowKeys:[...v],onChange:e=>{if(w(new Set(e)),!o&&e.length>0){const t=e[0],n=c.find(e=>e._id===t),r=new Map;n&&r.set(t,n[E]||t),a([t],r,n)}}}),[o,v,c,E,a]);return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Modal,{open:!0,title:React.createElement("div",{className:"flex items-center gap-2"},React.createElement(ot,{className:"w-4 h-4 text-indigo-500"}),React.createElement("span",null,"选择数据")),width:Math.min(960,window.innerWidth-32),onCancel:l,onOk:o?()=>{const e=new Map;for(const t of c){const n=t._id;v.has(n)&&e.set(n,t[E]||n)}a([...v],e)}:void 0,okText:o?"确定"+(v.size>0?` (${v.size})`:""):void 0,cancelText:"取消",footer:o?void 0:null,destroyOnClose:!0,styles:{body:{padding:"12px 0"}}},React.createElement("div",{style:{padding:"0 0 12px"}},React.createElement(t.Input.Search,{placeholder:`搜索 ${C.get(E)||E}...`,allowClear:!0,onChange:e=>R(e.target.value),style:{width:"100%"}})),React.createElement(t.Table,{rowKey:"_id",columns:N,dataSource:c,loading:p,rowSelection:O,pagination:{current:m,pageSize:10,total:d,size:"small",showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>g(e)},size:"small",scroll:{x:"max-content"},style:{fontSize:13},onRow:e=>({onClick:()=>{const t=e._id;if(o)w(e=>{const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});else{const n=new Map;n.set(t,e[E]||t),a([t],n,e)}},style:{cursor:"pointer"}})})))}const ws=n=>{const{visible:r,multiple:o,loading:i,users:s,searchKeyword:a,searchInputValue:l,tempSelectedUsers:c,clearable:u,rootDeptInfo:d,deptPath:h,currentLevelDepts:p,showSelectedPanel:f,onDrillDown:m,onMobileBack:g,onDrillBack:y,onBackToRoot:b,onToggleSelectedPanel:v,onUserSearch:w,onAddUser:x,onRemoveUser:k,onToggleUser:S,onToggleSelectAll:E,onReorderUsers:C,onOk:M,onCancel:R,onClearAll:N}=n,O=s.length>0&&s.every(e=>c.find(t=>t._id===e._id)),T=!!a,{visibleCount:_,scrollContainerRef:A}=function(t,n=50,r=[]){const[o,i]=e.useState(n),s=e.useRef(null),[a,l]=e.useState(!1);e.useEffect(()=>{e.startTransition(()=>i(n)),s.current&&(s.current.scrollTop=0)},[...r,t,n]);const c=e.useCallback(e=>{s.current=e,l(!!e)},[]);return e.useEffect(()=>{const e=s.current;if(!e)return;const r=()=>{i(r=>r>=t?r:e.scrollHeight-e.scrollTop-e.clientHeight<120?Math.min(r+n,t):r)};e.addEventListener("scroll",r,{passive:!0});const o=requestAnimationFrame(()=>r());return()=>{e.removeEventListener("scroll",r),cancelAnimationFrame(o)}},[t,n,a]),{visibleCount:o,scrollContainerRef:c}}(s.length,50,[h.length,a]),D=e.useRef({dragging:!1,startIndex:-1,currentIndex:-1,startY:0,itemHeight:56,clone:null,listEl:null}),$=e.useRef(null),[L,I]=e.useState(null),[j,z]=e.useState(null),P=e.useCallback((e,t)=>{if(e.target.closest(".steedos-selected-remove-btn"))return;const n=e.touches[0],r=e.currentTarget,o=r.getBoundingClientRect(),i=r.cloneNode(!0);i.style.position="fixed",i.style.left=`${o.left}px`,i.style.top=`${o.top}px`,i.style.width=`${o.width}px`,i.style.zIndex="9999",i.style.boxShadow="0 8px 24px rgba(0,0,0,0.15)",i.style.borderRadius="8px",i.style.opacity="0.92",i.style.transition="box-shadow 0.2s",i.style.pointerEvents="none",document.body.appendChild(i),D.current={dragging:!0,startIndex:t,currentIndex:t,startY:n.clientY,itemHeight:o.height,clone:i,listEl:$.current},I(t),z(t),navigator.vibrate&&navigator.vibrate(20)},[]),F=e.useCallback(e=>{const t=D.current;if(!t.dragging||!t.clone)return;e.preventDefault();const n=e.touches[0].clientY-t.startY;t.clone.style.transform=`translateY(${n}px) scale(1.02)`;const r=Math.round(n/t.itemHeight)+t.startIndex,o=Math.max(0,Math.min(r,c.length-1));o!==t.currentIndex&&(t.currentIndex=o,z(o),navigator.vibrate&&navigator.vibrate(10))},[c.length]),B=e.useCallback(()=>{const e=D.current;if(!e.dragging)return;e.clone&&(e.clone.remove(),e.clone=null);const t=e.startIndex,n=e.currentIndex;e.dragging=!1,I(null),z(null),t!==n&&t>=0&&n>=0&&C(t,n)},[C]);return e.createElement(t.Drawer,{open:r,placement:"bottom",height:"100vh",closable:!1,destroyOnClose:!0,rootClassName:"steedos-mobile-drawer",onClose:R,styles:{body:{padding:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}}},e.createElement("style",null,"\n.steedos-mobile-drawer .ant-drawer-content-wrapper {\n border-radius: 0 !important;\n overflow: hidden;\n}\n.steedos-mobile-drawer .ant-drawer-header {\n padding: 12px 16px;\n border-bottom: none;\n}\n.steedos-mobile-drawer .ant-drawer-body {\n padding: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n.steedos-mobile-dept-card {\n display: flex;\n align-items: center;\n padding: 14px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-dept-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-user-card {\n display: flex;\n align-items: center;\n padding: 12px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-user-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-bottom-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 16px;\n padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));\n border-top: 1px solid #f0f0f0;\n background: #fff;\n}\n.steedos-mobile-selected-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: #fff;\n z-index: 20;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n"),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px 8px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:28,minWidth:60}},h.length>0&&e.createElement("span",{onClick:g,style:{color:"#1890ff",fontSize:18,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Hn,null)),e.createElement("span",{onClick:R,style:{color:"#666",fontSize:16,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Dn,null))),e.createElement("span",{style:{fontWeight:600,fontSize:16}},"选择人员"),e.createElement("div",{style:{minWidth:60,display:"flex",justifyContent:"flex-end"}},o&&s.length>0&&!T&&h.length>0&&e.createElement("span",{onClick:E,style:{fontSize:14,color:"#1890ff",cursor:"pointer",WebkitTapHighlightColor:"transparent"}},O?"取消全选":"全选"))),e.createElement("div",{style:{padding:"4px 16px 8px",flexShrink:0}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Zn,null),value:l,onChange:e=>w(e.target.value),allowClear:!0,size:"large"})),h.length>0&&!T&&e.createElement("div",{style:{height:8,background:"#f5f5f5",flexShrink:0}}),h.length>0&&!T&&(()=>{const t=h.length>2,n=h.length>2?h.slice(-2):h,r=h.length>2?h.length-2:0,o=e=>e.length>8?e.slice(0,8)+"…":e;return e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",fontSize:13,color:"#999",overflow:"hidden",whiteSpace:"nowrap",flexShrink:0,borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{onClick:b,style:{color:"#1890ff",cursor:"pointer",flexShrink:0,WebkitTapHighlightColor:"transparent"}},"联系人"),t&&e.createElement(e.Fragment,null,e.createElement(Jn,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),e.createElement("span",{style:{color:"#999",flexShrink:0,display:"flex",alignItems:"center",lineHeight:1}},"···")),n.map((t,n)=>{const i=r+n,s=i===h.length-1;return e.createElement(e.Fragment,{key:t.id},e.createElement(Jn,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),s?e.createElement("span",{style:{color:"#999",overflow:"hidden",textOverflow:"ellipsis"}},o(t.name)):e.createElement("span",{onClick:()=>y(i),style:{color:"#1890ff",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",WebkitTapHighlightColor:"transparent"}},o(t.name)))}))})(),e.createElement("div",{ref:A,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},e.createElement(t.Spin,{spinning:i},T||h.length>0||!d?null:e.createElement(e.Fragment,null,e.createElement("div",{className:"steedos-mobile-dept-card",onClick:()=>m(d.id,d.name)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(Rn,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15}},"通讯录")),e.createElement(Jn,{style:{color:"#ccc",fontSize:14,flexShrink:0}})),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),T||0===h.length||0===p.length?null:e.createElement(e.Fragment,null,p.map(t=>e.createElement("div",{key:t._id||t.id||t.key||t.value,className:"steedos-mobile-dept-card",onClick:()=>m(t._id||t.id||t.key||t.value,t.title||t.name||t.label)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(Rn,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.title||t.name||t.label)),e.createElement(Jn,{style:{color:"#ccc",fontSize:14,flexShrink:0}}))),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),e.createElement(e.Fragment,null,s.length>0?e.createElement(e.Fragment,null,s.slice(0,_).map(n=>{const r=!!c.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:"steedos-mobile-user-card",onClick:()=>S(n)},o&&e.createElement("div",{style:{width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:r?"#1890ff":"transparent",border:r?"none":"1.5px solid #d9d9d9"}},r&&e.createElement(Tn,{style:{color:"#fff",fontSize:11}})),e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:void 0,size:40,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:2}},n.organization?.name,n.position?` · ${n.position}`:""),(n.email||n.mobile||n.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},n.email||n.mobile||n.username)))}),_<s.length&&e.createElement("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13}},"加载更多...")):i?null:e.createElement(t.Empty,{description:a?"未找到匹配的人员":"暂无人员",style:{marginTop:60}})))),f&&e.createElement("div",{className:"steedos-mobile-selected-overlay"},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{style:{fontWeight:600,fontSize:16}},"已选中 (",c.length,")"),e.createElement(t.Button,{type:"text",onClick:v,style:{padding:0,color:"#666"}},"返回")),u&&c.length>0&&e.createElement("div",{style:{padding:"4px 16px",display:"flex",justifyContent:"flex-end"}},e.createElement(t.Button,{type:"link",danger:!0,size:"small",onClick:N,style:{padding:0}},"清空全部")),o&&c.length>1&&e.createElement("div",{style:{padding:"0 16px 6px",fontSize:12,color:"#999"}},"长按拖拽可调整顺序"),e.createElement("div",{ref:$,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},c.length>0?c.map((n,r)=>{const i=L===r,s=j===r&&null!==L&&L!==r;return e.createElement("div",{key:n._id,onTouchStart:o?e=>P(e,r):void 0,onTouchMove:o?F:void 0,onTouchEnd:o?B:void 0,style:{display:"flex",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid #f5f5f5",gap:10,opacity:i?.3:1,background:s?"#e6f7ff":"#fff",borderTop:s?"2px solid #1890ff":"2px solid transparent",transition:"background 0.15s, border-top 0.15s, opacity 0.15s",touchAction:"none",userSelect:"none"}},o&&e.createElement(In,{style:{color:"#bbb",fontSize:16,flexShrink:0,cursor:"grab"}}),e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:void 0,size:36,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),(n.email||n.mobile||n.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},n.email||n.mobile||n.username)),u&&e.createElement(Dn,{className:"steedos-selected-remove-btn",onClick:()=>k(n._id),style:{fontSize:14,color:"#ff4d4f",padding:8,flexShrink:0}}))}):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE}))),o?e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:c.length>0?"#1890ff":"#666",cursor:"pointer"},onClick:c.length>0?v:void 0},"已选 ",c.length," 人 ",c.length>0&&!f?"▲":c.length>0&&f?"▼":""),e.createElement(t.Button,{type:"primary",onClick:M},"确定")):e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:"#666"}},c.length>0?`已选: ${c[0]?.name}`:"请选择人员"),e.createElement(t.Button,{type:"primary",onClick:M,disabled:0===c.length},"确定")))};function xs(e){return e}function ks(e={}){return{...e}}async function Ss(e){const t=`{rows:space_users(filters: [${[[["user_accepted","=",!0]],"and",[["organization","=",e]]].map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}}}`,n=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function Es(e,t){if(!e&&!t)return[];const n=[];n.push([["user_accepted","=",!0]]),n.push("and"),t?n.push([[["name","contains",t],"or",["email","contains",t]],"or",["username","contains",t]]):e&&n.push([["organizations_parents","in",[e]]]);const r=`{rows:space_users(filters: [${n.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}},count:space_users__count(filters:[${n.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}])}`,o=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:r})}),i=await o.json();return(i.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function Cs(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 1000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.fullname||e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,sort_no,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}{const e=await fetch("/service/api/organizations/root",{headers:ks()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}}const Ms=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择人员",fetchUsers:a=Es,fetchDeptTree:l=Cs,style:c,dispatchEvent:u,clearable:d=!0,isTableMode:h=!1,hasError:p=!1,formalTableMode:f=!1,minimal:m=!1,pickerFillRules:g,onFillFields:y,valueFormat:b="object"}=n,[v,w]=e.useState(!1),[x,k]=e.useState([]),[S,E]=e.useState([]),[C,M]=e.useState(null),[R,N]=e.useState([]),[O,T]=e.useState([]),[_,A]=e.useState(!1),[D,$]=e.useState(""),[L,I]=e.useState(""),[j,z]=e.useState(""),[P,F]=e.useState(null),[B,H]=e.useState([]),[V,U]=e.useState(null),[q,W]=e.useState(!1),[Y,J]=e.useState(0),[K,G]=e.useState(null),Z=e.useRef(null),Q=e.useRef(null),X=e.useRef(0),ee=e.useRef(null),te=function(){const[t,n]=e.useState(()=>"undefined"!=typeof window&&window.innerWidth<768);return e.useEffect(()=>{const e=()=>n(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t}(),[,ne]=e.useState("dept"),[,re]=e.useState(""),[oe,ie]=e.useState([]),[se,ae]=e.useState([]),[le,ce]=e.useState(!1),[ue,de]=e.useState(null),{visibleCount:he,sentinelRef:pe}=function(t,n=50,r=[]){const[o,i]=e.useState(n),s=e.useRef(null),a=e.useRef(null);return e.useEffect(()=>{i(n)},[...r,t,n]),e.useEffect(()=>{if(a.current&&a.current.disconnect(),s.current&&!(o>=t))return a.current=new IntersectionObserver(e=>{e[0]?.isIntersecting&&i(e=>Math.min(e+n,t))},{threshold:.1}),a.current.observe(s.current),()=>{a.current&&a.current.disconnect()}},[t,n,o]),{visibleCount:o,sentinelRef:s}}(S.length,50,[C,D]);e.useEffect(()=>{ee.current={props:n}}),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id)return void N([{_id:r.id,user:r.id,name:r.name||""}]);if(Array.isArray(r)&&r.length>0&&"object"==typeof r[0]&&r[0].id)return void N(r.map(e=>({_id:e.id,user:e.id,name:e.name||""})));const e=Array.isArray(r)?r.map(String).map(e=>e.trim()).filter(Boolean):r?i?String(r).split(",").map(e=>e.trim()).filter(Boolean):[String(r).trim()]:[];if(e.length>0){const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,email,mobile,position,username,avatar,organization}}`;fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(t=>{let n=(t.data?.rows||[]).map(e=>({_id:e._id,name:e.name,user:e.user,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}));n=e.map(e=>n.find(t=>t.user===e)).filter(e=>!!e),N(n)})}else N([])},[r,i]),e.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current),Q.current&&clearTimeout(Q.current)},[]),e.useEffect(()=>{if(v){A(!0),J(e=>e+1),re(""),k([]),H([]),M(null),z(""),$(""),I("");let e=!1;l().then(t=>{const n=t;k(n);const r=n.map(e=>e.key);if(H(r),r.length>0)if(te&&n[0]){re(String(n[0].title||""));const t=String(n[0].key),r=String(n[0].title||"");de({id:t,name:r}),ie([]),M(t),e=!0,a(t).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>{A(!1)})}else M(String(r[0]));n.forEach(e=>{e.isLeaf||l(String(e.key)).then(t=>{k(n=>{const r=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:r(e.children,t,n)}:e);return r(n,e.key,t)})})})}).finally(()=>{e||A(!1)})}},[v,l,a,te]),e.useEffect(()=>{te||(C||D?(A(!0),a(C||void 0,D||void 0).then(e=>E(e)).finally(()=>A(!1))):E([]))},[C,D,a,te]);const fe=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:fe(e.children,t,n)}:e),me=e=>{I(e),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{$(e),e?(M(null),re(""),te&&(A(!0),a(void 0,e).then(e=>E(e)).finally(()=>A(!1)))):te?ue&&(ie([]),ae([]),M(ue.id),A(!0),a(ue.id).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>A(!1))):x.length>0&&M(String(x[0].key))},300)},ge=e=>{if(i){if(!O.find(t=>t._id===e._id)){const t=[...O,e];T(t)}}else T([e]),te?setTimeout(()=>{we([e])},0):(G(e._id),setTimeout(()=>{G(null),we([e])},300))},ye=e=>{T(O.filter(t=>t._id!==e))},be=()=>{F(null)},ve=()=>{if(S.length>0&&S.every(e=>O.find(t=>t._id===e._id))){const e=new Set(S.map(e=>e._id));T(O.filter(t=>!e.has(t._id)))}else{const e=[...O];S.forEach(t=>{e.find(e=>e._id===t._id)||e.push(t)}),T(e)}},we=async e=>{if(N(e),o||u){const t=await async function(e){if(0===e.length)return[];const t=e.map(e=>e.user).filter(Boolean);if(0===t.length)return[];const n=`{rows:space_users(filters: [["user","in",[${t.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,sort_no,organization,organizations}}`;let r=[];try{const e=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),t=await e.json();r=t.data?.rows||[]}catch{}const o=new Set;for(const s of r)if(s.organization&&o.add(s.organization),Array.isArray(s.organizations))for(const e of s.organizations)e&&o.add(e);const i=new Map;if(o.size>0){const e=`{rows:organizations(filters: [["_id","in",[${[...o].map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,name,fullname}}`;try{const t=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await t.json();for(const e of n.data?.rows||[])i.set(e._id,{name:e.name||"",fullname:e.fullname||""})}catch{}}return e.map(e=>{const t=r.find(t=>t.user===e.user)||e,n=i.get(t.organization)||{name:"",fullname:""},o=Array.isArray(t.organizations)?t.organizations.map(e=>i.get(e)).filter(Boolean):n.name?[n]:[];return{id:t.user,name:t.name||"",sort_no:t.sort_no||0,organization:{name:n.name,fullname:n.fullname},organizations:{name:o.map(e=>e.name),fullname:o.map(e=>e.fullname)},hr:{},roles:[]}})}(e);let n=i?t:t[0]||null;"string"===b&&(n=i?t.map(e=>e.id):t[0]?.id||null),u&&await u("change",{value:n},ee.current),o&&o(n)}if(w(!1),!i&&g&&g.length>0&&1===e.length&&y){const t=e[0],n=[],r=new Map;for(const e of g){if(!e.sourceField||!e.targetField)continue;const t=e.sourceField.indexOf(".");if(t>0){const n=e.sourceField.substring(0,t),o=e.sourceField.substring(t+1);r.has(n)||r.set(n,[]),r.get(n).push({subField:o,targetField:e.targetField})}else n.push(e)}const o={};if(n.length>0){const e=n.map(e=>e.sourceField).filter(Boolean),r=e=>{for(const t of n)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(o[t.targetField]=String(e[t.sourceField]))};if(e.every(e=>e in t&&null!=t[e]))r(t);else try{const n=`{rows:space_users(filters: [["user","=","${t.user}"]], top: 1){${["_id",...e].join(",")}}}`,o=await fetch("/graphql",{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),i=await o.json(),s=i.data?.rows||[];s.length>0&&r(s[0])}catch{}}const i={organization:"organizations"};for(const[e,s]of r){const n=i[e];if(!n)continue;let r=t[e];if(!r)try{const n=`{rows:space_users(filters: [["user","=","${t.user}"]], top: 1){_id,${e}}}`,o=await fetch(xs("/graphql"),{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),i=await o.json();r=i.data?.rows?.[0]?.[e]}catch{}if(!r)continue;const a=s.map(e=>e.subField);try{const e=`{rows:${n}(filters: [["_id","=","${r}"]], top: 1){${["_id",...a].join(",")}}}`,t=await fetch(xs("/graphql"),{method:"POST",headers:ks({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),i=await t.json(),l=i.data?.rows?.[0];if(l)for(const n of s)null!=l[n.subField]&&(o[n.targetField]=String(l[n.subField]))}catch{}}Object.keys(o).length>0&&y(o)}},xe=async()=>{await we(O)},ke=()=>{T([...R]),w(!1)},Se=e.useCallback(async(e,t)=>{ie(n=>[...n,{id:e,name:t}]),M(e),$(""),I(""),A(!0);try{const[t,n]=await Promise.all([l(e),Ss(e)]);ae(t),E(n)}catch{ae([]),E([])}finally{A(!1)}},[l]),Ee=e.useCallback(async e=>{if(e<0)return;const t=oe.slice(0,e+1);ie(t);const n=t[t.length-1];M(n.id),$(""),I(""),A(!0);try{const[e,t]=await Promise.all([l(n.id),Ss(n.id)]);ae(e),E(t)}catch{ae([]),E([])}finally{A(!1)}},[oe,l]),Ce=e.useCallback(async()=>{if(ue){ie([]),M(ue.id),$(""),I(""),ae([]),A(!0);try{const e=await a(ue.id);E(e)}catch{E([])}finally{A(!1)}}},[ue,a]),Me=e.useCallback(async()=>{if(!(oe.length<=0))if(1===oe.length)await Ce();else{const e=oe.slice(0,-1);ie(e);const t=e[e.length-1];M(t.id),$(""),I(""),A(!0);try{const[e,n]=await Promise.all([l(t.id),Ss(t.id)]);ae(e),E(n)}catch{ae([]),E([])}finally{A(!1)}}},[oe,Ce,l]),Re=e.useCallback((e,t)=>{if(e<0||t<0||e>=O.length||t>=O.length)return;const n=[...O],[r]=n.splice(e,1);n.splice(t,0,r),T(n)},[O]),Ne=e.useCallback(e=>{O.find(t=>t._id===e._id)?ye(e._id):ge(e)},[O,i,ge,ye]),Oe=d&&R.length>0&&(te||q);return e.createElement("div",{style:{...c},className:"steedos-user-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:R.map(e=>e.name).join(", "),onClick:()=>{w(!0),T([...R]),te&&(ne("users"),re(""),ce(!1),ie([]),ae([]),de(null))},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),variant:h||m?"borderless":"outlined",className:h?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...h?{backgroundColor:p?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{}},suffix:m?null:Oe?e.createElement(Dn,{style:{color:"#ff4d4f",cursor:"pointer",padding:te?4:0},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),onClick:async e=>{e.stopPropagation(),N([]);const t=i?[]:null;u&&await u("change",{value:t},ee.current),o&&o(t),W(!1)}}):e.createElement(rr,{style:{color:"#999"},onMouseEnter:()=>!te&&R.length>0&&W(!0),onMouseLeave:()=>!te&&W(!1)})}),!te&&e.createElement(t.Modal,{title:i?"选择人员 (多选)":"选择人员",open:v,onOk:i?xe:void 0,onCancel:ke,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:1200,destroyOnClose:!0,bodyStyle:{height:600,overflow:"hidden",padding:0}},e.createElement("div",{style:{display:"flex",height:"100%"}},e.createElement("div",{style:{width:240,borderRight:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement(t.Input,{placeholder:"搜索部门",prefix:e.createElement(Zn,null),value:j,onChange:e=>(e=>{if(Q.current&&clearTimeout(Q.current),z(e),!e)return A(!0),void l().then(e=>{const t=e.map(e=>({...e,children:void 0}));k(t),J(e=>e+1);const n=t.map(e=>e.key);H(n),n.length>0&&M(String(n[0]))}).finally(()=>A(!1));Q.current=setTimeout(()=>{A(!0),l(void 0,e).then(e=>k(e)).finally(()=>A(!1))},300)})(e.target.value),allowClear:!0,style:{marginBottom:12},size:"small"}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(t.Spin,{spinning:_&&!C&&!D},e.createElement(t.Tree,{key:Y,treeData:x,onSelect:(e,t)=>{e.length>0?(M(String(e[0])),$(""),I(""),te&&t?.node&&(re(String(t.node.title||"")),ne("users"))):x.length>0&&M(String(x[0].key))},loadData:j?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await l(String(e));k(t=>fe(t,e,n))},showLine:!0,selectedKeys:C?[C]:[],expandedKeys:B,onExpand:H})))),e.createElement("div",{style:{flex:1,padding:16,display:"flex",flexDirection:"column"}},e.createElement("style",null,"\n .steedos-user-selector-item:hover {\n background-color: #f0f7ff !important;\n border-color: #1890ff !important;\n }\n "),e.createElement("div",{style:{display:"flex",gap:8,marginBottom:12}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Zn,null),value:L,onChange:e=>me(e.target.value),allowClear:!0,style:{flex:1}}),i&&S.length>0&&e.createElement(t.Button,{onClick:ve},S.every(e=>O.find(t=>t._id===e._id))?"取消":"全选")),e.createElement("div",{style:{flex:1,overflowY:"auto",border:"1px solid #f0f0f0",borderRadius:4,position:"relative"}},e.createElement(t.Spin,{spinning:_},S.length>0?e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"4px",padding:"0 8px"}},S.slice(0,he).map(n=>{const r=!!O.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:r&&i?"":"steedos-user-selector-item",onClick:()=>{i&&r||ge(n)},style:{padding:"10px 12px",borderRadius:4,cursor:"pointer",backgroundColor:K===n._id?"#e6f7ff":r&&i?"#f5f5f5":"transparent",borderColor:K===n._id||r&&i?"#1890ff":"transparent",borderWidth:1,borderStyle:"solid",transition:"all 0.2s",opacity:r&&i?.6:1,display:"flex",alignItems:"center",gap:12,minWidth:0}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:40,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,marginBottom:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.organization?.name&&e.createElement("span",null,n.organization.name),n.position&&e.createElement("span",null," · ",n.position)),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.email||n.mobile||n.username)),r&&e.createElement(Tn,{style:{color:"#1890ff",flexShrink:0}}))})),he<S.length&&e.createElement("div",{ref:pe,style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13,marginTop:8}},"滚动加载更多...")):!C&&!D||_?_?null:e.createElement(t.Empty,{description:"请选择部门或搜索",style:{marginTop:60}}):e.createElement(t.Empty,{description:"暂无人员",style:{marginTop:60}})))),e.createElement("div",{style:{width:240,borderLeft:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement("div",{style:{marginBottom:12,fontSize:14}},e.createElement("span",{style:{fontWeight:500}},"已选中"),e.createElement("span",{style:{marginLeft:8,color:"#999"}},"(",O.length,")")),e.createElement("div",{style:{flex:1,overflowY:"auto"}},O.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},O.map((n,r)=>e.createElement("div",{key:n._id,draggable:i,onDragStart:()=>(e=>{F(e)})(r),onDragEnd:be,onDragOver:e=>((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===P||P===t)return;const n=Date.now();if(n-X.current<100)return;X.current=n;const r=[...O],o=r[P];r.splice(P,1),r.splice(t,0,o),T(r),F(t)})(e,r),onMouseEnter:()=>U(n._id),onMouseLeave:()=>U(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:P===r?"#e6f7ff":"#f5f5f5",borderRadius:4,position:"relative",cursor:i?"grab":"default",transition:"all 0.3s ease",opacity:P===r?.5:1,border:P===r?"1px dashed #1890ff":"1px solid transparent",transform:P===r?"scale(0.98)":"scale(1)",boxShadow:P===r?"0 2px 8px rgba(0,0,0,0.1)":"none"}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:32,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),d&&V===n._id&&e.createElement(Dn,{onClick:()=>ye(n._id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f"}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),d&&O.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>T([]),style:{marginTop:8,padding:0}},"清空全部")))),te&&v&&e.createElement(ws,{visible:v,multiple:i,loading:_,users:S,searchKeyword:D,searchInputValue:L,tempSelectedUsers:O,clearable:d,rootDeptInfo:ue,deptPath:oe,currentLevelDepts:se,showSelectedPanel:le,onDrillDown:Se,onMobileBack:Me,onDrillBack:Ee,onBackToRoot:Ce,onToggleSelectedPanel:()=>ce(e=>!e),onUserSearch:me,onAddUser:ge,onRemoveUser:ye,onToggleUser:Ne,onToggleSelectAll:ve,onReorderUsers:Re,onOk:xe,onCancel:ke,onClearAll:()=>T([])}))};function Rs(e={}){return{...e}}async function Ns(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 100, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}{const e=await fetch("/service/api/organizations/root",{headers:Rs()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}}function Os(e,t){for(const n of e){if(n.key===t)return n;if(n.children){const e=Os(n.children,t);if(e)return e}}return null}async function Ts(e,t){try{const n=`{node:organizations(filters: [["_id","=","${e}"]], top: 1){_id,name,fullname}}`,r=await fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json(),i=o.data?.node?.[0];if(!i)return t;if(i.fullname)return i.fullname;const s=[i.name];let a=i.parent;for(;a;)s.unshift(a.name),a=a.parent;return s.join(" / ")}catch{return t}}const _s=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择部门/分组",fetchDeptTree:a=Ns,style:l,dispatchEvent:c,data:u,isTableMode:d=!1,hasError:h=!1,formalTableMode:p=!1,pickerFillRules:f,onFillFields:m,valueFormat:g="object"}=n,[y,b]=e.useState([]),v=e.useRef(null),[w,x]=e.useState(!1),[k,S]=e.useState(new Map),[E,C]=e.useState([]),[R,N]=e.useState(""),O=e.useRef(null),T=e.useRef([]),_=e.useRef(new Map),A=e.useRef([]),D=e=>"object"==typeof e&&e?.id?String(e.id).trim():String(e).trim(),$=e.useMemo(()=>i?Array.isArray(r)?r.map(e=>D(e)).filter(Boolean):r?"object"==typeof r&&r.id?[D(r)]:String(r).split(",").map(e=>e.trim()).filter(Boolean):[]:[],[r,i]),L=e.useCallback(e=>{if(!e)return"";if("object"==typeof e)return e.id?String(e.id).trim():e._id?String(e._id).trim():"";if("string"==typeof e){const t=e.trim();if(!t)return"";if(t.startsWith("{")&&t.endsWith("}"))try{const e=JSON.parse(t);if(e?.id)return String(e.id).trim();if(e?._id)return String(e._id).trim()}catch{}return t}return String(e).trim()},[]),I=e.useMemo(()=>i?r:L(r)||void 0,[r,i,L]);e.useEffect(()=>{v.current={props:n}}),e.useEffect(()=>{e.startTransition(()=>x(!0)),a().then(e=>{b(e);const t=e.map(e=>String(e.key));C(t);const n=(e,t="")=>e.map(e=>{const r=e.fullname||(t?`${t} / ${e.title}`:e.title);return{...e,pathLabel:r,children:e.children?n(e.children,r):void 0}}),r=n(e);b(r);const o=new Map,i=e=>{e.forEach(e=>{o.set(e.key,e.pathLabel),e.children&&i(e.children)})};i(r),S(o),T.current=r,_.current=o,A.current=t}).finally(()=>x(!1))},[a]),e.useEffect(()=>{const e=i?$:L(r)?[L(r)]:[];if(0===e.length)return;const t=(e,n)=>{for(const r of e){if(r.key===n)return!0;if(r.children&&t(r.children,n))return!0}return!1},n=e.filter(e=>!t(y,String(e)));if(n.length>0){const e=`{rows:organizations(filters: [["_id","in",${JSON.stringify(n)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(async e=>{const t=(e.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!0,pathLabel:e.fullname||e.name,isExtra:!0}));t.length>0&&(b(e=>{const n=new Set,r=e=>{e.forEach(e=>{n.add(e.key),e.children&&r(e.children)})};r(e);const o=t.filter(e=>!n.has(e.key));return 0===o.length?e:[...e,...o]}),S(e=>{const n=new Map(e);return t.forEach(e=>n.set(e.key,e.pathLabel)),n}))})}},[r,y,i,$,L]);const j=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:j(e.children,t,n)}:e),z=()=>{T.current.length>0&&(b(T.current),S(_.current),C(A.current))},P=e=>{const t=Os(y,e),n=t?.title||"";return{id:e,name:n,fullname:t?.fullname||k.get(e)||n}};return e.createElement(t.Spin,{spinning:w,className:"steedos-org-selector"},e.createElement(t.TreeSelect,{treeData:y,className:"w-full "+(d?"picker-table-mode":""),value:i?$.map(e=>({value:String(e),label:k.get(String(e))||e})):I||void 0,onChange:async(e,t,n)=>{let r=e;if(i&&e&&(Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&"value"in e[0]?r=e.map(e=>e.value):Array.isArray(e)?r=e:"object"==typeof e&&"value"in e&&(r=e.value)),o||c){const e=async e=>{const t=await(c?.("change",e?M(u,{value:e}):u,v.current));t?.prevented||o?.(e)};if(Array.isArray(r)){await Promise.all(r.map(async e=>{const t=k.get(String(e));if(!t||!t.includes("/")){const t=Os(y,String(e));if(t){const n=await Ts(String(e),t.title),r=new Map(k);r.set(String(e),n),S(r)}}}));const t=r.map(e=>P(String(e)));e("string"===g?t.map(e=>e.id):t)}else if(r){const t=k.get(String(r));if(!t||!t.includes("/")){const e=Os(y,String(r));if(e){const t=await Ts(String(r),e.title),n=new Map(k);n.set(String(r),t),S(n)}}const n=P(String(r));e("string"===g?n.id:n)}else await e(void 0)}if(!i&&f&&f.length>0&&m&&r&&!Array.isArray(r)){const e=`{rows:organizations(filters: [["_id","=","${String(r)}"]], top: 1){${["_id",...f.map(e=>e.sourceField).filter(Boolean)].join(",")}}}`;fetch("/graphql",{method:"POST",headers:Rs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];if(t.length>0){const e=t[0],n={};for(const t of f)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(n[t.targetField]=String(e[t.sourceField]));Object.keys(n).length>0&&m(n)}})}},treeCheckable:i,showCheckedStrategy:i?void 0:t.TreeSelect.SHOW_PARENT,placeholder:s,variant:d?"borderless":"outlined",style:{minWidth:196,...l,...d?{backgroundColor:h?"rgba(254,226,226,0.9)":p?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,width:"100%",fontSize:13}:{}},loadData:async e=>{if(e.children)return;x(!0);const t=await a(String(e.key));b(n=>{const r=new Set(t.map(e=>e.key)),o=n.filter(e=>!(e.isExtra&&r.has(e.key))),i=e.pathLabel||e.title,s=t.map(e=>({...e,pathLabel:e.fullname||`${i} / ${e.title}`})),a=j(o,String(e.key),s),l=new Map(k);return s.forEach(e=>{l.set(e.key,e.pathLabel)}),S(l),T.current=a,_.current=l,a}),x(!1)},treeDefaultExpandAll:!1,treeExpandedKeys:E,onTreeExpand:e=>{C(e.map(e=>String(e)))},allowClear:!0,multiple:i,treeCheckStrictly:i,treeLine:!0,styles:{popup:{root:{minWidth:400,maxWidth:450,maxHeight:700,overflow:"auto",zIndex:3e3}}},treeNodeLabelProp:"pathLabel",showSearch:!0,searchValue:R,onSearch:e=>{N(e),O.current&&clearTimeout(O.current),e?(x(!0),O.current=setTimeout(async()=>{const t=(await a(void 0,e)).map(e=>({...e,title:e.fullname||e.title,pathLabel:e.fullname||e.title}));b(t);const n=new Map;t.forEach(e=>{n.set(e.key,e.pathLabel)}),S(n),x(!1)},300)):z()},onDropdownVisibleChange:e=>{e&&R&&(N(""),z()),!e&&R&&(N(""),z())},filterTreeNode:!1,maxTagCount:"responsive",listHeight:600}))};function As(e={}){return{...e}}function Ds({value:t,isTableMode:n=!1}){const[r,o]=e.useState(new Map),{names:i,unresolvedIds:s}=function(e){return e?"object"==typeof e&&!Array.isArray(e)&&e.id?{names:[e.name||e.id],unresolvedIds:[]}:Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&e[0].id?{names:e.map(e=>e.name||e.id),unresolvedIds:[]}:{names:[],unresolvedIds:("string"==typeof e?e:Array.isArray(e)?e.join(","):String(e)).split(",").map(e=>e.trim()).filter(Boolean)}:{names:[],unresolvedIds:[]}}(t);e.useEffect(()=>{if(0===s.length)return;const e=s.filter(e=>!r.has(e));if(0===e.length)return;const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name}}`;fetch("/graphql",{method:"POST",headers:As({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];o(e=>{const n=new Map(e);for(const r of t)r.user&&r.name&&n.set(r.user,r.name);return n})}).catch(()=>{})},[t]);const a=n?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return i.length>0?React.createElement("div",{className:a},React.createElement("div",{className:"flex flex-wrap gap-1.5"},i.map((e,t)=>React.createElement("span",{key:t,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},e)))):0===s.length?React.createElement("div",{className:a}):React.createElement("div",{className:a},React.createElement("div",{className:"flex flex-wrap gap-1.5"},s.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},r.get(e)||e))))}function $s(e={}){return{...e}}function Ls({value:t,isTableMode:n=!1}){const r=function(e){return e?"object"==typeof e&&!Array.isArray(e)&&e.id?[{id:e.id,name:e.name||"",fullname:e.fullname||""}]:Array.isArray(e)?e.length>0&&"object"==typeof e[0]&&e[0].id?e.map(e=>({id:e.id,name:e.name||"",fullname:e.fullname||""})):e.map(e=>({id:String(e),name:"",fullname:""})):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean).map(e=>({id:e,name:"",fullname:""})):[]:[]}(t),[o,i]=e.useState(new Map);e.useEffect(()=>{if(0===r.length)return;const e=r.filter(e=>!e.name&&!o.has(e.id)).map(e=>e.id);if(0===e.length)return;const t=`{rows:organizations(filters: [["_id","in",${JSON.stringify(e)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:$s({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];i(e=>{const n=new Map(e);for(const r of t)r._id&&n.set(r._id,r.fullname||r.name||r._id);return n})}).catch(()=>{})},[t]);const s=n?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return 0===r.length?React.createElement("div",{className:s}):React.createElement("div",{className:s},React.createElement("div",{className:"flex flex-wrap gap-1.5"},r.map(e=>React.createElement("span",{key:e.id,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},e.fullname||e.name||o.get(e.id)||e.id))))}var Is,js,zs={exports:{}},Ps={};function Fs(){return js||(js=1,zs.exports=function(){if(Is)return Ps;Is=1;var t=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function a(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(o){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=r({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i(function(){c.value=n,c.getSnapshot=t,a(c)&&u({inst:c})},[e,n,t]),o(function(){return a(c)&&u({inst:c}),e(function(){a(c)&&u({inst:c})})},[e]),s(n),n};return Ps.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,Ps}()),zs.exports}var Bs=Fs();function Hs(t,n,r){const{children:o,...i}=n;return void 0!==r&&(i.key=r),void 0!==o?e.createElement(t,i,o):e.createElement(t,i)}function Vs(t,n,r){const{children:o,...i}=n;return Array.isArray(o)?e.createElement(t,i,...o):void 0!==o?e.createElement(t,i,o):e.createElement(t,i)}const Us=e.Fragment;function qs(e){this.content=e}function Ws(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=Ws(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Ys(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=Ys(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}qs.prototype={constructor:qs,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new qs(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new qs(n)},addToStart:function(e,t){return new qs([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new qs(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new qs(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=qs.from(e)).size?new qs(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=qs.from(e)).size?new qs(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=qs.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},qs.from=function(e){if(e instanceof qs)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new qs(t)};class Js{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new Js(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Js(n,r)}cutByIndex(e,t){return e==t?Js.empty:0==e&&t==this.content.length?this:new Js(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Js(r,o)}addToStart(e){return new Js([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Js(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Ws(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ys(this,e,t,n)}findIndex(e){if(0==e)return Gs(0,e);if(e==this.size)return Gs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Gs(t+1,r):Gs(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Js.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Js(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Js.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new Js(t||e,n)}static from(e){if(!e)return Js.empty;if(e instanceof Js)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Js([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Js.empty=new Js([],0);const Ks={index:0,offset:0};function Gs(e,t){return Ks.index=e,Ks.offset=t,Ks}function Zs(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Zs(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Zs(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Qs=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Zs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Qs.none=[];class Xs extends Error{}class ea{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=na(this.content,e+this.openStart,t);return n&&new ea(n,this.openStart,this.openEnd)}removeBetween(e,t){return new ea(ta(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ea.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new ea(Js.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new ea(e,n,r)}}function ta(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(ta(i.content,t-o-1,n-o-1)))}function na(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=na(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function ra(e,t,n){if(n.openStart>e.depth)throw new Xs("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Xs("Inconsistent open depths");return oa(e,t,n,0)}function oa(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=oa(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)r=t.node(o).copy(Js.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return ca(i,ua(e,o,s,t,r))}{let r=e.parent,o=r.content;return ca(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return ca(i,da(e,t,r))}function ia(e,t){if(!t.type.compatibleContent(e.type))throw new Xs("Cannot join "+t.type.name+" onto "+e.type.name)}function sa(e,t,n){let r=e.node(n);return ia(r,t.node(n)),r}function aa(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function la(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(aa(e.nodeAfter,r),i++));for(let a=i;a<s;a++)aa(o.child(a),r);t&&t.depth==n&&t.textOffset&&aa(t.nodeBefore,r)}function ca(e,t){return e.type.checkContent(t),e.copy(t)}function ua(e,t,n,r,o){let i=e.depth>o&&sa(e,t,o+1),s=r.depth>o&&sa(n,r,o+1),a=[];return la(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(ia(i,s),aa(ca(i,ua(e,t,n,r,o+1)),a)):(i&&aa(ca(i,da(e,t,o+1)),a),la(t,n,o,a),s&&aa(ca(s,da(n,r,o+1)),a)),la(r,null,o,a),new Js(a)}function da(e,t,n){let r=[];if(la(null,e,n,r),e.depth>n){aa(ca(sa(e,t,n+1),da(e,t,n+1)),r)}return la(t,null,n,r),new Js(r)}ea.empty=new ea(Js.empty,0,0);class ha{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Qs.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ga(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(o),s=o-t;if(n.push(i,e,r+t),!s)break;if(i=i.child(e),i.isText)break;o=s-1,r+=t+1}return new ha(t,n,o)}static resolveCached(e,t){let n=ma.get(e);if(n)for(let o=0;o<n.elts.length;o++){let e=n.elts[o];if(e.pos==t)return e}else ma.set(e,n=new pa);let r=n.elts[n.i]=ha.resolve(e,t);return n.i=(n.i+1)%fa,r}}class pa{constructor(){this.elts=[],this.i=0}}const fa=12,ma=new WeakMap;class ga{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ya=Object.create(null);class ba{constructor(e,t,n,r=Qs.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Js.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Zs(this.attrs,t||e.defaultAttrs||ya)&&Qs.sameSet(this.marks,n||Qs.none)}copy(e=null){return e==this.content?this:new ba(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ba(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return ea.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new ea(a,r.depth-i,o.depth-i)}replace(e,t,n){return ra(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ha.resolveCached(this,e)}resolveNoCache(e){return ha.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),wa(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Js.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let a=r;a<o;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Qs.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Qs.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Js.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}ba.prototype.text=void 0;class va extends ba{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new va(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new va(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function wa(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class xa{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new ka(e,t);if(null==n.next)return xa.empty;let r=Sa(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(Oa(e,0));function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);Oa(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new xa(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Na);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}(function(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}function i(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(i(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),o(i(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(i(e.expr,t),s),o(i(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,s),t),s=t}if(-1==e.max)o(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),o(i(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(e.exprs[r],t);if(r==e.exprs.length-1)return s;o(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Js.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}xa.empty=new xa(!0);class ka{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Sa(e){let t=[];do{t.push(Ea(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Ea(e){let t=[];do{t.push(Ca(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Ca(e){let t=function(e){if(e.eat("(")){let t=Sa(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let e=n[i];e.isInGroup(t)&&o.push(e)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Ra(e,t)}return t}function Ma(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ra(e,t){let n=Ma(e),r=n;return e.eat(",")&&(r="}"!=e.next?Ma(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Na(e,t){return t-e}function Oa(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(Na)}function Ta(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function _a(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function Aa(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let n=e[o];n.validate&&n.validate(t[o])}}function Da(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new La(e,r,t[r]);return n}let $a=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Da(e,n.attrs),this.defaultAttrs=Ta(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==xa.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:_a(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ba(this,this.computeAttrs(e),Js.from(t),Qs.setFrom(n))}createChecked(e=null,t,n){return t=Js.from(t),this.checkContent(t),new ba(this,this.computeAttrs(e),t,Qs.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Js.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(Js.empty,!0);return o?new ba(this,e,t.append(o),Qs.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Aa(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Qs.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,o)=>r[t]=new e(t,n,o));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class La{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Ia{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Da(e,r.attrs),this.excluded=null;let o=Ta(this.attrs);this.instance=o?new Qs(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Qs(this,_a(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new Ia(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Aa(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ja{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=qs.from(e.nodes),t.marks=qs.from(e.marks||{}),this.nodes=$a.compile(this.spec.nodes,this),this.marks=Ia.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let e=this.nodes[r],t=e.spec.content||"",o=e.spec.marks;if(e.contentMatch=n[t]||(n[t]=xa.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==o?null:o?za(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:za(this,t.split(" "))}this.nodeFromJSON=e=>ba.fromJSON(this,e),this.markFromJSON=e=>Qs.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof $a))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new va(n,n.defaultAttrs,e,Qs.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function za(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Pa{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new qa(this,t,!1);return n.addAll(e,Qs.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new qa(this,t,!0);return n.addAll(e,Qs.none,t.from,t.to),ea.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Wa(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Ya(e)),e.mark||e.ignore||e.clearMark||(e.mark=r)})}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Ya(e)),e.node||e.ignore||e.mark||(e.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Pa(e,Pa.schemaRules(e)))}}const Fa={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Ba={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ha={ol:!0,ul:!0};function Va(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Ua{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Qs.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Js.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Js.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Js.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Fa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qa{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=Va(null,t.preserveWhitespace,0)|(n?4:0);r=o?new Ua(o.type,o.attrs,Qs.none,!0,t.topMatch||o.type.contentMatch,i):new Ua(n?null:e.schema.topNodeType,null,Qs.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();Ha.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Ha.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Ba.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Fa.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let e=this.parser.matchedStyles[r],o=n.getPropertyValue(e);if(o)for(let n;;){let r=this.parser.matchStyle(e,o,this,n);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;n=r}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let i=this.open,s=0;i>=0;i--){let t=this.nodes[i],a=t.findWrapping(e);if(a&&(!r||r.length>a.length+s)&&(r=a,o=t,!a.length))break;if(t.solid){if(n)break;s+=2}}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)t=this.enterInner(r[i],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Qs.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):Ja(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=Va(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Qs.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):Ja(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new Ua(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function Wa(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ya(e){let t={};for(let n in e)t[n]=e[n];return t}function Ja(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Ka{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Za(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=el(Za(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&el(Za(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return el(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ka(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ga(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Ga(e.marks)}}function Ga(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Za(e){return e.document||window.document}const Qa=new WeakMap;function Xa(e){let t=Qa.get(e);return void 0===t&&Qa.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function el(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Xa(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],u=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){u=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let d=u;d<t.length;d++){let o=t[d];if(0===o){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:i}=el(e,o,n,r);if(l.appendChild(t),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}const tl=Math.pow(2,16);function nl(e,t){return e+t*tl}function rl(e){return 65535&e}class ol{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class il{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&il.empty)return il.empty}recover(e){let t=0,n=rl(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/tl}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],u=a+l;if(e<=u){let o=a+r+((l?e==a?-1:e==u?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:u)?null:nl(s/3,e-a),d=e==a?2:e==u?1:4;return(t<0?e!=a:e!=u)&&(d|=8),new ol(o,d,i)}r+=c-l}return n?e+r:new ol(e+r,0,null)}touches(e,t){let n=0,r=rl(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let t=this.ranges[s]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[s+o];if(e<=t+a&&s==3*r)return!0;n+=this.ranges[s+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new il(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?il.empty:new il(e<0?[0,-e,0]:[0,0,e])}}il.empty=new il([]);class sl{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new sl(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new sl;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this._maps[o].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(o);if(null!=t&&t>o&&t<this.to){o=t,e=this._maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new ol(e,r,null)}}const al=Object.create(null);class ll{getMap(){return il.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=al[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in al)throw new RangeError("Duplicate use of step JSON ID "+e);return al[e]=t,t.prototype.jsonID=e,t}}class cl{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new cl(e,null)}static fail(e){return new cl(null,e)}static fromReplace(e,t,n,r){try{return cl.ok(e.replace(t,n,r))}catch(o){if(o instanceof Xs)return cl.fail(o.message);throw o}}}function ul(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(ul(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Js.fromArray(r)}class dl extends ll{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new ea(ul(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return cl.fromReplace(e,this.from,this.to,o)}invert(){return new hl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new dl(t.pos,n.pos,this.mark)}merge(e){return e instanceof dl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new dl(t.from,t.to,e.markFromJSON(t.mark))}}ll.jsonID("addMark",dl);class hl extends ll{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new ea(ul(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return cl.fromReplace(e,this.from,this.to,n)}invert(){return new dl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new hl(t.pos,n.pos,this.mark)}merge(e){return e instanceof hl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new hl(t.from,t.to,e.markFromJSON(t.mark))}}ll.jsonID("removeMark",hl);class pl extends ll{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cl.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return cl.fromReplace(e,this.pos,this.pos+1,new ea(Js.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new pl(this.pos,t.marks[n]);return new pl(this.pos,this.mark)}}return new fl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pl(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new pl(t.pos,e.markFromJSON(t.mark))}}ll.jsonID("addNodeMark",pl);class fl extends ll{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return cl.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return cl.fromReplace(e,this.pos,this.pos+1,new ea(Js.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new pl(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new fl(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new fl(t.pos,e.markFromJSON(t.mark))}}ll.jsonID("removeNodeMark",fl);class ml extends ll{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&yl(e,this.from,this.to)?cl.fail("Structure replace would overwrite content"):cl.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new il([this.from,this.to-this.from,this.slice.size])}invert(e){return new ml(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new ml(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ml)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?ea.empty:new ea(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ml(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?ea.empty:new ea(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ml(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ml(t.from,t.to,ea.fromJSON(e,t.slice),!!t.structure)}}ll.jsonID("replace",ml);class gl extends ll{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(yl(e,this.from,this.gapFrom)||yl(e,this.gapTo,this.to)))return cl.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return cl.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?cl.fromReplace(e,this.from,this.to,n):cl.fail("Content does not fit in gap")}getMap(){return new il([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new gl(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new gl(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new gl(t.from,t.to,t.gapFrom,t.gapTo,ea.fromJSON(e,t.slice),t.insert,!!t.structure)}}function yl(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function bl(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let t=i.child(l),c=a+t.nodeSize,u=r.matchType(t.type);if(u){r=u;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new hl(a,c,t.marks[r]));if(o&&t.isText&&"pre"!=n.whitespace){let e,r,o=/\r?\n|\r/g;for(;e=o.exec(t.text);)r||(r=new ea(Js.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new ml(a+e.index,a+e.index+e[0].length,r))}}else s.push(new ml(a,c,ea.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Js.empty,!0);e.replace(a,a,new ea(t,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function vl(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function wl(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!vl(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function xl(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(kl).concat({type:t,attrs:n}).concat(i.map(kl)):null}function kl(e){return{type:e,attrs:null}}function Sl(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function El(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function Cl(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let e=o.node(c),t=o.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=r&&r[u+1];i&&(n=n.replaceChild(0,i.type.create(i.attrs)));let s=r&&r[u]||e;if(!e.canReplace(t+1,e.childCount)||!s.type.validContent(n))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Ml(e,t){let n=e.resolve(t),r=n.index();return Rl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Rl(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function Nl(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let e,i,s=r.index(o);if(o==r.depth?(e=r.nodeBefore,i=r.nodeAfter):n>0?(e=r.node(o+1),s++,i=r.node(o).maybeChild(s)):(e=r.node(o).maybeChild(s-1),i=r.node(o+1)),e&&!e.isTextblock&&Rl(e,i)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}}function Ol(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),s=r.node(e),a=!1;if(1==i)a=s.canReplace(n,n,o);else{let e=s.contentMatchAt(n).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(n,n,e[0])}if(a)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}function Tl(e,t,n=t,r=ea.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return _l(o,i,r)?new ml(t,n,r):new Al(o,i,r).fit()}function _l(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ll.jsonID("replaceAround",gl);class Al{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Js.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Js.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new ea(o,i,s);return e>-1?new gl(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new ml(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Ll(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let i=this.depth;i>=0;i--){let e,{type:s,match:a}=this.frontier[i],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Js.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:i,parent:r,inject:l};if(2==t&&o&&(e=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:i,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ll(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new ea(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Ll(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new ea(Dl(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new ea(Dl(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let f=0;f<o.length;f++)this.openFrontierNode(o[f]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));u=u.matchFragment(r)}let h=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=u.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(u=t,c.push(Il(e.mark(d.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=$l(this.placed,t,Js.from(c)),this.frontier[t].match=u,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=s;f<h;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?ea.empty:new ea(Dl(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new ea(Dl(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!jl(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=jl(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=jl(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=$l(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=$l(this.placed,this.depth,Js.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Js.empty,!0);e.childCount&&(this.placed=$l(this.placed,this.frontier.length,e))}}function Dl(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Dl(e.firstChild.content,t-1,n)))}function $l(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy($l(e.lastChild.content,t-1,n)))}function Ll(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Il(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Il(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Js.empty,!0)))),e.copy(r)}function jl(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function zl(e){return e.spec.defining||e.spec.definingForContent}function Pl(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Pl(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Js.empty,!0))}return e}function Fl(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Bl extends ll{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return cl.fail("No node at attribute step's position");let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return cl.fromReplace(e,this.pos,this.pos+1,new ea(Js.from(r),0,t.isLeaf?0:1))}getMap(){return il.empty}invert(e){return new Bl(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bl(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Bl(t.pos,t.attr,t.value)}}ll.jsonID("attr",Bl);class Hl extends ll{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return cl.ok(n)}getMap(){return il.empty}invert(e){return new Hl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Hl(t.attr,t.value)}}ll.jsonID("docAttr",Hl);let Vl=class extends Error{};Vl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Vl.prototype=Object.create(Error.prototype)).constructor=Vl,Vl.prototype.name="TransformError";class Ul{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new sl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Vl(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=ea.empty){let r=Tl(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new ea(Js.from(n),0,0))}delete(e,t){return this.replace(e,t,ea.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(_l(o,i,r))return e.step(new ml(t,n,r));let s=Fl(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let e=o.node(h).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;s.indexOf(h)>-1?a=h:o.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let e=h.firstChild;if(c.push(e),p==r.openStart)break;h=e.content}for(let h=u-1;h>=0;h--){let e=c[h],t=zl(e.type);if(t&&!e.sameMarkup(o.node(Math.abs(a)-1)))u=h;else if(t||!e.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let t=(h+u+1)%(r.openStart+1),a=c[t];if(a)for(let c=0;c<s.length;c++){let u=s[(c+l)%s.length],d=!0;u<0&&(d=!1,u=-u);let h=o.node(u-1),p=o.index(u-1);if(h.canReplaceWith(p,p,a.type,a.marks))return e.replace(o.before(u),d?i.after(u):n,new ea(Pl(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let h=s.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>d));h--){let e=s[h];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let e=r.index(o);if(r.node(o).canReplaceWith(e,e,n))return r.before(o+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let e=r.indexAfter(o);if(r.node(o).canReplaceWith(e,e,n))return r.after(o+1);if(e<r.node(o).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new ea(Js.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=Fl(r,o);for(let s=0;s<i.length;s++){let t=i[s],n=s==i.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),o.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),o.indexAfter(t-1))))return e.delete(r.before(t),o.after(t))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=Js.empty,d=0;for(let f=i,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,u=Js.from(r.node(f).copy(u)),d++):l--;let h=Js.empty,p=0;for(let f=i,m=!1;f>n;f--)m||o.after(f+1)<o.end(f)?(m=!0,h=Js.from(o.node(f).copy(h)),p++):c++;e.step(new gl(l,c,s,a,new ea(u.append(h),d,p),u.size-d,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);El(e,r.node(),r.before(),a)}s.inlineContent&&bl(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new ml(c,l.map(t+n,-1),ea.empty,!0)),!0===r){let t=e.doc.resolve(c);Sl(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Js.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let e=n[s].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Js.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new gl(o,i,o,i,new ea(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&El(e,t,n,i),bl(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new gl(l,c,l+1,c-1,new ea(Js.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&Sl(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new gl(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ea(Js.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Bl(e,t,n)),this}setDocAttribute(e,t){return this.step(new Hl(e,t)),this}addNodeMark(e,t){return this.step(new pl(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Qs)t.isInSet(n.marks)&&this.step(new fl(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new fl(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=Js.empty,s=Js.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=Js.from(o.node(a).copy(i));let e=r&&r[c];s=Js.from(e?e.type.create(e.attrs,s):o.node(a).copy(s))}e.step(new ml(t,t,new ea(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new hl(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new dl(c,d,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof Ia){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new hl(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return bl(this,e,t,n),this}}const ql=Object.create(null);class Wl{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Yl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ea.empty){let n=t.content.lastChild,r=null;for(let s=0;s<t.openEnd;s++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?ea.empty:t),0==s&&rc(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),rc(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Gl(e):nc(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let r=t<0?nc(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):nc(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ec(e.node(0))}static atStart(e){return nc(e,e,0,0,1)||new ec(e)}static atEnd(e){return nc(e,e,e.content.size,e.childCount,-1)||new ec(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ql[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ql)throw new RangeError("Duplicate use of selection JSON ID "+e);return ql[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Gl.between(this.$anchor,this.$head).getBookmark()}}Wl.prototype.visible=!0;class Yl{constructor(e,t){this.$from=e,this.$to=t}}let Jl=!1;function Kl(e){Jl||e.parent.inlineContent||(Jl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Gl extends Wl{constructor(e,t=e){Kl(e),Kl(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Wl.near(n);let r=e.resolve(t.map(this.anchor));return new Gl(r.parent.inlineContent?r:n,n)}replace(e,t=ea.empty){if(super.replace(e,t),t==ea.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Gl&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Zl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Gl(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Wl.findFrom(t,n,!0)||Wl.findFrom(t,-n,!0);if(!e)return Wl.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Wl.findFrom(e,-n,!0)||Wl.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Gl(e,t)}}Wl.jsonID("text",Gl);class Zl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Zl(e.map(this.anchor),e.map(this.head))}resolve(e){return Gl.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ql extends Wl{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Wl.near(o):new Ql(o)}content(){return new ea(Js.from(this.node),0,0)}eq(e){return e instanceof Ql&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Xl(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ql(e.resolve(t.anchor))}static create(e,t){return new Ql(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Ql.prototype.visible=!1,Wl.jsonID("node",Ql);class Xl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Zl(n,n):new Xl(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Ql.isSelectable(n)?new Ql(t):Wl.near(t)}}class ec extends Wl{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ea.empty){if(t==ea.empty){e.delete(0,e.doc.content.size);let t=Wl.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ec(e)}map(e){return new ec(e)}eq(e){return e instanceof ec}getBookmark(){return tc}}Wl.jsonID("all",ec);const tc={map(){return this},resolve:e=>new ec(e)};function nc(e,t,n,r,o,i=!1){if(t.inlineContent)return Gl.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Ql.isSelectable(r))return Ql.create(e,n-(o<0?r.nodeSize:0))}else{let t=nc(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function rc(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof ml||i instanceof gl)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Wl.near(e.doc.resolve(o),n)))}class oc extends Ul{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Qs.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Qs.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Wl.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ic(e,t){return t&&e?e.bind(t):e}class sc{constructor(e,t,n){this.name=e,this.init=ic(t.init,n),this.apply=ic(t.apply,n)}}const ac=[new sc("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new sc("selection",{init:(e,t)=>e.selection||Wl.atStart(t.doc),apply:e=>e.selection}),new sc("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new sc("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class lc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ac.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new sc(e.key,e.spec.state,e))})}}class cc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new cc(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new oc(this)}static create(e){let t=new lc(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new cc(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new lc(this.schema,e.plugins),n=t.fields,r=new cc(t);for(let o=0;o<n.length;o++){let t=n[o].name;r[t]=this.hasOwnProperty(t)?this[t]:n[o].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new lc(e.schema,e.plugins),o=new cc(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=ba.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Wl.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function uc(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=uc(o,t,{})),n[r]=o}return n}class dc{constructor(e){this.spec=e,this.props={},e.props&&uc(e.props,this,this.props),this.key=e.key?e.key.key:pc("plugin")}getState(e){return e[this.key]}}const hc=Object.create(null);function pc(e){return e in hc?e+"$"+ ++hc[e]:(hc[e]=0,e+"$")}class fc{constructor(e="key"){this.key=pc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const mc=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function gc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const yc=(e,t,n)=>{let r=gc(e,n);if(!r)return!1;let o=xc(r);if(!o){let n=r.blockRange(),o=n&&wl(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(_c(e,o,t,-1))return!0;if(0==r.parent.content.size&&(vc(i,"end")||Ql.isSelectable(i)))for(let s=r.depth;;s--){let n=Tl(e.doc,r.before(s),r.after(s),ea.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(vc(i,"end")?Wl.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):Ql.create(r.doc,o.pos-i.nodeSize)),t(r.scrollIntoView())}return!0}if(1==s||r.node(s-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function bc(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=Tl(e.doc,o,s,ea.empty);if(!a||a.from!=o||a instanceof ml&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Gl.create(t.doc,o)),n(t.scrollIntoView())}return!0}function vc(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const wc=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=xc(r)}let s=i&&i.nodeBefore;return!(!s||!Ql.isSelectable(s))&&(t&&t(e.tr.setSelection(Ql.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function xc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function kc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Sc=(e,t,n)=>{let r=kc(e,n);if(!r)return!1;let o=Cc(r);if(!o)return!1;let i=o.nodeAfter;if(_c(e,o,t,1))return!0;if(0==r.parent.content.size&&(vc(i,"start")||Ql.isSelectable(i))){let n=Tl(e.doc,r.before(),r.after(),ea.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(vc(i,"start")?Wl.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Ql.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},Ec=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Cc(r)}let s=i&&i.nodeAfter;return!(!s||!Ql.isSelectable(s))&&(t&&t(e.tr.setSelection(Ql.create(e.doc,i.pos)).scrollIntoView()),!0)};function Cc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const Mc=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function Rc(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Nc=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof ec||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Rc(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Gl.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Oc=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Cl(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&wl(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const Tc=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Ql&&e.selection.node.isBlock)return!(!n.parentOffset||!Cl(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let h=n.depth;;h--){if(n.node(h).isBlock){a=n.end(h)==n.pos+(n.depth-h),l=n.start(h)==n.pos-(n.depth-h),i=Rc(n.node(h-1).contentMatchAt(n.indexAfter(h-1))),s.unshift(a&&i?{type:i}:null),o=h;break}if(1==h)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Gl||e.selection instanceof ec)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=Cl(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=Cl(c.doc,u,s.length,s)),!d)return!1;if(c.split(u,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0};function _c(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Ml(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=Js.empty;for(let e=o.length-1;e>=0;e--)i=Js.from(o[e].create(null,i));i=Js.from(s.copy(i));let l=e.tr.step(new gl(t.pos-1,r,t.pos,r,new ea(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Ml(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&l?null:Wl.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),h=d&&wl(d);if(null!=h&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(c&&vc(a,"start",!0)&&vc(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Js.empty;for(let e=o.length-1;e>=0;e--)r=Js.from(o[e].copy(r));n(e.tr.step(new gl(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new ea(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Ac(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Gl.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Dc=Ac(-1),$c=Ac(1);function Lc(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(r,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function Ic(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}function jc(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new ga(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ga(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=xl(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=Js.empty;for(let u=n.length-1;u>=0;u--)i=Js.from(n[u].type.create(n[u].attrs,i));e.step(new gl(t.start-(r?2:0),t.end,t.start,t.end,new ea(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,h=!0;u<d;u++,h=!1)!h&&Cl(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize}(e,t,a,o,n);return!0}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}function zc(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,t=>t.childCount>0&&t.firstChild.type==e);return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new gl(i-1,s,i,s,new ea(Js.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ga(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=wl(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);Ml(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos);return t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)p-=o.child(f).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?Js.empty:Js.from(o))))return!1;let d=i.pos,h=d+s.nodeSize;return r.step(new gl(d-(a?1:0),h+(l?1:0),d+1,h-1,new ea((a?Js.empty:Js.from(o.copy(Js.empty))).append(l?Js.empty:Js.from(o.copy(Js.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}Ic(mc,yc,wc),Ic(mc,Sc,Ec),Ic(Mc,Nc,Oc,Tc),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const Pc=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Fc=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Bc=null;const Hc=function(e,t,n){let r=Bc||(Bc=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Vc=function(e,t,n,r){return n&&(qc(e,t,n,r,-1)||qc(e,t,n,r,1))},Uc=/^(img|br|input|textarea|hr)$/i;function qc(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Wc(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Yc(e)||Uc.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Pc(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Wc(e):0}}}}function Wc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Yc(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Jc=function(e){return e.focusNode&&Vc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Kc(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Gc="undefined"!=typeof navigator?navigator:null,Zc="undefined"!=typeof document?document:null,Qc=Gc&&Gc.userAgent||"",Xc=/Edge\/(\d+)/.exec(Qc),eu=/MSIE \d/.exec(Qc),tu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qc),nu=!!(eu||tu||Xc),ru=eu?document.documentMode:tu?+tu[1]:Xc?+Xc[1]:0,ou=!nu&&/gecko\/(\d+)/i.test(Qc);ou&&(/Firefox\/(\d+)/.exec(Qc)||[0,0])[1];const iu=!nu&&/Chrome\/(\d+)/.exec(Qc),su=!!iu,au=iu?+iu[1]:0,lu=!nu&&!!Gc&&/Apple Computer/.test(Gc.vendor),cu=lu&&(/Mobile\/\w+/.test(Qc)||!!Gc&&Gc.maxTouchPoints>2),uu=cu||!!Gc&&/Mac/.test(Gc.platform),du=!!Gc&&/Win/.test(Gc.platform),hu=/Android \d/.test(Qc),pu=!!Zc&&"webkitFontSmoothing"in Zc.documentElement.style,fu=pu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function mu(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function gu(e,t){return"number"==typeof e?e:e[t]}function yu(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function bu(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Fc(s);continue}let e=s,n=e==i.body,a=n?mu(i):yu(e),l=0,c=0;if(t.top<a.top+gu(r,"top")?c=-(a.top-t.top+gu(o,"top")):t.bottom>a.bottom-gu(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+gu(o,"top")-a.top:t.bottom-a.bottom+gu(o,"bottom")),t.left<a.left+gu(r,"left")?l=-(a.left-t.left+gu(o,"left")):t.right>a.right-gu(r,"right")&&(l=t.right-a.right+gu(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let u=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(u))break;s="absolute"==u?s.offsetParent:Fc(s)}}function vu(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Fc(r));return t}function wu(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let xu=null;function ku(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(1==u.nodeType)e=u.getClientRects();else{if(3!=u.nodeType)continue;e=Hc(u).getClientRects()}for(let h=0;h<e.length;h++){let p=e[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=u,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&e&&(a=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=u,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=Ru(o,1);if(r.top!=r.bottom&&Su(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:ku(n,r)}function Su(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Eu(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(Su(t,o))return Eu(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Cu(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Wc(r.offsetNode),r.offset)}}catch(r){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Wc(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!Su(t,n))return null;if(a=Eu(e.dom,t,n),!a)return null}if(lu)for(let c=a;n&&c;c=Fc(c))c.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(ou&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;pu&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let t,n=e.docView.nearestDesc(i,!0);if(!n)return null;if(1==n.dom.nodeType&&(n.node.isBlock&&n.parent||!n.contentDOM)&&((t=n.dom.getBoundingClientRect()).width||t.height)&&(n.node.isBlock&&n.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(n.dom.nodeName)&&(!s&&t.left>r.left||t.top>r.top?o=n.posBefore:(!s&&t.right<r.left||t.bottom<r.top)&&(o=n.posAfter),s=!0),!n.contentDOM&&o<0&&!n.node.isText))return(n.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?n.posBefore:n.posAfter;i=n.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=ku(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function Mu(e){return e.top<e.bottom||e.left<e.right}function Ru(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Mu(e))return e}return Array.prototype.find.call(n,Mu)||e.getBoundingClientRect()}const Nu=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ou(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=pu||ou;if(3==r.nodeType){if(!s||!Nu.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Tu(Ru(Hc(r,e,t),i),i<0)}{let e=Ru(Hc(r,o,o),n);if(ou&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Ru(Hc(r,o-1,o-1),-1);if(t.top==e.top){let n=Ru(Hc(r,o,o+1),-1);if(n.top!=e.top)return Tu(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Wc(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return _u(e.getBoundingClientRect(),!1)}if(null==i&&o<Wc(r)){let e=r.childNodes[o];if(1==e.nodeType)return _u(e.getBoundingClientRect(),!0)}return _u(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Wc(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Hc(e,Wc(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Tu(Ru(t,1),!1)}if(null==i&&o<Wc(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Hc(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Tu(Ru(t,-1),!0)}return Tu(Ru(3==r.nodeType?Hc(r):r,-n),n>=0)}function Tu(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function _u(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Au(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Du=/[\u0590-\u08ac]/;let $u=null,Lu=null,Iu=!1;function ju(e,t,n){return $u==t&&Lu==n?Iu:($u=t,Lu=n,Iu="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Au(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Ou(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Hc(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Du.test(r.parent.textContent)&&a.modify?Au(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),h=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(p){}return null!=l&&(a.caretBidiLevel=l),h}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class zu{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Pc(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let o=0;n<this.children.length;n++){let t=this.children[n],i=o+t.size;if(i>e||t instanceof qu){r=e-o;break}o=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Pu&&o.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Pc(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Pc(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Pc(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=Pc(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let p=0,f=0;p<this.children.length;p++){let s=this.children[p],a=f+s.size;if(o>f&&i<a)return s.setSelection(e-f-s.border,t-f-s.border,n,r);f=a}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),u=!1;if((ou||lu)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(u=!(!t||"\n"!=e.nodeValue[t-1]),u&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:Pc(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(ou&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||u&&lu)&&Vc(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Vc(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((l.extend||e==t)&&(!u||!ou)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(h){}}if(!d){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Pu extends zu{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Fu extends zu{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Bu extends zu{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Ka.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Bu(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=Bu.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=od(o,t,i,n)),e>0&&(o=od(o,0,e,n));for(let s=0;s<o.length;s++)o[s].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Hu extends zu{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),c=l&&l.dom,u=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Ka.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:u}=e)}u||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let d=c;return c=Xu(c,n,t),l?s=new Wu(e,t,n,r,c,u||null,d,l,o,i+1):t.isText?new Uu(e,t,n,r,c,d,o):new Hu(e,t,n,r,c,u||null,d,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Js.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ed(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new nd(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d,h,p;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(u?(d||(d=[u])).push(e):u=e)}if(u)if(d){d.sort(rd);for(let e=0;e<d.length;e++)n(d[e],c,!!l)}else n(u,c,!!l);if(l)p=-1,h=l,l=null;else{if(!(c<e.childCount))break;p=c,h=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+h.nodeSize;if(h.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-i),h=h.cut(0,e-i),f=e,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(h,h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,h),p),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Qs.none:this.node.child(o).marks,n,e,o),a.placeWidget(t,e,r)},(t,i,l,c)=>{let u;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,u,e)||a.updateNextNode(t,i,l,e,c,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Yu(this.contentDOM,this.children,e),cu&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Gl)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Fu(this,o,t,r);e.input.compositionNodes.push(i),this.children=od(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ed(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Zu(this.dom,this.nodeDOM,Gu(this.outerDeco,this.node,t),Gu(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Vu(e,t,n,r,o){Xu(r,t,e);let i=new Hu(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Uu extends Hu{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new Uu(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class qu extends zu{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Wu extends Hu{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Yu(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=td(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Bu){let t=r?r.previousSibling:e.lastChild;Yu(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=td(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Ju=function(e){e&&(this.nodeName=e)};Ju.prototype=Object.create(null);const Ku=[new Ju];function Gu(e,t,n){if(0==e.length)return Ku;let r=n?Ku[0]:new Ju,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Ju(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Ju(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function Zu(e,t,n,r){if(n==Ku&&r==Ku)return t;let o=t;for(let i=0;i<r.length;i++){let t=r[i],s=n[i];if(i){let n;s&&s.nodeName==t.nodeName&&o!=e&&(n=o.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(o),s=Ku[0]),o=n}Qu(o,s||Ku[0],t)}return o}function Qu(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Xu(e,t,n){return Zu(e,e,Ku,Gu(t,n,1!=e.nodeType))}function ed(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function td(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class nd{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Bu)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=Bu.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){let r=this.top.children[s];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Hu){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,u=a.dom,d=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&ed(t,a.outerDeco));if(!d&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ed(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Hu.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Hu.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Pu(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Bu;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Uu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((lu||su)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new qu(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function rd(e,t){return e.type.side-t.type.side}function od(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function id(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Jc(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Ql.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Wc(e);r||o;){if(e==n)return!0;let t=Pc(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Wc(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new Ql(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!l){l=fd(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function sd(e){return e.editable?e.hasFocus():gd(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ad(e,t=!1){let n=e.state.selection;if(hd(e,n),sd(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&su){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Vc(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,Pc(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&nu&&ru<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!ld||n instanceof Gl||(n.$from.parent.inlineContent||(r=cd(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=cd(e,n.to))),e.docView.setSelection(i,s,e,t),ld&&(r&&dd(r),o&&dd(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{sd(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const ld=lu||su&&au<63;function cd(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(lu&&o&&"false"==o.contentEditable)return ud(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return ud(o);if(i)return ud(i)}}function ud(e){return e.contentEditable="true",lu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function dd(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function hd(e,t){if(t instanceof Ql){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(pd(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else pd(e)}function pd(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function fd(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Gl.between(t,n,r)}function md(e){return!(e.editable&&!e.hasFocus())&&gd(e)}function gd(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(n){return!1}}function yd(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Wl.findFrom(i,t)}function bd(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vd(e,t,n){let r=e.state.selection;if(!(r instanceof Gl)){if(r instanceof Ql&&r.node.isInline)return bd(e,new Gl(t>0?r.$to:r.$from));{let n=yd(e.state,t);return!!n&&bd(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return bd(e,new Gl(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=yd(e.state,t);return!!(n&&n instanceof Ql)&&bd(e,n)}if(!(uu&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Ql.isSelectable(i)?bd(e,new Ql(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!pu&&bd(e,new Gl(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function wd(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function xd(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function kd(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;ou&&1==n.nodeType&&r<wd(n)&&xd(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(xd(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Sd(n))break;{let t=n.previousSibling;for(;t&&xd(t,-1);)o=n.parentNode,i=Pc(t),t=t.previousSibling;if(t)n=t,r=wd(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Ed(e,n,r):o&&Ed(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=wd(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!xd(n.childNodes[r],1))break;o=n,i=++r}else{if(Sd(n))break;{let t=n.nextSibling;for(;t&&xd(t,1);)o=t.parentNode,i=Pc(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=wd(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Ed(e,o,i)}(e)}function Sd(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ed(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Yc(e);)t=Pc(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Yc(e);)t=Pc(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Jc(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&ad(e)},50)}function Cd(e,t){let n=e.state.doc.resolve(t);if(!su&&!du&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Md(e,t,n){let r=e.state.selection;if(r instanceof Gl&&!r.empty||n.indexOf("s")>-1)return!1;if(uu&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=yd(e.state,t);if(n&&n instanceof Ql)return bd(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof ec?Wl.near(n,t):Wl.findFrom(n,t);return!!s&&bd(e,s)}return!1}function Rd(e,t){if(!(e.state.selection instanceof Gl))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Nd(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Od(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||uu&&72==n&&"c"==r)return Rd(e,-1)||kd(e,-1);if(46==n&&!t.shiftKey||uu&&68==n&&"c"==r)return Rd(e,1)||kd(e,1);if(13==n||27==n)return!0;if(37==n||uu&&66==n&&"c"==r){let t=37==n?"ltr"==Cd(e,e.state.selection.from)?-1:1:-1;return vd(e,t,r)||kd(e,t)}if(39==n||uu&&70==n&&"c"==r){let t=39==n?"ltr"==Cd(e,e.state.selection.from)?1:-1:1;return vd(e,t,r)||kd(e,t)}return 38==n||uu&&80==n&&"c"==r?Md(e,-1,r)||kd(e,-1):40==n||uu&&78==n&&"c"==r?function(e){if(!lu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Nd(e,n,"true"),setTimeout(()=>Nd(e,n,"false"),20)}return!1}(e)||Md(e,1,r)||kd(e,1):r==(uu?"m":"c")&&(66==n||73==n||89==n||90==n)}function Td(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Ka.fromSchema(e.state.schema),a=Fd(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,d=0;for(;u&&1==u.nodeType&&(c=zd[u.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),d++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function _d(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new ea(Js.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Ka.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=Fd().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&zd[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Bd||(Bd=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Bd.createHTML(e)}(e),n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),pu&&function(e){let t=e.querySelectorAll(su?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Pa.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ad.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(u)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(a){return e}let{content:o,openStart:i,openEnd:s}=e;for(let l=n.length-2;l>=0;l-=2){let e=r.nodes[n[l]];if(!e||e.hasRequiredAttrs())break;o=Js.from(e.create(n[l+1],o)),i++,s++}return new ea(o,i,s)}(jd(s,+u[1],+u[2]),u[4]);else if(s=ea.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&$d(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ld(i[i.length-1],r.length));let t=Dd(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return Js.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let n=s.content.firstChild;e<s.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=s.content.lastChild;t<s.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);s=jd(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Ad=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Dd(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Js.from(e));return e}function $d(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=$d(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(Js.from(Dd(n,e,o+1))))}}function Ld(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ld(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Js.empty,!0);return e.copy(n.append(r))}function Id(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Id(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Js.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function jd(e,t,n){return t<e.openStart&&(e=new ea(Id(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ea(Id(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const zd={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Pd=null;function Fd(){return Pd||(Pd=document.implementation.createHTMLDocument("title"))}let Bd=null;const Hd={},Vd={},Ud={touchstart:!0,touchmove:!0};class qd{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Wd(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Yd(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Jd(e,t))})}function Jd(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Kd(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Gd(e){return{left:e.clientX,top:e.clientY}}function Zd(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,t=>s>i.depth?t(e,n,i.nodeAfter,i.before(s),o,!0):t(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Qd(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function Xd(e,t,n,r,o){return Zd(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Ql&&(n=o.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let e=s>i.depth?i.nodeAfter:i.node(s);if(Ql.isSelectable(e)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(Qd(e,Ql.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Ql.isSelectable(r))&&(Qd(e,new Ql(n)),!0)}(e,n))}function eh(e,t,n,r){return Zd(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function th(e,t,n,r){return Zd(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Qd(e,Gl.create(r,0,r.content.size)),!0);let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let t=i>o.depth?o.nodeAfter:o.node(i),n=o.before(i);if(t.inlineContent)Qd(e,Gl.create(r,n+1,n+1+t.content.size));else{if(!Ql.isSelectable(t))continue;Qd(e,Ql.create(r,n))}return!0}}(e,n,r)}function nh(e){return uh(e)}Vd.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!ih(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!hu||!su||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!cu||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Od(e,n)?n.preventDefault():Wd(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Vd.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Vd.keypress=(e,t)=>{let n=t;if(ih(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||uu&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Gl&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const rh=uu?"metaKey":"ctrlKey";Hd.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=nh(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[rh]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Gd(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new oh(e,s,n,!!r)):("doubleClick"==i?eh:th)(e,s.pos,s.inside,n)?n.preventDefault():Wd(e,"pointer"))};class oh{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[rh],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Ql&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!ou||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wd(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ad(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Gd(e))),this.updateAllowDefault(e),this.allowDefault||!t?Wd(this.view,"pointer"):Xd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||lu&&this.mightDrag&&!this.mightDrag.node.isAtom||su&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Qd(this.view,Wl.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Wd(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wd(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function ih(e,t){return!!e.composing||!!(lu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Hd.touchstart=e=>{e.input.lastTouch=Date.now(),nh(e),Wd(e,"pointer")},Hd.touchmove=e=>{e.input.lastTouch=Date.now(),Wd(e,"pointer")},Hd.contextmenu=e=>nh(e);const sh=hu?5e3:-1;function ah(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>uh(e),t))}function lh(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function ch(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Wc(e=e.childNodes[t-1])}else{if(!e.parentNode||Yc(e))return null;t=Pc(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Yc(e))return null;t=Pc(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function uh(e,t=!1){if(!(hu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),lh(e),t||e.docView&&e.docView.dirty){let n=id(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Vd.compositionstart=Vd.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Gl&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||su&&du&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),uh(e,!0),e.markCursor=null;else if(uh(e,!t.selection.empty),ou&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}ah(e,sh)},Vd.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ah(e,20))};const dh=nu&&ru<15||cu&&fu<604;function hh(e,t,n,r,o){let i=_d(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||ea.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ph(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Hd.copy=Vd.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=dh?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Td(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Vd.paste=(e,t)=>{let n=t;if(e.composing&&!hu)return;let r=dh?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&hh(e,ph(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?hh(e,r.value,null,o,t):hh(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class fh{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const mh=uu?"altKey":"ctrlKey";function gh(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[mh]}Hd.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Gd(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Ql?i.to-1:i.to));else if(r&&r.mightDrag)o=Ql.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Ql.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:u}=Td(e,a);(!n.dataTransfer.files.length||!su||au>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(dh?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",dh||n.dataTransfer.setData("text/plain",c),e.dragging=new fh(u,gh(e,n),o)},Hd.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Vd.dragover=Vd.dragenter=(e,t)=>t.preventDefault(),Vd.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Gd(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=_d(e,ph(t.dataTransfer),dh?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!gh(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||ea.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?Ol(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=l.doc;u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i);if(l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&Ql.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Ql(h));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(fd(e,h,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Hd.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ad(e)},20))},Hd.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Hd.beforeinput=(e,t)=>{if(su&&hu&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Kc(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let os in Vd)Hd[os]=Vd[os];function yh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class bh{constructor(e,t){this.toDOM=e,this.spec=t||Sh,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new xh(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof bh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&yh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class vh{constructor(e,t){this.attrs=e,this.spec=t||Sh}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new xh(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof vh&&yh(this.attrs,e.attrs)&&yh(this.spec,e.spec)}static is(e){return e.type instanceof vh}destroy(){}}class wh{constructor(e,t){this.attrs=e,this.spec=t||Sh}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new xh(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof wh&&yh(this.attrs,e.attrs)&&yh(this.spec,e.spec)}destroy(){}}class xh{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new xh(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new xh(e,e,new bh(t,n))}static inline(e,t,n,r){return new xh(e,t,new vh(n,r))}static node(e,t,n,r){return new xh(e,t,new wh(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof vh}get widget(){return this.type instanceof bh}}const kh=[],Sh={};class Eh{constructor(e,t){this.local=e.length?e:kh,this.children=t.length?t:kh}static create(e,t){return t.length?Th(t,e,0,Sh):Ch}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Ch||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Sh)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach((t,n,r,o)=>{let i=o-r-(n-t);for(let s=0;s<a.length;s+=3){let r=a[s+1];if(r<0||t>r+u-e)continue;let o=a[s]+u-e;n>=o?a[s+1]=t<=o?-2:-1:t>=u&&i&&(a[s]+=i,a[s+1]+=i)}e+=i}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(-2==a[c+1]){l=!0,a[c+1]=-1;continue}let t=n.map(e[c]+i),u=t-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[c+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(u),f=r.maybeChild(h);if(f&&p==u&&p+f.nodeSize==d){let r=a[c+2].mapInner(n,f,t+1,e[c]+i+1,s);r!=Ch?(a[c]=u,a[c+1]=d,a[c+2]=r):(a[c+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}(a,e,t,n,o,i,s),c=Th(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Eh(t.sort(_h),a)}(this.children,i||[],e,t,n,r,o):i?new Eh(i.sort(_h),kh):Ch}add(e,t){return t.length?this==Ch?Eh.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=Nh(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Th(s,e,a+1,Sh)),o+=3}});let i=Rh(o?Oh(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Eh(i.length?this.local.concat(i).sort(_h):this.local,r||this.children)}remove(e){return 0==e.length||this==Ch?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,s=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[o+2].removeInner(r,i+1);a!=Ch?n[o+2]=a:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<e.length;i++)if(o=e[i])for(let e=0;e<r.length;e++)r[e].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Eh(r,n):Ch}forChild(e,t){if(this==Ch)return this;if(t.isLeaf)return Eh.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let o=e+1,i=o+t.content.size;for(let s=0;s<this.local.length;s++){let e=this.local[s];if(e.from<i&&e.to>o&&e.type instanceof vh){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new Eh(r.sort(_h),kh);return n?new Mh([e,n]):e}return n||Ch}eq(e){if(this==e)return!0;if(!(e instanceof Eh)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ah(this.localsInner(e))}localsInner(e){if(this==Ch)return kh;if(e.inlineContent||!this.local.some(vh.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof vh||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Eh.empty=new Eh([],[]),Eh.removeOverlap=Ah;const Ch=Eh.empty;class Mh{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,Sh));return Mh.from(n)}forChild(e,t){if(t.isLeaf)return Eh.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Ch&&(o instanceof Mh?n=n.concat(o.members):n.push(o))}return Mh.from(n)}eq(e){if(!(e instanceof Mh)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Ah(n?t:t.sort(_h)):kh}static from(e){switch(e.length){case 0:return Ch;case 1:return e[0];default:return new Mh(e.every(e=>e instanceof Eh)?e:e.reduce((e,t)=>e.concat(t instanceof Eh?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Rh(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new xh(o.from+t,o.to+t,o.type))}return n}function Nh(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i,s=0;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[s]=null);return o}function Oh(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Th(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Nh(e,t,s+n);if(a){i=!0;let e=Th(a,t,n+s+1,r);e!=Ch&&o.push(s,s+t.nodeSize,e)}});let s=Rh(i?Oh(e):e,-n).sort(_h);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Eh(s,o):Ch}function _h(e,t){return e.from-t.from||e.to-t.to}function Ah(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Dh(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Dh(t,o+1,i.copy(r.to,i.to)))}}return t}function Dh(e,t,n){for(;t<e.length&&_h(n,e[t])>0;)t++;e.splice(t,0,n)}function $h(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Ch&&t.push(r)}),e.cursorWrapper&&t.push(Eh.create(e.state.doc,[e.cursorWrapper.deco])),Mh.from(t)}const Lh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ih=nu&&ru<=11;class jh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class zh{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new jh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);nu&&ru<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():lu&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Ih&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Lh)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(md(this.view)){if(this.suppressingSelectionUpdates)return ad(this.view);if(nu&&ru<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Vc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let o=e.focusNode;o;o=Fc(o))n.add(o);for(let o=e.anchorNode;o;o=Fc(o))if(n.has(o)){t=o;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&md(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let c=0;c<t.length;c++){let e=this.registerMutation(t[c],a);e&&(o=o<0?e.from:Math.min(e.from,o),i=i<0?e.to:Math.max(e.to,i),e.typeOver&&(s=!0))}if(!a.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(ou&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Hh(e,n)==t||r.remove()}}}}else for(let c of a)if("BR"==c.nodeName&&c.parentNode){let e=c.nextSibling;e&&1==e.nodeType&&"false"==e.contentEditable&&c.parentNode.removeChild(c)}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Jc(n)&&(l=id(e))&&l.eq(Wl.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ad(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(Ph.has(e))return;if(Ph.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=ou,Fh)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Fh=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||ad(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(nu&&ru<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?Pc(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Pc(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Ph=new WeakMap,Fh=!1;function Bh(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Vc(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Hh(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Vh(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(lu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||lu&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Uh=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function qh(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=id(e,t);if(n&&!e.state.selection.eq(n)){if(su&&hu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,u=e.state.selection,d=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(r=[{node:u,offset:c.anchorOffset}],Jc(c)||r.push({node:c.focusNode,offset:c.focusOffset})),su&&8===e.input.lastKeyCode)for(let g=s;g>i;g--){let e=o.childNodes[g-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){s=g;break}if(!t||t.size)break}let d=e.state.doc,h=e.someProp("domParser")||Pa.fromSchema(e.state.schema),p=d.resolve(a),f=null,m=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Vh,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),h=e.state.doc,p=h.slice(d.from,d.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){r-=s+Math.max(0,i-Math.min(s,a))-i}if(s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&Jh(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&Jh(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(p.content,d.doc.content,d.from,l,c);if(f&&e.input.domChangeCount++,(cu&&e.input.lastIOSEnter>Date.now()-225||hu)&&o.some(e=>1==e.nodeType&&!Uh.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&u instanceof Gl&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=Wh(e,e.state.doc,d.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:u.from,endA:u.to,endB:u.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Gl&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),nu&&ru<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>d.from&&" "==d.doc.textBetween(f.start-d.from-1,f.start-d.from+1)&&(f.start--,f.endA--,f.endB--);let m=d.doc.resolveNoCache(f.start-d.from),g=d.doc.resolveNoCache(f.endB-d.from),y=h.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA;if((cu&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&m.pos<d.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(d.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Kc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Yh(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Yh(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Yh(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Kc(8,"Backspace"))))return void(hu&&su&&e.domObserver.suppressSelectionUpdates());su&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),hu&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==f.endA&&(f.endB-=2,g=d.doc.resolveNoCache(f.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Kc(13,"Enter"))})},20));let v,w=f.start,x=f.endA,k=t=>{let n=t||e.state.tr.replace(w,x,d.doc.slice(f.start-d.from,f.endB-d.from));if(d.sel){let t=Wh(e,n.doc,d.sel);t&&!(su&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(x)-1)||nu&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){nu&&ru<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ad(e),20));let t=k(e.state.tr.delete(w,x)),n=h.resolve(f.start).marksAcross(h.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(v=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let u=0;u<s.length;u++)a=s[u].removeFromSet(a);for(let u=0;u<i.length;u++)l=i[u].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let u=0;u<t.childCount;u++)c.push(o(t.child(u)));if(Js.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start())))){let t=k(e.state.tr);"add"==v.type?t.addMark(w,x,v.mark):t.removeMark(w,x,v.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,w,x));e.someProp("handleTextInput",r=>r(e,w,x,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}function Wh(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:fd(e,t.resolve(n.anchor),t.resolve(n.head))}function Yh(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function Jh(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class Kh{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new qd,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(ep),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Qh(this),Zh(this),this.nodeViews=Xh(this),this.docView=Vu(this.state.doc,Gh(this),$h(this),this.dom,this),this.domObserver=new zh(this,(e,t,n,r)=>qh(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Hd){let n=Hd[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Kd(e,t)||Jd(e,t)||!e.editable&&t.type in Vd||n(e,t)},Ud[t]?{passive:!0}:void 0)}lu&&e.dom.addEventListener("input",()=>null),Yd(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Yd(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ep),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(lh(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Xh(this);(function(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Yd(this),this.editable=Qh(this),Zh(this);let a=$h(this),l=Gh(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(e.doc,l,a);!u&&e.selection.eq(r.selection)||(i=!0);let d="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:vu(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(nu||su)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(u){let n=su?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ch(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Vu(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Vc(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?ad(this,t):(hd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;wu(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Ql){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&bu(this,t.getBoundingClientRect(),e)}else bu(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new fh(e.slice,e.move,r<0?void 0:Ql.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[e];if(null!=r&&(n=t?t(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(nu){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(xu)return e.focus(xu);let t=vu(e);e.focus(null==xu?{get preventScroll(){return xu={preventScroll:!0},!0}}:void 0),xu||(xu=!1,wu(t,0))}(this.dom),ad(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cu(this,e)}coordsAtPos(e,t=1){return Ou(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return ju(this,t||this.state,e)}pasteHTML(e,t){return hh(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return hh(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Td(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$h(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Bc=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Jd(e,t)||!Hd[t.type]||!e.editable&&t.type in Vd||Hd[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?lu&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Bh(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Bh(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Gh(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[xh.node(0,e.state.doc.content.size,t)]}function Zh(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:xh.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Qh(e){return!e.someProp("editable",t=>!1===t(e.state))}function Xh(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function ep(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Kh.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var tp={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},np={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rp="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),op="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ip=0;ip<10;ip++)tp[48+ip]=tp[96+ip]=String(ip);for(ip=1;ip<=24;ip++)tp[ip+111]="F"+ip;for(ip=65;ip<=90;ip++)tp[ip]=String.fromCharCode(ip+32),np[ip]=String.fromCharCode(ip);for(var sp in tp)np.hasOwnProperty(sp)||(np[sp]=tp[sp]);const ap="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lp="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function cp(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let a=0;a<i.length-1;a++){let e=i[a];if(/^(cmd|meta|m)$/i.test(e))o=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);ap?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function up(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function dp(e){let t=function(e){let t=Object.create(null);for(let n in e)t[cp(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(rp&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||op&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?np:tp)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[up(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[up(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(lp&&n.ctrlKey&&n.altKey)&&(r=tp[n.keyCode])&&r!=o){let o=t[up(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var hp=Object.defineProperty,pp=(e,t)=>{for(var n in t)hp(e,n,{get:t[n],enumerable:!0})};function fp(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var mp=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:fp({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},gp={};pp(gp,{blur:()=>yp,clearContent:()=>bp,clearNodes:()=>vp,command:()=>wp,createParagraphNear:()=>xp,cut:()=>kp,deleteCurrentNode:()=>Sp,deleteNode:()=>Cp,deleteRange:()=>Mp,deleteSelection:()=>Rp,enter:()=>Np,exitCode:()=>Op,extendMarkRange:()=>Ip,first:()=>jp,focus:()=>Vp,forEach:()=>Up,insertContent:()=>qp,insertContentAt:()=>Kp,joinBackward:()=>Qp,joinDown:()=>Zp,joinForward:()=>Xp,joinItemBackward:()=>ef,joinItemForward:()=>tf,joinTextblockBackward:()=>nf,joinTextblockForward:()=>rf,joinUp:()=>Gp,keyboardShortcut:()=>sf,lift:()=>lf,liftEmptyBlock:()=>cf,liftListItem:()=>uf,newlineInCode:()=>df,resetAttributes:()=>ff,scrollIntoView:()=>mf,selectAll:()=>gf,selectNodeBackward:()=>yf,selectNodeForward:()=>bf,selectParentNode:()=>vf,selectTextblockEnd:()=>wf,selectTextblockStart:()=>xf,setContent:()=>Sf,setMark:()=>om,setMeta:()=>im,setNode:()=>sm,setNodeSelection:()=>am,setTextDirection:()=>lm,setTextSelection:()=>cm,sinkListItem:()=>um,splitBlock:()=>hm,splitListItem:()=>pm,toggleList:()=>gm,toggleMark:()=>ym,toggleNode:()=>bm,toggleWrap:()=>vm,undoInputRule:()=>wm,unsetAllMarks:()=>xm,unsetMark:()=>km,unsetTextDirection:()=>Sm,updateAttributes:()=>Em,wrapIn:()=>Cm,wrapInList:()=>Mm});var yp=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),bp=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),vp=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=wl(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},wp=e=>t=>e(t),xp=()=>({state:e,dispatch:t})=>Nc(e,t),kp=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Gl(r.doc.resolve(Math.max(s-1,0)))),!0},Sp=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1){if(o.node(i).type===r.type){if(t){const t=o.before(i),n=o.after(i);e.delete(t,n).scrollIntoView()}return!0}}return!1};function Ep(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Cp=e=>({tr:t,state:n,dispatch:r})=>{const o=Ep(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1){if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}}return!1},Mp=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},Rp=()=>({state:e,dispatch:t})=>mc(e,t),Np=()=>({commands:e})=>e.keyboardShortcut("Enter"),Op=()=>({state:e,dispatch:t})=>((e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Rc(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Wl.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t);function Tp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function _p(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Tp(t[r])?t[r].test(e[r]):t[r]===e[r])}function Ap(e,t,n={}){return e.find(e=>e.type===t&&_p(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Dp(e,t,n={}){return!!Ap(e,t,n)}function $p(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some(e=>e.type===t)||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(e=>e.type===t))return;n=n||(null==(r=o.node.marks[0])?void 0:r.attrs);if(!Ap([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&Dp([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Dp([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Lp(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Ip=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Lp(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const e=$p(l,i,t);if(e&&e.from<=c&&e.to>=u){const t=Gl.create(s,e.from,e.to);n.setSelection(t)}}return!0},jp=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function zp(e){return e instanceof Gl}function Pp(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Fp(e,t=null){if(!t)return null;const n=Wl.atStart(e),r=Wl.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Gl.create(e,Pp(0,o,i),Pp(e.content.size,o,i)):Gl.create(e,Pp(t,o,i),Pp(t,o,i))}function Bp(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function Hp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Vp=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(Hp()||Bp())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||Hp()||Bp()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!zp(n.state.selection))return s(),!0;const a=Fp(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Up=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),qp=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Wp=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Wp(r)}return e};function Yp(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Wp(n)}function Jp(e,t,n){if(e instanceof ba||e instanceof Js)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Js.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),Jp("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new ja({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?Pa.fromSchema(i).parseSlice(Yp(e),n.parseOptions):Pa.fromSchema(i).parse(Yp(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=Pa.fromSchema(t);return n.slice?r.parseSlice(Yp(e),n.parseOptions).content:r.parse(Yp(e),n.parseOptions)}return Jp("",t,n)}var Kp=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const l=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Jp(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(a){l(a)}try{o=Jp(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(a){return l(a),!1}let{from:u,to:d}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,p=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),h=!!h&&(e.isText&&0===e.marks.length),p=!!p&&e.isBlock}),u===d&&p){const{parent:e}=r.doc.resolve(u);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(u-=1,d+=1)}let f;if(h){if(Array.isArray(t))f=t.map(e=>e.text||"").join("");else if(t instanceof Js){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f="object"==typeof t&&t&&t.text?t.text:t;r.insertText(f,u,d)}else{f=o;const e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&(u=Math.max(0,u-1)),r.replaceWith(u,d,f)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof ml||o instanceof gl))return;const i=e.mapping.maps[r];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(Wl.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:f}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:f})}return!0},Gp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof Ql;if(o){if(r.node.isTextblock||!Ml(e.doc,r.from))return!1;n=r.from}else if(n=Nl(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(Ql.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Zp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof Ql){if(r.node.isTextblock||!Ml(e.doc,r.to))return!1;n=r.to}else if(n=Nl(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Qp=()=>({state:e,dispatch:t})=>yc(e,t),Xp=()=>({state:e,dispatch:t})=>Sc(e,t),ef=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Nl(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},tf=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Nl(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},nf=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=gc(e,n);if(!r)return!1;let o=xc(r);return!!o&&bc(e,o,t)})(e,t),rf=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=kc(e,n);if(!r)return!1;let o=Cc(r);return!!o&&bc(e,o,t)})(e,t);function of(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var sf=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let a=0;a<t.length-1;a+=1){const e=t[a];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))n=!0;else if(/^(c|ctrl|control)$/i.test(e))r=!0;else if(/^s(hift)?$/i.test(e))o=!0;else{if(!/^mod$/i.test(e))throw new Error(`Unrecognized modifier name: ${e}`);Hp()||of()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function af(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?Ep(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>_p(e.node.attrs,n,{strict:!1}));if(i)return!!c.length;return c.reduce((e,t)=>e+t.to-t.from,0)>=l}var lf=(e,t={})=>({state:n,dispatch:r})=>!!af(n,Ep(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&wl(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),cf=()=>({state:e,dispatch:t})=>Oc(e,t),uf=e=>({state:t,dispatch:n})=>zc(Ep(e,t.schema))(t,n),df=()=>({state:e,dispatch:t})=>Mc(e,t);function hf(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function pf(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ff=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=hf("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=Ep(e,r.schema)),"mark"===a&&(s=Lp(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,pf(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(pf(i.attrs,t))))})})}),l},mf=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),gf=()=>({tr:e,dispatch:t})=>{if(t){const t=new ec(e.doc);e.setSelection(t)}return!0},yf=()=>({state:e,dispatch:t})=>wc(e,t),bf=()=>({state:e,dispatch:t})=>Ec(e,t),vf=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(Ql.create(e.doc,n))),!0)})(e,t),wf=()=>({state:e,dispatch:t})=>$c(e,t),xf=()=>({state:e,dispatch:t})=>Dc(e,t);function kf(e,t,n={},r={}){return Jp(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Sf=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=kf(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function Ef(e,t){const n=Lp(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function Cf(e,t){const n=new Ul(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Mf(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function Rf(e,t,n){if(void 0===e.config[t]&&e.parent)return Rf(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?Rf(e.parent,t,n):null})}return e.config[t]}function Nf(e){return e.map(e=>{const t=Rf(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Nf(t())]:e}).flat(10)}function Of(e,t){const n=Ka.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Tf(e){return"function"==typeof e}function _f(e,t=void 0,...n){return Tf(e)?t?e.bind(t)(...n):e(...n):e}function Af(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Df(e){const t=[],{nodeExtensions:n,markExtensions:r}=Af(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=Rf(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});if(!n)return;n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Rf(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function $f(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let o=0;o<r;o+=1){const e=n[o],r=e.indexOf(":");if(-1===r)continue;const i=e.slice(0,r).trim(),s=e.slice(r+1).trim();i&&s&&t.push([i,s])}return t}function Lf(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...$f(n[e]),...$f(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function If(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Lf(e,t),{})}function jf(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function zf(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Pf(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function Ff(e){return e.sort((e,t)=>{const n=Rf(e,"priority")||100,r=Rf(t,"priority")||100;return n>r?-1:n<r?1:0})}function Bf(e){const t=Ff(Nf(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function Hf(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,c)=>{var u;e.isBlock&&n>r&&(a+=i);const d=null==s?void 0:s[e.type.name];if(d)return l&&(a+=d({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(u=null==e?void 0:e.text)?void 0:u.slice(Math.max(r,n)-n,o-n))}),a}function Vf(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Uf(e,t){const n=hf("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=Ep(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?Ef(e,t):{}}function qf(e){const t=function(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Wf(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),qf(r)}function Yf(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=$p(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function Jf(e,t){return t.nodes[e]||t.marks[e]||null}function Kf(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Gf(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Lp(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>_p(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>_p(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function Zf(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Qf(e,t){const{nodeExtensions:n}=Af(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=_f(Rf(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Xf(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Xf(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function em(e){return e instanceof Ql}var tm=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function nm(e,t){const n=t.mapping.mapResult(e.position);return{position:new tm(n.pos),mapResult:n}}function rm(e){return new tm(e)}var om=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Lp(e,r.schema);if(o)if(s){const e=Ef(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(zp(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},im=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sm=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=Ep(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!Lc(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Lc(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},am=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=Pp(e,0,n.content.size),o=Ql.create(n,r);t.setSelection(o)}return!0},lm=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},cm=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Gl.atStart(n).from,s=Gl.atEnd(n).to,a=Pp(r,i,s),l=Pp(o,i,s),c=Gl.create(n,a,l);t.setSelection(c)}return!0},um=e=>({state:t,dispatch:n})=>{const r=Ep(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,e=>e.childCount>0&&e.firstChild.type==o);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=Js.from(n?o.create():null),s=new ea(Js.from(o.create(null,Js.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new gl(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function dm(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var hm=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Kf(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof Ql&&i.node.isBlock)return!(!a.parentOffset||!Cl(s,a.pos))&&(r&&(e&&dm(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,d=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=u&&d?[{type:d,attrs:c}]:void 0,p=Cl(t.doc,t.mapping.map(a.pos),1,h);if(h||p||!Cl(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)||(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(i instanceof Gl&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),d&&!u&&!a.parentOffset&&a.parent.type!==d)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,d)&&t.setNodeMarkup(t.mapping.map(a.before()),d)}e&&dm(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},pm=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=Ep(e,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=Js.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=Js.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={...Kf(h,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(Js.from(a.createAndFill(null,c)||void 0));const u=l.before(l.depth-(r-1));n.replace(u,l.after(-o),new ea(e,4-r,0));let d=-1;n.doc.nodesBetween(u,n.doc.content.size,(e,t)=>{if(d>-1)return!1;e.isTextblock&&0===e.content.size&&(d=t+1)}),d>-1&&n.setSelection(Gl.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...Kf(h,d.type.name,d.attrs),...t},m={...Kf(h,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!Cl(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const c=a.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},fm=(e,t)=>{const n=Mf(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Ml(e.doc,n.pos)||(e.join(n.pos),!0)},mm=(e,t)=>{const n=Mf(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Ml(e.doc,r)||(e.join(r),!0)},gm=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=o.extensionManager,p=Ep(e,s.schema),f=Ep(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,v=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const x=Mf(e=>Qf(e.type.name,d))(m);if(v.depth>=1&&x&&v.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(f);if(Qf(x.node.type.name,d)&&p.validContent(x.node.content)&&a)return l().command(()=>(i.setNodeMarkup(x.pos,p),!0)).command(()=>fm(i,p)).command(()=>mm(i,p)).run()}return n&&w&&a?l().command(()=>{const e=u().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>fm(i,p)).command(()=>mm(i,p)).run():l().command(()=>!!u().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>fm(i,p)).command(()=>mm(i,p)).run()},ym=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Lp(e,r.schema);return Gf(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},bm=(e,t,n={})=>({state:r,commands:o})=>{const i=Ep(e,r.schema),s=Ep(t,r.schema),a=af(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},vm=(e,t={})=>({state:n,commands:r})=>{const o=Ep(e,n.schema);return af(n,o,t)?r.lift(o):r.wrapIn(o,t)},wm=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},xm=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},km=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Lp(e,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find(e=>e.type===l))?void 0:i.attrs,o=$p(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else d.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},Sm=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},Em=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=hf("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=Ep(e,r.schema)),"mark"===a&&(s=Lp(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let u,d,h,p;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,h=Math.max(t,a),p=Math.min(t+e.nodeSize,c),u=t,d=e)}):r.doc.nodesBetween(a,c,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,h=Math.max(r,a),p=Math.min(r+e.nodeSize,c),u=r,d=e),r>=a&&r<=c&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,c);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),d&&(void 0!==u&&o&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),s&&d.marks.length&&d.marks.forEach(e=>{s===e.type&&o&&n.addMark(h,p,s.create({...e.attrs,...t}))}))}),l},Cm=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&xl(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(Ep(e,n.schema),t)(n,r),Mm=(e,t={})=>({state:n,dispatch:r})=>jc(Ep(e,n.schema),t)(n,r),Rm=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Nm=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Om(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let u=!1;const d=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+i;return s.forEach(e=>{if(u)return;const t=((e,t)=>{if(Tp(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(d,e.find);if(!t)return;const s=l.state.tr,c=fp({state:l.state,transaction:s}),h={from:r-(t[0].length-i.length),to:o},{commands:p,chain:f,can:m}=new mp({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),u=!0)}),u}function Tm(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function _m(e,t){const n={...e};return Tm(e)&&Tm(t)&&Object.keys(t).forEach(r=>{Tm(t[r])&&Tm(e[r])?n[r]=_m(e[r],t[r]):n[r]=t[r]}),n}var Am=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{..._f(Rf(this,"addOptions",{name:this.name}))||{}}}get storage(){return{..._f(Rf(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>_m(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Dm=class e extends Am{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};var $m=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Lm(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:u}=new mp({editor:t,state:n}),d=[];n.doc.nodesBetween(r,o,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),v=Math.min(o,t+y);if(b>=v)return;((e,t,n)=>{if(Tp(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,v-t,void 0,""),i.find,s).forEach(e=>{if(void 0===e.index)return;const t=b+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(h)})});return d.every(e=>null!==e)}var Im=null;function jm(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,c=fp({state:e,transaction:l});if(Lm({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new dc({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(Im=t)},r=()=>{Im&&(Im=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=Im;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],c="paste"===o.getMeta("uiEvent")&&!i,u="drop"===o.getMeta("uiEvent")&&!s,d=o.getMeta("applyPasteRules"),h=!!d;if(!c&&!u&&!h)return;if(h){let{text:t}=d;"string"==typeof t||(t=Of(Js.from(t),r.schema));const{from:n}=d,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const p=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&f&&p!==f.b?l({rule:e,state:r,from:p,to:f,pasteEvt:a}):void 0}}))}var zm=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Bf(e),this.schema=function(e,t){var n;const r=Df(e),{nodeExtensions:o,markExtensions:i}=Af(e),s=null==(n=o.find(e=>Rf(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=zf({...e.reduce((e,t)=>{const r=Rf(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:_f(Rf(n,"content",i)),marks:_f(Rf(n,"marks",i)),group:_f(Rf(n,"group",i)),inline:_f(Rf(n,"inline",i)),atom:_f(Rf(n,"atom",i)),selectable:_f(Rf(n,"selectable",i)),draggable:_f(Rf(n,"draggable",i)),code:_f(Rf(n,"code",i)),whitespace:_f(Rf(n,"whitespace",i)),linebreakReplacement:_f(Rf(n,"linebreakReplacement",i)),defining:_f(Rf(n,"defining",i)),isolating:_f(Rf(n,"isolating",i)),attrs:Object.fromEntries(o.map(Pf))}),a=_f(Rf(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>jf(e,o)));const l=Rf(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:If(e,o)}));const c=Rf(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=zf({...e.reduce((e,t)=>{const r=Rf(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:_f(Rf(n,"inclusive",i)),excludes:_f(Rf(n,"excludes",i)),group:_f(Rf(n,"group",i)),spanning:_f(Rf(n,"spanning",i)),code:_f(Rf(n,"code",i)),attrs:Object.fromEntries(o.map(Pf))}),a=_f(Rf(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>jf(e,o)));const l=Rf(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:If(e,o)})),[n.name,s]}));return new ja({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Rf(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Jf(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this;return Ff([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Jf(t.name,this.schema)},r=[],o=Rf(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Rf(t,"exitable",n)&&(i.ArrowRight=()=>Dm.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=new dc({props:{handleKeyDown:dp(i)}});r.push(s);const a=Rf(t,"addInputRules",n);if(Zf(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new dc({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=Of(Js.from(e),i.schema));const{from:o}=a,s=o+e.length;Om({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Om({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Om({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Om({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=Rf(t,"addPasteRules",n);if(Zf(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=jm({editor:e,rules:t});r.push(...n)}}const c=Rf(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r})}get attributes(){return Df(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Af(this.extensions);return Object.fromEntries(t.filter(e=>!!Rf(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Ep(t.name,this.schema)},o=Rf(t,"addNodeView",r);if(!o)return[];const i=o();if(!i)return[];return[t.name,(r,o,s,a,l)=>{const c=If(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]}))}dispatchTransaction(e){const{editor:t}=this;return Ff([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Jf(n.name,this.schema)},o=Rf(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return Ff([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Jf(n.name,this.schema)},o=Rf(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=Af(this.extensions);return Object.fromEntries(t.filter(e=>!!Rf(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Lp(t.name,this.schema)},o=Rf(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=If(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(c=!0)}),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Jf(e.name,this.schema)};if("mark"===e.type){(null==(t=_f(Rf(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=Rf(e,"onBeforeCreate",n),o=Rf(e,"onCreate",n),i=Rf(e,"onUpdate",n),s=Rf(e,"onSelectionUpdate",n),a=Rf(e,"onTransaction",n),l=Rf(e,"onFocus",n),c=Rf(e,"onBlur",n),u=Rf(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}};zm.resolve=Bf,zm.sort=Ff,zm.flatten=Nf;pp({},{ClipboardTextSerializer:()=>Fm,Commands:()=>Bm,Delete:()=>Hm,Drop:()=>Vm,Editable:()=>Um,FocusEvents:()=>Wm,Keymap:()=>Ym,Paste:()=>Jm,Tabindex:()=>Km,TextDirection:()=>Gm,focusEventsPluginKey:()=>qm});var Pm=class e extends Am{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Fm=Pm.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new dc({key:new fc("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=Vf(n);return Hf(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Bm=Pm.create({name:"commands",addCommands:()=>({...gp})}),Hm=Pm.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=Cf(e.before,[e,...t]);Wf(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof hl){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),u=a.invert().map(l),d=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark)),h=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:u},newRange:{from:i,to:l},partial:Boolean(h||d),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),Vm=Pm.create({name:"drop",addProseMirrorPlugins(){return[new dc({key:new fc("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Um=Pm.create({name:"editable",addProseMirrorPlugins(){return[new dc({key:new fc("editable"),props:{editable:()=>this.editor.options.editable}})]}}),qm=new fc("focusEvents"),Wm=Pm.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new dc({key:qm,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Ym=Pm.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,u=i.pos-i.parentOffset,d=c&&1===l.parent.childCount?u===i.pos:Wl.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!d||d&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Hp()||of()?o:r},addProseMirrorPlugins(){return[new dc({key:new fc("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Wl.atStart(t.doc).from,c=Wl.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!Xf(n.doc))return;const u=n.tr,d=fp({state:n,transaction:u}),{commands:h}=new mp({editor:this.editor,state:d});return h.clearNodes(),u.steps.length?u:void 0}})]}}),Jm=Pm.create({name:"paste",addProseMirrorPlugins(){return[new dc({key:new fc("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Km=Pm.create({name:"tabindex",addProseMirrorPlugins(){return[new dc({key:new fc("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Gm=Pm.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Af(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new dc({key:new fc("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Zm=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new e(l,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{if(!(n&&r.length>0)){if(i.node.type.name===e){o.every(e=>t[e]===i.node.attrs[e])&&r.push(i)}n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n)))}}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};var Qm=class extends Rm{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:nm,createMappablePosition:rm},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Fp(t,this.options.autofocus);this.editorState=cc.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=Tf(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[Um,Fm.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Bm,Wm,Ym,Km,Vm,Jm,Hm,Gm.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new zm(n,this)}createCommandManager(){this.commandManager=new mp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=kf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=kf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Kh(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Uf(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return af(e,null,n)||Gf(e,null,n);const r=hf(t,e.schema);return"node"===r?af(e,t,n):"mark"===r&&Gf(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Of(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Hf(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...Vf(this.schema),...n}})}get isEmpty(){return Xf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Zm(t,this)}get $doc(){return this.$pos(0)}};function Xm(e){return new Nm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=_f(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Yf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const u=n.from+r+s.length;i.addMark(n.from+r,u,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function eg(e){return new Nm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=_f(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function tg(e){return new Nm({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=_f(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&xl(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&Ml(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function ng(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();if(s){s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)})}return t}function rg(e){if(!e||0===Object.keys(e).length)return"";const t=[];if(e.class){String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`))}return e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function og(e){const{nodeName:t,name:n,parseAttributes:r=ng,serializeAttributes:o=rg,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const c=a[1]||"",u=r(c);return s.find(e=>!(e in u))?void 0:{type:t,raw:a[0],attributes:u}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function ig(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=ng,serializeAttributes:i=rg,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[u,d=""]=l,h=o(d);let p=1;const f=u.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(y);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)p+=1;else if(p-=1,0===p){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${c}${o}\n\n${s}\n\n:::`}}}function sg(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function ag(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function lg(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=sg,serializeAttributes:i=ag,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),s=e.match(i);if(!s)return;let l="",c="";if(a){const[,e]=s;c=e}else{const[,e,t]=s;c=e,l=t||""}const d=o(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:d}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function cg(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let c="",u=0;const d=t.baseIndentSize||2;for(;u<a.length;){const e=a[u],h=e.match(t.itemPattern);if(!h){if(l.length>0)break;if(""===e.trim()){u+=1,c=`${c}${e}\n`;continue}return}const p=t.extractItemData(h),{indentLevel:f,mainContent:m}=p;c=`${c}${e}\n`;const g=[m];for(u+=1;u<a.length;){const e=a[u];if(""===e.trim()){const t=a.slice(u+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[u+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),c=`${c}${e}\n`,u+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),c=`${c}${e}\n`,u+=1}let y;const b=g.slice(1);if(b.length>0){const e=b.map(e=>e.slice(f+d)).join("\n");e.trim()&&(y=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const v=t.createToken(p,y);l.push(v)}if(0!==l.length)return{items:l,raw:c}}function ug(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content,a=[`${o}${t.renderChildren([i])}`];return s&&s.length>0&&s.forEach(e=>{const n=t.renderChildren([e]);if(n){const e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}pp({},{createAtomBlockMarkdownSpec:()=>og,createBlockMarkdownSpec:()=>ig,createInlineMarkdownSpec:()=>lg,parseAttributes:()=>ng,parseIndentedBlocks:()=>cg,renderNestedMarkdownContent:()=>ug,serializeAttributes:()=>rg});var dg=class e extends Am{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function hg(e){return new $m({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=_f(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),u=o+a.length;if(Yf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>o).length)return null;u<n.to&&s.delete(u,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:pg,getOwnPropertySymbols:fg}=Object,{hasOwnProperty:mg}=Object.prototype;function gg(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function yg(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);const{cache:o}=r,i=o.get(t),s=o.get(n);if(i&&s)return i===n&&s===t;o.set(t,n),o.set(n,t);const a=e(t,n,r);return o.delete(t),o.delete(n),a}}function bg(e){return pg(e).concat(fg(e))}const vg=Object.hasOwn||((e,t)=>mg.call(e,t));function wg(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:xg,keys:kg}=Object;function Sg(e,t){return e.byteLength===t.byteLength&&Ig(new Uint8Array(e),new Uint8Array(t))}function Eg(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Cg(e,t){return e.byteLength===t.byteLength&&Ig(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Mg(e,t){return wg(e.getTime(),t.getTime())}function Rg(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Ng(e,t){return e===t}function Og(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,a,l=0;for(;(s=i.next())&&!s.done;){const r=t.entries();let i=!1,c=0;for(;(a=r.next())&&!a.done;){if(o[c]){c++;continue}const r=s.value,u=a.value;if(n.equals(r[0],u[0],l,c,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){i=o[c]=!0;break}c++}if(!i)return!1;l++}return!0}const Tg=wg;function _g(e,t,n){const r=kg(e);let o=r.length;if(kg(t).length!==o)return!1;for(;o-- >0;)if(!zg(e,t,n,r[o]))return!1;return!0}function Ag(e,t,n){const r=bg(e);let o,i,s,a=r.length;if(bg(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!zg(e,t,n,o))return!1;if(i=xg(e,o),s=xg(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function Dg(e,t){return wg(e.valueOf(),t.valueOf())}function $g(e,t){return e.source===t.source&&e.flags===t.flags}function Lg(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,a;for(;(s=i.next())&&!s.done;){const r=t.values();let i=!1,l=0;for(;(a=r.next())&&!a.done;){if(!o[l]&&n.equals(s.value,a.value,s.value,a.value,e,t,n)){i=o[l]=!0;break}l++}if(!i)return!1}return!0}function Ig(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function jg(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function zg(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||vg(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Pg={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Fg=Object.prototype.toString;function Bg({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&i(m,g,y);const v=m.constructor;if(v!==g.constructor)return!1;if(v===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(v===Date)return r(m,g,y);if(v===RegExp)return u(m,g,y);if(v===Map)return s(m,g,y);if(v===Set)return d(m,g,y);const w=Fg.call(m);if("[object Date]"===w)return r(m,g,y);if("[object RegExp]"===w)return u(m,g,y);if("[object Map]"===w)return s(m,g,y);if("[object Set]"===w)return d(m,g,y);if("[object Object]"===w)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===w)return p(m,g,y);if("[object Error]"===w)return o(m,g,y);if("[object Arguments]"===w)return l(m,g,y);if(Pg[w])return h(m,g,y);if("[object ArrayBuffer]"===w)return e(m,g,y);if("[object DataView]"===w)return n(m,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return c(m,g,y);if(f){let e=f[w];if(!e){const t=null!=(x=m)?x[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}var x;return!1}}const Hg=Vg();function Vg(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Sg,areArraysEqual:n?Ag:Eg,areDataViewsEqual:Cg,areDatesEqual:Mg,areErrorsEqual:Rg,areFunctionsEqual:Ng,areMapsEqual:n?gg(Og,Ag):Og,areNumbersEqual:Tg,areObjectsEqual:n?Ag:_g,arePrimitiveWrappersEqual:Dg,areRegExpsEqual:$g,areSetsEqual:n?gg(Lg,Ag):Lg,areTypedArraysEqual:n?gg(Ig,Ag):Ig,areUrlsEqual:jg,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=yg(r.areArraysEqual),t=yg(r.areMapsEqual),n=yg(r.areObjectsEqual),o=yg(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=Bg(i);var a;return function({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(i,s){const{cache:a=(e?new WeakMap:void 0),meta:l}=n();return t(i,s,{cache:a,equals:r,meta:l,strict:o})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(e,n){return t(e,n,i)}}({circular:t,comparator:s,createState:r,equals:n?n(s):(a=s,function(e,t,n,r,o,i,s){return a(e,t,s)}),strict:o})}Vg({strict:!0}),Vg({circular:!0}),Vg({circular:!0,strict:!0}),Vg({createInternalComparator:()=>wg}),Vg({strict:!0,createInternalComparator:()=>wg}),Vg({circular:!0,createInternalComparator:()=>wg}),Vg({circular:!0,createInternalComparator:()=>wg,strict:!0});var Ug,qg,Wg={exports:{}},Yg={};var Jg=(qg||(qg=1,Wg.exports=function(){if(Ug)return Yg;Ug=1;var t=e,n=Fs(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Yg.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=a(function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,r(o,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,i=n)}var o,i,s=!1,a=void 0===n?null:n;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]},[t,n,c,u]);var p=o(e,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=p},[p]),l(p),p},Yg}()),Wg.exports),Kg=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},Gg=({contentComponent:e})=>{const t=Bs.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return Hs(Us,{children:Object.values(t)})};var Zg=class extends e.Component{constructor(t){var n;super(t),this.editorContentRef=e.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(n=t.editor)?void 0:n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(r,o){t={...t,[r]:n.createPortal(o.reactElement,o.element,r)},e.forEach(e=>e())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(e=>e())}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return Vs(Us,{children:[Hs("div",{ref:Kg(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&Hs(Gg,{contentComponent:e.contentComponent})]})}},Qg=e.forwardRef((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(Zg,{key:r,innerRef:n,...t})}),Xg=e.memo(Qg),ey="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,ty=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var ny="undefined"==typeof window,ry=ny||Boolean("undefined"!=typeof window&&window.next),oy=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?ny||ry?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new Qm(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function iy(t={},n=[]){const r=e.useRef(t);r.current=t;const[o]=e.useState(()=>new oy(r)),i=Bs.useSyncExternalStore(o.subscribe,o.getEditor,o.getServerSnapshot);return e.useDebugValue(i),e.useEffect(o.onRender(n)),function(t){var n;const[r]=e.useState(()=>new ty(t.editor)),o=Jg.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:Hg);ey(()=>r.watch(t.editor),[t.editor,r]),e.useDebugValue(o)}({editor:i,selector:({transactionNumber:e})=>!1===t.shouldRerenderOnTransaction||void 0===t.shouldRerenderOnTransaction?null:t.immediatelyRender&&0===e?0:e+1}),i}var sy=e.createContext({editor:null});sy.Consumer;var ay=e.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});e.forwardRef((t,n)=>{const{onDragStart:r}=e.useContext(ay);return Hs(t.as||"div",{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})}),e.createContext({markViewContentRef:()=>{}});var ly=e.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});ly.displayName="TiptapContext";function cy({editor:t,instance:n,children:r}){const o=null!=t?t:n;if(!o)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=e.useMemo(()=>({editor:o}),[o]),s=e.useMemo(()=>({editor:o}),[o]);return Hs(sy.Provider,{value:s,children:Hs(ly.Provider,{value:i,children:r})})}function uy({...t}){const{editor:n}=e.useContext(ly);return Hs(Xg,{editor:n,...t})}cy.displayName="Tiptap",uy.displayName="Tiptap.Content",Object.assign(cy,{Content:uy});var dy=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},hy=/^\s*>\s$/,py=dg.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return dy("blockquote",{...Lf(this.options.HTMLAttributes,e),children:dy("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach(e=>{const r=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(r.join("\n"))}),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[tg({find:hy,type:this.type})]}}),fy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,my=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,gy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,yy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,by=Dm.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return dy("strong",{...Lf(this.options.HTMLAttributes,e),children:dy("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Xm({find:fy,type:this.type}),Xm({find:gy,type:this.type})]},addPasteRules(){return[hg({find:my,type:this.type}),hg({find:yy,type:this.type})]}}),vy=/(^|[^`])`([^`]+)`(?!`)$/,wy=/(^|[^`])`([^`]+)`(?!`)/g,xy=Dm.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Xm({find:vy,type:this.type})]},addPasteRules(){return[hg({find:wy,type:this.type})]}}),ky=/^```([a-z]+)?[\s\n]$/,Sy=/^~~~([a-z]+)?[\s\n]$/,Ey=dg.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",Lf(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=e.raw)?void 0:r.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=(null==(n=e.attrs)?void 0:n.language)||"";if(e.content){r=[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n")}else r=`\`\`\`${o}\n\n\`\`\``;return r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,i=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(i)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=i,s=i.start(),a=i.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n");let c=0,u=0;const d=o-s;for(let n=0;n<l.length;n+=1){if(u+l[n].length>=d){c=n;break}u+=l[n].length+1}const h=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",p=Math.min(h.length,n);if(0===p)return!0;let f=s;for(let n=0;n<c;n+=1)f+=l[n].length+1;e.delete(f,f+p);return o-f<=p&&e.setSelection(Gl.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:i}=o,s=r.doc.textBetween(t,i,"\n","\n").split("\n").map(e=>{var t;const r=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(r.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,i,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(Wl.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[eg({find:ky,type:this.type,getAttributes:e=>({language:e[1]})}),eg({find:Sy,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new dc({key:new fc("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Gl.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),Cy=dg.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),My=dg.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Lf(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ry=dg.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Lf(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>eg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Ny=dg.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Lf(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Ql){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return em(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){const{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Gl.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Ql.create(t.doc,n.pos)):t.setSelection(Gl.create(t.doc,n.pos));else{const o=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,i=null==o?void 0:o.create();i&&(t.insert(r,i),t.setSelection(Gl.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Nm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=_f(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable}))];var e}}),Oy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ty=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_y=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ay=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dy=Dm.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Lf(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Xm({find:Oy,type:this.type}),Xm({find:_y,type:this.type})]},addPasteRules(){return[hg({find:Ty,type:this.type}),hg({find:Ay,type:this.type})]}});const $y="numeric",Ly="ascii",Iy="alpha",jy="asciinumeric",zy="alphanumeric",Py="domain",Fy="emoji",By="scheme",Hy="slashscheme",Vy="whitespace";function Uy(e,t){return e in t||(t[e]=[]),t[e]}function qy(e,t,n){t[$y]&&(t[jy]=!0,t[zy]=!0),t[Ly]&&(t[jy]=!0,t[Iy]=!0),t[jy]&&(t[zy]=!0),t[Iy]&&(t[zy]=!0),t[zy]&&(t[Py]=!0),t[Fy]&&(t[Py]=!0);for(const r in t){const t=Uy(r,n);t.indexOf(e)<0&&t.push(e)}}function Wy(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Wy.groups={},Wy.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const n=t.jr[r][0],o=t.jr[r][1];if(o&&n.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Wy.groups,t&&t.j?o=t:(o=new Wy(t),n&&r&&qy(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(e[s]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Wy.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Wy,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Wy,i){if(r)if(s.t&&"string"==typeof s.t){const e=Object.assign(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);qy(i,e,r)}else n&&qy(i,n,r);s.t=i}return o.j[e]=s,s}};const Yy=(e,t,n,r,o)=>e.ta(t,n,r,o),Jy=(e,t,n,r,o)=>e.tr(t,n,r,o),Ky=(e,t,n,r,o)=>e.ts(t,n,r,o),Gy=(e,t,n,r,o)=>e.tt(t,n,r,o),Zy="WORD",Qy="UWORD",Xy="ASCIINUMERICAL",eb="ALPHANUMERICAL",tb="LOCALHOST",nb="TLD",rb="UTLD",ob="SCHEME",ib="SLASH_SCHEME",sb="NUM",ab="WS",lb="NL",cb="OPENBRACE",ub="CLOSEBRACE",db="OPENBRACKET",hb="CLOSEBRACKET",pb="OPENPAREN",fb="CLOSEPAREN",mb="OPENANGLEBRACKET",gb="CLOSEANGLEBRACKET",yb="FULLWIDTHLEFTPAREN",bb="FULLWIDTHRIGHTPAREN",vb="LEFTCORNERBRACKET",wb="RIGHTCORNERBRACKET",xb="LEFTWHITECORNERBRACKET",kb="RIGHTWHITECORNERBRACKET",Sb="FULLWIDTHLESSTHAN",Eb="FULLWIDTHGREATERTHAN",Cb="AMPERSAND",Mb="APOSTROPHE",Rb="ASTERISK",Nb="AT",Ob="BACKSLASH",Tb="BACKTICK",_b="CARET",Ab="COLON",Db="COMMA",$b="DOLLAR",Lb="DOT",Ib="EQUALS",jb="EXCLAMATION",zb="HYPHEN",Pb="PERCENT",Fb="PIPE",Bb="PLUS",Hb="POUND",Vb="QUERY",Ub="QUOTE",qb="FULLWIDTHMIDDLEDOT",Wb="SEMI",Yb="SLASH",Jb="TILDE",Kb="UNDERSCORE",Gb="EMOJI",Zb="SYM";var Qb=Object.freeze({__proto__:null,ALPHANUMERICAL:eb,AMPERSAND:Cb,APOSTROPHE:Mb,ASCIINUMERICAL:Xy,ASTERISK:Rb,AT:Nb,BACKSLASH:Ob,BACKTICK:Tb,CARET:_b,CLOSEANGLEBRACKET:gb,CLOSEBRACE:ub,CLOSEBRACKET:hb,CLOSEPAREN:fb,COLON:Ab,COMMA:Db,DOLLAR:$b,DOT:Lb,EMOJI:Gb,EQUALS:Ib,EXCLAMATION:jb,FULLWIDTHGREATERTHAN:Eb,FULLWIDTHLEFTPAREN:yb,FULLWIDTHLESSTHAN:Sb,FULLWIDTHMIDDLEDOT:qb,FULLWIDTHRIGHTPAREN:bb,HYPHEN:zb,LEFTCORNERBRACKET:vb,LEFTWHITECORNERBRACKET:xb,LOCALHOST:tb,NL:lb,NUM:sb,OPENANGLEBRACKET:mb,OPENBRACE:cb,OPENBRACKET:db,OPENPAREN:pb,PERCENT:Pb,PIPE:Fb,PLUS:Bb,POUND:Hb,QUERY:Vb,QUOTE:Ub,RIGHTCORNERBRACKET:wb,RIGHTWHITECORNERBRACKET:kb,SCHEME:ob,SEMI:Wb,SLASH:Yb,SLASH_SCHEME:ib,SYM:Zb,TILDE:Jb,TLD:nb,UNDERSCORE:Kb,UTLD:rb,UWORD:Qy,WORD:Zy,WS:ab});const Xb=/[a-z]/,ev=new RegExp("\\p{L}","u"),tv=new RegExp("\\p{Emoji}","u"),nv=/\d/,rv=/\s/;let ov=null,iv=null;function sv(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,u=null,d=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,h=0,u=a):d>=0&&(d+=n[s].length,h++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=h,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function av(e,t,n,r,o){let i;const s=t.length;for(let a=0;a<s-1;a++){const n=t[a];e.j[n]?i=e.j[n]:(i=new Wy(r),i.jr=o.slice(),e.j[n]=i),e=i}return i=new Wy(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function lv(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const cv={defaultProtocol:"http",events:null,format:dv,formatHref:dv,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function uv(e,t=null){let n=Object.assign({},cv);e&&(n=Object.assign(n,e instanceof uv?e.o:e));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function dv(e){return e}function hv(e,t){this.t="token",this.v=e,this.tk=t}function pv(e,t){class n extends hv{constructor(t,n){super(t,n),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}uv.prototype={o:cv,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:cv[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},hv.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=cv.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};const fv=pv("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),mv=pv("text"),gv=pv("nl"),yv=pv("url",{isLink:!0,toHref(e=cv.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==tb&&e[1].t===Ab}}),bv=e=>new Wy(e);function vv(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const wv="undefined"!=typeof console&&console&&console.warn||(()=>{}),xv={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kv(e,t=!1){if(xv.initialized&&wv(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');xv.customSchemes.push([e,t])}function Sv(){xv.scanner=function(e=[]){const t={};Wy.groups=t;const n=new Wy;null==ov&&(ov=lv("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==iv&&(iv=lv("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Gy(n,"'",Mb),Gy(n,"{",cb),Gy(n,"}",ub),Gy(n,"[",db),Gy(n,"]",hb),Gy(n,"(",pb),Gy(n,")",fb),Gy(n,"<",mb),Gy(n,">",gb),Gy(n,"(",yb),Gy(n,")",bb),Gy(n,"「",vb),Gy(n,"」",wb),Gy(n,"『",xb),Gy(n,"』",kb),Gy(n,"<",Sb),Gy(n,">",Eb),Gy(n,"&",Cb),Gy(n,"*",Rb),Gy(n,"@",Nb),Gy(n,"`",Tb),Gy(n,"^",_b),Gy(n,":",Ab),Gy(n,",",Db),Gy(n,"$",$b),Gy(n,".",Lb),Gy(n,"=",Ib),Gy(n,"!",jb),Gy(n,"-",zb),Gy(n,"%",Pb),Gy(n,"|",Fb),Gy(n,"+",Bb),Gy(n,"#",Hb),Gy(n,"?",Vb),Gy(n,'"',Ub),Gy(n,"/",Yb),Gy(n,";",Wb),Gy(n,"~",Jb),Gy(n,"_",Kb),Gy(n,"\\",Ob),Gy(n,"・",qb);const r=Jy(n,nv,sb,{[$y]:!0});Jy(r,nv,r);const o=Jy(r,Xb,Xy,{[jy]:!0}),i=Jy(r,ev,eb,{[zy]:!0}),s=Jy(n,Xb,Zy,{[Ly]:!0});Jy(s,nv,o),Jy(s,Xb,s),Jy(o,nv,o),Jy(o,Xb,o);const a=Jy(n,ev,Qy,{[Iy]:!0});Jy(a,Xb),Jy(a,nv,i),Jy(a,ev,a),Jy(i,nv,i),Jy(i,Xb),Jy(i,ev,i);const l=Gy(n,"\n",lb,{[Vy]:!0}),c=Gy(n,"\r",ab,{[Vy]:!0}),u=Jy(n,rv,ab,{[Vy]:!0});Gy(n,"",u),Gy(c,"\n",l),Gy(c,"",u),Jy(c,rv,u),Gy(u,"\r"),Gy(u,"\n"),Jy(u,rv,u),Gy(u,"",u);const d=Jy(n,tv,Gb,{[Fy]:!0});Gy(d,"#"),Jy(d,tv,d),Gy(d,"️",d);const h=Gy(d,"");Gy(h,"#"),Jy(h,tv,d);const p=[[Xb,s],[nv,o]],f=[[Xb,null],[ev,a],[nv,i]];for(let m=0;m<ov.length;m++)av(n,ov[m],nb,Zy,p);for(let m=0;m<iv.length;m++)av(n,iv[m],rb,Qy,f);qy(nb,{tld:!0,ascii:!0},t),qy(rb,{utld:!0,alpha:!0},t),av(n,"file",ob,Zy,p),av(n,"mailto",ob,Zy,p),av(n,"http",ib,Zy,p),av(n,"https",ib,Zy,p),av(n,"ftp",ib,Zy,p),av(n,"ftps",ib,Zy,p),qy(ob,{scheme:!0,ascii:!0},t),qy(ib,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let m=0;m<e.length;m++){const t=e[m][0],r=e[m][1]?{[By]:!0}:{[Hy]:!0};t.indexOf("-")>=0?r[Py]=!0:Xb.test(t)?nv.test(t)?r[jy]=!0:r[Ly]=!0:r[$y]=!0,Ky(n,t,t,r)}return Ky(n,"localhost",tb,{ascii:!0}),n.jd=new Wy(Zb),{start:n,tokens:Object.assign({groups:t},Qb)}}(xv.customSchemes);for(let e=0;e<xv.tokenQueue.length;e++)xv.tokenQueue[e][1]({scanner:xv.scanner});xv.parser=function({groups:e}){const t=e.domain.concat([Cb,Rb,Nb,Ob,Tb,_b,$b,Ib,zb,sb,Pb,Fb,Bb,Hb,Yb,Zb,Jb,Kb]),n=[Mb,Ab,Db,Lb,jb,Pb,Vb,Ub,Wb,mb,gb,cb,ub,hb,db,pb,fb,yb,bb,vb,wb,xb,kb,Sb,Eb],r=[Cb,Mb,Rb,Ob,Tb,_b,$b,Ib,zb,cb,ub,Pb,Fb,Bb,Hb,Vb,Yb,Zb,Jb,Kb],o=bv(),i=Gy(o,Jb);Yy(i,r,i),Yy(i,e.domain,i);const s=bv(),a=bv(),l=bv();Yy(o,e.domain,s),Yy(o,e.scheme,a),Yy(o,e.slashscheme,l),Yy(s,r,i),Yy(s,e.domain,s);const c=Gy(s,Nb);Gy(i,Nb,c),Gy(a,Nb,c),Gy(l,Nb,c);const u=Gy(i,Lb);Yy(u,r,i),Yy(u,e.domain,i);const d=bv();Yy(c,e.domain,d),Yy(d,e.domain,d);const h=Gy(d,Lb);Yy(h,e.domain,d);const p=bv(fv);Yy(h,e.tld,p),Yy(h,e.utld,p),Gy(c,tb,p);const f=Gy(d,zb);Gy(f,zb,f),Yy(f,e.domain,d),Yy(p,e.domain,d),Gy(p,Lb,h),Gy(p,zb,f);const m=Gy(p,Ab);Yy(m,e.numeric,fv);const g=Gy(s,zb),y=Gy(s,Lb);Gy(g,zb,g),Yy(g,e.domain,s),Yy(y,r,i),Yy(y,e.domain,s);const b=bv(yv);Yy(y,e.tld,b),Yy(y,e.utld,b),Yy(b,e.domain,s),Yy(b,r,i),Gy(b,Lb,y),Gy(b,zb,g),Gy(b,Nb,c);const v=Gy(b,Ab),w=bv(yv);Yy(v,e.numeric,w);const x=bv(yv),k=bv();Yy(x,t,x),Yy(x,n,k),Yy(k,t,x),Yy(k,n,k),Gy(b,Yb,x),Gy(w,Yb,x);const S=Gy(a,Ab),E=Gy(l,Ab),C=Gy(E,Yb),M=Gy(C,Yb);Yy(a,e.domain,s),Gy(a,Lb,y),Gy(a,zb,g),Yy(l,e.domain,s),Gy(l,Lb,y),Gy(l,zb,g),Yy(S,e.domain,x),Gy(S,Yb,x),Gy(S,Vb,x),Yy(M,e.domain,x),Yy(M,t,x),Gy(M,Yb,x);const R=[[cb,ub],[db,hb],[pb,fb],[mb,gb],[yb,bb],[vb,wb],[xb,kb],[Sb,Eb]];for(let N=0;N<R.length;N++){const[e,r]=R[N],o=Gy(x,e);Gy(k,e,o),Gy(o,r,x);const i=bv(yv);Yy(o,t,i);const s=bv();Yy(o,n),Yy(i,t,i),Yy(i,n,s),Yy(s,t,i),Yy(s,n,s),Gy(i,r,x),Gy(s,r,x)}return Gy(o,tb,b),Gy(o,lb,gv),{start:o,tokens:Qb}}(xv.scanner.tokens);for(let e=0;e<xv.pluginQueue.length;e++)xv.pluginQueue[e][1]({scanner:xv.scanner,parser:xv.parser});return xv.initialized=!0,xv}function Ev(e){return xv.initialized||Sv(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,u=0,d=null,h=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(h=0,d=a):h>=0&&h++,o++,u++;if(h<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(vv(mv,t,s)),s=[]),o-=h,u-=h;const e=d.t,r=n.slice(o-u,o);i.push(vv(e,t,r))}}return s.length>0&&i.push(vv(mv,t,s)),i}(xv.parser.start,e,sv(xv.scanner.start,e))}function Cv(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new uv(n),o=Ev(e),i=[];for(let s=0;s<o.length;s++){const e=o[s];!e.isLink||t&&e.t!==t||!r.check(e)||i.push(e.toFormattedObject(r))}return i}Ev.scan=sv;var Mv="[\0- -\u2029 ]",Rv=new RegExp(Mv),Nv=new RegExp(`${Mv}$`),Ov=new RegExp(Mv,"g");function Tv(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(Ov,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var _v=Dm.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!=typeof e?kv(e.scheme,e.optionalSlashes):kv(e)})},onDestroy(){Wy.groups={},xv.scanner=null,xv.parser=null,xv.tokenQueue=[],xv.pluginQueue=[],xv.customSchemes=[],xv.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Tv(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Tv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Tv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Lf(this.options.HTMLAttributes,e),0]:["a",Lf(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Tv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Tv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[hg({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=Cv(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Tv(e,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;var r;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Tv(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new dc({key:new fc("autolink"),appendTransaction:(e,t,n)=>{const o=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=n;return Wf(Cf(t.doc,[...e])).forEach(({newRange:e})=>{const t=function(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}(n.doc,e,e=>e.isTextblock);let o,i;if(t.length>1)o=t[0],i=n.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(t.length){const r=n.doc.textBetween(e.from,e.to," "," ");if(!Nv.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(Rv).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],l=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=Ev(t).map(e=>e.toObject(r.defaultProtocol));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code)).filter(e=>r.validate(e.value)).filter(e=>r.shouldAutoLink(e.value)).forEach(e=>{Yf(e.from,e.to,n.doc).some(e=>e.mark.type===r.type)||s.addMark(e.from,e.to,r.type.create({href:e.href}))})}var a}),s.steps.length?s:void 0}}))),e.push(function(e){return new dc({key:new fc("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=Uf(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,l=null!=(i=s.target)?i:n.target;r&&(window.open(r,l),a=!0)}return a}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new dc({key:new fc("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});const c=Cv(l,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!(!l||!c||void 0!==o&&!o(c.value))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Av=_v,Dv=Object.defineProperty,$v="textStyle",Lv=/^\s*([-+*])\s$/,Iv=dg.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes($v)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=tg({find:Lv,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tg({find:Lv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes($v),editor:this.editor})),[e]}}),jv=dg.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let n=[];if(e.tokens&&e.tokens.length>0){if(e.tokens.some(e=>"paragraph"===e.type))n=t.parseChildren(e.tokens);else{const r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){const r=e.tokens.slice(1),o=t.parseChildren(r);n.push(...o)}}else n=t.parseChildren(e.tokens)}}return 0===n.length&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>ug(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){return`${((null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1)+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)Dv(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>zv,getNextListDepth:()=>Pv,handleBackspace:()=>Vv,handleDelete:()=>Wv,hasListBefore:()=>Fv,hasListItemAfter:()=>Yv,hasListItemBefore:()=>Bv,listItemHasSubList:()=>Hv,nextListIsDeeper:()=>Uv,nextListIsHigher:()=>qv});var zv=(e,t)=>{const{$from:n}=t.selection,r=Ep(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},Pv=(e,t)=>{const n=zv(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Fv=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Bv=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},Hv=(e,t,n)=>{if(!n)return!1;const r=Ep(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},Vv=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!af(e.state,t)&&Fv(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})});const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!af(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=zv(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Hv(t,e.state,o);return Bv(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Uv=(e,t)=>{const n=Pv(e,t),r=zv(e,t);return!(!r||!n)&&n>r.depth},qv=(e,t)=>{const n=Pv(e,t),r=zv(e,t);return!(!r||!n)&&n<r.depth},Wv=(e,t)=>{if(!af(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=Mf(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Uv(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():qv(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Yv=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},Jv=Pm.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Wv(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Wv(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Vv(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Vv(e,n,r)&&(t=!0)}),t}}}}),Kv=/^(\s*)(\d+)\.\s+(.*)$/,Gv=/^\s/;function Zv(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const a=s.content.split("\n"),l=(null==(r=a[0])?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join("\n").trim();if(u){const e=n.blockTokens(u);c.push(...e)}let d=i+1;const h=[];for(;d<e.length&&e[d].indent>t;)h.push(e[d]),d+=1;if(h.length>0){const e=Math.min(...h.map(e=>e.indent)),t=Zv(h,e,n);c.push({type:"list",ordered:!0,start:h[0].number,items:t,raw:h.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return o}var Qv="textStyle",Xv=/^(\d+)\.\s$/,ew=dg.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",Lf(this.options.HTMLAttributes,n),0]:["ol",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const n=e.start||1,r=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{const r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}(e.items,t):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split("\n"),[i,s]=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match(Kv);if(!i)break;const[,s,a,l]=i,c=s.length;let u=l,d=n+1;const h=[o];for(;d<e.length;){const t=e[d];if(t.match(Kv))break;if(""===t.trim())h.push(t),u+="\n",d+=1;else{if(!t.match(Gv))break;h.push(t),u+=`\n${t.slice(c+2)}`,d+=1}}t.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:h.join("\n")}),r=d,n=d}return[t,r]}(o);if(0===i.length)return;const a=Zv(i,0,n);if(0===a.length)return;return{type:"list",ordered:!0,start:(null==(r=i[0])?void 0:r.number)||1,items:a,raw:o.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Qv)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=tg({find:Xv,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=tg({find:Xv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Qv)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),tw=/^\s*(\[([( |x])?\])\s$/,nw=dg.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Lf(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return ug(e,t,`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach(([e,t])=>{o.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:o,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);const t=If(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),i=this.options.HTMLAttributes;return u.forEach(e=>{n.has(e)||(e in i?o.setAttribute(e,i[e]):o.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in i?o.setAttribute(e,i[e]):o.removeAttribute(e):o.setAttribute(e,t)}),u=n,!0}}}},addInputRules(){return[tg({find:tw,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),rw=dg.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Lf(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){const r=e=>{const t=cg(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},o=cg(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Pm.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(Iv.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(jv.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Jv.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(ew.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(nw.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(rw.configure(this.options.taskList)),e}});var ow=" ",iw=dg.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",Lf(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==r.length||"text"!==r[0].type||r[0].text!==ow&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return 0===n.length?ow:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lw=Dm.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Lf(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Xm({find:sw,type:this.type})]},addPasteRules(){return[hg({find:aw,type:this.type})]}}),cw=dg.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),uw=Dm.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",Lf(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),dw=uw;function hw(e={}){return new dc({view:t=>new pw(t,e)})}class pw{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;a=e.left-c.scrollLeft*t,l=e.top-c.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Ol(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fw extends Wl{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return fw.valid(n)?new fw(n):Wl.near(n)}content(){return ea.empty}eq(e){return e instanceof fw&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new fw(e.resolve(t.pos))}getBookmark(){return new mw(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||gw(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||gw(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&fw.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(fw.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Ql.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(fw.valid(s))return s}return null}}}fw.prototype.visible=!1,fw.findFrom=fw.findGapCursorFrom,Wl.jsonID("gapcursor",fw);class mw{constructor(e){this.pos=e}map(e){return new mw(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return fw.valid(t)?new fw(t):Wl.near(t)}}function gw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const yw=dp({ArrowLeft:bw("horiz",-1),ArrowRight:bw("horiz",1),ArrowUp:bw("vert",-1),ArrowDown:bw("vert",1)});function bw(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Gl){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=fw.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new fw(l))),!0)}}function vw(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!fw.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Ql.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new fw(r))),!0)}function ww(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof fw))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Js.empty;for(let s=r.length-1;s>=0;s--)o=Js.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new ea(o,0,0));return i.setSelection(Gl.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function xw(e){if(!(e.selection instanceof fw))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Eh.create(e.doc,[xh.widget(e.selection.head,t,{key:"gapcursor"})])}var kw=200,Sw=function(){};Sw.prototype.append=function(e){return e.length?(e=Sw.from(e),!this.length&&e||e.length<kw&&this.leafAppend(e)||this.length<kw&&e.leafPrepend(this)||this.appendInner(e)):this},Sw.prototype.prepend=function(e){return e.length?Sw.from(e).append(this):this},Sw.prototype.appendInner=function(e){return new Cw(this,e)},Sw.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Sw.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Sw.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Sw.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Sw.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Sw.from=function(e){return e instanceof Sw?e:e&&e.length?new Ew(e):Sw.empty};var Ew=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=kw)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=kw)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Sw);Sw.empty=new Ew([]);var Cw=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Sw);class Mw{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new Rw(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new Rw(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new Mw(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let n,l=e.steps[c].invert(e.docs[c]),u=new Rw(e.mapping.maps[c],l,t);(n=a&&a.merge(u))&&(u=n,c?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>Ow&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new Mw(s.append(o),i)}remapping(e,t){let n=new sl;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new Mw(this.items.append(e.map(e=>new Rw(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new Rw(l,i,c))}else n.push(new Rw(l))},r);let l=[];for(let d=t;d<i;d++)l.push(new Rw(o.maps[d]));let c=this.items.slice(0,r).append(l).append(n),u=new Mw(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new Rw(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--},this.items.length,0),new Mw(Sw.from(r.reverse()),o)}}Mw.empty=new Mw(Sw.empty,0);class Rw{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Rw(t.getMap().invert(),t,this.selection)}}}class Nw{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Ow=20;function Tw(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function _w(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let Aw=!1,Dw=null;function $w(e){let t=e.plugins;if(Dw!=t){Aw=!1,Dw=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Aw=!0;break}}return Aw}const Lw=new fc("history"),Iw=new fc("closeHistory");function jw(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new dc({key:Lw,state:{init:()=>new Nw(Mw.empty,Mw.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Lw);if(i)return i.historyState;n.getMeta(Iw)&&(e=new Nw(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Lw))return s.getMeta(Lw).redo?new Nw(e.done.addTransform(n,void 0,r,$w(t)),e.undone,Tw(n.mapping.maps),e.prevTime,e.prevComposition):new Nw(e.done,e.undone.addTransform(n,void 0,r,$w(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Nw(e.done.rebased(n,o),e.undone.rebased(n,o),_w(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Nw(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),_w(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?_w(e.prevRanges,n.mapping):Tw(n.mapping.maps);return new Nw(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,$w(t)),Mw.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Pw:"historyRedo"==n?Fw:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function zw(e,t){return(n,r)=>{let o=Lw.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=$w(t),o=Lw.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Nw(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Lw,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Pw=zw(!1,!0),Fw=zw(!0,!0);Pm.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new dc({key:new fc("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;e.deleteRange(s,a);return!(this.storage.characters({node:e.doc})>n)}})]}});var Bw=Pm.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[hw(this.options)]}});Pm.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new dc({key:new fc("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return Eh.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(e.isText)return;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;s+=1});let a=0;return e.descendants((e,t)=>{if(e.isText)return!1;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;a+=1;if("deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)return"deepest"===this.options.mode;i.push(xh.node(t,t+e.nodeSize,{class:this.options.className}))}),Eh.create(e,i)}}})]}});var Hw=Pm.create({name:"gapCursor",addProseMirrorPlugins:()=>[new dc({props:{decorations:xw,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&fw.valid(n)?new fw(n):null,handleClick:vw,handleKeyDown:yw,handleDOMEvents:{beforeinput:ww}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=_f(Rf(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),Vw="placeholder";var Uw=Pm.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Vw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${t=this.options.dataAttribute,t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${Vw}`;var t;return[new dc({key:new fc("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((t,n)=>{const r=o>=n&&o<=n+t.nodeSize,a=!t.isLeaf&&Xf(t);if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=xh.node(n,n+t.nodeSize,{class:o.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});i.push(a)}return this.options.includeChildren}),Eh.create(t,i)}}})]}});function qw({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Pm.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new dc({key:new fc("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||em(n.selection)||e.view.dragging?null:Eh.create(n.doc,[xh.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Ww=Pm.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new fc(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new dc({key:t,appendTransaction:(e,r,o)=>{const{doc:i,tr:s,schema:a}=o,l=t.getState(o),c=i.content.size,u=a.nodes[n];if(l)return s.insert(c,u.create())},state:{init:(e,t)=>!qw({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!qw({node:e.doc.lastChild,types:r})}}})]}}),Yw=Pm.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Pw(e,t),redo:()=>({state:e,dispatch:t})=>Fw(e,t)}),addProseMirrorPlugins(){return[jw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Jw=Pm.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(by.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(py.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(Iv.configure(this.options.bulletList)),!1!==this.options.code&&o.push(xy.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(Ey.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(Cy.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Bw.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Hw.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(My.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(Ry.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(Yw.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(Ny.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Dy.configure(this.options.italic)),!1!==this.options.listItem&&o.push(jv.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(Jv.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(_v.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(ew.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(iw.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(lw.configure(this.options.strike)),!1!==this.options.text&&o.push(cw.configure(this.options.text)),!1!==this.options.underline&&o.push(uw.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Ww.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),Kw=Pm.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Gw=Uw,Zw=(e,t=0)=>{const n=[];return!e.children.length||t>20||Array.from(e.children).forEach(e=>{"SPAN"===e.tagName?n.push(e):e.children.length&&n.push(...Zw(e,t+1))}),n},Qw=Dm.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{},mergeNestedSpanStyles:!0}),parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>!!e.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(e=>{if(!e.children.length)return;const t=Zw(e);t&&t.forEach(e=>{var t,n;const r=e.getAttribute("style"),o=null==(n=null==(t=e.parentElement)?void 0:t.closest("span"))?void 0:n.getAttribute("style");e.setAttribute("style",`${o};${r}`)})})(e),{})}]},renderHTML({HTMLAttributes:e}){return["span",Lf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),Xw=Pm.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("background-color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.backgroundColor)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands:()=>({setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()})}),ex=Pm.create({name:"color",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.color)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands:()=>({setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()})}),tx=Pm.create({name:"fontFamily",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands:()=>({setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()})}),nx=Pm.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands:()=>({setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})}),rx=Pm.create({name:"lineHeight",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands:()=>({setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()})});Pm.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(Xw.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(ex.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(tx.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(nx.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(rx.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(Qw.configure(this.options.textStyle)),e}});var ox=ex,ix=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,sx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ax=Dm.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",Lf(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){const r=/^(==)([^=]+)(==)/.exec(e);if(r){const e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Xm({find:ix,type:this.type})]},addPasteRules(){return[hg({find:sx,type:this.type})]}}),lx=ax;function cx({onClick:e,active:t,disabled:n,title:r,children:o}){return React.createElement("button",{type:"button",onMouseDown:t=>{t.preventDefault(),e()},disabled:n,title:r,className:"p-1 rounded hover:bg-gray-200 smooth-transition "+(n?"text-gray-300 cursor-not-allowed":t?"bg-gray-200 text-indigo-600":"text-gray-500")},o)}const ux=["#000000","#434343","#666666","#999999","#cccccc","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#6366f1","#8b5cf6","#ec4899","#f43f5e","#991b1b","#9a3412","#854d0e","#166534","#115e59","#1e40af","#3730a3","#5b21b6","#9d174d","#be123c"];function dx({currentColor:t,onSelect:r,icon:o,title:i}){const[s,a]=e.useState(!1),[l,c]=e.useState({top:0,left:0}),u=e.useRef(null),d=e.useRef(null);e.useEffect(()=>{if(!s)return;const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);const h=e.useCallback(e=>{if(e.preventDefault(),!s&&u.current){const e=u.current.getBoundingClientRect();c({top:e.bottom+4,left:e.left})}a(e=>!e)},[s]);return React.createElement("div",{className:"relative"},React.createElement("button",{ref:u,type:"button",title:i,className:"flex items-center p-1 rounded hover:bg-gray-200 smooth-transition text-gray-500",onMouseDown:h},React.createElement("span",{className:"relative"},o,t&&React.createElement("span",{className:"absolute -bottom-0.5 left-0 right-0 h-[3px] rounded-sm",style:{backgroundColor:t}})),React.createElement(nt,{className:"w-2.5 h-2.5 ml-0.5"})),s&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:d,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg p-2.5",style:{top:l.top,left:l.left}},React.createElement("div",{className:"flex flex-wrap gap-1.5",style:{width:164}},ux.map(e=>React.createElement("button",{key:e,type:"button",title:e,className:"w-7 h-7 rounded-md border-2 smooth-transition flex items-center justify-center "+(e===t?"border-gray-800 shadow-sm scale-110":"border-transparent hover:border-gray-300"),style:{backgroundColor:e},onMouseDown:t=>{t.preventDefault(),r(e),a(!1)}}))),React.createElement("button",{type:"button",className:"w-full mt-2 text-[11px] text-gray-500 hover:text-gray-700 py-1 rounded-md hover:bg-gray-100 smooth-transition",onMouseDown:e=>{e.preventDefault(),r(null),a(!1)}},"清除颜色"))),document.body))}function hx({editor:t}){const[r,o]=e.useState(!1),[i,s]=e.useState({top:0,left:0}),a=e.useRef(null),l=e.useRef(null);e.useEffect(()=>{if(!r)return;const e=e=>{a.current&&!a.current.contains(e.target)&&l.current&&!l.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]);const c=e.useCallback(e=>{if(e.preventDefault(),!r&&a.current){const e=a.current.getBoundingClientRect();s({top:e.bottom+4,left:e.left})}o(e=>!e)},[r]),u=[{label:"正文",active:!t.isActive("heading"),action:()=>t.chain().focus().setParagraph().run()},{label:"标题 1",active:t.isActive("heading",{level:1}),action:()=>t.chain().focus().toggleHeading({level:1}).run(),className:"text-[16px] font-bold"},{label:"标题 2",active:t.isActive("heading",{level:2}),action:()=>t.chain().focus().toggleHeading({level:2}).run(),className:"text-[15px] font-bold"},{label:"标题 3",active:t.isActive("heading",{level:3}),action:()=>t.chain().focus().toggleHeading({level:3}).run(),className:"text-[14px] font-semibold"}],d=u.find(e=>e.active)?.label||"正文";return React.createElement("div",{className:"relative"},React.createElement("button",{ref:a,type:"button",className:"flex items-center gap-0.5 px-1.5 py-1 rounded hover:bg-gray-200 smooth-transition text-gray-600 text-[12px] font-medium min-w-[56px]",onMouseDown:c},d,React.createElement(nt,{className:"w-3 h-3"})),r&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:l,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg py-1 min-w-[120px]",style:{top:i.top,left:i.left}},u.map(e=>React.createElement("button",{key:e.label,type:"button",className:`w-full text-left px-3 py-1.5 hover:bg-gray-100 smooth-transition ${e.active?"bg-indigo-50 text-indigo-600":"text-gray-700"} ${e.className||"text-[13px]"}`,onMouseDown:t=>{t.preventDefault(),e.action(),o(!1)}},e.label)))),document.body))}function px({editor:r,iconSize:o}){const[i,s]=e.useState(!1),[a,l]=e.useState(""),[c,u]=e.useState({top:0,left:0}),d=e.useRef(null),h=e.useRef(null),p=e.useRef(null);e.useEffect(()=>{if(!i)return;const e=e=>{d.current&&!d.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const f=()=>{s(!1),a&&"https://"!==a?r.chain().focus().extendMarkRange("link").setLink({href:a}).run():r.chain().focus().extendMarkRange("link").unsetLink().run()};return React.createElement("div",{className:"relative"},React.createElement("button",{ref:d,type:"button",title:"插入链接",className:"p-1 rounded hover:bg-gray-200 smooth-transition "+(r.isActive("link")?"bg-gray-200 text-indigo-600":"text-gray-500"),onMouseDown:e=>{e.preventDefault(),(()=>{const e=r.getAttributes("link").href||"";if(l(e||"https://"),d.current){const e=d.current.getBoundingClientRect();u({top:e.bottom+4,left:Math.max(8,e.right-320)})}s(!i),setTimeout(()=>p.current?.focus(),50)})()}},React.createElement(at,{className:o})),i&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:h,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg p-3 w-[320px]",style:{top:c.top,left:c.left},onMouseDown:e=>e.stopPropagation()},React.createElement("label",{className:"block text-[12px] font-medium text-gray-600 mb-1"},"链接地址"),React.createElement(t.Input,{ref:p,value:a,onChange:e=>l(e.target.value),placeholder:"https://",size:"small",onPressEnter:f}),React.createElement("div",{className:"flex justify-end gap-1.5 mt-2"},React.createElement("button",{type:"button",className:"px-2.5 py-1 text-[12px] text-gray-500 hover:text-gray-700 rounded hover:bg-gray-100 smooth-transition",onMouseDown:e=>{e.preventDefault(),s(!1)}},"取消"),React.createElement("button",{type:"button",className:"px-2.5 py-1 text-[12px] text-white bg-indigo-500 hover:bg-indigo-600 rounded smooth-transition",onMouseDown:e=>{e.preventDefault(),f()}},"确定")))),document.body))}function fx({editor:t}){const n="w-3.5 h-3.5",[,r]=e.useState(0);e.useEffect(()=>{const e=()=>r(e=>e+1);return t.on("transaction",e),()=>{t.off("transaction",e)}},[t]);const o=t.getAttributes("textStyle").color,i=t.getAttributes("highlight").color;return React.createElement(React.Fragment,null,React.createElement("div",{className:"flex flex-wrap items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-gray-50/80"},React.createElement(hx,{editor:t}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().toggleBold().run(),active:t.isActive("bold"),title:"加粗"},React.createElement(tt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"斜体"},React.createElement(st,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"下划线"},React.createElement(St,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"删除线"},React.createElement(bt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(dx,{currentColor:o,onSelect:e=>{e?t.chain().focus().setColor(e).run():t.chain().focus().unsetColor().run()},icon:React.createElement(ft,{className:n}),title:"字体颜色"}),React.createElement(dx,{currentColor:i,onSelect:e=>{e?t.chain().focus().setHighlight({color:e}).run():t.chain().focus().unsetHighlight().run()},icon:React.createElement(it,{className:n}),title:"背景色"}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().toggleBulletList().run(),active:t.isActive("bulletList"),title:"无序列表"},React.createElement(dt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"有序列表"},React.createElement(ut,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().sinkListItem("listItem").run(),disabled:!t.can().sinkListItem("listItem"),title:"增加缩进"},React.createElement(ct,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().liftListItem("listItem").run(),disabled:!t.can().liftListItem("listItem"),title:"减少缩进"},React.createElement(lt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().setTextAlign("left").run(),active:t.isActive({textAlign:"left"}),title:"左对齐"},React.createElement(xt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().setTextAlign("center").run(),active:t.isActive({textAlign:"center"}),title:"居中"},React.createElement(vt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().setTextAlign("right").run(),active:t.isActive({textAlign:"right"}),title:"右对齐"},React.createElement(wt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(px,{editor:t,iconSize:n}),React.createElement(cx,{onClick:()=>t.chain().focus().unsetLink().run(),disabled:!t.isActive("link"),title:"取消链接"},React.createElement(Ct,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(cx,{onClick:()=>t.chain().focus().unsetAllMarks().clearNodes().run(),title:"清除格式"},React.createElement(yt,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo(),title:"撤销"},React.createElement(Et,{className:n})),React.createElement(cx,{onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo(),title:"重做"},React.createElement(gt,{className:n}))))}function mx({value:t,onChange:n,readonly:r=!1,placeholder:o="请输入内容...",isTableMode:i=!1,hasError:s=!1,minHeight:a=120}){const l=iy({extensions:[Jw,dw,Qw,ox,lx.configure({multicolor:!0}),Av.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),Kw.configure({types:["heading","paragraph"]}),Gw.configure({placeholder:o})],content:t||"",editable:!r,onUpdate:({editor:e})=>{n(e.getHTML())}});if(e.useEffect(()=>{l?.setEditable(!r)},[l,r]),e.useEffect(()=>{if(!l)return;if(l.isFocused)return;const e=l.getHTML(),n=t||"";("<p></p>"===e?"":e)!==n&&l.commands.setContent(n,{emitUpdate:!1})},[l,t]),r){const e=i?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:t||""}})}const c=i?"w-full "+(s?"bg-red-100/90":"bg-white"):"w-full border rounded-md "+(s?"border-red-200 bg-red-50":"border-gray-300 bg-white focus-within:border-indigo-400 focus-within:ring-2 focus-within:ring-indigo-100");return React.createElement("div",{className:c},l&&React.createElement(fx,{editor:l}),React.createElement(Xg,{editor:l,className:"tiptap-editor rich-text-content overflow-hidden rounded-b-md",style:{minHeight:`${a}px`}}))}function gx(e){return e.filter(e=>"done"===e.status).map(e=>e.response?._id||e.uid).join(",")}function yx(e){const t=e.autoNumberPrefix||"",n=e.autoNumberSuffix||"",r=e.autoNumberPadding??4,o=e.autoNumberDateFormat??"YYYYMM",i="1".padStart(r,"0"),s=new Date;let a="";"YYYY"===o?a=`${s.getFullYear()}`:"YYYYMM"===o?a=`${s.getFullYear()}${String(s.getMonth()+1).padStart(2,"0")}`:"YYYYMMDD"===o&&(a=`${s.getFullYear()}${String(s.getMonth()+1).padStart(2,"0")}${String(s.getDate()).padStart(2,"0")}`);const l=[t,a,i,n].filter(Boolean);return a?`${t}${a}-${i}${n}`:`${t}${i}${n}`||l.join("")}function bx({field:n,value:r,onChange:o,isTableMode:i=!1,hasError:s=!1,minimal:a=!1,onFillFields:l,formValues:c,formalTableMode:d=!1,historyApproves:h=[],previewMode:p=!1}){const[f,m]=e.useState(()=>{if(("file"===n.type||"image"===n.type)&&r){const e=String(r).split(",").map(e=>e.trim()).filter(Boolean),t="image"===n.type?"cfs.images.filerecord":"cfs.files.filerecord";if(e.length>0)return e.map(e=>({uid:e,name:e,status:"done",url:fs(e,void 0,t),response:{_id:e}}))}return[]});e.useEffect(()=>{if("file"!==n.type&&"image"!==n.type)return;const e=f.filter(e=>"done"===e.status&&e.name===e.uid).map(e=>e.uid);if(0===e.length)return;const t="image"===n.type?"cfs.images.filerecord":"cfs.files.filerecord";(async function(e,t="cfs.files.filerecord"){if(!e.length)return{};const n=t.replace(/\./g,"_");try{const t=await ds.get(`/data/${n}`,{params:{filters:JSON.stringify(["_id","in",e]),fields:"_id,original",top:e.length,skip:0}}),r=t.data?.data||[],o={};for(const e of r)e._id&&e.original?.name&&(o[e._id]=e.original.name);return o}catch{return{}}})(e,t).then(e=>{0!==Object.keys(e).length&&m(r=>r.map(r=>{const o=e[r.uid];return o?{...r,name:o,url:fs(r.uid,o,t),..."image"===n.type?{thumbUrl:fs(r.uid,o,t)}:{}}:r}))})},[]);const[g,y]=e.useState(!1),[b,v]=e.useState(""),[w,x]=e.useState(!1),k=d?s?"bg-red-100/90 focus:bg-red-50":"bg-transparent focus:bg-blue-50/30":s?"bg-red-100/90 focus:bg-red-50":"bg-amber-50/80 focus:bg-amber-50",S=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(s?"border-red-200 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100"),E=n.readonly?"bg-gray-50 cursor-not-allowed text-gray-500":"",[C,M]=e.useState(null),R=e.useCallback(e=>{if(!e)return void M(null);const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);M(t?null:"邮箱格式不正确")},[]),N=e.useCallback(e=>{if(!e)return void M(null);const t=/^https?:\/\/.+/i.test(e);M(t?null:"链接格式不正确,需以 http:// 或 https:// 开头")},[]),O=e.useCallback(e=>{if(""===e||null==e)return void M(null);const t=Number(String(e).replace(/,/g,""));isNaN(t)?M(null):null!=n.min&&t<n.min?M(`不能小于 ${n.min}`):null!=n.max&&t>n.max?M(`不能大于 ${n.max}`):M(null)},[n.min,n.max]),T=e.useCallback(e=>{n.minLength&&e&&e.length<n.minLength?M(`长度不能少于 ${n.minLength} 个字符(当前 ${e.length} 字符)`):M(null)},[n.minLength]),_=C?React.createElement(t.Tooltip,{title:C,color:"orange",placement:"topLeft"},React.createElement("span",{className:"inline-flex items-center justify-center flex-shrink-0 w-4 h-4 text-amber-500 cursor-pointer"},React.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4"},React.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))):null;if(n.readonly){const e=i?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";if("formula"===n.type||"approvalComments"===n.type);else{if("checkbox"===n.type){const t="true"===r?"是":"否";return React.createElement("div",{className:e},t)}if("radio"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label??"")}if("select"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label||r||"")}if("file"===n.type)return 0===f.length?React.createElement("div",{className:e}):React.createElement("div",{className:`${e} flex flex-wrap gap-2`},f.map(e=>{const t=e.url||(e.response?._id?fs(e.response._id,e.name,"cfs.files.filerecord"):"");return t?React.createElement("a",{key:e.uid,href:t,target:"_blank",rel:"noopener noreferrer",className:"text-gray-900 hover:underline cursor-pointer text-[13px]",title:`下载 ${e.name}`},e.name):React.createElement("span",{key:e.uid,className:"text-gray-500 text-[13px]"},e.name)}));if("image"===n.type);else{if("member"===n.type||"memberMulti"===n.type)return React.createElement(Ds,{value:r,isTableMode:i});if("org"===n.type||"orgMulti"===n.type)return React.createElement(Ls,{value:r,isTableMode:i});if("lookup"===n.type);else{if("email"===n.type)return React.createElement("div",{className:e},r?React.createElement("a",{href:`mailto:${r}`,className:"text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",title:"发送邮件"},r):"");if("url"===n.type)return React.createElement("div",{className:e},r?React.createElement(React.Fragment,null,React.createElement("span",{role:"link",tabIndex:0,className:"text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",title:r,onClick:()=>x(!0),onKeyDown:e=>{"Enter"===e.key&&x(!0)}},r),React.createElement(t.Modal,{title:"即将离开当前页面",open:w,okText:"继续访问",cancelText:"取消",onOk:()=>{x(!1),window.open(r,"_blank","noopener,noreferrer")},onCancel:()=>x(!1)},React.createElement("p",{className:"text-gray-500 mb-2"},"您即将打开以下外部链接:"),React.createElement("p",{className:"break-all text-blue-600 bg-gray-50 rounded px-3 py-2 text-[13px] font-mono"},r))):"");if("password"===n.type)return React.createElement("div",{className:e},"••••••••");if("qrcode"!==n.type)return"autoNumber"===n.type?React.createElement("div",{className:`${e} flex items-center gap-1.5 text-gray-400`},React.createElement("span",null,r||yx(n))):"richtext"===n.type?React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:r||""}}):React.createElement("div",{className:e},r||"")}}}}switch(n.type){case"text":{const e=s||!!C,t=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${e?"bg-red-100/90 focus:bg-red-50":k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(e?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100"),a=(r||"").length,l=!!n.maxLength&&!i;return React.createElement("div",{className:i&&C?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&C&&_,React.createElement("input",{type:"text",value:r,onChange:e=>{o(e.target.value),C&&T(e.target.value)},onBlur:e=>{n.minLength&&T(e.target.value)},placeholder:n.placeholder||"请输入",readOnly:n.readonly,maxLength:n.maxLength,className:`${t} ${E} ${i&&C?"flex-1 min-w-0":""}`}),!i&&(C||l)&&React.createElement("div",{className:"flex justify-between items-center mt-0.5 px-1"},C?React.createElement("p",{className:"text-[11px] text-red-500"},C):React.createElement("span",null),l&&React.createElement("span",{className:"text-[11px] "+(a>=(n.maxLength??0)?"text-red-400":a>.85*(n.maxLength??0)?"text-amber-400":"text-gray-300")},a,"/",n.maxLength)))}case"email":case"url":{const e="email"===n.type,t=s||!!C,a=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${t?"bg-red-100/90 focus:bg-red-50":k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(t?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100");return React.createElement("div",{className:i&&C?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&C&&_,React.createElement("input",{type:e?"email":"url",value:r,onChange:t=>{o(t.target.value),C&&(e?R(t.target.value):N(t.target.value))},onBlur:t=>{e?R(t.target.value):N(t.target.value)},placeholder:n.placeholder||(e?"请输入邮箱地址":"请输入链接地址"),readOnly:n.readonly,maxLength:n.maxLength,className:`${a} ${E} ${i&&C?"flex-1 min-w-0":""}`}),!i&&C&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},C))}case"textarea":{const e=s||!!C,t=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${e?"bg-red-100/90 focus:bg-red-50":k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(e?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100"),a=(r||"").length,l=!!n.maxLength&&!i;return React.createElement("div",{className:i&&C?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&C&&_,React.createElement("textarea",{value:r,onChange:e=>{o(e.target.value),C&&T(e.target.value)},onBlur:e=>{n.minLength&&T(e.target.value)},placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,maxLength:n.maxLength,rows:3,className:`${t} ${E} resize-none ${i&&C?"flex-1 min-w-0":""}`}),!i&&(C||l)&&React.createElement("div",{className:"flex justify-between items-center mt-0.5 px-1"},C?React.createElement("p",{className:"text-[11px] text-red-500"},C):React.createElement("span",null),l&&React.createElement("span",{className:"text-[11px] "+(a>=(n.maxLength??0)?"text-red-400":a>.85*(n.maxLength??0)?"text-amber-400":"text-gray-300")},a,"/",n.maxLength)))}case"number":{const e=e=>{if(!n.thousandSeparator||""===e||void 0===e)return e;const t=Number(e);return isNaN(t)?e:null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN")},t=s||!!C,a=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${t?"bg-red-100/90 focus:bg-red-50":k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(t?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100");return n.thousandSeparator&&!n.readonly?React.createElement("div",{className:i&&C?"flex items-center w-full h-full bg-red-100/90":"w-full flex items-center"},i&&C&&_,React.createElement("input",{type:"text",defaultValue:e(r),key:`num-${n._id}-${r}`,onFocus:e=>{e.target.value=r,M(null)},onBlur:t=>{const n=t.target.value.replace(/,/g,"");o(n),t.target.value=e(n),O(n)},placeholder:n.placeholder||"请输入数字",className:`${a} ${i&&C?"flex-1 min-w-0":"w-full"}`}),!i&&C&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},C)):React.createElement("div",{className:i&&C?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&C&&_,React.createElement("input",{type:"number",value:r,onChange:e=>{o(e.target.value),C&&O(e.target.value)},onBlur:e=>{null==n.min&&null==n.max||O(e.target.value)},placeholder:n.placeholder||"请输入数字",readOnly:n.readonly,min:n.min,max:n.max,step:n.precision?Math.pow(10,-n.precision):void 0,className:`${a} ${E} ${i&&C?"flex-1 min-w-0":""}`}),!i&&C&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},C))}case"date":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.DatePicker,{value:r?u(r):null,onChange:(e,t)=>o("string"==typeof t?t:""),disabled:n.readonly,placeholder:"选择日期",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"datetime":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.DatePicker,{showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",value:r?u(r):null,onChange:(e,t)=>o("string"==typeof t?t:""),disabled:n.readonly,placeholder:"选择日期时间",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"time":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.TimePicker,{value:r?u(r,"HH:mm"):null,onChange:(e,t)=>o("string"==typeof t?t:""),format:"HH:mm",disabled:n.readonly,placeholder:"选择时间",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"select":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Select,{value:r||void 0,onChange:e=>o(e??""),disabled:n.readonly,placeholder:"请选择",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"multiSelect":return React.createElement(t.ConfigProvider,{locale:Br},React.createElement(t.Select,{mode:"multiple",value:r?Array.isArray(r)?r:String(r).split(",").filter(Boolean):[],onChange:e=>o(e.join(",")),disabled:n.readonly,placeholder:"请选择(多选)",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,minHeight:34,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"radio":return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1")},(n.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-pointer text-[13px] text-gray-700"},React.createElement("input",{type:"radio",name:n._id,value:e.value,checked:r===e.value,onChange:e=>o(e.target.value),disabled:n.readonly,className:"w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-200"}),e.label)),(!n.options||0===n.options.length)&&React.createElement("span",{className:"text-[12px] text-gray-400 italic"},"未配置选项"));case"checkbox":return React.createElement("label",{className:"flex items-center gap-2 cursor-pointer py-1 "+(i?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===r,onChange:e=>o(e.target.checked?"true":"false"),disabled:n.readonly,className:"w-4 h-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-200"}),!i&&React.createElement("span",{className:"text-[13px] text-gray-700"},n.label));case"file":{const e=!!n.multiple,r={fileList:f,multiple:e,maxCount:e?void 0:1,accept:n.accept||void 0,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await ps(e);n?.(t)}catch(o){const e=o instanceof Error?o.message:"未知错误";t.message.error(`上传失败: ${e}`),r?.(o instanceof Error?o:new Error(e))}},onChange:e=>{m(e.fileList),o(gx(e.fileList))},onRemove:e=>{const t=f.filter(t=>t.uid!==e.uid);m(t),o(gx(t))}};return React.createElement(t.ConfigProvider,{locale:Br},i?React.createElement("div",{className:"px-2.5 py-2"},React.createElement(t.Upload,{...r},React.createElement(t.Button,{size:"small",icon:React.createElement(er,null),disabled:n.readonly},n.readonly?"仅读":"上传文件"))):React.createElement(t.Upload.Dragger,{...r},React.createElement("p",{className:"ant-upload-drag-icon"},React.createElement(Pn,null)),React.createElement("p",{className:"ant-upload-text text-[13px]"},n.readonly?"仅读模式":e?"点击或拖拽文件到此区域上传(可多选)":"点击或拖拽文件到此区域上传"),n.accept&&React.createElement("p",{className:"ant-upload-hint text-[11px]"},"支持格式: ",n.accept)))}case"image":{const e=!!n.pickerMultiple,r=async e=>{const t=e.url||e.thumbUrl||"";v(t),y(!0)},s={listType:"picture-card",fileList:f,accept:"image/*",multiple:e,maxCount:e?void 0:1,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await ps(e,{collectionName:"cfs.images.filerecord"});n?.(t)}catch(o){const e=o instanceof Error?o.message:"未知错误";t.message.error(`上传失败: ${e}`),r?.(o instanceof Error?o:new Error(e))}},onChange:e=>{const t=e.fileList.map(e=>{if("done"===e.status&&e.response?._id&&!e.url){const t=fs(e.response._id,e.name,"cfs.images.filerecord");return{...e,url:t,thumbUrl:t}}return e});m(t),o(gx(t))},onRemove:e=>{const t=f.filter(t=>t.uid!==e.uid);m(t),o(gx(t))},onPreview:r};return React.createElement(t.ConfigProvider,{locale:Br},React.createElement("div",{className:i?"px-2.5 py-1.5":""},React.createElement(t.Upload,{...s},!n.readonly&&React.createElement("div",{className:"flex flex-col items-center justify-center"},React.createElement(qn,null),React.createElement("span",{className:"text-[11px] mt-1"},"上传")))),b&&React.createElement(t.Image,{wrapperStyle:{display:"none"},preview:{visible:g,onVisibleChange:e=>{y(e),e||v("")}},src:b}))}case"member":return React.createElement(Ms,{value:r,onChange:o,multiple:!1,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,pickerFillRules:n.pickerFillRules,onFillFields:l,valueFormat:n.valueFormat});case"memberMulti":return React.createElement(Ms,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,valueFormat:n.valueFormat});case"org":return React.createElement(_s,{value:r,onChange:o,multiple:!1,isTableMode:i,hasError:s,formalTableMode:d,pickerFillRules:n.pickerFillRules,onFillFields:l,valueFormat:n.valueFormat});case"orgMulti":return React.createElement(_s,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,valueFormat:n.valueFormat});case"lookup":return React.createElement(bs,{field:n,value:r,onChange:o,onFillFields:l,isTableMode:i,hasError:s,formValues:c});case"formula":return React.createElement("div",{className:`${i?"overflow-hidden":"border border-gray-200 rounded-md bg-gray-50"} px-3 py-2 text-[13px] font-mono ${r.startsWith("#ERR")?"text-red-400 text-[11px]":r?"text-gray-800":"text-gray-400"} truncate`,title:r.startsWith("#ERR")?r:n.formula?`= ${n.formula}`:""},i?r.startsWith("#ERR")?r:r||"—":r||(n.formula?`= ${n.formula}`:"(自动计算)"));case"approvalComments":{const e=n.approvalCommentSteps||[];let t=Array.isArray(h)&&h.length?h:function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(r);return p&&0===t.length&&e.length>0&&(t=e.map(e=>({name:e.stepLabel||e.stepId||"审批步骤",type:"trace",judge:"",judgeValue:"approved",step_type:"sign",step_id:e.stepId,children:[{name:"",user_name:"张三",finish_date:"2026-03-14 10:30",judge:"已核准",judgeValue:"approved",opinion:e.defaultComment||"已审阅,同意。",type:"approve",approve_type:"",step_type:"sign",step_id:e.stepId}]}))),0===e.length?React.createElement("div",{className:(i?"px-2.5 py-2":"border border-dashed border-purple-300 rounded-md px-4 py-3")+" flex items-center gap-2 text-gray-400"},React.createElement(pt,{className:"w-4 h-4 shrink-0 text-purple-400"}),React.createElement("span",{className:"text-[12px]"},"审批意见(未绑定步骤)")):React.createElement("div",{className:(i?"":"border border-purple-200 rounded-md")+" bg-white overflow-hidden"},e.map((e,n)=>(()=>{const r=t.filter(t=>{const n=String(t?.step_id||""),r=String(t?.name||"");return n===e.stepId||r===e.stepLabel||r===e.stepId}).flatMap(e=>Array.isArray(e.children)?e.children:[]).filter(t=>{const n="cc"===t?.approve_type;return!(!e.showCirculateComments||!e.showHandlerComments)||(e.showCirculateComments?n:!!e.showHandlerComments&&!n)});if(0===r.length)return null;const o=t=>r.map((n,r)=>{const o=String(n?.user_name||""),i=function(e){if(!e)return"";const t=e.match(/<img[^>]*src=["']([^"']+)["'][^>]*>/i);return t?.[1]||""}(o),s=((a=o)?a.replace(/<img[^>]*>/gi,"").replace(/<[^>]+>/g,"").trim():"")||"审批人";var a;const l=(n?.opinion||"").trim()||e.defaultComment||"";return React.createElement("div",{key:`${n?.step_id||e.stepId||"step"}-${r}`,className:""+(t?"px-2 py-1.5":"px-2.5 py-2")},l&&React.createElement("p",{className:"text-[12px] text-gray-700 leading-snug break-words mb-1"},l),React.createElement("div",{className:"flex items-center gap-1.5 pl-3"},e.showSignature&&i?React.createElement("img",{src:i,alt:s,className:"max-w-[90px] max-h-[60px] object-contain"}):React.createElement("span",{className:"text-[12px] font-medium text-gray-600"},s),n?.finish_date&&React.createElement("span",{className:"text-[12px] text-gray-600 shrink-0"},String(n.finish_date).split(" ")[0])))});return i?React.createElement("div",{key:e.stepId||n,className:n>0?"border-gray-100":""},o(!0)):React.createElement("div",{key:e.stepId||n,className:""+(n>0?"border-gray-100":"")},o(!1))})()))}case"password":return React.createElement(t.Input.Password,{value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入密码",readOnly:n.readonly,disabled:n.readonly,className:i?"picker-table-mode":"",variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}}});case"richtext":return React.createElement(mx,{value:r,onChange:o,readonly:n.readonly,placeholder:n.placeholder||"请输入富文本内容...",isTableMode:i,hasError:s,formalTableMode:d});case"autoNumber":return React.createElement("div",{className:(i?"px-2.5 py-2 flex items-center gap-1.5":"border border-gray-200 rounded-md px-3 py-2 flex items-center gap-1.5")+" text-[13px] text-gray-400 bg-gray-50"},React.createElement("span",null,r||yx(n)));case"qrcode":return React.createElement("div",{className:(i?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-3")+" flex flex-col items-center gap-2"},r?React.createElement(t.QRCode,{value:r,size:i?80:120}):React.createElement(t.QRCode,{value:"-",size:i?80:120,status:"expired"}),!n.readonly&&React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"输入二维码内容",className:`${S} mt-1`}));default:return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:"请输入",className:S})}}function vx(e){const t=Number(e);if(isNaN(t)||!isFinite(t))return"";if(0===t)return"零元整";const n=t<0,r=Math.abs(t),o=Math.floor(r),i=Math.round(100*(r-o)),s=Math.floor(i/10),a=i%10,l=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],c=["","拾","佰","仟"],u=["","万","亿","兆"];function d(e){if(0===e)return"";let t="",n=!1;for(let r=3;r>=0;r--){const o=Math.floor(e/Math.pow(10,r))%10;0===o?t.length>0&&(n=!0):(n&&(t+="零",n=!1),t+=l[o]+c[r])}return t}let h=(function(e){if(0===e)return"";const t=[];let n=e;for(;n>0;)t.push(n%1e4),n=Math.floor(n/1e4);let r="";for(let o=t.length-1;o>=0;o--){const e=t[o];if(0===e)r.length>0&&!r.endsWith("零")&&(r+="零");else{const t=d(e);r.length>0&&e<1e3&&!r.endsWith("零")&&(r+="零"),r+=t+u[o]}}return r.replace(/零+$/,"")}(o)||"零")+"元";return 0===s&&0===a?h+="整":0===s?h+="零"+l[a]+"分":(h+=l[s]+"角",h+=a>0?l[a]+"分":"整"),(n?"负":"")+h}function wx(e){const t=[],n=e=>{Array.isArray(e)?e.forEach(n):t.push(e)};return e.forEach(n),t}function xx(e){if("number"==typeof e)return isFinite(e)?e:0;if(null==e||""===e)return 0;if("string"==typeof e){const t=e.replace(/,/g,"").trim();if(!t)return 0;const n=Number(t);return isNaN(n)||!isFinite(n)?0:n}const t=Number(e);return isNaN(t)||!isFinite(t)?0:t}u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn");const kx={SUM:(...e)=>wx(e).reduce((e,t)=>e+xx(t),0),AVG:(...e)=>{const t=wx(e);return t.length?t.reduce((e,t)=>e+xx(t),0)/t.length:0},AVERAGE:(...e)=>{const t=wx(e);return t.length?t.reduce((e,t)=>e+xx(t),0)/t.length:0},MAX:(...e)=>{const t=wx(e);return 0===t.length?0:Math.max(...t.map(xx))},MIN:(...e)=>{const t=wx(e);return 0===t.length?0:Math.min(...t.map(xx))},COUNT:(...e)=>wx(e).filter(e=>0!==e&&""!==e&&null!=e).length,ABS:e=>Math.abs(Number(e)),ROUND:(e,t=0)=>{const n=Math.pow(10,Number(t));return Math.round(Number(e)*n)/n},FLOOR:e=>Math.floor(Number(e)),CEIL:e=>Math.ceil(Number(e)),INT:e=>Math.trunc(Number(e)),MOD:(e,t)=>Number(e)%Number(t),POWER:(e,t)=>Math.pow(Number(e),Number(t)),SQRT:e=>Math.sqrt(Number(e)),IF:(e,t,n)=>e?t:n,AND:(...e)=>e.every(e=>!!e),OR:(...e)=>e.some(e=>!!e),NOT:e=>!e,ISNULL:e=>null==e||""===e,ISBLANK:e=>null==e||""===e,TODAY:()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},NOW:()=>(new Date).toISOString(),DATE:(e,t,n)=>new Date(Number(e),Number(t)-1,Number(n)).toISOString().split("T")[0],YEAR:e=>(e?new Date(e):new Date).getFullYear(),MONTH:e=>(e?new Date(e):new Date).getMonth()+1,DAY:e=>(e?new Date(e):new Date).getDate(),DATEDIF:(e,t,n)=>{if(!e||!t)return 0;const r=new Date(e),o=new Date(t),i=o.getTime()-r.getTime(),s=String(n).toUpperCase();return"D"===s?Math.floor(i/864e5):"M"===s?12*(o.getFullYear()-r.getFullYear())+(o.getMonth()-r.getMonth()):"Y"===s?o.getFullYear()-r.getFullYear():Math.floor(i/864e5)},DAYS:(e,t)=>t&&e?Math.floor((new Date(e).getTime()-new Date(t).getTime())/864e5):0,CONCAT:(...e)=>e.join(""),LEFT:(e,t)=>String(e).substring(0,Number(t)),RIGHT:(e,t)=>{const n=String(e);return n.substring(n.length-Number(t))},MID:(e,t,n)=>String(e).substring(Number(t)-1,Number(t)-1+Number(n)),LEN:e=>String(e).length,UPPER:e=>String(e).toUpperCase(),LOWER:e=>String(e).toLowerCase(),TRIM:e=>String(e).trim(),REPLACE:(e,t,n)=>String(e).split(String(t)).join(String(n)),FIND:(e,t)=>{const n=String(t).indexOf(String(e));return n>=0?n+1:0},TEXT:(e,t)=>{const n=String(t||"");if("rmb"===n.toLowerCase()||n.includes("[DBNum2]")||n.includes("DBNum2"))return vx(e);const r=Number(e);if(isNaN(r))return String(e);if(n.includes(".")){const e=n.split(".")[1]?.length||0;return r.toFixed(e)}return String(r)},RMB:e=>vx(e),CNY:e=>vx(e)},Sx=Object.keys(kx),Ex=Object.values(kx);function Cx(e,t){if(!e)return"";const n=e.includes("${")?e:`\${${e}}`;try{const e=Object.keys(t),r=[],o=[];for(const n of e){const i=t[n];if("string"!=typeof i||!i.trim())continue;let s;try{s=JSON.parse(i)}catch{continue}if(!Array.isArray(s)||0===s.length)continue;if(!s.every(e=>e&&"object"==typeof e&&!Array.isArray(e)))continue;const a=new Map;for(const e of s)Object.keys(e).forEach(t=>{a.has(t)||a.set(t,[]),a.get(t).push(e[t])});for(const[t,l]of a.entries()){e.includes(t)||r.includes(t)||(r.push(t),o.push(l));const i=`${n}_${t}`;e.includes(i)||r.includes(i)||(r.push(i),o.push(l))}}const i=e.map(e=>{const n=t[e];if(null==n||""===n)return 0;const r=Number(n);return isNaN(r)?n:r});return n.replace(/\$\{([^}]+)\}/g,(t,n)=>{try{const t=[],s=[],a=new Set([...Sx,...e,...r]),l=n.match(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)||[];for(const e of l)a.has(e)||(a.add(e),t.push(e),s.push(0));const c=new Function(...Sx,...e,...r,...t,`return (${n});`)(...Ex,...i,...o,...s);return null==c?"":"number"==typeof c?isNaN(c)?"":isFinite(c)?String(Math.round(1e4*c)/1e4):"#ERR: 除以零":String(c)}catch(s){return`#ERR: ${s instanceof Error?s.message:String(s)}`}})}catch(r){const t=r instanceof Error?r.message:String(r);return console.warn("[Formula]",e,t),`#ERR: ${t}`}}function Mx(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Rx({field:n,isTableMode:r=!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,value:a,onChange:l,fieldPermissions:c,tableBorderColor:u,rowErrors:d}){const h=n.children||[],p=e.useMemo(()=>c?h.filter(e=>"hidden"!==c[e.name]).map(e=>{const t=c[e.name];return"editable"===t?e:"readonly"===t?{...e,readonly:!0}:e}):h,[h,c]),f=void 0!==l,[m,g]=e.useState([{}]),y=f?Mx(a).length>0?Mx(a):[{}]:m,[b,v]=e.useState(a);f&&a!==b&&v(a);const w=e=>{f?l(JSON.stringify(e)):g(e)},x=null==n.maxRows||y.length<n.maxRows,k=y.length>1&&(null==n.minRows||y.length>n.minRows),S=p.filter(e=>"formula"===e.type&&e.formula),E=e=>{if(0===S.length)return e;let t={...e};for(const n of S){const e=Cx(n.formula,t);t[n.name]!==e&&(t={...t,[n.name]:e})}return t},C=e.useMemo(()=>0===S.length?y:y.map(E),[y,S.map(e=>e.name+":"+e.formula).join(",")]),[M,R]=e.useState(null),[N,O]=e.useState({}),T=e.useCallback(e=>{R(e),O({...y[e]||{}})},[y]),_=e.useCallback((e,t)=>{O(n=>{const r={...n,[e]:t};return E(r)})},[E]),A=e.useCallback(()=>{if(null===M)return;const e=[...y];e[M]=E(N),w(e),R(null)},[M,N,y,w,E]),D=e.useCallback(()=>{R(null)},[]),$=r?"":"border-gray-200",L=r?u||"#000000":void 0,I=L?{borderColor:L}:void 0,j=!!n.readonly,[z,P]=t.message.useMessage(),F=e.useMemo(()=>(n.children||[]).filter(e=>"formula"!==e.type&&!e.readonly).map(e=>e.name),[n.children]),B=e.useCallback(e=>{if(!e.trim())return[];const t=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").filter(e=>e.trim());if(0===t.length)return[];const n=t[0].includes("\t")?"\t":",";return t.map(e=>{const t="\t"===n?e.split("\t"):function(e){const t=[];let n="",r=!1;for(let o=0;o<e.length;o++){const i=e[o];r?'"'===i?o+1<e.length&&'"'===e[o+1]?(n+='"',o++):r=!1:n+=i:'"'===i?r=!0:","===i?(t.push(n),n=""):n+=i}return t.push(n),t}(e),r={};return F.forEach((e,n)=>{n<t.length&&(r[e]=t[n].trim())}),r})},[F]),H=e.useCallback(e=>{if(j)return;const t=e.target?.tagName?.toLowerCase();if("input"===t||"textarea"===t||"select"===t)return;const r=e.clipboardData.getData("text/plain");if(!r?.trim())return;const o=B(r);if(0===o.length)return;e.preventDefault();const i=null!=n.maxRows?Math.max(0,n.maxRows-y.length):o.length;if(0===i)return void z.warning(`已达到最大行数 ${n.maxRows}`);const s=o.slice(0,i).map(E);w([...y,...s]),z.success(`已粘贴 ${s.length} 行数据`)},[j,B,y,n.maxRows,E,w,z]),V=e.useCallback(async()=>{if(!j)try{const e=await navigator.clipboard.readText();if(!e?.trim())return void z.info("剪贴板为空");const t=B(e);if(0===t.length)return void z.info("未解析到有效数据");const r=null!=n.maxRows?Math.max(0,n.maxRows-y.length):t.length;if(0===r)return void z.warning(`已达到最大行数 ${n.maxRows}`);const o=t.slice(0,r).map(E);w([...y,...o]),z.success(`已粘贴 ${o.length} 行数据`)}catch{z.error("无法读取剪贴板,请使用 Ctrl+V / ⌘+V 粘贴")}},[j,B,y,n.maxRows,E,w,z]);if(0===p.length)return React.createElement("div",{className:"text-[12px] text-gray-400 italic py-2 text-center"},"未配置子字段");const U=e.useMemo(()=>0===S.length?N:E(N),[N,S.map(e=>e.name+":"+e.formula).join(",")]),q=null!==M&&React.createElement(t.Modal,{open:!0,title:`${n.label} - 第 ${M+1} 行`,onCancel:D,onOk:A,footer:React.createElement("div",{className:"flex justify-end gap-2 pt-2"},React.createElement(t.Button,{onClick:D},"取消"),React.createElement(t.Button,{type:"primary",onClick:A},"确认")),width:"min(780px, 95vw)",destroyOnClose:!0,styles:{body:{maxHeight:"70vh",overflowY:"auto",padding:"16px 0 24px"}}},React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-5 gap-y-5"},p.map(e=>{const t="textarea"===e.type||"html"===e.type;return React.createElement("div",{key:e._id,className:t?"md:col-span-2":""},React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&!j&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement(bx,{field:j?{...e,readonly:!0}:e,value:U[e.name]||"",onChange:t=>_(e.name,t),isTableMode:!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s}))})));return React.createElement("div",{className:r?"":"mt-1",onPaste:H},P,React.createElement("div",{className:r?(!1!==n.showLabel?"border-t ":"")+"overflow-hidden":"border border-gray-300 rounded-md overflow-hidden",style:r&&!1!==n.showLabel?{borderColor:L}:void 0},React.createElement("div",{className:"overflow-x-auto"},React.createElement("table",{className:"w-full text-[13px]",style:{minWidth:p.length>3?120*p.length+80+"px":void 0}},React.createElement("thead",null,React.createElement("tr",{className:`bg-gray-50 border-b ${$}`,style:I},!1!==n.showRowNumber&&React.createElement("th",{className:`w-10 px-2 py-2 text-center text-gray-500 font-medium border-r ${$} sticky left-0 bg-gray-50 z-[1]`,style:I},"#"),p.map(e=>React.createElement("th",{key:e._id,className:`px-3 py-2 text-left font-medium text-gray-600 border-r ${$} last:border-r-0 whitespace-nowrap`,style:I},e.label,e.required&&!e.readonly&&!j&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*"))),!j&&React.createElement("th",{className:"w-16 px-2 py-2 text-center text-gray-500 font-medium sticky right-0 bg-gray-50 z-[1]"},"操作"))),React.createElement("tbody",null,C.map((e,a)=>React.createElement("tr",{key:a,className:`border-b ${r?"":"border-gray-100"} last:border-b-0 hover:bg-gray-50/50`,style:r?I:void 0},!1!==n.showRowNumber&&React.createElement("td",{className:`px-2 py-1.5 text-center text-gray-400 text-[12px] border-r ${$} sticky left-0 bg-white z-[1]`,style:I},a+1),p.map(n=>{const l=d?.[a]?.[n.name];return React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${$} last:border-r-0 ${l?"bg-red-50":!r||n.readonly||j?"":"bg-amber-50/80"}`,style:I},React.createElement("div",{className:l?"flex items-center":void 0},l&&React.createElement(t.Tooltip,{title:l,color:"red",placement:"topLeft"},React.createElement("span",{className:"inline-flex items-center justify-center flex-shrink-0 w-4 h-4 ml-1 mr-0.5 text-red-500 cursor-pointer"},React.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4"},React.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))),React.createElement("div",{className:"flex-1 min-w-0"},React.createElement(bx,{field:j?{...n,readonly:!0}:n,value:e[n.name]||"",onChange:e=>((e,t,n)=>{const r=[...y];r[e]={...r[e],[t]:n},r[e]=E(r[e]),w(r)})(a,n.name,e),isTableMode:r,formalTableMode:!l,hasError:!!l,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s}))))}),!j&&React.createElement("td",{className:"px-1 py-1.5 text-center sticky right-0 bg-white z-[1]"},React.createElement("div",{className:"flex items-center justify-center gap-0.5"},React.createElement("button",{onClick:()=>T(a),className:"rounded p-0.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"弹窗编辑"},React.createElement(ht,{className:"w-3 h-3"})),k&&React.createElement("button",{onClick:()=>{return e=a,void(k&&(w(y.filter((t,n)=>n!==e)),M===e?R(null):null!==M&&M>e&&R(M-1)));var e},className:"rounded p-0.5 text-gray-400 hover:text-red-500 hover:bg-red-50 smooth-transition"},React.createElement(kt,{className:"w-3 h-3"}))))))))),!j&&React.createElement("div",{className:r?"border-t border-black":"border-t border-gray-100"},React.createElement("div",{className:"flex items-center gap-2 px-3 py-1.5"},x&&React.createElement("button",{onClick:()=>{x&&w([...y,{}])},className:"flex items-center gap-1 text-[12px] text-indigo-600 hover:text-indigo-700 smooth-transition"},React.createElement(mt,{className:"w-3.5 h-3.5"})," 添加一行"),x&&React.createElement("button",{onClick:V,className:"flex items-center gap-1 text-[12px] text-gray-500 hover:text-indigo-600 smooth-transition",title:"从Excel或CSV粘贴数据(也可以直接 Ctrl+V / ⌘+V)"},React.createElement(rt,{className:"w-3.5 h-3.5"})," 粘贴")))),q)}function Nx(e,t){return`${e}_${t}`}function Ox({field:t,isTableMode:n=!1,formValues:r,onUpdateValue:o,onFillFields:i,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c,formMode:u="editable",compact:d=!1,tableBorderColor:h}){const p=t.gridRows||3,f=t.gridCols||4,m=t.gridData||[],g=t.children||[],y=e.useMemo(()=>"editable"!==u?g.map(e=>({...e,readonly:!0})):c?g.map(e=>{const t=c[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}):g,[g,c,u]),b=e.useMemo(()=>{const e=new Map;for(const t of y)e.set(t._id,t);return e},[y]),v=e.useMemo(()=>function(e){const t=new Set;for(const n of e){const e=n.rowspan||1,r=n.colspan||1;for(let o=0;o<e;o++)for(let e=0;e<r;e++)0===o&&0===e||t.add(Nx(n.row+o,n.col+e))}return t}(m),[m]),w=e.useMemo(()=>{const e=m.filter(e=>"formula"===e.cellType&&e.value);if(0===e.length)return{};const t={};for(const n of e){t[Nx(n.row,n.col)]=Cx(n.value,r)}return t},[r,m]),x=n?h||"#000000":"",k=n?"":"border-gray-300",S=t.gridColumnWidths,E=!!t.gridScrollable||d;return React.createElement("div",{className:n?"":"mt-1"},React.createElement("div",{className:n?""+(!1!==t.showLabel?"border-t":""):`border ${k}`,style:n?{overflow:"hidden",...!1!==t.showLabel?{borderColor:x}:{}}:void 0},React.createElement("div",{className:E?"overflow-x-auto":""},React.createElement("table",{className:"w-full text-[13px] border-collapse "+(E?"table-fixed":""),style:{minWidth:E&&f>4?100*f+"px":void 0,...n?{margin:"-1px",width:"calc(100% + 2px)"}:{}}},React.createElement("colgroup",null,Array.from({length:f},(e,t)=>React.createElement("col",{key:t,style:S?.[t]?{width:`${S[t]}%`}:void 0}))),React.createElement("tbody",null,Array.from({length:p},(e,t)=>React.createElement("tr",{key:t,className:""+(t<p-1?`border-b ${k}`:""),style:n?{borderColor:x}:void 0},Array.from({length:f},(e,d)=>{const h=Nx(t,d);if(v.has(h))return null;const p=function(e,t,n){return e.find(e=>e.row===t&&e.col===n)}(m,t,d),g=p?.rowspan||1,y=p?.colspan||1,S=d+y>=f,C=p?.cellType||"input",M={textAlign:p?.align||("label"===C?"center":"left")};if(p?.color&&(M.color=p.color),p?.backgroundColor&&(M.backgroundColor=p.backgroundColor),p?.fontWeight&&(M.fontWeight=p.fontWeight),p?.borderStyle&&(M.borderStyle=p.borderStyle),n&&(M.borderColor=x),"label"===C)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:`px-3 py-2 ${S?"":`border-r ${k}`} ${p?.backgroundColor?"":"bg-white"} ${p?.color?"":"text-gray-600"} ${p?.fontWeight?"":"font-medium"}`,style:M},p?.value||"");if("formula"===C){const e=w[h]||"";return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:`px-3 py-2 ${S?"":`border-r ${k}`} ${p?.backgroundColor?"":n?"bg-amber-50/50":""} ${p?.color?"":"text-gray-700"}`,style:E?{...M,maxWidth:0}:M},React.createElement("div",{className:E?"truncate":"",title:e},e))}const R=p?.fieldId?b.get(p.fieldId):null;if(!R&&!p?.fieldType)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:"px-3 py-2 "+(S?"":`border-r ${k}`),style:M}," ");if(R){if(R.hidden)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:"px-3 py-2 "+(S?"":`border-r ${k}`),style:M}," ");const e=R.name,t=r[e]||R.defaultValue||"";if("table"===R.type)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:"p-0 "+(S?"":`border-r ${k}`),style:M},React.createElement(Rx,{field:R,isTableMode:n,value:t,onChange:t=>o(e,t),searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c}));const u=!R.readonly&&n?"bg-amber-50/80":"",h=R.required&&!R.readonly;return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:`p-0 ${S?"":`border-r ${k}`} ${u} ${E?"overflow-hidden":""}`,style:E?{...M,maxWidth:0}:M},React.createElement("div",{className:"relative"},h&&React.createElement("span",{className:"absolute top-0.5 right-1 text-red-500 text-[10px] font-bold z-10"},"*"),React.createElement(bx,{field:R,value:t,onChange:t=>o(e,t),isTableMode:!0,formalTableMode:!0,searchUsersFn:s,searchOrgsFn:a,onFillFields:i,formValues:r})))}const N="editable"!==u;return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:y>1?y:void 0,className:"p-0 "+(S?"":`border-r ${k}`),style:M},React.createElement("input",{type:"number"===p?.fieldType?"number":"text",className:"w-full h-full px-3 py-2 text-[13px] bg-transparent outline-none "+(N?"cursor-not-allowed text-gray-500 bg-gray-50":"focus:bg-blue-50/50"),value:r[h]||"",onChange:e=>!N&&o(h,e.target.value),readOnly:N,placeholder:p?.fieldLabel||p?.value||""}))}))))))))}const Tx=e=>(e.colspan??6)>=12,_x=e=>"section"===e||"table"===e||"grid"===e;const Ax=[{name:"indigo",label:"靛蓝",primary:"#6366f1",title:"#4338ca",bg:"#eef2ff",border:"#818cf8",desc:"#818cf8"},{name:"emerald",label:"翡翠绿",primary:"#10b981",title:"#047857",bg:"#ecfdf5",border:"#34d399",desc:"#6ee7b7"},{name:"amber",label:"琥珀",primary:"#f59e0b",title:"#92400e",bg:"#fffbeb",border:"#fbbf24",desc:"#fbbf24"},{name:"rose",label:"玫瑰红",primary:"#f43f5e",title:"#be123c",bg:"#fff1f2",border:"#fb7185",desc:"#fda4af"},{name:"sky",label:"天蓝",primary:"#0ea5e9",title:"#0369a1",bg:"#f0f9ff",border:"#38bdf8",desc:"#7dd3fc"},{name:"violet",label:"紫罗兰",primary:"#8b5cf6",title:"#6d28d9",bg:"#f5f3ff",border:"#a78bfa",desc:"#c4b5fd"},{name:"slate",label:"石板灰",primary:"#64748b",title:"#334155",bg:"#f8fafc",border:"#94a3b8",desc:"#94a3b8"},{name:"orange",label:"橙色",primary:"#f97316",title:"#c2410c",bg:"#fff7ed",border:"#fb923c",desc:"#fdba74"},{name:"teal",label:"青色",primary:"#14b8a6",title:"#0f766e",bg:"#f0fdfa",border:"#2dd4bf",desc:"#5eead4"}];function Dx(e){const t=e.replace("#","");return 3===t.length?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)}:6===t.length?{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}:null}function $x(e,t,n){return"#"+[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function Lx(e,t){const n=Dx(e);return n?$x(n.r+(255-n.r)*t,n.g+(255-n.g)*t,n.b+(255-n.b)*t):e}function Ix(e,t){const n=Dx(e);return n?$x(n.r*(1-t),n.g*(1-t),n.b*(1-t)):e}function jx(e){if(e.sectionColor){const n={name:"custom",label:"自定义",primary:t=e.sectionColor,title:Ix(t,.35),bg:Lx(t,.92),border:Lx(t,.35),desc:Lx(t,.35)};return{...n,title:e.titleColor||n.title}}var t;const n=Ax.find(t=>t.name===e.colorScheme)||Ax[0];return{...n,title:e.titleColor||n.title}}function zx(e,t,n){if(!e?.length)return!1;const r=e.map(e=>function(e,t){const n=String(t[e.field]??"");switch(e.operator){case"eq":return n===e.value;case"neq":return n!==e.value;case"contains":return n.includes(e.value||"");case"notContains":return!n.includes(e.value||"");case"empty":return""===n;case"notEmpty":return""!==n;default:return!1}}(e,n));return"or"===(t||"and")?r.some(Boolean):r.every(Boolean)}function Px({fields:e,columns:t=2,formValues:n,updateValue:r,fieldErrors:o,tableRowErrors:i={},searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,labelClassName:c,onFillFields:u,fieldPermissions:d,formMode:h="editable",resolveValue:p,historyApproves:f,previewMode:m,tableBorderColor:g="#000000",tableShowLeftBorder:y=!0,tableShowRightBorder:b=!0}){const v=[];let w=0,x=0;if(e.forEach(e=>{const n=_x(e.type),r=Tx(e),o=n||r?t:Math.min(e.tableColspan||1,t);if(w>0&&(n||r||w+o>t)){const e=t-w;e>0&&v.push({type:"empty",cs:e,key:"empty-"+x++}),w=0}v.push({type:"field",field:e}),n||r?w=0:(w+=o,w>=t&&(w=0))}),w>0){const e=t-w;e>0&&v.push({type:"empty",cs:e,key:"empty-"+x++})}const k={minWidth:0,backgroundColor:"#fff"},S=g||"#000000";return React.createElement("div",{className:"overflow-hidden workflow-form-v2-body",style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"1px",backgroundColor:S,borderTop:`2px solid ${S}`,borderBottom:`2px solid ${S}`,borderLeft:y?`2px solid ${S}`:"none",borderRight:b?`2px solid ${S}`:"none"}},v.map(e=>{if("empty"===e.type)return React.createElement("div",{key:e.key,style:{...k,gridColumn:`span ${e.cs}`}});const{field:y}=e,b=_x(y.type),v=Tx(y),w={gridColumn:`span ${b||v?t:Math.min(y.tableColspan||1,t)}`,minWidth:0,backgroundColor:"#fff"};if("section"===y.type){const e=jx(y);return React.createElement("div",{key:y._id,style:{...w,backgroundColor:e.bg},"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} px-3 py-2`},React.createElement("div",{className:"flex items-center gap-2"},React.createElement("span",{className:"text-[13px] font-semibold",style:{color:e.title}},y.label)),y.description&&React.createElement("div",{className:"text-[11px] mt-0.5 ml-[22px]",style:{color:e.desc},dangerouslySetInnerHTML:{__html:y.description}}))}if("table"===y.type){const e=!1!==y.showLabel&&(y.colorScheme||y.sectionColor)?jx(y):null;return React.createElement("div",{key:y._id,style:w,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},!1!==y.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"rgba(238,242,255,0.6)"}},React.createElement("span",{className:"text-[13px] font-semibold table-label",style:{color:e?.title||"#374151"}},y.label),y.required&&!y.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==y.showLabel&&y.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#9ca3af",backgroundColor:e?.bg||"rgba(238,242,255,0.6)"},dangerouslySetInnerHTML:{__html:y.description}}),React.createElement(Rx,{field:y,isTableMode:!0,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,value:n[y.name],onChange:e=>r(y.name,e),fieldPermissions:d,tableBorderColor:g,rowErrors:i[y.name]}))}if("grid"===y.type){const e=!1!==y.showLabel&&(y.colorScheme||y.sectionColor)?jx(y):null;return React.createElement("div",{key:y._id,style:w,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},!1!==y.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"rgba(240,253,250,0.6)"}},React.createElement("span",{className:"text-[13px] grid-label font-semibold",style:{color:e?.title||"#374151"}},y.label)),!1!==y.showLabel&&y.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#9ca3af",backgroundColor:e?.bg||"rgba(240,253,250,0.6)"},dangerouslySetInnerHTML:{__html:y.description}}),React.createElement(Ox,{field:y,isTableMode:!0,formValues:n,onUpdateValue:r,onFillFields:u,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:d,formMode:h,tableBorderColor:g}))}const x=!!o?.[y.name];return React.createElement("div",{key:y._id,style:w,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},React.createElement("div",{className:"flex h-full min-w-0 overflow-hidden"},!1!==y.showLabel&&React.createElement("div",{"data-field-label":"",className:Je("field-label w-28 lg:w-32 shrink-0 border-r px-2.5 py-2 flex items-center justify-center",x?"bg-red-50":"bg-gray-50/30",y.labelClassName||c),style:{borderColor:S}},React.createElement("span",{className:Je("text-[13px] font-medium break-words text-center leading-snug",x?"text-red-700":"text-gray-600",y.labelClassName||c)},y.label),y.required&&!y.readonly&&React.createElement("span",{className:"text-red-500 text-[10px] font-bold ml-0.5"},"*")),React.createElement("div",{"data-field-item":"",className:Je("field-item flex-1 min-w-0 overflow-hidden flex flex-col justify-center",!y.readonly&&(x?"bg-red-100/90":"bg-amber-50/80"))},React.createElement(bx,{field:y,value:(p||Bx)(n[y.name]??y.defaultValue??""),onChange:e=>r(y.name,e),isTableMode:!0,hasError:x,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,onFillFields:u,formValues:n,historyApproves:f,previewMode:m}),x&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 px-2 py-0.5 leading-tight"},o[y.name]))))}))}function Fx(e){if(!e)return"";if("__TODAY__"===e){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}if("__NOW__"===e){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}if("__CURRENT_TIME__"===e){const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}return"__CURRENT_USER__"===e||"__CURRENT_USER_ORG__"===e?e:e.includes("${")?Cx(e,{}):e}function Bx(e){return e&&"string"==typeof e&&e.includes("${")?Fx(e):e}function Hx(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0");return`${n}-${r}-${String(t.getDate()).padStart(2,"0")}`}catch{return e}}const Vx=e.forwardRef(({fields:n,values:r,onChange:o,onSubmit:i,formName:s,viewMode:a="form",readOnly:l=!1,formMode:c="editable",fieldPermissions:u,formEvents:d,showButtons:h=!0,searchUsersFn:p,searchOrgsFn:f,tableColumns:m=2,searchObjectFn:g,className:y,labelClassName:b,onUpdateField:v,compact:w=!1,showFormName:x=!0,currentUser:k,state:S="draft",submitDate:E,context:C,currentStep:M={},historyApproves:R=[],previewMode:T=!1,formColumns:_=2,tableTitleColor:A,tableBorderColor:D="#000000",tableShowLeftBorder:$=!0,tableShowRightBorder:L=!0},I)=>{const[j,z]=t.message.useMessage(),P=e.useCallback(e=>{const t=Bx(e||"");return"__CURRENT_USER__"===t?k?.user||"":"__CURRENT_USER_ORG__"===t?k?.organization?._id||"":t},[k?.user,k?.organization?._id]),F=e.useMemo(()=>{const e=k?.organization;if(e?._id)return{id:e._id,name:e.name||"",fullname:e.fullname||""}},[k?.organization]),B=e.useMemo(()=>n.map(e=>{const t=e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:Fx(e.defaultValue)}:e;if(t.children?.length){const e=t.children.map(e=>e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:Fx(e.defaultValue)}:e);return{...t,children:e}}return t}),[n.map(e=>`${e.name}:${e.defaultValue??""}:${(e.children||[]).map(e=>`${e.name}:${e.defaultValue??""}`).join(",")}`).join("|")]),H=l||"readonly"===c||"print"===c,V=H?"print"===c?"print":"readonly":c,U=e.useMemo(()=>B.map(e=>{if(H)return{...e,readonly:!0};if(!u)return e;const t=u[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}),[B,u,H]);console.log("FormRenderer externalValues",r);const q=e.useMemo(()=>{const e={_id:"__applicant__system",name:"__applicant",label:"申请人",type:"member",required:!1,readonly:"draft"!==S,hidden:!1,pickerMultiple:!1,defaultValue:k?.user,valueFormat:"string"};return U.some(e=>"__applicant"===e.name)?U:[...U,e]},[U,k,S]),[W,Y]=e.useState(()=>{const e={};for(const t of n){if(t.defaultValue){const n=Fx(t.defaultValue);"__CURRENT_USER__"===n?k?.user&&(e[t.name]=k.user):"__CURRENT_USER_ORG__"===n?k?.organization?._id&&(e[t.name]={id:k.organization._id,name:k.organization.name||"",fullname:k.organization.fullname||""}):e[t.name]=n}if(t.children?.length)for(const n of t.children)if(n.defaultValue){const t=Fx(n.defaultValue);"__CURRENT_USER__"===t?k?.user&&(e[n.name]=k.user):"__CURRENT_USER_ORG__"===t?k?.organization?._id&&(e[n.name]={id:k.organization._id,name:k.organization.name||"",fullname:k.organization.fullname||""}):e[n.name]=t}}return{...e,...r||{}}}),[J,K]=e.useState({}),[G,Z]=e.useState({}),Q=e.useRef(W);e.useEffect(()=>{Q.current=W},[W]),e.useEffect(()=>{Y(e=>{const t={};for(const n of B){if(n.defaultValue&&null==e[n.name]){const e=n.defaultValue;"__CURRENT_USER__"===e?k?.user&&(t[n.name]=k.user):"__CURRENT_USER_ORG__"===e?F&&(t[n.name]=F):t[n.name]=e}if(n.children?.length)for(const r of n.children)if(r.defaultValue&&null==e[r.name]){const e=r.defaultValue;"__CURRENT_USER__"===e?k?.user&&(t[r.name]=k.user):"__CURRENT_USER_ORG__"===e?F&&(t[r.name]=F):t[r.name]=e}}return Object.keys(t).length>0?{...e,...t}:e})},[B,k?.user,F]);const X=e.useRef("");e.useEffect(()=>{if(!r)return;const e=JSON.stringify(r);e!==X.current&&(X.current=e,Y(e=>{const t={...e};let n=!1;for(const[o,i]of Object.entries(r)){const e=P(i);t[o]!==e&&(t[o]=e,n=!0)}return n?t:e}))},[r,P]);const ee=e.useMemo(()=>{const e=String(M?.name??"");return{...W,stepName:e}},[W,M]),te=q.filter(e=>!e.hidden&&(!e.visibilityRules?.length||zx(e.visibilityRules,e.visibilityLogic,ee))).map(e=>{let t=e;if(t.requiredRules?.length){const e=zx(t.requiredRules,t.requiredLogic,ee);e!==t.required&&(t={...t,required:t.required||e})}if(["table","grid"].includes(t.type)&&t.children?.length){const n=t.children.filter(e=>!e.hidden&&(!e.visibilityRules?.length||zx(e.visibilityRules,e.visibilityLogic,ee))).map(e=>{if(!e.requiredRules?.length)return e;const t=zx(e.requiredRules,e.requiredLogic,ee);return t!==e.required?{...e,required:e.required||t}:e});t=t===e?{...e,children:n}:{...t,children:n}}return t}),ne=function(e,t=2){const n=[];let r=[],o=0;for(const i of e)if(!i.hidden)if(Tx(i)||_x(i.type))r.length&&(n.push(r),r=[],o=0),n.push([i]);else{const e=Math.min(i.tableColspan||1,t);o+e>t&&(r.length&&(n.push(r),r=[]),o=0),r.push(i),o+=e,o>=t&&(n.push(r),r=[],o=0)}return r.length&&n.push(r),n}(te,"table"===a?m:_),re=[...q.filter(e=>"formula"===e.type&&e.formula),...q.filter(e=>["grid","table"].includes(e.type)&&e.children).flatMap(e=>e.children.filter(e=>"formula"===e.type&&e.formula))];e.useEffect(()=>{let e=!1;const t={...W};for(const n of re){const r=Cx(n.formula,W);t[n.name]!==r&&(t[n.name]=r,e=!0)}e&&(Y(t),o?.(t))},[W,re.map(e=>e.name+":"+e.formula).join(",")]);const oe=e.useRef(!1);e.useEffect(()=>{if(oe.current)return;if(!d?.onInit)return;oe.current=!0;const e=N(Q.current,(e,t)=>{Y(n=>{const r={...n,[e]:t};return o?.(r),r})},q,v,j,C,M);O(d.onInit,{form:e,fields:q,values:Q.current}).catch(e=>{console.error("[FormRenderer] onInit error:",e)})},[d?.onInit]);const ie=e.useMemo(()=>{const e=[];for(const t of te)"grid"===t.type&&t.children?.length?e.push(...t.children):e.push(t);return e},[te]);e.useImperativeHandle(I,()=>({getValues:()=>{const e={};return ie.forEach(t=>{e[t.name]=W[t.name]??t.defaultValue??""}),e},validate:async()=>{const e=[],t={},n={},r=e=>{if(!e)return[];try{const t="string"==typeof e?JSON.parse(e):e;return Array.isArray(t)?t:[]}catch{return[]}};if(ie.forEach(o=>{const i=W[o.name]??o.defaultValue??"";if(o.required&&!o.readonly){let n=!1;if("table"===o.type){const e=r(i);n=0===e.length||1===e.length&&!Object.values(e[0]).some(e=>null!=e&&""!==e)}else n=!i;if(n){const n=`${o.label} 不能为空`;return e.push(n),void(t[o.name]=n)}}if("number"===o.type&&""!==i&&null!=i){const n=Number(i);if(!isNaN(n))if(null!=o.min&&n<o.min){const n=`${o.label} 不能小于 ${o.min}`;e.push(n),t[o.name]=n}else if(null!=o.max&&n>o.max){const n=`${o.label} 不能大于 ${o.max}`;e.push(n),t[o.name]=n}}if(["text","textarea"].includes(o.type)&&"string"==typeof i&&""!==i)if(null!=o.minLength&&i.length<o.minLength){const n=`${o.label} 长度不能少于 ${o.minLength} 个字符`;e.push(n),t[o.name]=n}else if(null!=o.maxLength&&i.length>o.maxLength){const n=`${o.label} 长度不能超过 ${o.maxLength} 个字符`;e.push(n),t[o.name]=n}if("table"===o.type){const s=r(i),a=s.filter(e=>Object.values(e).some(e=>null!=e&&""!==e));if(null!=o.minRows&&a.length<o.minRows){const n=`${o.label} 至少需要填写 ${o.minRows} 行数据`;e.push(n),t[o.name]=n}else if(null!=o.maxRows&&s.length>o.maxRows){const n=`${o.label} 不能超过 ${o.maxRows} 行`;e.push(n),t[o.name]=n}if(o.children?.length){const t=s.map(e=>{const t={};for(const n of o.children){if(n.readonly||"formula"===n.type)continue;const r=e[n.name]??"";if(n.required&&!r)t[n.name]=`${n.label} 不能为空`;else if("number"===n.type&&""!==r){const e=Number(r);isNaN(e)||(null!=n.min&&e<n.min?t[n.name]=`${n.label} 不能小于 ${n.min}`:null!=n.max&&e>n.max&&(t[n.name]=`${n.label} 不能大于 ${n.max}`))}else["text","textarea"].includes(n.type)&&""!==r&&(null!=n.minLength&&r.length<n.minLength?t[n.name]=`${n.label} 长度不能少于 ${n.minLength} 个字符`:null!=n.maxLength&&r.length>n.maxLength&&(t[n.name]=`${n.label} 长度不能超过 ${n.maxLength} 个字符`))}return t});t.some(e=>Object.keys(e).length>0)&&(n[o.name]=t,t.forEach((t,n)=>{Object.keys(t).length>0&&e.push(`${o.label} 第 ${n+1} 行:${Object.values(t).join("、")}`)}))}}}),K(t),Z(n),e.length>0){j.error({content:1===e.length?e[0]:`表单校验未通过,请检查以下字段:${e.join(";")}`,duration:4});const n=ie.find(e=>t[e.name]);n&&setTimeout(()=>{const e=document.querySelector(`[data-field-name="${n.name}"]`);e?.scrollIntoView({behavior:"smooth",block:"center"})},0)}return{isValid:0===e.length,errors:e}}}),[W,ie,K,Z,j]);const se=e.useCallback((e,t)=>{K(t=>{if(!t[e])return t;const n={...t};return delete n[e],n}),Y(n=>{const r={...n,[e]:t};return o?.(r),r})},[o]),ae=e.useCallback((e,t)=>{const n=Q.current[e]||"";if(se(e,t),d?.onValueChange){let r=q.find(t=>t.name===e);if(!r)for(const t of q)if(t.children){const n=t.children.find(t=>t.name===e);if(n){r=n;break}}const o={...Q.current,[e]:t},i=N(o,se,q,v,j,C,M);O(d.onValueChange,{field:r?{name:r.name,label:r.label,type:r.type}:{name:e},value:t,oldValue:n,form:i,values:o,fields:q}).catch(e=>{console.error("[FormRenderer] onValueChange error:",e)})}},[d?.onValueChange,q,se,v,j,C,M]),le=e.useCallback(e=>{K(t=>{const n=Object.keys(e);if(n.every(e=>!t[e]))return t;const r={...t};for(const e of n)delete r[e];return r}),Y(t=>{const n={...t,...e};return o?.(n),n})},[o]),ce=e.useCallback(async()=>{if(d?.onSubmit){const t=N(Q.current,se,q,v,j,C,M);try{if(!1===await O(d.onSubmit,{form:t,values:{...Q.current},fields:q}))return}catch(e){return void console.error("[FormRenderer] onSubmit error:",e)}}i?.(Q.current)},[d?.onSubmit,q,se,v,j,C,M,i]);if(0===q.length)return React.createElement("div",{className:`h-full flex items-center justify-center ${y||""}`},z,React.createElement("p",{className:"text-[13px] text-gray-400"},"表单为空,请先添加字段"));if("table"===a){const e=te.filter(e=>"__applicant__system"!==e._id),t=te.find(e=>"__applicant__system"===e._id),n=t?J[t.name]:void 0;return React.createElement("div",{className:`p-6 max-w-4xl m-auto h-full overflow-y-auto custom-scrollbar ${"print"===V?"workflow-form-print":""} ${y||""}`},z,React.createElement("div",{className:"mx-auto"},x&&s&&React.createElement("div",{className:"mb-4 text-center"},React.createElement("h2",{className:"text-xl font-bold",style:A?{color:A}:void 0},s)),React.createElement(Px,{fields:e,columns:m,formValues:W,updateValue:ae,fieldErrors:J,tableRowErrors:G,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,labelClassName:b,onFillFields:le,fieldPermissions:u,formMode:V,resolveValue:P,historyApproves:R,previewMode:T,tableBorderColor:D,tableShowLeftBorder:$,tableShowRightBorder:L}),t&&React.createElement("div",{className:"flex items-center","data-field-name":t.name},React.createElement("div",{className:"flex items-center",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},t.label,t.required&&!t.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&_.field-input-wrapper]:!border-0 [&_.field-input-wrapper]:!shadow-none [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(bx,{field:t,value:P(W[t.name]??t.defaultValue??""),onChange:e=>ae(t.name,e),hasError:!!n,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:le,formValues:W,historyApproves:R,previewMode:T,minimal:!0})),n&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 ml-2 flex items-center gap-1"},React.createElement("span",null,"⚠"),n)),"draft"!==S&&E&&React.createElement("div",{className:"flex items-center justify-end ml-4",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Hx(E))))))}return React.createElement("div",{className:`h-full overflow-y-auto custom-scrollbar ${w?"bg-white":"bg-gray-50/50"} ${"print"===V?"workflow-form-print":""} ${y||""}`},z,React.createElement("div",{className:w?"px-3 py-3":"p-6 max-w-3xl mx-auto"},x&&s&&React.createElement("div",{className:w?"mb-3 text-center":"mb-6 text-center"},React.createElement("h2",{className:w?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800"},s)),React.createElement("div",{className:w?"":"bg-white rounded-xl border border-gray-200 shadow-sm p-6"},React.createElement("div",{className:w?"space-y-3":"grid gap-x-6 gap-y-5",style:w?void 0:{gridTemplateColumns:`repeat(${_}, minmax(0, 1fr))`}},ne.map((e,t)=>{const n=e[0];if("section"===n.type){const e=jx(n);return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${_}`}},React.createElement("div",{className:"flex items-center gap-2 mb-1"},React.createElement("h3",{className:(w?"text-[13px]":"text-[15px]")+" font-semibold",style:{color:n.titleColor||e.title}},n.label)),n.description&&React.createElement("div",{className:"text-[12px] ml-6",style:{color:e.desc},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement("div",{className:w?"mt-1 mb-1":"mt-2 mb-1",style:{borderBottom:`2px solid ${e.border}`}}))}if("table"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?jx(n):null;return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${_}`}},!1!==n.showLabel&&React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement("label",{className:"text-[13px] font-medium",style:{color:e?.title||"#374151"}},n.label),n.required&&!n.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#9ca3af"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Rx,{field:n,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,value:W[n.name],onChange:e=>ae(n.name,e),fieldPermissions:u,rowErrors:G[n.name]}))}if("grid"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?jx(n):null;return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${_}`}},!1!==n.showLabel&&React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement("label",{className:"text-[13px] font-medium",style:{color:e?.title||"#374151"}},n.label)),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#9ca3af"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Ox,{field:n,formValues:W,onUpdateValue:ae,onFillFields:le,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,fieldPermissions:u,formMode:V,compact:w}))}return e.map(e=>{const t=Tx(e)||_x(e.type),n=!1!==e.showLabel&&"checkbox"!==e.type,r=J[e.name],o="__applicant__system"===e._id;return React.createElement("div",{key:e._id,"data-field-name":e.name,className:"",style:w?void 0:t?{gridColumn:`span ${_}`}:void 0},o&&w?React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"[&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(bx,{field:e,value:P(W[e.name]??e.defaultValue??""),onChange:t=>ae(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:le,formValues:W,historyApproves:R,previewMode:T,minimal:!0})),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),r),"draft"!==S&&E&&React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1 mt-3"},"提交日期"),React.createElement("span",{className:"block text-[13px] text-gray-800"},Hx(E)))):o?React.createElement("div",{className:"flex items-center gap-2",style:{gridColumn:`span ${_}`}},React.createElement("div",{className:"flex items-center flex-1 min-w-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(bx,{field:e,value:P(W[e.name]??e.defaultValue??""),onChange:t=>ae(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:le,formValues:W,historyApproves:R,previewMode:T,minimal:!0}))),"draft"!==S&&E&&React.createElement("div",{className:"flex items-center shrink-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Hx(E))),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 flex items-center gap-1 w-full"},React.createElement("span",null,"⚠"),r)):React.createElement(React.Fragment,null,n&&React.createElement("label",{className:`block text-[13px] font-medium ${r?"text-red-600":"text-gray-700"} ${w?"mb-1":"mb-1.5"}`},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),n&&e.description&&React.createElement("p",{className:"text-[11px] text-gray-400 "+(w?"mb-1":"mb-1.5")},e.description),React.createElement(bx,{field:e,value:P(W[e.name]??e.defaultValue??""),onChange:t=>ae(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:le,formValues:W,historyApproves:R,previewMode:T}),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),r)))})})),h&&"editable"===V&&React.createElement("div",{className:(w?"mt-4 pt-3":"mt-8 pt-5")+" border-t border-gray-100 flex justify-end gap-3"},React.createElement("button",{className:`rounded-md border border-gray-300 bg-white ${w?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition`},"取消"),React.createElement("button",{onClick:ce,className:`rounded-md bg-indigo-600 ${w?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-white hover:bg-indigo-700 smooth-transition`},"提交")))))}),Ux={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:(e,t)=>"W"===t?e+"周":e+"日",weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:(e,t)=>{const n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};function qx(e,t){const n={...e};for(const r of t)if("table"===r.type){const e=n[r.name];if("string"==typeof e)if(""===e)n[r.name]=[];else try{const t=JSON.parse(e);n[r.name]=Array.isArray(t)?t:[]}catch{n[r.name]=[]}else Array.isArray(e)||(n[r.name]=[])}return n}!function(){const e=window.dayjs;e&&"function"==typeof e.extend&&(e.extend(p),e.extend(g),e.extend(v),e.locale(Ux,null,!0),e.locale("zh-cn")),u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn")}(),function(){if("undefined"==typeof amisRequire)return void console.error("[workflow-form-v2] amisRequire is not defined. Make sure the amis SDK is loaded first.");const e=amisRequire("react"),t=amisRequire("amis");t?.Renderer?(t.Renderer({type:"workflow-form-v2",autoVar:!0})(function(n){const{$schema:r,data:o,dispatchEvent:i,currentUser:s,state:a,submit_date:l,currentStep:c}=n,u=t.ScopedContext,d=e.useContext(u),h=e.useRef(null),p={getValues:()=>qx(h.current?.getValues()||y,m),validate:async()=>{const e=await(h.current?h.current.validate():Promise.resolve({isValid:!0,errors:[]}));return console.log("[workflow-form-v2] validate result",e),e.isValid}},f=e.useRef(null);null===f.current?f.current={...p}:Object.assign(f.current,p),Object.defineProperty(f.current,"props",{get:()=>n,configurable:!0}),e.useEffect(()=>{if(d&&(r.id||n.id))return d.registerComponent(f.current),()=>{d.unRegisterComponent(f.current)}},[r.id||n.id]);let m=[];Array.isArray(r.fields)?m=r.fields:"string"==typeof r.fields&&o&&(m=o[r.fields.replace(/^\$\{|\}$/g,"")]||[]),!m.length&&Array.isArray(o?.fields)&&(m=o.fields);let g={};r.values&&"object"==typeof r.values?g=r.values:"string"==typeof r.values&&o&&(g=o[r.values.replace(/^\$\{|\}$/g,"")]||{}),!Object.keys(g).length&&o?.values&&"object"==typeof o.values&&(g=o.values);const y=e.useMemo(()=>function(e){const t={};for(const[n,r]of Object.entries(e))Array.isArray(r)?r.length>0&&"object"==typeof r[0]&&r[0]?.id?t[n]=r:t[n]=JSON.stringify(r):"object"==typeof r&&null!==r&&r.id?t[n]=r:t[n]=null==r?"":String(r);return t}(g),[JSON.stringify(g)]),[b,v]=e.useState(!1);e.useEffect(()=>{const e=()=>{v(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const w=b?"form":r.viewMode||"form",x=b?1:r.tableColumns||2,k=r.layout??r.formColumns,S=b||"single"===k?1:"double"===k?2:Math.min(Math.max(Number(k)||2,1),3),E=r.readOnly??r.static??!1,C=r.formMode||"editable",R=r.formName||o?.formName||"",N=r.showButtons??!0,O=!!b||(r.compact??!1),T=r.showFormName??!0,_=r.formEvents,A=r.tableTitleColor||void 0,D=r.tableBorderColor||"#000000",$=!1!==r.tableShowOuterBorder;let L,I=[];Array.isArray(r.historyApproves)?I=r.historyApproves:"string"==typeof r.historyApproves&&o&&(I=o[r.historyApproves.replace(/^\$\{|\}$/g,"")]||[]),Array.isArray(I)&&0!==I.length||!Array.isArray(o?.historyApproves)||(I=o.historyApproves),"editable"===C&&(r.fieldPermissions&&"object"==typeof r.fieldPermissions?L=r.fieldPermissions:"string"==typeof r.fieldPermissions&&o&&(L=o[r.fieldPermissions.replace(/^\$\{|\}$/g,"")]),!L&&o?.fieldPermissions&&(L=o.fieldPermissions));const j=r.apiBaseUrl||o?.context?.rootUrl||o?.rootUrl||"",z=r.authToken||o?.context?.authToken||o?.authToken||"",P=r.spaceId||o?.context?.spaceId||o?.spaceId||"",F=e.useCallback(async e=>{if(!j)return[];try{const t=`${j}/api/v6/space_users?$top=20&$select=name,user,mobile&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${P},${z}`}}),r=await n.json();return(r?.value||r?.data||r||[]).map(e=>({_id:e.user||e._id,label:e.name||e.label||"",description:e.mobile||""}))}catch(t){return console.warn("[workflow-form-v2] searchUsers error:",t),[]}},[j,z,P]),B=e.useCallback(async e=>{if(!j)return[];try{const t=`${j}/api/v6/organizations?$top=20&$select=name,fullname&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${P},${z}`}}),r=await n.json();return(r?.value||r?.data||r||[]).map(e=>({_id:e._id,label:e.name||e.label||"",description:e.fullname||""}))}catch(t){return console.warn("[workflow-form-v2] searchOrgs error:",t),[]}},[j,z,P]),H=e.useCallback((e,t)=>async n=>{if(!j||!e)return[];try{const r=n?`&$filter=contains(${encodeURIComponent(t)},'${encodeURIComponent(n)}')`:"",o=`${j}/api/v6/${encodeURIComponent(e)}?$top=20&$select=_id,${encodeURIComponent(t)}${r}`,i=await fetch(o,{headers:{Authorization:`Bearer ${P},${z}`}}),s=await i.json();return(s?.value||s?.data||s||[]).map(e=>({_id:e._id,label:e[t]||e.name||e._id,description:""}))}catch(r){return console.warn("[workflow-form-v2] searchObject error:",r),[]}},[j,z,P]),V={props:n,getValues:p.getValues,validate:p.validate};return e.createElement(Vx,{fields:m,values:y,ref:h,onChange:e=>{const t=qx(e,m);i?.("change",t?M(o,{value:t}):o,V)},onSubmit:e=>{const t=qx(e,m);i?.("submit",t?M(o,{value:t}):o,V)},formName:R,viewMode:w,tableColumns:x,formColumns:S,readOnly:E,formMode:C,fieldPermissions:L,formEvents:_,showButtons:N,compact:O,showFormName:T,searchUsersFn:F,searchOrgsFn:B,searchObjectFn:H,currentUser:s,state:a,submitDate:l,currentStep:c||r.currentStep||{},historyApproves:Array.isArray(I)?I:[],tableTitleColor:A,tableBorderColor:D,tableShowLeftBorder:$,tableShowRightBorder:$,className:["workflow-form-v2",n.className].filter(Boolean).join(" ")})}),console.log("[workflow-form-v2] amis Renderer registered successfully.")):console.error("[workflow-form-v2] amis.Renderer not found.")}()}(amisRequire("react"),antd,amisRequire("react-dom"));
|