[ SYSTEM ]: Linux wordpress 6.1.0-44-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
[ SERVER ]: Apache/2.4.66 (Debian) | PHP: 8.2.30
[ USER ]: www-data | IP: 172.19.30.54
GEFORCE FILE MANAGER
/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
elementor
/
assets
/
js
/
packages
/
editor-controls
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📄 editor-controls.asset.php
686 B
SET
[ EDIT ]
|
[ DEL ]
📄 editor-controls.js
693,663 B
SET
[ EDIT ]
|
[ DEL ]
📄 editor-controls.js.LICENSE.txt
71,326 B
SET
[ EDIT ]
|
[ DEL ]
📄 editor-controls.min.js
480,299 B
SET
[ EDIT ]
|
[ DEL ]
📄 editor-controls.min.js.LICENSE.txt
781 B
SET
[ EDIT ]
|
[ DEL ]
📄 editor-controls.strings.js
11,101 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: editor-controls.min.js
/*! For license information please see editor-controls.min.js.LICENSE.txt */ !function(){var e={1020: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},2162:function(e,t,n){"use strict";var r=n(7557),o=n(9888),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}},4353: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+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={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]=f;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 f(e){this.$L=x(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var g=f.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)},m=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)},f=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=(f<v?f+7:f)-v;return h(c?y-w:y+(6-w),g);case s:case d:return m(b+"Hours",0);case i:return m(b+"Minutes",1);case o:return m(b+"Seconds",2);case r:return m(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],m=c===s?this.$D+(t-this.$W):t;if(c===a||c===u){var f=this.clone().set(d,1);f.$d[h](m),f.init(),this.$d=f.set(d,Math.min(this.$D,f.daysInMonth())).$d}else h&&this.$d[h](m);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),m=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 m(1);if(h===l)return m(7);var f=(d={},d[o]=e,d[i]=t,d[r]=1e3,d)[h]||1,g=this.$d.getTime()+n*f;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")},f=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return 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 f(i,s,!0);case"A":return f(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,m=this,f=S.p(d),g=k(n),y=(g.utcOffset()-this.utcOffset())*e,b=this-g,v=function(){return S.m(m,g)};switch(f){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()},f}(),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}()},4848:function(e,t,n){"use strict";e.exports=n(1020)},7557:function(e){"use strict";e.exports=window.React},8493: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},9242:function(e,t,n){"use strict";e.exports=n(2162)},9888:function(e,t,n){"use strict";e.exports=n(8493)}},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 rr},AttributesControl:function(){return Av},BackgroundControl:function(){return oo},BoxShadowRepeaterControl:function(){return St},ChipsControl:function(){return nn},ClearIconButton:function(){return Nv},ColorControl:function(){return Pe},ControlActionsProvider:function(){return G},ControlAdornments:function(){return T},ControlAdornmentsProvider:function(){return S},ControlFormLabel:function(){return x},ControlReplacementsProvider:function(){return I},ControlToggleButtonGroup:function(){return an},DateTimeControl:function(){return Ki},DisplayConditionsControl:function(){return Iv},EmailFormActionControl:function(){return Kb},EqualUnequalSizesControl:function(){return yn},FilterRepeaterControl:function(){return Yt},FontFamilyControl:function(){return Mn},GapControl:function(){return Qn},HtmlTagControl:function(){return Xn},ImageControl:function(){return ee},InlineEditingControl:function(){return Nb},InlineEditor:function(){return _b},InlineEditorToolbar:function(){return Fv},ItemSelector:function(){return xn},KeyValueControl:function(){return wo},LinkControl:function(){return Hn},LinkedDimensionsControl:function(){return vn},NumberControl:function(){return fn},NumberInput:function(){return he},PopoverContent:function(){return Et},PopoverGridContainer:function(){return xt},PositionControl:function(){return xo},PromotionTrigger:function(){return Tv},PropKeyProvider:function(){return m},PropProvider:function(){return d},QueryControl:function(){return Vn},RepeatableControl:function(){return co},Repeater:function(){return $v},SelectControl:function(){return Z},SelectControlWrapper:function(){return en},SizeComponent:function(){return vv},SizeControl:function(){return Ce},StrokeControl:function(){return Ae},SvgMediaControl:function(){return br},SwitchControl:function(){return jn},TextAreaControl:function(){return oe},TextControl:function(){return re},ToggleButtonGroupUi:function(){return ln},ToggleControl:function(){return pn},TransformRepeaterControl:function(){return bi},TransformSettingsControl:function(){return fi},TransitionRepeaterControl:function(){return Hi},UnstableSizeControl:function(){return Cv},UnstableSizeField:function(){return ew},UrlControl:function(){return On},VideoMediaControl:function(){return wr},createControl:function(){return N},createControlReplacementsRegistry:function(){return _},enqueueFont:function(){return Cn},getControlReplacements:function(){return D},injectIntoRepeaterItemActions:function(){return st},injectIntoRepeaterItemIcon:function(){return nt},injectIntoRepeaterItemLabel:function(){return ot},isUnitExtendedOption:function(){return ue},registerControlReplacement:function(){return A},trackUpgradePromotionClick:function(){return _i},trackViewPromotion:function(){return Pi},transitionProperties:function(){return Si},transitionsItemsList:function(){return Ci},useBoundProp:function(){return b},useControlActions:function(){return K},useControlReplacement:function(){return P},useFontFamilies:function(){return rw},useSyncExternalState:function(){return Ee},useTypingBuffer:function(){return se}});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),m=({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(f,{bind:n},t);throw new a({context:{propType:r}})},f=({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}}},_=()=>{const e=[];return{registerControlReplacement:function(t){e.push(t)},getControlReplacements:function(){return e}}},{registerControlReplacement:A,getControlReplacements:D}=_();function N(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 R=window.elementorV2.query,z=window.elementorV2.httpClient;const $="elementor/v1/settings",L=e=>e.data.value,B="elementor_unfiltered_files_upload",V={queryKey:[B]},j=()=>(0,R.useQuery)({...V,queryFn:()=>{return(e=B,(0,z.httpService)().get(`${$}/${e}`).then(e=>L(e.data))).then(e=>F(e));var e},staleTime:1/0}),F=e=>Boolean("1"===e);var U=window.elementorV2.icons,H=window.elementorV2.wpMedia,W=window.elementorV2.editorUi;const q=(0,e.createContext)(null),G=({children:t,items:n})=>e.createElement(q.Provider,{value:{items:n}},t),K=()=>{const t=(0,e.useContext)(q);if(!t)throw new Error("useControlActions must be used within a ControlActionsProvider");return t};function J({children:t}){const{items:n}=K(),{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.FloatingActionsBar,{actions:o},t)}const Y=N(({mediaTypes:n=["image"]})=>{const{value:r,setValue:s,propType:l}=b(t.imageSrcPropTypeUtil),{id:a,url:c}=r??{},{data:u,isFetching:d}=(0,H.useWpMediaAttachment)(a?.value||null),p=u?.url??c?.value??null,{open:h}=(0,H.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(J,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(U.UploadIcon,null),onClick:()=>h({mode:"upload"})},(0,i.__)("Upload","elementor"))))))});function X(){return X=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},X.apply(null,arguments)}const Q={MenuListProps:{sx:{maxHeight:"160px"}}},Z=N(({options:n,onChange:r,MenuProps:i=Q,ariaLabel:s})=>{const{value:l,setValue:a,disabled:c,placeholder:u}=b(t.stringPropTypeUtil),d=c||0===n.length;return e.createElement(J,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(W.MenuListItem,X({key:n.value},n,{value:n.value??""}),t))))}),ee=N(({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(te,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(ne,{sizes:n})))))}),te=()=>{const{data:t}=j(),n=t?["image","svg"]:["image"];return e.createElement(m,{bind:"src"},e.createElement(Y,{mediaTypes:n}))},ne=({sizes:t})=>e.createElement(m,{bind:"size"},e.createElement(Z,{options:t})),re=N(({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(J,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}:{}}}))}),oe=N(({placeholder:n,ariaLabel:r})=>{const{value:i,setValue:s,disabled:l}=b(t.stringPropTypeUtil);return e.createElement(J,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 ie=window.elementorV2.editorResponsive;function se(t={}){const{limit:n=3,timeout:r=600}=t,o=(0,e.useRef)(""),i=(0,e.useRef)(null);return(0,e.useEffect)(()=>()=>{o.current="",i.current&&(clearTimeout(i.current),i.current=null)},[]),{buffer:o.current,appendKey:e=>(o.current=(o.current+e).slice(-n),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{o.current="",i.current=null},r),o.current),startsWith:(e,t)=>!(3<e.length&&2>t.length)&&e.startsWith(t)}}const le=["px","%","em","rem","vw","vh","ch"],ae=["auto","custom"],ce=NaN;function ue(e){return ae.includes(e)}function de(){return de=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},de.apply(null,arguments)}const pe=["e","E","+"],he=(0,e.forwardRef)((t,n)=>{const[r,i]=(0,e.useState)(0);return e.createElement(o.TextField,de({},t,{ref:n,key:r,onKeyDown:e=>{!function(e,t){const n=[...pe];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 fe=(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},m)=>{const{placeholder:f}=b(t.sizePropTypeUtil);return e.createElement(he,{ref:m,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(f?.size??"")||void 0),InputProps:c,inputProps:u,id:h})}),ge=({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(ye,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(W.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()))))},ye=(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"})),be=({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:m,id:f,ariaLabel:g})=>{const{appendKey:y,startsWith:b}=se(),v=ue(d)?"text":"number",w=!ue(d)&&Number.isNaN(u)?"":u??"",E={"aria-controls":p.isOpen?p.popupId:void 0,"aria-haspopup":!0},x=t.includes("custom")?{custom:E}:void 0,k={custom:e.createElement(U.MathFunctionIcon,{fontSize:"tiny"})},S={...E,readOnly:ue(d),autoComplete:"off",onClick:c,onFocus:a,startAdornment:s?e.createElement(o.InputAdornment,{position:"start",disabled:h},s):void 0,endAdornment:e.createElement(ge,{disabled:h,options:t,onClick:n,value:d,alternativeOptionLabels:k,menuItemsAttributes:x})};return e.createElement(J,null,e.createElement(o.Box,null,e.createElement(fe,{disabled:h,placeholder:i,type:v,value:w,onChange:r,onKeyDown:e=>{const{key:r,altKey:o,ctrlKey:i,metaKey:s}=e;if(o||i||s)return;if(ue(d)&&!isNaN(Number(r))){const e=t?.[0];return void(e&&n(e))}if(!/^[a-zA-Z%]$/.test(r))return;e.preventDefault();const l=r.toLowerCase(),a=y(l),c=t.find(e=>b(e,a));c&&n(c)},onBlur:l,InputProps:S,inputProps:{min:m,step:"any","aria-label":g},isPopoverOpen:p.isOpen,id:f})))};function ve(){return ve=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},ve.apply(null,arguments)}const we=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,ve({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(W.PopoverHeader,{title:(0,i.__)("CSS function","elementor"),onClose:u,icon:e.createElement(U.MathFunctionIcon,{fontSize:"tiny"})}),e.createElement(o.TextField,{value:l,onChange:a,onKeyPress:e=>{"enter"===e.key.toLowerCase()&&u()},size:"tiny",type:"text",fullWidth:!0,inputProps:{ref:c},sx:{pt:0,pr:1.5,pb:1.5,pl:1.5}}))},Ee=({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)}]},xe={length:"px",angle:"deg",time:"ms"},ke={length:[...le],angle:["deg","rad","grad","turn"],time:["s","ms"]},Se="fx",Ce=N(({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:m})=>{const{value:f,setValue:g,disabled:y,restoreValue:v,placeholder:w,propType:E}=b(t.sizePropTypeUtil),x=r??w?.unit??xe[n],k=(0,ie.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=[...ke[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:ue(o)||isNaN(Number(i))||!i&&0!==i?ce:Number(i),custom:"custom"===o?String(i):r,unit:o}}(f,x),[f,x]),[O,I]=Ee({external:M,setExternal:(e,t,n)=>g(Me(e),t,n),persistWhen:e=>!!Me(e),fallback:e=>({unit:e?.unit??x,numeric:e?.numeric??ce,custom:e?.custom??""})}),{size:P=ce,unit:_=x}=Me(O,!0)||{},A=e=>{const t=e.target.value,n=e.target.validity.valid;"auto"!==_?I(e=>({...e,["custom"===_?"custom":"numeric"]:Te(t,_),unit:_}),void 0,{validation:()=>n}):I(e=>({...e,unit:_}))},D=e.useCallback(()=>{T&&T.isOpen&&T.close()},[T]);return(0,e.useEffect)(()=>{D()},[k]),e.createElement(e.Fragment,null,e.createElement(be,{disabled:y,size:P,unit:_,units:[...C],placeholder:s,startIcon:l,handleSizeChange:A,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:m}),a?.current&&T.isOpen&&e.createElement(we,{popupState:T,anchorRef:a,restoreValue:v,value:P,onChange:A}))});function Te(e,t){return ue(t)?"auto"===t?"":String(e??""):e||0===e?Number(e):NaN}function Me(e,t=!1){if(!e)return null;if(!e?.unit)return{size:ce,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 Oe=({gap:t=.5,sx:n,children:r})=>e.createElement(o.Stack,{gap:t,sx:{...n}},r);function Ie(){return Ie=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},Ie.apply(null,arguments)}const Pe=N(({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(J,null,e.createElement(o.UnstableColorField,Ie({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"],Ae=N(()=>{const n=b(t.strokePropTypeUtil),r=(0,e.useRef)(null);return e.createElement(d,n,e.createElement(Oe,null,e.createElement(De,{bind:"width",label:(0,i.__)("Stroke width","elementor"),ref:r},e.createElement(Ce,{units:_e,anchorRef:r})),e.createElement(De,{bind:"color",label:(0,i.__)("Stroke color","elementor")},e.createElement(Pe,null))))}),De=(0,e.forwardRef)(({bind:t,label:n,children:r},i)=>e.createElement(m,{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)))),Ne=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()}},Re=(0,e.createContext)({index:-1,value:{}}),ze=(0,e.createContext)(null),$e=()=>{const t=e.useContext(ze),n=e.useContext(Re);if(!t)throw new Error("useRepeaterContext must be used within a RepeaterContextProvider");return{...t,...n}},Le=({children:t,initial:n,propTypeUtil:r,isItemDisabled:i=()=>!1})=>{const{value:s,setValue:l}=b(r),[a,c]=Ee({external:s,fallback:()=>[],setExternal:l,persistWhen:()=>!0}),[u,d]=(0,e.useState)(()=>a?.map(()=>Be())??[]);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},Be)]})},[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,m]=(0,e.useState)(-1),[f,g]=(0,e.useState)(null),y=-1!==h,v=(0,o.usePopupState)({variant:"popover"});return e.createElement(ze.Provider,{value:{isOpen:y,openItemIndex:h,setOpenItemIndex:m,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=Be(),l=[...a];l.splice(i,0,o),c(l),d([...u.slice(0,i),s,...u.slice(i)]),m(i),v.open(f??e),Ne.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)),Ne.emit(`${r.key}-item-removed`,{itemValue:t?.value})},rowRef:f,setRowRef:g,isItemDisabled:e=>i(p[e].item)}},t)},Be=()=>Date.now()+Math.floor(1e6*Math.random()),Ve="tiny",je=({disabled:t=!1,enableTooltip:n=!1,tooltipContent:r=null,newItemIndex:s,ariaLabel:l})=>{const{addItem:a}=$e();return e.createElement(Fe,{content:r,enable:n},e.createElement(o.Box,{component:"span",sx:{cursor:t?"not-allowed":"pointer"}},e.createElement(o.IconButton,{size:Ve,disabled:t,onClick:e=>a(e,{index:s}),"aria-label":(0,i.sprintf)((0,i.__)("Add %s item","elementor"),l?.toLowerCase())},e.createElement(U.PlusIcon,{fontSize:Ve}))))},Fe=({children:t,enable:n,content:r})=>n&&r?e.createElement(o.Infotip,{placement:"right",color:"secondary",content:r},t):t;function Ue(){return Ue=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},Ue.apply(null,arguments)}const He=t=>e.createElement(o.List,{sx:{p:0,my:-.5,mx:0}},e.createElement(o.UnstableSortableProvider,Ue({restrictAxis:!0,disableDragOverlay:!1,variant:"static"},t))),We=({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(qe,Ue({},t,{style:i,tabIndex:-1}),!r&&e.createElement(Ge,Ue({},o,{style:s})),n,l&&e.createElement(Ke,{style:a}))}),qe=(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; } } `,Ge=t=>e.createElement("div",Ue({},t,{role:"button",className:"class-item-sortable-trigger",tabIndex:0,"aria-label":(0,i.__)("Drag item","elementor")}),e.createElement(U.GripVerticalIcon,{fontSize:"tiny"})),Ke=(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}; } `,Je=({isSortable:t=!0,children:n})=>{const{items:r,setItems:o}=$e(),i=r.map(({key:e})=>e);return n?e.createElement(e.Fragment,null,e.createElement(He,{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(We,{id:o,key:`sortable-${o}`,disabled:!t},e.createElement(Re.Provider,{value:{index:i,value:s}},n))}))):null},Ye=(0,e.createContext)(void 0),Xe=()=>{const t=(0,e.useContext)(Ye);if(!t)throw new Error("useRepeatableControlContext must be used within RepeatableControl");return t};function Qe(){return Qe=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},Qe.apply(null,arguments)}const Ze=(0,e.forwardRef)((t,n)=>e.createElement(o.UnstableTag,Qe({ref:n,fullWidth:!0,showActionsOnHover:!0,variant:"outlined",sx:{minHeight:e=>e.spacing(3.5)}},t)));var et=window.elementorV2.locations;const{Slot:tt,inject:nt}=(0,et.createReplaceableLocation)(),{Slot:rt,inject:ot}=(0,et.createReplaceableLocation)(),{Slot:it,inject:st}=(0,et.createLocation)();function lt(){return lt=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},lt.apply(null,arguments)}const at=({Label:t,Icon:n,actions:r})=>{const{popoverState:s,setRowRef:l,openItemIndex:a,setOpenItemIndex:c,index:u=-1,value:d,isItemDisabled:p}=$e(),h=e.useContext(Ye),m=!!h?.props?.readOnly,f=(0,o.bindTrigger)(s);return e.createElement(Ze,lt({ref:e=>{e&&a===u&&e!==s.anchorEl&&(l(e),s.setAnchorEl(e))},label:e.createElement(rt,{value:d},e.createElement(t,{value:d})),"aria-label":(0,i.__)("Open item","elementor")},f,{onClick:e=>{m||p(u)||(f.onClick(e),c(u))},startIcon:e.createElement(tt,{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(it,{index:u??-1}),r)}))},ct=({children:t,initial:n,propTypeUtil:r,isItemDisabled:o})=>e.createElement(Oe,null,e.createElement(Le,{initial:n,propTypeUtil:r,isItemDisabled:o},t)),ut="tiny",dt=()=>{const{items:t,updateItem:n,index:r=-1}=$e();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:ut,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(U.EyeOffIcon,{fontSize:ut}):e.createElement(U.EyeIcon,{fontSize:ut})))},pt="tiny",ht=()=>{const{items:t,addItem:n,index:r=-1,isItemDisabled:s}=$e();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:pt,onClick:e=>{const t=structuredClone(a);n(e,{item:t,index:r+1})},"aria-label":l,disabled:s(r)},e.createElement(U.CopyIcon,{fontSize:pt})))},mt="tiny",ft=()=>{const{removeItem:t,index:n=-1}=$e();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:mt,onClick:()=>t(n),"aria-label":r},e.createElement(U.XIcon,{fontSize:mt})))};function gt(){return gt=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},gt.apply(null,arguments)}const yt=({children:t,width:n,...r})=>e.createElement(o.Popover,gt({disablePortal:!0,disableEnforceFocus:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{marginBlockStart:.5,width:n,overflow:"visible"}}}},r),t);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})=>{const{popoverState:n,openItemIndex:r,isOpen:i,rowRef:s,setOpenItemIndex:l,setRowRef:a}=$e();return i&&s?e.createElement(yt,bt({width:s.offsetWidth},(0,o.bindPopover)(n),{onClose:()=>{a(null),n.setAnchorEl(null),l(-1)}}),e.createElement(m,{bind:String(r)},e.createElement(o.Box,null,t))):null};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=({gap:t=1.5,children:n,...r})=>e.createElement(o.Stack,wt({},r,{gap:t}),n),xt=(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)),kt=(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)),St=N(()=>{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(ct,{initial:Pt,propTypeUtil:t.boxShadowPropTypeUtil},e.createElement(kt,{label:(0,i.__)("Box shadow","elementor")},e.createElement(je,{newItemIndex:0,disabled:s,ariaLabel:"Box shadow"})),e.createElement(Je,null,e.createElement(at,{Icon:Tt,Label:It,actions:e.createElement(e.Fragment,null,e.createElement(ht,null),e.createElement(dt,null),e.createElement(ft,null))})),e.createElement(vt,null,e.createElement(Mt,null))))}),Ct=(0,o.styled)(o.UnstableColorIndicator)(({theme:e})=>({height:"1rem",width:"1rem",borderRadius:e.shape.borderRadius/2+"px"})),Tt=({value:t})=>e.createElement(Ct,{size:"inherit",component:"span",value:t.value.color?.value}),Mt=()=>{const n=b(t.shadowPropTypeUtil),r=[(0,e.useRef)(null),(0,e.useRef)(null)],{rowRef:o}=$e();return e.createElement(d,n,e.createElement(Et,{p:1.5},e.createElement(xt,null,e.createElement(Ot,{bind:"color",label:(0,i.__)("Color","elementor")},e.createElement(Pe,{anchorEl:o})),e.createElement(Ot,{bind:"position",label:(0,i.__)("Position","elementor"),sx:{overflow:"hidden"}},e.createElement(Z,{options:[{label:(0,i.__)("Inset","elementor"),value:"inset"},{label:(0,i.__)("Outset","elementor"),value:null}]}))),e.createElement(xt,{ref:r[0]},e.createElement(Ot,{bind:"hOffset",label:(0,i.__)("Horizontal","elementor")},e.createElement(Ce,{anchorRef:r[0]})),e.createElement(Ot,{bind:"vOffset",label:(0,i.__)("Vertical","elementor")},e.createElement(Ce,{anchorRef:r[0]}))),e.createElement(xt,{ref:r[1]},e.createElement(Ot,{bind:"blur",label:(0,i.__)("Blur","elementor")},e.createElement(Ce,{anchorRef:r[1]})),e.createElement(Ot,{bind:"spread",label:(0,i.__)("Spread","elementor")},e.createElement(Ce,{anchorRef:r[1]})))))},Ot=({label:t,bind:n,children:r,sx:i})=>e.createElement(m,{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)))),It=({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:m=""}=o?.value||{},f=n?.value||"outset",g=[[d,p],[h,m],[l,a],[c,u]].map(([e,t])=>"custom"!==t?e+t:e||Se).join(" ");return e.createElement("span",{style:{textTransform:"capitalize"}},f,": ",g)},Pt={$$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")}}},At=(0,i.__)("Amount","elementor"),Dt={"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 Nt=(0,e.createContext)(null);function Rt({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=Dt[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??At,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(Nt.Provider,{value:o},n)}function zt(){const t=(0,e.useContext)(Nt);if(!t)throw new Error("useFilterConfig must be used within FilterConfigProvider");return t}const $t=[{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}],Lt=({anchorEl:n})=>{const r=b(t.dropShadowFilterPropTypeUtil),i=[(0,e.useRef)(null),(0,e.useRef)(null)];return e.createElement(d,r,$t.map(t=>e.createElement(xt,{key:t.bind,ref:i[t.rowIndex]??null},e.createElement(m,{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(Pe,{anchorEl:n}):e.createElement(Ce,{anchorRef:i[t.rowIndex],enablePropTypeUnits:!0,min:"blur"===t.bind?0:-Number.MAX_SAFE_INTEGER,defaultUnit:"px"}))))))},Bt={blur:t.blurFilterPropTypeUtil,intensity:t.intensityFilterPropTypeUtil,"hue-rotate":t.hueRotateFilterPropTypeUtil,"color-tone":t.colorToneFilterPropTypeUtil},Vt=({filterFunc:t})=>{const n=(0,e.useRef)(null),{getFilterFunctionConfig:r}=zt(),{valueName:i,filterFunctionGroup:s}=r(t),l=b(Bt[s]);return e.createElement(d,l,e.createElement(m,{bind:s},e.createElement(m,{bind:"size"},e.createElement(xt,{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(Ce,{anchorRef:n,enablePropTypeUnits:!0}))))))};function jt(){return jt=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},jt.apply(null,arguments)}const Ft=()=>{const n=b(t.cssFilterFunctionPropUtil),{filterOptions:r,getFilterFunctionConfig:s}=zt();return e.createElement(d,jt({},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(m,{bind:"css-filter-func"},e.createElement(Et,{p:1.5},e.createElement(xt,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(m,{bind:"func"},e.createElement(Z,{options:r})))),e.createElement(m,{bind:"args"},e.createElement(Ut,null)))))},Ut=()=>{const{openItemIndex:t,items:n}=$e(),r=n[t].item.value.func.value;return"drop-shadow"===r?e.createElement(Lt,null):e.createElement(Vt,{filterFunc:r})},Ht=({value:t})=>"drop-shadow"!==t.value.func.value?null:e.createElement(Wt,{size:"inherit",component:"span",value:t.value.args.value?.color.value}),Wt=(0,o.styled)(o.UnstableColorIndicator)(({theme:e})=>({borderRadius:e.shape.borderRadius/2+"px"})),qt=({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||Se);return e.createElement(o.Box,{component:"span"},e.createElement(o.Box,{component:"span",style:{textTransform:"capitalize"}},"Drop shadow:"),` ${r.join(" ")}`)},Gt=({value:t})=>{const{func:n,args:r}=t.value,{getFilterFunctionConfig:i}=zt(),{defaultValue:s}=i(n.value??""),l=s.value.args.value?.size?.value?.unit??le[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||Se))},Kt=({value:t})=>"drop-shadow"===t.value.func.value?e.createElement(qt,{value:t}):e.createElement(Gt,{value:t}),Jt={filter:{propTypeUtil:t.filterPropTypeUtil,label:(0,i.__)("Filters","elementor")},"backdrop-filter":{propTypeUtil:t.backdropFilterPropTypeUtil,label:(0,i.__)("Backdrop filters","elementor")}},Yt=N(({filterPropName:t="filter"})=>{const{propTypeUtil:n,label:r}=(l=t)&&l in Jt?Jt[l]:Jt.filter,{propType:o,value:i,setValue:s}=b(n);var l;return e.createElement(Rt,null,e.createElement(d,{propType:o,value:i,setValue:s},e.createElement(Xt,{propTypeUtil:n,label:r,filterPropName:t})))}),Xt=({propTypeUtil:t,label:n,filterPropName:r})=>{const{getInitialValue:o}=zt();return e.createElement(ct,{initial:o(),propTypeUtil:t},e.createElement(kt,{label:n},e.createElement(je,{newItemIndex:0,ariaLabel:"backdrop-filter"===r?"backdrop filter":"filter"})),e.createElement(Je,null,e.createElement(at,{Label:Kt,Icon:Ht,actions:e.createElement(e.Fragment,null,e.createElement(ht,null),e.createElement(dt,null),e.createElement(ft,null))})),e.createElement(vt,null,e.createElement(Ft,null)))};function Qt(){return Qt=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},Qt.apply(null,arguments)}const Zt={"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}))}},en=N(({collectionId:t,options:n,...r})=>{const o=((t,n)=>{const[r,o]=(0,e.useState)(n??[]);return(0,e.useEffect)(()=>{t&&Zt[t]?o(Zt[t]()):o(n??[])},[t,n]),r})(t,n);return e.createElement(Z,Qt({options:o},r))});function tn(){return tn=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},tn.apply(null,arguments)}const nn=N(({options:n})=>{const{value:r,setValue:i,disabled:s}=b(t.stringArrayPropTypeUtil),l=(r||[]).map(e=>t.stringPropTypeUtil.extract(e)).filter(e=>null!==e).map(e=>n.find(t=>t.value===e)).filter(e=>void 0!==e);return e.createElement(J,null,e.createElement(o.Autocomplete,{fullWidth:!0,multiple:!0,size:"tiny",disabled:s,value:l,onChange:(e,n)=>{const r=n.map(e=>t.stringPropTypeUtil.create(e.value));i(r)},options:n,getOptionLabel:e=>e.label,isOptionEqualToValue:(e,t)=>e.value===t.value,renderInput:t=>e.createElement(o.TextField,t),renderTags:(t,n)=>t.map((t,r)=>{const{key:i,...s}=n({index:r});return e.createElement(o.Chip,tn({key:i,size:"tiny",label:t.label},s))})}))}),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,m=h?s.slice(l-1):[],f=h?s.slice(0,l-1):s,g="rtl"===(0,o.useTheme)().direction,y=(0,e.useMemo)(()=>{const e=m?.length,t=e?f.length+1:f.length,n=e?"auto":"";return c?`repeat(${t}, 1fr) ${n}`:`repeat(${t}, minmax(0, 25%)) ${n}`},[m?.length,f.length,c]),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%"}},f.map(({label:t,value:r,renderContent:o,showTooltip:i,disabled:s=!1})=>{const l=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:l,disabled:s},e.createElement(o,{size:n})))}),m.length&&a&&e.createElement(cn,{size:n,value:r||null,onChange:i,items:m,fullWidth:c}))}),an=t=>e.createElement(J,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(U.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=N(({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=U[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),m={items:p,maxItems:s,fullWidth:r,size:o,placeholder:u};return i?e.createElement(an,dn({},m,{value:a??null,onChange:c,disabled:d,exclusive:!0})):e.createElement(an,dn({},m,{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)),mn=t=>t.meta?.suffix?e.createElement(o.InputAdornment,{position:"end"},e.createElement(o.Typography,{variant:"caption",color:"text.secondary"},t.meta.suffix)):e.createElement(e.Fragment,null),fn=N(({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,propType:m}=b(t.numberPropTypeUtil);return e.createElement(J,null,e.createElement(he,{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,endAdornment:mn(m)}}))});function gn(){return gn=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},gn.apply(null,arguments)}function yn({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:m,setValue:f,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(m),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=!m&&!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(Ce,{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,gn({size:"tiny",value:"check",sx:{marginLeft:"auto"}},(0,o.bindToggle)(c),{selected:c.isOpen,isPlaceholder:S,"aria-label":r}),n))))),e.createElement(o.Popover,gn({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)?f(Object.values(e)?.pop()??null):f(l.create(e))},isDisabled:()=>h},e.createElement(Et,{p:1.5},e.createElement(xt,{ref:u[1]},e.createElement(bn,{item:s[0],rowRef:u[1]}),e.createElement(bn,{item:s[1],rowRef:u[1]})),e.createElement(xt,{ref:u[2]},e.createElement(bn,{item:s[2],rowRef:u[2]}),e.createElement(bn,{item:s[3],rowRef:u[2]}))))))}const bn=({item:t,rowRef:n})=>{const{bind:r,label:i,icon:s,ariaLabel:l}=t;return e.createElement(m,{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(Ce,{startIcon:s,ariaLabel:l,anchorRef:n})))))},vn=({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:m,disabled:f}=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,ie.useActiveBreakpoint)();(0,e.useLayoutEffect)(()=>{k(w)},[S]);const C=n.toLowerCase(),T=E?U.LinkIcon:U.DetachIcon,M=(0,i.__)("Link %s","elementor").replace("%s",C),O=(0,i.__)("Unlink %s","elementor").replace("%s",C),I=c||f,P={propType:h,value:u,placeholder:m,setValue:p,isDisabled:()=>f},_=!g&&(m||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:_},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(U.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(U.SideLeftIcon,{fontSize:"tiny"}):e.createElement(U.SideRightIcon,{fontSize:"tiny"})}],[{bind:"block-end",label:(0,i.__)("Bottom","elementor"),ariaLabel:(0,i.sprintf)((0,i.__)("%s bottom","elementor"),t),icon:e.createElement(U.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(U.SideRightIcon,{fontSize:"tiny"}):e.createElement(U.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(En,r)),e.createElement(o.Grid,{item:!0,xs:12},e.createElement(wn,{bind:r.bind,ariaLabel:r.ariaLabel,startIcon:t,isLinked:E,extendedOptions:s,anchorRef:a[n],min:l})))))))},wn=({bind:t,ariaLabel:n,startIcon:r,isLinked:o,extendedOptions:i,anchorRef:s,min:l})=>o?e.createElement(Ce,{ariaLabel:n,startIcon:r,extendedOptions:i,anchorRef:s,min:l}):e.createElement(m,{bind:t},e.createElement(Ce,{ariaLabel:n,startIcon:r,extendedOptions:i,anchorRef:s,min:l})),En=({label:t,bind:n})=>e.createElement(m,{bind:n},e.createElement(M,null,t)),xn=({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:m,categoryItemContentTemplate:f})=>{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(W.PopoverBody,{width:l,id:h},e.createElement(W.PopoverHeader,{title:a,onClose:w,icon:e.createElement(v,{fontSize:"tiny"})}),e.createElement(W.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(kn,{itemListItems:b,setSelectedItem:r,handleClose:w,selectedItem:n,itemStyle:c,onDebounce:u,categoryItemContentTemplate:f}):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"))))),m)},kn=({itemListItems:t,setSelectedItem:n,handleClose:r,selectedItem:o,itemStyle:i=()=>({}),onDebounce:s=()=>{},categoryItemContentTemplate:l})=>{const a=t.find(e=>e.value===o),c=Sn(e=>{e.forEach(e=>{e&&"item"===e.type&&s(e.value)})},100),u=(0,e.useCallback)(e=>i(e),[i]);return e.createElement(W.PopoverMenuList,{items:t,selectedValue:a?.value,onChange:c,onSelect:n,onClose:r,itemStyle:u,"data-testid":"item-list",categoryItemContentTemplate:l})},Sn=(t,n)=>{const[r]=(0,e.useState)(()=>(0,s.debounce)(t,n));return(0,e.useEffect)(()=>()=>r.cancel(),[r]),r},Cn=(e,t="editor")=>{const n=window;return n.elementor?.helpers?.enqueueFont?.(e,t)??null};function Tn(){return Tn=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},Tn.apply(null,arguments)}const Mn=N(({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(J,null,e.createElement(o.UnstableTag,Tn({id:"font-family-control",variant:"outlined",label:l||u,endIcon:e.createElement(U.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,Tn({disablePortal:!0,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{my:1.5}},(0,o.bindPopover)(d)),e.createElement(xn,{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:Cn,icon:U.TextIcon})))}),On=N(({placeholder:n,ariaLabel:r})=>{const{value:i,setValue:s,disabled:l}=b(t.urlPropTypeUtil);return e.createElement(J,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 In=window.elementorV2.editorElements,Pn=window.elementorV2.session;const _n={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(U.InfoCircleFilledIcon,null),action:e.createElement(o.AlertAction,{sx:{width:"fit-content"},variant:"contained",color:"secondary",onClick:()=>{a&&(0,In.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:_n.href,target:"_blank",color:"info.main"},_n.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 Nn(){return Nn=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},Nn.apply(null,arguments)}const Rn=(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,...m}=t,f=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&&!!Ln(r,u),v=(u?.toString()?.length??0)>=c&&(!l||f.length>0);return e.createElement(o.Autocomplete,Nn({},m,{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:f,getOptionKey:e=>Ln(r,e)?.id||e,getOptionLabel:e=>Ln(r,e)?.label||e.toString(),groupBy:Bn(r)?e=>Ln(r,e)?.groupLabel||e:void 0,isOptionEqualToValue:y,filterOptions:()=>f,renderOption:(t,n)=>e.createElement(o.Box,Nn({component:"li"},t,{key:t.id}),Ln(r,n)?.label??n),renderInput:t=>e.createElement(zn,{params:t,handleChange:e=>s?.(e),allowClear:g,placeholder:a,hasSelectedValue:b,startAdornment:d,extraInputProps:h})}))}),zn=({params:t,allowClear:n,placeholder:r,handleChange:i,hasSelectedValue:s,startAdornment:l,extraInputProps:a})=>e.createElement(o.TextField,Nn({},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||t.InputProps.startAdornment,endAdornment:e.createElement($n,{params:t,allowClear:n,handleChange:i})}})),$n=({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(U.XIcon,{fontSize:r.size})));function Ln(e,t=null){const n=(t||"").toString();return e.find(({id:e})=>n===e.toString())}function Bn(e){return!(e.length<=1)&&new Set(e.map(e=>e.groupLabel)).size>1}const Vn=N(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||{},m=u||(0,i.__)("Search","elementor"),[f,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,z.httpService)().get(e,{params:t});return n.data.value}catch{return[]}}(a,e).then(e=>{g(function(e){const t=Bn(e)?"groupLabel":"label";return e.sort((e,n)=>e[t]&&n[t]?e[t].localeCompare(n[t]):0)}(e))}),400),[a]);return e.createElement(J,null,e.createElement(Rn,{options:f,allowCustomValues:l,placeholder:m,startAdornment:e.createElement(U.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(Ln(f,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}:{}}}))}),jn=N(()=>{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 Fn(){return Fn=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},Fn.apply(null,arguments)}const Un="tiny",Hn=N(n=>{const{value:r,path:l,setValue:a,...c}=b(t.linkPropTypeUtil),[u,p]=(0,Pn.useSessionStorage)(l.join("/")),[h,f]=(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,In.getLinkInLinkRestriction)(E,r)),O=!h&&C.shouldRestrict,I=(0,e.useMemo)(()=>(0,s.debounce)(()=>{const e=(0,In.getLinkInLinkRestriction)(E,r);e.shouldRestrict&&h&&f(!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,Fn({},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(Wn,{disabled:O,active:h,onIconClick:()=>{if(T((0,In.getLinkInLinkRestriction)(E,r)),C.shouldRestrict&&!h)return;const e=!h;f(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(m,{bind:"destination"},e.createElement(Vn,{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(m,{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(jn,null))))))))}),Wn=({disabled:t,active:n,onIconClick:r,label:i})=>e.createElement(o.IconButton,{size:Un,onClick:r,"aria-label":i,disabled:t},n?e.createElement(U.MinusIcon,{fontSize:Un}):e.createElement(U.PlusIcon,{fontSize:Un}));function qn(){return qn=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},qn.apply(null,arguments)}const Gn="secondary",Kn=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,qn({placement:"right",color:Gn,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,10]}}]}}},s,{content:e.createElement(W.InfoAlert,qn({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 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 Yn=(0,o.styled)(o.Select)(()=>({".MuiSelect-select.Mui-disabled":{cursor:"not-allowed"}})),Xn=N(({options:n,onChange:r,fallbackLabels:s={}})=>{const{value:l,setValue:a,disabled:c,placeholder:u}=b(t.stringPropTypeUtil),d=(0,In.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(J,null,e.createElement(Kn,p,e.createElement(Yn,{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(W.MenuListItem,Jn({key:n.value},n,{value:n.value??""}),t)))))}),Qn=({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:m,placeholder:f}=b(),g=()=>!(t.layoutDirectionPropTypeUtil.isValid(h)||!h&&t.layoutDirectionPropTypeUtil.isValid(f)),[y,v]=(0,e.useState)(()=>g()),w=(0,ie.useActiveBreakpoint)();(0,e.useLayoutEffect)(()=>{v(g())},[w]);const E=n.toLowerCase(),k=y?U.LinkIcon:U.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||f);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 m(t.layoutDirectionPropTypeUtil.create({row:e,column:e})):void m(null)}m(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(Zn,{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(Zn,{bind:"row",ariaLabel:(0,i.__)("Row gap","elementor"),isLinked:y,anchorRef:r})))))},Zn=({bind:t,ariaLabel:n,isLinked:r,anchorRef:o})=>r?e.createElement(Ce,{anchorRef:o,ariaLabel:n}):e.createElement(m,{bind:t},e.createElement(Ce,{anchorRef:o,ariaLabel:n}));function er(){return er=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},er.apply(null,arguments)}const tr=[{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"}],nr="custom",rr=N(({label:n})=>{const{value:r,setValue:s,disabled:l,placeholder:a}=b(t.stringPropTypeUtil),c=r??a,u=c&&!tr.some(e=>e.value===c),[d,p]=u?c.split("/"):["",""],[h,m]=(0,e.useState)(u),[f,g]=(0,e.useState)(d),[y,v]=(0,e.useState)(p),[w,E]=(0,e.useState)(u?nr:c||"");(0,e.useEffect)(()=>{if(c&&!tr.some(e=>e.value===c)){const[e,t]=c.split("/");g(e||""),v(t||""),E(nr),m(!0)}else E(c||""),m(!1),g(""),v("")},[c]);const x=r??a,k=tr.find(e=>e.value===x);return e.createElement(J,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:w,onChange:e=>{const t=e.target.value,n=t===nr;m(n),E(t),n||s(t)},renderValue:u?void 0:()=>k?.label,fullWidth:!0},[...tr,{label:(0,i.__)("Custom","elementor"),value:nr}].map(({label:t,...n})=>e.createElement(W.MenuListItem,er({key:n.value},n,{value:n.value??""}),t))))),h&&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:f,onChange:e=>{const t=e.target.value;g(t),t&&y&&s(`${t}/${y}`)},InputProps:{startAdornment:e.createElement(U.ArrowsMoveHorizontalIcon,{fontSize:"tiny"})}})),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(o.TextField,{size:"tiny",type:"number",fullWidth:!0,disabled:l,value:y,onChange:e=>{const t=e.target.value;v(t),f&&t&&s(`${f}/${t}`)},InputProps:{startAdornment:e.createElement(U.ArrowsMoveVerticalIcon,{fontSize:"tiny"})}})))))});var or=window.elementorV2.editorCurrentUser;const ir=(0,i.__)("Enable Unfiltered Uploads","elementor"),sr=(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"),lr=(0,i.__)("Failed to enable unfiltered files upload.","elementor"),ar=(0,i.__)("You can try again, if the problem persists, please contact support.","elementor"),cr=t=>{const{mutateAsync:n,isPending:r}=function(){const e=(0,R.useQueryClient)();return(0,R.useMutation)({mutationFn:({allowUnfilteredFilesUpload:e})=>{return t=B,n=e?"1":"0",(0,z.httpService)().put(`${$}/${t}`,{value:n});var t,n},onSuccess:()=>e.invalidateQueries(V)})}(),[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(ur,s)},ur=({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,ir)),e.createElement(o.Divider,null),e.createElement(o.DialogContent,null,e.createElement(o.DialogContentText,null,l?e.createElement(e.Fragment,null,lr," ",e.createElement("br",null)," ",ar):sr)),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")))),dr="transparent",pr="#c1c1c1",hr=`linear-gradient(45deg, ${pr} 25%, ${dr} 0, ${dr} 75%, ${pr} 0, ${pr})`,mr=(0,o.styled)(o.Card)` background-color: white; background-image: ${hr}, ${hr}; 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 ); `,gr={mode:"browse"},yr={mode:"upload"},br=N(()=>{const{value:n,setValue:r}=b(t.svgSrcPropTypeUtil),s=n?.id,l=n?.url,{data:a,isFetching:c}=(0,H.useWpMediaAttachment)(s?.value||null),u=a?.url??l?.value??null,{data:d}=j(),[p,h]=(0,e.useState)(!1),{isAdmin:m}=(0,or.useCurrentUserCapabilities)(),{open:f}=(0,H.useWpMediaFrame)({mediaTypes:["svg"],multiple:!1,selected:s?.value||null,onSelect:e=>{r({id:{$$type:"image-attachment-id",value:e.id},url:t.urlPropTypeUtil.create(e.url)})}}),g=e=>{d||e!==yr?f(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:!m};return e.createElement(o.Stack,{gap:1,"aria-label":"SVG Control"},e.createElement(cr,{open:p,onClose:e=>{h(!1),e&&f(yr)}}),e.createElement(J,null,e.createElement(mr,{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(gr),"aria-label":"Select SVG"},(0,i.__)("Select SVG","elementor")),e.createElement(Kn,y,e.createElement("span",null,e.createElement(o.ThemeProvider,{colorScheme:m?"light":"dark"},e.createElement(o.Button,{size:"tiny",variant:"text",color:"inherit",startIcon:e.createElement(U.UploadIcon,null),disabled:!m,onClick:()=>m&&g(yr),"aria-label":"Upload SVG"},(0,i.__)("Upload","elementor"))))))))))}),vr=window.elementorCommon?.config?.urls?.assets+"/shapes/play-triangle.svg",wr=N(()=>{const{value:n,setValue:r}=b(t.videoSrcPropTypeUtil),{id:s,url:l}=n??{},{data:a,isFetching:c}=(0,H.useWpMediaAttachment)(s?.value||null),u=a?.url??l?.value??null,{open:d}=(0,H.useWpMediaFrame)({mediaTypes:["video"],multiple:!1,selected:s?.value||null,onSelect:e=>{r({id:{$$type:"video-attachment-id",value:e.id},url:null})}});return e.createElement(J,null,e.createElement(o.Card,{variant:"outlined"},e.createElement(o.CardMedia,{sx:{height:140,backgroundColor:"white",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px",backgroundRepeat:"repeat",backgroundImage:`${hr}, ${hr}`,display:"flex",justifyContent:"center",alignItems:"center"}},e.createElement(Er,{isFetching:c,videoUrl:u})),e.createElement(o.CardOverlay,null,e.createElement(o.Stack,{gap:1},e.createElement(o.Button,{size:"tiny",color:"inherit",variant:"outlined",onClick:()=>d({mode:"browse"})},(0,i.__)("Select video","elementor")),e.createElement(o.Button,{size:"tiny",variant:"text",color:"inherit",startIcon:e.createElement(U.UploadIcon,null),onClick:()=>d({mode:"upload"})},(0,i.__)("Upload","elementor"))))))}),Er=({isFetching:t=!1,videoUrl:n})=>t?e.createElement(o.CircularProgress,null):n?e.createElement("video",{src:n,muted:!0,preload:"metadata",style:{width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none"}}):e.createElement("img",{src:vr,alt:"No video selected"});var xr=window.elementorV2.env;const{env:kr}=(0,xr.parseEnv)("@elementor/editor-controls"),Sr=N(()=>{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)}})}),Cr=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)})])}),Tr=[{value:"fixed",label:(0,i.__)("Fixed","elementor"),renderContent:({size:t})=>e.createElement(U.PinIcon,{fontSize:t}),showTooltip:!0},{value:"scroll",label:(0,i.__)("Scroll","elementor"),renderContent:({size:t})=>e.createElement(U.PinnedOffIcon,{fontSize:t}),showTooltip:!0}],Mr=()=>e.createElement(xt,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:Tr}))),Or=[{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"}],Ir=()=>{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(xt,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(J,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)??""},Or.map(({label:t,value:n})=>e.createElement(W.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(m,{bind:"x"},e.createElement(Ce,{startIcon:e.createElement(U.LetterXIcon,{fontSize:"tiny"}),anchorRef:l,min:-Number.MAX_SAFE_INTEGER}))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(m,{bind:"y"},e.createElement(Ce,{startIcon:e.createElement(U.LetterYIcon,{fontSize:"tiny"}),anchorRef:l,min:-Number.MAX_SAFE_INTEGER})))))):null)},Pr=[{value:"repeat",label:(0,i.__)("Repeat","elementor"),renderContent:({size:t})=>e.createElement(U.GridDotsIcon,{fontSize:t}),showTooltip:!0},{value:"repeat-x",label:(0,i.__)("Repeat-x","elementor"),renderContent:({size:t})=>e.createElement(U.DotsHorizontalIcon,{fontSize:t}),showTooltip:!0},{value:"repeat-y",label:(0,i.__)("Repeat-y","elementor"),renderContent:({size:t})=>e.createElement(U.DotsVerticalIcon,{fontSize:t}),showTooltip:!0},{value:"no-repeat",label:(0,i.__)("No-repeat","elementor"),renderContent:({size:t})=>e.createElement(U.XIcon,{fontSize:t}),showTooltip:!0}],_r=()=>e.createElement(xt,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:Pr}))),Ar=[{value:"auto",label:(0,i.__)("Auto","elementor"),renderContent:({size:t})=>e.createElement(U.LetterAIcon,{fontSize:t}),showTooltip:!0},{value:"cover",label:(0,i.__)("Cover","elementor"),renderContent:({size:t})=>e.createElement(U.ArrowsMaximizeIcon,{fontSize:t}),showTooltip:!0},{value:"contain",label:(0,i.__)("Contain","elementor"),renderContent:({size:t})=>e.createElement(U.ArrowBarBothIcon,{fontSize:t}),showTooltip:!0},{value:"custom",label:(0,i.__)("Custom","elementor"),renderContent:({size:t})=>e.createElement(U.PencilIcon,{fontSize:t}),showTooltip:!0}],Dr=()=>{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(xt,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:Ar,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(xt,null,e.createElement(o.Grid,{item:!0,xs:6},e.createElement(m,{bind:"width"},e.createElement(Ce,{startIcon:e.createElement(U.ArrowsMoveHorizontalIcon,{fontSize:"tiny"}),extendedOptions:["auto"],anchorRef:l}))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(m,{bind:"height"},e.createElement(Ce,{startIcon:e.createElement(U.ArrowsMoveVerticalIcon,{fontSize:"tiny"}),extendedOptions:["auto"],anchorRef:l})))))):null)};function Nr(){return Nr=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},Nr.apply(null,arguments)}const Rr=t.backgroundColorOverlayPropTypeUtil.create({color:t.colorPropTypeUtil.create("#00000033")}),zr=()=>({$$type:"background-image-overlay",value:{image:{$$type:"image",value:{src:{$$type:"image-src",value:{url:{$$type:"url",value:kr.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"}],Lr=N(()=>{const{propType:n,value:r,setValue:o}=b(t.backgroundOverlayPropTypeUtil);return e.createElement(d,{propType:n,value:r,setValue:o},e.createElement(ct,{initial:zr(),propTypeUtil:t.backgroundOverlayPropTypeUtil},e.createElement(kt,{label:(0,i.__)("Overlay","elementor")},e.createElement(je,{newItemIndex:0})),e.createElement(Je,null,e.createElement(at,{Icon:Vr,Label:Wr,actions:e.createElement(e.Fragment,null,e.createElement(ht,null),e.createElement(dt,null),e.createElement(ft,null))})),e.createElement(vt,null,e.createElement(Br,null))))}),Br=()=>{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:m}=(0,o.useTabs)(a?"color":u?"gradient":"image"),f=(0,e.useRef)({image:r,color:n,gradient:i}),g=(e,t)=>{t&&(f.current[e]=t)},y=(e,t)=>{switch(t){case"image":l(f.current.image),g("color",a),g("gradient",u);break;case"gradient":d(f.current.gradient),g("color",a),g("image",s);break;case"color":c(f.current.color),g("image",s),g("gradient",u)}return p().onChange(e,t)};return{getTabProps:h,getTabPanelProps:m,getTabsProps:()=>({...p(),onChange:y})}})({image:zr().value,color:Rr.value,gradient:Cr.value}),{rowRef:l}=$e();return e.createElement(o.Box,{sx:{width:"100%"}},e.createElement(o.Box,{sx:{borderBottom:1,borderColor:"divider"}},e.createElement(o.Tabs,Nr({size:"small",variant:"fullWidth"},n(),{"aria-label":(0,i.__)("Background Overlay","elementor")}),e.createElement(o.Tab,Nr({label:(0,i.__)("Image","elementor")},r("image"))),e.createElement(o.Tab,Nr({label:(0,i.__)("Gradient","elementor")},r("gradient"))),e.createElement(o.Tab,Nr({label:(0,i.__)("Color","elementor")},r("color"))))),e.createElement(o.TabPanel,Nr({sx:{p:1.5}},s("image")),e.createElement(Et,null,e.createElement(Yr,null))),e.createElement(o.TabPanel,Nr({sx:{p:1.5}},s("gradient")),e.createElement(Sr,null)),e.createElement(o.TabPanel,Nr({sx:{p:1.5}},s("color")),e.createElement(Et,null,e.createElement(Jr,{anchorEl:l}))))},Vr=({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}},jr=e=>e?.value?.color?.value?e.value.color.value:"",Fr=({value:t})=>{const n=jr(t);return e.createElement(Xr,{size:"inherit",component:"span",value:n})},Ur=({value:t})=>{const{imageUrl:n}=Qr(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}`})})},Hr=({value:t})=>{const n=eo(t);return e.createElement(Xr,{size:"inherit",component:"span",value:n})},Wr=({value:t})=>{switch(t.$$type){case"background-image-overlay":return e.createElement(Gr,{value:t});case"background-color-overlay":return e.createElement(qr,{value:t});case"background-gradient-overlay":return e.createElement(Kr,{value:t});default:return null}},qr=({value:t})=>{const n=jr(t);return e.createElement("span",null,n)},Gr=({value:t})=>{const{imageTitle:n}=Qr(t);return e.createElement("span",null,n)},Kr=({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")),Jr=({anchorEl:n})=>{const r=b(t.backgroundColorOverlayPropTypeUtil);return e.createElement(d,r,e.createElement(m,{bind:"color"},e.createElement(Pe,{anchorEl:n})))},Yr=()=>{const n=b(t.backgroundImageOverlayPropTypeUtil);return e.createElement(d,n,e.createElement(m,{bind:"image"},e.createElement(ee,{sizes:$r})),e.createElement(m,{bind:"position"},e.createElement(Ir,null)),e.createElement(m,{bind:"repeat"},e.createElement(_r,null)),e.createElement(m,{bind:"size"},e.createElement(Dr,null)),e.createElement(m,{bind:"attachment"},e.createElement(Mr,null)))},Xr=(0,o.styled)(o.UnstableColorIndicator)(({theme:e})=>({height:"1rem",width:"1rem",borderRadius:e.shape.borderRadius/2+"px"})),Qr=e=>{let t,n=null;const r=e?.value.image.value?.src.value,{data:o}=(0,H.useWpMediaAttachment)(r.id?.value||null);if(r.id){const e=Zr(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}},Zr=e=>e?`.${e.substring(e.lastIndexOf(".")+1)}`:"",eo=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})`},to=[{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"}],no=(0,i.__)("Color","elementor"),ro=(0,i.__)("Clipping","elementor"),oo=N(()=>{const n=b(t.backgroundPropTypeUtil);return e.createElement(d,n,e.createElement(m,{bind:"background-overlay"},e.createElement(Lr,null)),e.createElement(io,null),e.createElement(so,null))}),io=()=>e.createElement(m,{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,no)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(Pe,null)))),so=()=>e.createElement(m,{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,ro)),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(Z,{options:to}))));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 ao=/\$\{([^}]+)\}/g,co=N(({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 m=(0,e.useMemo)(()=>(0,t.createArrayPropUtils)(p.key,p.schema,c),[p.key,p.schema,c]),f=(0,e.useMemo)(()=>({...r,placeholder:a||"",patternLabel:l||""}),[r,a,l]),{propType:g,value:y,setValue:v}=b(m);return e.createElement(d,{propType:g,value:y,setValue:v},e.createElement(Ye.Provider,{value:f},e.createElement(ct,{initial:p.create(s||null),propTypeUtil:m,isItemDisabled:h},e.createElement(kt,{label:n},e.createElement(je,lo({},u,{newItemIndex:0,ariaLabel:n}))),e.createElement(Je,{isSortable:!1},e.createElement(at,{Icon:uo,Label:fo,actions:e.createElement(e.Fragment,null,o&&e.createElement(ht,null),i&&e.createElement(dt,null),e.createElement(ft,null))})),e.createElement(vt,null,e.createElement(po,null)))))}),uo=()=>e.createElement(e.Fragment,null),po=()=>{const{component:t,props:n={}}=Xe();return e.createElement(Et,{p:1.5},e.createElement(xt,null,e.createElement(t,n)))},ho=(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?"":Se:i},mo=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),fo=({value:t})=>{const{placeholder:n,patternLabel:r,props:i}=Xe(),s=((e,t)=>{const n=go(e).map(e=>ho(t,e));return!(0===n.length||!n.some(e=>null==e)&&!n.every(mo))})(r,t),l=s?n:(a=r,(c=t)?a.replace(ao,(e,t)=>{const n=ho(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)},go=e=>e.match(ao)?.map(e=>e.slice(2,-1))||[],yo=e=>{const t={"&":"&","<":"<",">":">","'":"'",'"':"""};return e.replace(/[&<>'"]/g,e=>t[e]||e)};function bo(){return bo=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},bo.apply(null,arguments)}const vo=e=>{const t=e;return e&&"object"==typeof e&&"dynamic"!==t.$$type&&t.value||""},wo=N((n={})=>{const{value:r,setValue:s,...l}=b(t.keyValuePropTypeUtil),[a,c]=(0,e.useState)(""),[u,p]=(0,e.useState)(""),[h,f]=(0,e.useState)({key:vo(r?.key),value:vo(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,bo({},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);f(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(m,{bind:"key"},e.createElement(re,{inputValue:n.escapeHtml?yo(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(m,{bind:"value"},e.createElement(re,{inputValue:n.escapeHtml?yo(h.value):h.value,error:!!u,inputDisabled:!!a,helperText:w})),!!u&&e.createElement(o.FormHelperText,{error:!0},u))))}),Eo=[{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"}],xo=()=>{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},Eo.map(({label:t,value:n})=>e.createElement(W.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(m,{bind:"x"},e.createElement(Ce,{startIcon:e.createElement(U.LetterXIcon,{fontSize:"tiny"}),min:-Number.MAX_SAFE_INTEGER}))),e.createElement(o.Grid,{item:!0,xs:6},e.createElement(m,{bind:"y"},e.createElement(Ce,{startIcon:e.createElement(U.LetterYIcon,{fontSize:"tiny"}),min:-Number.MAX_SAFE_INTEGER})))))))},ko="transform-move",So="transform-scale",Co="transform-rotate",To="transform-skew",Mo={move:{size:0,unit:"px"},scale:1,rotate:{size:0,unit:"deg"},skew:{size:0,unit:"deg"}},Oo={$$type:ko,value:{x:{$$type:"size",value:{size:Mo.move.size,unit:Mo.move.unit}},y:{$$type:"size",value:{size:Mo.move.size,unit:Mo.move.unit}},z:{$$type:"size",value:{size:Mo.move.size,unit:Mo.move.unit}}}},Io=t.scaleTransformPropTypeUtil.create({x:t.numberPropTypeUtil.create(Mo.scale),y:t.numberPropTypeUtil.create(Mo.scale),z:t.numberPropTypeUtil.create(Mo.scale)}),Po=t.rotateTransformPropTypeUtil.create({x:{$$type:"size",value:{size:Mo.rotate.size,unit:Mo.rotate.unit}},y:{$$type:"size",value:{size:Mo.rotate.size,unit:Mo.rotate.unit}},z:{$$type:"size",value:{size:Mo.rotate.size,unit:Mo.rotate.unit}}}),_o=t.skewTransformPropTypeUtil.create({x:{$$type:"size",value:{size:Mo.skew.size,unit:Mo.skew.unit}},y:{$$type:"size",value:{size:Mo.skew.size,unit:Mo.skew.unit}}}),Ao=({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(xt,{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(m,{bind:n},e.createElement(Ce,{anchorRef:i,startIcon:r,units:s,variant:l,min:-Number.MAX_SAFE_INTEGER,id:a})))))};function Do(){return Do=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},Do.apply(null,arguments)}const No=[{label:(0,i.__)("Move X","elementor"),bind:"x",startIcon:e.createElement(U.ArrowRightIcon,{fontSize:"tiny"}),units:["px","%","em","rem","vw"]},{label:(0,i.__)("Move Y","elementor"),bind:"y",startIcon:e.createElement(U.ArrowDownSmallIcon,{fontSize:"tiny"}),units:["px","%","em","rem","vh"]},{label:(0,i.__)("Move Z","elementor"),bind:"z",startIcon:e.createElement(U.ArrowDownLeftIcon,{fontSize:"tiny"}),units:["px","%","em","rem","vw","vh"]}],Ro=()=>{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(m,{bind:ko},No.map((t,n)=>e.createElement(Ao,Do({key:t.bind},t,{anchorRef:r[n],units:t.units,variant:"length"}))))))};function zo(){return zo=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},zo.apply(null,arguments)}const $o=[{label:(0,i.__)("Rotate X","elementor"),bind:"x",startIcon:e.createElement(U.Arrow360Icon,{fontSize:"tiny"})},{label:(0,i.__)("Rotate Y","elementor"),bind:"y",startIcon:e.createElement(U.Arrow360Icon,{fontSize:"tiny",style:{transform:"scaleX(-1) rotate(-90deg)"}})},{label:(0,i.__)("Rotate Z","elementor"),bind:"z",startIcon:e.createElement(U.RotateClockwiseIcon,{fontSize:"tiny"})}],Lo=["deg","rad","grad","turn"],Bo=()=>{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(m,{bind:Co},$o.map((t,n)=>e.createElement(Ao,zo({key:t.bind},t,{anchorRef:r[n],units:Lo}))))))},Vo=({label:t,bind:n,startIcon:r,anchorRef:i})=>e.createElement(o.Grid,{item:!0,xs:12},e.createElement(xt,{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(m,{bind:n},e.createElement(fn,{step:.1,placeholder:"1",startIcon:r})))));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.__)("Scale X","elementor"),bind:"x",startIcon:e.createElement(U.ArrowRightIcon,{fontSize:"tiny"})},{label:(0,i.__)("Scale Y","elementor"),bind:"y",startIcon:e.createElement(U.ArrowDownSmallIcon,{fontSize:"tiny"})},{label:(0,i.__)("Scale Z","elementor"),bind:"z",startIcon:e.createElement(U.ArrowDownLeftIcon,{fontSize:"tiny"})}],Uo=()=>{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(m,{bind:So},Fo.map((t,n)=>e.createElement(Vo,jo({key:t.bind},t,{anchorRef:r[n]}))))))};function Ho(){return Ho=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},Ho.apply(null,arguments)}const Wo=[{label:(0,i.__)("Skew X","elementor"),bind:"x",startIcon:e.createElement(U.ArrowRightIcon,{fontSize:"tiny"})},{label:(0,i.__)("Skew Y","elementor"),bind:"y",startIcon:e.createElement(U.ArrowLeftIcon,{fontSize:"tiny",style:{transform:"scaleX(-1) rotate(-90deg)"}})}],qo=["deg","rad","grad","turn"],Go=()=>{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(m,{bind:To},Wo.map((t,n)=>e.createElement(Ao,Ho({key:t.bind},t,{anchorRef:r[n],units:qo}))))))};function Ko(){return Ko=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},Ko.apply(null,arguments)}const Jo=()=>{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:m}=b(t.skewTransformPropTypeUtil),{openItemIndex:f,items:g}=$e(),{getTabsProps:y,getTabProps:v,getTabPanelProps:w}=(0,o.useTabs)((()=>{switch(!0){case!!c:return So;case!!d:return Co;case!!h:return To;default:return ko}})()),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 ko:a(E.current.move),x("scale",c),x("rotate",d),x("skew",h);break;case So:u(E.current.scale),x("move",l),x("rotate",d),x("skew",h);break;case Co:p(E.current.rotate),x("move",l),x("scale",c),x("skew",h);break;case To:m(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!==f))};var t},getTabPanelProps:w,getTabsProps:()=>({...y(),onChange:k})}})({move:Oo.value,scale:Io.value,rotate:Po.value,skew:_o.value});return e.createElement(Et,null,e.createElement(o.Box,{sx:{width:"100%"}},e.createElement(o.Box,{sx:{borderBottom:1,borderColor:"divider"}},e.createElement(o.Tabs,Ko({size:"small",variant:"fullWidth",sx:{"& .MuiTab-root":{minWidth:"62px"}}},n(),{"aria-label":(0,i.__)("Transform","elementor")}),e.createElement(o.Tab,Ko({label:(0,i.__)("Move","elementor")},r(ko))),e.createElement(o.Tab,Ko({label:(0,i.__)("Scale","elementor")},r(So))),e.createElement(o.Tab,Ko({label:(0,i.__)("Rotate","elementor")},r(Co))),e.createElement(o.Tab,Ko({label:(0,i.__)("Skew","elementor")},r(To))))),e.createElement(o.TabPanel,Ko({sx:{p:1.5}},s(ko)),e.createElement(Ro,null)),e.createElement(o.TabPanel,Ko({sx:{p:1.5}},s(So)),e.createElement(Uo,null)),e.createElement(o.TabPanel,Ko({sx:{p:1.5}},s(Co)),e.createElement(Bo,null)),e.createElement(o.TabPanel,Ko({sx:{p:1.5}},s(To)),e.createElement(Go,null))))},Yo=({value:t})=>{switch(t.$$type){case ko:return e.createElement(U.ArrowsMaximizeIcon,{fontSize:"tiny"});case So:return e.createElement(U.ArrowAutofitHeightIcon,{fontSize:"tiny"});case Co:return e.createElement(U.RotateClockwise2Icon,{fontSize:"tiny"});case To:return e.createElement(U.SkewXIcon,{fontSize:"tiny"});default:return null}},Xo=["x","y","z"],Qo=(e,t)=>Xo.map(n=>{const r=e[n];if("scale"===t)return r?.value||Mo[t];const o=Mo[t],i=r?.value?.size??o.size,s=r?.value?.unit??o.unit;return"custom"===s?i||Se:`${i}${s}`}).join(", "),Zo=t=>{const{$$type:n,value:r}=t.value;switch(n){case ko:return e.createElement(ei,{label:(0,i.__)("Move","elementor"),value:Qo(r,"move")});case So:return e.createElement(ei,{label:(0,i.__)("Scale","elementor"),value:Qo(r,"scale")});case Co:return e.createElement(ei,{label:(0,i.__)("Rotate","elementor"),value:Qo(r,"rotate")});case To:return e.createElement(ei,{label:(0,i.__)("Skew","elementor"),value:Qo(r,"skew")});default:return""}},ei=({label:t,value:n})=>e.createElement(o.Box,{component:"span"},t,": ",n),ti=["px","%","em","rem"],ni={label:(0,i.__)("Perspective","elementor"),bind:"perspective",units:["px","em","rem","vw","vh"]},ri=[{label:(0,i.__)("Origin X","elementor"),bind:"x",units:ti},{label:(0,i.__)("Origin Y","elementor"),bind:"y",units:ti}],oi=()=>e.createElement(o.Stack,{direction:"column",spacing:1.5},e.createElement(x,null,(0,i.__)("Children perspective","elementor")),e.createElement(ii,null),e.createElement(si,null)),ii=()=>e.createElement(m,{bind:"perspective"},e.createElement(ai,{control:ni,key:ni.bind})),si=()=>e.createElement(m,{bind:"perspective-origin"},e.createElement(li,null)),li=()=>{const n=b(t.perspectiveOriginPropTypeUtil);return e.createElement(d,n,ri.map(t=>e.createElement(m,{bind:t.bind,key:t.bind},e.createElement(ai,{control:t}))))},ai=({control:t})=>{const n=e.useRef(null);return e.createElement(xt,{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(Ce,{variant:"length",units:t.units,anchorRef:n,disableCustom:!0})))},ci=["px","%","em","rem"],ui=ci.filter(e=>"%"!==e),di=[{label:(0,i.__)("Origin X","elementor"),bind:"x",units:ci},{label:(0,i.__)("Origin Y","elementor"),bind:"y",units:ci},{label:(0,i.__)("Origin Z","elementor"),bind:"z",units:ui}],pi=()=>e.createElement(o.Stack,{direction:"column",spacing:1.5},e.createElement(x,null,(0,i.__)("Transform","elementor")),di.map(t=>e.createElement(hi,{control:t,key:t.bind}))),hi=({control:n})=>{const r=b(t.transformOriginPropTypeUtil),i=e.useRef(null);return e.createElement(d,r,e.createElement(m,{bind:n.bind},e.createElement(xt,{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(Ce,{variant:"length",units:n.units,anchorRef:i,disableCustom:!0})))))};function mi(){return mi=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},mi.apply(null,arguments)}const fi=({popupState:t,anchorRef:n,showChildrenPerspective:r})=>{const s=(0,o.bindPopover)({...t,anchorEl:n.current??void 0});return e.createElement(o.Popover,mi({disablePortal:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{sx:{width:(n.current?.offsetWidth||0)-6+"px",mt:.5}}}},s),e.createElement(W.PopoverHeader,{title:(0,i.__)("Transform settings","elementor"),onClose:t.close,icon:e.createElement(U.AdjustmentsIcon,{fontSize:"tiny"})}),e.createElement(o.Divider,null),e.createElement(Et,{sx:{px:2,py:1.5}},e.createElement(m,{bind:"transform-origin"},e.createElement(pi,null)),r&&e.createElement(e.Fragment,null,e.createElement(o.Box,{sx:{my:.5}},e.createElement(o.Divider,null)),e.createElement(oi,null))))};function gi(){return gi=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},gi.apply(null,arguments)}const yi="tiny",bi=N(({showChildrenPerspective:n})=>{const r=b(t.transformPropTypeUtil),i=(0,e.useRef)(null),s=(0,o.usePopupState)({variant:"popover"});return e.createElement(d,r,e.createElement(fi,{popupState:s,anchorRef:i,showChildrenPerspective:n}),e.createElement(m,{bind:"transform-functions"},e.createElement(wi,{headerRef:i,propType:r.propType,popupState:s})))}),vi=e.createElement(o.Box,{component:"span","aria-label":void 0,sx:{display:"flex",gap:.5,p:2,width:320,borderRadius:1}},e.createElement(U.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"))),wi=({headerRef:n,propType:r,popupState:o})=>{const s=b(t.transformFunctionsPropTypeUtil),l=[Oo,Io,Po,_o],{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(ct,{initial:u()??Oo,propTypeUtil:t.transformFunctionsPropTypeUtil},e.createElement(kt,{label:(0,i.__)("Transform","elementor"),adornment:()=>e.createElement(T,{customContext:{path:["transform"],propType:r}}),ref:n},e.createElement(Ei,{popupState:o,repeaterBindKey:c}),e.createElement(je,{disabled:p,tooltipContent:vi,enableTooltip:p,ariaLabel:"transform"})),e.createElement(Je,null,e.createElement(at,{Icon:Yo,Label:Zo,actions:e.createElement(e.Fragment,null,e.createElement(dt,null),e.createElement(ft,null))})),e.createElement(vt,null,e.createElement(Jo,null))))},Ei=({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,gi({size:yi,"aria-label":s},(0,o.bindTrigger)(t)),e.createElement(U.AdjustmentsIcon,{fontSize:yi})))},xi=N(({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]),f=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(m,{bind:"selection"},e.createElement(f,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(m,{bind:"size"},e.createElement(Ce,{anchorRef:u,variant:h.variant,units:h.units,defaultUnit:h.defaultUnit,id:p}))))))}),ki={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"}}},Si=(()=>{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(!(0,s.hasProInstalled)())return!0;const e=window.elementorPro?.config?.version;return!!e&&(0,s.isVersionGreaterOrEqual)(e,"3.35")})()?t:[t[0]]})(),Ci=Si.map(e=>({label:e.label,items:e.properties.map(e=>e.label)}));var Ti=window.elementorV2.events;const Mi={eventName:"click_added_transition",location:"V4 Style Tab",secondaryLocation:"Transition control",trigger:"click"},Oi=(e,t)=>({app_type:t?.appTypes?.editor??"editor",window_name:t?.appTypes?.editor??"editor",interaction_type:t?.triggers?.click??"Click",target_name:e.target_name,target_location:e.target_location??"widget_panel",location_l1:e.location_l1??(0,In.getSelectedElements)()[0]?.type??"",...e.location_l2&&{location_l2:e.location_l2}}),Ii=(e,t)=>{const{dispatchEvent:n,config:r}=(0,Ti.getMixpanel)(),{eventName:o,interactionResult:i,interactionDescription:s}=t(r);o&&n?.(o,{...Oi(e,r),interaction_result:i,interaction_description:s})},Pi=e=>{Ii(e,e=>({eventName:e?.names?.promotions?.viewPromotion,interactionResult:e?.interactionResults?.promotionViewed??"promotion_viewed",interactionDescription:"user_viewed_promotion"}))},_i=e=>{Ii(e,e=>({eventName:e?.names?.promotions?.upgradePromotionClick,interactionResult:e?.interactionResults?.upgradeNow??"upgrade_now",interactionDescription:"user_clicked_upgrade_now"}))};function Ai(){return Ai=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},Ai.apply(null,arguments)}function Di(e){if(!e?.value)return null;for(const t of Si)for(const n of t.properties)if(n.value===e.value)return n;return null}const Ni=(e,t)=>t.filter(t=>t!==e.key.value),Ri=({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(Si.filter(e=>e.properties.some(e=>e.isDisabled)).map(e=>e.label)),[]);return e.createElement(o.Box,{ref:u},e.createElement(J,null,e.createElement(o.UnstableTag,Ai({variant:"outlined",label:c,endIcon:e.createElement(U.ChevronDownIcon,{fontSize:"tiny"})},(0,o.bindTrigger)(d),{fullWidth:!0}))),e.createElement(o.Popover,Ai({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(xn,{itemsList:(()=>{const e=n.map(e=>Di({value:e,$$type:"string"})?.label).filter(e=>!!e),t=Ci.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 Si){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:U.VariationsIcon,disabledItems:Ni(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(W.PromotionChip,null)),footer:s?e.createElement(W.PromotionAlert,{message:(0,i.__)("Upgrade to customize transition properties and control effects.","elementor"),upgradeUrl:"https://go.elementor.com/go-pro-transitions-modal/",onCtaClick:()=>_i({target_name:"transition_property",location_l2:"style"})}):null})))},zi={variant:"time",units:["s","ms"],defaultUnit:"ms"},$i=(0,t.createArrayPropUtils)(t.selectionSizePropTypeUtil.key,t.selectionSizePropTypeUtil.schema,"transition");Ne.subscribe("transition-item-added",e=>{const t=e,n=t?.itemValue?.selection?.value?.value?.value,r=(0,In.getSelectedElements)(),o=r[0]?.type??null;(0,Ti.trackEvent)({transition_type:n??"unknown",...Mi,widget_type:o})});const Li=(e,t,n)=>({selectionLabel:(0,i.__)("Type","elementor"),sizeLabel:(0,i.__)("Duration","elementor"),selectionConfig:{component:Ri,props:{recentlyUsedList:e,disabledItems:t,showPromotion:n}},sizeConfigMap:{...Si.reduce((e,t)=>(t.properties.forEach(t=>{e[t.value]=zi}),e),{})}}),Bi=e=>{const t=Di(e.value.selection.value?.value);return!!t&&!!t.isDisabled},Vi=(e,n,r)=>({propTypeUtil:t.selectionSizePropTypeUtil,component:xi,props:Li(e,n,r),isItemDisabled:Bi}),ji=(e,t)=>(e??[]).some(e=>e?.value?.selection?.value?.value?.value===t.value),Fi=(e=[])=>{if(!e?.length)return ki;for(const t of Si)for(const n of t.properties)if(!ji(e,n))return{...ki,selection:{$$type:"key-value",value:{key:{value:n.label,$$type:"string"},value:{value:n.value,$$type:"string"}}}};return ki},Ui=e.createElement(o.Alert,{sx:{width:280,gap:.5},color:"secondary",icon:e.createElement(U.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")))),Hi=N(({recentlyUsedListGetter:t,currentStyleState:n})=>{const r=null===n,[o,l]=(0,e.useState)([]),a=(0,s.hasProInstalled)(),{value:c,setValue:u}=b($i),{allDisabled:d,proDisabled:p}=(0,e.useMemo)(()=>((e=[])=>{const t=(e||[]).map(e=>e.value?.selection?.value?.key?.value),n=[];return Si.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}})(c),[c]),h=(0,e.useMemo)(()=>{const e=new Set;return Si.forEach(t=>{t.properties.forEach(t=>{t.isDisabled&&!a||e.add(t.value)})}),e},[a]);(0,e.useEffect)(()=>{if(!c||0===c.length)return;const e=c.filter(e=>{const t=e?.value?.selection?.value?.value?.value??"";return h.has(t)});e.length!==c.length&&u(e)},[h]),(0,e.useEffect)(()=>{t().then(l)},[t]);const m=(0,e.useMemo)(()=>((e=[])=>!!e?.length&&Si.every(t=>t.properties.every(t=>t.isDisabled||!!e?.find(e=>e.value?.selection?.value?.value?.value===t.value))))(c),[c]),f=!r||m;return e.createElement(co,{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:Fi(c),childControlConfig:Vi(o,d,p.length>0),propKey:"transition",addItemTooltipProps:{disabled:f,enableTooltip:!r,tooltipContent:Ui}})});var Wi=n(4353),qi=n.n(Wi);function Gi(){return Gi=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},Gi.apply(null,arguments)}const Ki=N(({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,Gi({},s,{value:r,setValue:i}),e.createElement(J,null,e.createElement(o.LocalizationProvider,null,e.createElement(o.Box,{display:"flex",gap:1,alignItems:"center"},e.createElement(m,{bind:"date"},e.createElement(o.DatePicker,{value:(e=>{if(!e)return null;const t=qi()(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(m,{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:qi()().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 Ji(e){this.content=e}Ji.prototype={constructor:Ji,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 Ji(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 Ji(n)},addToStart:function(e,t){return new Ji([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ji(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 Ji(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=Ji.from(e)).size?new Ji(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Ji.from(e)).size?new Ji(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ji.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}},Ji.from=function(e){if(e instanceof Ji)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ji(t)};var Yi=Ji;function Xi(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=Xi(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Qi(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=Qi(s.content,l.content,n-1,r-1);if(e)return e}n-=a,r-=a}else n-=a,r-=a}}class Zi{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 Zi(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 Zi(n,r)}cutByIndex(e,t){return e==t?Zi.empty:0==e&&t==this.content.length?this:new Zi(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 Zi(r,o)}addToStart(e){return new Zi([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Zi(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 Xi(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Qi(this,e,t,n)}findIndex(e){if(0==e)return ts(0,e);if(e==this.size)return ts(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?ts(t+1,r):ts(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 Zi.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Zi(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Zi.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 Zi(t||e,n)}static from(e){if(!e)return Zi.empty;if(e instanceof Zi)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Zi([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Zi.empty=new Zi([],0);const es={index:0,offset:0};function ts(e,t){return es.index=e,es.offset=t,es}function ns(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(!ns(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ns(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class rs{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&&ns(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 rs.none;if(e instanceof rs)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}rs.none=[];class is extends Error{}class ss{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=as(this.content,e+this.openStart,t);return n&&new ss(n,this.openStart,this.openEnd)}removeBetween(e,t){return new ss(ls(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 ss.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 ss(Zi.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 ss(e,n,r)}}function ls(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(ls(i.content,t-o-1,n-o-1)))}function as(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=as(s.content,t-i-1,n,s);return l&&e.replaceChild(o,s.copy(l))}function cs(e,t,n){if(n.openStart>e.depth)throw new is("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new is("Inconsistent open depths");return us(e,t,n,0)}function us(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=us(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(Zi.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return fs(i,gs(e,o,s,t,r))}{let r=e.parent,o=r.content;return fs(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return fs(i,ys(e,t,r))}function ds(e,t){if(!t.type.compatibleContent(e.type))throw new is("Cannot join "+t.type.name+" onto "+e.type.name)}function ps(e,t,n){let r=e.node(n);return ds(r,t.node(n)),r}function hs(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 ms(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&&(hs(e.nodeAfter,r),i++));for(let e=i;e<s;e++)hs(o.child(e),r);t&&t.depth==n&&t.textOffset&&hs(t.nodeBefore,r)}function fs(e,t){return e.type.checkContent(t),e.copy(t)}function gs(e,t,n,r,o){let i=e.depth>o&&ps(e,t,o+1),s=r.depth>o&&ps(n,r,o+1),l=[];return ms(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(ds(i,s),hs(fs(i,gs(e,t,n,r,o+1)),l)):(i&&hs(fs(i,ys(e,t,o+1)),l),ms(t,n,o,l),s&&hs(fs(s,ys(n,r,o+1)),l)),ms(r,null,o,l),new Zi(l)}function ys(e,t,n){let r=[];return ms(null,e,n,r),e.depth>n&&hs(fs(ps(e,t,n+1),ys(e,t,n+1)),r),ms(t,null,n,r),new Zi(r)}ss.empty=new ss(Zi.empty,0,0);class bs{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 rs.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 xs(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 bs(t,n,o)}static resolveCached(e,t){let n=Es.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 Es.set(e,n=new vs);let r=n.elts[n.i]=bs.resolve(e,t);return n.i=(n.i+1)%ws,r}}class vs{constructor(){this.elts=[],this.i=0}}const ws=12,Es=new WeakMap;class xs{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 ks=Object.create(null);class Ss{constructor(e,t,n,r=rs.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Zi.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&&ns(this.attrs,t||e.defaultAttrs||ks)&&rs.sameSet(this.marks,n||rs.none)}copy(e=null){return e==this.content?this:new Ss(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ss(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 ss.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 ss(l,r.depth-i,o.depth-i)}replace(e,t,n){return cs(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 bs.resolveCached(this,e)}resolveNoCache(e){return bs.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()+")"),Ts(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=Zi.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=rs.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(!rs.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=Zi.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}Ss.prototype.text=void 0;class Cs extends Ss{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):Ts(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 Cs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cs(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 Ts(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Ms{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Os(e,t);if(null==n.next)return Ms.empty;let r=Is(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]);Rs(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new Ms(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Ns);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(Rs(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 Zi.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")}}Ms.empty=new Ms(!0);class Os{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 Is(e){let t=[];do{t.push(Ps(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Ps(e){let t=[];do{t.push(_s(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function _s(e){let t=function(e){if(e.eat("(")){let t=Is(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=Ds(e,t)}return t}function As(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ds(e,t){let n=As(e),r=n;return e.eat(",")&&(r="}"!=e.next?As(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Ns(e,t){return t-e}function Rs(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(Ns)}function zs(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 $s(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 Ls(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 Bs(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new js(e,r,t[r]);return n}class Vs{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=Bs(e,n.attrs),this.defaultAttrs=zs(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==Ms.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:$s(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ss(this,this.computeAttrs(e),Zi.from(t),rs.setFrom(n))}createChecked(e=null,t,n){return t=Zi.from(t),this.checkContent(t),new Ss(this,this.computeAttrs(e),t,rs.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Zi.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(Zi.empty,!0);return o?new Ss(this,e,t.append(o),rs.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){Ls(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:rs.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new Vs(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 js{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 Fs{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Bs(e,r.attrs),this.excluded=null;let o=zs(this.attrs);this.instance=o?new rs(this,o):null}create(e=null){return!e&&this.instance?this.instance:new rs(this,$s(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new Fs(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){Ls(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Us{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=Yi.from(e.nodes),t.marks=Yi.from(e.marks||{}),this.nodes=Vs.compile(this.spec.nodes,this),this.marks=Fs.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]=Ms.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?Hs(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?[]:Hs(this,n.split(" "))}this.nodeFromJSON=e=>Ss.fromJSON(this,e),this.markFromJSON=e=>rs.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 Vs))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 Cs(n,n.defaultAttrs,e,rs.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 Hs(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 Ws{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 Xs(this,t,!1);return n.addAll(e,rs.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Xs(this,t,!0);return n.addAll(e,rs.none,t.from,t.to),ss.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(Qs(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=Zs(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=Zs(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ws(e,Ws.schemaRules(e)))}}const qs={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},Gs={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ks={ol:!0,ul:!0};function Js(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Ys{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=rs.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Zi.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=Zi.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Zi.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&&!qs.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Xs{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=Js(null,t.preserveWhitespace,0)|(n?4:0);r=o?new Ys(o.type,o.attrs,rs.none,!0,t.topMatch||o.type.contentMatch,i):new Ys(n?null:e.schema.topNodeType,null,rs.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();Ks.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&&Ks.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:Gs.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(qs.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=rs.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):el(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=Js(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let l=rs.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):el(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new Ys(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 Qs(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Zs(e){let t={};for(let n in e)t[n]=e[n];return t}function el(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 tl{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=rl(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}=il(rl(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&&il(rl(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return il(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=nl(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return nl(e.marks)}}function nl(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function rl(e){return e.document||window.document}const ol=new WeakMap;function il(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=ol.get(e);return void 0===t&&ol.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}=il(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 sl=Math.pow(2,16);function ll(e,t){return e+t*sl}function al(e){return 65535&e}class cl{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 ul{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ul.empty)return ul.empty}recover(e){let t=0,n=al(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))/sl}(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:ll(s/3,e-l),d=e==l?2:e==u?1:4;return(t<0?e!=l:e!=u)&&(d|=8),new cl(o,d,i)}r+=c-a}return n?e+r:new cl(e+r,0,null)}touches(e,t){let n=0,r=al(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 ul(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?ul.empty:new ul(e<0?[0,-e,0]:[0,0,e])}}ul.empty=new ul([]);class dl{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 dl(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 dl;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 cl(e,r,null)}}const pl=Object.create(null);class hl{getMap(){return ul.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=pl[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 pl)throw new RangeError("Duplicate use of step JSON ID "+e);return pl[e]=t,t.prototype.jsonID=e,t}}class ml{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ml(e,null)}static fail(e){return new ml(null,e)}static fromReplace(e,t,n,r){try{return ml.ok(e.replace(t,n,r))}catch(e){if(e instanceof is)return ml.fail(e.message);throw e}}}function fl(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(fl(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Zi.fromArray(r)}class gl extends hl{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 ss(fl(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 ml.fromReplace(e,this.from,this.to,o)}invert(){return new yl(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 gl(t.pos,n.pos,this.mark)}merge(e){return e instanceof gl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gl(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 gl(t.from,t.to,e.markFromJSON(t.mark))}}hl.jsonID("addMark",gl);class yl extends hl{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 ss(fl(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ml.fromReplace(e,this.from,this.to,n)}invert(){return new gl(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 yl(t.pos,n.pos,this.mark)}merge(e){return e instanceof yl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yl(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 yl(t.from,t.to,e.markFromJSON(t.mark))}}hl.jsonID("removeMark",yl);class bl extends hl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ml.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ml.fromReplace(e,this.pos,this.pos+1,new ss(Zi.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 bl(this.pos,t.marks[n]);return new bl(this.pos,this.mark)}}return new vl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new bl(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 bl(t.pos,e.markFromJSON(t.mark))}}hl.jsonID("addNodeMark",bl);class vl extends hl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ml.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ml.fromReplace(e,this.pos,this.pos+1,new ss(Zi.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new bl(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vl(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 vl(t.pos,e.markFromJSON(t.mark))}}hl.jsonID("removeNodeMark",vl);class wl extends hl{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&xl(e,this.from,this.to)?ml.fail("Structure replace would overwrite content"):ml.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ul([this.from,this.to-this.from,this.slice.size])}invert(e){return new wl(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 wl(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wl)||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?ss.empty:new ss(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wl(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?ss.empty:new ss(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wl(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 wl(t.from,t.to,ss.fromJSON(e,t.slice),!!t.structure)}}hl.jsonID("replace",wl);class El extends hl{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&&(xl(e,this.from,this.gapFrom)||xl(e,this.gapTo,this.to)))return ml.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ml.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?ml.fromReplace(e,this.from,this.to,n):ml.fail("Content does not fit in gap")}getMap(){return new ul([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 El(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 El(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 El(t.from,t.to,t.gapFrom,t.gapTo,ss.fromJSON(e,t.slice),t.insert,!!t.structure)}}function xl(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 kl(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 yl(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 ss(Zi.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),s.push(new wl(l+e.index,l+e.index+e[0].length,t))}}else s.push(new wl(l,c,ss.empty));l=c}if(!r.validEnd){let t=r.fillBefore(Zi.empty,!0);e.replace(l,l,new ss(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function Sl(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Cl(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||!Sl(i,s,l))break;s&&(r=1),l<i.childCount&&(o=1)}return null}function Tl(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(Ml).concat({type:t,attrs:n}).concat(i.map(Ml)):null}function Ml(e){return{type:e,attrs:null}}function Ol(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 Il(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 Pl(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 _l(e,t){let n=e.resolve(t),r=n.index();return Al(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Al(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 Dl(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&&Al(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 Nl(e,t,n=t,r=ss.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Rl(o,i,r)?new wl(t,n,r):new zl(o,i,r).fit()}function Rl(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}hl.jsonID("replaceAround",El);class zl{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Zi.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=Zi.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 ss(o,i,s);return e>-1?new El(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new wl(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=Bl(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(Zi.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=Bl(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new ss(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=Bl(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new ss($l(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new ss($l(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(Vl(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=Ll(this.placed,t,Zi.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?ss.empty:new ss($l(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new ss($l(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||!jl(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=jl(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=jl(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ll(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=Ll(this.placed,this.depth,Zi.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Zi.empty,!0);e.childCount&&(this.placed=Ll(this.placed,this.frontier.length,e))}}function $l(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy($l(e.firstChild.content,t-1,n)))}function Ll(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Ll(e.lastChild.content,t-1,n)))}function Bl(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Vl(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Vl(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(Zi.empty,!0)))),e.copy(r)}function jl(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let 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 Fl(e){return e.spec.defining||e.spec.definingForContent}function Ul(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Ul(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(Zi.empty,!0))}return e}function Hl(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 Wl extends hl{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 ml.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 ml.fromReplace(e,this.pos,this.pos+1,new ss(Zi.from(r),0,t.isLeaf?0:1))}getMap(){return ul.empty}invert(e){return new Wl(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 Wl(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 Wl(t.pos,t.attr,t.value)}}hl.jsonID("attr",Wl);class ql extends hl{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 ml.ok(n)}getMap(){return ul.empty}invert(e){return new ql(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 ql(t.attr,t.value)}}hl.jsonID("docAttr",ql);let Gl=class extends Error{};Gl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Gl.prototype=Object.create(Error.prototype)).constructor=Gl,Gl.prototype.name="TransformError";class Kl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new dl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Gl(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=ss.empty){let r=Nl(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new ss(Zi.from(n),0,0))}delete(e,t){return this.replace(e,t,ss.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(Rl(o,i,r))return e.step(new wl(t,n,r));let s=Hl(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=Fl(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 ss(Ul(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 ss(Zi.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=Hl(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=Zi.empty,d=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Zi.from(r.node(e).copy(u)),d++):a--;let p=Zi.empty,h=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,p=Zi.from(o.node(e).copy(p)),h++):c++;e.step(new El(a,c,s,l,new ss(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);Il(e,r.node(),r.before(),l)}s.inlineContent&&kl(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 wl(c,a.map(t+n,-1),ss.empty,!0)),!0===r){let t=e.doc.resolve(c);Ol(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Zi.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=Zi.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new El(o,i,o,i,new ss(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&&Il(e,t,n,i),kl(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 El(a,c,a+1,c-1,new ss(Zi.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&Ol(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 El(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ss(Zi.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Wl(e,t,n)),this}setDocAttribute(e,t){return this.step(new ql(e,t)),this}addNodeMark(e,t){return this.step(new bl(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 rs)t.isInSet(n.marks)&&this.step(new vl(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new vl(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=Zi.empty,s=Zi.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){i=Zi.from(o.node(e).copy(i));let t=r&&r[l];s=Zi.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new wl(t,t,new ss(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 yl(c,d,u[e])));i&&i.to==c?i.to=d:l.push(i=new gl(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 Fs){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 yl(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return kl(this,e,t,n),this}}const Jl=Object.create(null);class Yl{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Xl(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=ss.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?ss.empty:t),0==s&&la(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),la(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new ea(e):sa(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?sa(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):sa(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 oa(e.node(0))}static atStart(e){return sa(e,e,0,0,1)||new oa(e)}static atEnd(e){return sa(e,e,e.content.size,e.childCount,-1)||new oa(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Jl[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 Jl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Jl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ea.between(this.$anchor,this.$head).getBookmark()}}Yl.prototype.visible=!0;class Xl{constructor(e,t){this.$from=e,this.$to=t}}let Ql=!1;function Zl(e){Ql||e.parent.inlineContent||(Ql=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ea extends Yl{constructor(e,t=e){Zl(e),Zl(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 Yl.near(n);let r=e.resolve(t.map(this.anchor));return new ea(r.parent.inlineContent?r:n,n)}replace(e,t=ss.empty){if(super.replace(e,t),t==ss.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof ea&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ta(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 ea(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=Yl.findFrom(t,n,!0)||Yl.findFrom(t,-n,!0);if(!e)return Yl.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Yl.findFrom(e,-n,!0)||Yl.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new ea(e,t)}}Yl.jsonID("text",ea);class ta{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ta(e.map(this.anchor),e.map(this.head))}resolve(e){return ea.between(e.resolve(this.anchor),e.resolve(this.head))}}class na extends Yl{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?Yl.near(o):new na(o)}content(){return new ss(Zi.from(this.node),0,0)}eq(e){return e instanceof na&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ra(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new na(e.resolve(t.anchor))}static create(e,t){return new na(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}na.prototype.visible=!1,Yl.jsonID("node",na);class ra{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new ta(n,n):new ra(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&na.isSelectable(n)?new na(t):Yl.near(t)}}class oa extends Yl{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ss.empty){if(t==ss.empty){e.delete(0,e.doc.content.size);let t=Yl.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new oa(e)}map(e){return new oa(e)}eq(e){return e instanceof oa}getBookmark(){return ia}}Yl.jsonID("all",oa);const ia={map(){return this},resolve(e){return new oa(e)}};function sa(e,t,n,r,o,i=!1){if(t.inlineContent)return ea.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&&na.isSelectable(r))return na.create(e,n-(o<0?r.nodeSize:0))}else{let t=sa(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function la(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof wl||i instanceof El)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Yl.near(e.doc.resolve(o),n)))}class aa extends Kl{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 rs.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)||rs.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(Yl.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 ca(e,t){return t&&e?e.bind(t):e}class ua{constructor(e,t,n){this.name=e,this.init=ca(t.init,n),this.apply=ca(t.apply,n)}}const da=[new ua("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new ua("selection",{init(e,t){return e.selection||Yl.atStart(t.doc)},apply(e){return e.selection}}),new ua("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new ua("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class pa{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=da.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 ua(e.key,e.spec.state,e))})}}class ha{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 ha(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 aa(this)}static create(e){let t=new pa(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new ha(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 pa(this.schema,e.plugins),n=t.fields,r=new ha(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 pa(e.schema,e.plugins),o=new ha(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=Ss.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Yl.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 ma(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=ma(o,t,{})),n[r]=o}return n}class fa{constructor(e){this.spec=e,this.props={},e.props&&ma(e.props,this,this.props),this.key=e.key?e.key.key:ya("plugin")}getState(e){return e[this.key]}}const ga=Object.create(null);function ya(e){return e in ga?e+"$"+ ++ga[e]:(ga[e]=0,e+"$")}class ba{constructor(e="key"){this.key=ya(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const va=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function wa(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Ea=(e,t,n)=>{let r=wa(e,n);if(!r)return!1;let o=Ca(r);if(!o){let n=r.blockRange(),o=n&&Cl(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(za(e,o,t,-1))return!0;if(0==r.parent.content.size&&(ka(i,"end")||na.isSelectable(i)))for(let n=r.depth;;n--){let s=Nl(e.doc,r.before(n),r.after(n),ss.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(ka(i,"end")?Yl.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):na.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 xa(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=Nl(e.doc,o,s,ss.empty);if(!l||l.from!=o||l instanceof wl&&l.slice.size>=s-o)return!1;if(n){let t=e.tr.step(l);t.setSelection(ea.create(t.doc,o)),n(t.scrollIntoView())}return!0}function ka(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 Sa=(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=Ca(r)}let s=i&&i.nodeBefore;return!(!s||!na.isSelectable(s)||(t&&t(e.tr.setSelection(na.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),0))};function Ca(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 Ta(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Ma=(e,t,n)=>{let r=Ta(e,n);if(!r)return!1;let o=Ia(r);if(!o)return!1;let i=o.nodeAfter;if(za(e,o,t,1))return!0;if(0==r.parent.content.size&&(ka(i,"start")||na.isSelectable(i))){let n=Nl(e.doc,r.before(),r.after(),ss.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(ka(i,"start")?Yl.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):na.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))},Oa=(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=Ia(r)}let s=i&&i.nodeAfter;return!(!s||!na.isSelectable(s)||(t&&t(e.tr.setSelection(na.create(e.doc,i.pos)).scrollIntoView()),0))};function Ia(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 Pa=(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 _a(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 Aa=(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=_a(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(Yl.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Da=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof oa||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=_a(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(ea.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Na=(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(Pl(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Cl(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};var Ra;function za(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&&!_l(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=Zi.empty;for(let e=o.length-1;e>=0;e--)i=Zi.from(o[e].create(null,i));i=Zi.from(s.copy(i));let a=e.tr.step(new El(t.pos-1,r,t.pos,r,new ss(i,1,0),o.length,!0)),c=a.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&_l(a.doc,c.pos)&&a.join(c.pos),n(a.scrollIntoView())}return!0}let u=l.type.spec.isolating||r>0&&a?null:Yl.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),p=d&&Cl(d);if(null!=p&&p>=t.depth)return n&&n(e.tr.lift(d,p).scrollIntoView()),!0;if(c&&ka(l,"start",!0)&&ka(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=Zi.empty;for(let e=o.length-1;e>=0;e--)r=Zi.from(o[e].copy(r));n(e.tr.step(new El(t.pos-o.length,t.pos+l.nodeSize,t.pos+a,t.pos+l.nodeSize-a,new ss(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function $a(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(ea.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const La=$a(-1),Ba=$a(1);function Va(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 ja(...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 Fa=ja(va,Ea,Sa),Ua=ja(va,Ma,Oa);const Ha={Enter:ja(Pa,Da,Na,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof na&&e.selection.node.isBlock)return!(!n.parentOffset||!Pl(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=_a(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));let t=Ra;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 ea||e.selection instanceof oa)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=Pl(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=Pl(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":Aa,Backspace:Fa,"Mod-Backspace":Fa,"Shift-Backspace":Fa,Delete:Ua,"Mod-Delete":Ua,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new oa(e.doc))),!0)},Wa={"Ctrl-h":Ha.Backspace,"Alt-Backspace":Ha["Mod-Backspace"],"Ctrl-d":Ha.Delete,"Ctrl-Alt-Backspace":Ha["Mod-Delete"],"Alt-Delete":Ha["Mod-Delete"],"Alt-d":Ha["Mod-Delete"],"Ctrl-a":La,"Ctrl-e":Ba};for(let e in Ha)Wa[e]=Ha[e];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const qa=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Ga=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Ka=null;const Ja=function(e,t,n){let r=Ka||(Ka=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},Ya=function(e,t,n,r){return n&&(Qa(e,t,n,r,-1)||Qa(e,t,n,r,1))},Xa=/^(img|br|input|textarea|hr)$/i;function Qa(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Za(e))){let n=e.parentNode;if(!n||1!=n.nodeType||ec(e)||Xa.test(e.nodeName)||"false"==e.contentEditable)return!1;t=qa(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?Za(e):0}}}}function Za(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ec(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 tc=function(e){return e.focusNode&&Ya(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function nc(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const rc="undefined"!=typeof navigator?navigator:null,oc="undefined"!=typeof document?document:null,ic=rc&&rc.userAgent||"",sc=/Edge\/(\d+)/.exec(ic),lc=/MSIE \d/.exec(ic),ac=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ic),cc=!!(lc||ac||sc),uc=lc?document.documentMode:ac?+ac[1]:sc?+sc[1]:0,dc=!cc&&/gecko\/(\d+)/i.test(ic);dc&&(/Firefox\/(\d+)/.exec(ic)||[0,0])[1];const pc=!cc&&/Chrome\/(\d+)/.exec(ic),hc=!!pc,mc=pc?+pc[1]:0,fc=!cc&&!!rc&&/Apple Computer/.test(rc.vendor),gc=fc&&(/Mobile\/\w+/.test(ic)||!!rc&&rc.maxTouchPoints>2),yc=gc||!!rc&&/Mac/.test(rc.platform),bc=!!rc&&/Win/.test(rc.platform),vc=/Android \d/.test(ic),wc=!!oc&&"webkitFontSmoothing"in oc.documentElement.style,Ec=wc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xc(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 kc(e,t){return"number"==typeof e?e:e[t]}function Sc(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 Cc(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=Ga(s);continue}let e=s,n=e==i.body,l=n?xc(i):Sc(e),a=0,c=0;if(t.top<l.top+kc(r,"top")?c=-(l.top-t.top+kc(o,"top")):t.bottom>l.bottom-kc(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+kc(o,"top")-l.top:t.bottom-l.bottom+kc(o,"bottom")),t.left<l.left+kc(r,"left")?a=-(l.left-t.left+kc(o,"left")):t.right>l.right-kc(r,"right")&&(a=t.right-l.right+kc(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:Ga(s)}}function Tc(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ga(r));return t}function Mc(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 Oc=null;function Ic(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=Ja(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,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=Nc(o,1);if(r.top!=r.bottom&&Pc(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:l}:Ic(n,r)}function Pc(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function _c(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(Pc(t,o))return _c(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Ac(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(Za(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Za(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(!Pc(t,n))return null;if(l=_c(e.dom,t,n),!l)return null}if(fc)for(let e=l;n&&e;e=Ga(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(dc&&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;wc&&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}=Ic(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 Dc(e){return e.top<e.bottom||e.left<e.right}function Nc(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Dc(e))return e}return Array.prototype.find.call(n,Dc)||e.getBoundingClientRect()}const Rc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function zc(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=wc||dc;if(3==r.nodeType){if(!s||!Rc.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++,$c(Nc(Ja(r,e,t),i),i<0)}{let e=Nc(Ja(r,o,o),n);if(dc&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Nc(Ja(r,o-1,o-1),-1);if(t.top==e.top){let n=Nc(Ja(r,o,o+1),-1);if(n.top!=e.top)return $c(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Za(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Lc(e.getBoundingClientRect(),!1)}if(null==i&&o<Za(r)){let e=r.childNodes[o];if(1==e.nodeType)return Lc(e.getBoundingClientRect(),!0)}return Lc(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Za(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Ja(e,Za(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return $c(Nc(t,1),!1)}if(null==i&&o<Za(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Ja(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return $c(Nc(t,-1),!0)}return $c(Nc(3==r.nodeType?Ja(r):r,-n),n>=0)}function $c(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 Lc(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 Bc(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 Vc=/[\u0590-\u08ac]/;let jc=null,Fc=null,Uc=!1;class Hc{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>qa(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 Xc){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 Wc&&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?qa(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?qa(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=qa(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=qa(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((dc||fc)&&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:qa(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(dc&&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&&fc)&&Ya(s.node,s.offset,c.anchorNode,c.anchorOffset)&&Ya(l.node,l.offset,c.focusNode,c.focusOffset))return;let d=!1;if((a.extend||e==t)&&(!u||!dc)){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 Wc extends Hc{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 qc extends Hc{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 Gc extends Hc{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=tl.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Gc(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=Gc.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=uu(o,t,i,n)),e>0&&(o=uu(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 Kc extends Hc{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=tl.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=iu(c,n,t),a?s=new Qc(e,t,n,r,c,u||null,d,a,o,i+1):t.isText?new Yc(e,t,n,r,c,d,o):new Kc(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=()=>Zi.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)&&su(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 au(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(cu);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 m=i+p.nodeSize;if(p.isText){let e=m;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<m&&(a=p.cut(e-i),p=p.cut(0,e-i),m=e,h=-1)}else for(;s<o.length&&o[s].to<m;)s++;r(p,p.isInline&&!p.isLeaf?l.filter(e=>!e.inline):l.slice(),t.forChild(i,p),h),i=m}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&l.syncToMarks(o==this.node.childCount?rs.none:this.node.child(o).marks,n,e,o),l.placeWidget(t,e,r)},(t,i,a,c)=>{let u;l.syncToMarks(t.marks,n,e,c),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,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Zc(this.contentDOM,this.children,e),gc&&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 ea)||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 qc(this,o,t,r);e.input.compositionNodes.push(i),this.children=uu(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(su(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ru(this.dom,this.nodeDOM,nu(this.outerDeco,this.node,t),nu(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 Jc(e,t,n,r,o){iu(r,t,e);let i=new Kc(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class Yc extends Kc{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 Yc(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 Xc extends Hc{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 Qc extends Kc{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 Zc(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=lu(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(l,r);if(s instanceof Gc){let t=r?r.previousSibling:e.lastChild;Zc(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=lu(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const eu=function(e){e&&(this.nodeName=e)};eu.prototype=Object.create(null);const tu=[new eu];function nu(e,t,n){if(0==e.length)return tu;let r=n?tu[0]:new eu,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new eu(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new eu(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 ru(e,t,n,r){if(n==tu&&r==tu)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=tu[0]),o=t}ou(o,s||tu[0],i)}return o}function ou(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 iu(e,t,n){return ru(e,e,tu,nu(t,n,1!=e.nodeType))}function su(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 lu(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class au{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 Gc)){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,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=Gc.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let 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 Kc){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&&su(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)||!su(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Kc.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=Kc.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 Wc(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 Gc;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Yc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((fc||hc)&&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 Xc(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 cu(e,t){return e.type.side-t.type.side}function uu(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 du(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(tc(n)){for(l=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&na.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Za(e);r||o;){if(e==n)return!0;let t=qa(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Za(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;a=new na(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=wu(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)),a}function pu(e){return e.editable?e.hasFocus():xu(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function hu(e,t=!1){let n=e.state.selection;if(bu(e,n),pu(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&hc){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Ya(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,qa(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&cc&&uc<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!mu||n instanceof ea||(n.$from.parent.inlineContent||(r=fu(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=fu(e,n.to))),e.docView.setSelection(i,s,e,t),mu&&(r&&yu(r),o&&yu(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(()=>{pu(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const mu=fc||hc&&mc<63;function fu(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(fc&&o&&"false"==o.contentEditable)return gu(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return gu(o);if(i)return gu(i)}}function gu(e){return e.contentEditable="true",fc&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function yu(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function bu(e,t){if(t instanceof na){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(vu(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else vu(e)}function vu(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function wu(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||ea.between(t,n,r)}function Eu(e){return!(e.editable&&!e.hasFocus())&&xu(e)}function xu(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 ku(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&&Yl.findFrom(i,t)}function Su(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Cu(e,t,n){let r=e.state.selection;if(!(r instanceof ea)){if(r instanceof na&&r.node.isInline)return Su(e,new ea(t>0?r.$to:r.$from));{let n=ku(e.state,t);return!!n&&Su(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 Su(e,new ea(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=ku(e.state,t);return!!(n&&n instanceof na)&&Su(e,n)}if(!(yc&&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)&&(na.isSelectable(i)?Su(e,new na(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!wc&&Su(e,new ea(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Tu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Mu(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Ou(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(dc&&1==n.nodeType&&r<Tu(n)&&Mu(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Mu(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Iu(n))break;{let t=n.previousSibling;for(;t&&Mu(t,-1);)o=n.parentNode,i=qa(t),t=t.previousSibling;if(t)n=t,r=Tu(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Pu(e,n,r):o&&Pu(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Tu(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Mu(n.childNodes[r],1))break;o=n,i=++r}else{if(Iu(n))break;{let t=n.nextSibling;for(;t&&Mu(t,1);)o=t.parentNode,i=qa(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Tu(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Pu(e,o,i)}(e)}function Iu(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Pu(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!ec(e);)t=qa(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&&!ec(e);)t=qa(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(tc(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&&hu(e)},50)}function _u(e,t){let n=e.state.doc.resolve(t);if(!hc&&!bc&&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 Au(e,t,n){let r=e.state.selection;if(r instanceof ea&&!r.empty||n.indexOf("s")>-1)return!1;if(yc&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=ku(e.state,t);if(n&&n instanceof na)return Su(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof oa?Yl.near(n,t):Yl.findFrom(n,t);return!!s&&Su(e,s)}return!1}function Du(e,t){if(!(e.state.selection instanceof ea))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 Nu(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Ru(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")||tl.fromSchema(e.state.schema),l=Wu(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c,u=a.firstChild,d=0;for(;u&&1==u.nodeType&&(c=Uu[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 zu(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 ss(Zi.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=tl.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=Wu().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&Uu[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?(qu||(qu=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),qu.createHTML(e)):e}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),wc&&function(e){let t=e.querySelectorAll(hc?"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")||Ws.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!a&&!u),context:o,ruleFromNode(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||$u.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=Zi.from(t.create(n[e+1],o)),i++,s++}return new ss(o,i,s)}(Fu(s,+u[1],+u[2]),u[4]);else if(s=ss.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&&Bu(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Vu(i[i.length-1],r.length));let t=Lu(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return Zi.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=Fu(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,a)}),s}const $u=/^(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 Lu(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Zi.from(e));return e}function Bu(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Bu(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(Zi.from(Lu(n,e,o+1))))}}function Vu(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Vu(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Zi.empty,!0);return e.copy(n.append(r))}function ju(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=ju(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(Zi.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function Fu(e,t,n){return t<e.openStart&&(e=new ss(ju(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ss(ju(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Uu={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 Hu=null;function Wu(){return Hu||(Hu=document.implementation.createHTMLDocument("title"))}let qu=null;const Gu={},Ku={},Ju={touchstart:!0,touchmove:!0};class Yu{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Xu(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Qu(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Zu(e,t))})}function Zu(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function ed(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 td(e){return{left:e.clientX,top:e.clientY}}function nd(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 rd(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 od(e,t,n,r){return nd(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function id(e,t,n,r){return nd(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&&(rd(e,ea.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)rd(e,ea.create(r,i+1,i+1+n.content.size),"pointer");else{if(!na.isSelectable(n))continue;rd(e,na.create(r,i),"pointer")}return!0}}(e,n,r)}function sd(e){return hd(e)}Ku.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!cd(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!vc||!hc||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!gc||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||yc&&72==n&&"c"==r)return Du(e,-1)||Ou(e,-1);if(46==n&&!t.shiftKey||yc&&68==n&&"c"==r)return Du(e,1)||Ou(e,1);if(13==n||27==n)return!0;if(37==n||yc&&66==n&&"c"==r){let t=37==n?"ltr"==_u(e,e.state.selection.from)?-1:1:-1;return Cu(e,t,r)||Ou(e,t)}if(39==n||yc&&70==n&&"c"==r){let t=39==n?"ltr"==_u(e,e.state.selection.from)?1:-1:1;return Cu(e,t,r)||Ou(e,t)}return 38==n||yc&&80==n&&"c"==r?Au(e,-1,r)||Ou(e,-1):40==n||yc&&78==n&&"c"==r?function(e){if(!fc||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;Nu(e,n,"true"),setTimeout(()=>Nu(e,n,"false"),20)}return!1}(e)||Au(e,1,r)||Ou(e,1):r==(yc?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Xu(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,nc(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Ku.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},Ku.keypress=(e,t)=>{let n=t;if(cd(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||yc&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof ea&&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 ld=yc?"metaKey":"ctrlKey";Gu.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=sd(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[ld]&&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(td(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ad(e,s,n,!!r)):("doubleClick"==i?od:id)(e,s.pos,s.inside,n)?n.preventDefault():Xu(e,"pointer"))};class ad{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[ld],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 na&&a.from<=i&&a.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!dc||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)),Xu(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(()=>hu(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(td(e))),this.updateAllowDefault(e),this.allowDefault||!t?Xu(this.view,"pointer"):function(e,t,n,r,o){return nd(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 na&&(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(na.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&&(rd(e,na.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&&na.isSelectable(r))&&(rd(e,new na(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||fc&&this.mightDrag&&!this.mightDrag.node.isAtom||hc&&!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)?(rd(this.view,Yl.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Xu(this.view,"pointer")}move(e){this.updateAllowDefault(e),Xu(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 cd(e,t){return!!e.composing||!!(fc&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Gu.touchstart=e=>{e.input.lastTouch=Date.now(),sd(e),Xu(e,"pointer")},Gu.touchmove=e=>{e.input.lastTouch=Date.now(),Xu(e,"pointer")},Gu.contextmenu=e=>sd(e);const ud=vc?5e3:-1;function dd(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>hd(e),t))}function pd(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 hd(e,t=!1){if(!(vc&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),pd(e),t||e.docView&&e.docView.dirty){let n=du(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}}Ku.compositionstart=Ku.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof ea&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||hc&&bc&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),hd(e,!0),e.markCursor=null;else if(hd(e,!t.selection.empty),dc&&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}dd(e,ud)},Ku.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,dd(e,20))};const md=cc&&uc<15||gc&&Ec<604;function fd(e,t,n,r,o){let i=zu(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||ss.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 gd(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," "):""}Gu.copy=Ku.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=md?null:n.clipboardData,s=r.content(),{dom:l,text:a}=Ru(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"))},Ku.paste=(e,t)=>{let n=t;if(e.composing&&!vc)return;let r=md?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&fd(e,gd(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?fd(e,r.value,null,o,t):fd(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class yd{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const bd=yc?"altKey":"ctrlKey";function vd(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[bd]}Gu.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(td(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof na?i.to-1:i.to));else if(r&&r.mightDrag)o=na.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=na.create(e.state.doc,t.posBefore))}let l=(o||e.state.selection).content(),{dom:a,text:c,slice:u}=Ru(e,l);(!n.dataTransfer.files.length||!hc||mc>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(md?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",md||n.dataTransfer.setData("text/plain",c),e.dragging=new yd(u,vd(e,n),o)},Gu.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Ku.dragover=Ku.dragenter=(e,t)=>t.preventDefault(),Ku.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(td(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=zu(e,gd(t.dataTransfer),md?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!vd(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||ss.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let l=i?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,o.pos,i):o.pos;null==l&&(l=o.pos);let a=e.state.tr;if(s){let{node:e}=n;e?e.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let p=a.doc.resolve(c);if(u&&na.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new na(p));else{let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),a.setSelection(wu(e,p,a.doc.resolve(t)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Gu.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())&&hu(e)},20))},Gu.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)},Gu.beforeinput=(e,t)=>{if(hc&&vc&&"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,nc(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 Ku)Gu[e]=Ku[e];function wd(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 Ed{constructor(e,t){this.toDOM=e,this.spec=t||Td,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 Sd(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ed&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&wd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xd{constructor(e,t){this.attrs=e,this.spec=t||Td}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 Sd(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xd&&wd(this.attrs,e.attrs)&&wd(this.spec,e.spec)}static is(e){return e.type instanceof xd}destroy(){}}class kd{constructor(e,t){this.attrs=e,this.spec=t||Td}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 Sd(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 kd&&wd(this.attrs,e.attrs)&&wd(this.spec,e.spec)}destroy(){}}class Sd{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Sd(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 Sd(e,e,new Ed(t,n))}static inline(e,t,n,r){return new Sd(e,t,new xd(n,r))}static node(e,t,n,r){return new Sd(e,t,new kd(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof xd}get widget(){return this.type instanceof Ed}}const Cd=[],Td={};class Md{constructor(e,t){this.local=e.length?e:Cd,this.children=t.length?t:Cd}static create(e,t){return t.length?Dd(t,e,0,Td):Od}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==Od||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Td)}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),m=r.maybeChild(p);if(m&&h==u&&h+m.nodeSize==d){let r=l[t+2].mapInner(n,m,c+1,e[t]+i+1,s);r!=Od?(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=Dd(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 Md(t.sort(Nd),l)}(this.children,i||[],e,t,n,r,o):i?new Md(i.sort(Nd),Cd):Od}add(e,t){return t.length?this==Od?Md.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=_d(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,Dd(s,e,l+1,Td)),o+=3}});let i=Pd(o?Ad(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new Md(i.length?this.local.concat(i).sort(Nd):this.local,r||this.children)}remove(e){return 0==e.length||this==Od?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!=Od?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 Md(r,n):Od}forChild(e,t){if(this==Od)return this;if(t.isLeaf)return Md.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 xd){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 Md(r.sort(Nd),Cd);return n?new Id([e,n]):e}return n||Od}eq(e){if(this==e)return!0;if(!(e instanceof Md)||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 Rd(this.localsInner(e))}localsInner(e){if(this==Od)return Cd;if(e.inlineContent||!this.local.some(xd.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof xd||t.push(this.local[e]);return t}forEachSet(e){e(this)}}Md.empty=new Md([],[]),Md.removeOverlap=Rd;const Od=Md.empty;class Id{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,Td));return Id.from(n)}forChild(e,t){if(t.isLeaf)return Md.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Od&&(o instanceof Id?n=n.concat(o.members):n.push(o))}return Id.from(n)}eq(e){if(!(e instanceof Id)||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?Rd(n?t:t.sort(Nd)):Cd}static from(e){switch(e.length){case 0:return Od;case 1:return e[0];default:return new Id(e.every(e=>e instanceof Md)?e:e.reduce((e,t)=>e.concat(t instanceof Md?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Pd(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 Sd(o.from+t,o.to+t,o.type))}return n}function _d(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 Ad(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Dd(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let l=_d(e,t,s+n);if(l){i=!0;let e=Dd(l,t,n+s+1,r);e!=Od&&o.push(s,s+t.nodeSize,e)}});let s=Pd(i?Ad(e):e,-n).sort(Nd);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 Md(s,o):Od}function Nd(e,t){return e.from-t.from||e.to-t.to}function Rd(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),zd(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),zd(t,o+1,i.copy(r.to,i.to)))}}return t}function zd(e,t,n){for(;t<e.length&&Nd(n,e[t])>0;)t++;e.splice(t,0,n)}function $d(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Od&&t.push(r)}),e.cursorWrapper&&t.push(Md.create(e.state.doc,[e.cursorWrapper.deco])),Id.from(t)}const Ld={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Bd=cc&&uc<=11;class Vd{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 jd{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Vd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);cc&&uc<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():fc&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Bd&&(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,Ld)),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(Eu(this.view)){if(this.suppressingSelectionUpdates)return hu(this.view);if(cc&&uc<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ya(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=Ga(t))n.add(t);for(let r=e.anchorNode;r;r=Ga(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)&&Eu(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(!l.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(dc&&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&&Wd(e,n)==t||r.remove()}}}}else for(let e of l)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;t&&1==t.nodeType&&"false"==t.contentEditable&&e.parentNode.removeChild(e)}let a=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&tc(n)&&(a=du(e))&&a.eq(Yl.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hu(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(!Fd.has(e)&&(Fd.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=dc,Ud)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."),Ud=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,l)),this.handleDOMChange(o,i,s,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||hu(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(cc&&uc<=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?qa(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),l=o&&o.parentNode==e.target?qa(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 Fd=new WeakMap,Ud=!1;function Hd(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Ya(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Wd(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 qd(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(fc&&/^(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||fc&&/^(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 Gd=/^(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 Kd(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:wu(e,t.resolve(n.anchor),t.resolve(n.head))}function Jd(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 Yd(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 Xd{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 Yu,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(np),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=ep(this),Zd(this),this.nodeViews=tp(this),this.docView=Jc(this.state.doc,Qd(this),$d(this),this.dom,this),this.domObserver=new jd(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=du(e,t);if(n&&!e.state.selection.eq(n)){if(hc&&vc&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,nc(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}],tc(c)||r.push({node:c.focusNode,offset:c.focusOffset})),hc&&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")||Ws.fromSchema(e.state.schema),h=d.resolve(l),m=null,f=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:qd,context:h});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),m={anchor:e+l,head:t+l}}return{doc:f,sel:m,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 m=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&&Yd(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&&Yd(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(m&&e.input.domChangeCount++,(gc&&e.input.lastIOSEnter>Date.now()-225||vc)&&o.some(e=>1==e.nodeType&&!Gd.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,nc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!m){if(!(r&&u instanceof ea&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=Kd(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}m={start:u.from,endA:u.to,endB:u.to}}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof ea&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),cc&&uc<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&" "==d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)&&(m.start--,m.endA--,m.endB--);let f=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),y=p.resolve(m.start),b=f.sameParent(g)&&f.parent.inlineContent&&y.end()>=m.endA;if((gc&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&f.pos<d.doc.content.size&&(!f.sameParent(g)||!f.parent.inlineContent)&&f.pos<g.pos&&!/\S/.test(d.doc.textBetween(f.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,nc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>m.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Jd(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(Jd(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Jd(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,m.start,m.endA,f,g)&&e.someProp("handleKeyDown",t=>t(e,nc(8,"Backspace"))))return void(vc&&hc&&e.domObserver.suppressSelectionUpdates());hc&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),vc&&!b&&f.start()!=g.start()&&0==g.parentOffset&&f.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,nc(13,"Enter"))})},20));let v,w=m.start,E=m.endA,x=t=>{let n=t||e.state.tr.replace(w,E,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let t=Kd(e,n.doc,d.sel);t&&!(hc&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(E)-1)||cc&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(f.pos==g.pos){cc&&uc<=11&&0==f.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>hu(e),20));let t=x(e.state.tr.delete(w,E)),n=p.resolve(m.start).marksAcross(p.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.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(Zi.from(c).eq(e))return{mark:r,type:n}}(f.parent.content.cut(f.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,m.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(f.parent.child(f.index()).isText&&f.index()==g.index()-(g.textOffset?0:1)){let t=f.parent.textBetween(f.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 Gu){let n=Gu[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!ed(e,t)||Zu(e,t)||!e.editable&&t.type in Ku||n(e,t)},Ju[t]?{passive:!0}:void 0)}fc&&e.dom.addEventListener("input",()=>null),Qu(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&&Qu(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(np),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&&(pd(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=tp(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)&&Qu(this),this.editable=ep(this),Zd(this);let l=$d(this),a=Qd(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:Tc(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(cc||hc)&&!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=hc?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=Za(e=e.childNodes[t-1])}else{if(!e.parentNode||ec(e))return null;t=qa(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||ec(e))return null;t=qa(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=Jc(e.doc,a,l,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Ya(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?hu(this,t):(bu(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;Mc(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 na){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Cc(this,t.getBoundingClientRect(),e)}else Cc(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 yd(e.slice,e.move,r<0?void 0:na.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(cc){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(Oc)return e.focus(Oc);let t=Tc(e);e.focus(null==Oc?{get preventScroll(){return Oc={preventScroll:!0},!0}}:void 0),Oc||(Oc=!1,Mc(t,0))}(this.dom),hu(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 Ac(this,e)}coordsAtPos(e,t=1){return zc(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 jc==t&&Fc==n?Uc:(jc=t,Fc=n,Uc="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Bc(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=zc(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=Ja(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?Vc.test(r.parent.textContent)&&l.modify?Bc(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 fd(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return fd(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ru(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,[],$d(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Ka=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Zu(e,t)||!Gu[t.type]||!e.editable&&t.type in Ku||Gu[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?fc&&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 Hd(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?Hd(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Qd(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"),[Sd.node(0,e.state.doc.content.size,t)]}function Zd(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:Sd.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function ep(e){return!e.someProp("editable",t=>!1===t(e.state))}function tp(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 np(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")}Xd.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var rp={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:"'"},op={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ip="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),sp="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),lp=0;lp<10;lp++)rp[48+lp]=rp[96+lp]=String(lp);for(lp=1;lp<=24;lp++)rp[lp+111]="F"+lp;for(lp=65;lp<=90;lp++)rp[lp]=String.fromCharCode(lp+32),op[lp]=String.fromCharCode(lp);for(var ap in rp)op.hasOwnProperty(ap)||(op[ap]=rp[ap]);const cp="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),up="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function dp(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);cp?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function pp(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 hp(e){let t=function(e){let t=Object.create(null);for(let n in e)t[dp(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(ip&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||sp&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?op:rp)[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[pp(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[pp(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(up&&n.ctrlKey&&n.altKey)&&(r=rp[n.keyCode])&&r!=o){let o=t[pp(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var mp=Object.defineProperty,fp=(e,t)=>{for(var n in t)mp(e,n,{get:t[n],enumerable:!0})};function gp(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 yp=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:gp({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}},bp={};fp(bp,{blur:()=>vp,clearContent:()=>wp,clearNodes:()=>Ep,command:()=>xp,createParagraphNear:()=>kp,cut:()=>Sp,deleteCurrentNode:()=>Cp,deleteNode:()=>Mp,deleteRange:()=>Op,deleteSelection:()=>Ip,enter:()=>Pp,exitCode:()=>_p,extendMarkRange:()=>Lp,first:()=>Bp,focus:()=>Wp,forEach:()=>qp,insertContent:()=>Gp,insertContentAt:()=>Xp,joinBackward:()=>eh,joinDown:()=>Zp,joinForward:()=>th,joinItemBackward:()=>nh,joinItemForward:()=>rh,joinTextblockBackward:()=>oh,joinTextblockForward:()=>ih,joinUp:()=>Qp,keyboardShortcut:()=>lh,lift:()=>ch,liftEmptyBlock:()=>uh,liftListItem:()=>dh,newlineInCode:()=>ph,resetAttributes:()=>fh,scrollIntoView:()=>gh,selectAll:()=>yh,selectNodeBackward:()=>bh,selectNodeForward:()=>vh,selectParentNode:()=>wh,selectTextblockEnd:()=>Eh,selectTextblockStart:()=>xh,setContent:()=>Sh,setMark:()=>nm,setMeta:()=>rm,setNode:()=>om,setNodeSelection:()=>im,setTextDirection:()=>sm,setTextSelection:()=>lm,sinkListItem:()=>am,splitBlock:()=>um,splitListItem:()=>dm,toggleList:()=>mm,toggleMark:()=>fm,toggleNode:()=>gm,toggleWrap:()=>ym,undoInputRule:()=>bm,unsetAllMarks:()=>vm,unsetMark:()=>wm,unsetTextDirection:()=>Em,updateAttributes:()=>xm,wrapIn:()=>km,wrapInList:()=>Sm});var vp=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),wp=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),Ep=()=>({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=Cl(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)},xp=e=>t=>e(t),kp=()=>({state:e,dispatch:t})=>Da(e,t),Sp=(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 ea(r.doc.resolve(Math.max(s-1,0)))),!0},Cp=()=>({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 Tp(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Mp=e=>({tr:t,state:n,dispatch:r})=>{const o=Tp(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},Op=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},Ip=()=>({state:e,dispatch:t})=>va(e,t),Pp=()=>({commands:e})=>e.keyboardShortcut("Enter"),_p=()=>({state:e,dispatch:t})=>Aa(e,t);function Ap(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Dp(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Ap(t[r])?t[r].test(e[r]):t[r]===e[r])}function Np(e,t,n={}){return e.find(e=>e.type===t&&Dp(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Rp(e,t,n={}){return!!Np(e,t,n)}function zp(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),!Np([...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&&Rp([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&Rp([...e.parent.child(l).marks],t,n);)a+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function $p(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 Lp=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=$p(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){const e=zp(a,i,t);if(e&&e.from<=c&&e.to>=u){const t=ea.create(s,e.from,e.to);n.setSelection(t)}}return!0},Bp=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 Vp(e){return e instanceof ea}function jp(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Fp(e,t=null){if(!t)return null;const n=Yl.atStart(e),r=Yl.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?ea.create(e,jp(0,o,i),jp(e.content.size,o,i)):ea.create(e,jp(t,o,i),jp(t,o,i))}function Up(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function Hp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Wp=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(Hp()||Up())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||Hp()||Up()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!Vp(n.state.selection))return s(),!0;const l=Fp(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},qp=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Gp=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Kp=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&&Kp(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 Kp(n)}function Yp(e,t,n){if(e instanceof Ss||e instanceof Zi)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 Zi.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),Yp("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new Us({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?Ws.fromSchema(i).parseSlice(Jp(e),n.parseOptions):Ws.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=Ws.fromSchema(t);return n.slice?r.parseSlice(Jp(e),n.parseOptions).content:r.parse(Jp(e),n.parseOptions)}return Yp("",t,n)}var Xp=(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{Yp(t,i.schema,{parseOptions:a,errorOnInvalidContent:!0})}catch(e){l(e)}try{o=Yp(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 Zi){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 wl||r instanceof El))return;const o=e.mapping.maps[n];let i=0;o.forEach((e,t,n,r)=>{0===i&&(i=r)}),e.setSelection(Yl.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},Qp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof na;if(o){if(r.node.isTextblock||!_l(e.doc,r.from))return!1;n=r.from}else if(n=Dl(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(na.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Zp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof na){if(r.node.isTextblock||!_l(e.doc,r.to))return!1;n=r.to}else if(n=Dl(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),eh=()=>({state:e,dispatch:t})=>Ea(e,t),th=()=>({state:e,dispatch:t})=>Ma(e,t),nh=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Dl(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},rh=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Dl(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},oh=()=>({state:e,dispatch:t})=>((e,t)=>{let n=wa(e,void 0);if(!n)return!1;let r=Ca(n);return!!r&&xa(e,r,t)})(e,t),ih=()=>({state:e,dispatch:t})=>((e,t)=>{let n=Ta(e,void 0);if(!n)return!1;let r=Ia(n);return!!r&&xa(e,r,t)})(e,t);function sh(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var lh=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}`);Hp()||sh()?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 ah(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?Tp(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=>Dp(e.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}var ch=(e,t={})=>({state:n,dispatch:r})=>!!ah(n,Tp(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Cl(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),uh=()=>({state:e,dispatch:t})=>Na(e,t),dh=e=>({state:t,dispatch:n})=>{return(r=Tp(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 El(i-1,s,i,s,new ss(Zi.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new xs(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=Cl(r);if(null==l)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return _l(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?Zi.empty:Zi.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new El(d-(l?1:0),p+(a?1:0),d+1,p-1,new ss((l?Zi.empty:Zi.from(o.copy(Zi.empty))).append(a?Zi.empty:Zi.from(o.copy(Zi.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}(e,t,i)))})(t,n);var r},ph=()=>({state:e,dispatch:t})=>Pa(e,t);function hh(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function mh(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 fh=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=hh("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(i=Tp(e,r.schema)),"mark"===l&&(s=$p(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,mh(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(mh(i.attrs,t))))})})}),a},gh=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),yh=()=>({tr:e,dispatch:t})=>{if(t){const t=new oa(e.doc);e.setSelection(t)}return!0},bh=()=>({state:e,dispatch:t})=>Sa(e,t),vh=()=>({state:e,dispatch:t})=>Oa(e,t),wh=()=>({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(na.create(e.doc,n))),!0)})(e,t),Eh=()=>({state:e,dispatch:t})=>Ba(e,t),xh=()=>({state:e,dispatch:t})=>La(e,t);function kh(e,t,n={},r={}){return Yp(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Sh=(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=kh(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 Ch(e,t){const n=$p(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 Th(e,t){const n=new Kl(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Mh(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 Oh(e,t,n){return void 0===e.config[t]&&e.parent?Oh(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?Oh(e.parent,t,n):null}):e.config[t]}function Ih(e){return e.map(e=>{const t=Oh(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Ih(t())]:e}).flat(10)}function Ph(e,t){const n=tl.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function _h(e){return"function"==typeof e}function Ah(e,t=void 0,...n){return _h(e)?t?e.bind(t)(...n):e(...n):e}function Dh(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Nh(e){const t=[],{nodeExtensions:n,markExtensions:r}=Dh(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),l=r.map(e=>e.name),a=[...s,...l];return e.forEach(e=>{const n=Oh(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?a:"nodes"===e.types?s:"marks"===e.types?l:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Oh(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 Rh(...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 zh(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)=>Rh(e,t),{})}function $h(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 Lh(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 Bh(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 Vh(e){return e.sort((e,t)=>{const n=Oh(e,"priority")||100,r=Oh(t,"priority")||100;return n>r?-1:n<r?1:0})}function jh(e){const t=Vh(Ih(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 Fh(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 Uh(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Hh(e,t){const n=hh("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=Tp(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?Ch(e,t):{}}function Wh(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 qh(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=zp(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 Gh(e,t){return t.nodes[e]||t.marks[e]||null}function Kh(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?$p(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Dp(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(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),a=Math.min(o,t+e.nodeSize);s+=a-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),0===s)return!1;const a=l.filter(e=>!i||i.name===e.mark.type.name).filter(e=>Dp(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 Yh(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Xh(e,t){const{nodeExtensions:n}=Dh(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=Ah(Oh(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Qh(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&&(Qh(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}var Zh=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function em(e,t){const n=t.mapping.mapResult(e.position);return{position:new Zh(n.pos),mapResult:n}}function tm(e){return new Zh(e)}var nm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=$p(e,r.schema);if(o)if(s){const e=Ch(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(Vp(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)},rm=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),om=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=Tp(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})=>!!Va(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Va(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},im=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=jp(e,0,n.content.size),o=na.create(n,r);t.setSelection(o)}return!0},sm=(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},lm=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=ea.atStart(n).from,s=ea.atEnd(n).to,l=jp(r,i,s),a=jp(o,i,s),c=ea.create(n,l,a);t.setSelection(c)}return!0},am=e=>({state:t,dispatch:n})=>{const r=Tp(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=Zi.from(n?o.create():null),s=new ss(Zi.from(o.create(null,Zi.from(l.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new El(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function cm(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 um=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:l,$to:a}=i,c=Kh(o.extensionManager.attributes,l.node().type.name,l.node().attrs);if(i instanceof na&&i.node.isBlock)return!(!l.parentOffset||!Pl(s,l.pos)||(r&&(e&&cm(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=Pl(t.doc,t.mapping.map(l.pos),1,p);if(p||h||!Pl(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 ea&&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&&cm(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return h},dm=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=Tp(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=Zi.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=Zi.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={...Kh(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(Zi.from(l.createAndFill(null,c)||void 0));const u=a.before(a.depth-(r-1));n.replace(u,a.after(-o),new ss(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(ea.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,m={...Kh(p,d.type.name,d.attrs),...t},f={...Kh(p,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,c.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:f}]:[{type:l,attrs:m}];if(!Pl(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},pm=(e,t)=>{const n=Mh(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)||!_l(e.doc,n.pos)||(e.join(n.pos),!0)},hm=(e,t)=>{const n=Mh(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)||!_l(e.doc,r)||(e.join(r),!0)},mm=(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=Tp(e,s.schema),m=Tp(t,s.schema),{selection:f,storedMarks:g}=s,{$from:y,$to:b}=f,v=y.blockRange(b),w=g||f.$to.parentOffset&&f.$from.marks();if(!v)return!1;const E=Mh(e=>Xh(e.type.name,d))(f);if(v.depth>=1&&E&&v.depth-E.depth<=1){if(E.node.type===h)return c.liftListItem(m);if(Xh(E.node.type.name,d)&&h.validContent(E.node.content)&&l)return a().command(()=>(i.setNodeMarkup(E.pos,h),!0)).command(()=>pm(i,h)).command(()=>hm(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(()=>pm(i,h)).command(()=>hm(i,h)).run():a().command(()=>!!u().wrapInList(h,r)||c.clearNodes()).wrapInList(h,r).command(()=>pm(i,h)).command(()=>hm(i,h)).run()},fm=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=$p(e,r.schema);return Jh(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},gm=(e,t,n={})=>({state:r,commands:o})=>{const i=Tp(e,r.schema),s=Tp(t,r.schema),l=ah(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})},ym=(e,t={})=>({state:n,commands:r})=>{const o=Tp(e,n.schema);return ah(n,o,t)?r.lift(o):r.wrapIn(o,t)},bm=()=>({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},vm=()=>({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},wm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=$p(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=zp(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},Em=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},xm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const l=hh("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(i=Tp(e,r.schema)),"mark"===l&&(s=$p(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},km=(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&&Tl(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}}(Tp(e,n.schema),t)(n,r),Sm=(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 xs(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new xs(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=Tl(i,n,r,t);return!!l&&(e&&function(e,t,n,r,o){let i=Zi.empty;for(let e=n.length-1;e>=0;e--)i=Zi.from(n[e].type.create(n[e].attrs,i));e.step(new El(t.start-(r?2:0),t.end,t.start,t.end,new ss(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&&Pl(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)}}(Tp(e,n.schema),t)(n,r),Cm=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={}}},Tm=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Mm(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(Ap(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=gp({state:a.state,transaction:s}),p={from:r-(t[0].length-i.length),to:o},{commands:h,chain:m,can:f}=new yp({editor:n,state:c});null!==e.handler({state:c,range:p,match:t,commands:h,chain:m,can:f})&&s.steps.length&&(e.undoable&&s.setMeta(l,{transform:s,from:r,to:o,text:i}),a.dispatch(s),u=!0)}),u}function Om(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Im(e,t){const n={...e};return Om(e)&&Om(t)&&Object.keys(t).forEach(r=>{Om(t[r])&&Om(e[r])?n[r]=Im(e[r],t[r]):n[r]=t[r]}),n}var Pm=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{...Ah(Oh(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ah(Oh(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Im(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}},_m=class e extends Pm{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)}},Am=class{constructor(e){this.find=e.find,this.handler=e.handler}};var Dm=null;function Nm(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=gp({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 yp({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,o,(e,t)=>{var p,h,m,f,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!=(f=null==(m=e.content)?void 0:m.size)?f: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(Ap(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 fa({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(Dm=t)},r=()=>{Dm&&(Dm=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=Dm;(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=Ph(Zi.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),m=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof h&&m&&h!==m.b?a({rule:e,state:r,from:h,to:m,pasteEvt:l}):void 0}}))}var Rm=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=jh(e),this.schema=function(e,t){var n;const r=Nh(e),{nodeExtensions:o,markExtensions:i}=Dh(e),s=null==(n=o.find(e=>Oh(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=Lh({...e.reduce((e,t)=>{const r=Oh(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:Ah(Oh(n,"content",i)),marks:Ah(Oh(n,"marks",i)),group:Ah(Oh(n,"group",i)),inline:Ah(Oh(n,"inline",i)),atom:Ah(Oh(n,"atom",i)),selectable:Ah(Oh(n,"selectable",i)),draggable:Ah(Oh(n,"draggable",i)),code:Ah(Oh(n,"code",i)),whitespace:Ah(Oh(n,"whitespace",i)),linebreakReplacement:Ah(Oh(n,"linebreakReplacement",i)),defining:Ah(Oh(n,"defining",i)),isolating:Ah(Oh(n,"isolating",i)),attrs:Object.fromEntries(o.map(Bh))}),l=Ah(Oh(n,"parseHTML",i));l&&(s.parseDOM=l.map(e=>$h(e,o)));const a=Oh(n,"renderHTML",i);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:zh(e,o)}));const c=Oh(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=Lh({...e.reduce((e,t)=>{const r=Oh(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:Ah(Oh(n,"inclusive",i)),excludes:Ah(Oh(n,"excludes",i)),group:Ah(Oh(n,"group",i)),spanning:Ah(Oh(n,"spanning",i)),code:Ah(Oh(n,"code",i)),attrs:Object.fromEntries(o.map(Bh))}),l=Ah(Oh(n,"parseHTML",i));l&&(s.parseDOM=l.map(e=>$h(e,o)));const a=Oh(n,"renderHTML",i);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:zh(e,o)})),[n.name,s]}));return new Us({topNode:s,nodes:l,marks:a})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Oh(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Gh(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=Vh([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Gh(t.name,this.schema)},r=[],o=Oh(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Oh(t,"exitable",n)&&(i.ArrowRight=()=>_m.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 fa({props:{handleKeyDown:hp(i)}});r.push(s);const l=Oh(t,"addInputRules",n);if(Yh(t,e.options.enableInputRules)&&l){const t=l();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new fa({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=Ph(Zi.from(e),i.schema));const{from:o}=l,s=o+e.length;Mm({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 Mm({editor:t,from:o,to:i,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Mm({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&&Mm({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=Oh(t,"addPasteRules",n);if(Yh(t,e.options.enablePasteRules)&&a){const t=a();if(t&&t.length){const n=Nm({editor:e,rules:t});r.push(...n)}}const c=Oh(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r});return t}get attributes(){return Nh(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Dh(this.extensions);return Object.fromEntries(t.filter(e=>!!Oh(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:Tp(t.name,this.schema)},o=Oh(t,"addNodeView",r);if(!o)return[];const i=o();return i?[t.name,(r,o,s,l,a)=>{const c=zh(r,n);return i({node:r,view:o,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){const{editor:t}=this;return Vh([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Gh(n.name,this.schema)},o=Oh(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return Vh([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Gh(n.name,this.schema)},o=Oh(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=Dh(this.extensions);return Object.fromEntries(t.filter(e=>!!Oh(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:$p(t.name,this.schema)},o=Oh(t,"addMarkView",r);return o?[t.name,(r,i,s)=>{const l=zh(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:Gh(e.name,this.schema)};"mark"===e.type&&(null==(t=Ah(Oh(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);const r=Oh(e,"onBeforeCreate",n),o=Oh(e,"onCreate",n),i=Oh(e,"onUpdate",n),s=Oh(e,"onSelectionUpdate",n),l=Oh(e,"onTransaction",n),a=Oh(e,"onFocus",n),c=Oh(e,"onBlur",n),u=Oh(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)})}};Rm.resolve=jh,Rm.sort=Vh,Rm.flatten=Ih,fp({},{ClipboardTextSerializer:()=>$m,Commands:()=>Lm,Delete:()=>Bm,Drop:()=>Vm,Editable:()=>jm,FocusEvents:()=>Um,Keymap:()=>Hm,Paste:()=>Wm,Tabindex:()=>qm,TextDirection:()=>Gm,focusEventsPluginKey:()=>Fm});var zm=class e extends Pm{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)}},$m=zm.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new fa({key:new ba("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=Uh(n);return Fh(r,{from:s,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Lm=zm.create({name:"commands",addCommands(){return{...bp}}}),Bm=zm.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=Th(e.before,[e,...t]);Wh(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 yl){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()}}),Vm=zm.create({name:"drop",addProseMirrorPlugins(){return[new fa({key:new ba("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),jm=zm.create({name:"editable",addProseMirrorPlugins(){return[new fa({key:new ba("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Fm=new ba("focusEvents"),Um=zm.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new fa({key:Fm,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}}}})]}}),Hm=zm.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:Yl.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 Hp()||sh()?o:r},addProseMirrorPlugins(){return[new fa({key:new ba("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=Yl.atStart(t.doc).from,c=Yl.atEnd(t.doc).to;if(i||s!==a||l!==c)return;if(!Qh(n.doc))return;const u=n.tr,d=gp({state:n,transaction:u}),{commands:p}=new yp({editor:this.editor,state:d});return p.clearNodes(),u.steps.length?u:void 0}})]}}),Wm=zm.create({name:"paste",addProseMirrorPlugins(){return[new fa({key:new ba("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),qm=zm.create({name:"tabindex",addProseMirrorPlugins(){return[new fa({key:new ba("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Gm=zm.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Dh(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 fa({key:new ba("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Km=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!o&&!s&&a.depth<=this.depth)return;const c=new e(a,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{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)}},Jm=class extends Cm{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:em,createMappablePosition:tm},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Fp(t,this.options.autofocus);this.editorState=ha.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=_h(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?[jm,$m.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Lm,Um,Hm,qm,Vm,Wm,Bm,Gm.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new Rm(n,this)}createCommandManager(){this.commandManager=new yp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=kh(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=kh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Xd(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),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 Hh(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 ah(e,null,n)||Jh(e,null,n);const r=hh(t,e.schema);return"node"===r?ah(e,t,n):"mark"===r&&Jh(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ph(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Fh(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...Uh(this.schema),...n}})}get isEmpty(){return Qh(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 Km(t,this)}get $doc(){return this.$pos(0)}};function Ym(e){return new Tm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Ah(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(qh(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 Xm(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 Qm(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 Zm(e){const{nodeName:t,name:n,parseAttributes:r=Xm,serializeAttributes:o=Qm,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 ef(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Xm,serializeAttributes:i=Qm,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 m=u.length;let f="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(m);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);f=i.trim();const s=e.slice(0,m+o+n[0].length);let a=[];if(f)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(f);return{type:t,raw:s,attributes:p,content:f,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 tf(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 nf(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function rf(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=tf,serializeAttributes:i=nf,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=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return l?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function of(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:m,mainContent:f}=h;c=`${c}${e}\n`;const g=[f];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)>m){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)>m))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(m+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 sf(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")}fp({},{createAtomBlockMarkdownSpec:()=>Zm,createBlockMarkdownSpec:()=>ef,createInlineMarkdownSpec:()=>rf,parseAttributes:()=>Xm,parseIndentedBlocks:()=>of,renderNestedMarkdownContent:()=>sf,serializeAttributes:()=>Qm});var lf=class e extends Pm{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 af(e){return new Am({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Ah(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(qh(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 cf=(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]},uf=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,df=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,pf=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,hf=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mf=_m.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 cf("strong",{...Rh(this.options.HTMLAttributes,e),children:cf("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[Ym({find:uf,type:this.type}),Ym({find:pf,type:this.type})]},addPasteRules(){return[af({find:df,type:this.type}),af({find:hf,type:this.type})]}}),ff=lf.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),gf=lf.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",Rh(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()}}}),yf=gf,bf=lf.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]}`,Rh(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 Tm({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=Ah(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})}}),vf=bf,wf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ef=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xf=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kf=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Sf=_m.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",Rh(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[Ym({find:wf,type:this.type}),Ym({find:xf,type:this.type})]},addPasteRules(){return[af({find:Ef,type:this.type}),af({find:kf,type:this.type})]}});const Cf="numeric",Tf="ascii",Mf="alpha",Of="asciinumeric",If="alphanumeric",Pf="domain",_f="emoji",Af="scheme",Df="slashscheme",Nf="whitespace";function Rf(e,t){return e in t||(t[e]=[]),t[e]}function zf(e,t,n){t[Cf]&&(t[Of]=!0,t[If]=!0),t[Tf]&&(t[Of]=!0,t[Mf]=!0),t[Of]&&(t[If]=!0),t[Mf]&&(t[If]=!0),t[If]&&(t[Pf]=!0),t[_f]&&(t[Pf]=!0);for(const r in t){const t=Rf(r,n);t.indexOf(e)<0&&t.push(e)}}function $f(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}$f.groups={},$f.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||$f.groups,t&&t.j?o=t:(o=new $f(t),n&&r&&zf(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||$f.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 $f,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new $f,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);zf(i,e,r)}else n&&zf(i,n,r);s.t=i}return o.j[e]=s,s}};const Lf=(e,t,n,r,o)=>e.ta(t,n,r,o),Bf=(e,t,n,r,o)=>e.tr(t,n,r,o),Vf=(e,t,n,r,o)=>e.ts(t,n,r,o),jf=(e,t,n,r,o)=>e.tt(t,n,r,o),Ff="WORD",Uf="UWORD",Hf="ASCIINUMERICAL",Wf="ALPHANUMERICAL",qf="LOCALHOST",Gf="TLD",Kf="UTLD",Jf="SCHEME",Yf="SLASH_SCHEME",Xf="NUM",Qf="WS",Zf="NL",eg="OPENBRACE",tg="CLOSEBRACE",ng="OPENBRACKET",rg="CLOSEBRACKET",og="OPENPAREN",ig="CLOSEPAREN",sg="OPENANGLEBRACKET",lg="CLOSEANGLEBRACKET",ag="FULLWIDTHLEFTPAREN",cg="FULLWIDTHRIGHTPAREN",ug="LEFTCORNERBRACKET",dg="RIGHTCORNERBRACKET",pg="LEFTWHITECORNERBRACKET",hg="RIGHTWHITECORNERBRACKET",mg="FULLWIDTHLESSTHAN",fg="FULLWIDTHGREATERTHAN",gg="AMPERSAND",yg="APOSTROPHE",bg="ASTERISK",vg="AT",wg="BACKSLASH",Eg="BACKTICK",xg="CARET",kg="COLON",Sg="COMMA",Cg="DOLLAR",Tg="DOT",Mg="EQUALS",Og="EXCLAMATION",Ig="HYPHEN",Pg="PERCENT",_g="PIPE",Ag="PLUS",Dg="POUND",Ng="QUERY",Rg="QUOTE",zg="FULLWIDTHMIDDLEDOT",$g="SEMI",Lg="SLASH",Bg="TILDE",Vg="UNDERSCORE",jg="EMOJI",Fg="SYM";var Ug=Object.freeze({__proto__:null,ALPHANUMERICAL:Wf,AMPERSAND:gg,APOSTROPHE:yg,ASCIINUMERICAL:Hf,ASTERISK:bg,AT:vg,BACKSLASH:wg,BACKTICK:Eg,CARET:xg,CLOSEANGLEBRACKET:lg,CLOSEBRACE:tg,CLOSEBRACKET:rg,CLOSEPAREN:ig,COLON:kg,COMMA:Sg,DOLLAR:Cg,DOT:Tg,EMOJI:jg,EQUALS:Mg,EXCLAMATION:Og,FULLWIDTHGREATERTHAN:fg,FULLWIDTHLEFTPAREN:ag,FULLWIDTHLESSTHAN:mg,FULLWIDTHMIDDLEDOT:zg,FULLWIDTHRIGHTPAREN:cg,HYPHEN:Ig,LEFTCORNERBRACKET:ug,LEFTWHITECORNERBRACKET:pg,LOCALHOST:qf,NL:Zf,NUM:Xf,OPENANGLEBRACKET:sg,OPENBRACE:eg,OPENBRACKET:ng,OPENPAREN:og,PERCENT:Pg,PIPE:_g,PLUS:Ag,POUND:Dg,QUERY:Ng,QUOTE:Rg,RIGHTCORNERBRACKET:dg,RIGHTWHITECORNERBRACKET:hg,SCHEME:Jf,SEMI:$g,SLASH:Lg,SLASH_SCHEME:Yf,SYM:Fg,TILDE:Bg,TLD:Gf,UNDERSCORE:Vg,UTLD:Kf,UWORD:Uf,WORD:Ff,WS:Qf});const Hg=/[a-z]/,Wg=/\p{L}/u,qg=/\p{Emoji}/u,Gg=/\d/,Kg=/\s/;let Jg=null,Yg=null;function Xg(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 Qg(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 $f(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new $f(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Zg(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 ey={defaultProtocol:"http",events:null,format:ny,formatHref:ny,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ty(e,t=null){let n=Object.assign({},ey);e&&(n=Object.assign(n,e instanceof ty?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 ny(e){return e}function ry(e,t){this.t="token",this.v=e,this.tk=t}function oy(e,t){class n extends ry{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}ty.prototype={o:ey,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]:ey[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)}},ry.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=ey.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 iy=oy("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),sy=oy("text"),ly=oy("nl"),ay=oy("url",{isLink:!0,toHref(e=ey.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==qf&&e[1].t===kg}}),cy=e=>new $f(e);function uy(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const dy="undefined"!=typeof console&&console&&console.warn||(()=>{}),py={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function hy(e,t=!1){if(py.initialized&&dy(`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');py.customSchemes.push([e,t])}function my(e){return py.initialized||function(){py.scanner=function(e=[]){const t={};$f.groups=t;const n=new $f;null==Jg&&(Jg=Zg("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Yg&&(Yg=Zg("ελ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")),jf(n,"'",yg),jf(n,"{",eg),jf(n,"}",tg),jf(n,"[",ng),jf(n,"]",rg),jf(n,"(",og),jf(n,")",ig),jf(n,"<",sg),jf(n,">",lg),jf(n,"(",ag),jf(n,")",cg),jf(n,"「",ug),jf(n,"」",dg),jf(n,"『",pg),jf(n,"』",hg),jf(n,"<",mg),jf(n,">",fg),jf(n,"&",gg),jf(n,"*",bg),jf(n,"@",vg),jf(n,"`",Eg),jf(n,"^",xg),jf(n,":",kg),jf(n,",",Sg),jf(n,"$",Cg),jf(n,".",Tg),jf(n,"=",Mg),jf(n,"!",Og),jf(n,"-",Ig),jf(n,"%",Pg),jf(n,"|",_g),jf(n,"+",Ag),jf(n,"#",Dg),jf(n,"?",Ng),jf(n,'"',Rg),jf(n,"/",Lg),jf(n,";",$g),jf(n,"~",Bg),jf(n,"_",Vg),jf(n,"\\",wg),jf(n,"・",zg);const r=Bf(n,Gg,Xf,{[Cf]:!0});Bf(r,Gg,r);const o=Bf(r,Hg,Hf,{[Of]:!0}),i=Bf(r,Wg,Wf,{[If]:!0}),s=Bf(n,Hg,Ff,{[Tf]:!0});Bf(s,Gg,o),Bf(s,Hg,s),Bf(o,Gg,o),Bf(o,Hg,o);const l=Bf(n,Wg,Uf,{[Mf]:!0});Bf(l,Hg),Bf(l,Gg,i),Bf(l,Wg,l),Bf(i,Gg,i),Bf(i,Hg),Bf(i,Wg,i);const a=jf(n,"\n",Zf,{[Nf]:!0}),c=jf(n,"\r",Qf,{[Nf]:!0}),u=Bf(n,Kg,Qf,{[Nf]:!0});jf(n,"",u),jf(c,"\n",a),jf(c,"",u),Bf(c,Kg,u),jf(u,"\r"),jf(u,"\n"),Bf(u,Kg,u),jf(u,"",u);const d=Bf(n,qg,jg,{[_f]:!0});jf(d,"#"),Bf(d,qg,d),jf(d,"️",d);const p=jf(d,"");jf(p,"#"),Bf(p,qg,d);const h=[[Hg,s],[Gg,o]],m=[[Hg,null],[Wg,l],[Gg,i]];for(let e=0;e<Jg.length;e++)Qg(n,Jg[e],Gf,Ff,h);for(let e=0;e<Yg.length;e++)Qg(n,Yg[e],Kf,Uf,m);zf(Gf,{tld:!0,ascii:!0},t),zf(Kf,{utld:!0,alpha:!0},t),Qg(n,"file",Jf,Ff,h),Qg(n,"mailto",Jf,Ff,h),Qg(n,"http",Yf,Ff,h),Qg(n,"https",Yf,Ff,h),Qg(n,"ftp",Yf,Ff,h),Qg(n,"ftps",Yf,Ff,h),zf(Jf,{scheme:!0,ascii:!0},t),zf(Yf,{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]?{[Af]:!0}:{[Df]:!0};r.indexOf("-")>=0?o[Pf]=!0:Hg.test(r)?Gg.test(r)?o[Of]=!0:o[Tf]=!0:o[Cf]=!0,Vf(n,r,r,o)}return Vf(n,"localhost",qf,{ascii:!0}),n.jd=new $f(Fg),{start:n,tokens:Object.assign({groups:t},Ug)}}(py.customSchemes);for(let e=0;e<py.tokenQueue.length;e++)py.tokenQueue[e][1]({scanner:py.scanner});py.parser=function({groups:e}){const t=e.domain.concat([gg,bg,vg,wg,Eg,xg,Cg,Mg,Ig,Xf,Pg,_g,Ag,Dg,Lg,Fg,Bg,Vg]),n=[yg,kg,Sg,Tg,Og,Pg,Ng,Rg,$g,sg,lg,eg,tg,rg,ng,og,ig,ag,cg,ug,dg,pg,hg,mg,fg],r=[gg,yg,bg,wg,Eg,xg,Cg,Mg,Ig,eg,tg,Pg,_g,Ag,Dg,Ng,Lg,Fg,Bg,Vg],o=cy(),i=jf(o,Bg);Lf(i,r,i),Lf(i,e.domain,i);const s=cy(),l=cy(),a=cy();Lf(o,e.domain,s),Lf(o,e.scheme,l),Lf(o,e.slashscheme,a),Lf(s,r,i),Lf(s,e.domain,s);const c=jf(s,vg);jf(i,vg,c),jf(l,vg,c),jf(a,vg,c);const u=jf(i,Tg);Lf(u,r,i),Lf(u,e.domain,i);const d=cy();Lf(c,e.domain,d),Lf(d,e.domain,d);const p=jf(d,Tg);Lf(p,e.domain,d);const h=cy(iy);Lf(p,e.tld,h),Lf(p,e.utld,h),jf(c,qf,h);const m=jf(d,Ig);jf(m,Ig,m),Lf(m,e.domain,d),Lf(h,e.domain,d),jf(h,Tg,p),jf(h,Ig,m);const f=jf(h,kg);Lf(f,e.numeric,iy);const g=jf(s,Ig),y=jf(s,Tg);jf(g,Ig,g),Lf(g,e.domain,s),Lf(y,r,i),Lf(y,e.domain,s);const b=cy(ay);Lf(y,e.tld,b),Lf(y,e.utld,b),Lf(b,e.domain,s),Lf(b,r,i),jf(b,Tg,y),jf(b,Ig,g),jf(b,vg,c);const v=jf(b,kg),w=cy(ay);Lf(v,e.numeric,w);const E=cy(ay),x=cy();Lf(E,t,E),Lf(E,n,x),Lf(x,t,E),Lf(x,n,x),jf(b,Lg,E),jf(w,Lg,E);const k=jf(l,kg),S=jf(a,kg),C=jf(S,Lg),T=jf(C,Lg);Lf(l,e.domain,s),jf(l,Tg,y),jf(l,Ig,g),Lf(a,e.domain,s),jf(a,Tg,y),jf(a,Ig,g),Lf(k,e.domain,E),jf(k,Lg,E),jf(k,Ng,E),Lf(T,e.domain,E),Lf(T,t,E),jf(T,Lg,E);const M=[[eg,tg],[ng,rg],[og,ig],[sg,lg],[ag,cg],[ug,dg],[pg,hg],[mg,fg]];for(let e=0;e<M.length;e++){const[r,o]=M[e],i=jf(E,r);jf(x,r,i),jf(i,o,E);const s=cy(ay);Lf(i,t,s);const l=cy();Lf(i,n),Lf(s,t,s),Lf(s,n,l),Lf(l,t,s),Lf(l,n,l),jf(s,o,E),jf(l,o,E)}return jf(o,qf,b),jf(o,Zf,ly),{start:o,tokens:Ug}}(py.scanner.tokens);for(let e=0;e<py.pluginQueue.length;e++)py.pluginQueue[e][1]({scanner:py.scanner,parser:py.parser});py.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(uy(sy,t,s)),s=[]),o-=p,u-=p;const e=d.t,r=n.slice(o-u,o);i.push(uy(e,t,r))}}return s.length>0&&i.push(uy(sy,t,s)),i}(py.parser.start,e,Xg(py.scanner.start,e))}function fy(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 ty(n),o=my(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}my.scan=Xg;var gy="[\0- -\u2029 ]",yy=new RegExp(gy),by=new RegExp(`${gy}$`),vy=new RegExp(gy,"g");function wy(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(vy,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Ey=_m.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?hy(e.scheme,e.optionalSlashes):hy(e)})},onDestroy(){$f.groups={},py.scanner=null,py.parser=null,py.tokenQueue=[],py.pluginQueue=[],py.customSchemes=[],py.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)=>!!wy(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!wy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!wy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rh(this.options.HTMLAttributes,e),0]:["a",Rh(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",l=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",a=t.renderChildren(e);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!wy(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=>!!wy(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[af({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=fy(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!wy(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=>!!wy(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new fa({key:new ba("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 Wh(Th(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(!by.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(yy).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=my(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=>{qh(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}}))),e.push(function(e){return new fa({key:new ba("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(e.enableClickSelection&&(l=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=Hh(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,a=null!=(i=s.target)?i:n.target;r&&(window.open(r,a),l=!0)}return l}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new fa({key:new ba("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=fy(a,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!(!a||!c||void 0!==o&&!o(c.value))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e;var r}}),xy=Ey,ky=" ",Sy=lf.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Rh(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==r.length||"text"!==r[0].type||r[0].text!==ky&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return 0===n.length?ky:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Cy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ty=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,My=_m.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",Rh(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[Ym({find:Cy,type:this.type})]},addPasteRules(){return[af({find:Ty,type:this.type})]}}),Oy=_m.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(e){return"sub"===e&&null}}]},renderHTML({HTMLAttributes:e}){return["sub",Rh(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()}}}),Iy=_m.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(e){return"super"===e&&null}}]},renderHTML({HTMLAttributes:e}){return["sup",Rh(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()}}}),Py=lf.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),_y=_m.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",Rh(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()}}}),Ay=window.ReactDOM,Dy=n(9888),Ny=n(4848);const{getOwnPropertyNames:Ry,getOwnPropertySymbols:zy}=Object,{hasOwnProperty:$y}=Object.prototype;function Ly(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function By(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);const{cache:o}=r,i=o.get(t),s=o.get(n);if(i&&s)return i===n&&s===t;o.set(t,n),o.set(n,t);const l=e(t,n,r);return o.delete(t),o.delete(n),l}}function Vy(e){return Ry(e).concat(zy(e))}const jy=Object.hasOwn||((e,t)=>$y.call(e,t));function Fy(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:Uy,keys:Hy}=Object;function Wy(e,t){return e.byteLength===t.byteLength&&ob(new Uint8Array(e),new Uint8Array(t))}function qy(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Gy(e,t){return e.byteLength===t.byteLength&&ob(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Ky(e,t){return Fy(e.getTime(),t.getTime())}function Jy(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Yy(e,t){return e===t}function Xy(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,l,a=0;for(;(s=i.next())&&!s.done;){const r=t.entries();let i=!1,c=0;for(;(l=r.next())&&!l.done;){if(o[c]){c++;continue}const r=s.value,u=l.value;if(n.equals(r[0],u[0],a,c,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){i=o[c]=!0;break}c++}if(!i)return!1;a++}return!0}const Qy=Fy;function Zy(e,t,n){const r=Hy(e);let o=r.length;if(Hy(t).length!==o)return!1;for(;o-- >0;)if(!sb(e,t,n,r[o]))return!1;return!0}function eb(e,t,n){const r=Vy(e);let o,i,s,l=r.length;if(Vy(t).length!==l)return!1;for(;l-- >0;){if(o=r[l],!sb(e,t,n,o))return!1;if(i=Uy(e,o),s=Uy(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function tb(e,t){return Fy(e.valueOf(),t.valueOf())}function nb(e,t){return e.source===t.source&&e.flags===t.flags}function rb(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,l;for(;(s=i.next())&&!s.done;){const r=t.values();let i=!1,a=0;for(;(l=r.next())&&!l.done;){if(!o[a]&&n.equals(s.value,l.value,s.value,l.value,e,t,n)){i=o[a]=!0;break}a++}if(!i)return!1}return!0}function ob(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function ib(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function sb(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||jy(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const lb={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},ab=Object.prototype.toString;const cb=ub();function ub(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Wy,areArraysEqual:n?eb:qy,areDataViewsEqual:Gy,areDatesEqual:Ky,areErrorsEqual:Jy,areFunctionsEqual:Yy,areMapsEqual:n?Ly(Xy,eb):Xy,areNumbersEqual:Qy,areObjectsEqual:n?eb:Zy,arePrimitiveWrappersEqual:tb,areRegExpsEqual:nb,areSetsEqual:n?Ly(rb,eb):rb,areTypedArraysEqual:n?Ly(ob,eb):ob,areUrlsEqual:ib,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=By(r.areArraysEqual),t=By(r.areMapsEqual),n=By(r.areObjectsEqual),o=By(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:p,areUrlsEqual:h,unknownTagComparators:m}){return function(f,g,y){if(f===g)return!0;if(null==f||null==g)return!1;const b=typeof f;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?l(f,g,y):"function"===b&&i(f,g,y);const v=f.constructor;if(v!==g.constructor)return!1;if(v===Object)return a(f,g,y);if(Array.isArray(f))return t(f,g,y);if(v===Date)return r(f,g,y);if(v===RegExp)return u(f,g,y);if(v===Map)return s(f,g,y);if(v===Set)return d(f,g,y);const w=ab.call(f);if("[object Date]"===w)return r(f,g,y);if("[object RegExp]"===w)return u(f,g,y);if("[object Map]"===w)return s(f,g,y);if("[object Set]"===w)return d(f,g,y);if("[object Object]"===w)return"function"!=typeof f.then&&"function"!=typeof g.then&&a(f,g,y);if("[object URL]"===w)return h(f,g,y);if("[object Error]"===w)return o(f,g,y);if("[object Arguments]"===w)return a(f,g,y);if(lb[w])return p(f,g,y);if("[object ArrayBuffer]"===w)return e(f,g,y);if("[object DataView]"===w)return n(f,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return c(f,g,y);if(m){let e=m[w];if(!e){const t=null!=(E=f)?E[Symbol.toStringTag]:void 0;t&&(e=m[t])}if(e)return e(f,g,y)}var E;return!1}}(i);var l;return function({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(i,s){const{cache:l=(e?new WeakMap:void 0),meta:a}=n();return t(i,s,{cache:l,equals:r,meta:a,strict:o})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(e,n){return t(e,n,i)}}({circular:t,comparator:s,createState:r,equals:n?n(s):(l=s,function(e,t,n,r,o,i,s){return l(e,t,s)}),strict:o})}ub({strict:!0}),ub({circular:!0}),ub({circular:!0,strict:!0}),ub({createInternalComparator:()=>Fy}),ub({strict:!0,createInternalComparator:()=>Fy}),ub({circular:!0,createInternalComparator:()=>Fy}),ub({circular:!0,createInternalComparator:()=>Fy,strict:!0});var db=n(9242),pb=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},hb=({contentComponent:e})=>{const t=(0,Dy.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,Ny.jsx)(Ny.Fragment,{children:Object.values(t)})},mb=class extends e.Component{constructor(t){var n;super(t),this.editorContentRef=e.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(n=t.editor)?void 0:n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=function(){const e=new Set;let t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Ay.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=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return(0,Ny.jsxs)(Ny.Fragment,{children:[(0,Ny.jsx)("div",{ref:pb(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,Ny.jsx)(hb,{contentComponent:e.contentComponent})]})}},fb=(0,e.forwardRef)((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(mb,{key:r,innerRef:n,...t})}),gb=e.memo(fb),yb="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,bb=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 vb(t){var n;const[r]=(0,e.useState)(()=>new bb(t.editor)),o=(0,db.useSyncExternalStoreWithSelector)(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:cb);return yb(()=>r.watch(t.editor),[t.editor,r]),(0,e.useDebugValue)(o),o}var wb="undefined"==typeof window,Eb=wb||Boolean("undefined"!=typeof window&&window.next),xb=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?wb||Eb?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 Jm(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)}};var kb=(0,e.createContext)({editor:null});kb.Consumer;var Sb=(0,e.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});e.forwardRef((t,n)=>{const{onDragStart:r}=(0,e.useContext)(Sb),o=t.as||"div";return(0,Ny.jsx)(o,{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})}),e.createContext({markViewContentRef:()=>{}});var Cb=(0,e.createContext)({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Cb.displayName="TiptapContext";function Tb({editor:t,instance:n,children:r}){const o=null!=t?t:n;if(!o)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=(0,e.useMemo)(()=>({editor:o}),[o]),s=(0,e.useMemo)(()=>({editor:o}),[o]);return(0,Ny.jsx)(kb.Provider,{value:s,children:(0,Ny.jsx)(Cb.Provider,{value:i,children:r})})}function Mb({...t}){const{editor:n}=(0,e.useContext)(Cb);return(0,Ny.jsx)(gb,{editor:n,...t})}Tb.displayName="Tiptap",Mb.displayName="Tiptap.Content",Object.assign(Tb,{Content:Mb});const Ob="i",Ib="b",Pb="u",_b=e.forwardRef((t,n)=>{const{value:r,setValue:i,editorProps:s={},elementClasses:l="",autofocus:a=!1,sx:c={},onBlur:u,expectedTag:d=null,onEditorCreate:p,wrapperClassName:h,onSelectionEnd:m,mountElement:f=null}=t,g=(0,e.useRef)(null),y=(0,e.useRef)(u);y.current=u;const b=d?"block+":"inline*",v=e=>({...e,class:l}),w=function(t={},n=[]){const r=(0,e.useRef)(t);r.current=t;const[o]=(0,e.useState)(()=>new xb(r)),i=(0,Dy.useSyncExternalStore)(o.subscribe,o.getEditor,o.getServerSnapshot);return(0,e.useDebugValue)(i),(0,e.useEffect)(o.onRender(n)),vb({editor:i,selector:({transactionNumber:e})=>!1===t.shouldRerenderOnTransaction||void 0===t.shouldRerenderOnTransaction?null:t.immediatelyRender&&0===e?0:e+1}),i}({...f?{element:f}:{},extensions:[ff.extend({content:b}),Sy.extend({renderHTML({HTMLAttributes:e}){return[d??"p",v(e),0]}}),vf.extend({renderHTML({node:e,HTMLAttributes:t}){return d?[d,v(t),0]:[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,v(t),0]}}).configure({levels:[1,2,3,4,5,6]}),xy.configure({openOnClick:!1}),Py,mf,Sf,My,Iy,Oy,_y,yf.extend({addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.setHardBreak()}}})],content:r,onUpdate:({editor:e})=>{const t=e.getHTML();i(function(e=""){if(!e)return!0;const t=document.createElement("div");return t.innerHTML=e,!t.textContent?.length}(t)?null:t)},autofocus:a,editorProps:{...s,handleDOMEvents:{keydown:(e,t)=>{"Escape"===t.key&&y.current?.(),!t.metaKey&&!t.ctrlKey||t.altKey||[Ob,Ib,Pb].includes(t.key)&&t.stopPropagation()}},attributes:{...s.attributes??{},role:"textbox"}},onCreate:p?({editor:e})=>p(e):void 0,onBlur:f?void 0:()=>y.current?.(),onSelectionUpdate:m?({editor:e})=>m(e.view):void 0});return Ab(()=>{w&&w.getHTML()!==r&&w.commands.setContent(r,{emitUpdate:!1})},[w,r]),f?null:e.createElement(o.Box,{ref:g,sx:c,className:h},e.createElement(gb,{ref:n,editor:w}))}),Ab=(t,n)=>{const r=(0,e.useRef)(!1);(0,e.useEffect)(()=>{r.current?t():r.current=!0},n)};function Db(){return Db=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},Db.apply(null,arguments)}const Nb=N(({sx:n,attributes:r,props:i})=>{const{value:l,setValue:a}=b(t.htmlV3PropTypeUtil),c=t.stringPropTypeUtil.extract(l?.content??null)??"",u=(0,e.useMemo)(()=>(0,s.debounce)(e=>{const n=(0,t.parseHtmlChildren)(e);a({content:n.content?t.stringPropTypeUtil.create(n.content):null,children:n.children})},300),[a]),d=(0,e.useCallback)(e=>{const n=e??"";a({content:n?t.stringPropTypeUtil.create(n):null,children:l?.children??[]}),u(n)},[a,l?.children,u]);return(0,e.useEffect)(()=>()=>u.cancel(),[u]),e.createElement(J,null,e.createElement(o.Box,Db({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(_b,{value:c,setValue:d})))});function Rb(){return Rb=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},Rb.apply(null,arguments)}const zb=({bind:t,label:n,placeholder:r})=>e.createElement(m,{bind:t},e.createElement(o.Grid,{container:!0,direction:"column",gap:.5},e.createElement(o.Grid,{item:!0},e.createElement(x,null,n)),e.createElement(o.Grid,{item:!0},e.createElement(re,{placeholder:r})))),$b=()=>e.createElement(zb,{bind:"to",label:(0,i.__)("Send to","elementor"),placeholder:(0,i.__)("Where should we send new submissions?","elementor")}),Lb=()=>e.createElement(zb,{bind:"subject",label:(0,i.__)("Email subject","elementor"),placeholder:(0,i.__)("New form submission","elementor")}),Bb=()=>e.createElement(m,{bind:"message"},e.createElement(o.Grid,{container:!0,direction:"column",gap:.5},e.createElement(o.Grid,{item:!0},e.createElement(x,null,(0,i.__)("Message","elementor"))),e.createElement(o.Grid,{item:!0},e.createElement(oe,{placeholder:(0,i.__)("By default, all form fields are sent via [all-fields] shortcode.","elementor")})))),Vb=()=>e.createElement(zb,{bind:"from",label:(0,i.__)("From email","elementor"),placeholder:(0,i.__)("What email should appear as the sender?","elementor")}),jb=()=>e.createElement(zb,{bind:"from-name",label:(0,i.__)("From name","elementor"),placeholder:(0,i.__)("What name should appear as the sender?","elementor")}),Fb=()=>e.createElement(zb,{bind:"reply-to",label:(0,i.__)("Reply-to","elementor")}),Ub=()=>e.createElement(zb,{bind:"cc",label:(0,i.__)("Cc","elementor")}),Hb=()=>e.createElement(zb,{bind:"bcc",label:(0,i.__)("Bcc","elementor")}),Wb=()=>e.createElement(m,{bind:"meta-data"},e.createElement(o.Stack,{gap:.5},e.createElement(M,null,(0,i.__)("Metadata","elementor")),e.createElement(nn,{options:[{label:(0,i.__)("Date","elementor"),value:"date"},{label:(0,i.__)("Time","elementor"),value:"time"},{label:(0,i.__)("Page URL","elementor"),value:"page-url"},{label:(0,i.__)("User agent","elementor"),value:"user-agent"},{label:(0,i.__)("Credit","elementor"),value:"credit"}]}))),qb=()=>e.createElement(m,{bind:"send-as"},e.createElement(o.Grid,{container:!0,direction:"column",gap:.5},e.createElement(o.Grid,{item:!0},e.createElement(x,null,(0,i.__)("Send as","elementor"))),e.createElement(o.Grid,{item:!0},e.createElement(Z,{options:[{label:(0,i.__)("HTML","elementor"),value:"html"},{label:(0,i.__)("Plain Text","elementor"),value:"plain"}]})))),Gb=()=>e.createElement(W.CollapsibleContent,{defaultOpen:!1},e.createElement(o.Box,{sx:{pt:2}},e.createElement(o.Stack,{gap:2},e.createElement(jb,null),e.createElement(Fb,null),e.createElement(Ub,null),e.createElement(Hb,null),e.createElement(o.Divider,null),e.createElement(Wb,null),e.createElement(qb,null)))),Kb=N(()=>{const{value:n,setValue:r,...s}=b(t.emailPropTypeUtil);return e.createElement(d,Rb({},s,{value:n,setValue:r}),e.createElement(o.Stack,{gap:2},e.createElement(M,null,(0,i.__)("Email settings","elementor")),e.createElement($b,null),e.createElement(Lb,null),e.createElement(Bb,null),e.createElement(Vb,null),e.createElement(Gb,null)))}),Jb=()=>window.elementor?.config?.size_units?.length??[],Yb=()=>window.elementor?.config?.size_units?.angle??[],Xb=()=>window.elementor?.config?.size_units?.time??[],Qb=e=>(window.elementor?.config?.size_units?.extended_units??[]).includes(e),Zb=/^[a-zA-Z%]$/,ev="",tv="auto",nv="custom",rv=(e,t)=>Qb(t)?ev:e,ov=(e,t,n)=>t.includes(e)?e:n&&t.includes(n)?n:t[0]??"",iv=(e,t)=>e?.size!==t?.size||e?.unit!==t?.unit,sv=(0,e.forwardRef)(({id:t,type:n,value:r,onBlur:o,onKeyUp:i,focused:s,disabled:l,onChange:a,onKeyDown:c,InputProps:u,inputProps:d,placeholder:p},h)=>e.createElement(he,{id:t,ref:h,size:"tiny",fullWidth:!0,type:n,value:r,placeholder:p,onKeyUp:i,focused:s,disabled:l,onKeyDown:c,onInput:a,onBlur:o,InputProps:u,inputProps:d,sx:lv(u?.readOnly??!1)})),lv=e=>({input:{cursor:e?"default !important":void 0}});function av(){return av=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},av.apply(null,arguments)}const cv={display:"flex",flexDirection:"column",justifyContent:"center"},uv=({value:t,isActive:n,onSelect:r,options:i,disabled:s,menuItemsAttributes:l={},optionLabelOverrides:a={}})=>{const c=(0,o.usePopupState)({variant:"popover",popupId:(0,e.useId)()});return e.createElement(e.Fragment,null,e.createElement(dv,av({isActive:n,disabled:s,size:"small"},(0,o.bindTrigger)(c)),a[t]??t),e.createElement(o.Menu,av({MenuListProps:{dense:!0}},(0,o.bindMenu)(c)),i.map(t=>e.createElement(W.MenuListItem,av({key:t,onClick:()=>(e=>{r(e),c.close()})(t)},l?.[t],{primaryTypographyProps:{variant:"caption",sx:{...cv,lineHeight:"1"}},menuItemTextProps:{sx:cv}}),a[t]??t.toUpperCase()))))},dv=(0,o.styled)(o.Button,{shouldForwardProp:e=>"isActive"!==e})(({isActive:e,theme:t})=>({color:e?t.palette.text.primary:t.palette.text.tertiary,font:"inherit",minWidth:"initial",textTransform:"uppercase"})),pv=e=>Boolean(e)||0===e;function hv(){return hv=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},hv.apply(null,arguments)}const mv={custom:e.createElement(U.MathFunctionIcon,{fontSize:"tiny"})},fv=({value:t,focused:n,disabled:r,InputProps:i,defaultUnit:s,placeholder:l,onUnitChange:a,startIcon:c,ariaLabel:u,onKeyDown:d,setValue:p,onBlur:h,units:m,min:f,unitSelectorProps:g})=>{const{size:y,unit:b,setSize:v,setUnit:w}=(({value:t,setValue:n,units:r,defaultUnit:o})=>{const i=(0,e.useMemo)(()=>((e,t)=>{if(!e)return e;const{units:n,defaultUnit:r}=t,o=ov(e.unit,n,r);return o===tv?{size:ev,unit:o}:o===nv?{size:String(e.size??ev),unit:o}:{size:(i=e.size,("number"==typeof i&&isNaN(i)?ev:i)??ev),unit:o};var i})(t,{units:r,defaultUnit:o}),[t?.size,t?.unit,o]),[s,l]=Ee({external:i,setExternal:(e,t,r)=>{null!==e&&n(e,t,r)},persistWhen:e=>iv(e,i),fallback:()=>((e,t)=>{let[n]=e;return void 0!==t&&(n=ov(t,e)),{size:ev,unit:n}})(r,o)});return{size:s.size,unit:s.unit,setSize:(e,t=!0)=>{if(Qb(s.unit))return;const n=e.trim(),r=Number(n),o={...s,size:n&&!isNaN(r)?r:""};l(o,void 0,{validation:()=>t})},setUnit:e=>{l({unit:e,size:rv(s.size,e)})}}})({value:t,setValue:p,units:m,defaultUnit:s}),E=e=>{w(e),a?.(e)},{onUnitKeyDown:x}=(({unit:e,units:t,onUnitChange:n})=>{const{appendKey:r,startsWith:o}=se();return{onUnitKeyDown:i=>{if(0===t.length)return;const{key:s,altKey:l,ctrlKey:a,metaKey:c}=i;if(l||a||c)return;if(Qb(e)&&(e=>"number"==typeof e?!isNaN(e):"string"==typeof e&&""!==e.trim()&&!isNaN(Number(e)))(s)){const[e]=t;return void(e&&n(e))}if(!Zb.test(s))return;i.preventDefault();const u=r(s.toLowerCase()),d=t.find(e=>o(e,u));d&&n(d)}}})({unit:b,onUnitChange:E,units:m}),k=Qb(b)?"text":"number";return e.createElement(sv,{disabled:r,focused:n,type:k,value:y,placeholder:l,onBlur:h,onKeyDown:e=>{x(e),d?.(e)},onChange:e=>{const t=e.target.value,n=e.target.validity.valid;v(t,n)},InputProps:{...i,autoComplete:"off",readOnly:Qb(b),startAdornment:c&&e.createElement(o.InputAdornment,{position:"start",disabled:r},c),endAdornment:e.createElement(o.InputAdornment,{position:"end"},e.createElement(uv,hv({options:m,value:b,onSelect:E,isActive:g?.isActive??pv(y)},g,{optionLabelOverrides:mv})))},inputProps:{min:f,step:"any","arial-label":u}})};function gv(){return gv=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},gv.apply(null,arguments)}const yv=({popupState:t,anchorRef:n,value:r,onChange:s,onClose:l})=>{const a=(0,e.useRef)(null);(0,e.useEffect)(()=>{t.isOpen&&requestAnimationFrame(()=>{a.current&&a.current.focus()})},[t.isOpen]);const c=()=>{l?.(),t.close()};return e.createElement(o.Popover,gv({disablePortal:!0,slotProps:{paper:{sx:{borderRadius:2,width:n.current?.offsetWidth+"px"}}}},(0,o.bindPopover)(t),{anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},onClose:c}),e.createElement(W.PopoverHeader,{title:(0,i.__)("CSS function","elementor"),onClose:c,icon:e.createElement(U.MathFunctionIcon,{fontSize:"tiny"})}),e.createElement(o.TextField,{value:r,onChange:s,onKeyDown:e=>{"enter"===e.key.toLowerCase()&&c()},size:"tiny",type:"text",fullWidth:!0,inputProps:{ref:a},sx:{pt:0,pr:1.5,pb:1.5,pl:1.5}}))};function bv(){return bv=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},bv.apply(null,arguments)}const vv=({anchorRef:t,isUnitActive:n,SizeFieldWrapper:r=e.Fragment,...i})=>{const s=(0,o.usePopupState)({variant:"popover"}),l=(0,ie.useActiveBreakpoint)(),a=i?.value?.unit===nv,c=i.units.includes(nv);(0,e.useEffect)(()=>{s&&s.isOpen&&s.close()},[l]);const u={"aria-controls":s.isOpen?s.popupId:void 0,"aria-haspopup":!0};return e.createElement(e.Fragment,null,e.createElement(r,null,e.createElement(o.Box,null,e.createElement(fv,bv({focused:!!s.isOpen||void 0,onUnitChange:e=>{e===nv&&t?.current&&s.open(t.current)},InputProps:{...u,onClick:e=>{e.target.closest("input")&&a&&s.open(t?.current)}},unitSelectorProps:{menuItemsAttributes:c?{custom:u}:void 0,isActive:n}},i)))),s.isOpen&&t?.current&&e.createElement(yv,{popupState:s,anchorRef:t,value:String(i?.value?.size??""),onChange:e=>{i.setValue({size:e.target.value,unit:nv})},onClose:()=>{}}))},wv=e=>{if(!e)return!1;const n=t.sizePropTypeUtil.create(e);return t.sizePropTypeUtil.isValid(n)},Ev=(e,t)=>{if(e)return e;const n=t?.size;return void 0!==n?"number"==typeof n?n.toString():n:void 0},xv=e=>!!e&&(e.unit===tv||pv(e.size)),kv=e=>e.settings,Sv=[e=>null==e?.size||""===e?.size,e=>e?.unit!==tv,e=>e?.unit!==nv],Cv=N(({variant:n="length",placeholder:r,anchorRef:o,startIcon:i,ariaLabel:s,min:l})=>{const{value:a,setValue:c,propType:u,placeholder:d,restoreValue:p}=b(t.sizePropTypeUtil),{sizeValue:h,isUnitHighlighted:m,placeholder:f}=((e,t,n)=>{let r=null;return wv(e)?r=e:wv(t)&&(r={size:"",unit:t?.unit}),{sizeValue:r,isUnitHighlighted:xv(e),placeholder:Ev(n,t)}})(a,d,r),g=((e,t)=>(e=>kv(e)?.units)(e)??(e=>({length:Jb,angle:Yb,time:Xb}[e]()))(t))(u,n),y=(e=>kv(e)?.default_unit)(u);return e.createElement(vv,{units:g,value:h,anchorRef:o,placeholder:f,defaultUnit:y,isUnitActive:m,onBlur:()=>{const e=u.settings.required;(e=>Sv.every(t=>t(e)))(a)&&!e&&c(null),e&&p()},setValue:(e,t,n)=>{c(e,t,{...n,validation:()=>u.settings.required?""!==e.size:!n?.validation||n.validation(e)})},SizeFieldWrapper:J,startIcon:i,ariaLabel:s,min:l})}),Tv=(0,e.forwardRef)(({promotionKey:t,children:n,trackingData:r},i)=>{const[s,l]=(0,e.useState)(!1),a=(c=t,window.elementor?.config?.v4Promotions?.[c]);var c;const u=(0,e.useCallback)(()=>{l(e=>(e||Pi(r),!e))},[r]);return(0,e.useImperativeHandle)(i,()=>({toggle:u}),[u]),e.createElement(e.Fragment,null,a&&e.createElement(W.PromotionInfotip,{title:a.title,content:a.content,assetUrl:a.image,ctaUrl:a.ctaUrl,open:s,onClose:e=>{e.stopPropagation(),l(!1)},onCtaClick:()=>_i(r)},e.createElement(o.Box,{onClick:e=>{e.stopPropagation(),u()},sx:{cursor:"pointer",display:"inline-flex"}},n??e.createElement(W.PromotionChip,null))))}),Mv=(0,i.__)("Display Conditions","elementor"),Ov={target_name:"display_conditions",location_l2:"general"},Iv=N(()=>{const t=(0,e.useRef)(null);return e.createElement(o.Stack,{direction:"row",spacing:2,sx:{justifyContent:"flex-end",alignItems:"center"}},e.createElement(Tv,{ref:t,promotionKey:"displayConditions",trackingData:Ov}),e.createElement(o.Tooltip,{title:Mv,placement:"top"},e.createElement(o.IconButton,{size:"tiny","aria-label":Mv,"data-behavior":"display-conditions",onClick:()=>t.current?.toggle(),sx:{border:"1px solid",borderColor:"divider",borderRadius:1}},e.createElement(U.SitemapIcon,{fontSize:"tiny",color:"disabled"}))))}),Pv=(0,i.__)("Attributes","elementor"),_v={target_name:"attributes",location_l2:"general"},Av=N(()=>{const t=(0,e.useRef)(null);return e.createElement(o.Stack,{direction:"row",spacing:2,sx:{justifyContent:"flex-end",alignItems:"center"}},e.createElement(Tv,{ref:t,promotionKey:"attributes",trackingData:_v}),e.createElement(o.Tooltip,{title:Pv,placement:"top"},e.createElement(U.PlusIcon,{"aria-label":Pv,fontSize:"tiny",color:"disabled",onClick:()=>t.current?.toggle(),sx:{cursor:"pointer"}})))}),Dv=(0,o.styled)(o.IconButton)(({theme:e})=>({width:e.spacing(2.5),height:e.spacing(2.5)})),Nv=({tooltipText:t,onClick:n,disabled:r,size:i="tiny"})=>e.createElement(o.Tooltip,{title:t,placement:"top",disableInteractive:!0},e.createElement(Dv,{"aria-label":t,size:i,onClick:n,disabled:r},e.createElement(U.BrushBigIcon,{fontSize:i})));function Rv(){return Rv=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},Rv.apply(null,arguments)}const zv="tiny",$v=({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:m=-1,isSortable:f=!0})=>{const[g,y]=(0,e.useState)(m),b=l.map((e,t)=>f&&"getId"in n?n.getId({item:e,index:t}):String(t)),v=r||p,w=v&&h,E=e.createElement(o.IconButton,{size:zv,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(U.PlusIcon,{fontSize:zv}));return e.createElement(Oe,{gap:2},e.createElement(kt,{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(He,{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(We,{id:t,key:`sortable-${t}`,disabled:!f},e.createElement(Lv,{disabled:r,propDisabled:i?.disabled,label:e.createElement(rt,{value:i},e.createElement(n.Label,{value:i,index:o})),startIcon:e.createElement(tt,{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,Rv({},t,{value:i,bind:String(o),index:o})))):null})))},Lv=({label:t,propDisabled:n,startIcon:r,children:s,removeItem:l,duplicateItem:a,toggleDisableItem:c,openOnMount:u,onOpen:d,showDuplicate:p,showToggle:h,showRemove:m,disabled:f,actions:g,value:y})=>{const{popoverState:b,popoverProps:v,ref:w,setRef:E}=Bv(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(Ze,Rv({disabled:f,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:zv,onClick:a,"aria-label":x},e.createElement(U.CopyIcon,{fontSize:zv}))),h&&e.createElement(o.Tooltip,{title:k,placement:"top"},e.createElement(o.IconButton,{size:zv,onClick:c,"aria-label":k},n?e.createElement(U.EyeOffIcon,{fontSize:zv}):e.createElement(U.EyeIcon,{fontSize:zv}))),g?.(y),m&&e.createElement(o.Tooltip,{title:S,placement:"top"},e.createElement(o.IconButton,{size:zv,onClick:l,"aria-label":S},e.createElement(U.XIcon,{fontSize:zv}))))})),e.createElement(yt,Rv({width:w?.getBoundingClientRect().width},v,{anchorEl:w}),e.createElement(o.Box,null,s({anchorEl:w}))))},Bv=(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 Vv(){return Vv=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},Vv.apply(null,arguments)}const jv=({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,Vv({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(U.ExternalLinkIcon,{fontSize:"tiny"})))))},Fv=({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&&Uv(n),p=vb({editor:t,selector:e=>Gv.filter(t=>e.editor.isActive(t))}),h=(0,e.useMemo)(()=>{const e=Object.values(qv);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:Wv.label,placement:"top",sx:{borderRadius:"8px"}},e.createElement(o.IconButton,{"aria-label":Wv.label,onClick:()=>Wv.method(t),size:"tiny"},Wv.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(jv,{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)}}))},Uv=e=>{const t=(0,In.getContainer)(e),n=t?.model.get("widgetType"),r="e-button"===n,o=!!(0,In.getElementSetting)(e,"link")?.value?.destination;return r||o},Hv={clear:{label:(0,i.__)("Clear","elementor"),icon:e.createElement(U.MinusIcon,{fontSize:"tiny"}),action:"clear",method:e=>{e.chain().focus().clearNodes().unsetAllMarks().run()}},bold:{label:(0,i.__)("Bold","elementor"),icon:e.createElement(U.BoldIcon,{fontSize:"tiny"}),action:"bold",method:e=>{e.chain().focus().toggleBold().run()}},italic:{label:(0,i.__)("Italic","elementor"),icon:e.createElement(U.ItalicIcon,{fontSize:"tiny"}),action:"italic",method:e=>{e.chain().focus().toggleItalic().run()}},underline:{label:(0,i.__)("Underline","elementor"),icon:e.createElement(U.UnderlineIcon,{fontSize:"tiny"}),action:"underline",method:e=>{e.chain().focus().toggleUnderline().run()}},strike:{label:(0,i.__)("Strikethrough","elementor"),icon:e.createElement(U.StrikethroughIcon,{fontSize:"tiny"}),action:"strike",method:e=>{e.chain().focus().toggleStrike().run()}},superscript:{label:(0,i.__)("Superscript","elementor"),icon:e.createElement(U.SuperscriptIcon,{fontSize:"tiny"}),action:"superscript",method:e=>{e.chain().focus().toggleSuperscript().run()}},subscript:{label:(0,i.__)("Subscript","elementor"),icon:e.createElement(U.SubscriptIcon,{fontSize:"tiny"}),action:"subscript",method:e=>{e.chain().focus().toggleSubscript().run()}},link:{label:(0,i.__)("Link","elementor"),icon:e.createElement(U.LinkIcon,{fontSize:"tiny"}),action:"link",method:null}},{clear:Wv,...qv}=Hv,Gv=Object.keys(qv);function Kv(){return Kv=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},Kv.apply(null,arguments)}const Jv={display:"flex",flexDirection:"column",justifyContent:"center"},Yv=({value:t,showPrimaryColor:n,onClick:r,options:i})=>{const s=(0,o.usePopupState)({variant:"popover",popupId:(0,e.useId)()});return e.createElement(e.Fragment,null,e.createElement(Xv,Kv({isPrimaryColor:n,size:"small"},(0,o.bindTrigger)(s)),t),e.createElement(o.Menu,Kv({MenuListProps:{dense:!0}},(0,o.bindMenu)(s)),i.map((t,n)=>e.createElement(W.MenuListItem,{key:t,onClick:()=>(e=>{r(i[e]),s.close()})(n),primaryTypographyProps:{variant:"caption",sx:{...Jv,lineHeight:"1"}},menuItemTextProps:{sx:Jv}},t.toUpperCase()))))},Xv=(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"})),Qv=(0,e.forwardRef)(({type:t,value:n,onChange:r,onKeyDown:o,onKeyUp:i,InputProps:s,onBlur:l,focused:a,disabled:c},u)=>e.createElement(he,{ref:u,size:"tiny",fullWidth:!0,type:t,value:n,onKeyUp:i,focused:a,disabled:c,onKeyDown:o,onInput:r,onBlur:l,InputProps:s,sx:Zv(s?.readOnly??!1)})),Zv=e=>({input:{cursor:e?"default !important":void 0}}),ew=({value:t,InputProps:n,onChange:r,onBlur:i,units:s,defaultUnit:l,startIcon:a})=>{const{size:c,unit:u,setSize:d,setUnit:p}=((e,t,n)=>{const[r,o]=Ee({external:e,setExternal:e=>{null!==e&&t(e)},persistWhen:t=>((e,t)=>e?.size!==t?.size||e?.unit!==t?.unit)(t,e),fallback:()=>({size:"",unit:n??"px"})});return{size:r.size,unit:r.unit,setSize:e=>{const t={...r,size:""===e.trim()?null:Number(e)};o(t)},setUnit:e=>{const t={...r,unit:e};o(t)}}})(t,r,l);return e.createElement(Qv,{type:"number",value:c??"",onBlur:i,onChange:e=>d(e.target.value),InputProps:{...n,startAdornment:a&&e.createElement(o.InputAdornment,{position:"start"},a),endAdornment:e.createElement(o.InputAdornment,{position:"end"},e.createElement(Yv,{options:s,value:u,onClick:p,showPrimaryColor:tw(c)}))}})},tw=e=>null!==e&&""!==e;var nw=window.elementorV2.editorV1Adapters;const rw=()=>{const{groups:t,options:n}=(()=>{const{controls:e}=(0,nw.getElementorConfig)();return e?.font??{}})();return(0,e.useMemo)(()=>{if(!t||!n)return[];const e=Object.keys(t),r=new Map(e.map((e,t)=>[e,t]));return Object.entries(n).reduce((e,[n,o])=>{const i=r.get(o);return void 0===i||(e[i]||(e[i]={label:t[o],fonts:[]}),e[i].fonts.push(n)),e},[]).filter(Boolean)},[t,n])}}(),(window.elementorV2=window.elementorV2||{}).editorControls=r}(),window.elementorV2.editorControls?.init?.();