PATH:
home
/
lab2454c
/
argowells.com
/
wp-content
/
plugins
/
elementor
/
assets
/
js
/
packages
/
editor-controls
/*! For license information please see editor-controls.min.js.LICENSE.txt */ !function(){var e={1523:function(e,t,n){"use strict";var r=n(7557),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,s=r.useEffect,l=r.useLayoutEffect,a=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return l(function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})},[e,n,t]),s(function(){return c(o)&&u({inst:o}),e(function(){c(o)&&u({inst:o})})},[e]),a(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},3816:function(e,t,n){"use strict";var r=n(7557),o=n(6886),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,l=r.useRef,a=r.useEffect,c=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var d=l(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=c(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return l=t}return l=e}if(t=l,i(s,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(s=e,t):(s=e,l=n)}var s,l,a=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,o]);var h=s(e,d[0],d[1]);return a(function(){p.hasValue=!0,p.value=h},[h]),u(h),h}},5544:function(e,t,n){"use strict";e.exports=n(3816)},6886:function(e,t,n){"use strict";e.exports=n(1523)},7557:function(e){"use strict";e.exports=window.React},8061:function(e){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!==o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!==o--;){var s=i[o];if(!("_owner"===s&&t.$$typeof||e(t[s],n[s])))return!1}return!0}return t!=t&&n!=n}},9091:function(e){e.exports=function(){"use strict";var e=6e4,t=36e5,n="millisecond",r="second",o="minute",i="hour",s="day",l="week",a="month",c="quarter",u="year",d="date",p="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,f=/\[([^\]]+)]|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,m={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])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},y={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(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,a),i=n-o<0,s=t.clone().add(r+(i?-1:1),a);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:a,y:u,w:l,d:s,D:d,h:i,m:o,s:r,ms:n,Q:c}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",v={};v[b]=m;var w="$isDayjsObject",E=function(e){return e instanceof C||!(!e||!e[w])},x=function e(t,n,r){var o;if(!t)return b;if("string"==typeof t){var i=t.toLowerCase();v[i]&&(o=i),n&&(v[i]=n,o=i);var s=t.split("-");if(!o&&s.length>1)return e(s[0])}else{var l=t.name;v[l]=t,o=l}return!r&&o&&(b=o),o||!r&&b},k=function(e,t){if(E(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new C(n)},S=y;S.l=x,S.i=E,S.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function m(e){this.$L=x(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var g=m.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(S.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(h);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()},g.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()},g.$utils=function(){return S},g.isValid=function(){return!(this.$d.toString()===p)},g.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return k(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<k(e)},g.$g=function(e,t,n){return S.u(e)?this[t]:this.set(n,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var n=this,c=!!S.u(t)||t,p=S.p(e),h=function(e,t){var r=S.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return c?r:r.endOf(s)},f=function(e,t){return S.w(n.toDate()[e].apply(n.toDate("s"),(c?[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(p){case u:return c?h(1,0):h(31,11);case a:return c?h(1,g):h(0,g+1);case l:var v=this.$locale().weekStart||0,w=(m<v?m+7:m)-v;return h(c?y-w:y+(6-w),g);case s:case d:return f(b+"Hours",0);case i:return f(b+"Minutes",1);case o:return f(b+"Seconds",2);case r:return f(b+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var l,c=S.p(e),p="set"+(this.$u?"UTC":""),h=(l={},l[s]=p+"Date",l[d]=p+"Date",l[a]=p+"Month",l[u]=p+"FullYear",l[i]=p+"Hours",l[o]=p+"Minutes",l[r]=p+"Seconds",l[n]=p+"Milliseconds",l)[c],f=c===s?this.$D+(t-this.$W):t;if(c===a||c===u){var m=this.clone().set(d,1);m.$d[h](f),m.init(),this.$d=m.set(d,Math.min(this.$D,m.daysInMonth())).$d}else h&&this.$d[h](f);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[S.p(e)]()},g.add=function(n,c){var d,p=this;n=Number(n);var h=S.p(c),f=function(e){var t=k(p);return S.w(t.date(t.date()+Math.round(e*n)),p)};if(h===a)return this.set(a,this.$M+n);if(h===u)return this.set(u,this.$y+n);if(h===s)return f(1);if(h===l)return f(7);var m=(d={},d[o]=e,d[i]=t,d[r]=1e3,d)[h]||1,g=this.$d.getTime()+n*m;return S.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.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=S.z(this),i=this.$H,s=this.$m,l=this.$M,a=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 S.s(i%12||12,e,"0")},m=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(f,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return S.s(t.$y,4,"0");case"M":return l+1;case"MM":return S.s(l+1,2,"0");case"MMM":return d(n.monthsShort,l,c,3);case"MMMM":return d(c,l);case"D":return t.$D;case"DD":return S.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,a,2);case"ddd":return d(n.weekdaysShort,t.$W,a,3);case"dddd":return a[t.$W];case"H":return String(i);case"HH":return S.s(i,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return m(i,s,!0);case"A":return m(i,s,!1);case"m":return String(s);case"mm":return S.s(s,2,"0");case"s":return String(t.$s);case"ss":return S.s(t.$s,2,"0");case"SSS":return S.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(n,d,p){var h,f=this,m=S.p(d),g=k(n),y=(g.utcOffset()-this.utcOffset())*e,b=this-g,v=function(){return S.m(f,g)};switch(m){case u:h=v()/12;break;case a:h=v();break;case c:h=v()/3;break;case l:h=(b-y)/6048e5;break;case s:h=(b-y)/864e5;break;case i:h=b/t;break;case o:h=b/e;break;case r:h=b/1e3;break;default:h=b}return p?h:S.a(h)},g.daysInMonth=function(){return this.endOf(a).$D},g.$locale=function(){return v[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=x(e,t,!0);return r&&(n.$L=r),n},g.clone=function(){return S.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},m}(),T=C.prototype;return k.prototype=T,[["$ms",n],["$s",r],["$m",o],["$H",i],["$W",s],["$M",a],["$y",u],["$D",d]].forEach(function(e){T[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),k.extend=function(e,t){return e.$i||(e(t,C,k),e.$i=!0),k},k.locale=x,k.isDayjs=E,k.unix=function(e){return k(1e3*e)},k.en=v[b],k.Ls=v,k.p={},k}()},9106:function(e,t,n){"use strict";var r=n(7557),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,i={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,r)&&!a.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:c,ref:u,props:i,_owner:l.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},9370:function(e,t,n){"use strict";e.exports=n(9106)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};!function(){"use strict";n.r(r),n.d(r,{AspectRatioControl:function(){return nr},BackgroundControl:function(){return eo},BoxShadowRepeaterControl:function(){return Tt},ClearIconButton:function(){return Jy},ColorControl:function(){return De},ControlActionsProvider:function(){return K},ControlAdornments:function(){return T},ControlAdornmentsProvider:function(){return S},ControlFormLabel:function(){return x},ControlReplacementsProvider:function(){return I},ControlToggleButtonGroup:function(){return an},DateTimeControl:function(){return ji},DisplayConditionsControl:function(){return qy},EqualUnequalSizesControl:function(){return gn},FilterRepeaterControl:function(){return Qt},FloatingActionsBar:function(){return W},FontFamilyControl:function(){return Tn},GapControl:function(){return Xn},HtmlTagControl:function(){return Yn},ImageControl:function(){return ne},InlineEditingControl:function(){return Wy},InlineEditor:function(){return jy},InlineEditorToolbar:function(){return rb},ItemSelector:function(){return En},KeyValueControl:function(){return go},LinkControl:function(){return Un},LinkedDimensionsControl:function(){return bn},NumberControl:function(){return fn},PopoverContent:function(){return kt},PopoverGridContainer:function(){return St},PositionControl:function(){return bo},PropKeyProvider:function(){return f},PropProvider:function(){return d},QueryControl:function(){return Bn},RepeatableControl:function(){return io},Repeater:function(){return Qy},SelectControl:function(){return te},SelectControlWrapper:function(){return nn},SizeControl:function(){return Me},StrokeControl:function(){return Ne},SvgMediaControl:function(){return yr},SwitchControl:function(){return Vn},TextAreaControl:function(){return se},TextControl:function(){return ie},ToggleButtonGroupUi:function(){return ln},ToggleControl:function(){return pn},TransformRepeaterControl:function(){return mi},TransformSettingsControl:function(){return pi},TransitionRepeaterControl:function(){return $i},UrlControl:function(){return Mn},createControl:function(){return D},createControlReplacementsRegistry:function(){return A},enqueueFont:function(){return Sn},injectIntoRepeaterItemActions:function(){return at},injectIntoRepeaterItemIcon:function(){return ot},injectIntoRepeaterItemLabel:function(){return st},transitionProperties:function(){return Ei},transitionsItemsList:function(){return xi},useBoundProp:function(){return b},useControlActions:function(){return J},useControlReplacement:function(){return P},useElementCanHaveChildren:function(){return vo},useFloatingActionsBar:function(){return G},useSyncExternalState:function(){return ke}});var e=n(7557),t=window.elementorV2.editorProps,o=window.elementorV2.ui,i=window.wp.i18n,s=window.elementorV2.utils;const l=(0,s.createError)({code:"missing_prop_provider_prop_type",message:"Prop type is missing"}),a=(0,s.createError)({code:"unsupported_prop_provider_prop_type",message:"Parent prop type is not supported"}),c=(0,s.createError)({code:"hook_outside_provider",message:"Hook used outside of provider"}),u=(0,e.createContext)(null),d=({children:t,value:n,setValue:r,propType:o,placeholder:i,isDisabled:s})=>e.createElement(u.Provider,{value:{value:n,propType:o,setValue:r,placeholder:i,isDisabled:s}},t),p=()=>{const t=(0,e.useContext)(u);if(!t)throw new c({context:{hook:"usePropContext",provider:"PropProvider"}});return t},h=(0,e.createContext)(null),f=({children:t,bind:n})=>{const{propType:r}=p();if(!r)throw new l({context:{bind:n}});if("array"===r.kind)return e.createElement(g,{bind:n},t);if("object"===r.kind)return e.createElement(m,{bind:n},t);throw new a({context:{propType:r}})},m=({children:t,bind:n})=>{const r=p(),{path:o}=(0,e.useContext)(h)??{},i=r.value?.[n],s=r.placeholder?.[n],l=r.propType.shape[n];return e.createElement(h.Provider,{value:{...r,value:i,setValue:(e,t,o)=>{const i={...r.value,[n]:e};return r?.setValue(i,t,{...o,bind:n})},placeholder:s,bind:n,propType:l,path:[...o??[],n]}},t)},g=({children:t,bind:n})=>{const r=p(),{path:o}=(0,e.useContext)(h)??{},i=r.value?.[Number(n)],s=r.propType.item_prop_type;return e.createElement(h.Provider,{value:{...r,value:i,setValue:(e,t)=>{const o=[...r.value??[]];return o[Number(n)]=e,r?.setValue(o,t,{bind:n})},bind:n,propType:s,path:[...o??[],n]}},t)},y=()=>{const t=(0,e.useContext)(h);if(!t)throw new c({context:{hook:"usePropKeyContext",provider:"PropKeyProvider"}});return t};function b(e){const t=y(),{isValid:n,validate:r,restoreValue:o}=v(t.propType),i=t.isDisabled?.(t.propType),s=()=>{t.setValue(t.propType.initial_value??null)};if(!e)return{...t,disabled:i,resetValue:s};const l=w(t.propType,e.key),a=e.extract(t.value??l.default??null),c=e.extract(t.placeholder??null);return{...t,propType:l,setValue:function(n,o,i){if(r(n,i?.validation))return null===n?t?.setValue(null,o,i):t?.setValue(e?.create(n,o),{},i)},value:n?a:null,restoreValue:o,placeholder:c,disabled:i,resetValue:s}}const v=t=>{const[n,r]=(0,e.useState)(!0);return{isValid:n,setIsValid:r,validate:(e,n)=>{let o=!0;return t.settings.required&&null===e&&(o=!1),n&&!n(e)&&(o=!1),r(o),o},restoreValue:()=>r(!0)}},w=(e,t)=>{let n=e;if("union"===e.kind&&(n=e.prop_types[t]),!n)throw new l({context:{key:t}});return n};function E(){return E=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},E.apply(null,arguments)}const x=t=>e.createElement(o.FormLabel,E({size:"tiny"},t)),k=(0,e.createContext)(null),S=({children:t,items:n})=>e.createElement(k.Provider,{value:{items:n}},t),C=()=>{const t=(0,e.useContext)(k);return t?.items??[]};function T({customContext:t}){const n=C();return 0===n?.length?null:e.createElement(e.Fragment,null,n.map(({Adornment:n,id:r})=>e.createElement(n,{key:r,customContext:t})))}const M=({children:t,...n})=>e.createElement(o.Stack,{direction:"row",alignItems:"center",justifyItems:"start",gap:.25},e.createElement(x,n,t),e.createElement(T,null)),O=(0,e.createContext)([]),I=({replacements:t,children:n})=>e.createElement(O.Provider,{value:t},n),P=t=>{const{value:n,placeholder:r}=b(),o=(0,e.useContext)(O);try{const e=o.find(e=>e.condition({value:n,placeholder:r}));return{ControlToRender:e?.component??t,OriginalControl:t,isReplaced:!!e}}catch{return{ControlToRender:t,OriginalControl:t}}},A=()=>{const e=[];return{registerControlReplacement:function(t){e.push(t)},getControlReplacements:function(){return e}}};function D(t){return n=>{const{ControlToRender:r,OriginalControl:i,isReplaced:s}=P(t),l=s?{...n,OriginalControl:i}:n;return e.createElement(o.ErrorBoundary,{fallback:null},e.createElement(r,l))}}Symbol("control");var _=window.elementorV2.query,N=window.elementorV2.httpClient;const R="elementor/v1/settings",z=e=>e.data.value,$="elementor_unfiltered_files_upload",L={queryKey:[$]},B=()=>(0,_.useQuery)({...L,queryFn:()=>{return(e=$,(0,N.httpService)().get(`${R}/${e}`).then(e=>z(e.data))).then(e=>V(e));var e},staleTime:1/0}),V=e=>Boolean("1"===e);var j=window.elementorV2.icons,F=window.elementorV2.wpMedia;const U=(0,o.styled)("span")` display: contents; .MuiFloatingActionBar-popper:has( .MuiFloatingActionBar-actions:empty ) { display: none; } .MuiFloatingActionBar-popper { z-index: 1000; } `,H=(0,e.createContext)(null);function W({actions:t,children:n}){const[r,i]=(0,e.useState)(!1);return e.createElement(H.Provider,{value:{open:r,setOpen:i}},e.createElement(U,null,e.createElement(o.UnstableFloatingActionBar,{actions:t,open:r||void 0},n)))}function G(){const t=(0,e.useContext)(H);if(!t)throw new Error("useFloatingActions must be used within a FloatingActionsBar");return t}const q=(0,e.createContext)(null),K=({children:t,items:n})=>e.createElement(q.Provider,{value:{items:n}},t),J=()=>{const t=(0,e.useContext)(q);if(!t)throw new Error("useControlActions must be used within a ControlActionsProvider");return t};function Y({children:t}){const{items:n}=J(),{disabled:r}=b();if(0===n.length||r)return t;const o=n.map(({MenuItem:t,id:n})=>e.createElement(t,{key:n}));return e.createElement(W,{actions:o},t)}const X=D(({mediaTypes:n=["image"]})=>{const{value:r,setValue:s,propType:l}=b(t.imageSrcPropTypeUtil),{id:a,url:c}=r??{},{data:u,isFetching:d}=(0,F.useWpMediaAttachment)(a?.value||null),p=u?.url??c?.value??null,{open:h}=(0,F.useWpMediaFrame)({mediaTypes:n,multiple:!1,selected:a?.value||null,onSelect:e=>{s({id:{$$type:"image-attachment-id",value:e.id},url:null})}});return e.createElement(Y,null,e.createElement(o.Card,{variant:"outlined"},e.createElement(o.CardMedia,{image:p,sx:{height:l.meta.isDynamic?134:150}},d?e.createElement(o.Stack,{justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},e.createElement(o.CircularProgress,null)):e.createElement(e.Fragment,null)),e.createElement(o.CardOverlay,null,e.createElement(o.Stack,{gap:1},e.createElement(o.Button,{size:"tiny",color:"inherit",variant:"outlined",onClick:()=>h({mode:"browse"})},(0,i.__)("Select image","elementor")),e.createElement(o.Button,{size:"tiny",variant:"text",color:"inherit",startIcon:e.createElement(j.UploadIcon,null),onClick:()=>h({mode:"upload"})},(0,i.__)("Upload","elementor"))))))});var Q=window.elementorV2.editorUi;function Z(){return Z=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},Z.apply(null,arguments)}const ee={MenuListProps:{sx:{maxHeight:"160px"}}},te=D(({options:n,onChange:r,MenuProps:i=ee,ariaLabel:s})=>{const{value:l,setValue:a,disabled:c,placeholder:u}=b(t.stringPropTypeUtil),d=c||0===n.length;return e.createElement(Y,null,e.createElement(o.Select,{sx:{overflow:"hidden"},displayEmpty:!0,size:"tiny",MenuProps:i,"aria-label":s||u,renderValue:t=>{const r=e=>n.find(t=>t.value===e);if(!t||""===t){if(u){const t=r(u),n=t?.label||u;return e.createElement(o.Typography,{component:"span",variant:"caption",color:"text.tertiary"},n)}return""}const i=r(t);return i?.label||t},value:l??"",onChange:e=>{const t=e.target.value||null;r?.(t,l),a(t)},disabled:d,fullWidth:!0},n.map(({label:t,...n})=>e.createElement(Q.MenuListItem,Z({key:n.value},n,{value:n.value??""}),t))))}),ne=D(({sizes:n,label:r=(0,i.__)("Image","elementor")})=>{const s=b(t.imagePropTypeUtil);return e.createElement(d,s,e.createElement(o.Stack,{gap:1.5},e.createElement(M,null,r),e.createElement(re,null),e.createElement(o.Grid,{container:!0,gap:1.5,alignItems:"center",flexWrap:"nowrap"},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Resolution","elementor"))),e.createElement(o.Grid,{item:!0,xs:6,sx:{overflow:"hidden"}},e.createElement(oe,{sizes:n})))))}),re=()=>{const{data:t}=B(),n=t?["image","svg"]:["image"];return e.createElement(f,{bind:"src"},e.createElement(X,{mediaTypes:n}))},oe=({sizes:t})=>e.createElement(f,{bind:"size"},e.createElement(te,{options:t})),ie=D(({placeholder:n,error:r,inputValue:i,inputDisabled:s,helperText:l,sx:a,ariaLabel:c})=>{const{value:u,setValue:d,disabled:p}=b(t.stringPropTypeUtil);return e.createElement(Y,null,e.createElement(o.TextField,{size:"tiny",fullWidth:!0,disabled:s??p,value:i??u??"",onChange:e=>d(e.target.value),placeholder:n,error:r,helperText:l,sx:a,inputProps:{...c?{"aria-label":c}:{}}}))}),se=D(({placeholder:n,ariaLabel:r})=>{const{value:i,setValue:s,disabled:l}=b(t.stringPropTypeUtil);return e.createElement(Y,null,e.createElement(o.TextField,{size:"tiny",multiline:!0,fullWidth:!0,minRows:5,disabled:l,value:i??"",onChange:e=>{s(e.target.value)},placeholder:n,inputProps:{...r?{"aria-label":r}:{}}}))});var le=window.elementorV2.editorResponsive;const ae=["px","%","em","rem","vw","vh","ch"],ce=["auto","custom"],ue=NaN;function de(e){return ce.includes(e)}function pe(){return pe=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},pe.apply(null,arguments)}const he=["e","E","+"],fe=(0,e.forwardRef)((t,n)=>{const[r,i]=(0,e.useState)(0);return e.createElement(o.TextField,pe({},t,{ref:n,key:r,onKeyDown:e=>{!function(e,t){const n=[...he];t>=0&&n.push("-"),n.includes(e.key)&&e.preventDefault()}(e,t.inputProps?.min),t.onKeyDown?.(e)},onBlur:e=>{t.onBlur?.(e);const{valid:n}=e.target.validity;n||i(e=>e+1)}}))});function me(){return me=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},me.apply(null,arguments)}const ge=(0,e.forwardRef)(({placeholder:n,type:r,value:o,onChange:i,onBlur:s,onKeyDown:l,onKeyUp:a,InputProps:c,inputProps:u,disabled:d,isPopoverOpen:p,id:h},f)=>{const{placeholder:m}=b(t.sizePropTypeUtil);return e.createElement(fe,{ref:f,sx:{input:{cursor:c.readOnly?"default !important":void 0}},size:"tiny",fullWidth:!0,type:r,value:o,onInput:i,onKeyDown:l,onKeyUp:a,disabled:d,onBlur:s,focused:!!p||void 0,placeholder:n??(String(m?.size??"")||void 0),InputProps:c,inputProps:u,id:h})}),ye=({options:n,alternativeOptionLabels:r={},onClick:i,value:s,menuItemsAttributes:l={},disabled:a})=>{const c=(0,o.usePopupState)({variant:"popover",popupId:(0,e.useId)()}),{placeholder:u,showPrimaryColor:d}=function(e){const{value:n,placeholder:r}=b(t.sizePropTypeUtil),o=n?.size,i=n?.unit,s="custom"===e&&Boolean(o),l="auto"===e||s||Boolean(o);if(!r)return{placeholder:null,showPrimaryColor:l};return{placeholder:!i&&"px"===e?r.unit:void 0,showPrimaryColor:l}}(s),p={display:"flex",flexDirection:"column",justifyContent:"center"};return e.createElement(o.InputAdornment,{position:"end"},e.createElement(be,me({isPrimaryColor:d,size:"small",disabled:a},(0,o.bindTrigger)(c)),u??r[s]??s),e.createElement(o.Menu,me({MenuListProps:{dense:!0}},(0,o.bindMenu)(c)),n.map((t,o)=>e.createElement(Q.MenuListItem,me({key:t,onClick:()=>(e=>{i(n[e]),c.close()})(o)},l?.[t],{primaryTypographyProps:{variant:"caption",sx:{...p,lineHeight:"1"}},menuItemTextProps:{sx:p}}),r[t]??t.toUpperCase()))))},be=(0,o.styled)(o.Button,{shouldForwardProp:e=>"isPrimaryColor"!==e})(({isPrimaryColor:e,theme:t})=>({color:e?t.palette.text.primary:t.palette.text.tertiary,font:"inherit",minWidth:"initial",textTransform:"uppercase"})),ve=["auto"],we=({units:t,handleUnitChange:n,handleSizeChange:r,placeholder:i,startIcon:s,onBlur:l,onFocus:a,onClick:c,size:u,unit:d,popupState:p,disabled:h,min:f,id:m,ariaLabel:g})=>{const y=(0,e.useRef)(""),b=de(d)?"text":"number",v=!de(d)&&Number.isNaN(u)?"":u??"",w={"aria-controls":p.isOpen?p.popupId:void 0,"aria-haspopup":!0},E=t.includes("custom")?{custom:w}:void 0,x={custom:e.createElement(j.MathFunctionIcon,{fontSize:"tiny"})},k={...w,readOnly:de(d),autoComplete:"off",onClick:c,onFocus:a,startAdornment:s?e.createElement(o.InputAdornment,{position:"start",disabled:h},s):void 0,endAdornment:e.createElement(ye,{disabled:h,options:t,onClick:n,value:d,alternativeOptionLabels:x,menuItemsAttributes:E})};return e.createElement(Y,null,e.createElement(o.Box,null,e.createElement(ge,{disabled:h,placeholder:i,type:b,value:v,onChange:r,onKeyUp:e=>{const{key:r}=e;if(!/^[a-zA-Z%]$/.test(r))return;e.preventDefault();const o=r.toLowerCase(),i=(y.current+o).slice(-3);y.current=i;const s=t.find(e=>!ve.includes(e)&&e.includes(i))||t.find(e=>!ve.includes(e)&&e.startsWith(o))||t.find(e=>!ve.includes(e)&&e.includes(o));s&&n(s)},onBlur:l,InputProps:k,inputProps:{min:f,step:"any","aria-label":g},isPopoverOpen:p.isOpen,id:m})))};function Ee(){return Ee=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},Ee.apply(null,arguments)}const xe=t=>{const{popupState:n,restoreValue:r,anchorRef:s,value:l,onChange:a}=t,c=(0,e.useRef)(null);(0,e.useEffect)(()=>{n.isOpen&&requestAnimationFrame(()=>{c.current&&c.current.focus()})},[n.isOpen]);const u=()=>{r(),n.close()};return e.createElement(o.Popover,Ee({disablePortal:!0,slotProps:{paper:{sx:{borderRadius:2,width:s.current?.offsetWidth+"px"}}}},(0,o.bindPopover)(n),{anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},onClose:u}),e.createElement(Q.PopoverHeader,{title:(0,i.__)("CSS function","elementor"),onClose:u,icon:e.createElement(j.MathFunctionIcon,{fontSize:"tiny"})}),e.createElement(o.TextField,{value:l,onChange:a,size:"tiny",type:"text",fullWidth:!0,inputProps:{ref:c},sx:{pt:0,pr:1.5,pb:1.5,pl:1.5}}))},ke=({external:t,setExternal:n,persistWhen:r,fallback:o})=>{function i(e,t){return e||o(t)}const[s,l]=(0,e.useState)(i(t,null));return(0,e.useEffect)(()=>{l(e=>i(t,e))},[t]),[s,(e,t,o)=>{const i=("function"==typeof e?e:()=>e)(s);var a;l(i),n(r(a=i)?a:null,t,o)}]},Se={length:"px",angle:"deg",time:"ms"},Ce={length:[...ae],angle:["deg","rad","grad","turn"],time:["s","ms"]},Te="fx",Me=D(({variant:n="length",defaultUnit:r,units:i,placeholder:s,startIcon:l,anchorRef:a,extendedOptions:c,disableCustom:u,min:d=0,enablePropTypeUnits:p=!1,id:h,ariaLabel:f})=>{const{value:m,setValue:g,disabled:y,restoreValue:v,placeholder:w,propType:E}=b(t.sizePropTypeUtil),x=r??w?.unit??Se[n],k=(0,le.useActiveBreakpoint)(),S=function(t,n){return(0,e.useMemo)(()=>{const e=[...t];return n||e.includes("custom")?t.includes("custom")&&e.splice(e.indexOf("custom"),1):e.push("custom"),e},[t,n])}(c||[],u??!1),C=function(e,t,n,r,o){const i=[...Ce[n]];return t?e.settings?.available_units??i:[...r??i,...o||[]]}(E,p,n,i,S),T=(0,o.usePopupState)({variant:"popover"}),M=(0,e.useMemo)(()=>function(e,t,n="",r=""){const o=e?.unit??t,i=e?.size??n;return{numeric:de(o)||isNaN(Number(i))||!i&&0!==i?ue:Number(i),custom:"custom"===o?String(i):r,unit:o}}(m,x),[m,x]),[O,I]=ke({external:M,setExternal:(e,t,n)=>g(Ie(e),t,n),persistWhen:e=>!!Ie(e),fallback:e=>({unit:e?.unit??x,numeric:e?.numeric??ue,custom:e?.custom??""})}),{size:P=ue,unit:A=x}=Ie(O,!0)||{},D=e=>{const t=e.target.value,n=e.target.validity.valid;"auto"!==A?I(e=>({...e,["custom"===A?"custom":"numeric"]:Oe(t,A),unit:A}),void 0,{validation:()=>n}):I(e=>({...e,unit:A}))},_=e.useCallback(()=>{T&&T.isOpen&&T.close()},[T]);return(0,e.useEffect)(()=>{_()},[k]),e.createElement(e.Fragment,null,e.createElement(we,{disabled:y,size:P,unit:A,units:[...C],placeholder:s,startIcon:l,handleSizeChange:D,handleUnitChange:e=>{"custom"===e&&T.open(a?.current),I(t=>({...t,unit:e}))},onBlur:v,onClick:e=>{e.target.closest("input")&&"custom"===O.unit&&T.open(a?.current)},popupState:T,min:d,id:h,ariaLabel:f}),a?.current&&T.isOpen&&e.createElement(xe,{popupState:T,anchorRef:a,restoreValue:v,value:P,onChange:D}))});function Oe(e,t){return de(t)?"auto"===t?"":String(e??""):e||0===e?Number(e):NaN}function Ie(e,t=!1){if(!e)return null;if(!e?.unit)return{size:ue,unit:"px"};const{unit:n}=e;if("auto"===n)return{size:"",unit:n};if("custom"===n)return{size:e.custom??"",unit:"custom"};const r=e.numeric;return t||null!=r&&!Number.isNaN(r)?{size:r,unit:n}:null}const Pe=({gap:t=.5,sx:n,children:r})=>e.createElement(o.Stack,{gap:t,sx:{...n}},r);function Ae(){return Ae=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},Ae.apply(null,arguments)}const De=D(({propTypeUtil:n=t.colorPropTypeUtil,anchorEl:r,slotProps:i={},id:s,...l})=>{const{value:a,setValue:c,placeholder:u,disabled:d}=b(n),p=l.placeholder??u;return e.createElement(Y,null,e.createElement(o.UnstableColorField,Ae({id:s,size:"tiny",fullWidth:!0,value:a??"",placeholder:p??"",onChange:e=>{c(e||null)}},l,{disabled:d,slotProps:{...i,colorPicker:{anchorEl:r,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:-10},slotProps:{colorIndicator:{value:a??p??""},colorBox:{value:a??p??""}}}}})))}),_e=["px","em","rem"],Ne=D(()=>{const n=b(t.strokePropTypeUtil),r=(0,e.useRef)(null);return e.createElement(d,n,e.createElement(Pe,null,e.createElement(Re,{bind:"width",label:(0,i.__)("Stroke width","elementor"),ref:r},e.createElement(Me,{units:_e,anchorRef:r})),e.createElement(Re,{bind:"color",label:(0,i.__)("Stroke color","elementor")},e.createElement(De,null))))}),Re=(0,e.forwardRef)(({bind:t,label:n,children:r},i)=>e.createElement(f,{bind:t},e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap",ref:i},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,n)),e.createElement(o.Grid,{item:!0,xs:6},r)))),ze=new class{listeners=new Map;subscribe(e,t){this.listeners.has(e)||this.listeners.set(e,new Set);const n=this.listeners.get(e);n&&n.add(t)}unsubscribe(e,t){const n=this.listeners.get(e);n&&(n.delete(t),0===n.size&&this.listeners.delete(e))}emit(e,t){const n=this.listeners.get(e);n&&n.forEach(e=>e(t))}clearAll(){this.listeners.clear()}},$e=(0,e.createContext)({index:-1,value:{}}),Le=(0,e.createContext)(null),Be=()=>{const t=e.useContext(Le),n=e.useContext($e);if(!t)throw new Error("useRepeaterContext must be used within a RepeaterContextProvider");return{...t,...n}},Ve=({children:t,initial:n,propTypeUtil:r,isItemDisabled:i=()=>!1})=>{const{value:s,setValue:l}=b(r),[a,c]=ke({external:s,fallback:()=>[],setExternal:l,persistWhen:()=>!0}),[u,d]=(0,e.useState)(()=>a?.map(()=>je())??[]);e.useEffect(()=>{const e=a?.length??0;d(t=>{const n=t.length;return n===e?t:n>e?t.slice(0,e):[...t,...Array.from({length:e-n},je)]})},[a?.length]);const p=(0,e.useMemo)(()=>u.map((e,t)=>({key:e,item:a[t]})).filter(({item:e})=>void 0!==e),[u,a]),[h,f]=(0,e.useState)(-1),[m,g]=(0,e.useState)(null),y=-1!==h,v=(0,o.usePopupState)({variant:"popover"});return e.createElement(Le.Provider,{value:{isOpen:y,openItemIndex:h,setOpenItemIndex:f,items:p??[],setItems:e=>{c(e.map(({item:e})=>e))},popoverState:v,initial:n,updateItem:(e,t)=>{const n=[...a.slice(0,t),e,...a.slice(t+1)];c(n)},addItem:(e,t)=>{const o=t?.item??{...n},i=t?.index??a.length,s=je(),l=[...a];l.splice(i,0,o),c(l),d([...u.slice(0,i),s,...u.slice(i)]),f(i),v.open(m??e),ze.emit(`${r.key}-item-added`,{itemValue:n.value})},removeItem:e=>{const t=a[e];c(a.filter((t,n)=>n!==e)),d(u.filter((t,n)=>n!==e)),ze.emit(`${r.key}-item-removed`,{itemValue:t?.value})},rowRef:m,setRowRef:g,isItemDisabled:e=>i(p[e].item)}},t)},je=()=>Date.now()+Math.floor(1e6*Math.random()),Fe="tiny",Ue=({disabled:t=!1,enableTooltip:n=!1,tooltipContent:r=null,newItemIndex:s,ariaLabel:l})=>{const{addItem:a}=Be();return e.createElement(He,{content:r,enable:n},e.createElement(o.Box,{component:"span",sx:{cursor:t?"not-allowed":"pointer"}},e.createElement(o.IconButton,{size:Fe,disabled:t,onClick:e=>a(e,{index:s}),"aria-label":(0,i.sprintf)((0,i.__)("Add %s item","elementor"),l?.toLowerCase())},e.createElement(j.PlusIcon,{fontSize:Fe}))))},He=({children:t,enable:n,content:r})=>n&&r?e.createElement(o.Infotip,{placement:"right",color:"secondary",content:r},t):t;function We(){return We=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},We.apply(null,arguments)}const Ge=t=>e.createElement(o.List,{sx:{p:0,my:-.5,mx:0}},e.createElement(o.UnstableSortableProvider,We({restrictAxis:!0,disableDragOverlay:!1,variant:"static"},t))),qe=({id:t,children:n,disabled:r})=>e.createElement(o.UnstableSortableItem,{id:t,disabled:r,render:({itemProps:t,triggerProps:o,itemStyle:i,triggerStyle:s,showDropIndication:l,dropIndicationStyle:a})=>e.createElement(Ke,We({},t,{style:i,tabIndex:-1}),!r&&e.createElement(Je,We({},o,{style:s})),n,l&&e.createElement(Ye,{style:a}))}),Ke=(0,o.styled)(o.ListItem)` position: relative; margin-inline: 0px; padding-inline: 0px; padding-block: ${({theme:e})=>e.spacing(.5)}; & .class-item-sortable-trigger { color: ${({theme:e})=>e.palette.action.active}; height: 100%; display: flex; align-items: center; visibility: hidden; position: absolute; top: 50%; padding-inline-end: ${({theme:e})=>e.spacing(.5)}; transform: translate( -75%, -50% ); } &[aria-describedby=''] > .MuiTag-root { background-color: ${({theme:e})=>e.palette.background.paper}; box-shadow: ${({theme:e})=>e.shadows[3]}; } &:hover, &:focus-within { & .class-item-sortable-trigger { visibility: visible; } } `,Je=t=>e.createElement("div",We({},t,{role:"button",className:"class-item-sortable-trigger",tabIndex:0,"aria-label":(0,i.__)("Drag item","elementor")}),e.createElement(j.GripVerticalIcon,{fontSize:"tiny"})),Ye=(0,o.styled)(o.Divider)` height: 0px; border: none; overflow: visible; &:after { --height: 2px; content: ''; display: block; width: 100%; height: var( --height ); margin-block: calc( -1 * var( --height ) / 2 ); border-radius: ${({theme:e})=>e.spacing(.5)}; background-color: ${({theme:e})=>e.palette.text.primary}; } `,Xe=({isSortable:t=!0,children:n})=>{const{items:r,setItems:o}=Be(),i=r.map(({key:e})=>e);return n?e.createElement(e.Fragment,null,e.createElement(Ge,{value:i,onChange:e=>{o(e.map(e=>{const t=r.findIndex(t=>t.key===e);return r[t]}))}},i.map((o,i)=>{const s=r[i].item;return e.createElement(qe,{id:o,key:`sortable-${o}`,disabled:!t},e.createElement($e.Provider,{value:{index:i,value:s}},n))}))):null},Qe=(0,e.createContext)(void 0),Ze=()=>{const t=(0,e.useContext)(Qe);if(!t)throw new Error("useRepeatableControlContext must be used within RepeatableControl");return t};function et(){return et=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},et.apply(null,arguments)}const tt=(0,e.forwardRef)((t,n)=>e.createElement(o.UnstableTag,et({ref:n,fullWidth:!0,showActionsOnHover:!0,variant:"outlined",sx:{minHeight:e=>e.spacing(3.5)}},t)));var nt=window.elementorV2.locations;const{Slot:rt,inject:ot}=(0,nt.createReplaceableLocation)(),{Slot:it,inject:st}=(0,nt.createReplaceableLocation)(),{Slot:lt,inject:at}=(0,nt.createLocation)();function ct(){return ct=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},ct.apply(null,arguments)}const ut=({Label:t,Icon:n,actions:r})=>{const{popoverState:s,setRowRef:l,openItemIndex:a,setOpenItemIndex:c,index:u=-1,value:d,isItemDisabled:p}=Be(),h=e.useContext(Qe),f=!!h?.props?.readOnly,m=(0,o.bindTrigger)(s);return e.createElement(tt,ct({ref:e=>{e&&a===u&&e!==s.anchorEl&&(l(e),s.setAnchorEl(e))},label:e.createElement(it,{value:d},e.createElement(t,{value:d})),"aria-label":(0,i.__)("Open item","elementor")},m,{onClick:e=>{f||p(u)||(m.onClick(e),c(u))},startIcon:e.createElement(rt,{value:d},e.createElement(n,{value:d})),sx:{minHeight:e=>e.spacing(3.5),...p(u)&&{'[role="button"]':{cursor:"not-allowed"}}},actions:e.createElement(e.Fragment,null,e.createElement(lt,{index:u??-1}),r)}))},dt=({children:t,initial:n,propTypeUtil:r,isItemDisabled:o})=>e.createElement(Pe,null,e.createElement(Ve,{initial:n,propTypeUtil:r,isItemDisabled:o},t)),pt="tiny",ht=()=>{const{items:t,updateItem:n,index:r=-1}=Be();if(-1===r)return null;const s=t[r].item.disabled??!1,l=s?(0,i.__)("Show","elementor"):(0,i.__)("Hide","elementor");return e.createElement(o.Tooltip,{title:l,placement:"top"},e.createElement(o.IconButton,{size:pt,onClick:()=>{const e=structuredClone(t[r].item);e.disabled=!e.disabled,e.disabled||delete e.disabled,n(e,r)},"aria-label":l},s?e.createElement(j.EyeOffIcon,{fontSize:pt}):e.createElement(j.EyeIcon,{fontSize:pt})))},ft="tiny",mt=()=>{const{items:t,addItem:n,index:r=-1,isItemDisabled:s}=Be();if(-1===r)return null;const l=(0,i.__)("Duplicate","elementor"),a=t[r]?.item;return e.createElement(o.Tooltip,{title:l,placement:"top"},e.createElement(o.IconButton,{size:ft,onClick:e=>{const t=structuredClone(a);n(e,{item:t,index:r+1})},"aria-label":l,disabled:s(r)},e.createElement(j.CopyIcon,{fontSize:ft})))},gt="tiny",yt=()=>{const{removeItem:t,index:n=-1}=Be();if(-1===n)return null;const r=(0,i.__)("Remove","elementor");return e.createElement(o.Tooltip,{title:r,placement:"top"},e.createElement(o.IconButton,{size:gt,onClick:()=>t(n),"aria-label":r},e.createElement(j.XIcon,{fontSize:gt})))};function bt(){return bt=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},bt.apply(null,arguments)}const vt=({children:t,width:n,...r})=>e.createElement(o.Popover,bt({disablePortal:!0,disableEnforceFocus:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{marginBlockStart:.5,width:n,overflow:"visible"}}}},r),t);function wt(){return wt=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},wt.apply(null,arguments)}const Et=({children:t})=>{const{popoverState:n,openItemIndex:r,isOpen:i,rowRef:s,setOpenItemIndex:l,setRowRef:a}=Be();return i&&s?e.createElement(vt,wt({width:s.offsetWidth},(0,o.bindPopover)(n),{onClose:()=>{a(null),n.setAnchorEl(null),l(-1)}}),e.createElement(f,{bind:String(r)},e.createElement(o.Box,null,t))):null};function xt(){return xt=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},xt.apply(null,arguments)}const kt=({gap:t=1.5,children:n,...r})=>e.createElement(o.Stack,xt({},r,{gap:t}),n),St=(0,e.forwardRef)(({gap:t=1.5,alignItems:n="center",flexWrap:r="nowrap",children:i},s)=>e.createElement(o.Grid,{container:!0,gap:t,alignItems:n,flexWrap:r,ref:s},i)),Ct=(0,e.forwardRef)(({label:t,children:n,adornment:r=T},i)=>e.createElement(o.Stack,{direction:"row",alignItems:"center",gap:1,sx:{marginInlineEnd:-.75,py:.25},ref:i},e.createElement(o.Box,{display:"flex",alignItems:"center",gap:1,sx:{flexGrow:1}},e.createElement(o.Typography,{component:"label",variant:"caption",color:"text.secondary",sx:{lineHeight:1}},t),e.createElement(r,null)),n)),Tt=D(()=>{const{propType:n,value:r,setValue:o,disabled:s}=b(t.boxShadowPropTypeUtil);return e.createElement(d,{propType:n,value:r,setValue:o,isDisabled:()=>s},e.createElement(dt,{initial:Dt,propTypeUtil:t.boxShadowPropTypeUtil},e.createElement(Ct,{label:(0,i.__)("Box shadow","elementor")},e.createElement(Ue,{newItemIndex:0,disabled:s,ariaLabel:"Box shadow"})),e.createElement(Xe,null,e.createElement(ut,{Icon:Ot,Label:At,actions:e.createElement(e.Fragment,null,e.createElement(mt,null),e.createElement(ht,null),e.createElement(yt,null))})),e.createElement(Et,null,e.createElement(It,null))))}),Mt=(0,o.styled)(o.UnstableColorIndicator)(({theme:e})=>({height:"1rem",width:"1rem",borderRadius:e.shape.borderRadius/2+"px"})),Ot=({value:t})=>e.createElement(Mt,{size:"inherit",component:"span",value:t.value.color?.value}),It=()=>{const n=b(t.shadowPropTypeUtil),r=[(0,e.useRef)(null),(0,e.useRef)(null)],{rowRef:o}=Be();return e.createElement(d,n,e.createElement(kt,{p:1.5},e.createElement(St,null,e.createElement(Pt,{bind:"color",label:(0,i.__)("Color","elementor")},e.createElement(De,{anchorEl:o})),e.createElement(Pt,{bind:"position",label:(0,i.__)("Position","elementor"),sx:{overflow:"hidden"}},e.createElement(te,{options:[{label:(0,i.__)("Inset","elementor"),value:"inset"},{label:(0,i.__)("Outset","elementor"),value:null}]}))),e.createElement(St,{ref:r[0]},e.createElement(Pt,{bind:"hOffset",label:(0,i.__)("Horizontal","elementor")},e.createElement(Me,{anchorRef:r[0]})),e.createElement(Pt,{bind:"vOffset",label:(0,i.__)("Vertical","elementor")},e.createElement(Me,{anchorRef:r[0]}))),e.createElement(St,{ref:r[1]},e.createElement(Pt,{bind:"blur",label:(0,i.__)("Blur","elementor")},e.createElement(Me,{anchorRef:r[1]})),e.createElement(Pt,{bind:"spread",label:(0,i.__)("Spread","elementor")},e.createElement(Me,{anchorRef:r[1]})))))},Pt=({label:t,bind:n,children:r,sx:i})=>e.createElement(f,{bind:n},e.createElement(o.Grid,{item:!0,xs:6,sx:i},e.createElement(o.Grid,{container:!0,gap:.75,alignItems:"center"},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(o.FormLabel,{size:"tiny"},t)),e.createElement(o.Grid,{item:!0,xs:12},r)))),At=({value:t})=>{const{position:n,hOffset:r,vOffset:o,blur:i,spread:s}=t.value,{size:l="",unit:a=""}=i?.value||{},{size:c="",unit:u=""}=s?.value||{},{size:d="unset",unit:p=""}=r?.value||{},{size:h="unset",unit:f=""}=o?.value||{},m=n?.value||"outset",g=[[d,p],[h,f],[l,a],[c,u]].map(([e,t])=>"custom"!==t?e+t:e||Te).join(" ");return e.createElement("span",{style:{textTransform:"capitalize"}},m,": ",g)},Dt={$$type:"shadow",value:{hOffset:{$$type:"size",value:{unit:"px",size:0}},vOffset:{$$type:"size",value:{unit:"px",size:0}},blur:{$$type:"size",value:{unit:"px",size:10}},spread:{$$type:"size",value:{unit:"px",size:0}},color:{$$type:"color",value:"rgba(0, 0, 0, 1)"},position:null}},_t={blur:{blur:{name:(0,i.__)("Blur","elementor"),valueName:(0,i.__)("Radius","elementor")}},intensity:{brightness:{name:(0,i.__)("Brightness","elementor")},contrast:{name:(0,i.__)("Contrast","elementor")},saturate:{name:(0,i.__)("Saturate","elementor")}},"hue-rotate":{"hue-rotate":{name:(0,i.__)("Hue Rotate","elementor"),valueName:(0,i.__)("Angle","elementor")}},"color-tone":{grayscale:{name:(0,i.__)("Grayscale","elementor")},invert:{name:(0,i.__)("Invert","elementor")},sepia:{name:(0,i.__)("Sepia","elementor")}},"drop-shadow":{"drop-shadow":{name:(0,i.__)("Drop shadow","elementor"),valueName:(0,i.__)("Drop-shadow","elementor")}}},Nt=(0,i.__)("Amount","elementor"),Rt={"drop-shadow":e=>function(e){const t=e.shape;return{blur:t?.blur?.default,xAxis:t?.xAxis?.default,yAxis:t?.yAxis?.default,color:t?.color?.default??(t?.color).prop_types.color.default}}(e)};const zt=(0,e.createContext)(null);function $t({children:n}){const r=b(t.cssFilterFunctionPropUtil),o=(0,e.useMemo)(()=>{const e=function(e){const t=Object.entries(_t).flatMap(([t,n])=>Object.entries(n).map(([n,r])=>function(t,n,{name:r,valueName:o}){const i=function(e,t){return e.shape?.args?.prop_types[t]}(e,t),s=Rt[n]?.(i)??function(e){const t=e?.shape?.size;return{size:t?.default}}(i),l=function({filterFunction:e,filterFunctionGroup:t,value:n}){return{$$type:"css-filter-func",value:{func:{$$type:"string",value:e},args:{$$type:t,value:n}}}}({filterFunction:n,filterFunctionGroup:t,value:s});return[n,{name:r,valueName:o??Nt,defaultValue:l,filterFunctionGroup:t}]}(t,n,r)));return Object.fromEntries(t)}(r.propType.item_prop_type),t=Object.entries(e).map(([e,t])=>({value:e,label:t.name}));return{config:e,filterOptions:t,getFilterFunctionConfig:t=>e[t],getInitialValue:()=>e.blur.defaultValue}},[r.propType]);return e.createElement(zt.Provider,{value:o},n)}function Lt(){const t=(0,e.useContext)(zt);if(!t)throw new Error("useFilterConfig must be used within FilterConfigProvider");return t}const Bt=[{bind:"xAxis",label:(0,i.__)("X-axis","elementor"),rowIndex:0},{bind:"yAxis",label:(0,i.__)("Y-axis","elementor"),rowIndex:0},{bind:"blur",label:(0,i.__)("Blur","elementor"),rowIndex:1},{bind:"color",label:(0,i.__)("Color","elementor"),rowIndex:1}],Vt=({anchorEl:n})=>{const r=b(t.dropShadowFilterPropTypeUtil),i=[(0,e.useRef)(null),(0,e.useRef)(null)];return e.createElement(d,r,Bt.map(t=>e.createElement(St,{key:t.bind,ref:i[t.rowIndex]??null},e.createElement(f,{bind:t.bind},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,t.label)),e.createElement(o.Grid,{item:!0,xs:6},"color"===t.bind?e.createElement(De,{anchorEl:n}):e.createElement(Me,{anchorRef:i[t.rowIndex],enablePropTypeUnits:!0,defaultUnit:"px"}))))))},jt={blur:t.blurFilterPropTypeUtil,intensity:t.intensityFilterPropTypeUtil,"hue-rotate":t.hueRotateFilterPropTypeUtil,"color-tone":t.colorToneFilterPropTypeUtil},Ft=({filterFunc:t})=>{const n=(0,e.useRef)(null),{getFilterFunctionConfig:r}=Lt(),{valueName:i,filterFunctionGroup:s}=r(t),l=b(jt[s]);return e.createElement(d,l,e.createElement(f,{bind:s},e.createElement(f,{bind:"size"},e.createElement(St,{ref:n},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,i)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(Me,{anchorRef:n,enablePropTypeUnits:!0}))))))};function Ut(){return Ut=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},Ut.apply(null,arguments)}const Ht=()=>{const n=b(t.cssFilterFunctionPropUtil),{filterOptions:r,getFilterFunctionConfig:s}=Lt();return e.createElement(d,Ut({},n,{setValue:(e,t,r)=>{let o=structuredClone(e);const i=s(o?.func.value);"func"===r?.bind&&(o=i.defaultValue.value),o.args&&n.setValue(o)}}),e.createElement(f,{bind:"css-filter-func"},e.createElement(kt,{p:1.5},e.createElement(St,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Filter","elementor"))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"func"},e.createElement(te,{options:r})))),e.createElement(f,{bind:"args"},e.createElement(Wt,null)))))},Wt=()=>{const{openItemIndex:t,items:n}=Be(),r=n[t].item.value.func.value;return"drop-shadow"===r?e.createElement(Vt,null):e.createElement(Ft,{filterFunc:r})},Gt=({value:t})=>"drop-shadow"!==t.value.func.value?null:e.createElement(qt,{size:"inherit",component:"span",value:t.value.args.value?.color.value}),qt=(0,o.styled)(o.UnstableColorIndicator)(({theme:e})=>({borderRadius:e.shape.borderRadius/2+"px"})),Kt=({value:t})=>{const n=t.value.args.value,r=["xAxis","yAxis","blur"].map(e=>"custom"!==n[e]?.value?.unit?`${n[e]?.value?.size??0}${n[e]?.value?.unit??"px"}`:n[e]?.value?.size||Te);return e.createElement(o.Box,{component:"span"},e.createElement(o.Box,{component:"span",style:{textTransform:"capitalize"}},"Drop shadow:"),` ${r.join(" ")}`)},Jt=({value:t})=>{const{func:n,args:r}=t.value,{getFilterFunctionConfig:i}=Lt(),{defaultValue:s}=i(n.value??""),l=s.value.args.value?.size?.value?.unit??ae[0],{unit:a,size:c}=r.value.size?.value??{unit:l,size:0},u=e.createElement(o.Box,{component:"span",style:{textTransform:"capitalize"}},n.value??"",":");return e.createElement(o.Box,{component:"span"},u," "+("custom"!==a?`${c??0}${a??l}`:c||Te))},Yt=({value:t})=>"drop-shadow"===t.value.func.value?e.createElement(Kt,{value:t}):e.createElement(Jt,{value:t}),Xt={filter:{propTypeUtil:t.filterPropTypeUtil,label:(0,i.__)("Filters","elementor")},"backdrop-filter":{propTypeUtil:t.backdropFilterPropTypeUtil,label:(0,i.__)("Backdrop filters","elementor")}},Qt=D(({filterPropName:t="filter"})=>{const{propTypeUtil:n,label:r}=(l=t)&&l in Xt?Xt[l]:Xt.filter,{propType:o,value:i,setValue:s}=b(n);var l;return e.createElement($t,null,e.createElement(d,{propType:o,value:i,setValue:s},e.createElement(Zt,{propTypeUtil:n,label:r,filterPropName:t})))}),Zt=({propTypeUtil:t,label:n,filterPropName:r})=>{const{getInitialValue:o}=Lt();return e.createElement(dt,{initial:o(),propTypeUtil:t},e.createElement(Ct,{label:n},e.createElement(Ue,{newItemIndex:0,ariaLabel:"backdrop-filter"===r?"backdrop filter":"filter"})),e.createElement(Xe,null,e.createElement(ut,{Label:Yt,Icon:Gt,actions:e.createElement(e.Fragment,null,e.createElement(mt,null),e.createElement(ht,null),e.createElement(yt,null))})),e.createElement(Et,null,e.createElement(Ht,null)))};function en(){return en=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},en.apply(null,arguments)}const tn={"off-canvas":()=>{const e=window,t=e.elementor.config.document.id,n=e.elementor.$previewContents[0].querySelectorAll(`[data-elementor-id="${t}"] .elementor-widget-off-canvas.elementor-element-edit-mode`);return Array.from(n).map(e=>({label:e.querySelector(".e-off-canvas")?.getAttribute("aria-label")??"",value:e.dataset.id}))}},nn=D(({collectionId:t,options:n,...r})=>{const o=((t,n)=>{const[r,o]=(0,e.useState)(n??[]);return(0,e.useEffect)(()=>{t&&tn[t]?o(tn[t]()):o(n??[])},[t,n]),r})(t,n);return e.createElement(te,en({options:o},r))}),rn=({showTooltip:t,children:n,label:r})=>t&&r?e.createElement(o.Tooltip,{title:r,disableFocusListener:!0,placement:"top"},n):n,on=(0,o.styled)(o.ToggleButtonGroup)` ${({justify:e})=>`justify-content: ${e};`} button:not( :last-of-type ) { border-start-end-radius: 0; border-end-end-radius: 0; } button:not( :first-of-type ) { border-start-start-radius: 0; border-end-start-radius: 0; } button:last-of-type { border-start-end-radius: 8px; border-end-end-radius: 8px; } `,sn=(0,o.styled)(o.ToggleButton,{shouldForwardProp:e=>"isPlaceholder"!==e})` ${({theme:e,isPlaceholder:t})=>t&&`\n\t\tcolor: ${e.palette.text.tertiary};\n\t\tbackground-color: ${"dark"===e.palette.mode?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.02)"};\n\n\t\t&:hover {\n\t\t\tbackground-color: ${"dark"===e.palette.mode?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.04)"};\n\t\t}\n\t`} `,ln=e.forwardRef(({justify:t="end",size:n="tiny",value:r,onChange:i,items:s,maxItems:l,exclusive:a=!1,fullWidth:c=!1,disabled:u,placeholder:d},p)=>{const h=a&&void 0!==l&&s.length>l,f=h?s.slice(l-1):[],m=h?s.slice(0,l-1):s,g="rtl"===(0,o.useTheme)().direction,y=(0,e.useMemo)(()=>{const e=f?.length;return`repeat(${e?m.length+1:m.length}, minmax(0, 25%)) ${e?"auto":""}`},[f?.length,m.length]),b=a&&(null==r||""===r),v=!a&&Array.isArray(r)?r.map(e=>"string"==typeof e?e:"").join(" ").trim().split(/\s+/).filter(Boolean):[],w=!a&&0===v.length,E=(x=d,Array.isArray(x)?x.flatMap(e=>"string"==typeof e?e.trim().split(/\s+/).filter(Boolean):[]):"string"==typeof x?x.trim().split(/\s+/).filter(Boolean):[]);var x;return e.createElement(on,{ref:p,justify:t,value:r,onChange:(e,t)=>{i(t)},exclusive:a,disabled:u,sx:{direction:g?"rtl /* @noflip */":"ltr /* @noflip */",display:"grid",gridTemplateColumns:y,width:"100%"}},m.map(({label:t,value:r,renderContent:o,showTooltip:i})=>{const s=E.length>0&&E.includes(r)&&(b||w);return e.createElement(rn,{key:r,label:t,showTooltip:i||!1},e.createElement(sn,{value:r,"aria-label":t,size:n,fullWidth:c,isPlaceholder:s},e.createElement(o,{size:n})))}),f.length&&a&&e.createElement(cn,{size:n,value:r||null,onChange:i,items:f,fullWidth:c}))}),an=t=>e.createElement(Y,null,e.createElement(ln,t)),cn=({size:t="tiny",onChange:n,items:r,fullWidth:i,value:s})=>{const l=un(r,s),[a,c]=(0,e.useState)(!1),u=(0,e.useRef)(null),d=e=>{c(!1),p(e)},p=e=>{n(e===s?null:e)};return e.createElement(e.Fragment,null,e.createElement(o.ToggleButton,{value:l.value,"aria-label":l.label,size:t,fullWidth:i,onClick:e=>{e.preventDefault(),d(l.value)}},l.renderContent({size:t})),e.createElement(o.ToggleButton,{size:t,"aria-expanded":a?"true":void 0,"aria-haspopup":"menu","aria-pressed":void 0,onClick:e=>{c(e=>!e),e.preventDefault()},ref:u,value:"__chevron-icon-button__"},e.createElement(j.ChevronDownIcon,{fontSize:t})),e.createElement(o.Menu,{open:a,onClose:()=>c(!1),anchorEl:u.current,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{mt:.5}},r.map(({label:t,value:n})=>e.createElement(o.MenuItem,{key:n,selected:n===s,onClick:()=>d(n)},e.createElement(o.ListItemText,null,e.createElement(o.Typography,{sx:{fontSize:"14px"}},t))))))},un=(t,n)=>{const[r,o]=(0,e.useState)(t.find(e=>e.value===n)??t[0]);return(0,e.useEffect)(()=>{const e=t.find(e=>e.value===n);e&&o(e)},[t,n]),r};function dn(){return dn=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},dn.apply(null,arguments)}const pn=D(({options:n,fullWidth:r=!1,size:o="tiny",exclusive:i=!0,maxItems:s,convertOptions:l=!1})=>{const{value:a,setValue:c,placeholder:u,disabled:d}=b(t.stringPropTypeUtil),p=l?(t=>t.map(t=>{const n=t.icon,r=j[n];return{value:t.value,label:t.label,renderContent:({size:n})=>r?e.createElement(r,{fontSize:n}):t.label,showTooltip:t.showTooltip,exclusive:t.exclusive}}))(n):n,h=p.filter(e=>e.exclusive).map(e=>e.value),f={items:p,maxItems:s,fullWidth:r,size:o,placeholder:u};return i?e.createElement(an,dn({},f,{value:a??null,onChange:c,disabled:d,exclusive:!0})):e.createElement(an,dn({},f,{value:a?.split(" ")??[],onChange:e=>{const t=e[e.length-1],n=h.includes(t)?[t]:e?.filter(e=>!h.includes(e));c(n?.join(" ")||null)},disabled:d,exclusive:!1}))}),hn=e=>null==e||""===e||Number.isNaN(Number(e)),fn=D(({placeholder:n,max:r=Number.MAX_SAFE_INTEGER,min:i=-Number.MAX_SAFE_INTEGER,step:s=1,shouldForceInt:l=!1,startIcon:a})=>{const{value:c,setValue:u,placeholder:d,disabled:p,restoreValue:h}=b(t.numberPropTypeUtil);return e.createElement(Y,null,e.createElement(fe,{size:"tiny",type:"number",fullWidth:!0,disabled:p,value:hn(c)?"":c,onInput:e=>{const{value:t,validity:{valid:n}}=e.target;let o;if(hn(t))o=null;else{const e=l?+parseInt(t):Number(t);o=Math.min(Math.max(e,i??Number.MIN_SAFE_INTEGER),r??Number.MAX_SAFE_INTEGER)}u(o,void 0,{validation:()=>n})},onBlur:h,placeholder:n??(hn(d)?"":String(d)),inputProps:{step:s,min:i},InputProps:{startAdornment:a?e.createElement(o.InputAdornment,{position:"start",disabled:p},a):void 0}}))});function mn(){return mn=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},mn.apply(null,arguments)}function gn({label:t,icon:n,tooltipLabel:r,items:s,multiSizePropTypeUtil:l}){const a=(0,e.useId)(),c=(0,o.usePopupState)({variant:"popover",popupId:a}),u=[(0,e.useRef)(null),(0,e.useRef)(null)],{propType:p,disabled:h}=b(l),{value:f,setValue:m,placeholder:g}=b(),y=e=>{if(l.isValid(e))return e.value;const t={};s.forEach(n=>{t[n.bind]=e});const n=l.create(t);return n?.value},v=!c.isOpen,w=y(f),E=y(g),k=e=>{if(!e)return!0;const t=l.create(e),n={};s.forEach(e=>{n[e.bind]=t?.value?.[e.bind]??null});const r=Object.values(n).map(e=>JSON.stringify(e));return r.every(e=>e===r[0])},S=!f&&!k(E),C=S||!k(w);return e.createElement(e.Fragment,null,e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap",ref:u[0]},e.createElement(o.Grid,{item:!0,xs:6},v?e.createElement(M,null,t):e.createElement(x,null,t)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(o.Stack,{direction:"row",alignItems:"center",gap:1},e.createElement(o.Box,{flexGrow:1},e.createElement(Me,{placeholder:C?(0,i.__)("Mixed","elementor"):void 0,enablePropTypeUnits:!C||!S,anchorRef:u[0]})),e.createElement(o.Tooltip,{title:r,placement:"top"},e.createElement(sn,mn({size:"tiny",value:"check",sx:{marginLeft:"auto"}},(0,o.bindToggle)(c),{selected:c.isOpen,isPlaceholder:S,"aria-label":r}),n))))),e.createElement(o.Popover,mn({disablePortal:!0,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"}},(0,o.bindPopover)(c),{slotProps:{paper:{sx:{mt:.5,width:u[0].current?.getBoundingClientRect().width}}}}),e.createElement(d,{propType:p,value:w,placeholder:E,setValue:e=>{k(e)?m(Object.values(e)?.pop()??null):m(l.create(e))},isDisabled:()=>h},e.createElement(kt,{p:1.5},e.createElement(St,{ref:u[1]},e.createElement(yn,{item:s[0],rowRef:u[1]}),e.createElement(yn,{item:s[1],rowRef:u[1]})),e.createElement(St,{ref:u[2]},e.createElement(yn,{item:s[2],rowRef:u[2]}),e.createElement(yn,{item:s[3],rowRef:u[2]}))))))}const yn=({item:t,rowRef:n})=>{const{bind:r,label:i,icon:s,ariaLabel:l}=t;return e.createElement(f,{bind:r},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(o.Grid,{container:!0,gap:.75,alignItems:"center"},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(M,null,i)),e.createElement(o.Grid,{item:!0,xs:12},e.createElement(Me,{startIcon:s,ariaLabel:l,anchorRef:n})))))},bn=({label:n,isSiteRtl:r=!1,extendedOptions:s,min:l})=>{const a=[(0,e.useRef)(null),(0,e.useRef)(null)],{disabled:c}=b(t.sizePropTypeUtil),{value:u,setValue:p,propType:h,placeholder:f,disabled:m}=b(t.dimensionsPropTypeUtil),{value:g,placeholder:y,setValue:v}=b(),w=()=>!(t.dimensionsPropTypeUtil.isValid(g)||!g&&t.dimensionsPropTypeUtil.isValid(y)),[E,k]=(0,e.useState)(()=>w()),S=(0,le.useActiveBreakpoint)();(0,e.useLayoutEffect)(()=>{k(w)},[S]);const C=n.toLowerCase(),T=E?j.LinkIcon:j.DetachIcon,M=(0,i.__)("Link %s","elementor").replace("%s",C),O=(0,i.__)("Unlink %s","elementor").replace("%s",C),I=c||m,P={propType:h,value:u,placeholder:f,setValue:p,isDisabled:()=>m},A=!g&&(f||y);return e.createElement(d,P,e.createElement(o.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(x,null,n),e.createElement(o.Tooltip,{title:E?O:M,placement:"top"},e.createElement(sn,{"aria-label":E?O:M,size:"tiny",value:"check",selected:E,sx:{marginLeft:"auto"},onChange:()=>{if(k(e=>!e),!t.dimensionsPropTypeUtil.isValid(g)){const e=g||null;return e?void v(t.dimensionsPropTypeUtil.create({"block-start":e,"block-end":e,"inline-start":e,"inline-end":e})):void v(null)}v((u?.["block-start"]??u?.["inline-end"]??u?.["block-end"]??u?.["inline-start"]??null)||null)},disabled:I,isPlaceholder:A},e.createElement(T,{fontSize:"tiny"})))),function(t,n){return[[{bind:"block-start",label:(0,i.__)("Top","elementor"),ariaLabel:(0,i.sprintf)((0,i.__)("%s top","elementor"),t),icon:e.createElement(j.SideTopIcon,{fontSize:"tiny"})},{bind:"inline-end",label:n?(0,i.__)("Left","elementor"):(0,i.__)("Right","elementor"),ariaLabel:n?(0,i.sprintf)((0,i.__)("%s left","elementor"),t):(0,i.sprintf)((0,i.__)("%s right","elementor"),t),icon:n?e.createElement(j.SideLeftIcon,{fontSize:"tiny"}):e.createElement(j.SideRightIcon,{fontSize:"tiny"})}],[{bind:"block-end",label:(0,i.__)("Bottom","elementor"),ariaLabel:(0,i.sprintf)((0,i.__)("%s bottom","elementor"),t),icon:e.createElement(j.SideBottomIcon,{fontSize:"tiny"})},{bind:"inline-start",label:n?(0,i.__)("Right","elementor"):(0,i.__)("Left","elementor"),ariaLabel:n?(0,i.sprintf)((0,i.__)("%s right","elementor"),t):(0,i.sprintf)((0,i.__)("%s left","elementor"),t),icon:n?e.createElement(j.SideRightIcon,{fontSize:"tiny"}):e.createElement(j.SideLeftIcon,{fontSize:"tiny"})}]]}(n,r).map((t,n)=>e.createElement(o.Stack,{direction:"row",gap:2,flexWrap:"nowrap",key:n,ref:a[n]},t.map(({icon:t,...r})=>e.createElement(o.Grid,{container:!0,gap:.75,alignItems:"center",key:r.bind},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(wn,r)),e.createElement(o.Grid,{item:!0,xs:12},e.createElement(vn,{bind:r.bind,ariaLabel:r.ariaLabel,startIcon:t,isLinked:E,extendedOptions:s,anchorRef:a[n],min:l})))))))},vn=({bind:t,ariaLabel:n,startIcon:r,isLinked:o,extendedOptions:i,anchorRef:s,min:l})=>o?e.createElement(Me,{ariaLabel:n,startIcon:r,extendedOptions:i,anchorRef:s,min:l}):e.createElement(f,{bind:t},e.createElement(Me,{ariaLabel:n,startIcon:r,extendedOptions:i,anchorRef:s,min:l})),wn=({label:t,bind:n})=>e.createElement(f,{bind:n},e.createElement(M,null,t)),En=({itemsList:t,selectedItem:n,onItemChange:r,onClose:s,sectionWidth:l,title:a,itemStyle:c=()=>({}),onDebounce:u=()=>{},icon:d,disabledItems:p,id:h="item-selector",footer:f,categoryItemContentTemplate:m})=>{const[g,y]=(0,e.useState)(""),b=((e,t,n)=>e.reduce((e,r)=>{const o=r.items.filter(e=>e.toLowerCase().includes(t.toLowerCase()));return o.length&&(e.push({type:"category",value:r.label}),o.forEach(t=>{e.push({type:"item",value:t,disabled:n?.includes(t)??!1})})),e},[]))(t,g,p),v=d,w=()=>{y(""),s()};return e.createElement(Q.PopoverBody,{width:l,id:h},e.createElement(Q.PopoverHeader,{title:a,onClose:w,icon:e.createElement(v,{fontSize:"tiny"})}),e.createElement(Q.SearchField,{value:g,onSearch:e=>{y(e)},placeholder:(0,i.__)("Search","elementor"),id:h+"-search"}),e.createElement(o.Divider,null),e.createElement(o.Box,{sx:{flex:1,overflow:"auto",minHeight:0}},b.length>0?e.createElement(xn,{itemListItems:b,setSelectedItem:r,handleClose:w,selectedItem:n,itemStyle:c,onDebounce:u,categoryItemContentTemplate:m}):e.createElement(o.Stack,{alignItems:"center",justifyContent:"center",height:"100%",p:2.5,gap:1.5,overflow:"hidden"},e.createElement(v,{fontSize:"large"}),e.createElement(o.Box,{sx:{maxWidth:160,overflow:"hidden"}},e.createElement(o.Typography,{align:"center",variant:"subtitle2",color:"text.secondary"},(0,i.__)("Sorry, nothing matched","elementor")),e.createElement(o.Typography,{variant:"subtitle2",color:"text.secondary",sx:{display:"flex",width:"100%",justifyContent:"center"}},e.createElement("span",null,"“"),e.createElement(o.Box,{component:"span",sx:{maxWidth:"80%",overflow:"hidden",textOverflow:"ellipsis"}},g),e.createElement("span",null,"”."))),e.createElement(o.Typography,{align:"center",variant:"caption",color:"text.secondary",sx:{display:"flex",flexDirection:"column"}},(0,i.__)("Try something else.","elementor"),e.createElement(o.Link,{color:"secondary",variant:"caption",component:"button",onClick:()=>y("")},(0,i.__)("Clear & try again","elementor"))))),f)},xn=({itemListItems:t,setSelectedItem:n,handleClose:r,selectedItem:o,itemStyle:i=()=>({}),onDebounce:s=()=>{},categoryItemContentTemplate:l})=>{const a=t.find(e=>e.value===o),c=kn(e=>{e.forEach(e=>{e&&"item"===e.type&&s(e.value)})},100),u=(0,e.useCallback)(e=>i(e),[i]);return e.createElement(Q.PopoverMenuList,{items:t,selectedValue:a?.value,onChange:c,onSelect:n,onClose:r,itemStyle:u,"data-testid":"item-list",categoryItemContentTemplate:l})},kn=(t,n)=>{const[r]=(0,e.useState)(()=>(0,s.debounce)(t,n));return(0,e.useEffect)(()=>()=>r.cancel(),[r]),r},Sn=(e,t="editor")=>{const n=window;return n.elementor?.helpers?.enqueueFont?.(e,t)??null};function Cn(){return Cn=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},Cn.apply(null,arguments)}const Tn=D(({fontFamilies:n,sectionWidth:r,ariaLabel:s})=>{const{value:l,setValue:a,disabled:c,placeholder:u}=b(t.stringPropTypeUtil),d=(0,o.usePopupState)({variant:"popover"}),p=!l&&u,h=e.useMemo(()=>n.map(({label:e,fonts:t})=>({label:e,items:t})),[n]);return e.createElement(e.Fragment,null,e.createElement(Y,null,e.createElement(o.UnstableTag,Cn({id:"font-family-control",variant:"outlined",label:l||u,endIcon:e.createElement(j.ChevronDownIcon,{fontSize:"tiny"})},(0,o.bindTrigger)(d),{fullWidth:!0,disabled:c,"aria-label":s,sx:p?{"& .MuiTag-label":{color:e=>e.palette.text.tertiary},textTransform:"capitalize"}:void 0}))),e.createElement(o.Popover,Cn({disablePortal:!0,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{my:1.5}},(0,o.bindPopover)(d)),e.createElement(En,{id:"font-family-selector",itemsList:h,selectedItem:l,onItemChange:a,onClose:d.close,sectionWidth:r,title:(0,i.__)("Font family","elementor"),itemStyle:e=>({fontFamily:e.value}),onDebounce:Sn,icon:j.TextIcon})))}),Mn=D(({placeholder:n,ariaLabel:r})=>{const{value:i,setValue:s,disabled:l}=b(t.urlPropTypeUtil);return e.createElement(Y,null,e.createElement(o.TextField,{size:"tiny",fullWidth:!0,value:i??"",disabled:l,onChange:e=>s(e.target.value),placeholder:n,inputProps:{...r?{"aria-label":r}:{}}}))});var On=window.elementorV2.editorElements,In=window.elementorV2.session;const Pn={label:(0,i.__)("Learn More","elementor"),href:"https://go.elementor.com/element-link-inside-link-infotip"},An={descendant:(0,i.__)("To add a link or action to this element, first remove the link or action from the elements inside of it.","elementor"),ancestor:(0,i.__)("To add a link or action to this container, first remove the link or action from its parent container.","elementor")},Dn=({linkInLinkRestriction:t,isVisible:n,children:r})=>{const{shouldRestrict:s,reason:l,elementId:a}=t,c=e.createElement(o.Alert,{color:"secondary",icon:e.createElement(j.InfoCircleFilledIcon,null),action:e.createElement(o.AlertAction,{sx:{width:"fit-content"},variant:"contained",color:"secondary",onClick:()=>{a&&(0,On.selectElement)(a)}},(0,i.__)("Take me there","elementor"))},e.createElement(o.AlertTitle,null,(0,i.__)("Nested links","elementor")),e.createElement(o.Box,{component:"span"},An[l??"descendant"]," ",e.createElement(o.Link,{href:Pn.href,target:"_blank",color:"info.main"},Pn.label)));return s&&n?e.createElement(o.Infotip,{placement:"right",content:c,color:"secondary",slotProps:{popper:{sx:{width:300}}}},e.createElement(o.Box,null,r)):e.createElement(e.Fragment,null,r)};function _n(){return _n=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},_n.apply(null,arguments)}const Nn=(0,e.forwardRef)((t,n)=>{const{options:r,onOptionChange:i,onTextChange:s,allowCustomValues:l=!1,placeholder:a="",minInputLength:c=2,value:u="",startAdornment:d,disablePortal:p=!0,inputProps:h,...f}=t,m=function(e,t,n){if(null===e)return t;const r=String(e||"")?.toLowerCase();return r.length<n?new Array(0):t.filter(e=>String(e.id).toLowerCase().includes(r)||e.label.toLowerCase().includes(r))}(u,r,c).map(({id:e})=>e),g=!!u,y=l||u?.toString()?.length?void 0:()=>!0,b="number"==typeof u&&!!$n(r,u),v=(u?.toString()?.length??0)>=c&&(!l||m.length>0);return e.createElement(o.Autocomplete,_n({},f,{ref:n,forcePopupIcon:!1,disablePortal:p,disableClearable:!0,freeSolo:l,openOnFocus:!1,open:v,value:u?.toString()||"",size:"tiny",onChange:(e,t)=>i(Number(t)),readOnly:b,options:m,getOptionKey:e=>$n(r,e)?.id||e,getOptionLabel:e=>$n(r,e)?.label||e.toString(),groupBy:Ln(r)?e=>$n(r,e)?.groupLabel||e:void 0,isOptionEqualToValue:y,filterOptions:()=>m,renderOption:(t,n)=>e.createElement(o.Box,_n({component:"li"},t,{key:t.id}),$n(r,n)?.label??n),renderInput:t=>e.createElement(Rn,{params:t,handleChange:e=>s?.(e),allowClear:g,placeholder:a,hasSelectedValue:b,startAdornment:d,extraInputProps:h})}))}),Rn=({params:t,allowClear:n,placeholder:r,handleChange:i,hasSelectedValue:s,startAdornment:l,extraInputProps:a})=>e.createElement(o.TextField,_n({},t,{placeholder:r,onChange:e=>{i(e.target.value)},inputProps:{...t.inputProps??{},...a??{}},sx:{"& .MuiInputBase-input":{cursor:s?"default":void 0}},InputProps:{...t.InputProps,startAdornment:l?e.createElement(o.InputAdornment,{position:"start"},l):t.InputProps.startAdornment,endAdornment:e.createElement(zn,{params:t,allowClear:n,handleChange:i})}})),zn=({allowClear:t,handleChange:n,params:r})=>e.createElement(o.InputAdornment,{position:"end"},t&&e.createElement(o.IconButton,{size:r.size,onClick:()=>n(null),sx:{cursor:"pointer"}},e.createElement(j.XIcon,{fontSize:r.size})));function $n(e,t=null){const n=(t||"").toString();return e.find(({id:e})=>n===e.toString())}function Ln(e){return!(e.length<=1)&&new Set(e.map(e=>e.groupLabel)).size>1}const Bn=D(n=>{const{value:r,setValue:o}=b(),{allowCustomValues:l=!0,queryOptions:{url:a,params:c={}},placeholder:u,minInputLength:d=2,onSetValue:p,ariaLabel:h}=n||{},f=u||(0,i.__)("Search","elementor"),[m,g]=(0,e.useState)(function(e){const t=e?.id?.value,n=e?.label?.value;return t&&n&&"number"===(e?.id?.$$type||"url")?[{id:t.toString(),label:n}]:[]}(r?.value)),y=(0,e.useMemo)(()=>(0,s.debounce)(e=>async function(e,t){if(!t||!e)return[];try{const{data:n}=await(0,N.httpService)().get(e,{params:t});return n.data.value}catch{return[]}}(a,e).then(e=>{g(function(e){const t=Ln(e)?"groupLabel":"label";return e.sort((e,n)=>e[t]&&n[t]?e[t].localeCompare(n[t]):0)}(e))}),400),[a]);return e.createElement(Y,null,e.createElement(Nn,{options:m,allowCustomValues:l,placeholder:f,startAdornment:e.createElement(j.SearchIcon,{fontSize:"tiny"}),value:r?.value?.id?.value||r?.value,onOptionChange:e=>{if(null===e)return o(null),void p?.(null);const n={$$type:"query",value:{id:t.numberPropTypeUtil.create(e),label:t.stringPropTypeUtil.create($n(m,e)?.label||null)}};o(n),p?.(n)},onTextChange:e=>{if(!e)return o(null),void p?.(null);const n=e?.trim()||"",r=n?t.urlPropTypeUtil.create(n):null;o(r),p?.(r),(e=>{g([]),!e||!a||e.length<d||y({...c,term:e})})(e)},minInputLength:d,disablePortal:!1,inputProps:{...h?{"aria-label":h}:{}}}))}),Vn=D(()=>{const{value:n,setValue:r,disabled:i}=b(t.booleanPropTypeUtil);return e.createElement(o.Box,{sx:{display:"flex",justifyContent:"flex-end"}},e.createElement(o.Switch,{checked:!!n,onChange:e=>{r(e.target.checked)},size:"small",disabled:i,inputProps:{...i?{style:{opacity:0}}:{}}}))});function jn(){return jn=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},jn.apply(null,arguments)}const Fn="tiny",Un=D(n=>{const{value:r,path:l,setValue:a,...c}=b(t.linkPropTypeUtil),[u,p]=(0,In.useSessionStorage)(l.join("/")),[h,m]=(0,e.useState)(!!r),{allowCustomValues:g=!0,queryOptions:y,placeholder:v,minInputLength:w=2,context:{elementId:E},label:k=(0,i.__)("Link","elementor"),ariaLabel:S}=n||{},[C,T]=(0,e.useState)((0,On.getLinkInLinkRestriction)(E,r)),O=!h&&C.shouldRestrict,I=(0,e.useMemo)(()=>(0,s.debounce)(()=>{const e=(0,On.getLinkInLinkRestriction)(E,r);e.shouldRestrict&&h&&m(!1),T(e)},300),[E,h,r]);return(0,e.useEffect)(()=>{I();const e=e=>{e.detail.elementId===E&&I()};return window.addEventListener("elementor:inline-link-changed",e),()=>{window.removeEventListener("elementor:inline-link-changed",e),I.cancel()}},[E,I]),e.createElement(d,jn({},c,{value:r,setValue:a}),e.createElement(o.Stack,{gap:1.5},e.createElement(o.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",marginInlineEnd:-.75}},e.createElement(M,null,k),e.createElement(Dn,{isVisible:!h,linkInLinkRestriction:C},e.createElement(Hn,{disabled:O,active:h,onIconClick:()=>{if(T((0,On.getLinkInLinkRestriction)(E,r)),C.shouldRestrict&&!h)return;const e=!h;m(e),e||null===r||a(null),e&&u?.value&&a(u.value),p({value:u?.value,meta:{isEnabled:e}})},label:(0,i.__)("Toggle link","elementor")}))),e.createElement(o.Collapse,{in:h,timeout:"auto",unmountOnExit:!0},e.createElement(o.Stack,{gap:1.5},e.createElement(f,{bind:"destination"},e.createElement(Bn,{queryOptions:y,allowCustomValues:g,minInputLength:w,placeholder:v,onSetValue:e=>{const t=e?{...r,destination:e}:null;p({...u,value:t})},ariaLabel:S||k})),e.createElement(f,{bind:"isTargetBlank"},e.createElement(o.Grid,{container:!0,alignItems:"center",flexWrap:"nowrap",justifyContent:"space-between"},e.createElement(o.Grid,{item:!0},e.createElement(x,null,(0,i.__)("Open in a new tab","elementor"))),e.createElement(o.Grid,{item:!0,sx:{marginInlineEnd:-1}},e.createElement(Vn,null))))))))}),Hn=({disabled:t,active:n,onIconClick:r,label:i})=>e.createElement(o.IconButton,{size:Fn,onClick:r,"aria-label":i,disabled:t},n?e.createElement(j.MinusIcon,{fontSize:Fn}):e.createElement(j.PlusIcon,{fontSize:Fn}));function Wn(){return Wn=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},Wn.apply(null,arguments)}const Gn="secondary",qn=e.forwardRef(({children:t,title:n,description:r,alertProps:i,infotipProps:s,...l},a)=>{const c="rtl"===(0,o.useTheme)().direction,u=l.isEnabled&&(n||r);return e.createElement(o.Box,{ref:a},u?e.createElement(o.DirectionProvider,{rtl:c},e.createElement(o.Infotip,Wn({placement:"right",color:Gn,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,10]}}]}}},s,{content:e.createElement(Q.InfoAlert,Wn({color:Gn,sx:{width:300,px:1.5,py:2}},i),e.createElement(o.Box,{sx:{flexDirection:"column",display:"flex",gap:.5}},e.createElement(o.AlertTitle,null,n),e.createElement(o.Box,null,r)))}),t)):t)});function Kn(){return Kn=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},Kn.apply(null,arguments)}const Jn=(0,o.styled)(o.Select)(()=>({".MuiSelect-select.Mui-disabled":{cursor:"not-allowed"}})),Yn=D(({options:n,onChange:r,fallbackLabels:s={}})=>{const{value:l,setValue:a,disabled:c,placeholder:u}=b(t.stringPropTypeUtil),d=(0,On.getElementLabel)()??"element",p={title:(0,i.__)("HTML Tag","elementor"),description:(0,i.__)("The tag is locked to 'a' tag because this %s has a link. To pick a different tag, remove the link first.","elementor").replace("%s",d),isEnabled:!!c},h=e=>n.find(t=>t.value===e);return e.createElement(Y,null,e.createElement(qn,p,e.createElement(Jn,{sx:{overflow:"hidden",cursor:c?"not-allowed":void 0},displayEmpty:!0,size:"tiny",renderValue:t=>{if(t)return h(t)?.label||s[t]||t;if(!u)return"";const n=h(u),r=n?.label||u;return e.createElement(o.Typography,{component:"span",variant:"caption",color:"text.tertiary"},r)},value:l??"",onChange:e=>{const t=e.target.value||null;r?.(t,l),a(t)},disabled:c,fullWidth:!0},n.map(({label:t,...n})=>e.createElement(Q.MenuListItem,Kn({key:n.value},n,{value:n.value??""}),t)))))}),Xn=({label:n})=>{const r=(0,e.useRef)(null),{disabled:s}=b(t.sizePropTypeUtil),{value:l,setValue:a,propType:c,placeholder:u,disabled:p}=b(t.layoutDirectionPropTypeUtil),{value:h,setValue:f,placeholder:m}=b(),g=()=>!(t.layoutDirectionPropTypeUtil.isValid(h)||!h&&t.layoutDirectionPropTypeUtil.isValid(m)),[y,v]=(0,e.useState)(()=>g()),w=(0,le.useActiveBreakpoint)();(0,e.useLayoutEffect)(()=>{v(g())},[w]);const E=n.toLowerCase(),k=y?j.LinkIcon:j.DetachIcon,S=(0,i.__)("Link %s","elementor").replace("%s",E),C=(0,i.__)("Unlink %s","elementor").replace("%s",E),T=s||p,O={propType:c,value:l,setValue:a,placeholder:u},I=!h&&(u||m);return e.createElement(d,O,e.createElement(o.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(M,null,n),e.createElement(o.Tooltip,{title:y?C:S,placement:"top"},e.createElement(sn,{"aria-label":y?C:S,size:"tiny",value:"check",selected:y,sx:{marginLeft:"auto"},onChange:()=>{if(v(e=>!e),!t.layoutDirectionPropTypeUtil.isValid(h)){const e=h||null;return e?void f(t.layoutDirectionPropTypeUtil.create({row:e,column:e})):void f(null)}f(l?.column??l?.row??null)},disabled:T,isPlaceholder:I},e.createElement(k,{fontSize:"tiny"})))),e.createElement(o.Stack,{direction:"row",gap:2,flexWrap:"nowrap",ref:r},e.createElement(o.Grid,{container:!0,gap:.75,alignItems:"center"},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(x,null,(0,i.__)("Column","elementor"))),e.createElement(o.Grid,{item:!0,xs:12},e.createElement(Qn,{bind:"column",ariaLabel:(0,i.__)("Column gap","elementor"),isLinked:y,anchorRef:r}))),e.createElement(o.Grid,{container:!0,gap:.75,alignItems:"center"},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(x,null,(0,i.__)("Row","elementor"))),e.createElement(o.Grid,{item:!0,xs:12},e.createElement(Qn,{bind:"row",ariaLabel:(0,i.__)("Row gap","elementor"),isLinked:y,anchorRef:r})))))},Qn=({bind:t,ariaLabel:n,isLinked:r,anchorRef:o})=>r?e.createElement(Me,{anchorRef:o,ariaLabel:n}):e.createElement(f,{bind:t},e.createElement(Me,{anchorRef:o,ariaLabel:n}));function Zn(){return Zn=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},Zn.apply(null,arguments)}const er=[{label:(0,i.__)("Auto","elementor"),value:"auto"},{label:"1/1",value:"1/1"},{label:"4/3",value:"4/3"},{label:"3/4",value:"3/4"},{label:"16/9",value:"16/9"},{label:"9/16",value:"9/16"},{label:"3/2",value:"3/2"},{label:"2/3",value:"2/3"}],tr="custom",nr=D(({label:n})=>{const{value:r,setValue:s,disabled:l}=b(t.stringPropTypeUtil),a=r&&!er.some(e=>e.value===r),[c,u]=a?r.split("/"):["",""],[d,p]=(0,e.useState)(a),[h,f]=(0,e.useState)(c),[m,g]=(0,e.useState)(u),[y,v]=(0,e.useState)(a?tr:r||"");return(0,e.useEffect)(()=>{if(r&&!er.some(e=>e.value===r)){const[e,t]=r.split("/");f(e||""),g(t||""),v(tr),p(!0)}else v(r||""),p(!1),f(""),g("")},[r]),e.createElement(Y,null,e.createElement(o.Stack,{direction:"column",gap:2},e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(M,null,n)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(o.Select,{size:"tiny",displayEmpty:!0,sx:{overflow:"hidden"},disabled:l,value:y,onChange:e=>{const t=e.target.value,n=t===tr;p(n),v(t),n||s(t)},fullWidth:!0},[...er,{label:(0,i.__)("Custom","elementor"),value:tr}].map(({label:t,...n})=>e.createElement(Q.MenuListItem,Zn({key:n.value},n,{value:n.value??""}),t))))),d&&e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(o.TextField,{size:"tiny",type:"number",fullWidth:!0,disabled:l,value:h,onChange:e=>{const t=e.target.value;f(t),t&&m&&s(`${t}/${m}`)},InputProps:{startAdornment:e.createElement(j.ArrowsMoveHorizontalIcon,{fontSize:"tiny"})}})),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(o.TextField,{size:"tiny",type:"number",fullWidth:!0,disabled:l,value:m,onChange:e=>{const t=e.target.value;g(t),h&&t&&s(`${h}/${t}`)},InputProps:{startAdornment:e.createElement(j.ArrowsMoveVerticalIcon,{fontSize:"tiny"})}})))))});var rr=window.elementorV2.editorCurrentUser;const or=(0,i.__)("Enable Unfiltered Uploads","elementor"),ir=(0,i.__)("Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.","elementor"),sr=(0,i.__)("Failed to enable unfiltered files upload.","elementor"),lr=(0,i.__)("You can try again, if the problem persists, please contact support.","elementor"),ar=t=>{const{mutateAsync:n,isPending:r}=function(){const e=(0,_.useQueryClient)();return(0,_.useMutation)({mutationFn:({allowUnfilteredFilesUpload:e})=>{return t=$,n=e?"1":"0",(0,N.httpService)().put(`${R}/${t}`,{value:n});var t,n},onSuccess:()=>e.invalidateQueries(L)})}(),[o,i]=(0,e.useState)(!1),s={...t,isPending:r,handleEnable:async()=>{try{const e=await n({allowUnfilteredFilesUpload:!0});!1===e?.data?.success?i(!0):t.onClose(!0)}catch{i(!0)}},isError:o,onClose:e=>{t.onClose(e),setTimeout(()=>i(!1),300)}};return e.createElement(cr,s)},cr=({open:t,onClose:n,handleEnable:r,isPending:s,isError:l})=>e.createElement(o.Dialog,{open:t,maxWidth:"sm",onClose:()=>n(!1)},e.createElement(o.DialogHeader,{logo:!1},e.createElement(o.DialogTitle,null,or)),e.createElement(o.Divider,null),e.createElement(o.DialogContent,null,e.createElement(o.DialogContentText,null,l?e.createElement(e.Fragment,null,sr," ",e.createElement("br",null)," ",lr):ir)),e.createElement(o.DialogActions,null,e.createElement(o.Button,{size:"medium",color:"secondary",onClick:()=>n(!1)},(0,i.__)("Cancel","elementor")),e.createElement(o.Button,{size:"medium",onClick:()=>r(),variant:"contained",color:"primary",disabled:s},s?e.createElement(o.CircularProgress,{size:24}):(0,i.__)("Enable","elementor")))),ur="transparent",dr="#c1c1c1",pr=`linear-gradient(45deg, ${dr} 25%, ${ur} 0, ${ur} 75%, ${dr} 0, ${dr})`,hr=(0,o.styled)(o.Card)` background-color: white; background-image: ${pr}, ${pr}; background-size: ${8}px ${8}px; background-position: 0 0, ${4}px ${4}px; border: none; `,fr=(0,o.styled)(o.Stack)` position: relative; height: 140px; object-fit: contain; padding: 5px; justify-content: center; align-items: center; background-color: rgba( 255, 255, 255, 0.37 ); `,mr={mode:"browse"},gr={mode:"upload"},yr=D(()=>{const{value:n,setValue:r}=b(t.imageSrcPropTypeUtil),{id:s,url:l}=n??{},{data:a,isFetching:c}=(0,F.useWpMediaAttachment)(s?.value||null),u=a?.url??l?.value??null,{data:d}=B(),[p,h]=(0,e.useState)(!1),{isAdmin:f}=(0,rr.useCurrentUserCapabilities)(),{open:m}=(0,F.useWpMediaFrame)({mediaTypes:["svg"],multiple:!1,selected:s?.value||null,onSelect:e=>{r({id:{$$type:"image-attachment-id",value:e.id},url:null})}}),g=e=>{d||e!==gr?m(e):h(!0)},y={title:(0,i.__)("Sorry, you can't upload that file yet.","elementor"),description:e.createElement(e.Fragment,null,(0,i.__)("To upload them anyway, ask the site administrator to enable unfiltered","elementor"),e.createElement("br",null),(0,i.__)("file uploads.","elementor")),isEnabled:!f};return e.createElement(o.Stack,{gap:1,"aria-label":"SVG Control"},e.createElement(ar,{open:p,onClose:e=>{h(!1),e&&m(gr)}}),e.createElement(Y,null,e.createElement(hr,{variant:"outlined"},e.createElement(fr,null,c?e.createElement(o.CircularProgress,{role:"progressbar"}):e.createElement(o.CardMedia,{component:"img",image:u,alt:(0,i.__)("Preview SVG","elementor"),sx:{maxHeight:"140px",width:"50px"}})),e.createElement(o.CardOverlay,{sx:{"&:hover":{backgroundColor:"rgba( 0, 0, 0, 0.75 )"}}},e.createElement(o.Stack,{gap:1},e.createElement(o.Button,{size:"tiny",color:"inherit",variant:"outlined",onClick:()=>g(mr),"aria-label":"Select SVG"},(0,i.__)("Select SVG","elementor")),e.createElement(qn,y,e.createElement("span",null,e.createElement(o.ThemeProvider,{colorScheme:f?"light":"dark"},e.createElement(o.Button,{size:"tiny",variant:"text",color:"inherit",startIcon:e.createElement(j.UploadIcon,null),disabled:!f,onClick:()=>f&&g(gr),"aria-label":"Upload SVG"},(0,i.__)("Upload","elementor"))))))))))});var br=window.elementorV2.env;const{env:vr}=(0,br.parseEnv)("@elementor/editor-controls"),wr=D(()=>{const{value:n,setValue:r}=b(t.backgroundGradientOverlayPropTypeUtil);return e.createElement(o.UnstableGradientBox,{sx:{width:"auto",padding:1.5},value:(()=>{if(!n)return;const{type:e,angle:t,stops:r,positions:o}=n;return{type:e.value,angle:t?.value||0,stops:r.value.map(({value:{color:e,offset:t}})=>({color:e.value,offset:t.value})),positions:o?.value.split(" ")}})(),onChange:e=>{const n=(e=>({...e,type:t.stringPropTypeUtil.create(e.type),angle:t.numberPropTypeUtil.create(e.angle),stops:t.gradientColorStopPropTypeUtil.create(e.stops.map(({color:e,offset:n})=>t.colorStopPropTypeUtil.create({color:t.colorPropTypeUtil.create(e),offset:t.numberPropTypeUtil.create(n)})))}))(e);n.positions&&(n.positions=t.stringPropTypeUtil.create(e.positions.join(" "))),r(n)}})}),Er=t.backgroundGradientOverlayPropTypeUtil.create({type:t.stringPropTypeUtil.create("linear"),angle:t.numberPropTypeUtil.create(180),stops:t.gradientColorStopPropTypeUtil.create([t.colorStopPropTypeUtil.create({color:t.colorPropTypeUtil.create("rgb(0,0,0)"),offset:t.numberPropTypeUtil.create(0)}),t.colorStopPropTypeUtil.create({color:t.colorPropTypeUtil.create("rgb(255,255,255)"),offset:t.numberPropTypeUtil.create(100)})])}),xr=[{value:"fixed",label:(0,i.__)("Fixed","elementor"),renderContent:({size:t})=>e.createElement(j.PinIcon,{fontSize:t}),showTooltip:!0},{value:"scroll",label:(0,i.__)("Scroll","elementor"),renderContent:({size:t})=>e.createElement(j.PinnedOffIcon,{fontSize:t}),showTooltip:!0}],kr=()=>e.createElement(St,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Attachment","elementor"))),e.createElement(o.Grid,{item:!0,xs:6,sx:{display:"flex",justifyContent:"flex-end",overflow:"hidden"}},e.createElement(pn,{options:xr}))),Sr=[{label:(0,i.__)("Center center","elementor"),value:"center center"},{label:(0,i.__)("Center left","elementor"),value:"center left"},{label:(0,i.__)("Center right","elementor"),value:"center right"},{label:(0,i.__)("Top center","elementor"),value:"top center"},{label:(0,i.__)("Top left","elementor"),value:"top left"},{label:(0,i.__)("Top right","elementor"),value:"top right"},{label:(0,i.__)("Bottom center","elementor"),value:"bottom center"},{label:(0,i.__)("Bottom left","elementor"),value:"bottom left"},{label:(0,i.__)("Bottom right","elementor"),value:"bottom right"},{label:(0,i.__)("Custom","elementor"),value:"custom"}],Cr=()=>{const n=b(t.backgroundImagePositionOffsetPropTypeUtil),r=b(t.stringPropTypeUtil),s=!!n.value,l=(0,e.useRef)(null);return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(St,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Position","elementor"))),e.createElement(o.Grid,{item:!0,xs:6,sx:{display:"flex",justifyContent:"flex-end",overflow:"hidden"}},e.createElement(Y,null,e.createElement(o.Select,{fullWidth:!0,size:"tiny",onChange:e=>{const t=e.target.value||null;"custom"===t?n.setValue({x:null,y:null}):r.setValue(t)},disabled:r.disabled,value:(n.value?"custom":r.value)??""},Sr.map(({label:t,value:n})=>e.createElement(Q.MenuListItem,{key:n,value:n??""},t))))))),s?e.createElement(d,n,e.createElement(o.Grid,{item:!0,xs:12},e.createElement(o.Grid,{container:!0,spacing:1.5,ref:l},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"x"},e.createElement(Me,{startIcon:e.createElement(j.LetterXIcon,{fontSize:"tiny"}),anchorRef:l,min:-Number.MAX_SAFE_INTEGER}))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"y"},e.createElement(Me,{startIcon:e.createElement(j.LetterYIcon,{fontSize:"tiny"}),anchorRef:l,min:-Number.MAX_SAFE_INTEGER})))))):null)},Tr=[{value:"repeat",label:(0,i.__)("Repeat","elementor"),renderContent:({size:t})=>e.createElement(j.GridDotsIcon,{fontSize:t}),showTooltip:!0},{value:"repeat-x",label:(0,i.__)("Repeat-x","elementor"),renderContent:({size:t})=>e.createElement(j.DotsHorizontalIcon,{fontSize:t}),showTooltip:!0},{value:"repeat-y",label:(0,i.__)("Repeat-y","elementor"),renderContent:({size:t})=>e.createElement(j.DotsVerticalIcon,{fontSize:t}),showTooltip:!0},{value:"no-repeat",label:(0,i.__)("No-repeat","elementor"),renderContent:({size:t})=>e.createElement(j.XIcon,{fontSize:t}),showTooltip:!0}],Mr=()=>e.createElement(St,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Repeat","elementor"))),e.createElement(o.Grid,{item:!0,xs:6,sx:{display:"flex",justifyContent:"flex-end"}},e.createElement(pn,{options:Tr}))),Or=[{value:"auto",label:(0,i.__)("Auto","elementor"),renderContent:({size:t})=>e.createElement(j.LetterAIcon,{fontSize:t}),showTooltip:!0},{value:"cover",label:(0,i.__)("Cover","elementor"),renderContent:({size:t})=>e.createElement(j.ArrowsMaximizeIcon,{fontSize:t}),showTooltip:!0},{value:"contain",label:(0,i.__)("Contain","elementor"),renderContent:({size:t})=>e.createElement(j.ArrowBarBothIcon,{fontSize:t}),showTooltip:!0},{value:"custom",label:(0,i.__)("Custom","elementor"),renderContent:({size:t})=>e.createElement(j.PencilIcon,{fontSize:t}),showTooltip:!0}],Ir=()=>{const n=b(t.backgroundImageSizeScalePropTypeUtil),r=b(t.stringPropTypeUtil),s=!!n.value,l=(0,e.useRef)(null);return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(St,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Size","elementor"))),e.createElement(o.Grid,{item:!0,xs:6,sx:{display:"flex",justifyContent:"flex-end"}},e.createElement(an,{exclusive:!0,items:Or,onChange:e=>{"custom"===e?n.setValue({width:null,height:null}):r.setValue(e)},disabled:r.disabled,value:n.value?"custom":r.value})))),s?e.createElement(d,n,e.createElement(o.Grid,{item:!0,xs:12,ref:l},e.createElement(St,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"width"},e.createElement(Me,{startIcon:e.createElement(j.ArrowsMoveHorizontalIcon,{fontSize:"tiny"}),extendedOptions:["auto"],anchorRef:l}))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"height"},e.createElement(Me,{startIcon:e.createElement(j.ArrowsMoveVerticalIcon,{fontSize:"tiny"}),extendedOptions:["auto"],anchorRef:l})))))):null)};function Pr(){return Pr=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},Pr.apply(null,arguments)}const Ar=t.backgroundColorOverlayPropTypeUtil.create({color:t.colorPropTypeUtil.create("#00000033")}),Dr=()=>({$$type:"background-image-overlay",value:{image:{$$type:"image",value:{src:{$$type:"image-src",value:{url:{$$type:"url",value:vr.background_placeholder_image},id:null}},size:{$$type:"string",value:"large"}}}}}),_r=[{label:(0,i.__)("Thumbnail - 150 x 150","elementor"),value:"thumbnail"},{label:(0,i.__)("Medium - 300 x 300","elementor"),value:"medium"},{label:(0,i.__)("Large 1024 x 1024","elementor"),value:"large"},{label:(0,i.__)("Full","elementor"),value:"full"}],Nr=D(()=>{const{propType:n,value:r,setValue:o}=b(t.backgroundOverlayPropTypeUtil);return e.createElement(d,{propType:n,value:r,setValue:o},e.createElement(dt,{initial:Dr(),propTypeUtil:t.backgroundOverlayPropTypeUtil},e.createElement(Ct,{label:(0,i.__)("Overlay","elementor")},e.createElement(Ue,{newItemIndex:0})),e.createElement(Xe,null,e.createElement(ut,{Icon:zr,Label:jr,actions:e.createElement(e.Fragment,null,e.createElement(mt,null),e.createElement(ht,null),e.createElement(yt,null))})),e.createElement(Et,null,e.createElement(Rr,null))))}),Rr=()=>{const{getTabsProps:n,getTabProps:r,getTabPanelProps:s}=(({color:n,image:r,gradient:i})=>{const{value:s,setValue:l}=b(t.backgroundImageOverlayPropTypeUtil),{value:a,setValue:c}=b(t.backgroundColorOverlayPropTypeUtil),{value:u,setValue:d}=b(t.backgroundGradientOverlayPropTypeUtil),{getTabsProps:p,getTabProps:h,getTabPanelProps:f}=(0,o.useTabs)(a?"color":u?"gradient":"image"),m=(0,e.useRef)({image:r,color:n,gradient:i}),g=(e,t)=>{t&&(m.current[e]=t)},y=(e,t)=>{switch(t){case"image":l(m.current.image),g("color",a),g("gradient",u);break;case"gradient":d(m.current.gradient),g("color",a),g("image",s);break;case"color":c(m.current.color),g("image",s),g("gradient",u)}return p().onChange(e,t)};return{getTabProps:h,getTabPanelProps:f,getTabsProps:()=>({...p(),onChange:y})}})({image:Dr().value,color:Ar.value,gradient:Er.value}),{rowRef:l}=Be();return e.createElement(o.Box,{sx:{width:"100%"}},e.createElement(o.Box,{sx:{borderBottom:1,borderColor:"divider"}},e.createElement(o.Tabs,Pr({size:"small",variant:"fullWidth"},n(),{"aria-label":(0,i.__)("Background Overlay","elementor")}),e.createElement(o.Tab,Pr({label:(0,i.__)("Image","elementor")},r("image"))),e.createElement(o.Tab,Pr({label:(0,i.__)("Gradient","elementor")},r("gradient"))),e.createElement(o.Tab,Pr({label:(0,i.__)("Color","elementor")},r("color"))))),e.createElement(o.TabPanel,Pr({sx:{p:1.5}},s("image")),e.createElement(kt,null,e.createElement(Gr,null))),e.createElement(o.TabPanel,Pr({sx:{p:1.5}},s("gradient")),e.createElement(wr,null)),e.createElement(o.TabPanel,Pr({sx:{p:1.5}},s("color")),e.createElement(kt,null,e.createElement(Wr,{anchorEl:l}))))},zr=({value:t})=>{switch(t.$$type){case"background-image-overlay":return e.createElement(Br,{value:t});case"background-color-overlay":return e.createElement(Lr,{value:t});case"background-gradient-overlay":return e.createElement(Vr,{value:t});default:return null}},$r=e=>e?.value?.color?.value?e.value.color.value:"",Lr=({value:t})=>{const n=$r(t);return e.createElement(qr,{size:"inherit",component:"span",value:n})},Br=({value:t})=>{const{imageUrl:n}=Kr(t);return e.createElement(o.CardMedia,{image:n,sx:e=>({height:"1rem",width:"1rem",borderRadius:e.shape.borderRadius/2+"px",outline:`1px solid ${e.palette.action.disabled}`})})},Vr=({value:t})=>{const n=Yr(t);return e.createElement(qr,{size:"inherit",component:"span",value:n})},jr=({value:t})=>{switch(t.$$type){case"background-image-overlay":return e.createElement(Ur,{value:t});case"background-color-overlay":return e.createElement(Fr,{value:t});case"background-gradient-overlay":return e.createElement(Hr,{value:t});default:return null}},Fr=({value:t})=>{const n=$r(t);return e.createElement("span",null,n)},Ur=({value:t})=>{const{imageTitle:n}=Kr(t);return e.createElement("span",null,n)},Hr=({value:t})=>"linear"===t.value.type.value?e.createElement("span",null,(0,i.__)("Linear Gradient","elementor")):e.createElement("span",null,(0,i.__)("Radial Gradient","elementor")),Wr=({anchorEl:n})=>{const r=b(t.backgroundColorOverlayPropTypeUtil);return e.createElement(d,r,e.createElement(f,{bind:"color"},e.createElement(De,{anchorEl:n})))},Gr=()=>{const n=b(t.backgroundImageOverlayPropTypeUtil);return e.createElement(d,n,e.createElement(f,{bind:"image"},e.createElement(ne,{sizes:_r})),e.createElement(f,{bind:"position"},e.createElement(Cr,null)),e.createElement(f,{bind:"repeat"},e.createElement(Mr,null)),e.createElement(f,{bind:"size"},e.createElement(Ir,null)),e.createElement(f,{bind:"attachment"},e.createElement(kr,null)))},qr=(0,o.styled)(o.UnstableColorIndicator)(({theme:e})=>({height:"1rem",width:"1rem",borderRadius:e.shape.borderRadius/2+"px"})),Kr=e=>{let t,n=null;const r=e?.value.image.value?.src.value,{data:o}=(0,F.useWpMediaAttachment)(r.id?.value||null);if(r.id){const e=Jr(o?.filename);t=`${o?.title}${e}`||null,n=o?.url||null}else r.url&&(n=r.url.value,t=n?.substring(n.lastIndexOf("/")+1)||null);return{imageTitle:t,imageUrl:n}},Jr=e=>e?`.${e.substring(e.lastIndexOf(".")+1)}`:"",Yr=e=>{const t=e.value,n=t.stops.value?.map(({value:{color:e,offset:t}})=>`${e.value} ${t.value??0}%`)?.join(",");return"linear"===t.type.value?`linear-gradient(${t.angle.value}deg, ${n})`:`radial-gradient(circle at ${t.positions.value}, ${n})`},Xr=[{label:(0,i.__)("Full element","elementor"),value:"border-box"},{label:(0,i.__)("Padding edges","elementor"),value:"padding-box"},{label:(0,i.__)("Content edges","elementor"),value:"content-box"},{label:(0,i.__)("Text","elementor"),value:"text"}],Qr=(0,i.__)("Color","elementor"),Zr=(0,i.__)("Clipping","elementor"),eo=D(()=>{const n=b(t.backgroundPropTypeUtil);return e.createElement(d,n,e.createElement(f,{bind:"background-overlay"},e.createElement(Nr,null)),e.createElement(to,null),e.createElement(no,null))}),to=()=>e.createElement(f,{bind:"color"},e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(M,null,Qr)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(De,null)))),no=()=>e.createElement(f,{bind:"clip"},e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(M,null,Zr)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(te,{options:Xr}))));function ro(){return ro=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},ro.apply(null,arguments)}const oo=/\$\{([^}]+)\}/g,io=D(({repeaterLabel:n,childControlConfig:r,showDuplicate:o,showToggle:i,initialValues:s,patternLabel:l,placeholder:a,propKey:c,addItemTooltipProps:u})=>{const{propTypeUtil:p,isItemDisabled:h}=r;if(!p)return null;const f=(0,e.useMemo)(()=>(0,t.createArrayPropUtils)(p.key,p.schema,c),[p.key,p.schema,c]),m=(0,e.useMemo)(()=>({...r,placeholder:a||"",patternLabel:l||""}),[r,a,l]),{propType:g,value:y,setValue:v}=b(f);return e.createElement(d,{propType:g,value:y,setValue:v},e.createElement(Qe.Provider,{value:m},e.createElement(dt,{initial:p.create(s||null),propTypeUtil:f,isItemDisabled:h},e.createElement(Ct,{label:n},e.createElement(Ue,ro({},u,{newItemIndex:0,ariaLabel:n}))),e.createElement(Xe,{isSortable:!1},e.createElement(ut,{Icon:so,Label:uo,actions:e.createElement(e.Fragment,null,o&&e.createElement(mt,null),i&&e.createElement(ht,null),e.createElement(yt,null))})),e.createElement(Et,null,e.createElement(lo,null)))))}),so=()=>e.createElement(e.Fragment,null),lo=()=>{const{component:t,props:n={}}=Ze();return e.createElement(kt,{p:1.5},e.createElement(St,null,e.createElement(t,n)))},ao=(e,t)=>{let n={};const r=t.split("."),o=r.slice(-1)[0];let i=r.reduce((e,t,o)=>(o===r.length-2&&(n=e),e&&"object"==typeof e?e[t]:{}),e);i=i||"";const s=n?.$$type,l=n?.value;return"unit"===o&&"size"===s&&"custom"===l?.unit?l?.size?"":Te:i},co=e=>"string"==typeof e?""===e.trim():!!Number.isNaN(e)||(Array.isArray(e)?0===e.length:"object"==typeof e&&null!==e&&0===Object.keys(e).length),uo=({value:t})=>{const{placeholder:n,patternLabel:r,props:i}=Ze(),s=((e,t)=>{const n=po(e).map(e=>ao(t,e));return!(0===n.length||!n.some(e=>null==e)&&!n.every(co))})(r,t),l=s?n:(a=r,(c=t)?a.replace(oo,(e,t)=>{const n=ao(c,t);return"object"!=typeof n||null===n||Array.isArray(n)?Array.isArray(n)?n.join(", "):String(n??""):"name"in n&&n.name?n.name:JSON.stringify(n)}):a);var a,c;const u=((e,t)=>e?"text.disabled":t?"text.tertiary":"text.primary")(!!i?.readOnly,s);return e.createElement(o.Box,{component:"span",color:u},l)},po=e=>e.match(oo)?.map(e=>e.slice(2,-1))||[],ho=e=>{const t={"&":"&","<":"<",">":">","'":"'",'"':"""};return e.replace(/[&<>'"]/g,e=>t[e]||e)};function fo(){return fo=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},fo.apply(null,arguments)}const mo=e=>{const t=e;return e&&"object"==typeof e&&"dynamic"!==t.$$type&&t.value||""},go=D((n={})=>{const{value:r,setValue:s,...l}=b(t.keyValuePropTypeUtil),[a,c]=(0,e.useState)(""),[u,p]=(0,e.useState)(""),[h,m]=(0,e.useState)({key:mo(r?.key),value:mo(r?.value)}),g=n.keyName||(0,i.__)("Key","elementor"),y=n.valueName||(0,i.__)("Value","elementor"),{keyHelper:v,valueHelper:w}=n.getHelperText?.(h.key,h.value)||{keyHelper:void 0,valueHelper:void 0},[E,x,k]=(0,e.useMemo)(()=>[n.regexKey?new RegExp(n.regexKey):void 0,n.regexValue?new RegExp(n.regexValue):void 0,n.validationErrorMessage||(0,i.__)("Invalid Format","elementor")],[n.regexKey,n.regexValue,n.validationErrorMessage]);return e.createElement(d,fo({},l,{value:r,setValue:(e,n,o)=>{const i=o?.bind;if(!i)return;const l=e[i];if((0,t.isTransformable)(l)&&"dynamic"===l.$$type)return void s({...r,[i]:l});const a=t.stringPropTypeUtil.extract(l);m(e=>({...e,[i]:a})),a&&((e,t)=>{if("key"===t&&E){const t=E.test(e);return c(t?"":k),t}if("value"===t&&x){const t=x.test(e);return p(t?"":k),t}return!0})(a,i)?s({...r,[i]:l}):s({...r,[i]:{value:"",$$type:"string"}})}}),e.createElement(o.Grid,{container:!0,gap:1.5},e.createElement(o.Grid,{item:!0,xs:12,display:"flex",flexDirection:"column"},e.createElement(o.FormLabel,{size:"tiny",sx:{pb:1}},g),e.createElement(f,{bind:"key"},e.createElement(ie,{inputValue:n.escapeHtml?ho(h.key):h.key,error:!!a,helperText:v})),!!a&&e.createElement(o.FormHelperText,{error:!0},a)),e.createElement(o.Grid,{item:!0,xs:12,display:"flex",flexDirection:"column"},e.createElement(o.FormLabel,{size:"tiny",sx:{pb:1}},y),e.createElement(f,{bind:"value"},e.createElement(ie,{inputValue:n.escapeHtml?ho(h.value):h.value,error:!!u,inputDisabled:!!a,helperText:w})),!!u&&e.createElement(o.FormHelperText,{error:!0},u))))}),yo=[{label:(0,i.__)("Center center","elementor"),value:"center center"},{label:(0,i.__)("Center left","elementor"),value:"center left"},{label:(0,i.__)("Center right","elementor"),value:"center right"},{label:(0,i.__)("Top center","elementor"),value:"top center"},{label:(0,i.__)("Top left","elementor"),value:"top left"},{label:(0,i.__)("Top right","elementor"),value:"top right"},{label:(0,i.__)("Bottom center","elementor"),value:"bottom center"},{label:(0,i.__)("Bottom left","elementor"),value:"bottom left"},{label:(0,i.__)("Bottom right","elementor"),value:"bottom right"},{label:(0,i.__)("Custom","elementor"),value:"custom"}],bo=()=>{const n=b(t.positionPropTypeUtil),r=b(t.stringPropTypeUtil),s=!!n.value;return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(o.Grid,{item:!0,xs:12},e.createElement(o.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,(0,i.__)("Object position","elementor"))),e.createElement(o.Grid,{item:!0,xs:6,sx:{overflow:"hidden"}},e.createElement(o.Select,{size:"tiny",disabled:r.disabled,value:(n.value?"custom":r.value)??"",onChange:e=>{const t=e.target.value||null;"custom"===t?n.setValue({x:null,y:null}):r.setValue(t)},fullWidth:!0},yo.map(({label:t,value:n})=>e.createElement(Q.MenuListItem,{key:n,value:n??""},t)))))),s&&e.createElement(d,n,e.createElement(o.Grid,{item:!0,xs:12},e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"x"},e.createElement(Me,{startIcon:e.createElement(j.LetterXIcon,{fontSize:"tiny"}),min:-Number.MAX_SAFE_INTEGER}))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"y"},e.createElement(Me,{startIcon:e.createElement(j.LetterYIcon,{fontSize:"tiny"}),min:-Number.MAX_SAFE_INTEGER})))))))},vo=()=>{const{element:t}=(0,On.useSelectedElement)(),n=t?.id||"";return(0,e.useMemo)(()=>{const e=(0,On.getContainer)(n);return!!e&&"widget"!==e.model.get("elType")},[n])},wo="transform-move",Eo="transform-scale",xo="transform-rotate",ko="transform-skew",So={move:{size:0,unit:"px"},scale:1,rotate:{size:0,unit:"deg"},skew:{size:0,unit:"deg"}},Co={$$type:wo,value:{x:{$$type:"size",value:{size:So.move.size,unit:So.move.unit}},y:{$$type:"size",value:{size:So.move.size,unit:So.move.unit}},z:{$$type:"size",value:{size:So.move.size,unit:So.move.unit}}}},To=t.scaleTransformPropTypeUtil.create({x:t.numberPropTypeUtil.create(So.scale),y:t.numberPropTypeUtil.create(So.scale),z:t.numberPropTypeUtil.create(So.scale)}),Mo=t.rotateTransformPropTypeUtil.create({x:{$$type:"size",value:{size:So.rotate.size,unit:So.rotate.unit}},y:{$$type:"size",value:{size:So.rotate.size,unit:So.rotate.unit}},z:{$$type:"size",value:{size:So.rotate.size,unit:So.rotate.unit}}}),Oo=t.skewTransformPropTypeUtil.create({x:{$$type:"size",value:{size:So.skew.size,unit:So.skew.unit}},y:{$$type:"size",value:{size:So.skew.size,unit:So.skew.unit}}}),Io=({label:t,bind:n,startIcon:r,anchorRef:i,units:s,variant:l="angle"})=>{const a=t.replace(/\s+/g,"-").toLowerCase();return e.createElement(o.Grid,{item:!0,xs:12},e.createElement(St,{ref:i},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(M,{htmlFor:a},t)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:n},e.createElement(Me,{anchorRef:i,startIcon:r,units:s,variant:l,min:-Number.MAX_SAFE_INTEGER,id:a})))))};function Po(){return Po=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},Po.apply(null,arguments)}const Ao=[{label:(0,i.__)("Move X","elementor"),bind:"x",startIcon:e.createElement(j.ArrowRightIcon,{fontSize:"tiny"}),units:["px","%","em","rem","vw"]},{label:(0,i.__)("Move Y","elementor"),bind:"y",startIcon:e.createElement(j.ArrowDownSmallIcon,{fontSize:"tiny"}),units:["px","%","em","rem","vh"]},{label:(0,i.__)("Move Z","elementor"),bind:"z",startIcon:e.createElement(j.ArrowDownLeftIcon,{fontSize:"tiny"}),units:["px","%","em","rem","vw","vh"]}],Do=()=>{const n=b(t.moveTransformPropTypeUtil),r=[(0,e.useRef)(null),(0,e.useRef)(null),(0,e.useRef)(null)];return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(d,n,e.createElement(f,{bind:wo},Ao.map((t,n)=>e.createElement(Io,Po({key:t.bind},t,{anchorRef:r[n],units:t.units,variant:"length"}))))))};function _o(){return _o=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},_o.apply(null,arguments)}const No=[{label:(0,i.__)("Rotate X","elementor"),bind:"x",startIcon:e.createElement(j.Arrow360Icon,{fontSize:"tiny"})},{label:(0,i.__)("Rotate Y","elementor"),bind:"y",startIcon:e.createElement(j.Arrow360Icon,{fontSize:"tiny",style:{transform:"scaleX(-1) rotate(-90deg)"}})},{label:(0,i.__)("Rotate Z","elementor"),bind:"z",startIcon:e.createElement(j.RotateClockwiseIcon,{fontSize:"tiny"})}],Ro=["deg","rad","grad","turn"],zo=()=>{const n=b(t.rotateTransformPropTypeUtil),r=[(0,e.useRef)(null),(0,e.useRef)(null),(0,e.useRef)(null)];return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(d,n,e.createElement(f,{bind:xo},No.map((t,n)=>e.createElement(Io,_o({key:t.bind},t,{anchorRef:r[n],units:Ro}))))))},$o=({label:t,bind:n,startIcon:r,anchorRef:i})=>e.createElement(o.Grid,{item:!0,xs:12},e.createElement(St,{ref:i},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(M,null,t)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:n},e.createElement(fn,{step:.1,placeholder:"1",startIcon:r})))));function Lo(){return Lo=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},Lo.apply(null,arguments)}const Bo=[{label:(0,i.__)("Scale X","elementor"),bind:"x",startIcon:e.createElement(j.ArrowRightIcon,{fontSize:"tiny"})},{label:(0,i.__)("Scale Y","elementor"),bind:"y",startIcon:e.createElement(j.ArrowDownSmallIcon,{fontSize:"tiny"})},{label:(0,i.__)("Scale Z","elementor"),bind:"z",startIcon:e.createElement(j.ArrowDownLeftIcon,{fontSize:"tiny"})}],Vo=()=>{const n=b(t.scaleTransformPropTypeUtil),r=[(0,e.useRef)(null),(0,e.useRef)(null),(0,e.useRef)(null)];return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(d,n,e.createElement(f,{bind:Eo},Bo.map((t,n)=>e.createElement($o,Lo({key:t.bind},t,{anchorRef:r[n]}))))))};function jo(){return jo=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},jo.apply(null,arguments)}const Fo=[{label:(0,i.__)("Skew X","elementor"),bind:"x",startIcon:e.createElement(j.ArrowRightIcon,{fontSize:"tiny"})},{label:(0,i.__)("Skew Y","elementor"),bind:"y",startIcon:e.createElement(j.ArrowLeftIcon,{fontSize:"tiny",style:{transform:"scaleX(-1) rotate(-90deg)"}})}],Uo=["deg","rad","grad","turn"],Ho=()=>{const n=b(t.skewTransformPropTypeUtil),r=[(0,e.useRef)(null),(0,e.useRef)(null),(0,e.useRef)(null)];return e.createElement(o.Grid,{container:!0,spacing:1.5},e.createElement(d,n,e.createElement(f,{bind:ko},Fo.map((t,n)=>e.createElement(Io,jo({key:t.bind},t,{anchorRef:r[n],units:Uo}))))))};function Wo(){return Wo=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},Wo.apply(null,arguments)}const Go=()=>{const{getTabsProps:n,getTabProps:r,getTabPanelProps:s}=(({move:n,scale:r,rotate:i,skew:s})=>{const{value:l,setValue:a}=b(t.moveTransformPropTypeUtil),{value:c,setValue:u}=b(t.scaleTransformPropTypeUtil),{value:d,setValue:p}=b(t.rotateTransformPropTypeUtil),{value:h,setValue:f}=b(t.skewTransformPropTypeUtil),{openItemIndex:m,items:g}=Be(),{getTabsProps:y,getTabProps:v,getTabPanelProps:w}=(0,o.useTabs)((()=>{switch(!0){case!!c:return Eo;case!!d:return xo;case!!h:return ko;default:return wo}})()),E=(0,e.useRef)({move:n,scale:r,rotate:i,skew:s}),x=(e,t)=>{t&&(E.current[e]=t)},k=(e,t)=>{switch(t){case wo:a(E.current.move),x("scale",c),x("rotate",d),x("skew",h);break;case Eo:u(E.current.scale),x("move",l),x("rotate",d),x("skew",h);break;case xo:p(E.current.rotate),x("move",l),x("scale",c),x("skew",h);break;case ko:f(E.current.skew),x("move",l),x("scale",c),x("rotate",d)}return y().onChange(e,t)};return{getTabProps:e=>{return{...v(e),disabled:(t=e,!!g.find(({item:{$$type:e}},n)=>t===e&&n!==m))};var t},getTabPanelProps:w,getTabsProps:()=>({...y(),onChange:k})}})({move:Co.value,scale:To.value,rotate:Mo.value,skew:Oo.value});return e.createElement(kt,null,e.createElement(o.Box,{sx:{width:"100%"}},e.createElement(o.Box,{sx:{borderBottom:1,borderColor:"divider"}},e.createElement(o.Tabs,Wo({size:"small",variant:"fullWidth",sx:{"& .MuiTab-root":{minWidth:"62px"}}},n(),{"aria-label":(0,i.__)("Transform","elementor")}),e.createElement(o.Tab,Wo({label:(0,i.__)("Move","elementor")},r(wo))),e.createElement(o.Tab,Wo({label:(0,i.__)("Scale","elementor")},r(Eo))),e.createElement(o.Tab,Wo({label:(0,i.__)("Rotate","elementor")},r(xo))),e.createElement(o.Tab,Wo({label:(0,i.__)("Skew","elementor")},r(ko))))),e.createElement(o.TabPanel,Wo({sx:{p:1.5}},s(wo)),e.createElement(Do,null)),e.createElement(o.TabPanel,Wo({sx:{p:1.5}},s(Eo)),e.createElement(Vo,null)),e.createElement(o.TabPanel,Wo({sx:{p:1.5}},s(xo)),e.createElement(zo,null)),e.createElement(o.TabPanel,Wo({sx:{p:1.5}},s(ko)),e.createElement(Ho,null))))},qo=({value:t})=>{switch(t.$$type){case wo:return e.createElement(j.ArrowsMaximizeIcon,{fontSize:"tiny"});case Eo:return e.createElement(j.ArrowAutofitHeightIcon,{fontSize:"tiny"});case xo:return e.createElement(j.RotateClockwise2Icon,{fontSize:"tiny"});case ko:return e.createElement(j.SkewXIcon,{fontSize:"tiny"});default:return null}},Ko=["x","y","z"],Jo=(e,t)=>Ko.map(n=>{const r=e[n];if("scale"===t)return r?.value||So[t];const o=So[t],i=r?.value?.size??o.size,s=r?.value?.unit??o.unit;return"custom"===s?i||Te:`${i}${s}`}).join(", "),Yo=t=>{const{$$type:n,value:r}=t.value;switch(n){case wo:return e.createElement(Xo,{label:(0,i.__)("Move","elementor"),value:Jo(r,"move")});case Eo:return e.createElement(Xo,{label:(0,i.__)("Scale","elementor"),value:Jo(r,"scale")});case xo:return e.createElement(Xo,{label:(0,i.__)("Rotate","elementor"),value:Jo(r,"rotate")});case ko:return e.createElement(Xo,{label:(0,i.__)("Skew","elementor"),value:Jo(r,"skew")});default:return""}},Xo=({label:t,value:n})=>e.createElement(o.Box,{component:"span"},t,": ",n),Qo=["px","%","em","rem"],Zo={label:(0,i.__)("Perspective","elementor"),bind:"perspective",units:["px","em","rem","vw","vh"]},ei=[{label:(0,i.__)("Origin X","elementor"),bind:"x",units:Qo},{label:(0,i.__)("Origin Y","elementor"),bind:"y",units:Qo}],ti=()=>e.createElement(o.Stack,{direction:"column",spacing:1.5},e.createElement(x,null,(0,i.__)("Children perspective","elementor")),e.createElement(ni,null),e.createElement(ri,null)),ni=()=>e.createElement(f,{bind:"perspective"},e.createElement(ii,{control:Zo,key:Zo.bind})),ri=()=>e.createElement(f,{bind:"perspective-origin"},e.createElement(oi,null)),oi=()=>{const n=b(t.perspectiveOriginPropTypeUtil);return e.createElement(d,n,ei.map(t=>e.createElement(f,{bind:t.bind,key:t.bind},e.createElement(ii,{control:t}))))},ii=({control:t})=>{const n=e.useRef(null);return e.createElement(St,{ref:n},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,t.label)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(Me,{variant:"length",units:t.units,anchorRef:n,disableCustom:!0})))},si=["px","%","em","rem"],li=si.filter(e=>"%"!==e),ai=[{label:(0,i.__)("Origin X","elementor"),bind:"x",units:si},{label:(0,i.__)("Origin Y","elementor"),bind:"y",units:si},{label:(0,i.__)("Origin Z","elementor"),bind:"z",units:li}],ci=()=>e.createElement(o.Stack,{direction:"column",spacing:1.5},e.createElement(x,null,(0,i.__)("Transform","elementor")),ai.map(t=>e.createElement(ui,{control:t,key:t.bind}))),ui=({control:n})=>{const r=b(t.transformOriginPropTypeUtil),i=e.useRef(null);return e.createElement(d,r,e.createElement(f,{bind:n.bind},e.createElement(St,{ref:i},e.createElement(o.Grid,{item:!0,xs:6},e.createElement(x,null,n.label)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(Me,{variant:"length",units:n.units,anchorRef:i,disableCustom:!0})))))};function di(){return di=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},di.apply(null,arguments)}const pi=({popupState:t,anchorRef:n,showChildrenPerspective:r})=>{const s=(0,o.bindPopover)({...t,anchorEl:n.current??void 0});return e.createElement(o.Popover,di({disablePortal:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{width:(n.current?.offsetWidth||0)-6+"px",mt:.5}}}},s),e.createElement(Q.PopoverHeader,{title:(0,i.__)("Transform settings","elementor"),onClose:t.close,icon:e.createElement(j.AdjustmentsIcon,{fontSize:"tiny"})}),e.createElement(o.Divider,null),e.createElement(kt,{sx:{px:2,py:1.5}},e.createElement(f,{bind:"transform-origin"},e.createElement(ci,null)),r&&e.createElement(e.Fragment,null,e.createElement(o.Box,{sx:{my:.5}},e.createElement(o.Divider,null)),e.createElement(ti,null))))};function hi(){return hi=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},hi.apply(null,arguments)}const fi="tiny",mi=D(()=>{const n=b(t.transformPropTypeUtil),r=(0,e.useRef)(null),i=(0,o.usePopupState)({variant:"popover"}),s=vo();return e.createElement(d,n,e.createElement(pi,{popupState:i,anchorRef:r,showChildrenPerspective:s}),e.createElement(f,{bind:"transform-functions"},e.createElement(yi,{headerRef:r,propType:n.propType,popupState:i})))}),gi=e.createElement(o.Box,{component:"span","aria-label":void 0,sx:{display:"flex",gap:.5,p:2,width:320,borderRadius:1}},e.createElement(j.InfoCircleFilledIcon,{sx:{color:"secondary.main"}}),e.createElement(o.Typography,{variant:"body2",color:"text.secondary",fontSize:"14px"},(0,i.__)("You can use each kind of transform only once per element.","elementor"))),yi=({headerRef:n,propType:r,popupState:o})=>{const s=b(t.transformFunctionsPropTypeUtil),l=[Co,To,Mo,Oo],{value:a,bind:c}=s,u=()=>l.find(e=>!a?.some(t=>t.$$type===e.$$type)),p=!u();return e.createElement(d,s,e.createElement(dt,{initial:u()??Co,propTypeUtil:t.transformFunctionsPropTypeUtil},e.createElement(Ct,{label:(0,i.__)("Transform","elementor"),adornment:()=>e.createElement(T,{customContext:{path:["transform"],propType:r}}),ref:n},e.createElement(bi,{popupState:o,repeaterBindKey:c}),e.createElement(Ue,{disabled:p,tooltipContent:gi,enableTooltip:p,ariaLabel:"transform"})),e.createElement(Xe,null,e.createElement(ut,{Icon:qo,Label:Yo,actions:e.createElement(e.Fragment,null,e.createElement(ht,null),e.createElement(yt,null))})),e.createElement(Et,null,e.createElement(Go,null))))},bi=({popupState:t,repeaterBindKey:n})=>{const{bind:r}=b(),s=(0,i.__)("Transform settings","elementor");return r!==n?null:e.createElement(o.Tooltip,{title:s,placement:"top"},e.createElement(o.IconButton,hi({size:fi,"aria-label":s},(0,o.bindTrigger)(t)),e.createElement(j.AdjustmentsIcon,{fontSize:fi})))},vi=D(({selectionLabel:n,sizeLabel:r,selectionConfig:i,sizeConfigMap:s})=>{const{value:l,setValue:a,propType:c}=b(t.selectionSizePropTypeUtil),u=(0,e.useRef)(null),p=r.replace(/\s+/g,"-").toLowerCase(),h=(0,e.useMemo)(()=>{switch(l.selection.$$type){case"key-value":return s[l?.selection?.value.value.value||""];case"string":return s[l?.selection?.value||""];default:return null}},[l,s]),m=i.component;return e.createElement(d,{value:l,setValue:a,propType:c},e.createElement(o.Grid,{container:!0,spacing:1.5,ref:u},e.createElement(o.Grid,{item:!0,xs:6,sx:{display:"flex",alignItems:"center"}},e.createElement(x,null,n)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"selection"},e.createElement(m,i.props))),h&&e.createElement(e.Fragment,null,e.createElement(o.Grid,{item:!0,xs:6,sx:{display:"flex",alignItems:"center"}},e.createElement(x,{htmlFor:p},r)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(f,{bind:"size"},e.createElement(Me,{anchorRef:u,variant:h.variant,units:h.units,defaultUnit:h.defaultUnit,id:p}))))))}),wi={selection:{$$type:"key-value",value:{key:{value:(0,i.__)("All properties","elementor"),$$type:"string"},value:{value:"all",$$type:"string"}}},size:{$$type:"size",value:{size:200,unit:"ms"}}},Ei=(()=>{const e=!!window.elementorFrontend?.config?.is_rtl,t=[{label:(0,i.__)("Default","elementor"),type:"category",properties:[{label:(0,i.__)("All properties","elementor"),value:"all"}]},{label:(0,i.__)("Margin","elementor"),type:"category",properties:[{label:(0,i.__)("Margin (all)","elementor"),value:"margin",isDisabled:!0},{label:(0,i.__)("Margin bottom","elementor"),value:"margin-block-end",isDisabled:!0},{label:e?(0,i.__)("Margin right","elementor"):(0,i.__)("Margin left","elementor"),value:"margin-inline-start",isDisabled:!0},{label:e?(0,i.__)("Margin left","elementor"):(0,i.__)("Margin right","elementor"),value:"margin-inline-end",isDisabled:!0},{label:(0,i.__)("Margin top","elementor"),value:"margin-block-start",isDisabled:!0}]},{label:(0,i.__)("Padding","elementor"),type:"category",properties:[{label:(0,i.__)("Padding (all)","elementor"),value:"padding",isDisabled:!0},{label:(0,i.__)("Padding bottom","elementor"),value:"padding-block-end",isDisabled:!0},{label:e?(0,i.__)("Padding right","elementor"):(0,i.__)("Padding left","elementor"),value:"padding-inline-start",isDisabled:!0},{label:e?(0,i.__)("Padding left","elementor"):(0,i.__)("Padding right","elementor"),value:"padding-inline-end",isDisabled:!0},{label:(0,i.__)("Padding top","elementor"),value:"padding-block-start",isDisabled:!0}]},{label:(0,i.__)("Flex","elementor"),type:"category",properties:[{label:(0,i.__)("Flex (all)","elementor"),value:"flex",isDisabled:!0},{label:(0,i.__)("Flex grow","elementor"),value:"flex-grow",isDisabled:!0},{label:(0,i.__)("Flex shrink","elementor"),value:"flex-shrink",isDisabled:!0},{label:(0,i.__)("Flex basis","elementor"),value:"flex-basis",isDisabled:!0}]},{label:(0,i.__)("Size","elementor"),type:"category",properties:[{label:(0,i.__)("Width","elementor"),value:"width",isDisabled:!0},{label:(0,i.__)("Height","elementor"),value:"height",isDisabled:!0},{label:(0,i.__)("Max height","elementor"),value:"max-height",isDisabled:!0},{label:(0,i.__)("Max width","elementor"),value:"max-width",isDisabled:!0},{label:(0,i.__)("Min height","elementor"),value:"min-height",isDisabled:!0},{label:(0,i.__)("Min width","elementor"),value:"min-width",isDisabled:!0}]},{label:(0,i.__)("Position","elementor"),type:"category",properties:[{label:(0,i.__)("Top","elementor"),value:"inset-block-start",isDisabled:!0},{label:e?(0,i.__)("Right","elementor"):(0,i.__)("Left","elementor"),value:"inset-inline-start",isDisabled:!0},{label:e?(0,i.__)("Left","elementor"):(0,i.__)("Right","elementor"),value:"inset-inline-end",isDisabled:!0},{label:(0,i.__)("Bottom","elementor"),value:"inset-block-end",isDisabled:!0},{label:(0,i.__)("Z-index","elementor"),value:"z-index",isDisabled:!0}]},{label:(0,i.__)("Typography","elementor"),type:"category",properties:[{label:(0,i.__)("Font color","elementor"),value:"color",isDisabled:!0},{label:(0,i.__)("Font size","elementor"),value:"font-size",isDisabled:!0},{label:(0,i.__)("Line height","elementor"),value:"line-height",isDisabled:!0},{label:(0,i.__)("Letter spacing","elementor"),value:"letter-spacing",isDisabled:!0},{label:(0,i.__)("Word spacing","elementor"),value:"word-spacing",isDisabled:!0},{label:(0,i.__)("Font variations","elementor"),value:"font-variation-settings",isDisabled:!0},{label:(0,i.__)("Text stroke color","elementor"),value:"-webkit-text-stroke-color",isDisabled:!0}]},{label:(0,i.__)("Background","elementor"),type:"category",properties:[{label:(0,i.__)("Background color","elementor"),value:"background-color",isDisabled:!0},{label:(0,i.__)("Background position","elementor"),value:"background-position",isDisabled:!0},{label:(0,i.__)("Box shadow","elementor"),value:"box-shadow",isDisabled:!0}]},{label:(0,i.__)("Border","elementor"),type:"category",properties:[{label:(0,i.__)("Border (all)","elementor"),value:"border",isDisabled:!0},{label:(0,i.__)("Border radius","elementor"),value:"border-radius",isDisabled:!0},{label:(0,i.__)("Border color","elementor"),value:"border-color",isDisabled:!0},{label:(0,i.__)("Border width","elementor"),value:"border-width",isDisabled:!0}]},{label:(0,i.__)("Effects","elementor"),type:"category",properties:[{label:(0,i.__)("Opacity","elementor"),value:"opacity",isDisabled:!0},{label:(0,i.__)("Transform (all)","elementor"),value:"transform",isDisabled:!0},{label:(0,i.__)("Filter (all)","elementor"),value:"filter",isDisabled:!0}]}];return(()=>{if(!window.elementorPro)return!0;const e=window.elementorPro?.config?.version;return!!e&&(0,s.isVersionGreaterOrEqual)(e,"3.35")})()?t:[t[0]]})(),xi=Ei.map(e=>({label:e.label,items:e.properties.map(e=>e.label)}));var ki=window.elementorV2.mixpanel;const Si={eventName:"click_added_transition",location:"V4 Style Tab",secondaryLocation:"Transition control",trigger:"click"};function Ci(){return Ci=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},Ci.apply(null,arguments)}function Ti(e){if(!e?.value)return null;for(const t of Ei)for(const n of t.properties)if(n.value===e.value)return n;return null}const Mi=(e,t)=>t.filter(t=>t!==e.key.value),Oi=({recentlyUsedList:n=[],disabledItems:r=[],showPromotion:s=!1})=>{const{value:l,setValue:a}=b(t.keyValuePropTypeUtil),{key:{value:c}}=l,u=(0,e.useRef)(null),d=(0,o.usePopupState)({variant:"popover"}),p=(0,e.useMemo)(()=>new Set(Ei.filter(e=>e.properties.some(e=>e.isDisabled)).map(e=>e.label)),[]);return e.createElement(o.Box,{ref:u},e.createElement(Y,null,e.createElement(o.UnstableTag,Ci({variant:"outlined",label:c,endIcon:e.createElement(j.ChevronDownIcon,{fontSize:"tiny"})},(0,o.bindTrigger)(d),{fullWidth:!0}))),e.createElement(o.Popover,Ci({disablePortal:!0,disableScrollLock:!0},(0,o.bindPopover)(d),{anchorReference:"anchorPosition",anchorPosition:(()=>{if(!u.current)return;const e=u.current.getBoundingClientRect();return{top:e.top,left:e.right+36}})(),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"}}),e.createElement(En,{itemsList:(()=>{const e=n.map(e=>Ti({value:e,$$type:"string"})?.label).filter(e=>!!e),t=xi.map(t=>({...t,items:t.items.filter(t=>!e.includes(t))}));if(0===e.length)return t;const[r,...o]=t;return[r,{label:(0,i.__)("Recently Used","elementor"),items:e},...o]})(),selectedItem:c,onItemChange:e=>{const t=(e=>{for(const t of Ei){const n=t.properties.find(t=>t.label===e);if(n)return{key:{value:n.label,$$type:"string"},value:{value:n.value,$$type:"string"}}}return null})(e);t&&(a(t),d.close())},onClose:d.close,sectionWidth:268,title:(0,i.__)("Transition Property","elementor"),icon:j.VariationsIcon,disabledItems:Mi(l,r),categoryItemContentTemplate:t=>e.createElement(o.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"}},e.createElement("span",null,t.value),s&&p.has(t.value)&&e.createElement(Q.PromotionChip,null)),footer:s?e.createElement(o.Alert,{variant:"standard",color:"promotion",icon:!1,role:"dialog","aria-label":"promotion-alert",size:"small",sx:{m:1.5,mt:0}},(0,i.__)("Upgrade to customize transition properties and control effects.","elementor"),e.createElement(o.Box,{component:"a",href:"https://go.elementor.com/go-pro-transitions-modal/",target:"_blank",rel:"noopener noreferrer",sx:{display:"flex",alignItems:"center",gap:.5,color:"promotion.main"}},e.createElement(j.CrownFilledIcon,{fontSize:"tiny"}),(0,i.__)("Upgrade now","elementor"))):null})))},Ii={variant:"time",units:["s","ms"],defaultUnit:"ms"},Pi=(0,t.createArrayPropUtils)(t.selectionSizePropTypeUtil.key,t.selectionSizePropTypeUtil.schema,"transition");ze.subscribe("transition-item-added",e=>{const t=e,n=t?.itemValue?.selection?.value?.value?.value,r=(0,On.getSelectedElements)(),o=r[0]?.type??null;(0,ki.trackEvent)({transition_type:n??"unknown",...Si,widget_type:o})});const Ai=(e,t,n)=>({selectionLabel:(0,i.__)("Type","elementor"),sizeLabel:(0,i.__)("Duration","elementor"),selectionConfig:{component:Oi,props:{recentlyUsedList:e,disabledItems:t,showPromotion:n}},sizeConfigMap:{...Ei.reduce((e,t)=>(t.properties.forEach(t=>{e[t.value]=Ii}),e),{})}}),Di=e=>{const t=Ti(e.value.selection.value?.value);return!!t&&!!t.isDisabled},_i=(e,n,r)=>({propTypeUtil:t.selectionSizePropTypeUtil,component:vi,props:Ai(e,n,r),isItemDisabled:Di}),Ni=(e,t)=>(e??[]).some(e=>e?.value?.selection?.value?.value?.value===t.value),Ri=(e=[])=>{if(!e?.length)return wi;for(const t of Ei)for(const n of t.properties)if(!Ni(e,n))return{...wi,selection:{$$type:"key-value",value:{key:{value:n.label,$$type:"string"},value:{value:n.value,$$type:"string"}}}};return wi},zi=e.createElement(o.Alert,{sx:{width:280,gap:.5},color:"secondary",icon:e.createElement(j.InfoCircleFilledIcon,null)},e.createElement(o.AlertTitle,null,(0,i.__)("Transitions","elementor")),e.createElement(o.Box,{component:"span"},e.createElement(o.Typography,{variant:"body2"},(0,i.__)("Switch to 'Normal' state to add a transition.","elementor")))),$i=D(({recentlyUsedListGetter:t,currentStyleState:n})=>{const r=null===n,[o,s]=(0,e.useState)([]),{value:l,setValue:a}=b(Pi),{allDisabled:c,proDisabled:u}=(0,e.useMemo)(()=>((e=[])=>{const t=(e||[]).map(e=>e.value?.selection?.value?.key?.value),n=[];return Ei.forEach(e=>{const r=e.properties.filter(e=>e.isDisabled&&!t.includes(e.label)).map(e=>e.label);n.push(...r)}),{allDisabled:[...t,...n],proDisabled:n}})(l),[l]),d=(0,e.useMemo)(()=>{const e=new Set;return Ei.forEach(t=>{t.properties.forEach(t=>e.add(t.value))}),e},[]);(0,e.useEffect)(()=>{if(!l||0===l.length)return;const e=l.filter(e=>{const t=e?.value?.selection?.value?.value?.value??"";return d.has(t)});e.length!==l.length&&a(e)},[d]),(0,e.useEffect)(()=>{t().then(s)},[t]);const p=(0,e.useMemo)(()=>((e=[])=>!!e?.length&&Ei.every(t=>t.properties.every(t=>t.isDisabled||!!e?.find(e=>e.value?.selection?.value?.value?.value===t.value))))(l),[l]),h=!r||p;return e.createElement(io,{label:(0,i.__)("Transitions","elementor"),repeaterLabel:(0,i.__)("Transitions","elementor"),patternLabel:"${value.selection.value.key.value}: ${value.size.value.size}${value.size.value.unit}",placeholder:(0,i.__)("Empty Transition","elementor"),showDuplicate:!1,showToggle:!0,initialValues:Ri(l),childControlConfig:_i(o,c,u.length>0),propKey:"transition",addItemTooltipProps:{disabled:h,enableTooltip:!r,tooltipContent:zi}})});var Li=n(9091),Bi=n.n(Li);function Vi(){return Vi=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},Vi.apply(null,arguments)}const ji=D(({inputDisabled:n})=>{const{value:r,setValue:i,...s}=b(t.DateTimePropTypeUtil),l=(e,n)=>{const o=n.bind,s=e[o];if((0,t.isTransformable)(s))return i({...r,[o]:s});let l="";if(s){const e=s;l="date"===o?e.format("YYYY-MM-DD"):e.format("HH:mm")}i({...r,[o]:{$$type:"string",value:l}})};return e.createElement(d,Vi({},s,{value:r,setValue:i}),e.createElement(Y,null,e.createElement(o.LocalizationProvider,null,e.createElement(o.Box,{display:"flex",gap:1,alignItems:"center"},e.createElement(f,{bind:"date"},e.createElement(o.DatePicker,{value:(e=>{if(!e)return null;const t=Bi()(e);return t&&"function"==typeof t.isValid&&t.isValid()?t:null})(t.stringPropTypeUtil.extract(r?.date)),onChange:e=>l({date:e},{bind:"date"}),disabled:n,slotProps:{textField:{size:"tiny"},openPickerButton:{size:"tiny"},openPickerIcon:{fontSize:"tiny"}}})),e.createElement(f,{bind:"time"},e.createElement(o.TimePicker,{value:(e=>{if(!e)return null;const[t,n]=e.split(":"),r=Number.parseInt(t??"",10),o=Number.parseInt(n??"",10);return Number.isNaN(r)||Number.isNaN(o)?null:Bi()().hour(r).minute(o).second(0).millisecond(0)})(t.stringPropTypeUtil.extract(r?.time)),onChange:e=>l({time:e},{bind:"time"}),disabled:n,slotProps:{textField:{size:"tiny"},openPickerButton:{size:"tiny"},openPickerIcon:{fontSize:"tiny"}}}))))))});function Fi(e){this.content=e}Fi.prototype={constructor:Fi,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 Fi(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 Fi(n)},addToStart:function(e,t){return new Fi([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Fi(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 Fi(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=Fi.from(e)).size?new Fi(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Fi.from(e)).size?new Fi(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Fi.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}},Fi.from=function(e){if(e instanceof Fi)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Fi(t)};var Ui=Fi;function Hi(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=Hi(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Wi(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),l=t.child(--i),a=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let e=0,t=Math.min(s.text.length,l.text.length);for(;e<t&&s.text[s.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let e=Wi(s.content,l.content,n-1,r-1);if(e)return e}n-=a,r-=a}else n-=a,r-=a}}class Gi{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,o||null,i)&&l.content.size){let o=s+1;l.nodesBetween(Math.max(0,e-o),Math.min(l.content.size,t-o),n,r+o)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=a},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 Gi(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],l=i+s.nodeSize;l>e&&((i<e||l>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=l}return new Gi(n,r)}cutByIndex(e,t){return e==t?Gi.empty:0==e&&t==this.content.length?this:new Gi(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 Gi(r,o)}addToStart(e){return new Gi([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Gi(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 Hi(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Wi(this,e,t,n)}findIndex(e){if(0==e)return Ki(0,e);if(e==this.size)return Ki(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?Ki(t+1,r):Ki(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 Gi.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Gi(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Gi.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 Gi(t||e,n)}static from(e){if(!e)return Gi.empty;if(e instanceof Gi)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Gi([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Gi.empty=new Gi([],0);const qi={index:0,offset:0};function Ki(e,t){return qi.index=e,qi.offset=t,qi}function Ji(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(!Ji(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Ji(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class Yi{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&&Ji(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(e){if(!e||Array.isArray(e)&&0==e.length)return Yi.none;if(e instanceof Yi)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}Yi.none=[];class Xi extends Error{}class Qi{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=es(this.content,e+this.openStart,t);return n&&new Qi(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Qi(Zi(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 Qi.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 Qi(Gi.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new Qi(e,n,r)}}function Zi(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:l}=e.findIndex(n);if(o==t||i.isText){if(l!=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(Zi(i.content,t-o-1,n-o-1)))}function es(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 l=es(s.content,t-i-1,n,s);return l&&e.replaceChild(o,s.copy(l))}function ts(e,t,n){if(n.openStart>e.depth)throw new Xi("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Xi("Inconsistent open depths");return ns(e,t,n,0)}function ns(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=ns(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 e=n-1;e>=0;e--)r=t.node(e).copy(Gi.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return as(i,cs(e,o,s,t,r))}{let r=e.parent,o=r.content;return as(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return as(i,us(e,t,r))}function rs(e,t){if(!t.type.compatibleContent(e.type))throw new Xi("Cannot join "+t.type.name+" onto "+e.type.name)}function is(e,t,n){let r=e.node(n);return rs(r,t.node(n)),r}function ss(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 ls(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&&(ss(e.nodeAfter,r),i++));for(let e=i;e<s;e++)ss(o.child(e),r);t&&t.depth==n&&t.textOffset&&ss(t.nodeBefore,r)}function as(e,t){return e.type.checkContent(t),e.copy(t)}function cs(e,t,n,r,o){let i=e.depth>o&&is(e,t,o+1),s=r.depth>o&&is(n,r,o+1),l=[];return ls(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(rs(i,s),ss(as(i,cs(e,t,n,r,o+1)),l)):(i&&ss(as(i,us(e,t,o+1)),l),ls(t,n,o,l),s&&ss(as(s,us(n,r,o+1)),l)),ls(r,null,o,l),new Gi(l)}function us(e,t,n){let r=[];return ls(null,e,n,r),e.depth>n&&ss(as(is(e,t,n+1),us(e,t,n+1)),r),ls(t,null,n,r),new Gi(r)}Qi.empty=new Qi(Gi.empty,0,0);class ds{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 t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Yi.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 ms(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 t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new ds(t,n,o)}static resolveCached(e,t){let n=fs.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else fs.set(e,n=new ps);let r=n.elts[n.i]=ds.resolve(e,t);return n.i=(n.i+1)%hs,r}}class ps{constructor(){this.elts=[],this.i=0}}const hs=12,fs=new WeakMap;class ms{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 gs=Object.create(null);class ys{constructor(e,t,n,r=Yi.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Gi.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&&Ji(this.attrs,t||e.defaultAttrs||gs)&&Yi.sameSet(this.marks,n||Yi.none)}copy(e=null){return e==this.content?this:new ys(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ys(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 Qi.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),l=r.node(i).content.cut(r.pos-s,o.pos-s);return new Qi(l,r.depth-i,o.depth-i)}replace(e,t,n){return ts(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 ds.resolveCached(this,e)}resolveNoCache(e){return ds.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()+")"),vs(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=Gi.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 e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).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=Yi.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(!Yi.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=Gi.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}ys.prototype.text=void 0;class bs extends ys{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):vs(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 bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(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 vs(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ws{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Es(e,t);if(null==n.next)return ws.empty;let r=xs(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return 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]);Os(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new ws(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Ms);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(Os(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,i)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(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)}}(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 l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return Gi.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 t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+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 n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}ws.empty=new ws(!0);class Es{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 xs(e){let t=[];do{t.push(ks(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function ks(e){let t=[];do{t.push(Ss(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Ss(e){let t=function(e){if(e.eat("(")){let t=xs(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 e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),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=Ts(e,t)}return t}function Cs(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ts(e,t){let n=Cs(e),r=n;return e.eat(",")&&(r="}"!=e.next?Cs(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Ms(e,t){return t-e}function Os(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(Ms)}function Is(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 Ps(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 As(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Ds(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ns(e,r,t[r]);return n}class _s{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=Ds(e,n.attrs),this.defaultAttrs=Is(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==ws.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:Ps(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ys(this,this.computeAttrs(e),Gi.from(t),Yi.setFrom(n))}createChecked(e=null,t,n){return t=Gi.from(t),this.checkContent(t),new ys(this,this.computeAttrs(e),t,Yi.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Gi.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(Gi.empty,!0);return o?new ys(this,e,t.append(o),Yi.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).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){As(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:Yi.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new _s(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class Ns{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 Rs{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ds(e,r.attrs),this.excluded=null;let o=Is(this.attrs);this.instance=o?new Yi(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Yi(this,Ps(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new Rs(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){As(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class zs{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Ui.from(e.nodes),t.marks=Ui.from(e.marks||{}),this.nodes=_s.compile(this.spec.nodes,this),this.marks=Rs.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=ws.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?$s(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:$s(this,n.split(" "))}this.nodeFromJSON=e=>ys.fromJSON(this,e),this.markFromJSON=e=>Yi.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 _s))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 bs(n,n.defaultAttrs,e,Yi.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 $s(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 Ls{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 Hs(this,t,!1);return n.addAll(e,Yi.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Hs(this,t,!0);return n.addAll(e,Yi.none,t.from,t.to),Qi.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(Ws(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 t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Gs(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Gs(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ls(e,Ls.schemaRules(e)))}}const Bs={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},Vs={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},js={ol:!0,ul:!0};function Fs(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Us{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=Yi.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Gi.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=Gi.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Gi.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&&!Bs.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Hs{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=Fs(null,t.preserveWhitespace,0)|(n?4:0);r=o?new Us(o.type,o.attrs,Yi.none,!0,t.topMatch||o.type.contentMatch,i):new Us(n?null:e.schema.topNodeType,null,Yi.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();js.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&&js.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Vs.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(Bs.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=l&&l.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,l,n,!1===l.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 e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}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 t=this.open,i=0;t>=0;t--){let s=this.nodes[t],l=s.findWrapping(e);if(l&&(!r||r.length>l.length+i)&&(r=l,o=s,!l.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],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=Yi.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):qs(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=Fs(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let l=Yi.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):qs(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new Us(e,t,l,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++)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 l=t[e];if(""==l){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!=l&&!e.isInGroup(l))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 e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Ws(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Gs(e){let t={};for(let n in e)t[n]=e[n];return t}function qs(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 Ks{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Ys(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}=Qs(Ys(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&&Qs(Ys(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Qs(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ks(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Js(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Js(e.marks)}}function Js(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ys(e){return e.document||window.document}const Xs=new WeakMap;function Qs(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=function(e){let t=Xs.get(e);return void 0===t&&Xs.set(e,t=function(e){let t=null;return function e(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(let t=0;t<n.length;t++)e(n[t]);else for(let t in n)e(n[t])}(e),t}(e)),t}(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,l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let a=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?a.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&a.style?a.style.cssText=c[e]:a.setAttribute(e,c[e])}}for(let o=u;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}{let{dom:t,contentDOM:o}=Qs(e,i,n,r);if(a.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:a,contentDOM:s}}const Zs=Math.pow(2,16);function el(e,t){return e+t*Zs}function tl(e){return 65535&e}class nl{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 rl{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&rl.empty)return rl.empty}recover(e){let t=0,n=tl(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Zs}(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 l=this.ranges[s]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[s+o],c=this.ranges[s+i],u=l+a;if(e<=u){let o=l+r+((a?e==l?-1:e==u?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?l:u)?null:el(s/3,e-l),d=e==l?2:e==u?1:4;return(t<0?e!=l:e!=u)&&(d|=8),new nl(o,d,i)}r+=c-a}return n?e+r:new nl(e+r,0,null)}touches(e,t){let n=0,r=tl(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[t+o];if(e<=s+l&&t==3*r)return!0;n+=this.ranges[t+i]-l}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),l=i+(this.inverted?0:o),a=this.ranges[r+t],c=this.ranges[r+n];e(s,s+a,l,l+c),o+=c-a}}invert(){return new rl(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?rl.empty:new rl(e<0?[0,-e,0]:[0,0,e])}}rl.empty=new rl([]);class ol{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 ol(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 ol;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 n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new nl(e,r,null)}}const il=Object.create(null);class sl{getMap(){return rl.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=il[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 il)throw new RangeError("Duplicate use of step JSON ID "+e);return il[e]=t,t.prototype.jsonID=e,t}}class ll{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ll(e,null)}static fail(e){return new ll(null,e)}static fromReplace(e,t,n,r){try{return ll.ok(e.replace(t,n,r))}catch(e){if(e instanceof Xi)return ll.fail(e.message);throw e}}}function al(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(al(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Gi.fromArray(r)}class cl extends sl{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 Qi(al(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 ll.fromReplace(e,this.from,this.to,o)}invert(){return new ul(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 cl(t.pos,n.pos,this.mark)}merge(e){return e instanceof cl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new cl(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 cl(t.from,t.to,e.markFromJSON(t.mark))}}sl.jsonID("addMark",cl);class ul extends sl{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 Qi(al(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ll.fromReplace(e,this.from,this.to,n)}invert(){return new cl(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 ul(t.pos,n.pos,this.mark)}merge(e){return e instanceof ul&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ul(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 ul(t.from,t.to,e.markFromJSON(t.mark))}}sl.jsonID("removeMark",ul);class dl extends sl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ll.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ll.fromReplace(e,this.pos,this.pos+1,new Qi(Gi.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 dl(this.pos,t.marks[n]);return new dl(this.pos,this.mark)}}return new pl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new dl(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 dl(t.pos,e.markFromJSON(t.mark))}}sl.jsonID("addNodeMark",dl);class pl extends sl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ll.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ll.fromReplace(e,this.pos,this.pos+1,new Qi(Gi.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new dl(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new pl(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 pl(t.pos,e.markFromJSON(t.mark))}}sl.jsonID("removeNodeMark",pl);class hl extends sl{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&ml(e,this.from,this.to)?ll.fail("Structure replace would overwrite content"):ll.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new rl([this.from,this.to-this.from,this.slice.size])}invert(e){return new hl(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 hl(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof hl)||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?Qi.empty:new Qi(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new hl(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Qi.empty:new Qi(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new hl(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 hl(t.from,t.to,Qi.fromJSON(e,t.slice),!!t.structure)}}sl.jsonID("replace",hl);class fl extends sl{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&&(ml(e,this.from,this.gapFrom)||ml(e,this.gapTo,this.to)))return ll.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ll.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?ll.fromReplace(e,this.from,this.to,n):ll.fail("Content does not fit in gap")}getMap(){return new rl([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 fl(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 fl(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 fl(t.from,t.to,t.gapFrom,t.gapTo,Qi.fromJSON(e,t.slice),t.insert,!!t.structure)}}function ml(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 gl(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],l=t+1;for(let t=0;t<i.childCount;t++){let a=i.child(t),c=l+a.nodeSize,u=r.matchType(a.type);if(u){r=u;for(let t=0;t<a.marks.length;t++)n.allowsMarkType(a.marks[t].type)||e.step(new ul(l,c,a.marks[t]));if(o&&a.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(a.text);)t||(t=new Qi(Gi.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),s.push(new hl(l+e.index,l+e.index+e[0].length,t))}}else s.push(new hl(l,c,Qi.empty));l=c}if(!r.validEnd){let t=r.fillBefore(Gi.empty,!0);e.replace(l,l,new Qi(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function yl(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function bl(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,l=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,l,t))return n;if(0==n||i.type.spec.isolating||!yl(i,s,l))break;s&&(r=1),l<i.childCount&&(o=1)}return null}function vl(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 l=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;l&&e<o;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return i?o.map(wl).concat({type:t,attrs:n}).concat(i.map(wl)):null}function wl(e){return{type:e,attrs:null}}function El(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.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 xl(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 kl(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 e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),l=r&&r[t+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!a.type.validContent(s))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function Sl(e,t){let n=e.resolve(t),r=n.index();return Cl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Cl(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 Tl(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let o,i,s=r.index(e);if(e==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(e+1),s++,i=r.node(e).maybeChild(s)):(o=r.node(e).maybeChild(s-1),i=r.node(e+1)),o&&!o.isTextblock&&Cl(o,i)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function Ml(e,t,n=t,r=Qi.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Ol(o,i,r)?new hl(t,n,r):new Il(o,i,r).fit()}function Ol(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}sl.jsonID("replaceAround",fl);class Il{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Gi.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Gi.from(e.node(t).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 l=new Qi(o,i,s);return e>-1?new fl(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new hl(n.pos,r.pos,l):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=Dl(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:l}=this.frontier[e],a=null;if(1==t&&(o?l.matchType(o.type)||(a=l.fillBefore(Gi.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:a};if(2==t&&o&&(i=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&l.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Dl(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new Qi(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=Dl(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new Qi(Pl(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new Qi(Pl(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 e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,l=i.openStart-e,a=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 p=s.size+e-(i.content.size-i.openEnd);for(;a<s.childCount;){let e=s.child(a),t=u.matchType(e.type);if(!t)break;a++,(a>1||0==l||e.content.size)&&(u=t,c.push(_l(e.mark(d.allowedMarks(e.marks)),1==a?l:0,a==s.childCount?p:-1)))}let h=a==s.childCount;h||(p=-1),this.placed=Al(this.placed,t,Gi.from(c)),this.frontier[t].match=u,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<p;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=h?0==e?Qi.empty:new Qi(Pl(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new Qi(Pl(i.content,e,a),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Nl(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=Nl(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Nl(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=Al(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=Al(this.placed,this.depth,Gi.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Gi.empty,!0);e.childCount&&(this.placed=Al(this.placed,this.frontier.length,e))}}function Pl(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Pl(e.firstChild.content,t-1,n)))}function Al(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Al(e.lastChild.content,t-1,n)))}function Dl(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function _l(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,_l(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(Gi.empty,!0)))),e.copy(r)}function Nl(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 l=r.fillBefore(i.content,!0,s);return l&&!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)?l:null}function Rl(e){return e.spec.defining||e.spec.definingForContent}function zl(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(zl(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(Gi.empty,!0))}return e}function $l(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 Ll extends sl{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 ll.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return ll.fromReplace(e,this.pos,this.pos+1,new Qi(Gi.from(r),0,t.isLeaf?0:1))}getMap(){return rl.empty}invert(e){return new Ll(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 Ll(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 Ll(t.pos,t.attr,t.value)}}sl.jsonID("attr",Ll);class Bl extends sl{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return ll.ok(n)}getMap(){return rl.empty}invert(e){return new Bl(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 Bl(t.attr,t.value)}}sl.jsonID("docAttr",Bl);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 jl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ol}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}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=Qi.empty){let r=Ml(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Qi(Gi.from(n),0,0))}delete(e,t){return this.replace(e,t,Qi.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(Ol(o,i,r))return e.step(new hl(t,n,r));let s=$l(o,i);0==s[s.length-1]&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?l=e:o.before(e)==t&&s.splice(1,0,-e)}let a=s.indexOf(l),c=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=c[e],n=Rl(t.type);if(n&&!t.sameMarkup(o.node(Math.abs(l)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+u+1)%(r.openStart+1),d=c[l];if(d)for(let t=0;t<s.length;t++){let c=s[(t+a)%s.length],u=!0;c<0&&(u=!1,c=-c);let p=o.node(c-1),h=o.index(c-1);if(p.canReplaceWith(h,h,d.type,d.marks))return e.replace(o.before(c),u?i.after(c):n,new Qi(zl(r.content,0,r.openStart,l),l,r.openEnd))}}let d=e.steps.length;for(let l=s.length-1;l>=0&&(e.replace(t,n,r),!(e.steps.length>d));l--){let e=s[l];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 e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new Qi(Gi.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=$l(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),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),l=o.after(i+1),a=s,c=l,u=Gi.empty,d=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Gi.from(r.node(e).copy(u)),d++):a--;let p=Gi.empty,h=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,p=Gi.from(o.node(e).copy(p)),h++):c++;e.step(new fl(a,c,s,l,new Qi(u.append(p),d,h),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 l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);xl(e,r.node(),r.before(),l)}s.inlineContent&&gl(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let a=e.mapping.slice(l),c=a.map(t-n);if(e.step(new hl(c,a.map(t+n,-1),Qi.empty,!0)),!0===r){let t=e.doc.resolve(c);El(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Gi.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Gi.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new fl(o,i,o,i,new Qi(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&&xl(e,t,n,i),gl(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let l=e.mapping.slice(i),a=l.map(n,1),c=l.map(n+t.nodeSize,1);return e.step(new fl(a,c,a+1,c-1,new Qi(Gi.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&El(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 fl(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Qi(Gi.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Ll(e,t,n)),this}setDocAttribute(e,t){return this.step(new Bl(e,t)),this}addNodeMark(e,t){return this.step(new dl(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 Yi)t.isInSet(n.marks)&&this.step(new pl(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new pl(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=Gi.empty,s=Gi.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){i=Gi.from(o.node(e).copy(i));let t=r&&r[l];s=Gi.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new hl(t,t,new Qi(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=[],l=[];e.doc.nodesBetween(t,n,(e,a,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(a,t),d=Math.min(a+e.nodeSize,n),p=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(p)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new ul(c,d,u[e])));i&&i.to==c?i.to=d:l.push(i=new cl(c,d,r))}}),s.forEach(t=>e.step(t)),l.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 l=null;if(r instanceof Rs){let t,n=e.marks;for(;t=r.isInSet(n);)(l||(l=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(l=[r]):l=e.marks;if(l&&l.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<l.length;e++){let n,a=l[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&a.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:a,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new ul(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return gl(this,e,t,n),this}}const Fl=Object.create(null);class Ul{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Hl(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=Qi.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(l.pos),c.map(a.pos),s?Qi.empty:t),0==s&&ea(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],l=e.mapping.slice(n),a=l.map(i.pos),c=l.map(s.pos);o?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),ea(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new ql(e):Zl(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?Zl(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):Zl(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Xl(e.node(0))}static atStart(e){return Zl(e,e,0,0,1)||new Xl(e)}static atEnd(e){return Zl(e,e,e.content.size,e.childCount,-1)||new Xl(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Fl[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 Fl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Fl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ql.between(this.$anchor,this.$head).getBookmark()}}Ul.prototype.visible=!0;class Hl{constructor(e,t){this.$from=e,this.$to=t}}let Wl=!1;function Gl(e){Wl||e.parent.inlineContent||(Wl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ql extends Ul{constructor(e,t=e){Gl(e),Gl(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 Ul.near(n);let r=e.resolve(t.map(this.anchor));return new ql(r.parent.inlineContent?r:n,n)}replace(e,t=Qi.empty){if(super.replace(e,t),t==Qi.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof ql&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kl(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 ql(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=Ul.findFrom(t,n,!0)||Ul.findFrom(t,-n,!0);if(!e)return Ul.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Ul.findFrom(e,-n,!0)||Ul.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new ql(e,t)}}Ul.jsonID("text",ql);class Kl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Kl(e.map(this.anchor),e.map(this.head))}resolve(e){return ql.between(e.resolve(this.anchor),e.resolve(this.head))}}class Jl extends Ul{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?Ul.near(o):new Jl(o)}content(){return new Qi(Gi.from(this.node),0,0)}eq(e){return e instanceof Jl&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Yl(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Jl(e.resolve(t.anchor))}static create(e,t){return new Jl(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Jl.prototype.visible=!1,Ul.jsonID("node",Jl);class Yl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Kl(n,n):new Yl(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Jl.isSelectable(n)?new Jl(t):Ul.near(t)}}class Xl extends Ul{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Qi.empty){if(t==Qi.empty){e.delete(0,e.doc.content.size);let t=Ul.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Xl(e)}map(e){return new Xl(e)}eq(e){return e instanceof Xl}getBookmark(){return Ql}}Ul.jsonID("all",Xl);const Ql={map(){return this},resolve(e){return new Xl(e)}};function Zl(e,t,n,r,o,i=!1){if(t.inlineContent)return ql.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&&Jl.isSelectable(r))return Jl.create(e,n-(o<0?r.nodeSize:0))}else{let t=Zl(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function ea(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof hl||i instanceof fl)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Ul.near(e.doc.resolve(o),n)))}class ta extends jl{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 Yi.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)||Yi.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(Ul.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 na(e,t){return t&&e?e.bind(t):e}class ra{constructor(e,t,n){this.name=e,this.init=na(t.init,n),this.apply=na(t.apply,n)}}const oa=[new ra("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new ra("selection",{init(e,t){return e.selection||Ul.atStart(t.doc)},apply(e){return e.selection}}),new ra("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new ra("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class ia{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=oa.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 ra(e.key,e.spec.state,e))})}}class sa{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 l=r?r[i].n:0,a=r?r[i].state:this,c=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,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 sa(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 ta(this)}static create(e){let t=new ia(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new sa(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 ia(this.schema,e.plugins),n=t.fields,r=new sa(t);for(let t=0;t<n.length;t++){let o=n[t].name;r[o]=this.hasOwnProperty(o)?this[o]:n[t].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 ia(e.schema,e.plugins),o=new sa(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=ys.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Ul.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],l=s.spec.state;if(s.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=l.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function la(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=la(o,t,{})),n[r]=o}return n}class aa{constructor(e){this.spec=e,this.props={},e.props&&la(e.props,this,this.props),this.key=e.key?e.key.key:ua("plugin")}getState(e){return e[this.key]}}const ca=Object.create(null);function ua(e){return e in ca?e+"$"+ ++ca[e]:(ca[e]=0,e+"$")}class da{constructor(e="key"){this.key=ua(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const pa=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ha(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const fa=(e,t,n)=>{let r=ha(e,n);if(!r)return!1;let o=ba(r);if(!o){let n=r.blockRange(),o=n&&bl(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Ia(e,o,t,-1))return!0;if(0==r.parent.content.size&&(ga(i,"end")||Jl.isSelectable(i)))for(let n=r.depth;;n--){let s=Ml(e.doc,r.before(n),r.after(n),Qi.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(ga(i,"end")?Ul.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):Jl.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-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 ma(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 l=Ml(e.doc,o,s,Qi.empty);if(!l||l.from!=o||l instanceof hl&&l.slice.size>=s-o)return!1;if(n){let t=e.tr.step(l);t.setSelection(ql.create(t.doc,o)),n(t.scrollIntoView())}return!0}function ga(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 ya=(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=ba(r)}let s=i&&i.nodeBefore;return!(!s||!Jl.isSelectable(s)||(t&&t(e.tr.setSelection(Jl.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),0))};function ba(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 va(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const wa=(e,t,n)=>{let r=va(e,n);if(!r)return!1;let o=xa(r);if(!o)return!1;let i=o.nodeAfter;if(Ia(e,o,t,1))return!0;if(0==r.parent.content.size&&(ga(i,"start")||Jl.isSelectable(i))){let n=Ml(e.doc,r.before(),r.after(),Qi.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(ga(i,"start")?Ul.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Jl.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))},Ea=(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=xa(r)}let s=i&&i.nodeAfter;return!(!s||!Jl.isSelectable(s)||(t&&t(e.tr.setSelection(Jl.create(e.doc,i.pos)).scrollIntoView()),0))};function xa(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 ka=(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 Sa(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 Ca=(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=Sa(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(Ul.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Ta=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Xl||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Sa(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(ql.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Ma=(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(kl(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&bl(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};var Oa;function Ia(e,t,n,r){let o,i,s=t.nodeBefore,l=t.nodeAfter,a=s.type.spec.isolating||l.type.spec.isolating;if(!a&&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&&!Sl(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!a&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(l.type))&&i.matchType(o[0]||l.type).validEnd){if(n){let r=t.pos+l.nodeSize,i=Gi.empty;for(let e=o.length-1;e>=0;e--)i=Gi.from(o[e].create(null,i));i=Gi.from(s.copy(i));let a=e.tr.step(new fl(t.pos-1,r,t.pos,r,new Qi(i,1,0),o.length,!0)),c=a.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Sl(a.doc,c.pos)&&a.join(c.pos),n(a.scrollIntoView())}return!0}let u=l.type.spec.isolating||r>0&&a?null:Ul.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),p=d&&bl(d);if(null!=p&&p>=t.depth)return n&&n(e.tr.lift(d,p).scrollIntoView()),!0;if(c&&ga(l,"start",!0)&&ga(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=l,a=1;for(;!i.isTextblock;i=i.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Gi.empty;for(let e=o.length-1;e>=0;e--)r=Gi.from(o[e].copy(r));n(e.tr.step(new fl(t.pos-o.length,t.pos+l.nodeSize,t.pos+a,t.pos+l.nodeSize-a,new Qi(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Pa(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(ql.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Aa=Pa(-1),Da=Pa(1);function _a(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,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 Na(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let Ra=Na(pa,fa,ya),za=Na(pa,wa,Ea);const $a={Enter:Na(ka,Ta,Ma,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Jl&&e.selection.node.isBlock)return!(!n.parentOffset||!kl(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],l=!1,a=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){l=n.end(e)==n.pos+(n.depth-e),a=n.start(e)==n.pos-(n.depth-e),i=Sa(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));let t=Oa;s.unshift(t||(l&&i?{type:i}:null)),o=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof ql||e.selection instanceof Xl)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=kl(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=kl(c.doc,u,s.length,s)),!d)return!1;if(c.split(u,s.length,s),!l&&a&&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}),"Mod-Enter":Ca,Backspace:Ra,"Mod-Backspace":Ra,"Shift-Backspace":Ra,Delete:za,"Mod-Delete":za,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new Xl(e.doc))),!0)},La={"Ctrl-h":$a.Backspace,"Alt-Backspace":$a["Mod-Backspace"],"Ctrl-d":$a.Delete,"Ctrl-Alt-Backspace":$a["Mod-Delete"],"Alt-Delete":$a["Mod-Delete"],"Alt-d":$a["Mod-Delete"],"Ctrl-a":Aa,"Ctrl-e":Da};for(let e in $a)La[e]=$a[e];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const Ba=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Va=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let ja=null;const Fa=function(e,t,n){let r=ja||(ja=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Ua=function(e,t,n,r){return n&&(Wa(e,t,n,r,-1)||Wa(e,t,n,r,1))},Ha=/^(img|br|input|textarea|hr)$/i;function Wa(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Ga(e))){let n=e.parentNode;if(!n||1!=n.nodeType||qa(e)||Ha.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Ba(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?Ga(e):0}}}}function Ga(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function qa(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 Ka=function(e){return e.focusNode&&Ua(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ja(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Ya="undefined"!=typeof navigator?navigator:null,Xa="undefined"!=typeof document?document:null,Qa=Ya&&Ya.userAgent||"",Za=/Edge\/(\d+)/.exec(Qa),ec=/MSIE \d/.exec(Qa),tc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qa),nc=!!(ec||tc||Za),rc=ec?document.documentMode:tc?+tc[1]:Za?+Za[1]:0,oc=!nc&&/gecko\/(\d+)/i.test(Qa);oc&&(/Firefox\/(\d+)/.exec(Qa)||[0,0])[1];const ic=!nc&&/Chrome\/(\d+)/.exec(Qa),sc=!!ic,lc=ic?+ic[1]:0,ac=!nc&&!!Ya&&/Apple Computer/.test(Ya.vendor),cc=ac&&(/Mobile\/\w+/.test(Qa)||!!Ya&&Ya.maxTouchPoints>2),uc=cc||!!Ya&&/Mac/.test(Ya.platform),dc=!!Ya&&/Win/.test(Ya.platform),pc=/Android \d/.test(Qa),hc=!!Xa&&"webkitFontSmoothing"in Xa.documentElement.style,fc=hc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function mc(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 gc(e,t){return"number"==typeof e?e:e[t]}function yc(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 bc(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=Va(s);continue}let e=s,n=e==i.body,l=n?mc(i):yc(e),a=0,c=0;if(t.top<l.top+gc(r,"top")?c=-(l.top-t.top+gc(o,"top")):t.bottom>l.bottom-gc(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+gc(o,"top")-l.top:t.bottom-l.bottom+gc(o,"bottom")),t.left<l.left+gc(r,"left")?a=-(l.left-t.left+gc(o,"left")):t.right>l.right-gc(r,"right")&&(a=t.right-l.right+gc(o,"right")),a||c)if(n)i.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);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:Va(s)}}function vc(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Va(r));return t}function wc(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 Ec=null;function xc(e,t){let n,r,o,i,s=2e8,l=0,a=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=Fa(u).getClientRects()}for(let p=0;p<e.length;p++){let h=e[p];if(h.top<=a&&h.bottom>=c){a=Math.max(h.bottom,a),c=Math.min(h.top,c);let e=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(e<s){n=u,s=e,r=e&&3==n.nodeType?{left:h.right<t.left?h.right:h.left,top:t.top}:t,1==u.nodeType&&e&&(l=d+(t.left>=(h.left+h.right)/2?1:0));continue}}else h.top>t.top&&!o&&h.left<=t.left&&h.right>=t.left&&(o=u,i={left:Math.max(h.left,Math.min(h.right,t.left)),top:h.top});!n&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(l=d+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=Mc(r,1);if(n.top!=n.bottom&&kc(t,n))return{node:e,offset:o+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:l}:xc(n,r)}function kc(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Sc(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(kc(t,o))return Sc(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Cc(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(Ga(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Ga(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,l=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!l||!e.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=e.dom.getBoundingClientRect();if(!kc(t,n))return null;if(l=Sc(e.dom,t,n),!l)return null}if(ac)for(let e=l;n&&e;e=Va(e))e.draggable&&(n=void 0);if(l=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(l,t),n){if(oc&&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;hc&&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 n=t,i=!1;n!=e.dom;){let t,s=e.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((t=s.dom.getBoundingClientRect()).width||t.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&t.left>r.left||t.top>r.top?o=s.posBefore:(!i&&t.right<r.left||t.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?s.posBefore:s.posAfter;n=s.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}=xc(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,l,t));let a=e.docView.nearestDesc(l,!0);return{pos:s,inside:a?a.posAtStart-a.border:-1}}function Tc(e){return e.top<e.bottom||e.left<e.right}function Mc(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Tc(e))return e}return Array.prototype.find.call(n,Tc)||e.getBoundingClientRect()}const Oc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ic(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=hc||oc;if(3==r.nodeType){if(!s||!Oc.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++,Pc(Mc(Fa(r,e,t),i),i<0)}{let e=Mc(Fa(r,o,o),n);if(oc&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Mc(Fa(r,o-1,o-1),-1);if(t.top==e.top){let n=Mc(Fa(r,o,o+1),-1);if(n.top!=e.top)return Pc(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Ga(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Ac(e.getBoundingClientRect(),!1)}if(null==i&&o<Ga(r)){let e=r.childNodes[o];if(1==e.nodeType)return Ac(e.getBoundingClientRect(),!0)}return Ac(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Ga(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Fa(e,Ga(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Pc(Mc(t,1),!1)}if(null==i&&o<Ga(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Fa(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Pc(Mc(t,-1),!0)}return Pc(Mc(3==r.nodeType?Fa(r):r,-n),n>=0)}function Pc(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 Ac(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 Dc(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 _c=/[\u0590-\u08ac]/;let Nc=null,Rc=null,zc=!1;class $c{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>Ba(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 e=t;e;e=e.parent)if(e==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 t=0;n<this.children.length;n++){let o=this.children[n],i=t+o.size;if(i>e||o instanceof Hc){r=e-t;break}t=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Lc&&e.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?Ba(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?Ba(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],l=i+n.size;if(-1==r&&e<=l){let o=i+n.border;if(e>=o&&t<=l-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=Ba(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;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=Ba(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}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 s=0,l=0;s<this.children.length;s++){let a=this.children[s],c=l+a.size;if(o>l&&i<c)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=c}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),c=n.domSelectionRange(),u=!1;if((oc||ac)&&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 t,n=e;n;n=n.parentNode){if(t=n.nextSibling){"BR"==t.nodeName&&(s=l={node:t.parentNode,offset:Ba(t)+1});break}let e=n.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(oc&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||u&&ac)&&Ua(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Ua(l.node,l.offset,c.focusNode,c.focusOffset))return;let d=!1;if((a.extend||e==t)&&(!u||!oc)){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),d=!0}catch(e){}}if(!d){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.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 Lc extends $c{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 Bc extends $c{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 Vc extends $c{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=Ks.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Vc(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=Vc.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=ru(o,t,i,n)),e>0&&(o=ru(o,0,e,n));for(let e=0;e<o.length;e++)o[e].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 jc extends $c{constructor(e,t,n,r,o,i,s,l,a){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,l=o.nodeViews[t.type.name],a=l&&l(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),c=a&&a.dom,u=a&&a.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=Ks.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=Qc(c,n,t),a?s=new Wc(e,t,n,r,c,u||null,d,a,o,i+1):t.isText?new Uc(e,t,n,r,c,d,o):new jc(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=()=>Gi.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)&&Zc(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,l=new tu(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,l=[],a=null;for(let c=0;;){let u,d,p,h;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(nu);for(let e=0;e<d.length;e++)n(d[e],c,!!a)}else n(u,c,!!a);if(a)h=-1,p=a,a=null;else{if(!(c<e.childCount))break;h=c,p=e.child(c++)}for(let e=0;e<l.length;e++)l[e].to<=i&&l.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let f=i+p.nodeSize;if(p.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=p.cut(e-i),p=p.cut(0,e-i),f=e,h=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(p,p.isInline&&!p.isLeaf?l.filter(e=>!e.inline):l.slice(),t.forChild(i,p),h),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!i&&l.syncToMarks(o==this.node.childCount?Yi.none:this.node.child(o).marks,n,e),l.placeWidget(t,e,r)},(t,i,a,c)=>{let u;l.syncToMarks(t.marks,n,e),l.findNodeMatch(t,i,a,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(t,i,a,u,e)||l.updateNextNode(t,i,a,e,c,r)||l.addNode(t,i,a,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Gc(this.contentDOM,this.children,e),cc&&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 ql)||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++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;a+=t.text}if(i>=n){if(i>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+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 Bc(this,o,t,r);e.input.compositionNodes.push(i),this.children=ru(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(Zc(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Yc(this.dom,this.nodeDOM,Jc(this.outerDeco,this.node,t),Jc(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 Fc(e,t,n,r,o){Qc(r,t,e);let i=new jc(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Uc extends jc{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 Uc(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 Hc extends $c{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 Wc extends jc{constructor(e,t,n,r,o,i,s,l,a,c){super(e,t,n,r,o,i,s,a,c),this.spec=l}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 Gc(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],l=s.dom;if(l.parentNode==e){for(;l!=r;)r=eu(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(l,r);if(s instanceof Vc){let t=r?r.previousSibling:e.lastChild;Gc(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=eu(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const qc=function(e){e&&(this.nodeName=e)};qc.prototype=Object.create(null);const Kc=[new qc];function Jc(e,t,n){if(0==e.length)return Kc;let r=n?Kc[0]:new qc,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new qc(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new qc(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 Yc(e,t,n,r){if(n==Kc&&r==Kc)return t;let o=t;for(let t=0;t<r.length;t++){let i=r[t],s=n[t];if(t){let t;s&&s.nodeName==i.nodeName&&o!=e&&(t=o.parentNode)&&t.nodeName.toLowerCase()==i.nodeName||(t=document.createElement(i.nodeName),t.pmIsDeco=!0,t.appendChild(o),s=Kc[0]),o=t}Xc(o,s||Kc[0],i)}return o}function Xc(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 Qc(e,t,n){return Yc(e,e,Kc,Jc(t,n,1!=e.nodeType))}function Zc(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 eu(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class tu{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 l;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Vc)){l=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 a=l.node;if(a){if(a!=e.child(o-1))break;--o,i.set(l,o),s.push(l)}}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){let r=0,o=this.stack.length>>1,i=Math.min(o,e.length);for(;r<i&&(r==o-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){r=t;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=Vc.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}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 r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;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 l=this.top.children[s];if(l instanceof jc){let a=this.preMatch.matched.get(l);if(null!=a&&a!=o)return!1;let c,u=l.dom,d=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&Zc(t,l.outerDeco));if(!d&&l.update(e,t,n,r))return this.destroyBetween(this.index,s),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(l,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)||!Zc(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=jc.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=jc.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 Lc(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 Vc;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Uc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ac||sc)&&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 Hc(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 nu(e,t){return e.type.side-t.type.side}function ru(e,t,n,r,o){let i=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,u=l+=a.size;c>=n||u<=t?i.push(a):(c<t&&i.push(a.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function ou(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 l,a,c=r.resolve(s);if(Ka(n)){for(l=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Jl.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Ga(e);r||o;){if(e==n)return!0;let t=Ba(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Ga(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;a=new Jl(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;[l,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);return a||(a=hu(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)),a}function iu(e){return e.editable?e.hasFocus():mu(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function su(e,t=!1){let n=e.state.selection;if(du(e,n),iu(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&sc){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Ua(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,Ba(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&nc&&rc<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!lu||n instanceof ql||(n.$from.parent.inlineContent||(r=au(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=au(e,n.to))),e.docView.setSelection(i,s,e,t),lu&&(r&&uu(r),o&&uu(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(()=>{iu(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const lu=ac||sc&&lc<63;function au(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(ac&&o&&"false"==o.contentEditable)return cu(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return cu(o);if(i)return cu(i)}}function cu(e){return e.contentEditable="true",ac&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function uu(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function du(e,t){if(t instanceof Jl){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(pu(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else pu(e)}function pu(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function hu(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||ql.between(t,n,r)}function fu(e){return!(e.editable&&!e.hasFocus())&&mu(e)}function mu(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(e){return!1}}function gu(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&&Ul.findFrom(i,t)}function yu(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function bu(e,t,n){let r=e.state.selection;if(!(r instanceof ql)){if(r instanceof Jl&&r.node.isInline)return yu(e,new ql(t>0?r.$to:r.$from));{let n=gu(e.state,t);return!!n&&yu(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 yu(e,new ql(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=gu(e.state,t);return!!(n&&n instanceof Jl)&&yu(e,n)}if(!(uc&&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)&&(Jl.isSelectable(i)?yu(e,new Jl(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!hc&&yu(e,new ql(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function vu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function wu(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Eu(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;for(oc&&1==n.nodeType&&r<vu(n)&&wu(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(wu(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(xu(n))break;{let t=n.previousSibling;for(;t&&wu(t,-1);)o=n.parentNode,i=Ba(t),t=t.previousSibling;if(t)n=t,r=vu(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?ku(e,n,r):o&&ku(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=vu(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!wu(n.childNodes[r],1))break;o=n,i=++r}else{if(xu(n))break;{let t=n.nextSibling;for(;t&&wu(t,1);)o=t.parentNode,i=Ba(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=vu(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&ku(e,o,i)}(e)}function xu(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function ku(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!qa(e);)t=Ba(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&&!qa(e);)t=Ba(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(Ka(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&&su(e)},50)}function Su(e,t){let n=e.state.doc.resolve(t);if(!sc&&!dc&&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 Cu(e,t,n){let r=e.state.selection;if(r instanceof ql&&!r.empty||n.indexOf("s")>-1)return!1;if(uc&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=gu(e.state,t);if(n&&n instanceof Jl)return yu(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof Xl?Ul.near(n,t):Ul.findFrom(n,t);return!!s&&yu(e,s)}return!1}function Tu(e,t){if(!(e.state.selection instanceof ql))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 Mu(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ou(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")||Ks.fromSchema(e.state.schema),l=Lu(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c,u=a.firstChild,d=0;for(;u&&1==u.nodeType&&(c=zu[u.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=l.createElement(c[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),d++}u=a.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Iu(e,t,n,r,o){let i,s,l=o.parent.type.spec.code;if(!n&&!t)return null;let a=!!t&&(r||l||!n);if(a){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return s=new Qi(Gi.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=Ks.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=Lu().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&zu[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=function(e){let t=window.trustedTypes;return t?(Bu||(Bu=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),Bu.createHTML(e)):e}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),hc&&function(e){let t=e.querySelectorAll(sc?"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 e=+u[3];e>0;e--){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")||Ls.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!a&&!u),context:o,ruleFromNode(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Pu.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(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=Gi.from(t.create(n[e+1],o)),i++,s++}return new Qi(o,i,s)}(Ru(s,+u[1],+u[2]),u[4]);else if(s=Qi.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&&Du(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=_u(i[i.length-1],r.length));let t=Au(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return Gi.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=Ru(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,a)}),s}const Pu=/^(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 Au(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Gi.from(e));return e}function Du(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Du(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(Gi.from(Au(n,e,o+1))))}}function _u(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,_u(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Gi.empty,!0);return e.copy(n.append(r))}function Nu(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(i=0),o<r-1&&(l=Nu(l,t,n,r,o+1,i)),o>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(Gi.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function Ru(e,t,n){return t<e.openStart&&(e=new Qi(Nu(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Qi(Nu(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const zu={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 $u=null;function Lu(){return $u||($u=document.implementation.createHTMLDocument("title"))}let Bu=null;const Vu={},ju={},Fu={touchstart:!0,touchmove:!0};class Uu{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Hu(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Wu(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Gu(e,t))})}function Gu(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function qu(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 Ku(e){return{left:e.clientX,top:e.clientY}}function Ju(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1)))return!0;return!1}function Yu(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function Xu(e,t,n,r){return Ju(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function Qu(e,t,n,r){return Ju(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&&(Yu(e,ql.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)Yu(e,ql.create(r,i+1,i+1+n.content.size),"pointer");else{if(!Jl.isSelectable(n))continue;Yu(e,Jl.create(r,i),"pointer")}return!0}}(e,n,r)}function Zu(e){return sd(e)}ju.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!nd(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!pc||!sc||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!cc||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||function(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||uc&&72==n&&"c"==r)return Tu(e,-1)||Eu(e,-1);if(46==n&&!t.shiftKey||uc&&68==n&&"c"==r)return Tu(e,1)||Eu(e,1);if(13==n||27==n)return!0;if(37==n||uc&&66==n&&"c"==r){let t=37==n?"ltr"==Su(e,e.state.selection.from)?-1:1:-1;return bu(e,t,r)||Eu(e,t)}if(39==n||uc&&70==n&&"c"==r){let t=39==n?"ltr"==Su(e,e.state.selection.from)?1:-1:1;return bu(e,t,r)||Eu(e,t)}return 38==n||uc&&80==n&&"c"==r?Cu(e,-1,r)||Eu(e,-1):40==n||uc&&78==n&&"c"==r?function(e){if(!ac||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;Mu(e,n,"true"),setTimeout(()=>Mu(e,n,"false"),20)}return!1}(e)||Cu(e,1,r)||Eu(e,1):r==(uc?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Hu(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,Ja(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},ju.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},ju.keypress=(e,t)=>{let n=t;if(nd(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||uc&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof ql&&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 ed=uc?"metaKey":"ctrlKey";Vu.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Zu(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[ed]&&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(Ku(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new td(e,s,n,!!r)):("doubleClick"==i?Xu:Qu)(e,s.pos,s.inside,n)?n.preventDefault():Hu(e,"pointer"))};class td{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[ed],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,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||a instanceof Jl&&a.from<=i&&a.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!oc||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)),Hu(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(()=>su(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(Ku(e))),this.updateAllowDefault(e),this.allowDefault||!t?Hu(this.view,"pointer"):function(e,t,n,r,o){return Ju(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 Jl&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(Jl.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(Yu(e,Jl.create(e.state.doc,r),"pointer"),!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&&Jl.isSelectable(r))&&(Yu(e,new Jl(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||ac&&this.mightDrag&&!this.mightDrag.node.isAtom||sc&&!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)?(Yu(this.view,Ul.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Hu(this.view,"pointer")}move(e){this.updateAllowDefault(e),Hu(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 nd(e,t){return!!e.composing||!!(ac&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Vu.touchstart=e=>{e.input.lastTouch=Date.now(),Zu(e),Hu(e,"pointer")},Vu.touchmove=e=>{e.input.lastTouch=Date.now(),Hu(e,"pointer")},Vu.contextmenu=e=>Zu(e);const rd=pc?5e3:-1;function od(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>sd(e),t))}function id(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 sd(e,t=!1){if(!(pc&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),id(e),t||e.docView&&e.docView.dirty){let n=ou(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}}ju.compositionstart=ju.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof ql&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)))e.markCursor=e.state.storedMarks||n.marks(),sd(e,!0),e.markCursor=null;else if(sd(e,!t.selection.empty),oc&&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}od(e,rd)},ju.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.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,od(e,20))};const ld=nc&&rc<15||cc&&fc<604;function ad(e,t,n,r,o){let i=Iu(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||Qi.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),l=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function cd(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," "):""}Vu.copy=ju.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=ld?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Ou(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):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,l),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ju.paste=(e,t)=>{let n=t;if(e.composing&&!pc)return;let r=ld?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&ad(e,cd(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?ad(e,r.value,null,o,t):ad(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class ud{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const dd=uc?"altKey":"ctrlKey";function pd(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[dd]}Vu.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(Ku(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Jl?i.to-1:i.to));else if(r&&r.mightDrag)o=Jl.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=Jl.create(e.state.doc,t.posBefore))}let l=(o||e.state.selection).content(),{dom:a,text:c,slice:u}=Ou(e,l);(!n.dataTransfer.files.length||!sc||lc>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ld?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",ld||n.dataTransfer.setData("text/plain",c),e.dragging=new ud(u,pd(e,n),o)},Vu.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},ju.dragover=ju.dragenter=(e,t)=>t.preventDefault(),ju.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(Ku(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",t=>{s=t(s,e,!1)}):s=Iu(e,cd(n.dataTransfer),ld?null:n.dataTransfer.getData("text/html"),!1,i);let l=!(!r||!pd(e,n));if(e.someProp("handleDrop",t=>t(e,n,s||Qi.empty,l)))return void n.preventDefault();if(!s)return;n.preventDefault();let a=s?function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);l=e&&s.canReplaceWith(i,i,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}(e.state.doc,i.pos,s):i.pos;null==a&&(a=i.pos);let c=e.state.tr;if(l){let{node:e}=r;e?e.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let h=c.doc.resolve(u);if(d&&Jl.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Jl(h));else{let t=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),c.setSelection(hu(e,h,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},Vu.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())&&su(e)},20))},Vu.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)},Vu.beforeinput=(e,t)=>{if(sc&&pc&&"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,Ja(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 e in ju)Vu[e]=ju[e];function hd(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 fd{constructor(e,t){this.toDOM=e,this.spec=t||vd,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 yd(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof fd&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&hd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class md{constructor(e,t){this.attrs=e,this.spec=t||vd}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 yd(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof md&&hd(this.attrs,e.attrs)&&hd(this.spec,e.spec)}static is(e){return e.type instanceof md}destroy(){}}class gd{constructor(e,t){this.attrs=e,this.spec=t||vd}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 yd(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 gd&&hd(this.attrs,e.attrs)&&hd(this.spec,e.spec)}destroy(){}}class yd{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new yd(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 yd(e,e,new fd(t,n))}static inline(e,t,n,r){return new yd(e,t,new md(n,r))}static node(e,t,n,r){return new yd(e,t,new gd(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof md}get widget(){return this.type instanceof fd}}const bd=[],vd={};class wd{constructor(e,t){this.local=e.length?e:bd,this.children=t.length?t:bd}static create(e,t){return t.length?Td(t,e,0,vd):Ed}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==Ed||0==e.maps.length?this:this.mapInner(e,t,0,0,n||vd)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(i||(i=[])).push(l):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let l=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<l.length;o+=3){let i=l[o+1];if(i<0||e>i+t-r)continue;let a=l[o]+t-r;n>=a?l[o+1]=e<=a?-2:-1:e>=t&&s&&(l[o]+=s,l[o+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let c=n.map(e[t]+i),u=c-o;if(u<0||u>=r.content.size){a=!0;continue}let d=n.map(e[t+1]+i,-1)-o,{index:p,offset:h}=r.content.findIndex(u),f=r.maybeChild(p);if(f&&h==u&&h+f.nodeSize==d){let r=l[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=Ed?(l[t]=u,l[t+1]=d,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=function(e,t,n,r,o,i,s){function l(e,t){for(let i=0;i<e.local.length;i++){let l=e.local[i].map(r,o,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)l(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&l(e[n+2],t[n]+i+1);return n}(l,e,t,n,o,i,s),c=Td(a,r,0,s);t=c.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new wd(t.sort(Md),l)}(this.children,i||[],e,t,n,r,o):i?new wd(i.sort(Md),bd):Ed}add(e,t){return t.length?this==Ed?wd.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,l=i+n;if(s=Sd(t,e,l)){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,l+1):r.splice(o,0,i,i+e.nodeSize,Td(s,e,l+1,vd)),o+=3}});let i=kd(o?Cd(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new wd(i.length?this.local.concat(i).sort(Md):this.local,r||this.children)}remove(e){return 0==e.length||this==Ed?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(o,i+1);l!=Ed?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,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 wd(r,n):Ed}forChild(e,t){if(this==Ed)return this;if(t.isLeaf)return wd.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof md){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new wd(r.sort(Md),bd);return n?new xd([e,n]):e}return n||Ed}eq(e){if(this==e)return!0;if(!(e instanceof wd)||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 Od(this.localsInner(e))}localsInner(e){if(this==Ed)return bd;if(e.inlineContent||!this.local.some(md.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof md||t.push(this.local[e]);return t}forEachSet(e){e(this)}}wd.empty=new wd([],[]),wd.removeOverlap=Od;const Ed=wd.empty;class xd{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,vd));return xd.from(n)}forChild(e,t){if(t.isLeaf)return wd.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Ed&&(o instanceof xd?n=n.concat(o.members):n.push(o))}return xd.from(n)}eq(e){if(!(e instanceof xd)||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?Od(n?t:t.sort(Md)):bd}static from(e){switch(e.length){case 0:return Ed;case 1:return e[0];default:return new xd(e.every(e=>e instanceof wd)?e:e.reduce((e,t)=>e.concat(t instanceof wd?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function kd(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 yd(o.from+t,o.to+t,o.type))}return n}function Sd(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function Cd(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Td(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let l=Sd(e,t,s+n);if(l){i=!0;let e=Td(l,t,n+s+1,r);e!=Ed&&o.push(s,s+t.nodeSize,e)}});let s=kd(i?Cd(e):e,-n).sort(Md);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new wd(s,o):Ed}function Md(e,t){return e.from-t.from||e.to-t.to}function Od(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),Id(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),Id(t,o+1,i.copy(r.to,i.to)))}}return t}function Id(e,t,n){for(;t<e.length&&Md(n,e[t])>0;)t++;e.splice(t,0,n)}function Pd(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Ed&&t.push(r)}),e.cursorWrapper&&t.push(wd.create(e.state.doc,[e.cursorWrapper.deco])),xd.from(t)}const Ad={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dd=nc&&rc<=11;class _d{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 Nd{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _d,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);nc&&rc<=11&&e.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),Dd&&(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,Ad)),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(fu(this.view)){if(this.suppressingSelectionUpdates)return su(this.view);if(nc&&rc<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ua(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 t=e.focusNode;t;t=Va(t))n.add(t);for(let r=e.anchorNode;r;r=Va(r))if(n.has(r)){t=r;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)&&fu(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,l=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],l);n&&(o=o<0?n.from:Math.min(n.from,o),i=i<0?n.to:Math.max(n.to,i),n.typeOver&&(s=!0))}if(oc&&l.length){let t=l.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&&Ld(e,n)==t||r.remove()}}}let a=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ka(n)&&(a=ou(e))&&a.eq(Ul.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,su(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(!Rd.has(e)&&(Rd.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=oc,zd)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."),zd=!0}}(e)),this.handleDOMChange(o,i,s,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||su(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(nc&&rc<=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?Ba(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?Ba(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,l,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 Rd=new WeakMap,zd=!1;function $d(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Ua(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Ld(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 Bd(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(ac&&/^(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||ac&&/^(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 Vd=/^(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 jd(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:hu(e,t.resolve(n.anchor),t.resolve(n.head))}function Fd(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 Ud(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 Hd{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 Uu,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Jd),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=qd(this),Gd(this),this.nodeViews=Kd(this),this.docView=Fc(this.state.doc,Wd(this),Pd(this),this.dom,this),this.domObserver=new Nd(this,(e,t,n,r)=>function(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=ou(e,t);if(n&&!e.state.selection.eq(n)){if(sc&&pc&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Ja(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),l=s.sharedDepth(n);t=s.before(l+1),n=e.state.doc.resolve(n).after(l+1);let a,c,u=e.state.selection,d=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:l,to:a}=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}],Ka(c)||r.push({node:c.focusNode,offset:c.focusOffset})),sc&&8===e.input.lastKeyCode)for(let e=s;e>i;e--){let t=o.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){s=e;break}if(!n||n.size)break}let d=e.state.doc,p=e.someProp("domParser")||Ls.fromSchema(e.state.schema),h=d.resolve(l),f=null,m=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=h.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Bd,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+l,head:t+l}}return{doc:m,sel:f,from:l,to:a}}(e,t,n),p=e.state.doc,h=p.slice(d.from,d.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(a=e.state.selection.to,c="end"):(a=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:l}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o&&(r-=s+Math.max(0,i-Math.min(s,l))-i),s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&Ud(t.textBetween(i-1,i+1))&&(i+=e?1:-1),l=i+(l-s),s=i}else if(l<i){let t=r<=i&&r>=l?i-r:0;i-=t,i&&i<e.size&&Ud(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}(h.content,d.doc.content,d.from,a,c);if(f&&e.input.domChangeCount++,(cc&&e.input.lastIOSEnter>Date.now()-225||pc)&&o.some(e=>1==e.nodeType&&!Vd.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Ja(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&u instanceof ql&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=jd(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 ql&&(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)),nc&&rc<=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=p.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA;if((cc&&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,Ja(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||Fd(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(Fd(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Fd(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Ja(8,"Backspace"))))return void(pc&&sc&&e.domObserver.suppressSelectionUpdates());sc&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),pc&&!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,Ja(13,"Enter"))})},20));let v,w=f.start,E=f.endA,x=t=>{let n=t||e.state.tr.replace(w,E,d.doc.slice(f.start-d.from,f.endB-d.from));if(d.sel){let t=jd(e,n.doc,d.sel);t&&!(sc&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(E)-1)||nc&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){nc&&rc<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>su(e),20));let t=x(e.state.tr.delete(w,E)),n=p.resolve(f.start).marksAcross(p.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,l=i,a=s;for(let e=0;e<s.length;e++)l=s[e].removeFromSet(l);for(let e=0;e<i.length;e++)a=i[e].removeFromSet(a);if(1==l.length&&0==a.length)r=l[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=l.length||1!=a.length)return null;r=a[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(o(t.child(e)));if(Gi.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=x(e.state.tr);"add"==v.type?t.addMark(w,E,v.mark):t.removeMark(w,E,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=()=>x(e.state.tr.insertText(t,w,E));e.someProp("handleTextInput",r=>r(e,w,E,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Vu){let n=Vu[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!qu(e,t)||Gu(e,t)||!e.editable&&t.type in ju||n(e,t)},Fu[t]?{passive:!0}:void 0)}ac&&e.dom.addEventListener("input",()=>null),Wu(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&&Wu(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Jd),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];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&&(id(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=Kd(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Wu(this),this.editable=qd(this),Gd(this);let l=Pd(this),a=Wd(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,a,l);!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 l=r.getBoundingClientRect();if(l.top>=o-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:vc(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(nc||sc)&&!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=sc?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(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=Ga(e=e.childNodes[t-1])}else{if(!e.parentNode||qa(e))return null;t=Ba(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||qa(e))return null;t=Ba(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}(this)),!o&&this.docView.update(e.doc,a,l,this)||(this.docView.updateOuterDeco(a),this.docView.destroy(),this.docView=Fc(e.doc,a,l,this.dom,this)),n&&!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 Ua(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?su(this,t):(du(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;wc(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 Jl){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&bc(this,t.getBoundingClientRect(),e)}else bc(this,this.coordsAtPos(this.state.selection.head,1),e)}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 ud(e.slice,e.move,r<0?void 0:Jl.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 r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[e];if(null!=o&&(n=t?t(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[e];if(null!=i&&(n=t?t(i):i))return n}}hasFocus(){if(nc){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(Ec)return e.focus(Ec);let t=vc(e);e.focus(null==Ec?{get preventScroll(){return Ec={preventScroll:!0},!0}}:void 0),Ec||(Ec=!1,wc(t,0))}(this.dom),su(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Cc(this,e)}coordsAtPos(e,t=1){return Ic(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 function(e,t,n){return Nc==t&&Rc==n?zc:(Nc=t,Rc=n,zc="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Dc(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=Ic(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=Fa(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,l=e.domSelection();return l?_c.test(r.parent.textContent)&&l.modify?Dc(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),p=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{l.collapse(i,s),t&&(t!=i||o!=s)&&l.extend&&l.extend(t,o)}catch(e){}return null!=a&&(l.caretBidiLevel=a),p}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return ad(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return ad(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ou(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,[],Pd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ja=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Gu(e,t)||!Vu[t.type]||!e.editable&&t.type in ju||Vu[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?ac&&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 $d(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?$d(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Wd(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"),[yd.node(0,e.state.doc.content.size,t)]}function Gd(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:yd.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function qd(e){return!e.someProp("editable",t=>!1===t(e.state))}function Kd(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 Jd(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")}Hd.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Yd={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:"'"},Xd={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qd="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Zd="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ep=0;ep<10;ep++)Yd[48+ep]=Yd[96+ep]=String(ep);for(ep=1;ep<=24;ep++)Yd[ep+111]="F"+ep;for(ep=65;ep<=90;ep++)Yd[ep]=String.fromCharCode(ep+32),Xd[ep]=String.fromCharCode(ep);for(var tp in Yd)Xd.hasOwnProperty(tp)||(Xd[tp]=Yd[tp]);const np="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),rp="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function op(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);np?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function ip(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 sp(e){let t=function(e){let t=Object.create(null);for(let n in e)t[op(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(Qd&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Zd&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Xd:Yd)[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[ip(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[ip(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(rp&&n.ctrlKey&&n.altKey)&&(r=Yd[n.keyCode])&&r!=o){let o=t[ip(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var lp=Object.defineProperty,ap=(e,t)=>{for(var n in t)lp(e,n,{get:t[n],enumerable:!0})};function cp(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 up=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=[],l=!!e,a=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(a,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(a),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:cp({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}},dp={};ap(dp,{blur:()=>pp,clearContent:()=>hp,clearNodes:()=>fp,command:()=>mp,createParagraphNear:()=>gp,cut:()=>yp,deleteCurrentNode:()=>bp,deleteNode:()=>wp,deleteRange:()=>Ep,deleteSelection:()=>xp,enter:()=>kp,exitCode:()=>Sp,extendMarkRange:()=>Ap,first:()=>Dp,focus:()=>$p,forEach:()=>Lp,insertContent:()=>Bp,insertContentAt:()=>Up,joinBackward:()=>Gp,joinDown:()=>Wp,joinForward:()=>qp,joinItemBackward:()=>Kp,joinItemForward:()=>Jp,joinTextblockBackward:()=>Yp,joinTextblockForward:()=>Xp,joinUp:()=>Hp,keyboardShortcut:()=>Zp,lift:()=>th,liftEmptyBlock:()=>nh,liftListItem:()=>rh,newlineInCode:()=>oh,resetAttributes:()=>lh,scrollIntoView:()=>ah,selectAll:()=>ch,selectNodeBackward:()=>uh,selectNodeForward:()=>dh,selectParentNode:()=>ph,selectTextblockEnd:()=>hh,selectTextblockStart:()=>fh,setContent:()=>gh,setMark:()=>Wh,setMeta:()=>Gh,setNode:()=>qh,setNodeSelection:()=>Kh,setTextDirection:()=>Jh,setTextSelection:()=>Yh,sinkListItem:()=>Xh,splitBlock:()=>Zh,splitListItem:()=>ef,toggleList:()=>rf,toggleMark:()=>of,toggleNode:()=>sf,toggleWrap:()=>lf,undoInputRule:()=>af,unsetAllMarks:()=>cf,unsetMark:()=>uf,unsetTextDirection:()=>df,updateAttributes:()=>pf,wrapIn:()=>hf,wrapInList:()=>ff});var pp=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),hp=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),fp=()=>({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)),l=i.blockRange(s);if(!l)return;const a=bl(l);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)})}),!0)},mp=e=>t=>e(t),gp=()=>({state:e,dispatch:t})=>Ta(e,t),yp=(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 ql(r.doc.resolve(Math.max(s-1,0)))),!0},bp=()=>({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 n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function vp(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 wp=e=>({tr:t,state:n,dispatch:r})=>{const o=vp(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},Ep=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},xp=()=>({state:e,dispatch:t})=>pa(e,t),kp=()=>({commands:e})=>e.keyboardShortcut("Enter"),Sp=()=>({state:e,dispatch:t})=>Ca(e,t);function Cp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Tp(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Cp(t[r])?t[r].test(e[r]):t[r]===e[r])}function Mp(e,t,n={}){return e.find(e=>e.type===t&&Tp(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Op(e,t,n={}){return!!Mp(e,t,n)}function Ip(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;if(n=n||(null==(r=o.node.marks[0])?void 0:r.attrs),!Mp([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,l=i+1,a=s+o.node.nodeSize;for(;i>0&&Op([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&Op([...e.parent.child(l).marks],t,n);)a+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Pp(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 Ap=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Pp(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const e=Ip(a,i,t);if(e&&e.from<=c&&e.to>=u){const t=ql.create(s,e.from,e.to);n.setSelection(t)}}return!0},Dp=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 _p(e){return e instanceof ql}function Np(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Rp(e,t=null){if(!t)return null;const n=Ul.atStart(e),r=Ul.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?ql.create(e,Np(0,o,i),Np(e.content.size,o,i)):ql.create(e,Np(t,o,i),Np(t,o,i))}function zp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var $p=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(zp()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};if(r.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!_p(n.state.selection))return s(),!0;const l=Rp(o.doc,e)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Lp=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Bp=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Vp=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&&Vp(r)}return e};function jp(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 Vp(n)}function Fp(e,t,n){if(e instanceof ys||e instanceof Gi)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 Gi.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Fp("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new zs({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?Ls.fromSchema(i).parseSlice(jp(e),n.parseOptions):Ls.fromSchema(i).parse(jp(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=Ls.fromSchema(t);return n.slice?r.parseSlice(jp(e),n.parseOptions).content:r.parse(jp(e),n.parseOptions)}return Fp("",t,n)}var Up=(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)}})},a={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{Fp(t,i.schema,{parseOptions:a,errorOnInvalidContent:!0})}catch(e){l(e)}try{o=Fp(t,i.schema,{parseOptions:a,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return l(e),!1}let c,{from:u,to:d}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,h=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,h=!!h&&e.isBlock}),u===d&&h){const{parent:e}=r.doc.resolve(u);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(u-=1,d+=1)}if(p){if(Array.isArray(t))c=t.map(e=>e.text||"").join("");else if(t instanceof Gi){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),c=e}else c="object"==typeof t&&t&&t.text?t.text:t;r.insertText(c,u,d)}else{c=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,c)}n.updateSelection&&function(e,t){const n=e.steps.length-1;if(n<t)return;const r=e.steps[n];if(!(r instanceof hl||r instanceof fl))return;const o=e.mapping.maps[n];let i=0;o.forEach((e,t,n,r)=>{0===i&&(i=r)}),e.setSelection(Ul.near(e.doc.resolve(i),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:c}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:c})}return!0},Hp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof Jl;if(o){if(r.node.isTextblock||!Sl(e.doc,r.from))return!1;n=r.from}else if(n=Tl(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(Jl.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Wp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof Jl){if(r.node.isTextblock||!Sl(e.doc,r.to))return!1;n=r.to}else if(n=Tl(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Gp=()=>({state:e,dispatch:t})=>fa(e,t),qp=()=>({state:e,dispatch:t})=>wa(e,t),Kp=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Tl(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Jp=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Tl(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Yp=()=>({state:e,dispatch:t})=>((e,t)=>{let n=ha(e,void 0);if(!n)return!1;let r=ba(n);return!!r&&ma(e,r,t)})(e,t),Xp=()=>({state:e,dispatch:t})=>((e,t)=>{let n=va(e,void 0);if(!n)return!1;let r=xa(n);return!!r&&ma(e,r,t)})(e,t);function Qp(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Zp=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 e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);zp()||Qp()?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)),l=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}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==a||a.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function eh(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?vp(t,e.schema):null,l=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);l.push({node:e,from:n,to:i})});const a=o-r,c=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>Tp(e.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}var th=(e,t={})=>({state:n,dispatch:r})=>!!eh(n,vp(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&bl(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),nh=()=>({state:e,dispatch:t})=>Ma(e,t),rh=e=>({state:t,dispatch:n})=>{return(r=vp(e,t.schema),function(e,t){let{$from:n,$to:o}=e.selection,i=n.blockRange(o,e=>e.childCount>0&&e.firstChild.type==r);return!!i&&(!t||(n.node(i.depth-1).type==r?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new fl(i-1,s,i,s,new Qi(Gi.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ms(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=bl(r);if(null==l)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return Sl(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),t(o.scrollIntoView()),!0}(e,t,r,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+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 l=0==n.startIndex,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?Gi.empty:Gi.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new fl(d-(l?1:0),p+(a?1:0),d+1,p-1,new Qi((l?Gi.empty:Gi.from(o.copy(Gi.empty))).append(a?Gi.empty:Gi.from(o.copy(Gi.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}(e,t,i)))})(t,n);var r},oh=()=>({state:e,dispatch:t})=>ka(e,t);function ih(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function sh(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 lh=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=ih("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(i=vp(e,r.schema)),"mark"===l&&(s=Pp(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(a=!0,o&&n.setNodeMarkup(r,void 0,sh(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(a=!0,o&&n.addMark(r,r+e.nodeSize,s.create(sh(i.attrs,t))))})})}),a},ah=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ch=()=>({tr:e,dispatch:t})=>{if(t){const t=new Xl(e.doc);e.setSelection(t)}return!0},uh=()=>({state:e,dispatch:t})=>ya(e,t),dh=()=>({state:e,dispatch:t})=>Ea(e,t),ph=()=>({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(Jl.create(e.doc,n))),!0)})(e,t),hh=()=>({state:e,dispatch:t})=>Da(e,t),fh=()=>({state:e,dispatch:t})=>Aa(e,t);function mh(e,t,n={},r={}){return Fp(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var gh=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if("full"!==r.preserveWhitespace){const l=mh(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,l).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function yh(e,t){const n=Pp(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 l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function bh(e,t){const n=new jl(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function vh(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 wh(e,t,n){return void 0===e.config[t]&&e.parent?wh(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?wh(e.parent,t,n):null}):e.config[t]}function Eh(e){return e.map(e=>{const t=wh(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Eh(t())]:e}).flat(10)}function xh(e,t){const n=Ks.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function kh(e){return"function"==typeof e}function Sh(e,t=void 0,...n){return kh(e)?t?e.bind(t)(...n):e(...n):e}function Ch(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Th(e){const t=[],{nodeExtensions:n,markExtensions:r}=Ch(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{const n=wh(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{e.types.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=wh(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 Mh(...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=t?t.split(";").map(e=>e.trim()).filter(Boolean):[],o=n[e]?n[e].split(";").map(e=>e.trim()).filter(Boolean):[],i=new Map;o.forEach(e=>{const[t,n]=e.split(":").map(e=>e.trim());i.set(t,n)}),r.forEach(e=>{const[t,n]=e.split(":").map(e=>e.trim());i.set(t,n)}),n[e]=Array.from(i.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function Oh(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)=>Mh(e,t),{})}function Ih(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 Ph(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 Ah(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 Dh(e){return e.sort((e,t)=>{const n=wh(e,"priority")||100,r=wh(t,"priority")||100;return n>r?-1:n<r?1:0})}function _h(e){const t=Dh(Eh(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 Nh(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let l="";return e.nodesBetween(r,o,(e,n,a,c)=>{var u;e.isBlock&&n>r&&(l+=i);const d=null==s?void 0:s[e.type.name];if(d)return a&&(l+=d({node:e,pos:n,parent:a,index:c,range:t})),!1;e.isText&&(l+=null==(u=null==e?void 0:e.text)?void 0:u.slice(Math.max(r,n)-n,o-n))}),l}function Rh(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function zh(e,t){const n=ih("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=vp(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?yh(e,t):{}}function $h(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),l=t.invert().map(i,-1),a=t.invert().map(s);r.push({oldRange:{from:l,to:a},newRange:{from:i,to:s}})})}),function(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)=>{const r=t.filter((e,t)=>t!==n);return!r.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)})}(r)}function Lh(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=Ip(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 Bh(e,t){return t.nodes[e]||t.marks[e]||null}function Vh(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 jh(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Pp(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Tp(e.attrs,n,{strict:!1}));let s=0;const l=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);s+=i-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:i})))})}),0===s)return!1;const a=l.filter(e=>!i||i.name===e.mark.type.name).filter(e=>Tp(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=l.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+c:a)>=s}function Fh(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Uh(e,t){const{nodeExtensions:n}=Ch(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=Sh(wh(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Hh(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&&(Hh(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}var Wh=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=Pp(e,r.schema);if(o)if(s){const e=yh(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),l=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(_p(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,a)},Gh=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),qh=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=vp(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})=>!!_a(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>_a(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Kh=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=Np(e,0,n.content.size),o=Jl.create(n,r);t.setSelection(o)}return!0},Jh=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,l;return"number"==typeof t?(s=t,l=t):t&&"from"in t&&"to"in t?(s=t.from,l=t.to):(s=i.from,l=i.to),o&&n.doc.nodesBetween(s,l,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Yh=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=ql.atStart(n).from,s=ql.atEnd(n).to,l=Np(r,i,s),a=Np(o,i,s),c=ql.create(n,l,a);t.setSelection(c)}return!0},Xh=e=>({state:t,dispatch:n})=>{const r=vp(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 l=i.parent,a=l.child(s-1);if(a.type!=o)return!1;if(t){let n=a.lastChild&&a.lastChild.type==l.type,r=Gi.from(n?o.create():null),s=new Qi(Gi.from(o.create(null,Gi.from(l.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new fl(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function Qh(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 Zh=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:l,$to:a}=i,c=Vh(o.extensionManager.attributes,l.node().type.name,l.node().attrs);if(i instanceof Jl&&i.node.isBlock)return!(!l.parentOffset||!kl(s,l.pos)||(r&&(e&&Qh(n,o.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),0));if(!l.parent.isBlock)return!1;const u=a.parentOffset===a.parent.content.size,d=0===l.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}(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=u&&d?[{type:d,attrs:c}]:void 0,h=kl(t.doc,t.mapping.map(l.pos),1,p);if(p||h||!kl(t.doc,t.mapping.map(l.pos),1,d?[{type:d}]:void 0)||(h=!0,p=d?[{type:d,attrs:c}]:void 0),r){if(h&&(i instanceof ql&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,p),d&&!u&&!l.parentOffset&&l.parent.type!==d)){const e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,d)&&t.setNodeMarkup(t.mapping.map(l.before()),d)}e&&Qh(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return h},ef=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=vp(e,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const p=i.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let e=Gi.empty;const r=a.index(-1)?1:a.index(-2)?2:3;for(let t=a.depth-r;t>=a.depth-3;t-=1)e=Gi.from(a.node(t).copy(e));const o=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,i={...Vh(p,a.node().type.name,a.node().attrs),...t},c=(null==(s=l.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(Gi.from(l.createAndFill(null,c)||void 0));const u=a.before(a.depth-(r-1));n.replace(u,a.after(-o),new Qi(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(ql.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,f={...Vh(p,d.type.name,d.attrs),...t},m={...Vh(p,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,c.pos);const g=h?[{type:l,attrs:f},{type:h,attrs:m}]:[{type:l,attrs:f}];if(!kl(n.doc,a.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,l=t||e.$to.parentOffset&&e.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!l||!o)return!0;const c=l.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},tf=(e,t)=>{const n=vh(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)||!Sl(e.doc,n.pos)||(e.join(n.pos),!0)},nf=(e,t)=>{const n=vh(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)||!Sl(e.doc,r)||(e.join(r),!0)},rf=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:p}=o.extensionManager,h=vp(e,s.schema),f=vp(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 E=vh(e=>Uh(e.type.name,d))(m);if(v.depth>=1&&E&&v.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(f);if(Uh(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>tf(i,h)).command(()=>nf(i,h)).run()}return n&&w&&l?a().command(()=>{const e=u().wrapInList(h,r),t=w.filter(e=>p.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(h,r).command(()=>tf(i,h)).command(()=>nf(i,h)).run():a().command(()=>!!u().wrapInList(h,r)||c.clearNodes()).wrapInList(h,r).command(()=>tf(i,h)).command(()=>nf(i,h)).run()},of=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Pp(e,r.schema);return jh(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},sf=(e,t,n={})=>({state:r,commands:o})=>{const i=vp(e,r.schema),s=vp(t,r.schema),l=eh(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},lf=(e,t={})=>({state:n,commands:r})=>{const o=vp(e,n.schema);return eh(n,o,t)?r.lift(o):r.wrapIn(o,t)},af=()=>({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},cf=()=>({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},uf=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=Pp(e,r.schema),{$from:c,empty:u,ranges:d}=l;if(!o)return!0;if(u&&s){let{from:e,to:t}=l;const r=null==(i=c.marks().find(e=>e.type===a))?void 0:i.attrs,o=Ip(c,a,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,a)}else d.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});return n.removeStoredMark(a),!0},df=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},pf=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=ih("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(i=vp(e,r.schema)),"mark"===l&&(s=Pp(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{const l=e.$from.pos,c=e.$to.pos;let u,d,p,h;n.selection.empty?r.doc.nodesBetween(l,c,(e,t)=>{i&&i===e.type&&(a=!0,p=Math.max(t,l),h=Math.min(t+e.nodeSize,c),u=t,d=e)}):r.doc.nodesBetween(l,c,(e,r)=>{r<l&&i&&i===e.type&&(a=!0,p=Math.max(r,l),h=Math.min(r+e.nodeSize,c),u=r,d=e),r>=l&&r<=c&&(i&&i===e.type&&(a=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(a=!0,o)){const o=Math.max(r,l),a=Math.min(r+e.nodeSize,c);n.addMark(o,a,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(p,h,s.create({...e.attrs,...t}))}))}),a},hf=(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),l=s&&vl(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}}(vp(e,n.schema),t)(n,r),ff=(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);if(!s)return!1;let l=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 ms(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ms(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=vl(i,n,r,t);return!!l&&(e&&function(e,t,n,r,o){let i=Gi.empty;for(let e=n.length-1;e>=0;e--)i=Gi.from(n[e].type.create(n[e].attrs,i));e.step(new fl(t.start-(r?2:0),t.end,t.start,t.end,new Qi(i,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==o&&(s=e+1);let l=n.length-s,a=t.start+n.length-(r?2:0),c=t.parent;for(let n=t.startIndex,r=t.endIndex,o=!0;n<r;n++,o=!1)!o&&kl(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=c.child(n).nodeSize}(e,t,l,o,n),!0)}(l,s,e,t)&&(r&&r(l.scrollIntoView()),!0)}}(vp(e,n.schema),t)(n,r),mf=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={}}},gf=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function yf(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;const c=a.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,l;const a=(null==(l=(s=e.type.spec).toText)?void 0:l.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(c)+i;return s.forEach(e=>{if(u)return;const t=((e,t)=>{if(Cp(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=a.state.tr,c=cp({state:a.state,transaction:s}),p={from:r-(t[0].length-i.length),to:o},{commands:h,chain:f,can:m}=new up({editor:n,state:c});null!==e.handler({state:c,range:p,match:t,commands:h,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(l,{transform:s,from:r,to:o,text:i}),a.dispatch(s),u=!0)}),u}function bf(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function vf(e,t){const n={...e};return bf(e)&&bf(t)&&Object.keys(t).forEach(r=>{bf(t[r])&&bf(e[r])?n[r]=vf(e[r],t[r]):n[r]=t[r]}),n}var wf=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{...Sh(wh(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Sh(wh(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>vf(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}},Ef=class e extends wf{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)}},xf=class{constructor(e){this.find=e.find,this.handler=e.handler}};var kf=null;function Sf(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const a=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const a=e.tr,c=cp({state:e,transaction:a});if(function(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:c,can:u}=new up({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,o,(e,t)=>{var p,h,f,m,g;if((null==(h=null==(p=e.type)?void 0:p.spec)?void 0:h.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;const w=((e,t,n)=>{if(Cp(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);w.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)},p=i.handler({state:n,range:o,match:e,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(p)})}),d.every(e=>null!==e)}({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&a.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return n.map(e=>new aa({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(kf=t)},r=()=>{kf&&(kf=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=kf;(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 l=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"),p=!!d;if(!c&&!u&&!p)return;if(p){let{text:t}=d;"string"==typeof t||(t=xh(Gi.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 a({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const h=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof h&&f&&h!==f.b?a({rule:e,state:r,from:h,to:f,pasteEvt:l}):void 0}}))}var Cf=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=_h(e),this.schema=function(e,t){var n;const r=Th(e),{nodeExtensions:o,markExtensions:i}=Ch(e),s=null==(n=o.find(e=>wh(e,"topNode")))?void 0:n.name,l=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=Ph({...e.reduce((e,t)=>{const r=wh(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:Sh(wh(n,"content",i)),marks:Sh(wh(n,"marks",i)),group:Sh(wh(n,"group",i)),inline:Sh(wh(n,"inline",i)),atom:Sh(wh(n,"atom",i)),selectable:Sh(wh(n,"selectable",i)),draggable:Sh(wh(n,"draggable",i)),code:Sh(wh(n,"code",i)),whitespace:Sh(wh(n,"whitespace",i)),linebreakReplacement:Sh(wh(n,"linebreakReplacement",i)),defining:Sh(wh(n,"defining",i)),isolating:Sh(wh(n,"isolating",i)),attrs:Object.fromEntries(o.map(Ah))}),l=Sh(wh(n,"parseHTML",i));l&&(s.parseDOM=l.map(e=>Ih(e,o)));const a=wh(n,"renderHTML",i);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:Oh(e,o)}));const c=wh(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),a=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=Ph({...e.reduce((e,t)=>{const r=wh(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:Sh(wh(n,"inclusive",i)),excludes:Sh(wh(n,"excludes",i)),group:Sh(wh(n,"group",i)),spanning:Sh(wh(n,"spanning",i)),code:Sh(wh(n,"code",i)),attrs:Object.fromEntries(o.map(Ah))}),l=Sh(wh(n,"parseHTML",i));l&&(s.parseDOM=l.map(e=>Ih(e,o)));const a=wh(n,"renderHTML",i);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:Oh(e,o)})),[n.name,s]}));return new zs({topNode:s,nodes:l,marks:a})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=wh(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Bh(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=Dh([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Bh(t.name,this.schema)},r=[],o=wh(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&wh(t,"exitable",n)&&(i.ArrowRight=()=>Ef.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 aa({props:{handleKeyDown:sp(i)}});r.push(s);const l=wh(t,"addInputRules",n);if(Fh(t,e.options.enableInputRules)&&l){const t=l();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new aa({state:{init(){return null},apply(e,o,i){const s=e.getMeta(r);if(s)return s;const l=e.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=xh(Gi.from(e),i.schema));const{from:o}=l,s=o+e.length;yf({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput(e,o,i,s){return yf({editor:t,from:o,to:i,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&yf({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&&yf({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 a=wh(t,"addPasteRules",n);if(Fh(t,e.options.enablePasteRules)&&a){const t=a();if(t&&t.length){const n=Sf({editor:e,rules:t});r.push(...n)}}const c=wh(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r});return t}get attributes(){return Th(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ch(this.extensions);return Object.fromEntries(t.filter(e=>!!wh(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:vp(t.name,this.schema)},o=wh(t,"addNodeView",r);if(!o)return[];const i=o();return i?[t.name,(r,o,s,l,a)=>{const c=Oh(r,n);return i({node:r,view:o,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}get markViews(){const{editor:e}=this,{markExtensions:t}=Ch(this.extensions);return Object.fromEntries(t.filter(e=>!!wh(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:Pp(t.name,this.schema)},o=wh(t,"addMarkView",r);return o?[t.name,(r,i,s)=>{const l=Oh(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:l,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),l=i.mapping.map(r)+t.nodeSize;let a=null;if(t.marks.forEach(e=>{if(e!==s)return!1;a=e}),!a)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==a.attrs[e]&&(c=!0)}),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,l,e.type),i.addMark(o,l,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:Bh(e.name,this.schema)};"mark"===e.type&&(null==(t=Sh(wh(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);const r=wh(e,"onBeforeCreate",n),o=wh(e,"onCreate",n),i=wh(e,"onUpdate",n),s=wh(e,"onSelectionUpdate",n),l=wh(e,"onTransaction",n),a=wh(e,"onFocus",n),c=wh(e,"onBlur",n),u=wh(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),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}};Cf.resolve=_h,Cf.sort=Dh,Cf.flatten=Eh,ap({},{ClipboardTextSerializer:()=>Mf,Commands:()=>Of,Delete:()=>If,Drop:()=>Pf,Editable:()=>Af,FocusEvents:()=>_f,Keymap:()=>Nf,Paste:()=>Rf,Tabindex:()=>zf,TextDirection:()=>$f,focusEventsPluginKey:()=>Df});var Tf=class e extends wf{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)}},Mf=Tf.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new aa({key:new da("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)),l=Math.max(...i.map(e=>e.$to.pos)),a=Rh(n);return Nh(r,{from:s,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Of=Tf.create({name:"commands",addCommands(){return{...dp}}}),If=Tf.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=bh(e.before,[e,...t]);$h(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 l=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof ul){const i=l.slice(n).map(t.from,-1),a=l.slice(n).map(t.to),c=l.invert().map(i,-1),u=l.invert().map(a),d=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark)),p=null==(o=s.doc.nodeAt(a))?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:a},partial:Boolean(p||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()}}),Pf=Tf.create({name:"drop",addProseMirrorPlugins(){return[new aa({key:new da("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Af=Tf.create({name:"editable",addProseMirrorPlugins(){return[new aa({key:new da("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Df=new da("focusEvents"),_f=Tf.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new aa({key:Df,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}}}})]}}),Nf=Tf.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:l}=i,a=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=a.parent.type.spec.isolating,u=i.pos-i.parentOffset,d=c&&1===a.parent.childCount?u===i.pos:Ul.atStart(r).from===s;return!(!o||!l.type.isTextblock||l.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 zp()||Qp()?o:r},addProseMirrorPlugins(){return[new aa({key:new da("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:l}=t.selection,a=Ul.atStart(t.doc).from,c=Ul.atEnd(t.doc).to;if(i||s!==a||l!==c)return;if(!Hh(n.doc))return;const u=n.tr,d=cp({state:n,transaction:u}),{commands:p}=new up({editor:this.editor,state:d});return p.clearNodes(),u.steps.length?u:void 0}})]}}),Rf=Tf.create({name:"paste",addProseMirrorPlugins(){return[new aa({key:new da("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),zf=Tf.create({name:"tabindex",addProseMirrorPlugins(){return[new aa({key:new da("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),$f=Tf.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Ch(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 aa({key:new da("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Lf=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=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!o&&l.depth<=this.depth)return;const a=new e(l,this.editor,o,o?n:null);o&&(a.actualDepth=this.depth+1),t.push(new e(l,this.editor,o,o?n:null))}),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=>{n&&r.length>0||(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)}},Bf=class extends mf{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},this.isCapturingTransaction=!1,this.capturedTransaction=null,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=Rp(t,this.options.autofocus);this.editorState=sa.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='.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}',document.getElementsByTagName("head")[0].appendChild(r),r}(0,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=kh(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?[Af,Mf.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Of,_f,Nf,zf,Pf,Rf,If,$f.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 Cf(n,this)}createCommandManager(){this.commandManager=new up({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=mh(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=mh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new Hd(e,{...this.options.editorProps,attributes:{role:"textbox",...null==(t=this.options.editorProps)?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),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")),l=null==s?void 0:s.getMeta("focus"),a=null==s?void 0:s.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.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 zh(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 eh(e,null,n)||jh(e,null,n);const r=ih(t,e.schema);return"node"===r?eh(e,t,n):"mark"===r&&jh(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return xh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Nh(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...Rh(this.schema),...n}})}get isEmpty(){return Hh(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 Lf(t,this)}get $doc(){return this.$pos(0)}};function Vf(e){return new gf({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Sh(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],l=r[0];if(s){const r=l.search(/\S/),a=n.from+l.indexOf(s),c=a+s.length;if(Lh(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>a).length)return null;c<n.to&&i.delete(c,n.to),a>n.from&&i.delete(n.from+r,a);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 jf(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();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Ff(e){if(!e||0===Object.keys(e).length)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),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 Uf(e){const{nodeName:t,name:n,parseAttributes:r=jf,serializeAttributes:o=Ff,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=e,a=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(`^:::${a}(?:\\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(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),l=e.match(i);if(!l)return;const c=l[1]||"",u=r(c);return s.find(e=>!(e in u))?void 0:{type:t,raw:l[0],attributes:u}}},renderMarkdown:e=>{const t=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${a}${n?` {${n}}`:""} :::`}}}function Hf(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=jf,serializeAttributes:i=Ff,defaultAttributes:s={},content:l="block",allowedAttributes:a}=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"===l?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`),a=e.match(s);if(!a)return;const[u,d=""]=a,p=o(d);let h=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)h+=1;else if(h-=1,0===h){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let a=[];if(m)if("block"===l)for(a=r.blockTokens(i),a.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});a.length>0;){const e=a[a.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;a.pop()}else a=r.inlineTokens(m);return{type:t,raw:s,attributes:p,content:m,tokens:a}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!a)return e;const t={};return a.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 Wf(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 Gf(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function qf(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Wf,serializeAttributes:i=Gf,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=e,c=n||t,u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(l)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=l?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=l?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),s=e.match(i);if(!s)return;let a="",c="";if(l){const[,e]=s;c=e}else{const[,e,t]=s;c=e,a=t||""}const d=o(c.trim());return{type:t,raw:s[0],content:a.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(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return l?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function Kf(e,t,n){var r,o,i,s;const l=e.split("\n"),a=[];let c="",u=0;const d=t.baseIndentSize||2;for(;u<l.length;){const e=l[u],p=e.match(t.itemPattern);if(!p){if(a.length>0)break;if(""===e.trim()){u+=1,c=`${c}${e}\n`;continue}return}const h=t.extractItemData(p),{indentLevel:f,mainContent:m}=h;c=`${c}${e}\n`;const g=[m];for(u+=1;u<l.length;){const e=l[u];if(""===e.trim()){const t=l.slice(u+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=l[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(h,y);a.push(v)}if(0!==a.length)return{items:a,raw:c}}function Jf(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content,l=[`${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");l.push(e)}}),l.join("\n")}ap({},{createAtomBlockMarkdownSpec:()=>Uf,createBlockMarkdownSpec:()=>Hf,createInlineMarkdownSpec:()=>qf,parseAttributes:()=>jf,parseIndentedBlocks:()=>Kf,renderNestedMarkdownContent:()=>Jf,serializeAttributes:()=>Ff});var Yf=class e extends wf{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 Xf(e){return new xf({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Sh(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,l=r[r.length-1],a=r[0];let c=n.to;if(l){const r=a.search(/\S/),o=n.from+a.indexOf(l),u=o+l.length;if(Lh(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+l.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}var Qf=(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]},Zf=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,em=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,tm=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,nm=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,rm=Ef.create({name:"bold",addOptions(){return{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 Qf("strong",{...Mh(this.options.HTMLAttributes,e),children:Qf("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[Vf({find:Zf,type:this.type}),Vf({find:tm,type:this.type})]},addPasteRules(){return[Xf({find:em,type:this.type}),Xf({find:nm,type:this.type})]}}),om=Yf.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),im=Yf.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Mh(this.options.HTMLAttributes,e)]},renderText(){return"\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,l=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&i){const t=l.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()}}}),sm=im,lm=Yf.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{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]}`,Mh(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=>{return t={find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}},new gf({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=Sh(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable});var t})}}),am=lm,cm=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,um=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dm=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pm=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,hm=Ef.create({name:"italic",addOptions(){return{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",Mh(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[Vf({find:cm,type:this.type}),Vf({find:dm,type:this.type})]},addPasteRules(){return[Xf({find:um,type:this.type}),Xf({find:pm,type:this.type})]}});const fm="numeric",mm="ascii",gm="alpha",ym="asciinumeric",bm="alphanumeric",vm="domain",wm="emoji",Em="scheme",xm="slashscheme",km="whitespace";function Sm(e,t){return e in t||(t[e]=[]),t[e]}function Cm(e,t,n){t[fm]&&(t[ym]=!0,t[bm]=!0),t[mm]&&(t[ym]=!0,t[gm]=!0),t[ym]&&(t[bm]=!0),t[gm]&&(t[bm]=!0),t[bm]&&(t[vm]=!0),t[wm]&&(t[vm]=!0);for(const r in t){const t=Sm(r,n);t.indexOf(e)<0&&t.push(e)}}function Tm(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Tm.groups={},Tm.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],o=t.jr[n][1];if(o&&r.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||Tm.groups,t&&t.j?o=t:(o=new Tm(t),n&&r&&Cm(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 t=0;t<i-1;t++)o=o.tt(e[t]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Tm.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,l=o.go(e);if(l?(s=new Tm,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Tm,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);Cm(i,e,r)}else n&&Cm(i,n,r);s.t=i}return o.j[e]=s,s}};const Mm=(e,t,n,r,o)=>e.ta(t,n,r,o),Om=(e,t,n,r,o)=>e.tr(t,n,r,o),Im=(e,t,n,r,o)=>e.ts(t,n,r,o),Pm=(e,t,n,r,o)=>e.tt(t,n,r,o),Am="WORD",Dm="UWORD",_m="ASCIINUMERICAL",Nm="ALPHANUMERICAL",Rm="LOCALHOST",zm="TLD",$m="UTLD",Lm="SCHEME",Bm="SLASH_SCHEME",Vm="NUM",jm="WS",Fm="NL",Um="OPENBRACE",Hm="CLOSEBRACE",Wm="OPENBRACKET",Gm="CLOSEBRACKET",qm="OPENPAREN",Km="CLOSEPAREN",Jm="OPENANGLEBRACKET",Ym="CLOSEANGLEBRACKET",Xm="FULLWIDTHLEFTPAREN",Qm="FULLWIDTHRIGHTPAREN",Zm="LEFTCORNERBRACKET",eg="RIGHTCORNERBRACKET",tg="LEFTWHITECORNERBRACKET",ng="RIGHTWHITECORNERBRACKET",rg="FULLWIDTHLESSTHAN",og="FULLWIDTHGREATERTHAN",ig="AMPERSAND",sg="APOSTROPHE",lg="ASTERISK",ag="AT",cg="BACKSLASH",ug="BACKTICK",dg="CARET",pg="COLON",hg="COMMA",fg="DOLLAR",mg="DOT",gg="EQUALS",yg="EXCLAMATION",bg="HYPHEN",vg="PERCENT",wg="PIPE",Eg="PLUS",xg="POUND",kg="QUERY",Sg="QUOTE",Cg="FULLWIDTHMIDDLEDOT",Tg="SEMI",Mg="SLASH",Og="TILDE",Ig="UNDERSCORE",Pg="EMOJI",Ag="SYM";var Dg=Object.freeze({__proto__:null,ALPHANUMERICAL:Nm,AMPERSAND:ig,APOSTROPHE:sg,ASCIINUMERICAL:_m,ASTERISK:lg,AT:ag,BACKSLASH:cg,BACKTICK:ug,CARET:dg,CLOSEANGLEBRACKET:Ym,CLOSEBRACE:Hm,CLOSEBRACKET:Gm,CLOSEPAREN:Km,COLON:pg,COMMA:hg,DOLLAR:fg,DOT:mg,EMOJI:Pg,EQUALS:gg,EXCLAMATION:yg,FULLWIDTHGREATERTHAN:og,FULLWIDTHLEFTPAREN:Xm,FULLWIDTHLESSTHAN:rg,FULLWIDTHMIDDLEDOT:Cg,FULLWIDTHRIGHTPAREN:Qm,HYPHEN:bg,LEFTCORNERBRACKET:Zm,LEFTWHITECORNERBRACKET:tg,LOCALHOST:Rm,NL:Fm,NUM:Vm,OPENANGLEBRACKET:Jm,OPENBRACE:Um,OPENBRACKET:Wm,OPENPAREN:qm,PERCENT:vg,PIPE:wg,PLUS:Eg,POUND:xg,QUERY:kg,QUOTE:Sg,RIGHTCORNERBRACKET:eg,RIGHTWHITECORNERBRACKET:ng,SCHEME:Lm,SEMI:Tg,SLASH:Mg,SLASH_SCHEME:Bm,SYM:Ag,TILDE:Og,TLD:zm,UNDERSCORE:Ig,UTLD:$m,UWORD:Dm,WORD:Am,WS:jm});const _g=/[a-z]/,Ng=/\p{L}/u,Rg=/\p{Emoji}/u,zg=/\d/,$g=/\s/;let Lg=null,Bg=null;function Vg(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 l=e,a=null,c=0,u=null,d=-1,p=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,p=0,u=l):d>=0&&(d+=n[s].length,p++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=p,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function jg(e,t,n,r,o){let i;const s=t.length;for(let n=0;n<s-1;n++){const s=t[n];e.j[s]?i=e.j[s]:(i=new Tm(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new Tm(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Fg(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 Ug={defaultProtocol:"http",events:null,format:Wg,formatHref:Wg,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hg(e,t=null){let n=Object.assign({},Ug);e&&(n=Object.assign(n,e instanceof Hg?e.o:e));const r=n.ignoreTags,o=[];for(let e=0;e<r.length;e++)o.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function Wg(e){return e}function Gg(e,t){this.t="token",this.v=e,this.tk=t}function qg(e,t){class n extends Gg{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}Hg.prototype={o:Ug,ignoreTags:[],defaultRender(e){return 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]:Ug[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)}},Gg.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=Ug.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={},l=e.get("className",n,t),a=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,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};const Kg=qg("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Jg=qg("text"),Yg=qg("nl"),Xg=qg("url",{isLink:!0,toHref(e=Ug.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Rm&&e[1].t===pg}}),Qg=e=>new Tm(e);function Zg(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const ey="undefined"!=typeof console&&console&&console.warn||(()=>{}),ty={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ny(e,t=!1){if(ty.initialized&&ey(`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');ty.customSchemes.push([e,t])}function ry(e){return ty.initialized||function(){ty.scanner=function(e=[]){const t={};Tm.groups=t;const n=new Tm;null==Lg&&(Lg=Fg("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Bg&&(Bg=Fg("ελ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")),Pm(n,"'",sg),Pm(n,"{",Um),Pm(n,"}",Hm),Pm(n,"[",Wm),Pm(n,"]",Gm),Pm(n,"(",qm),Pm(n,")",Km),Pm(n,"<",Jm),Pm(n,">",Ym),Pm(n,"(",Xm),Pm(n,")",Qm),Pm(n,"「",Zm),Pm(n,"」",eg),Pm(n,"『",tg),Pm(n,"』",ng),Pm(n,"<",rg),Pm(n,">",og),Pm(n,"&",ig),Pm(n,"*",lg),Pm(n,"@",ag),Pm(n,"`",ug),Pm(n,"^",dg),Pm(n,":",pg),Pm(n,",",hg),Pm(n,"$",fg),Pm(n,".",mg),Pm(n,"=",gg),Pm(n,"!",yg),Pm(n,"-",bg),Pm(n,"%",vg),Pm(n,"|",wg),Pm(n,"+",Eg),Pm(n,"#",xg),Pm(n,"?",kg),Pm(n,'"',Sg),Pm(n,"/",Mg),Pm(n,";",Tg),Pm(n,"~",Og),Pm(n,"_",Ig),Pm(n,"\\",cg),Pm(n,"・",Cg);const r=Om(n,zg,Vm,{[fm]:!0});Om(r,zg,r);const o=Om(r,_g,_m,{[ym]:!0}),i=Om(r,Ng,Nm,{[bm]:!0}),s=Om(n,_g,Am,{[mm]:!0});Om(s,zg,o),Om(s,_g,s),Om(o,zg,o),Om(o,_g,o);const l=Om(n,Ng,Dm,{[gm]:!0});Om(l,_g),Om(l,zg,i),Om(l,Ng,l),Om(i,zg,i),Om(i,_g),Om(i,Ng,i);const a=Pm(n,"\n",Fm,{[km]:!0}),c=Pm(n,"\r",jm,{[km]:!0}),u=Om(n,$g,jm,{[km]:!0});Pm(n,"",u),Pm(c,"\n",a),Pm(c,"",u),Om(c,$g,u),Pm(u,"\r"),Pm(u,"\n"),Om(u,$g,u),Pm(u,"",u);const d=Om(n,Rg,Pg,{[wm]:!0});Pm(d,"#"),Om(d,Rg,d),Pm(d,"️",d);const p=Pm(d,"");Pm(p,"#"),Om(p,Rg,d);const h=[[_g,s],[zg,o]],f=[[_g,null],[Ng,l],[zg,i]];for(let e=0;e<Lg.length;e++)jg(n,Lg[e],zm,Am,h);for(let e=0;e<Bg.length;e++)jg(n,Bg[e],$m,Dm,f);Cm(zm,{tld:!0,ascii:!0},t),Cm($m,{utld:!0,alpha:!0},t),jg(n,"file",Lm,Am,h),jg(n,"mailto",Lm,Am,h),jg(n,"http",Bm,Am,h),jg(n,"https",Bm,Am,h),jg(n,"ftp",Bm,Am,h),jg(n,"ftps",Bm,Am,h),Cm(Lm,{scheme:!0,ascii:!0},t),Cm(Bm,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){const r=e[t][0],o=e[t][1]?{[Em]:!0}:{[xm]:!0};r.indexOf("-")>=0?o[vm]=!0:_g.test(r)?zg.test(r)?o[ym]=!0:o[mm]=!0:o[fm]=!0,Im(n,r,r,o)}return Im(n,"localhost",Rm,{ascii:!0}),n.jd=new Tm(Ag),{start:n,tokens:Object.assign({groups:t},Dg)}}(ty.customSchemes);for(let e=0;e<ty.tokenQueue.length;e++)ty.tokenQueue[e][1]({scanner:ty.scanner});ty.parser=function({groups:e}){const t=e.domain.concat([ig,lg,ag,cg,ug,dg,fg,gg,bg,Vm,vg,wg,Eg,xg,Mg,Ag,Og,Ig]),n=[sg,pg,hg,mg,yg,vg,kg,Sg,Tg,Jm,Ym,Um,Hm,Gm,Wm,qm,Km,Xm,Qm,Zm,eg,tg,ng,rg,og],r=[ig,sg,lg,cg,ug,dg,fg,gg,bg,Um,Hm,vg,wg,Eg,xg,kg,Mg,Ag,Og,Ig],o=Qg(),i=Pm(o,Og);Mm(i,r,i),Mm(i,e.domain,i);const s=Qg(),l=Qg(),a=Qg();Mm(o,e.domain,s),Mm(o,e.scheme,l),Mm(o,e.slashscheme,a),Mm(s,r,i),Mm(s,e.domain,s);const c=Pm(s,ag);Pm(i,ag,c),Pm(l,ag,c),Pm(a,ag,c);const u=Pm(i,mg);Mm(u,r,i),Mm(u,e.domain,i);const d=Qg();Mm(c,e.domain,d),Mm(d,e.domain,d);const p=Pm(d,mg);Mm(p,e.domain,d);const h=Qg(Kg);Mm(p,e.tld,h),Mm(p,e.utld,h),Pm(c,Rm,h);const f=Pm(d,bg);Pm(f,bg,f),Mm(f,e.domain,d),Mm(h,e.domain,d),Pm(h,mg,p),Pm(h,bg,f);const m=Pm(h,pg);Mm(m,e.numeric,Kg);const g=Pm(s,bg),y=Pm(s,mg);Pm(g,bg,g),Mm(g,e.domain,s),Mm(y,r,i),Mm(y,e.domain,s);const b=Qg(Xg);Mm(y,e.tld,b),Mm(y,e.utld,b),Mm(b,e.domain,s),Mm(b,r,i),Pm(b,mg,y),Pm(b,bg,g),Pm(b,ag,c);const v=Pm(b,pg),w=Qg(Xg);Mm(v,e.numeric,w);const E=Qg(Xg),x=Qg();Mm(E,t,E),Mm(E,n,x),Mm(x,t,E),Mm(x,n,x),Pm(b,Mg,E),Pm(w,Mg,E);const k=Pm(l,pg),S=Pm(a,pg),C=Pm(S,Mg),T=Pm(C,Mg);Mm(l,e.domain,s),Pm(l,mg,y),Pm(l,bg,g),Mm(a,e.domain,s),Pm(a,mg,y),Pm(a,bg,g),Mm(k,e.domain,E),Pm(k,Mg,E),Pm(k,kg,E),Mm(T,e.domain,E),Mm(T,t,E),Pm(T,Mg,E);const M=[[Um,Hm],[Wm,Gm],[qm,Km],[Jm,Ym],[Xm,Qm],[Zm,eg],[tg,ng],[rg,og]];for(let e=0;e<M.length;e++){const[r,o]=M[e],i=Pm(E,r);Pm(x,r,i),Pm(i,o,E);const s=Qg(Xg);Mm(i,t,s);const l=Qg();Mm(i,n),Mm(s,t,s),Mm(s,n,l),Mm(l,t,s),Mm(l,n,l),Pm(s,o,E),Pm(l,o,E)}return Pm(o,Rm,b),Pm(o,Fm,Yg),{start:o,tokens:Dg}}(ty.scanner.tokens);for(let e=0;e<ty.pluginQueue.length;e++)ty.pluginQueue[e][1]({scanner:ty.scanner,parser:ty.parser});ty.initialized=!0}(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let l=e,a=null,c=null,u=0,d=null,p=-1;for(;o<r&&!(a=l.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=a||l.go(n[o].t));)a=null,l=c,l.accepts()?(p=0,d=l):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(Zg(Jg,t,s)),s=[]),o-=p,u-=p;const e=d.t,r=n.slice(o-u,o);i.push(Zg(e,t,r))}}return s.length>0&&i.push(Zg(Jg,t,s)),i}(ty.parser.start,e,Vg(ty.scanner.start,e))}function oy(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 Hg(n),o=ry(e),i=[];for(let e=0;e<o.length;e++){const n=o[e];!n.isLink||t&&n.t!==t||!r.check(n)||i.push(n.toFormattedObject(r))}return i}ry.scan=Vg;var iy="[\0- -\u2029 ]",sy=new RegExp(iy),ly=new RegExp(`${iy}$`),ay=new RegExp(iy,"g");function cy(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(ay,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var uy=Ef.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?ny(e.scheme,e.optionalSlashes):ny(e)})},onDestroy(){Tm.groups={},ty.scanner=null,ty.parser=null,ty.tokenQueue=[],ty.pluginQueue=[],ty.customSchemes=[],ty.initialized=!1},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!cy(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!cy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!cy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mh(this.options.HTMLAttributes,e),0]:["a",Mh(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;const r=(null==(n=e.attrs)?void 0:n.href)||"";return`[${t.renderChildren(e)}](${r})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!cy(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=>!!cy(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[Xf({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=oy(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!cy(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;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!cy(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new aa({key:new da("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 $h(bh(t.doc,[...e])).forEach(({newRange:e})=>{const t=function(e,t){const n=[];return e.nodesBetween(t.from,t.to,(e,t)=>{(e=>e.isTextblock)(e)&&n.push({node:e,pos:t})}),n}(n.doc,e);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(!ly.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(sy).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],a=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=ry(t).map(e=>e.toObject(r.defaultProtocol));if(!(1===(l=c).length?l[0].isLink:3===l.length&&l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:a+e.start+1,to:a+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=>{Lh(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 l}),s.steps.length?s:void 0}}))),!0===this.options.openOnClick&&e.push(function(e){return new aa({key:new da("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{let e=r.target;const t=[];for(;"DIV"!==e.nodeName;)t.push(e),e=e.parentNode;s=t.find(e=>"A"===e.nodeName)}if(!s)return!1;const l=zh(t.state,e.type.name),a=null!=(o=null==s?void 0:s.href)?o:l.href,c=null!=(i=null==s?void 0:s.target)?i:l.target;return e.enableClickSelection&&e.editor.commands.extendMarkRange(e.type.name),!(!s||!a||(window.open(a,c),0))}}})}({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new aa({key:new da("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(e=>{a+=e.textContent});const c=oy(a,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!(!a||!c||void 0!==o&&!o(c.href))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e;var r}}),dy=uy,py=Yf.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Mh(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];return 1===n.length&&"image"===n[0].type?t.parseChildren([n[0]]):t.createNode("paragraph",void 0,t.parseInline(n))},renderMarkdown:(e,t)=>e&&Array.isArray(e.content)?t.renderChildren(e.content):"",addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,my=Ef.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}]},renderHTML({HTMLAttributes:e}){return["s",Mh(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[Vf({find:hy,type:this.type})]},addPasteRules(){return[Xf({find:fy,type:this.type})]}}),gy=Ef.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(e){return"sub"===e&&null}}]},renderHTML({HTMLAttributes:e}){return["sub",Mh(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),yy=Ef.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(e){return"super"===e&&null}}]},renderHTML({HTMLAttributes:e}){return["sup",Mh(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),by=Yf.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),vy=Ef.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}]},renderHTML({HTMLAttributes:e}){return["u",Mh(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return 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()}}}),wy=window.ReactDOM,Ey=n(6886),xy=n(9370),ky=n(8061),Sy=n(5544),Cy=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},Ty=({contentComponent:e})=>{const t=(0,Ey.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,xy.jsx)(xy.Fragment,{children:Object.values(t)})},My=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(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(e.view.dom),e.setOptions({element:t}),e.contentComponent=function(){const e=new Set;let t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:wy.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(e=>e())}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.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.firstChild))return;const n=document.createElement("div");n.append(t.view.dom),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return(0,xy.jsxs)(xy.Fragment,{children:[(0,xy.jsx)("div",{ref:Cy(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,xy.jsx)(Ty,{contentComponent:e.contentComponent})]})}},Oy=(0,e.forwardRef)((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(My,{key:r,innerRef:n,...t})}),Iy=e.memo(Oy),Py="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,Ay=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)}}}};function Dy(t){var n;const[r]=(0,e.useState)(()=>new Ay(t.editor)),o=(0,Sy.useSyncExternalStoreWithSelector)(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:ky);return Py(()=>r.watch(t.editor),[t.editor,r]),(0,e.useDebugValue)(o),o}var _y="undefined"==typeof window,Ny=_y||Boolean("undefined"!=typeof window&&window.next),Ry=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?_y||Ny?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 Bf(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)}};(0,e.createContext)({editor:null}).Consumer;var zy=(0,e.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});function $y(){return $y=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},$y.apply(null,arguments)}e.forwardRef((t,n)=>{const{onDragStart:r}=(0,e.useContext)(zy),o=t.as||"div";return(0,xy.jsx)(o,{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})}),e.createContext({markViewContentRef:()=>{}});const Ly="i",By="b",Vy="u",jy=e.forwardRef((t,n)=>{const{value:r,setValue:o,editorProps:i={},elementClasses:s="",autofocus:l=!1,sx:a={},onBlur:c,expectedTag:u=null,onEditorCreate:d,wrapperClassName:p,onSelectionEnd:h}=t,f=(0,e.useRef)(null),m=u?"block+":"inline*",g=e=>({...e,class:s}),y=function(t={},n=[]){const r=(0,e.useRef)(t);r.current=t;const[o]=(0,e.useState)(()=>new Ry(r)),i=(0,Ey.useSyncExternalStore)(o.subscribe,o.getEditor,o.getServerSnapshot);return(0,e.useDebugValue)(i),(0,e.useEffect)(o.onRender(n)),Dy({editor:i,selector:({transactionNumber:e})=>!1===t.shouldRerenderOnTransaction||void 0===t.shouldRerenderOnTransaction?null:t.immediatelyRender&&0===e?0:e+1}),i}({extensions:[om.extend({content:m}),py.extend({renderHTML({HTMLAttributes:e}){return[u??"p",g(e),0]}}),am.extend({renderHTML({node:e,HTMLAttributes:t}){return u?[u,g(t),0]:[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,g(t),0]}}).configure({levels:[1,2,3,4,5,6]}),dy.configure({openOnClick:!1}),by,rm,hm,my,yy,gy,vy,sm.extend({addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.setHardBreak()}}})],content:r,onUpdate:({editor:e})=>{const t=e.getHTML();o(function(e=""){if(!e)return!0;const t=document.createElement("div");return t.innerHTML=e,!t.textContent?.length}(t)?null:t)},autofocus:l,editorProps:{...i,handleDOMEvents:{keydown:(e,t)=>{"Escape"===t.key&&c?.(),!t.metaKey&&!t.ctrlKey||t.altKey||[Ly,By,Vy].includes(t.key)&&t.stopPropagation()}},attributes:{...i.attributes??{},role:"textbox"}},onCreate:d?({editor:e})=>d(e):void 0,onSelectionUpdate:h?({editor:e})=>h(e.view):void 0});return Uy(()=>{y&&y.getHTML()!==r&&y.commands.setContent(r,{emitUpdate:!1})},[y,r]),e.createElement(e.Fragment,null,e.createElement(Fy,{containerRef:f,editor:y,sx:a,onBlur:c,className:p},e.createElement(Iy,{ref:n,editor:y})))}),Fy=({children:t,containerRef:n,editor:r,sx:i,onBlur:s,className:l})=>{const a=e.createElement(o.Box,$y({ref:n},i,{className:l}),t);return s?e.createElement(o.ClickAwayListener,{onClickAway:e=>{n.current?.contains(e.target)||r.view.dom.contains(e.target)||s?.()}},a):e.createElement(e.Fragment,null,a)},Uy=(t,n)=>{const r=(0,e.useRef)(!1);(0,e.useEffect)(()=>{r.current?t():r.current=!0},n)};function Hy(){return Hy=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},Hy.apply(null,arguments)}const Wy=D(({sx:n,attributes:r,props:i})=>{const{value:s,setValue:l}=b(t.htmlPropTypeUtil);return e.createElement(Y,null,e.createElement(o.Box,Hy({sx:{p:.8,border:"1px solid",borderColor:"grey.200",borderRadius:"8px",transition:"border-color .2s ease, box-shadow .2s ease","&:hover":{borderColor:"black"},"&:focus-within":{borderColor:"black",boxShadow:"0 0 0 1px black"},"& .ProseMirror:focus":{outline:"none"},"& .ProseMirror":{minHeight:"70px",fontSize:"12px","& a":{color:"inherit"},"& .elementor-inline-editor-reset":{margin:0,padding:0}},".strip-styles *":{all:"unset"},...n}},r,i),e.createElement(jy,{value:s||"",setValue:e=>l(e??"")})))}),Gy=(0,i.__)("Display Conditions","elementor"),qy=D(()=>{const[t,n]=(0,e.useState)(!1),r=window.elementor?.config?.v4Promotions?.displayConditions;return e.createElement(o.Stack,{direction:"row",spacing:2,sx:{justifyContent:"flex-end",alignItems:"center"}},e.createElement(Q.PromotionInfotip,{title:r?.title??"",content:r?.content??"",assetUrl:r?.image??"",ctaUrl:r?.ctaUrl??"",open:t,onClose:()=>n(!1)},e.createElement(o.Box,{onClick:()=>n(e=>!e),sx:{cursor:"pointer",display:"inline-flex"}},e.createElement(Q.PromotionChip,null))),e.createElement(o.Tooltip,{title:Gy,placement:"top"},e.createElement(o.IconButton,{size:"tiny","aria-label":Gy,"data-behavior":"display-conditions",onClick:()=>n(e=>!e),sx:{border:"1px solid",borderColor:"divider",borderRadius:1}},e.createElement(j.SitemapIcon,{fontSize:"tiny",color:"disabled"}))))}),Ky=(0,o.styled)(o.IconButton)(({theme:e})=>({width:e.spacing(2.5),height:e.spacing(2.5)})),Jy=({tooltipText:t,onClick:n,disabled:r,size:i="tiny"})=>e.createElement(o.Tooltip,{title:t,placement:"top",disableInteractive:!0},e.createElement(Ky,{"aria-label":t,size:i,onClick:n,disabled:r},e.createElement(j.BrushBigIcon,{fontSize:i})));function Yy(){return Yy=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},Yy.apply(null,arguments)}const Xy="tiny",Qy=({label:t,itemSettings:n,disabled:r=!1,openOnAdd:s=!1,values:l=[],setValues:a,showDuplicate:c=!0,showToggle:u=!0,showRemove:d=!0,disableAddItemButton:p=!1,addButtonInfotipContent:h,openItem:f=-1,isSortable:m=!0})=>{const[g,y]=(0,e.useState)(f),b=l.map((e,t)=>m&&"getId"in n?n.getId({item:e,index:t}):String(t)),v=r||p,w=v&&h,E=e.createElement(o.IconButton,{size:Xy,sx:{ml:"auto"},disabled:v,onClick:()=>{const e=structuredClone(n.initialValues),t=l.length;a([...l,e],{},{action:{type:"add",payload:[{index:t,item:e}]}}),s&&y(t)},"aria-label":(0,i.__)("Add item","elementor")},e.createElement(j.PlusIcon,{fontSize:Xy}));return e.createElement(Pe,{gap:2},e.createElement(Ct,{label:t,adornment:T},w?e.createElement(o.Infotip,{placement:"right",content:h,color:"secondary",slotProps:{popper:{sx:{width:300}}}},e.createElement(o.Box,{sx:{...v?{cursor:"not-allowed"}:{}}},E)):E),0<b.length&&e.createElement(Ge,{value:b,onChange:(e,t)=>{a(e.map(e=>l[b.indexOf(e)]),{},{action:{type:"reorder",payload:{...t}}})}},b.map(t=>{const o=b.indexOf(t),i=l[o];return i?e.createElement(qe,{id:t,key:`sortable-${t}`,disabled:!m},e.createElement(Zy,{disabled:r,propDisabled:i?.disabled,label:e.createElement(it,{value:i},e.createElement(n.Label,{value:i,index:o})),startIcon:e.createElement(rt,{value:i},e.createElement(n.Icon,{value:i})),removeItem:()=>(e=>{const t=l[e];a(l.filter((t,n)=>n!==e),{},{action:{type:"remove",payload:[{index:e,item:t}]}})})(o),duplicateItem:()=>(e=>{const t=structuredClone(l[e]),n=1+e;a([...l.slice(0,n),t,...l.slice(n)],{},{action:{type:"duplicate",payload:[{index:e,item:t}]}})})(o),toggleDisableItem:()=>(e=>{a(l.map((t,n)=>{if(n===e){const{disabled:e,...n}=t;return{...n,...e?{}:{disabled:!0}}}return t}),{},{action:{type:"toggle-disable"}})})(o),openOnMount:s&&g===o,onOpen:()=>y(-1),showDuplicate:c,showToggle:u,showRemove:d,actions:n.actions,value:i},t=>e.createElement(n.Content,Yy({},t,{value:i,bind:String(o),index:o})))):null})))},Zy=({label:t,propDisabled:n,startIcon:r,children:s,removeItem:l,duplicateItem:a,toggleDisableItem:c,openOnMount:u,onOpen:d,showDuplicate:p,showToggle:h,showRemove:f,disabled:m,actions:g,value:y})=>{const{popoverState:b,popoverProps:v,ref:w,setRef:E}=eb(u,d),x=(0,i.__)("Duplicate","elementor"),k=n?(0,i.__)("Show","elementor"):(0,i.__)("Hide","elementor"),S=(0,i.__)("Remove","elementor");return e.createElement(e.Fragment,null,e.createElement(tt,Yy({disabled:m,label:t,ref:E,"aria-label":(0,i.__)("Open item","elementor")},(0,o.bindTrigger)(b),{startIcon:r,actions:e.createElement(e.Fragment,null,p&&e.createElement(o.Tooltip,{title:x,placement:"top"},e.createElement(o.IconButton,{size:Xy,onClick:a,"aria-label":x},e.createElement(j.CopyIcon,{fontSize:Xy}))),h&&e.createElement(o.Tooltip,{title:k,placement:"top"},e.createElement(o.IconButton,{size:Xy,onClick:c,"aria-label":k},n?e.createElement(j.EyeOffIcon,{fontSize:Xy}):e.createElement(j.EyeIcon,{fontSize:Xy}))),g?.(y),f&&e.createElement(o.Tooltip,{title:S,placement:"top"},e.createElement(o.IconButton,{size:Xy,onClick:l,"aria-label":S},e.createElement(j.XIcon,{fontSize:Xy}))))})),e.createElement(vt,Yy({width:w?.getBoundingClientRect().width},v,{anchorEl:w}),e.createElement(o.Box,null,s({anchorEl:w}))))},eb=(t,n)=>{const[r,i]=(0,e.useState)(null),s=(0,o.usePopupState)({variant:"popover"}),l=(0,o.bindPopover)(s);return(0,e.useEffect)(()=>{t&&r&&(s.open(r),n?.())},[r]),{popoverState:s,ref:r,setRef:i,popoverProps:l}};function tb(){return tb=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},tb.apply(null,arguments)}const nb=({popupState:t,restoreValue:n,anchorRef:r,value:s,onChange:l,openInNewTab:a,onToggleNewTab:c})=>{const u=(0,e.useRef)(null);(0,e.useEffect)(()=>{t.isOpen&&requestAnimationFrame(()=>u.current?.focus())},[t.isOpen]);const d=()=>{n(),t.close()};return e.createElement(o.Popover,tb({slotProps:{paper:{sx:{borderRadius:"16px",width:r.current?.offsetWidth+"px",marginTop:-1}}}},(0,o.bindPopover)(t),{anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:d}),e.createElement(o.Stack,{direction:"row",alignItems:"center",gap:1,sx:{p:1.5}},e.createElement(o.TextField,{value:s,onChange:l,size:"tiny",fullWidth:!0,placeholder:(0,i.__)("Type a URL","elementor"),inputProps:{ref:u},color:"secondary",InputProps:{sx:{borderRadius:"8px"}},onKeyUp:e=>"Enter"===e.key&&d()}),e.createElement(o.Tooltip,{title:(0,i.__)("Open in a new tab","elementor")},e.createElement(o.ToggleButton,{size:"tiny",value:"newTab",selected:a,onClick:c,"aria-label":(0,i.__)("Open in a new tab","elementor"),sx:{borderRadius:"8px"}},e.createElement(j.ExternalLinkIcon,{fontSize:"tiny"})))))},rb=({editor:t,elementId:n,sx:r={}})=>{const[i,s]=(0,e.useState)(""),[l,a]=(0,e.useState)(!1),c=(0,e.useRef)(null),u=(0,o.usePopupState)({variant:"popover"}),d=!!n&&ob(n),p=Dy({editor:t,selector:e=>ab.filter(t=>e.editor.isActive(t))}),h=(0,e.useMemo)(()=>{const e=Object.values(lb);return d?e.filter(e=>"link"!==e.action):e},[d]);return e.useEffect(()=>{t?.commands?.focus()},[t]),e.createElement(o.Box,{ref:c,sx:{display:"inline-flex",gap:.5,padding:.5,borderRadius:"8px",backgroundColor:"background.paper",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)",alignItems:"center",visibility:u.isOpen?"hidden":"visible",pointerEvents:u.isOpen?"none":"all",...r}},e.createElement(o.Tooltip,{title:sb.label,placement:"top",sx:{borderRadius:"8px"}},e.createElement(o.IconButton,{"aria-label":sb.label,onClick:()=>sb.method(t),size:"tiny"},sb.icon)),e.createElement(o.ToggleButtonGroup,{value:p,size:"tiny",sx:{display:"flex",gap:.5,border:"none",[`& .${o.toggleButtonGroupClasses.firstButton}, & .${o.toggleButtonGroupClasses.middleButton}, & .${o.toggleButtonGroupClasses.lastButton}`]:{borderRadius:"8px",border:"none",marginLeft:0,"&.Mui-selected":{marginLeft:0},"& + &.Mui-selected":{marginLeft:0}}}},h.map(n=>e.createElement(o.Tooltip,{title:n.label,key:n.action,placement:"top"},e.createElement(o.ToggleButton,{value:n.action,"aria-label":n.label,size:"tiny",onClick:()=>{"link"===n.action?(()=>{const e=t.getAttributes("link");s(e.href||""),a("_blank"===e.target),u.open(c.current)})():n.method?.(t),t?.commands?.focus()}},n.icon)))),e.createElement(nb,{popupState:u,anchorRef:c,restoreValue:()=>{i?t.chain().focus().setLink({href:i,target:l?"_blank":"_self"}).run():t.chain().focus().unsetLink().run(),n&&window.dispatchEvent(new CustomEvent("elementor:inline-link-changed",{detail:{elementId:n}})),u.close()},value:i,onChange:e=>{s(e.target.value)},openInNewTab:l,onToggleNewTab:()=>{a(!l)}}))},ob=e=>!!(0,On.getElementSetting)(e,"link")?.value?.destination,ib={clear:{label:(0,i.__)("Clear","elementor"),icon:e.createElement(j.MinusIcon,{fontSize:"tiny"}),action:"clear",method:e=>{e.chain().focus().clearNodes().unsetAllMarks().run()}},bold:{label:(0,i.__)("Bold","elementor"),icon:e.createElement(j.BoldIcon,{fontSize:"tiny"}),action:"bold",method:e=>{e.chain().focus().toggleBold().run()}},italic:{label:(0,i.__)("Italic","elementor"),icon:e.createElement(j.ItalicIcon,{fontSize:"tiny"}),action:"italic",method:e=>{e.chain().focus().toggleItalic().run()}},underline:{label:(0,i.__)("Underline","elementor"),icon:e.createElement(j.UnderlineIcon,{fontSize:"tiny"}),action:"underline",method:e=>{e.chain().focus().toggleUnderline().run()}},strike:{label:(0,i.__)("Strikethrough","elementor"),icon:e.createElement(j.StrikethroughIcon,{fontSize:"tiny"}),action:"strike",method:e=>{e.chain().focus().toggleStrike().run()}},superscript:{label:(0,i.__)("Superscript","elementor"),icon:e.createElement(j.SuperscriptIcon,{fontSize:"tiny"}),action:"superscript",method:e=>{e.chain().focus().toggleSuperscript().run()}},subscript:{label:(0,i.__)("Subscript","elementor"),icon:e.createElement(j.SubscriptIcon,{fontSize:"tiny"}),action:"subscript",method:e=>{e.chain().focus().toggleSubscript().run()}},link:{label:(0,i.__)("Link","elementor"),icon:e.createElement(j.LinkIcon,{fontSize:"tiny"}),action:"link",method:null}},{clear:sb,...lb}=ib,ab=Object.keys(lb)}(),(window.elementorV2=window.elementorV2||{}).editorControls=r}(),window.elementorV2.editorControls?.init?.();
[-] editor-controls.js.LICENSE.txt
[edit]
[-] editor-controls.js
[edit]
[+]
..
[-] editor-controls.strings.js
[edit]
[-] editor-controls.min.js.LICENSE.txt
[edit]
[-] editor-controls.min.js
[edit]
[-] editor-controls.asset.php
[edit]