@useloops/design-system 1.4.77 → 1.4.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -22,22 +22,22 @@ object-assign
|
|
|
22
22
|
@license MIT
|
|
23
23
|
*/function Ia(){if(xa)return ja;xa=1;var e=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return ja=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var a={},r=0;r<10;r++)a["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(a).map((function(e){return a[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(n,i){for(var t,o,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),l=1;l<arguments.length;l++){for(var c in t=Object(arguments[l]))a.call(t,c)&&(s[c]=t[c]);if(e){o=e(t);for(var d=0;d<o.length;d++)r.call(t,o[d])&&(s[o[d]]=t[o[d]])}}return s},ja}function Fa(){if(qa)return $a;qa=1;return $a="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Pa(){return Sa?Ca:(Sa=1,Ca=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var Ra=Na();ka.exports=function(){if(_a)return Ma;_a=1;var e=Na(),a=Ia(),r=Fa(),n=Pa(),i=function(){if(Ea)return Oa;Ea=1;var e=function(){};if("production"!==process.env.NODE_ENV){var a=Fa(),r={},n=Pa();e=function(e){var a="Warning: "+e;"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}}}function i(i,t,o,s,l){if("production"!==process.env.NODE_ENV)for(var c in i)if(n(i,c)){var d;try{if("function"!=typeof i[c]){var u=Error((s||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}d=i[c](t,c,s,o,null,a)}catch(e){d=e}if(!d||d instanceof Error||e((s||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in r)){r[d.message]=!0;var h=l?l():"";e("Failed "+o+" type: "+d.message+(null!=h?h:""))}}}return i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},Oa=i}(),t=function(){};function o(){return null}return"production"!==process.env.NODE_ENV&&(t=function(e){var a="Warning: "+e;"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}}),Ma=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator,d="<<anonymous>>",u={array:p("array"),bigint:p("bigint"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:g(o),arrayOf:function(e){return g((function(a,n,i,t,o){if("function"!=typeof e)return new m("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=a[n];if(!Array.isArray(s))return new m("Invalid "+t+" `"+o+"` of type `"+k(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,i,t,o+"["+l+"]",r);if(c instanceof Error)return c}return null}))},element:g((function(e,a,r,n,i){var t=e[a];return s(t)?null:new m("Invalid "+n+" `"+i+"` of type `"+k(t)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:g((function(a,r,n,i,t){var o=a[r];return e.isValidElementType(o)?null:new m("Invalid "+i+" `"+t+"` of type `"+k(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return g((function(a,r,n,i,t){if(!(a[r]instanceof e)){var o=e.name||d;return new m("Invalid "+i+" `"+t+"` of type `"+((s=a[r]).constructor&&s.constructor.name?s.constructor.name:d)+"` supplied to `"+n+"`, expected instance of `"+o+"`.")}var s;return null}))},node:g((function(e,a,r,n,i){return f(e[a])?null:new m("Invalid "+n+" `"+i+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return g((function(a,i,t,o,s){if("function"!=typeof e)return new m("Property `"+s+"` of component `"+t+"` has invalid PropType notation inside objectOf.");var l=a[i],c=k(l);if("object"!==c)return new m("Invalid "+o+" `"+s+"` of type `"+c+"` supplied to `"+t+"`, expected an object.");for(var d in l)if(n(l,d)){var u=e(l,d,t,o,s+"."+d,r);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?g((function(a,r,n,i,t){for(var o=a[r],s=0;s<e.length;s++)if(h(o,e[s]))return null;var l=JSON.stringify(e,(function(e,a){return"symbol"===y(a)?String(a):a}));return new m("Invalid "+i+" `"+t+"` of value `"+String(o)+"` supplied to `"+n+"`, expected one of "+l+".")})):("production"!==process.env.NODE_ENV&&t(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),o)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&t("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var a=0;a<e.length;a++){var i=e[a];if("function"!=typeof i)return t("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+v(i)+" at index "+a+"."),o}return g((function(a,i,t,o,s){for(var l=[],c=0;c<e.length;c++){var d=(0,e[c])(a,i,t,o,s,r);if(null==d)return null;d.data&&n(d.data,"expectedType")&&l.push(d.data.expectedType)}return new m("Invalid "+o+" `"+s+"` supplied to `"+t+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")}))},shape:function(e){return g((function(a,n,i,t,o){var s=a[n],l=k(s);if("object"!==l)return new m("Invalid "+t+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return b(i,t,o,c,y(d));var u=d(s,c,i,t,o+"."+c,r);if(u)return u}return null}))},exact:function(e){return g((function(i,t,o,s,l){var c=i[t],d=k(c);if("object"!==d)return new m("Invalid "+s+" `"+l+"` of type `"+d+"` supplied to `"+o+"`, expected `object`.");var u=a({},i[t],e);for(var h in u){var g=e[h];if(n(e,h)&&"function"!=typeof g)return b(o,s,l,h,y(g));if(!g)return new m("Invalid "+s+" `"+l+"` key `"+h+"` supplied to `"+o+"`.\nBad object: "+JSON.stringify(i[t],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var p=g(c,h,o,s,l+"."+h,r);if(p)return p}return null}))}};function h(e,a){return e===a?0!==e||1/e==1/a:e!=e&&a!=a}function m(e,a){this.message=e,this.data=a&&"object"==typeof a?a:{},this.stack=""}function g(e){if("production"!==process.env.NODE_ENV)var a={},n=0;function i(i,o,s,c,u,h,g){if(c=c||d,h=h||s,g!==r){if(l){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var b=c+":"+s;!a[b]&&n<3&&(t("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),a[b]=!0,n++)}}return null==o[s]?i?null===o[s]?new m("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`."):new m("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(o,s,c,u,h)}var o=i.bind(null,!1);return o.isRequired=i.bind(null,!0),o}function p(e){return g((function(a,r,n,i,t,o){var s=a[r];return k(s)!==e?new m("Invalid "+i+" `"+t+"` of type `"+y(s)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function b(e,a,r,n,i){return new m((e||"React class")+": "+a+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function f(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(f);if(null===e||s(e))return!0;var a=function(e){var a=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof a)return a}(e);if(!a)return!1;var r,n=a.call(e);if(a!==e.entries){for(;!(r=n.next()).done;)if(!f(r.value))return!1}else for(;!(r=n.next()).done;){var i=r.value;if(i&&!f(i[1]))return!1}return!0;default:return!1}}function k(e){var a=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,a){return"symbol"===e||!!a&&("Symbol"===a["@@toStringTag"]||"function"==typeof Symbol&&a instanceof Symbol)}(a,e)?"symbol":a}function y(e){if(null==e)return""+e;var a=k(e);if("object"===a){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return a}function v(e){var a=y(e);switch(a){case"array":case"object":return"an "+a;case"boolean":case"date":case"regexp":return"a "+a;default:return a}}return m.prototype=Error.prototype,u.checkPropTypes=i,u.resetWarningCache=i.resetWarningCache,u.PropTypes=u,u},Ma}()(Ra.isElement,!0)}else ka.exports=function(){if(Da)return Aa;Da=1;var e=Fa();function a(){}function r(){}return r.resetWarningCache=a,Aa=function(){function n(a,r,n,i,t,o){if(o!==e){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function i(){return n}n.isRequired=n;var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:r,resetWarningCache:a};return t.PropTypes=t,t},Aa}()();var La=u(ka.exports);var Ba=function(){function e(e){var a=this;this._insertTag=function(e){var r;r=0===a.tags.length?a.insertionPoint?a.insertionPoint.nextSibling:a.prepend?a.container.firstChild:a.before:a.tags[a.tags.length-1].nextSibling,a.container.insertBefore(e,r),a.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var a=e.prototype;return a.hydrate=function(e){e.forEach(this._insertTag)},a.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var a=document.createElement("style");return a.setAttribute("data-emotion",e.key),void 0!==e.nonce&&a.setAttribute("nonce",e.nonce),a.appendChild(document.createTextNode("")),a.setAttribute("data-s",""),a}(this));var a=this.tags[this.tags.length-1];if(this.isSpeedy){var r=function(e){if(e.sheet)return e.sheet;for(var a=0;a<document.styleSheets.length;a++)if(document.styleSheets[a].ownerNode===e)return document.styleSheets[a]}(a);try{r.insertRule(e,r.cssRules.length)}catch(e){}}else a.appendChild(document.createTextNode(e));this.ctr++},a.flush=function(){this.tags.forEach((function(e){var a;return null==(a=e.parentNode)?void 0:a.removeChild(e)})),this.tags=[],this.ctr=0},e}(),Va="-ms-",Ha="-moz-",Wa="-webkit-",Ua="comm",Ga="rule",Ka="decl",Za="@keyframes",Ja=Math.abs,Ya=String.fromCharCode,Xa=Object.assign;function Qa(e){return e.trim()}function er(e,a,r){return e.replace(a,r)}function ar(e,a){return e.indexOf(a)}function rr(e,a){return 0|e.charCodeAt(a)}function nr(e,a,r){return e.slice(a,r)}function ir(e){return e.length}function tr(e){return e.length}function or(e,a){return a.push(e),e}var sr=1,lr=1,cr=0,dr=0,ur=0,hr="";function mr(e,a,r,n,i,t,o){return{value:e,root:a,parent:r,type:n,props:i,children:t,line:sr,column:lr,length:o,return:""}}function gr(e,a){return Xa(mr("",null,null,"",null,null,0),e,{length:-e.length},a)}function pr(){return ur=dr<cr?rr(hr,dr++):0,lr++,10===ur&&(lr=1,sr++),ur}function br(){return rr(hr,dr)}function fr(){return dr}function kr(e,a){return nr(hr,e,a)}function yr(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function vr(e){return sr=lr=1,cr=ir(hr=e),dr=0,[]}function wr(e){return hr="",e}function zr(e){return Qa(kr(dr-1,$r(91===e?e+2:40===e?e+1:e)))}function jr(e){for(;(ur=br())&&ur<33;)pr();return yr(e)>2||yr(ur)>3?"":" "}function xr(e,a){for(;--a&&pr()&&!(ur<48||ur>102||ur>57&&ur<65||ur>70&&ur<97););return kr(e,fr()+(a<6&&32==br()&&32==pr()))}function $r(e){for(;pr();)switch(ur){case e:return dr;case 34:case 39:34!==e&&39!==e&&$r(ur);break;case 40:41===e&&$r(e);break;case 92:pr()}return dr}function qr(e,a){for(;pr()&&e+ur!==57&&(e+ur!==84||47!==br()););return"/*"+kr(a,dr-1)+"*"+Ya(47===e?e:pr())}function Cr(e){for(;!yr(br());)pr();return kr(e,dr)}function Sr(e){return wr(Or("",null,null,null,[""],e=vr(e),0,[0],e))}function Or(e,a,r,n,i,t,o,s,l){for(var c=0,d=0,u=o,h=0,m=0,g=0,p=1,b=1,f=1,k=0,y="",v=i,w=t,z=n,j=y;b;)switch(g=k,k=pr()){case 40:if(108!=g&&58==rr(j,u-1)){-1!=ar(j+=er(zr(k),"&","&\f"),"&\f")&&(f=-1);break}case 34:case 39:case 91:j+=zr(k);break;case 9:case 10:case 13:case 32:j+=jr(g);break;case 92:j+=xr(fr()-1,7);continue;case 47:switch(br()){case 42:case 47:or(Mr(qr(pr(),fr()),a,r),l);break;default:j+="/"}break;case 123*p:s[c++]=ir(j)*f;case 125*p:case 59:case 0:switch(k){case 0:case 125:b=0;case 59+d:-1==f&&(j=er(j,/\f/g,"")),m>0&&ir(j)-u&&or(m>32?_r(j+";",n,r,u-1):_r(er(j," ","")+";",n,r,u-2),l);break;case 59:j+=";";default:if(or(z=Er(j,a,r,c,d,i,s,y,v=[],w=[],u),t),123===k)if(0===d)Or(j,a,z,z,v,t,u,s,w);else switch(99===h&&110===rr(j,3)?100:h){case 100:case 108:case 109:case 115:Or(e,z,z,n&&or(Er(e,z,z,0,0,i,s,y,i,v=[],u),w),i,w,u,s,n?v:w);break;default:Or(j,z,z,z,[""],w,0,s,w)}}c=d=m=0,p=f=1,y=j="",u=o;break;case 58:u=1+ir(j),m=g;default:if(p<1)if(123==k)--p;else if(125==k&&0==p++&&125==(ur=dr>0?rr(hr,--dr):0,lr--,10===ur&&(lr=1,sr--),ur))continue;switch(j+=Ya(k),k*p){case 38:f=d>0?1:(j+="\f",-1);break;case 44:s[c++]=(ir(j)-1)*f,f=1;break;case 64:45===br()&&(j+=zr(pr())),h=br(),d=u=ir(y=j+=Cr(fr())),k++;break;case 45:45===g&&2==ir(j)&&(p=0)}}return t}function Er(e,a,r,n,i,t,o,s,l,c,d){for(var u=i-1,h=0===i?t:[""],m=tr(h),g=0,p=0,b=0;g<n;++g)for(var f=0,k=nr(e,u+1,u=Ja(p=o[g])),y=e;f<m;++f)(y=Qa(p>0?h[f]+" "+k:er(k,/&\f/g,h[f])))&&(l[b++]=y);return mr(e,a,r,0===i?Ga:s,l,c,d)}function Mr(e,a,r){return mr(e,a,r,Ua,Ya(ur),nr(e,2,-2),0)}function _r(e,a,r,n){return mr(e,a,r,Ka,nr(e,0,n),nr(e,n+1,-1),n)}function Ar(e,a){for(var r="",n=tr(e),i=0;i<n;i++)r+=a(e[i],i,e,a)||"";return r}function Dr(e,a,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case Ka:return e.return=e.return||e.value;case Ua:return"";case Za:return e.return=e.value+"{"+Ar(e.children,n)+"}";case Ga:e.value=e.props.join(",")}return ir(r=Ar(e.children,n))?e.return=e.value+"{"+r+"}":""}function Tr(e){var a=tr(e);return function(r,n,i,t){for(var o="",s=0;s<a;s++)o+=e[s](r,n,i,t)||"";return o}}function Nr(e){var a=Object.create(null);return function(r){return void 0===a[r]&&(a[r]=e(r)),a[r]}}var Ir="undefined"!=typeof document,Fr=function(e,a,r){for(var n=0,i=0;n=i,i=br(),38===n&&12===i&&(a[r]=1),!yr(i);)pr();return kr(e,dr)},Pr=function(e,a){return wr(function(e,a){var r=-1,n=44;do{switch(yr(n)){case 0:38===n&&12===br()&&(a[r]=1),e[r]+=Fr(dr-1,a,r);break;case 2:e[r]+=zr(n);break;case 4:if(44===n){e[++r]=58===br()?"&\f":"",a[r]=e[r].length;break}default:e[r]+=Ya(n)}}while(n=pr());return e}(vr(e),a))},Rr=new WeakMap,Lr=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var a=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;"rule"!==r.type;)if(!(r=r.parent))return;if((1!==e.props.length||58===a.charCodeAt(0)||Rr.get(r))&&!n){Rr.set(e,!0);for(var i=[],t=Pr(a,i),o=r.props,s=0,l=0;s<t.length;s++)for(var c=0;c<o.length;c++,l++)e.props[l]=i[s]?t[s].replace(/&\f/g,o[c]):o[c]+" "+t[s]}}},Br=function(e){if("decl"===e.type){var a=e.value;108===a.charCodeAt(0)&&98===a.charCodeAt(2)&&(e.return="",e.value="")}};function Vr(e,a){switch(function(e,a){return 45^rr(e,0)?(((a<<2^rr(e,0))<<2^rr(e,1))<<2^rr(e,2))<<2^rr(e,3):0}(e,a)){case 5103:return Wa+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Wa+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Wa+e+Ha+e+Va+e+e;case 6828:case 4268:return Wa+e+Va+e+e;case 6165:return Wa+e+Va+"flex-"+e+e;case 5187:return Wa+e+er(e,/(\w+).+(:[^]+)/,Wa+"box-$1$2"+Va+"flex-$1$2")+e;case 5443:return Wa+e+Va+"flex-item-"+er(e,/flex-|-self/,"")+e;case 4675:return Wa+e+Va+"flex-line-pack"+er(e,/align-content|flex-|-self/,"")+e;case 5548:return Wa+e+Va+er(e,"shrink","negative")+e;case 5292:return Wa+e+Va+er(e,"basis","preferred-size")+e;case 6060:return Wa+"box-"+er(e,"-grow","")+Wa+e+Va+er(e,"grow","positive")+e;case 4554:return Wa+er(e,/([^-])(transform)/g,"$1"+Wa+"$2")+e;case 6187:return er(er(er(e,/(zoom-|grab)/,Wa+"$1"),/(image-set)/,Wa+"$1"),e,"")+e;case 5495:case 3959:return er(e,/(image-set\([^]*)/,Wa+"$1$`$1");case 4968:return er(er(e,/(.+:)(flex-)?(.*)/,Wa+"box-pack:$3"+Va+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Wa+e+e;case 4095:case 3583:case 4068:case 2532:return er(e,/(.+)-inline(.+)/,Wa+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ir(e)-1-a>6)switch(rr(e,a+1)){case 109:if(45!==rr(e,a+4))break;case 102:return er(e,/(.+:)(.+)-([^]+)/,"$1"+Wa+"$2-$3$1"+Ha+(108==rr(e,a+3)?"$3":"$2-$3"))+e;case 115:return~ar(e,"stretch")?Vr(er(e,"stretch","fill-available"),a)+e:e}break;case 4949:if(115!==rr(e,a+1))break;case 6444:switch(rr(e,ir(e)-3-(~ar(e,"!important")&&10))){case 107:return er(e,":",":"+Wa)+e;case 101:return er(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Wa+(45===rr(e,14)?"inline-":"")+"box$3$1"+Wa+"$2$3$1"+Va+"$2box$3")+e}break;case 5936:switch(rr(e,a+11)){case 114:return Wa+e+Va+er(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Wa+e+Va+er(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Wa+e+Va+er(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Wa+e+Va+e+e}return e}var Hr=Ir?void 0:function(e){var a=new WeakMap;return function(r){if(a.has(r))return a.get(r);var n=e(r);return a.set(r,n),n}}((function(){return Nr((function(){return{}}))})),Wr=[function(e,a,r,n){if(e.length>-1&&!e.return)switch(e.type){case Ka:e.return=Vr(e.value,e.length);break;case Za:return Ar([gr(e,{value:er(e.value,"@","@"+Wa)})],n);case Ga:if(e.length)return function(e,a){return e.map(a).join("")}(e.props,(function(a){switch(function(e,a){return(e=a.exec(e))?e[0]:e}(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ar([gr(e,{props:[er(a,/:(read-\w+)/,":-moz-$1")]})],n);case"::placeholder":return Ar([gr(e,{props:[er(a,/:(plac\w+)/,":"+Wa+"input-$1")]}),gr(e,{props:[er(a,/:(plac\w+)/,":-moz-$1")]}),gr(e,{props:[er(a,/:(plac\w+)/,Va+"input-$1")]})],n)}return""}))}}],Ur=function(e){var a=e.key;if(Ir&&"css"===a){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var n,i,t=e.stylisPlugins||Wr,o={},s=[];Ir&&(n=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+a+' "]'),(function(e){for(var a=e.getAttribute("data-emotion").split(" "),r=1;r<a.length;r++)o[a[r]]=!0;s.push(e)})));var l,c=[Lr,Br];if(Hr){var d=[Dr],u=Tr(c.concat(t,d)),h=Hr(t)(a),m=function(e,a){var r=a.name;return void 0===h[r]&&(h[r]=Ar(Sr(e?e+"{"+a.styles+"}":a.styles),u)),h[r]};i=function(e,a,r,n){var i=a.name,t=m(e,a);return void 0===f.compat?(n&&(f.inserted[i]=!0),t):n?void(f.inserted[i]=t):t}}else{var g,p=[Dr,(l=function(e){g.insert(e)},function(e){e.root||(e=e.return)&&l(e)})],b=Tr(c.concat(t,p));i=function(e,a,r,n){g=r,Ar(Sr(e?e+"{"+a.styles+"}":a.styles),b),n&&(f.inserted[a.name]=!0)}}var f={key:a,sheet:new Ba({key:a,container:n,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:o,registered:{},insert:i};return f.sheet.hydrate(s),f};let Gr;function Kr(e){const{injectFirst:a,children:r}=e;return a&&Gr?k.jsx(n.CacheProvider,{value:Gr,children:r}):r}function Zr(e){const{styles:a,defaultTheme:r={}}=e,i="function"==typeof a?e=>{return a(null==(n=e)||0===Object.keys(n).length?r:e);var n}:a;return k.jsx(n.Global,{styles:i})}"object"==typeof document&&(Gr=Ur({key:"css",prepend:!0})),"production"!==process.env.NODE_ENV&&(Kr.propTypes={children:La.node,injectFirst:La.bool}),"production"!==process.env.NODE_ENV&&(Zr.propTypes={defaultTheme:La.object,styles:La.oneOfType([La.array,La.string,La.object,La.func])});var Jr=Object.freeze({__proto__:null,GlobalStyles:Zr,StyledEngineProvider:Kr,ThemeContext:n.ThemeContext,css:n.css,default:
|
|
24
24
|
/**
|
|
25
|
-
* @mui/styled-engine v5.16.
|
|
25
|
+
* @mui/styled-engine v5.16.14
|
|
26
26
|
*
|
|
27
27
|
* @license MIT
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
30
30
|
*/
|
|
31
|
-
function(e,a){const r=l(e,a);return"production"!==process.env.NODE_ENV?(...a)=>{const n="string"==typeof e?`"${e}"`:"component";return 0===a.length?console.error([`MUI: Seems like you called \`styled(${n})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n")):a.some((e=>void 0===e))&&console.error(`MUI: the styled(${n})(...args) API requires all its args to be defined.`),r(...a)}:r},internal_processStyles:(e,a)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=a(e.__emotion_styles))},keyframes:n.keyframes});function Yr(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function Xr(e){if(!Yr(e))return e;const a={};return Object.keys(e).forEach((r=>{a[r]=Xr(e[r])})),a}function Qr(e,a,r={clone:!0}){const n=r.clone?ma({},e):e;return Yr(e)&&Yr(a)&&Object.keys(a).forEach((i=>{Yr(a[i])&&Object.prototype.hasOwnProperty.call(e,i)&&Yr(e[i])?n[i]=Qr(e[i],a[i],r):r.clone?n[i]=Yr(a[i])?Xr(a[i]):a[i]:n[i]=a[i]})),n}var en=Object.freeze({__proto__:null,default:Qr,isPlainObject:Yr});const an=["values","unit","step"];function rn(e){const{values:a={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5}=e,i=ga(e,an),t=(e=>{const a=Object.keys(e).map((a=>({key:a,val:e[a]})))||[];return a.sort(((e,a)=>e.val-a.val)),a.reduce(((e,a)=>ma({},e,{[a.key]:a.val})),{})})(a),o=Object.keys(t);function s(e){return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r})`}function l(e){return`@media (max-width:${("number"==typeof a[e]?a[e]:e)-n/100}${r})`}function c(e,i){const t=o.indexOf(i);return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r}) and (max-width:${(-1!==t&&"number"==typeof a[o[t]]?a[o[t]]:i)-n/100}${r})`}return ma({keys:o,values:t,up:s,down:l,between:c,only:function(e){return o.indexOf(e)+1<o.length?c(e,o[o.indexOf(e)+1]):s(e)},not:function(e){const a=o.indexOf(e);return 0===a?s(o[1]):a===o.length-1?l(o[a]):c(e,o[o.indexOf(e)+1]).replace("@media","@media not all and")},unit:r},i)}const nn={borderRadius:4},tn="production"!==process.env.NODE_ENV?La.oneOfType([La.number,La.string,La.object,La.array]):{};function on(e,a){return a?Qr(e,a,{clone:!1}):e}const sn={xs:0,sm:600,md:900,lg:1200,xl:1536},ln={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${sn[e]}px)`};function cn(e,a,r){const n=e.theme||{};if(Array.isArray(a)){const e=n.breakpoints||ln;return a.reduce(((n,i,t)=>(n[e.up(e.keys[t])]=r(a[t]),n)),{})}if("object"==typeof a){const e=n.breakpoints||ln;return Object.keys(a).reduce(((n,i)=>{if(-1!==Object.keys(e.values||sn).indexOf(i)){n[e.up(i)]=r(a[i],i)}else{const e=i;n[e]=a[e]}return n}),{})}return r(a)}function dn(e){if("string"!=typeof e)throw new Error("production"!==process.env.NODE_ENV?"MUI: `capitalize(string)` expects a string argument.":pa(7));return e.charAt(0).toUpperCase()+e.slice(1)}var un=Object.freeze({__proto__:null,default:dn});function hn(e,a,r=!0){if(!a||"string"!=typeof a)return null;if(e&&e.vars&&r){const r=`vars.${a}`.split(".").reduce(((e,a)=>e&&e[a]?e[a]:null),e);if(null!=r)return r}return a.split(".").reduce(((e,a)=>e&&null!=e[a]?e[a]:null),e)}function mn(e,a,r,n=r){let i;return i="function"==typeof e?e(r):Array.isArray(e)?e[r]||n:hn(e,r)||n,a&&(i=a(i,n,e)),i}function gn(e){const{prop:a,cssProperty:r=e.prop,themeKey:n,transform:i}=e,t=e=>{if(null==e[a])return null;const t=e[a],o=hn(e.theme,n)||{};return cn(e,t,(e=>{let n=mn(o,i,e);return e===n&&"string"==typeof e&&(n=mn(o,i,`${a}${"default"===e?"":dn(e)}`,e)),!1===r?n:{[r]:n}}))};return t.propTypes="production"!==process.env.NODE_ENV?{[a]:tn}:{},t.filterProps=[a],t}const pn={m:"margin",p:"padding"},bn={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},fn={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},kn=function(e){const a={};return r=>(void 0===a[r]&&(a[r]=e(r)),a[r])}((e=>{if(e.length>2){if(!fn[e])return[e];e=fn[e]}const[a,r]=e.split(""),n=pn[a],i=bn[r]||"";return Array.isArray(i)?i.map((e=>n+e)):[n+i]})),yn=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],vn=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],wn=[...yn,...vn];function zn(e,a,r,n){var i;const t=null!=(i=hn(e,a,!1))?i:r;return"number"==typeof t?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&"number"!=typeof e&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${e}.`),t*e):Array.isArray(t)?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&(Number.isInteger(e)?e>t.length-1&&console.error([`MUI: The value provided (${e}) overflows.`,`The supported values are: ${JSON.stringify(t)}.`,`${e} > ${t.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${a}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${a}\` as a number.`].join("\n"))),t[e]):"function"==typeof t?t:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${a}\` value (${t}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function jn(e){return zn(e,"spacing",8,"spacing")}function xn(e,a){if("string"==typeof a||null==a)return a;const r=e(Math.abs(a));return a>=0?r:"number"==typeof r?-r:`-${r}`}function $n(e,a,r,n){if(-1===a.indexOf(r))return null;const i=function(e,a){return r=>e.reduce(((e,n)=>(e[n]=xn(a,r),e)),{})}(kn(r),n);return cn(e,e[r],i)}function qn(e,a){const r=jn(e.theme);return Object.keys(e).map((n=>$n(e,a,n,r))).reduce(on,{})}function Cn(e){return qn(e,yn)}function Sn(e){return qn(e,vn)}function On(...e){const a=e.reduce(((e,a)=>(a.filterProps.forEach((r=>{e[r]=a})),e)),{}),r=e=>Object.keys(e).reduce(((r,n)=>a[n]?on(r,a[n](e)):r),{});return r.propTypes="production"!==process.env.NODE_ENV?e.reduce(((e,a)=>Object.assign(e,a.propTypes)),{}):{},r.filterProps=e.reduce(((e,a)=>e.concat(a.filterProps)),[]),r}function En(e){return"number"!=typeof e?e:`${e}px solid`}function Mn(e,a){return gn({prop:e,themeKey:"borders",transform:a})}Cn.propTypes="production"!==process.env.NODE_ENV?yn.reduce(((e,a)=>(e[a]=tn,e)),{}):{},Cn.filterProps=yn,Sn.propTypes="production"!==process.env.NODE_ENV?vn.reduce(((e,a)=>(e[a]=tn,e)),{}):{},Sn.filterProps=vn,"production"===process.env.NODE_ENV||wn.reduce(((e,a)=>(e[a]=tn,e)),{});const _n=Mn("border",En),An=Mn("borderTop",En),Dn=Mn("borderRight",En),Tn=Mn("borderBottom",En),Nn=Mn("borderLeft",En),In=Mn("borderColor"),Fn=Mn("borderTopColor"),Pn=Mn("borderRightColor"),Rn=Mn("borderBottomColor"),Ln=Mn("borderLeftColor"),Bn=Mn("outline",En),Vn=Mn("outlineColor"),Hn=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const a=zn(e.theme,"shape.borderRadius",4,"borderRadius"),r=e=>({borderRadius:xn(a,e)});return cn(e,e.borderRadius,r)}return null};Hn.propTypes="production"!==process.env.NODE_ENV?{borderRadius:tn}:{},Hn.filterProps=["borderRadius"],On(_n,An,Dn,Tn,Nn,In,Fn,Pn,Rn,Ln,Hn,Bn,Vn);const Wn=e=>{if(void 0!==e.gap&&null!==e.gap){const a=zn(e.theme,"spacing",8,"gap"),r=e=>({gap:xn(a,e)});return cn(e,e.gap,r)}return null};Wn.propTypes="production"!==process.env.NODE_ENV?{gap:tn}:{},Wn.filterProps=["gap"];const Un=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const a=zn(e.theme,"spacing",8,"columnGap"),r=e=>({columnGap:xn(a,e)});return cn(e,e.columnGap,r)}return null};Un.propTypes="production"!==process.env.NODE_ENV?{columnGap:tn}:{},Un.filterProps=["columnGap"];const Gn=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const a=zn(e.theme,"spacing",8,"rowGap"),r=e=>({rowGap:xn(a,e)});return cn(e,e.rowGap,r)}return null};Gn.propTypes="production"!==process.env.NODE_ENV?{rowGap:tn}:{},Gn.filterProps=["rowGap"];function Kn(e,a){return"grey"===a?a:e}On(Wn,Un,Gn,gn({prop:"gridColumn"}),gn({prop:"gridRow"}),gn({prop:"gridAutoFlow"}),gn({prop:"gridAutoColumns"}),gn({prop:"gridAutoRows"}),gn({prop:"gridTemplateColumns"}),gn({prop:"gridTemplateRows"}),gn({prop:"gridTemplateAreas"}),gn({prop:"gridArea"}));function Zn(e){return e<=1&&0!==e?100*e+"%":e}On(gn({prop:"color",themeKey:"palette",transform:Kn}),gn({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Kn}),gn({prop:"backgroundColor",themeKey:"palette",transform:Kn}));const Jn=gn({prop:"width",transform:Zn}),Yn=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const a=a=>{var r,n;const i=(null==(r=e.theme)||null==(r=r.breakpoints)||null==(r=r.values)?void 0:r[a])||sn[a];return i?"px"!==(null==(n=e.theme)||null==(n=n.breakpoints)?void 0:n.unit)?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Zn(a)}};return cn(e,e.maxWidth,a)}return null};Yn.filterProps=["maxWidth"];const Xn=gn({prop:"minWidth",transform:Zn}),Qn=gn({prop:"height",transform:Zn}),ei=gn({prop:"maxHeight",transform:Zn}),ai=gn({prop:"minHeight",transform:Zn});gn({prop:"size",cssProperty:"width",transform:Zn}),gn({prop:"size",cssProperty:"height",transform:Zn});On(Jn,Yn,Xn,Qn,ei,ai,gn({prop:"boxSizing"}));const ri={border:{themeKey:"borders",transform:En},borderTop:{themeKey:"borders",transform:En},borderRight:{themeKey:"borders",transform:En},borderBottom:{themeKey:"borders",transform:En},borderLeft:{themeKey:"borders",transform:En},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:En},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Hn},color:{themeKey:"palette",transform:Kn},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Kn},backgroundColor:{themeKey:"palette",transform:Kn},p:{style:Sn},pt:{style:Sn},pr:{style:Sn},pb:{style:Sn},pl:{style:Sn},px:{style:Sn},py:{style:Sn},padding:{style:Sn},paddingTop:{style:Sn},paddingRight:{style:Sn},paddingBottom:{style:Sn},paddingLeft:{style:Sn},paddingX:{style:Sn},paddingY:{style:Sn},paddingInline:{style:Sn},paddingInlineStart:{style:Sn},paddingInlineEnd:{style:Sn},paddingBlock:{style:Sn},paddingBlockStart:{style:Sn},paddingBlockEnd:{style:Sn},m:{style:Cn},mt:{style:Cn},mr:{style:Cn},mb:{style:Cn},ml:{style:Cn},mx:{style:Cn},my:{style:Cn},margin:{style:Cn},marginTop:{style:Cn},marginRight:{style:Cn},marginBottom:{style:Cn},marginLeft:{style:Cn},marginX:{style:Cn},marginY:{style:Cn},marginInline:{style:Cn},marginInlineStart:{style:Cn},marginInlineEnd:{style:Cn},marginBlock:{style:Cn},marginBlockStart:{style:Cn},marginBlockEnd:{style:Cn},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Wn},rowGap:{style:Gn},columnGap:{style:Un},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Zn},maxWidth:{style:Yn},minWidth:{transform:Zn},height:{transform:Zn},maxHeight:{transform:Zn},minHeight:{transform:Zn},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function ni(){function e(e,a,r,n){const i={[e]:a,theme:r},t=n[e];if(!t)return{[e]:a};const{cssProperty:o=e,themeKey:s,transform:l,style:c}=t;if(null==a)return null;if("typography"===s&&"inherit"===a)return{[e]:a};const d=hn(r,s)||{};if(c)return c(i);return cn(i,a,(a=>{let r=mn(d,l,a);return a===r&&"string"==typeof a&&(r=mn(d,l,`${e}${"default"===a?"":dn(a)}`,a)),!1===o?r:{[o]:r}}))}return function a(r){var n;const{sx:i,theme:t={}}=r||{};if(!i)return null;const o=null!=(n=t.unstable_sxConfig)?n:ri;function s(r){let n=r;if("function"==typeof r)n=r(t);else if("object"!=typeof r)return r;if(!n)return null;const i=function(e={}){var a;return(null==(a=e.keys)?void 0:a.reduce(((a,r)=>(a[e.up(r)]={},a)),{}))||{}}(t.breakpoints),s=Object.keys(i);let l=i;return Object.keys(n).forEach((r=>{const i=(s=n[r],c=t,"function"==typeof s?s(c):s);var s,c;if(null!=i)if("object"==typeof i)if(o[r])l=on(l,e(r,i,t,o));else{const e=cn({theme:t},i,(e=>({[r]:e})));!function(...e){const a=e.reduce(((e,a)=>e.concat(Object.keys(a))),[]),r=new Set(a);return e.every((e=>r.size===Object.keys(e).length))}(e,i)?l=on(l,e):l[r]=a({sx:i,theme:t})}else l=on(l,e(r,i,t,o))})),function(e,a){return e.reduce(((e,a)=>{const r=e[a];return(!r||0===Object.keys(r).length)&&delete e[a],e}),a)}(s,l)}return Array.isArray(i)?i.map(s):s(i)}}const ii=ni();function ti(e,a){const r=this;if(r.vars&&"function"==typeof r.getColorSchemeSelector){const n=r.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)");return{[n]:a}}return r.palette.mode===e?a:{}}ii.filterProps=["sx"];const oi=["breakpoints","palette","spacing","shape"];function si(e={},...a){const{breakpoints:r={},palette:n={},spacing:i,shape:t={}}=e,o=ga(e,oi),s=rn(r),l=function(e=8){if(e.mui)return e;const a=jn({spacing:e}),r=(...e)=>("production"!==process.env.NODE_ENV&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`)),(0===e.length?[1]:e).map((e=>{const r=a(e);return"number"==typeof r?`${r}px`:r})).join(" "));return r.mui=!0,r}(i);let c=Qr({breakpoints:s,direction:"ltr",components:{},palette:ma({mode:"light"},n),spacing:l,shape:ma({},nn,t)},o);return c.applyStyles=ti,c=a.reduce(((e,a)=>Qr(e,a)),c),c.unstable_sxConfig=ma({},ri,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return ii({sx:e,theme:this})},c}var li=Object.freeze({__proto__:null,default:si,private_createBreakpoints:rn,unstable_applyStyles:ti});function ci(e=null){const a=d.useContext(n.ThemeContext);return a&&(r=a,0!==Object.keys(r).length)?a:e;var r}const di=si();const ui=["sx"];var hi=Object.freeze({__proto__:null,default:ii,extendSxProp:function(e){const{sx:a}=e,r=ga(e,ui),{systemProps:n,otherProps:i}=(e=>{var a,r;const n={systemProps:{},otherProps:{}},i=null!=(a=null==e||null==(r=e.theme)?void 0:r.unstable_sxConfig)?a:ri;return Object.keys(e).forEach((a=>{i[a]?n.systemProps[a]=e[a]:n.otherProps[a]=e[a]})),n})(r);let t;return t=Array.isArray(a)?[n,...a]:"function"==typeof a?(...e)=>{const r=a(...e);return Yr(r)?ma({},n,r):n}:ma({},n,a),ma({},i,{sx:t})},unstable_createStyleFunctionSx:ni,unstable_defaultSxConfig:ri});function mi(e){var a,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(a=0;a<i;a++)e[a]&&(r=mi(e[a]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function gi(){for(var e,a,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(a=mi(e))&&(n&&(n+=" "),n+=a);return n}var pi,bi={exports:{}},fi={};var ki,yi={};
|
|
31
|
+
function(e,a){const r=l(e,a);return"production"!==process.env.NODE_ENV?(...a)=>{const n="string"==typeof e?`"${e}"`:"component";return 0===a.length?console.error([`MUI: Seems like you called \`styled(${n})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n")):a.some((e=>void 0===e))&&console.error(`MUI: the styled(${n})(...args) API requires all its args to be defined.`),r(...a)}:r},internal_processStyles:(e,a)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=a(e.__emotion_styles))},keyframes:n.keyframes});function Yr(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function Xr(e){if(d.isValidElement(e)||!Yr(e))return e;const a={};return Object.keys(e).forEach((r=>{a[r]=Xr(e[r])})),a}function Qr(e,a,r={clone:!0}){const n=r.clone?ma({},e):e;return Yr(e)&&Yr(a)&&Object.keys(a).forEach((i=>{d.isValidElement(a[i])?n[i]=a[i]:Yr(a[i])&&Object.prototype.hasOwnProperty.call(e,i)&&Yr(e[i])?n[i]=Qr(e[i],a[i],r):r.clone?n[i]=Yr(a[i])?Xr(a[i]):a[i]:n[i]=a[i]})),n}var en=Object.freeze({__proto__:null,default:Qr,isPlainObject:Yr});const an=["values","unit","step"];function rn(e){const{values:a={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5}=e,i=ga(e,an),t=(e=>{const a=Object.keys(e).map((a=>({key:a,val:e[a]})))||[];return a.sort(((e,a)=>e.val-a.val)),a.reduce(((e,a)=>ma({},e,{[a.key]:a.val})),{})})(a),o=Object.keys(t);function s(e){return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r})`}function l(e){return`@media (max-width:${("number"==typeof a[e]?a[e]:e)-n/100}${r})`}function c(e,i){const t=o.indexOf(i);return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r}) and (max-width:${(-1!==t&&"number"==typeof a[o[t]]?a[o[t]]:i)-n/100}${r})`}return ma({keys:o,values:t,up:s,down:l,between:c,only:function(e){return o.indexOf(e)+1<o.length?c(e,o[o.indexOf(e)+1]):s(e)},not:function(e){const a=o.indexOf(e);return 0===a?s(o[1]):a===o.length-1?l(o[a]):c(e,o[o.indexOf(e)+1]).replace("@media","@media not all and")},unit:r},i)}const nn={borderRadius:4},tn="production"!==process.env.NODE_ENV?La.oneOfType([La.number,La.string,La.object,La.array]):{};function on(e,a){return a?Qr(e,a,{clone:!1}):e}const sn={xs:0,sm:600,md:900,lg:1200,xl:1536},ln={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${sn[e]}px)`};function cn(e,a,r){const n=e.theme||{};if(Array.isArray(a)){const e=n.breakpoints||ln;return a.reduce(((n,i,t)=>(n[e.up(e.keys[t])]=r(a[t]),n)),{})}if("object"==typeof a){const e=n.breakpoints||ln;return Object.keys(a).reduce(((n,i)=>{if(-1!==Object.keys(e.values||sn).indexOf(i)){n[e.up(i)]=r(a[i],i)}else{const e=i;n[e]=a[e]}return n}),{})}return r(a)}function dn(e){if("string"!=typeof e)throw new Error("production"!==process.env.NODE_ENV?"MUI: `capitalize(string)` expects a string argument.":pa(7));return e.charAt(0).toUpperCase()+e.slice(1)}var un=Object.freeze({__proto__:null,default:dn});function hn(e,a,r=!0){if(!a||"string"!=typeof a)return null;if(e&&e.vars&&r){const r=`vars.${a}`.split(".").reduce(((e,a)=>e&&e[a]?e[a]:null),e);if(null!=r)return r}return a.split(".").reduce(((e,a)=>e&&null!=e[a]?e[a]:null),e)}function mn(e,a,r,n=r){let i;return i="function"==typeof e?e(r):Array.isArray(e)?e[r]||n:hn(e,r)||n,a&&(i=a(i,n,e)),i}function gn(e){const{prop:a,cssProperty:r=e.prop,themeKey:n,transform:i}=e,t=e=>{if(null==e[a])return null;const t=e[a],o=hn(e.theme,n)||{};return cn(e,t,(e=>{let n=mn(o,i,e);return e===n&&"string"==typeof e&&(n=mn(o,i,`${a}${"default"===e?"":dn(e)}`,e)),!1===r?n:{[r]:n}}))};return t.propTypes="production"!==process.env.NODE_ENV?{[a]:tn}:{},t.filterProps=[a],t}const pn={m:"margin",p:"padding"},bn={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},fn={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},kn=function(e){const a={};return r=>(void 0===a[r]&&(a[r]=e(r)),a[r])}((e=>{if(e.length>2){if(!fn[e])return[e];e=fn[e]}const[a,r]=e.split(""),n=pn[a],i=bn[r]||"";return Array.isArray(i)?i.map((e=>n+e)):[n+i]})),yn=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],vn=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],wn=[...yn,...vn];function zn(e,a,r,n){var i;const t=null!=(i=hn(e,a,!1))?i:r;return"number"==typeof t?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&"number"!=typeof e&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${e}.`),t*e):Array.isArray(t)?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&(Number.isInteger(e)?e>t.length-1&&console.error([`MUI: The value provided (${e}) overflows.`,`The supported values are: ${JSON.stringify(t)}.`,`${e} > ${t.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${a}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${a}\` as a number.`].join("\n"))),t[e]):"function"==typeof t?t:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${a}\` value (${t}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function jn(e){return zn(e,"spacing",8,"spacing")}function xn(e,a){if("string"==typeof a||null==a)return a;const r=e(Math.abs(a));return a>=0?r:"number"==typeof r?-r:`-${r}`}function $n(e,a,r,n){if(-1===a.indexOf(r))return null;const i=function(e,a){return r=>e.reduce(((e,n)=>(e[n]=xn(a,r),e)),{})}(kn(r),n);return cn(e,e[r],i)}function qn(e,a){const r=jn(e.theme);return Object.keys(e).map((n=>$n(e,a,n,r))).reduce(on,{})}function Cn(e){return qn(e,yn)}function Sn(e){return qn(e,vn)}function On(...e){const a=e.reduce(((e,a)=>(a.filterProps.forEach((r=>{e[r]=a})),e)),{}),r=e=>Object.keys(e).reduce(((r,n)=>a[n]?on(r,a[n](e)):r),{});return r.propTypes="production"!==process.env.NODE_ENV?e.reduce(((e,a)=>Object.assign(e,a.propTypes)),{}):{},r.filterProps=e.reduce(((e,a)=>e.concat(a.filterProps)),[]),r}function En(e){return"number"!=typeof e?e:`${e}px solid`}function Mn(e,a){return gn({prop:e,themeKey:"borders",transform:a})}Cn.propTypes="production"!==process.env.NODE_ENV?yn.reduce(((e,a)=>(e[a]=tn,e)),{}):{},Cn.filterProps=yn,Sn.propTypes="production"!==process.env.NODE_ENV?vn.reduce(((e,a)=>(e[a]=tn,e)),{}):{},Sn.filterProps=vn,"production"===process.env.NODE_ENV||wn.reduce(((e,a)=>(e[a]=tn,e)),{});const _n=Mn("border",En),An=Mn("borderTop",En),Dn=Mn("borderRight",En),Tn=Mn("borderBottom",En),Nn=Mn("borderLeft",En),In=Mn("borderColor"),Fn=Mn("borderTopColor"),Pn=Mn("borderRightColor"),Rn=Mn("borderBottomColor"),Ln=Mn("borderLeftColor"),Bn=Mn("outline",En),Vn=Mn("outlineColor"),Hn=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const a=zn(e.theme,"shape.borderRadius",4,"borderRadius"),r=e=>({borderRadius:xn(a,e)});return cn(e,e.borderRadius,r)}return null};Hn.propTypes="production"!==process.env.NODE_ENV?{borderRadius:tn}:{},Hn.filterProps=["borderRadius"],On(_n,An,Dn,Tn,Nn,In,Fn,Pn,Rn,Ln,Hn,Bn,Vn);const Wn=e=>{if(void 0!==e.gap&&null!==e.gap){const a=zn(e.theme,"spacing",8,"gap"),r=e=>({gap:xn(a,e)});return cn(e,e.gap,r)}return null};Wn.propTypes="production"!==process.env.NODE_ENV?{gap:tn}:{},Wn.filterProps=["gap"];const Un=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const a=zn(e.theme,"spacing",8,"columnGap"),r=e=>({columnGap:xn(a,e)});return cn(e,e.columnGap,r)}return null};Un.propTypes="production"!==process.env.NODE_ENV?{columnGap:tn}:{},Un.filterProps=["columnGap"];const Gn=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const a=zn(e.theme,"spacing",8,"rowGap"),r=e=>({rowGap:xn(a,e)});return cn(e,e.rowGap,r)}return null};Gn.propTypes="production"!==process.env.NODE_ENV?{rowGap:tn}:{},Gn.filterProps=["rowGap"];function Kn(e,a){return"grey"===a?a:e}On(Wn,Un,Gn,gn({prop:"gridColumn"}),gn({prop:"gridRow"}),gn({prop:"gridAutoFlow"}),gn({prop:"gridAutoColumns"}),gn({prop:"gridAutoRows"}),gn({prop:"gridTemplateColumns"}),gn({prop:"gridTemplateRows"}),gn({prop:"gridTemplateAreas"}),gn({prop:"gridArea"}));function Zn(e){return e<=1&&0!==e?100*e+"%":e}On(gn({prop:"color",themeKey:"palette",transform:Kn}),gn({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Kn}),gn({prop:"backgroundColor",themeKey:"palette",transform:Kn}));const Jn=gn({prop:"width",transform:Zn}),Yn=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const a=a=>{var r,n;const i=(null==(r=e.theme)||null==(r=r.breakpoints)||null==(r=r.values)?void 0:r[a])||sn[a];return i?"px"!==(null==(n=e.theme)||null==(n=n.breakpoints)?void 0:n.unit)?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Zn(a)}};return cn(e,e.maxWidth,a)}return null};Yn.filterProps=["maxWidth"];const Xn=gn({prop:"minWidth",transform:Zn}),Qn=gn({prop:"height",transform:Zn}),ei=gn({prop:"maxHeight",transform:Zn}),ai=gn({prop:"minHeight",transform:Zn});gn({prop:"size",cssProperty:"width",transform:Zn}),gn({prop:"size",cssProperty:"height",transform:Zn});On(Jn,Yn,Xn,Qn,ei,ai,gn({prop:"boxSizing"}));const ri={border:{themeKey:"borders",transform:En},borderTop:{themeKey:"borders",transform:En},borderRight:{themeKey:"borders",transform:En},borderBottom:{themeKey:"borders",transform:En},borderLeft:{themeKey:"borders",transform:En},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:En},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Hn},color:{themeKey:"palette",transform:Kn},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Kn},backgroundColor:{themeKey:"palette",transform:Kn},p:{style:Sn},pt:{style:Sn},pr:{style:Sn},pb:{style:Sn},pl:{style:Sn},px:{style:Sn},py:{style:Sn},padding:{style:Sn},paddingTop:{style:Sn},paddingRight:{style:Sn},paddingBottom:{style:Sn},paddingLeft:{style:Sn},paddingX:{style:Sn},paddingY:{style:Sn},paddingInline:{style:Sn},paddingInlineStart:{style:Sn},paddingInlineEnd:{style:Sn},paddingBlock:{style:Sn},paddingBlockStart:{style:Sn},paddingBlockEnd:{style:Sn},m:{style:Cn},mt:{style:Cn},mr:{style:Cn},mb:{style:Cn},ml:{style:Cn},mx:{style:Cn},my:{style:Cn},margin:{style:Cn},marginTop:{style:Cn},marginRight:{style:Cn},marginBottom:{style:Cn},marginLeft:{style:Cn},marginX:{style:Cn},marginY:{style:Cn},marginInline:{style:Cn},marginInlineStart:{style:Cn},marginInlineEnd:{style:Cn},marginBlock:{style:Cn},marginBlockStart:{style:Cn},marginBlockEnd:{style:Cn},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Wn},rowGap:{style:Gn},columnGap:{style:Un},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Zn},maxWidth:{style:Yn},minWidth:{transform:Zn},height:{transform:Zn},maxHeight:{transform:Zn},minHeight:{transform:Zn},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function ni(){function e(e,a,r,n){const i={[e]:a,theme:r},t=n[e];if(!t)return{[e]:a};const{cssProperty:o=e,themeKey:s,transform:l,style:c}=t;if(null==a)return null;if("typography"===s&&"inherit"===a)return{[e]:a};const d=hn(r,s)||{};if(c)return c(i);return cn(i,a,(a=>{let r=mn(d,l,a);return a===r&&"string"==typeof a&&(r=mn(d,l,`${e}${"default"===a?"":dn(a)}`,a)),!1===o?r:{[o]:r}}))}return function a(r){var n;const{sx:i,theme:t={}}=r||{};if(!i)return null;const o=null!=(n=t.unstable_sxConfig)?n:ri;function s(r){let n=r;if("function"==typeof r)n=r(t);else if("object"!=typeof r)return r;if(!n)return null;const i=function(e={}){var a;return(null==(a=e.keys)?void 0:a.reduce(((a,r)=>(a[e.up(r)]={},a)),{}))||{}}(t.breakpoints),s=Object.keys(i);let l=i;return Object.keys(n).forEach((r=>{const i=(s=n[r],c=t,"function"==typeof s?s(c):s);var s,c;if(null!=i)if("object"==typeof i)if(o[r])l=on(l,e(r,i,t,o));else{const e=cn({theme:t},i,(e=>({[r]:e})));!function(...e){const a=e.reduce(((e,a)=>e.concat(Object.keys(a))),[]),r=new Set(a);return e.every((e=>r.size===Object.keys(e).length))}(e,i)?l=on(l,e):l[r]=a({sx:i,theme:t})}else l=on(l,e(r,i,t,o))})),function(e,a){return e.reduce(((e,a)=>{const r=e[a];return(!r||0===Object.keys(r).length)&&delete e[a],e}),a)}(s,l)}return Array.isArray(i)?i.map(s):s(i)}}const ii=ni();function ti(e,a){const r=this;if(r.vars&&"function"==typeof r.getColorSchemeSelector){const n=r.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)");return{[n]:a}}return r.palette.mode===e?a:{}}ii.filterProps=["sx"];const oi=["breakpoints","palette","spacing","shape"];function si(e={},...a){const{breakpoints:r={},palette:n={},spacing:i,shape:t={}}=e,o=ga(e,oi),s=rn(r),l=function(e=8){if(e.mui)return e;const a=jn({spacing:e}),r=(...e)=>("production"!==process.env.NODE_ENV&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`)),(0===e.length?[1]:e).map((e=>{const r=a(e);return"number"==typeof r?`${r}px`:r})).join(" "));return r.mui=!0,r}(i);let c=Qr({breakpoints:s,direction:"ltr",components:{},palette:ma({mode:"light"},n),spacing:l,shape:ma({},nn,t)},o);return c.applyStyles=ti,c=a.reduce(((e,a)=>Qr(e,a)),c),c.unstable_sxConfig=ma({},ri,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return ii({sx:e,theme:this})},c}var li=Object.freeze({__proto__:null,default:si,private_createBreakpoints:rn,unstable_applyStyles:ti});function ci(e=null){const a=d.useContext(n.ThemeContext);return a&&(r=a,0!==Object.keys(r).length)?a:e;var r}const di=si();const ui=["sx"];var hi=Object.freeze({__proto__:null,default:ii,extendSxProp:function(e){const{sx:a}=e,r=ga(e,ui),{systemProps:n,otherProps:i}=(e=>{var a,r;const n={systemProps:{},otherProps:{}},i=null!=(a=null==e||null==(r=e.theme)?void 0:r.unstable_sxConfig)?a:ri;return Object.keys(e).forEach((a=>{i[a]?n.systemProps[a]=e[a]:n.otherProps[a]=e[a]})),n})(r);let t;return t=Array.isArray(a)?[n,...a]:"function"==typeof a?(...e)=>{const r=a(...e);return Yr(r)?ma({},n,r):n}:ma({},n,a),ma({},i,{sx:t})},unstable_createStyleFunctionSx:ni,unstable_defaultSxConfig:ri});function mi(e){var a,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(a=0;a<i;a++)e[a]&&(r=mi(e[a]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function gi(){for(var e,a,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(a=mi(e))&&(n&&(n+=" "),n+=a);return n}var pi,bi={exports:{}},fi={};var ki,yi={};
|
|
32
32
|
/**
|
|
33
33
|
* @license React
|
|
34
34
|
* react-is.development.js
|
|
35
35
|
*
|
|
36
|
-
* Copyright (c)
|
|
36
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
37
37
|
*
|
|
38
38
|
* This source code is licensed under the MIT license found in the
|
|
39
39
|
* LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/"production"===process.env.NODE_ENV?bi.exports=function(){if(pi)return fi;pi=1;var e,a=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),t=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen");function p(e){if("object"==typeof e&&null!==e){var g=e.$$typeof;switch(g){case a:switch(e=e.type){case n:case t:case i:case d:case u:return e;default:switch(e=e&&e.$$typeof){case l:case s:case c:case m:case h:case o:return e;default:return g}}case r:return g}}}return e=Symbol.for("react.module.reference"),fi.ContextConsumer=s,fi.ContextProvider=o,fi.Element=a,fi.ForwardRef=c,fi.Fragment=n,fi.Lazy=m,fi.Memo=h,fi.Portal=r,fi.Profiler=t,fi.StrictMode=i,fi.Suspense=d,fi.SuspenseList=u,fi.isAsyncMode=function(){return!1},fi.isConcurrentMode=function(){return!1},fi.isContextConsumer=function(e){return p(e)===s},fi.isContextProvider=function(e){return p(e)===o},fi.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},fi.isForwardRef=function(e){return p(e)===c},fi.isFragment=function(e){return p(e)===n},fi.isLazy=function(e){return p(e)===m},fi.isMemo=function(e){return p(e)===h},fi.isPortal=function(e){return p(e)===r},fi.isProfiler=function(e){return p(e)===t},fi.isStrictMode=function(e){return p(e)===i},fi.isSuspense=function(e){return p(e)===d},fi.isSuspenseList=function(e){return p(e)===u},fi.isValidElementType=function(a){return"string"==typeof a||"function"==typeof a||a===n||a===t||a===i||a===d||a===u||a===g||"object"==typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===h||a.$$typeof===o||a.$$typeof===s||a.$$typeof===c||a.$$typeof===e||void 0!==a.getModuleId)},fi.typeOf=p,fi}():bi.exports=(ki||(ki=1,"production"!==process.env.NODE_ENV&&function(){var e,a=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),t=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen");function p(e){if("object"==typeof e&&null!==e){var g=e.$$typeof;switch(g){case a:var p=e.type;switch(p){case n:case t:case i:case d:case u:return p;default:var b=p&&p.$$typeof;switch(b){case l:case s:case c:case m:case h:case o:return b;default:return g}}case r:return g}}}e=Symbol.for("react.module.reference");var b=s,f=o,k=a,y=c,v=n,w=m,z=h,j=r,x=t,$=i,q=d,C=u,S=!1,O=!1;yi.ContextConsumer=b,yi.ContextProvider=f,yi.Element=k,yi.ForwardRef=y,yi.Fragment=v,yi.Lazy=w,yi.Memo=z,yi.Portal=j,yi.Profiler=x,yi.StrictMode=$,yi.Suspense=q,yi.SuspenseList=C,yi.isAsyncMode=function(e){return S||(S=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},yi.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},yi.isContextConsumer=function(e){return p(e)===s},yi.isContextProvider=function(e){return p(e)===o},yi.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},yi.isForwardRef=function(e){return p(e)===c},yi.isFragment=function(e){return p(e)===n},yi.isLazy=function(e){return p(e)===m},yi.isMemo=function(e){return p(e)===h},yi.isPortal=function(e){return p(e)===r},yi.isProfiler=function(e){return p(e)===t},yi.isStrictMode=function(e){return p(e)===i},yi.isSuspense=function(e){return p(e)===d},yi.isSuspenseList=function(e){return p(e)===u},yi.isValidElementType=function(a){return"string"==typeof a||"function"==typeof a||a===n||a===t||a===i||a===d||a===u||a===g||"object"==typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===h||a.$$typeof===o||a.$$typeof===s||a.$$typeof===c||a.$$typeof===e||void 0!==a.getModuleId)},yi.typeOf=p}()),yi);var vi=bi.exports;const wi=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function zi(e){const a=`${e}`.match(wi);return a&&a[1]||""}function ji(e,a=""){return e.displayName||e.name||zi(e)||a}function xi(e,a,r){const n=ji(a);return e.displayName||(""!==n?`${r}(${n})`:r)}var $i=Object.freeze({__proto__:null,default:function(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return ji(e,"Component");if("object"==typeof e)switch(e.$$typeof){case vi.ForwardRef:return xi(e,e.render,"ForwardRef");case vi.Memo:return xi(e,e.type,"memo");default:return}}},getFunctionName:zi});function qi(e,a){const r=ma({},a);return Object.keys(e).forEach((n=>{if(n.toString().match(/^(components|slots)$/))r[n]=ma({},e[n],r[n]);else if(n.toString().match(/^(componentsProps|slotProps)$/)){const i=e[n]||{},t=a[n];r[n]={},t&&Object.keys(t)?i&&Object.keys(i)?(r[n]=ma({},t),Object.keys(i).forEach((e=>{r[n][e]=qi(i[e],t[e])}))):r[n]=t:r[n]=i}else void 0===r[n]&&(r[n]=e[n])})),r}const Ci="undefined"!=typeof window?d.useLayoutEffect:d.useEffect;function Si(e,a,r,n,i){const[t,o]=d.useState((()=>i&&r?r(e).matches:n?n(e).matches:a));return Ci((()=>{let a=!0;if(!r)return;const n=r(e),i=()=>{a&&o(n.matches)};return i(),n.addListener(i),()=>{a=!1,n.removeListener(i)}}),[e,r]),t}const Oi=d.useSyncExternalStore;function Ei(e,a,r,n,i){const t=d.useCallback((()=>a),[a]),o=d.useMemo((()=>{if(i&&r)return()=>r(e).matches;if(null!==n){const{matches:a}=n(e);return()=>a}return t}),[t,e,n,i,r]),[s,l]=d.useMemo((()=>{if(null===r)return[t,()=>()=>{}];const a=r(e);return[()=>a.matches,e=>(a.addListener(e),()=>{a.removeListener(e)})]}),[t,r,e]);return Oi(l,s,o)}function Mi(e,a={}){const r=ci(),n="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:i=!1,matchMedia:t=(n?window.matchMedia:null),ssrMatchMedia:o=null,noSsr:s=!1}=function(e){const{theme:a,name:r,props:n}=e;return a&&a.components&&a.components[r]&&a.components[r].defaultProps?qi(a.components[r].defaultProps,n):n}({name:"MuiUseMediaQuery",props:a,theme:r});"production"!==process.env.NODE_ENV&&"function"==typeof e&&null===r&&console.error(["MUI: The `query` argument provided is invalid.","You are providing a function without a theme in the context.","One of the parent elements needs to use a ThemeProvider."].join("\n"));let l="function"==typeof e?e(r):e;l=l.replace(/^@media( ?)/m,"");const c=(void 0!==Oi?Ei:Si)(l,i,t,o,s);return"production"!==process.env.NODE_ENV&&d.useDebugValue({query:l,match:c}),c}var _i=Object.freeze({__proto__:null,default:function(e,a=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(a,Math.min(e,r))}});const Ai="exact-prop: ";const Di=d.createContext(null);function Ti(){const e=d.useContext(Di);return"production"!==process.env.NODE_ENV&&d.useDebugValue(e),e}"production"!==process.env.NODE_ENV&&(Di.displayName="ThemeContext");var Ni="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";function Ii(e){const{children:a,theme:r}=e,n=Ti();"production"!==process.env.NODE_ENV&&null===n&&"function"==typeof r&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const i=d.useMemo((()=>{const e=null===n?r:function(e,a){if("function"==typeof a){const r=a(e);return"production"!==process.env.NODE_ENV&&(r||console.error(["MUI: You should return an object from your theme function, i.e.","<ThemeProvider theme={() => ({})} />"].join("\n"))),r}return ma({},e,a)}(n,r);return null!=e&&(e[Ni]=null!==n),e}),[r,n]);return k.jsx(Di.Provider,{value:i,children:a})}"production"!==process.env.NODE_ENV&&(Ii.propTypes={children:La.node,theme:La.oneOfType([La.object,La.func]).isRequired}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Ii.propTypes=function(e){return"production"===process.env.NODE_ENV?e:ma({},e,{[Ai]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Ii.propTypes));const Fi="exact-prop: ";const Pi=["value"],Ri=d.createContext();function Li(e){let{value:a}=e,r=ga(e,Pi);return k.jsx(Ri.Provider,ma({value:null==a||a},r))}"production"!==process.env.NODE_ENV&&(Li.propTypes={children:La.node,value:La.bool});const Bi=d.createContext(void 0);function Vi({value:e,children:a}){return k.jsx(Bi.Provider,{value:e,children:a})}function Hi({props:e,name:a}){return function(e){const{theme:a,name:r,props:n}=e;if(!a||!a.components||!a.components[r])return n;const i=a.components[r];return i.defaultProps?qi(i.defaultProps,n):i.styleOverrides||i.variants?n:qi(i,n)}({props:e,name:a,theme:{components:d.useContext(Bi)}})}"production"!==process.env.NODE_ENV&&(Vi.propTypes={children:La.node,value:La.object});const Wi={};function Ui(e,a,r,n=!1){return d.useMemo((()=>{const i=e&&a[e]||a;if("function"==typeof r){const t=r(i),o=e?ma({},a,{[e]:t}):t;return n?()=>o:o}return ma({},a,e?{[e]:r}:r)}),[e,a,r,n])}function Gi(e){const{children:a,theme:r,themeId:i}=e,t=ci(Wi),o=Ti()||Wi;"production"!==process.env.NODE_ENV&&(null===t&&"function"==typeof r||i&&t&&!t[i]&&"function"==typeof r)&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const s=Ui(i,t,r),l=Ui(i,o,r,!0),c="rtl"===s.direction;return k.jsx(Ii,{theme:l,children:k.jsx(n.ThemeContext.Provider,{value:s,children:k.jsx(Li,{value:c,children:k.jsx(Vi,{value:null==s?void 0:s.components,children:a})})})})}function Ki(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function Zi(e){if(!Ki(e))return e;const a={};return Object.keys(e).forEach((r=>{a[r]=Zi(e[r])})),a}function Ji(e,a,r={clone:!0}){const n=r.clone?ma({},e):e;return Ki(e)&&Ki(a)&&Object.keys(a).forEach((i=>{Ki(a[i])&&Object.prototype.hasOwnProperty.call(e,i)&&Ki(e[i])?n[i]=Ji(e[i],a[i],r):r.clone?n[i]=Ki(a[i])?Zi(a[i]):a[i]:n[i]=a[i]})),n}"production"!==process.env.NODE_ENV&&(Gi.propTypes={children:La.node,theme:La.oneOfType([La.func,La.object]).isRequired,themeId:La.string}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Gi.propTypes=function(e){return"production"===process.env.NODE_ENV?e:ma({},e,{[Fi]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Gi.propTypes));const Yi=e=>e,Xi=(()=>{let e=Yi;return{configure(a){e=a},generate:a=>e(a),reset(){e=Yi}}})(),Qi={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function et(e,a,r="Mui"){const n=Qi[a];return n?`${r}-${n}`:`${Xi.generate(e)}-${a}`}function at(e,a){return ma({toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}}},a)}var rt,nt={},it={exports:{}};(rt=it).exports=function(e){return e&&e.__esModule?e:{default:e}},rt.exports.__esModule=!0,rt.exports.default=rt.exports;var tt=it.exports,ot=h(fa),st=h(_i),lt=tt;Object.defineProperty(nt,"__esModule",{value:!0}),nt.alpha=wt,nt.blend=function(e,a,r,n=1){const i=(e,a)=>Math.round((e**(1/n)*(1-r)+a**(1/n)*r)**n),t=bt(e),o=bt(a),s=[i(t.values[0],o.values[0]),i(t.values[1],o.values[1]),i(t.values[2],o.values[2])];return kt({type:"rgb",values:s})},nt.colorChannel=void 0;var ct=nt.darken=zt;nt.decomposeColor=bt,nt.emphasize=xt;var dt=nt.getContrastRatio=function(e,a){const r=vt(e),n=vt(a);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)};nt.getLuminance=vt,nt.hexToRgb=pt,nt.hslToRgb=yt;var ut=nt.lighten=jt;nt.private_safeAlpha=function(e,a,r){try{return wt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.private_safeColorChannel=void 0,nt.private_safeDarken=function(e,a,r){try{return zt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.private_safeEmphasize=function(e,a,r){try{return xt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.private_safeLighten=function(e,a,r){try{return jt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.recomposeColor=kt,nt.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:a}=bt(e);return`#${a.map(((e,a)=>function(e){const a=e.toString(16);return 1===a.length?`0${a}`:a}(3===a?Math.round(255*e):e))).join("")}`};var ht=lt(ot),mt=lt(st);function gt(e,a=0,r=1){return"production"!==process.env.NODE_ENV&&(e<a||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${a}, ${r}].`),(0,mt.default)(e,a,r)}function pt(e){e=e.slice(1);const a=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(a);return r&&1===r[0].length&&(r=r.map((e=>e+e))),r?`rgb${4===r.length?"a":""}(${r.map(((e,a)=>a<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}function bt(e){if(e.type)return e;if("#"===e.charAt(0))return bt(pt(e));const a=e.indexOf("("),r=e.substring(0,a);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(r))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,ht.default)(9,e));let n,i=e.substring(a+1,e.length-1);if("color"===r){if(i=i.split(" "),n=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,ht.default)(10,n))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:r,values:i,colorSpace:n}}const ft=e=>{const a=bt(e);return a.values.slice(0,3).map(((e,r)=>-1!==a.type.indexOf("hsl")&&0!==r?`${e}%`:e)).join(" ")};nt.colorChannel=ft;function kt(e){const{type:a,colorSpace:r}=e;let{values:n}=e;return-1!==a.indexOf("rgb")?n=n.map(((e,a)=>a<3?parseInt(e,10):e)):-1!==a.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==a.indexOf("color")?`${r} ${n.join(" ")}`:`${n.join(", ")}`,`${a}(${n})`}function yt(e){e=bt(e);const{values:a}=e,r=a[0],n=a[1]/100,i=a[2]/100,t=n*Math.min(i,1-i),o=(e,a=(e+r/30)%12)=>i-t*Math.max(Math.min(a-3,9-a,1),-1);let s="rgb";const l=[Math.round(255*o(0)),Math.round(255*o(8)),Math.round(255*o(4))];return"hsla"===e.type&&(s+="a",l.push(a[3])),kt({type:s,values:l})}function vt(e){let a="hsl"===(e=bt(e)).type||"hsla"===e.type?bt(yt(e)).values:e.values;return a=a.map((a=>("color"!==e.type&&(a/=255),a<=.03928?a/12.92:((a+.055)/1.055)**2.4))),Number((.2126*a[0]+.7152*a[1]+.0722*a[2]).toFixed(3))}function wt(e,a){return e=bt(e),a=gt(a),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${a}`:e.values[3]=a,kt(e)}function zt(e,a){if(e=bt(e),a=gt(a),-1!==e.type.indexOf("hsl"))e.values[2]*=1-a;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-a;return kt(e)}function jt(e,a){if(e=bt(e),a=gt(a),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*a;else if(-1!==e.type.indexOf("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*a;else if(-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*a;return kt(e)}function xt(e,a=.15){return vt(e)>.5?zt(e,a):jt(e,a)}nt.private_safeColorChannel=(e,a)=>{try{return ft(e)}catch(r){return a&&"production"!==process.env.NODE_ENV&&console.warn(a),e}};const $t={black:"#000",white:"#fff"},qt={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ct="#f3e5f5",St="#ce93d8",Ot="#ba68c8",Et="#ab47bc",Mt="#9c27b0",_t="#7b1fa2",At="#e57373",Dt="#ef5350",Tt="#f44336",Nt="#d32f2f",It="#c62828",Ft="#ffb74d",Pt="#ffa726",Rt="#ff9800",Lt="#f57c00",Bt="#e65100",Vt="#e3f2fd",Ht="#90caf9",Wt="#42a5f5",Ut="#1976d2",Gt="#1565c0",Kt="#4fc3f7",Zt="#29b6f6",Jt="#03a9f4",Yt="#0288d1",Xt="#01579b",Qt="#81c784",eo="#66bb6a",ao="#4caf50",ro="#388e3c",no="#2e7d32",io="#1b5e20",to=["mode","contrastThreshold","tonalOffset"],oo={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:$t.white,default:$t.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},so={text:{primary:$t.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:$t.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function lo(e,a,r,n){const i=n.light||n,t=n.dark||1.5*n;e[a]||(e.hasOwnProperty(r)?e[a]=e[r]:"light"===a?e.light=ut(e.main,i):"dark"===a&&(e.dark=ct(e.main,t)))}function co(e){const{mode:a="light",contrastThreshold:r=3,tonalOffset:n=.2}=e,i=ga(e,to),t=e.primary||function(e="light"){return"dark"===e?{main:Ht,light:Vt,dark:Wt}:{main:Ut,light:Wt,dark:Gt}}(a),o=e.secondary||function(e="light"){return"dark"===e?{main:St,light:Ct,dark:Et}:{main:Mt,light:Ot,dark:_t}}(a),s=e.error||function(e="light"){return"dark"===e?{main:Tt,light:At,dark:Nt}:{main:Nt,light:Dt,dark:It}}(a),l=e.info||function(e="light"){return"dark"===e?{main:Zt,light:Kt,dark:Yt}:{main:Yt,light:Jt,dark:Xt}}(a),c=e.success||function(e="light"){return"dark"===e?{main:eo,light:Qt,dark:ro}:{main:no,light:ao,dark:io}}(a),d=e.warning||function(e="light"){return"dark"===e?{main:Pt,light:Ft,dark:Lt}:{main:"#ed6c02",light:Rt,dark:Bt}}(a);function u(e){const a=dt(e,so.text.primary)>=r?so.text.primary:oo.text.primary;if("production"!==process.env.NODE_ENV){const r=dt(e,a);r<3&&console.error([`MUI: The contrast ratio of ${r}:1 for ${a} on ${e}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join("\n"))}return a}const h=({color:e,name:a,mainShade:r=500,lightShade:i=300,darkShade:t=700})=>{if(!(e=ma({},e)).main&&e[r]&&(e.main=e[r]),!e.hasOwnProperty("main"))throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\nThe color object needs to have a \`main\` property or a \`${r}\` property.`:ua(11,a?` (${a})`:"",r));if("string"!=typeof e.main)throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\n\`color.main\` should be a string, but \`${JSON.stringify(e.main)}\` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from "@mui/material/colors";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });`:ua(12,a?` (${a})`:"",JSON.stringify(e.main)));return lo(e,"light",i,n),lo(e,"dark",t,n),e.contrastText||(e.contrastText=u(e.main)),e},m={dark:so,light:oo};"production"!==process.env.NODE_ENV&&(m[a]||console.error(`MUI: The palette mode \`${a}\` is not supported.`));return Ji(ma({common:ma({},$t),mode:a,primary:h({color:t,name:"primary"}),secondary:h({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:s,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:l,name:"info"}),success:h({color:c,name:"success"}),grey:qt,contrastThreshold:r,getContrastText:u,augmentColor:h,tonalOffset:n},m[a]),i)}const uo=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];const ho={textTransform:"uppercase"},mo='"Roboto", "Helvetica", "Arial", sans-serif';function go(e,a){const r="function"==typeof a?a(e):a,{fontFamily:n=mo,fontSize:i=14,fontWeightLight:t=300,fontWeightRegular:o=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:d,pxToRem:u}=r,h=ga(r,uo);"production"!==process.env.NODE_ENV&&("number"!=typeof i&&console.error("MUI: `fontSize` is required to be a number."),"number"!=typeof c&&console.error("MUI: `htmlFontSize` is required to be a number."));const m=i/14,g=u||(e=>e/c*m+"rem"),p=(e,a,r,i,t)=>{return ma({fontFamily:n,fontWeight:e,fontSize:g(a),lineHeight:r},n===mo?{letterSpacing:(o=i/a,Math.round(1e5*o)/1e5)+"em"}:{},t,d);var o},b={h1:p(t,96,1.167,-1.5),h2:p(t,60,1.2,-.5),h3:p(o,48,1.167,0),h4:p(o,34,1.235,.25),h5:p(o,24,1.334,0),h6:p(s,20,1.6,.15),subtitle1:p(o,16,1.75,.15),subtitle2:p(s,14,1.57,.1),body1:p(o,16,1.5,.15),body2:p(o,14,1.43,.15),button:p(s,14,1.75,.4,ho),caption:p(o,12,1.66,.4),overline:p(o,12,2.66,1,ho),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Ji(ma({htmlFontSize:c,pxToRem:g,fontFamily:n,fontSize:i,fontWeightLight:t,fontWeightRegular:o,fontWeightMedium:s,fontWeightBold:l},b),h,{clone:!1})}function po(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const bo=["none",po(0,2,1,-1,0,1,1,0,0,1,3,0),po(0,3,1,-2,0,2,2,0,0,1,5,0),po(0,3,3,-2,0,3,4,0,0,1,8,0),po(0,2,4,-1,0,4,5,0,0,1,10,0),po(0,3,5,-1,0,5,8,0,0,1,14,0),po(0,3,5,-1,0,6,10,0,0,1,18,0),po(0,4,5,-2,0,7,10,1,0,2,16,1),po(0,5,5,-3,0,8,10,1,0,3,14,2),po(0,5,6,-3,0,9,12,1,0,3,16,2),po(0,6,6,-3,0,10,14,1,0,4,18,3),po(0,6,7,-4,0,11,15,1,0,4,20,3),po(0,7,8,-4,0,12,17,2,0,5,22,4),po(0,7,8,-4,0,13,19,2,0,5,24,4),po(0,7,9,-4,0,14,21,2,0,5,26,4),po(0,8,9,-5,0,15,22,2,0,6,28,5),po(0,8,10,-5,0,16,24,2,0,6,30,5),po(0,8,11,-5,0,17,26,2,0,6,32,5),po(0,9,11,-5,0,18,28,2,0,7,34,6),po(0,9,12,-6,0,19,29,2,0,7,36,6),po(0,10,13,-6,0,20,31,3,0,8,38,7),po(0,10,13,-6,0,21,33,3,0,8,40,7),po(0,10,14,-6,0,22,35,3,0,8,42,7),po(0,11,14,-7,0,23,36,3,0,9,44,8),po(0,11,15,-7,0,24,38,3,0,9,46,8)],fo=["duration","easing","delay"],ko={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},yo={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function vo(e){return`${Math.round(e)}ms`}function wo(e){if(!e)return 0;const a=e/36;return Math.round(10*(4+15*a**.25+a/5))}function zo(e){const a=ma({},ko,e.easing),r=ma({},yo,e.duration);return ma({getAutoHeightDuration:wo,create:(e=["all"],n={})=>{const{duration:i=r.standard,easing:t=a.easeInOut,delay:o=0}=n,s=ga(n,fo);if("production"!==process.env.NODE_ENV){const a=e=>"string"==typeof e,r=e=>!isNaN(parseFloat(e));a(e)||Array.isArray(e)||console.error('MUI: Argument "props" must be a string or Array.'),r(i)||a(i)||console.error(`MUI: Argument "duration" must be a number or a string but found ${i}.`),a(t)||console.error('MUI: Argument "easing" must be a string.'),r(o)||a(o)||console.error('MUI: Argument "delay" must be a number or a string.'),"object"!=typeof n&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join("\n")),0!==Object.keys(s).length&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(s).join(",")}].`)}return(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof i?i:vo(i)} ${t} ${"string"==typeof o?o:vo(o)}`)).join(",")}},e,{easing:a,duration:r})}const jo={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},xo=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];const $o=function(e={},...a){const{mixins:r={},palette:n={},transitions:i={},typography:t={}}=e,o=ga(e,xo);if(e.vars)throw new Error("production"!==process.env.NODE_ENV?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":ua(18));const s=co(n),l=si(e);let c=Ji(l,{mixins:at(l.breakpoints,r),palette:s,shadows:bo.slice(),typography:go(s,t),transitions:zo(i),zIndex:ma({},jo)});if(c=Ji(c,o),c=a.reduce(((e,a)=>Ji(e,a)),c),"production"!==process.env.NODE_ENV){const e=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],a=(a,r)=>{let n;for(n in a){const i=a[n];if(-1!==e.indexOf(n)&&Object.keys(i).length>0){if("production"!==process.env.NODE_ENV){const e=et("",n);console.error([`MUI: The \`${r}\` component increases the CSS specificity of the \`${n}\` internal state.`,"You can not override it like this: ",JSON.stringify(a,null,2),"",`Instead, you need to use the '&.${e}' syntax:`,JSON.stringify({root:{[`&.${e}`]:i}},null,2),"","https://mui.com/r/state-classes-guide"].join("\n"))}a[n]={}}}};Object.keys(c.components).forEach((e=>{const r=c.components[e].styleOverrides;r&&0===e.indexOf("Mui")&&a(r,e)}))}return c.unstable_sxConfig=ma({},ri,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return ii({sx:e,theme:this})},c}();function qo(){const e=function(e=di){return ci(e)}($o);return"production"!==process.env.NODE_ENV&&d.useDebugValue(e),e[ha]||e}var Co,So={},Oo={exports:{}};var Eo,Mo={exports:{}};var _o=h(Jr),Ao=h(en),Do=h(un),To=h($i),No=h(li),Io=h(hi),Fo=tt;Object.defineProperty(So,"__esModule",{value:!0});var Po=So.default=function(e={}){const{themeId:a,defaultTheme:r=Qo,rootShouldForwardProp:n=Xo,slotShouldForwardProp:i=Xo}=e,t=e=>(0,Go.default)((0,Ro.default)({},e,{theme:as((0,Ro.default)({},e,{defaultTheme:r,themeId:a}))}));return t.__mui_systemSx=!0,(e,o={})=>{(0,Bo.internal_processStyles)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:s,slot:l,skipVariantsResolver:c,skipSx:d,overridesResolver:u=rs(es(l))}=o,h=(0,Lo.default)(o,Jo),m=void 0!==c?c:l&&"Root"!==l&&"root"!==l||!1,g=d||!1;let p;"production"!==process.env.NODE_ENV&&s&&(p=`${s}-${es(l||"Root")}`);let b=Xo;"Root"===l||"root"===l?b=n:l?b=i:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(b=void 0);const f=(0,Bo.default)(e,(0,Ro.default)({shouldForwardProp:b,label:p},h)),k=e=>"function"==typeof e&&e.__emotion_real!==e||(0,Vo.isPlainObject)(e)?n=>ns(e,(0,Ro.default)({},n,{theme:as({theme:n.theme,defaultTheme:r,themeId:a})})):e,y=(n,...i)=>{let o=k(n);const c=i?i.map(k):[];s&&u&&c.push((e=>{const n=as((0,Ro.default)({},e,{defaultTheme:r,themeId:a}));if(!n.components||!n.components[s]||!n.components[s].styleOverrides)return null;const i=n.components[s].styleOverrides,t={};return Object.entries(i).forEach((([a,r])=>{t[a]=ns(r,(0,Ro.default)({},e,{theme:n}))})),u(e,t)})),s&&!m&&c.push((e=>{var n;const i=as((0,Ro.default)({},e,{defaultTheme:r,themeId:a}));return ns({variants:null==i||null==(n=i.components)||null==(n=n[s])?void 0:n.variants},(0,Ro.default)({},e,{theme:i}))})),g||c.push(t);const d=c.length-i.length;if(Array.isArray(n)&&d>0){const e=new Array(d).fill("");o=[...n,...e],o.raw=[...n.raw,...e]}const h=f(o,...c);if("production"!==process.env.NODE_ENV){let a;s&&(a=`${s}${(0,Ho.default)(l||"")}`),void 0===a&&(a=`Styled(${(0,Wo.default)(e)})`),h.displayName=a}return e.muiName&&(h.muiName=e.muiName),h};return f.withConfig&&(y.withConfig=f.withConfig),y}};So.shouldForwardProp=Xo,So.systemDefaultTheme=void 0;var Ro=Fo((Co||(Co=1,function(e){function a(){return e.exports=a=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}(Oo)),Oo.exports)),Lo=Fo((Eo||(Eo=1,function(e){e.exports=function(e,a){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(a.includes(n))continue;r[n]=e[n]}return r},e.exports.__esModule=!0,e.exports.default=e.exports}(Mo)),Mo.exports)),Bo=function(e,a){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=Yo(a);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if("default"!==t&&Object.prototype.hasOwnProperty.call(e,t)){var o=i?Object.getOwnPropertyDescriptor(e,t):null;o&&(o.get||o.set)?Object.defineProperty(n,t,o):n[t]=e[t]}return n.default=e,r&&r.set(e,n),n}(_o),Vo=Ao,Ho=Fo(Do),Wo=Fo(To),Uo=Fo(No),Go=Fo(Io);const Ko=["ownerState"],Zo=["variants"],Jo=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Yo(e){if("function"!=typeof WeakMap)return null;var a=new WeakMap,r=new WeakMap;return(Yo=function(e){return e?r:a})(e)}function Xo(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const Qo=So.systemDefaultTheme=(0,Uo.default)(),es=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function as({defaultTheme:e,theme:a,themeId:r}){return n=a,0===Object.keys(n).length?e:a[r]||a;var n}function rs(e){return e?(a,r)=>r[e]:null}function ns(e,a){let{ownerState:r}=a,n=(0,Lo.default)(a,Ko);const i="function"==typeof e?e((0,Ro.default)({ownerState:r},n)):e;if(Array.isArray(i))return i.flatMap((e=>ns(e,(0,Ro.default)({ownerState:r},n))));if(i&&"object"==typeof i&&Array.isArray(i.variants)){const{variants:e=[]}=i;let a=(0,Lo.default)(i,Zo);return e.forEach((e=>{let i=!0;"function"==typeof e.props?i=e.props((0,Ro.default)({ownerState:r},n,r)):Object.keys(e.props).forEach((a=>{(null==r?void 0:r[a])!==e.props[a]&&n[a]!==e.props[a]&&(i=!1)})),i&&(Array.isArray(a)||(a=[a]),a.push("function"==typeof e.style?e.style((0,Ro.default)({ownerState:r},n,r)):e.style))})),a}return i}const is=Po({themeId:ha,defaultTheme:$o,rootShouldForwardProp:e=>function(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}(e)&&"classes"!==e}),ts=["theme"];function ss(e){let{theme:a}=e,r=ga(e,ts);const n=a[ha];return k.jsx(Gi,ma({},r,{themeId:n?ha:void 0,theme:n||a}))}"production"!==process.env.NODE_ENV&&(ss.propTypes={children:La.node,theme:La.oneOfType([La.object,La.func]).isRequired});const ls=()=>{const e=qo();return[...e.breakpoints.keys].reduce(((a,r)=>Mi(e.breakpoints.up(r))?r:a),null)??"sm"},cs=e=>({backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.icon.primary}),ds=e=>({backgroundColor:e.custom.palette.purple[100],color:e.custom.palette.icon.primary,"&:hover":{"&:before":{background:e.custom.palette.interaction.hoverOnDark}},"&:active":{"&:before":{background:e.custom.palette.interaction.pressOnDark}}}),us=e=>({backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,color:e.custom.palette.icon.primary,"&.MuiIconButton-root:disabled":{border:"none"}}),hs=e=>({backgroundColor:e.custom.palette.surface.raised,boxShadow:e.custom.elevation.raised,color:e.custom.palette.icon.primary,"&:focus-visible:after":{boxShadow:e.custom.boxShadow.input.focus},"&.MuiIconButton-root:disabled":{boxShadow:"none"}}),ms=(e,a)=>({borderRadius:"default"===e?a.spacing(a.custom.radius.md):a.custom.radius.round}),gs={xs:3*O,sm:3.5*O,md:4*O,lg:5*O,xl:6*O},ps=e=>({height:gs[e],width:gs[e]}),bs={xs:2*O,sm:2*O,md:2*O,lg:2.5*O,xl:3*O},fs=e=>({height:bs[e],width:bs[e]}),ks=a.styled(a.IconButton)((({theme:e,variation:a,shape:r="default",sizing:n})=>({boxSizing:"border-box",transition:"all 200ms ease","&:before, &:after":{...r&&{...ms(r,e)},transition:"all 250ms ease",content:'""',position:"absolute",inset:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&:focus:before":{backgroundColor:e.custom.palette.interaction.hover},"&:active:before":{backgroundColor:e.custom.palette.interaction.press},"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus},...r&&{...ms(r,e)},...n&&{...ps(n)},"&.MuiIconButton-root":{..."default"===a&&{...cs(e)},..."toggle"===a&&{...ds(e)},..."outlined"===a&&{...us(e)},..."raised"===a&&{...hs(e)},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,color:e.custom.palette.icon.disabled}},"& .MuiSvgIcon-root":{...n&&{...fs(n)},position:"relative",zIndex:1}}))),ys=({icon:e,loading:a,sizing:r,...n})=>k.jsx(ks,{...n,sizing:r,children:a?k.jsx(Pe,{sizing:r}):e}),vs=(e,a)=>({"&:after":{content:'""',position:"absolute",bottom:0,width:0,height:1,borderBottom:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderBottomLeftRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderTopLeftRadius:0,"&:after":{content:"none"}}}),ws=(e,a)=>({"&:after":{content:'""',position:"absolute",right:0,width:1,height:0,borderRight:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopLeftRadius:0,borderBottomLeftRadius:0,"&:after":{content:"none"}}}),zs=a.styled(a.ButtonGroup)((({theme:e,variation:a,orientation:r="horizontal",iconColor:n,sizing:i="lg",groupRaised:t=!1})=>({"&.MuiButtonGroup-root":{border:`1px solid ${e.custom.palette.stroke.default}`,...t&&{boxShadow:e.custom.elevation.raised,border:"none"},"& > button":{..."default"===a&&{...cs(e)},..."toggle"===a&&{...ds(e)},..."vertical"===r&&{...vs(e)},..."horizontal"===r&&{...ws(e)},...i&&{...ps(i)}},"& .MuiSvgIcon-root":{...i&&{...fs(i)},fill:n||"inherit"}}}))),js=({sx:e,...a})=>k.jsx(ea,{...a,sx:y({fontSize:{xs:qe.sm.body.md,sm:qe.sm.body.md,md:qe.sm.body.md,lg:qe.lg.body.md,xl:qe.lg.body.md}},!!e&&{...e})}),xs=a.styled(a.Box)((({theme:e})=>({"& .MuiGrid-item":{"&:first-of-type":{"& .MuiBox-root":{"&:before":{width:x,borderRadius:e.custom.radius.round,right:"50%",transform:`translateX(-${x}px)`,left:"auto"}}},"&:last-child":{"& .MuiBox-root":{"&:after":{width:x,borderRadius:e.custom.radius.round,right:"auto",left:"50%",transform:`translateX(${x}px)`}}}}}))),$s=({children:e,width:a})=>k.jsx(xs,{sx:{width:a},children:e}),qs=a.styled(aa)((()=>({lineHeight:"110%",textAlign:"center",width:"100%"}))),Cs=({disabled:e,children:a})=>k.jsx(qs,{showicon:!1,disabled:e,sx:{cursor:"inherit"},children:a}),Ss=a.styled(ta)((()=>({marginRight:0}))),Os=a.styled(a.Box)((({theme:e})=>({posiion:"relative","&:before":{content:'""',position:"absolute",top:"50%",left:0,height:z,width:`calc(50% - ${q/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default},"&:after":{content:'""',position:"absolute",top:"50%",right:0,height:z,width:`calc(50% - ${q/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default}}))),Es=e=>k.jsx(Os,{sx:{textAlign:"center",position:"relative"},children:k.jsx(Ss,{...e})}),Ms=({options:e=[],disabled:r=!1,sizing:n="lg",onChange:i,internalChange:t,value:o})=>{const s=a.useTheme();function l(e){console.warn(e),i(e.value),t&&t()}return k.jsx(a.Box,{children:k.jsx($s,{children:k.jsx(a.Grid,{container:!0,justifyContent:"space-between",children:e.map((e=>k.jsxs(a.Grid,{item:!0,sm:!0,onClick:()=>l(e),sx:{cursor:"pointer",textAlign:"center","&:hover":{"& .MuiButtonBase-root.MuiRadio-root":{"&:before":{backgroundColor:s.custom.palette.interaction.hover}}},"&:active":{"& .MuiButtonBase-root.MuiRadio-root":{backgroundColor:s.custom.palette.input.default,borderColor:s.custom.palette.stroke.focus,boxShadow:s.custom.boxShadow.input.focus,"&:before":{backgroundColor:s.custom.palette.interaction.press},"&.Mui-checked":{backgroundColor:s.custom.palette.purple[500]}}}},children:[k.jsx(Es,{sizing:n,disabled:r,onChange:a=>l(e),checked:o===e.value},e.value),k.jsx(a.Box,{sx:{mt:E.xs,width:"100%"},children:k.jsx(Cs,{disabled:r,children:e.label})})]},e.value)))})})})},_s=a.styled(a.Link)((({theme:e,disabled:a})=>({"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus,borderRadius:e.spacing(e.custom.radius.sm),outline:"none"},"&.MuiLink-root":{transition:"all 200ms ease",display:"inline",cursor:"pointer",color:a?e.custom.palette.text.lockedWhite:e.custom.palette.text.textLink,textDecorationColor:e.custom.palette.text.textLink,pointerEvents:a?"none":"auto","&:hover":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover},"&:active":{color:e.custom.palette.text.textLinkHover,textDecorationColor:e.custom.palette.text.textLinkHover},"&:visited":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink}}}))),As=e=>e.target&&"_blank"===e.target?k.jsx(_s,{rel:"noopener",...e}):k.jsx(_s,{...e});function Ds(e,a){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)a.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}var Ts;function Ns(){}function Is(e){return!!(e||"").match(/\d/)}function Fs(e){return null==e}function Ps(e){return Fs(e)||function(e){return"number"==typeof e&&isNaN(e)}(e)||"number"==typeof e&&!isFinite(e)}function Rs(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Ls(e,a){void 0===a&&(a=!0);var r="-"===e[0],n=r&&a,i=(e=e.replace("-","")).split(".");return{beforeDecimal:i[0],afterDecimal:i[1]||"",hasNegation:r,addNegation:n}}function Bs(e,a,r){for(var n="",i=r?"0":"",t=0;t<=a-1;t++)n+=e[t]||i;return n}function Vs(e,a){return Array(a+1).join(e)}function Hs(e){var a=e+"",r="-"===a[0]?"-":"";r&&(a=a.substring(1));var n=a.split(/[eE]/g),i=n[0],t=n[1];if(!(t=Number(t)))return r+i;var o=1+t,s=(i=i.replace(".","")).length;return o<0?i="0."+Vs("0",Math.abs(o))+i:o>=s?i+=Vs("0",o-s):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Ws(e,a,r){if(-1!==["","-"].indexOf(e))return e;var n=(-1!==e.indexOf(".")||r)&&a,i=Ls(e),t=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,l=parseFloat("0."+(o||"0")),c=(o.length<=a?"0."+o:l.toFixed(a)).split("."),d=t;return t&&Number(c[0])&&(d=t.split("").reverse().reduce((function(e,a,r){return e.length>r?(Number(e[0])+Number(a)).toString()+e.substring(1,e.length):a+e}),c[0])),""+(s?"-":"")+d+(n?".":"")+Bs(c[1]||"",a,r)}function Us(e,a){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",a),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(a,a),!0):(e.focus(),!1)}}!function(e){e.event="event",e.props="prop"}(Ts||(Ts={}));var Gs,Ks,Zs,Js=(Gs=function(e,a){for(var r=0,n=0,i=e.length,t=a.length;e[r]===a[r]&&r<i;)r++;for(;e[i-1-n]===a[t-1-n]&&t-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:t-n}}},Zs=void 0,function(){for(var e=[],a=arguments.length;a--;)e[a]=arguments[a];return Ks&&e.length===Ks.length&&e.every((function(e,a){return e===Ks[a]}))?Zs:(Ks=e,Zs=Gs.apply(void 0,e))});function Ys(e){return Math.max(e.selectionStart,e.selectionEnd)}function Xs(e){var a=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return a[n]===r[i]}function Qs(e,a,r,n){var i,t,o,s=e.length;if(i=a,t=0,o=s,a=Math.min(Math.max(i,t),o),"left"===n){for(;a>=0&&!r[a];)a--;-1===a&&(a=r.indexOf(!0))}else{for(;a<=s&&!r[a];)a++;a>s&&(a=r.lastIndexOf(!0))}return-1===a&&(a=s),a}function el(e){for(var a=Array.from({length:e.length+1}).map((function(){return!0})),r=0,n=a.length;r<n;r++)a[r]=Boolean(Is(e[r])||Is(e[r-1]));return a}function al(a,r,n,i,t,o){void 0===o&&(o=Ns);var s=function(a){var r=e.useRef(a);r.current=a;var n=e.useRef((function(){for(var e=[],a=arguments.length;a--;)e[a]=arguments[a];return r.current.apply(r,e)}));return n.current}((function(e,a){var r,n;return Ps(e)?(n="",r=""):"number"==typeof e||a?(n="number"==typeof e?Hs(e):e,r=i(n)):(n=t(e,void 0),r=i(n)),{formattedValue:r,numAsString:n}})),l=e.useState((function(){return s(Fs(a)?r:a,n)})),c=l[0],d=l[1],u=a,h=n;Fs(a)&&(u=c.numAsString,h=!0);var m=s(u,h);return e.useMemo((function(){d(m)}),[m.formattedValue]),[c,function(e,a){e.formattedValue!==c.formattedValue&&d({formattedValue:e.formattedValue,numAsString:e.value}),o(e,a)}]}function rl(e){return e.replace(/[^0-9]/g,"")}function nl(e){return e}function il(a){var r=a.type;void 0===r&&(r="text");var n=a.displayType;void 0===n&&(n="input");var i=a.customInput,t=a.renderText,o=a.getInputRef,s=a.format;void 0===s&&(s=nl);var l=a.removeFormatting;void 0===l&&(l=rl);var c=a.defaultValue,d=a.valueIsNumericString,u=a.onValueChange,h=a.isAllowed,m=a.onChange;void 0===m&&(m=Ns);var g=a.onKeyDown;void 0===g&&(g=Ns);var p=a.onMouseUp;void 0===p&&(p=Ns);var b=a.onFocus;void 0===b&&(b=Ns);var f=a.onBlur;void 0===f&&(f=Ns);var k=a.value,y=a.getCaretBoundary;void 0===y&&(y=el);var v=a.isValidInputCharacter;void 0===v&&(v=Is);var w=a.isCharacterSame,z=Ds(a,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),j=al(k,c,Boolean(d),s,l,u),x=j[0],$=x.formattedValue,q=x.numAsString,C=j[1],S=e.useRef(),O=e.useRef({formattedValue:$,numAsString:q}),E=function(e,a){O.current={formattedValue:e.formattedValue,numAsString:e.value},C(e,a)},M=e.useState(!1),_=M[0],A=M[1],D=e.useRef(null),T=e.useRef({setCaretTimeout:null,focusTimeout:null});e.useEffect((function(){return A(!0),function(){clearTimeout(T.current.setCaretTimeout),clearTimeout(T.current.focusTimeout)}}),[]);var N=s,I=function(e,a){var r=parseFloat(a);return{formattedValue:e,value:a,floatValue:isNaN(r)?void 0:r}},F=function(e,a,r){0===e.selectionStart&&e.selectionEnd===e.value.length||(Us(e,a),T.current.setCaretTimeout=setTimeout((function(){e.value===r&&e.selectionStart!==a&&Us(e,a)}),0))},P=function(e,a,r){return Qs(e,a,y(e),r)},R=function(e,a,r){var n=y(a),i=function(e,a,r,n,i,t,o){void 0===o&&(o=Xs);var s=i.findIndex((function(e){return e})),l=e.slice(0,s);a||r.startsWith(l)||(a=l,r=l+r,n+=l.length);for(var c=r.length,d=e.length,u={},h=new Array(c),m=0;m<c;m++){h[m]=-1;for(var g=0,p=d;g<p;g++)if(o({currentValue:r,lastValue:a,formattedValue:e,currentValueIndex:m,formattedValueIndex:g})&&!0!==u[g]){h[m]=g,u[g]=!0;break}}for(var b=n;b<c&&(-1===h[b]||!t(r[b]));)b++;var f=b===c||-1===h[b]?d:h[b];for(b=n-1;b>0&&-1===h[b];)b--;var k=-1===b||-1===h[b]?0:h[b]+1;return k>f?f:n-k<f-n?k:f}(a,$,e,r,n,v,w);return i=Qs(a,i,n)};e.useEffect((function(){var e=O.current,a=e.formattedValue,r=e.numAsString;$===a&&q===r||E(I($,q),{event:void 0,source:Ts.props})}),[$,q]);var L=D.current?Ys(D.current):void 0;("undefined"!=typeof window?e.useLayoutEffect:e.useEffect)((function(){var e=D.current;if($!==O.current.formattedValue&&e){var a=R(O.current.formattedValue,$,L);e.value=$,F(e,a,$)}}),[$]);var B=function(e,a,r){var n=a.target,i=S.current?function(e,a){var r=Math.min(e.selectionStart,a);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:a}}}(S.current,n.selectionEnd):Js($,e),t=Object.assign(Object.assign({},i),{lastValue:$}),o=l(e,t),s=N(o);if(o=l(s,void 0),h&&!h(I(s,o))){var c=a.target,d=Ys(c),u=R(e,$,d);return c.value=$,F(c,u,$),!1}return function(e){var a=e.formattedValue;void 0===a&&(a="");var r,n=e.input,i=e.source,t=e.event,o=e.numAsString;if(n){var s=e.inputValue||n.value,l=Ys(n);n.value=a,void 0!==(r=R(s,a,l))&&F(n,r,a)}a!==$&&E(I(a,o),{event:t,source:i})}({formattedValue:s,numAsString:o,inputValue:e,event:a,source:r,input:a.target}),!0},V=function(e,a){void 0===a&&(a=0);var r=e.selectionStart,n=e.selectionEnd;S.current={selectionStart:r,selectionEnd:n+a}},H=!_||"undefined"==typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",W=Object.assign({inputMode:H},z,{type:r,value:$,onChange:function(e){var a=e.target.value;B(a,e,Ts.event)&&m(e),S.current=void 0},onKeyDown:function(e){var a,r=e.target,n=e.key,i=r.selectionStart,t=r.selectionEnd,o=r.value;void 0===o&&(o=""),"ArrowLeft"===n||"Backspace"===n?a=Math.max(i-1,0):"ArrowRight"===n?a=Math.min(i+1,o.length):"Delete"===n&&(a=i);var s=0;"Delete"===n&&i===t&&(s=1);var l="ArrowLeft"===n||"ArrowRight"===n;if(void 0===a||i!==t&&!l)return g(e),void V(r,s);var c=a;l?(c=P(o,a,"ArrowLeft"===n?"left":"right"))!==a&&e.preventDefault():"Delete"!==n||v(o[a])?"Backspace"!==n||v(o[a])||(c=P(o,a,"left")):c=P(o,a,"right");c!==a&&F(r,c,o),g(e),V(r,s)},onMouseUp:function(e){var a=e.target,r=function(){var e=a.selectionStart,r=a.selectionEnd,n=a.value;if(void 0===n&&(n=""),e===r){var i=P(n,e);i!==e&&F(a,i,n)}};r(),requestAnimationFrame((function(){r()})),p(e),V(a)},onFocus:function(e){e.persist&&e.persist();var a=e.target,r=e.currentTarget;D.current=a,T.current.focusTimeout=setTimeout((function(){var n=a.selectionStart,i=a.selectionEnd,t=a.value;void 0===t&&(t="");var o=P(t,n);o===n||0===n&&i===t.length||F(a,o,t),b(Object.assign(Object.assign({},e),{currentTarget:r}))}),0)},onBlur:function(e){D.current=null,clearTimeout(T.current.focusTimeout),clearTimeout(T.current.setCaretTimeout),f(e)}});if("text"===n)return t?e.createElement(e.Fragment,null,t($,z)||null):e.createElement("span",Object.assign({},z,{ref:o}),$);if(i){var U=i;return e.createElement(U,Object.assign({},W,{ref:o}))}return e.createElement("input",Object.assign({},W,{ref:o}))}function tl(e,a){var r=a.decimalScale,n=a.fixedDecimalScale,i=a.prefix;void 0===i&&(i="");var t=a.suffix;void 0===t&&(t="");var o=a.allowNegative,s=a.thousandsGroupStyle;if(void 0===s&&(s="thousand"),""===e||"-"===e)return e;var l=ol(a),c=l.thousandSeparator,d=l.decimalSeparator,u=0!==r&&-1!==e.indexOf(".")||r&&n,h=Ls(e,o),m=h.beforeDecimal,g=h.afterDecimal,p=h.addNegation;return void 0!==r&&(g=Bs(g,r,!!n)),c&&(m=function(e,a,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),i=e.search(/[1-9]/);return i=-1===i?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+a)}(m,c,s)),i&&(m=i+m),t&&(g+=t),p&&(m="-"+m),e=m+(u&&d||"")+g}function ol(e){var a=e.decimalSeparator;void 0===a&&(a=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[a,"."]),{decimalSeparator:a,thousandSeparator:r,allowedDecimalSeparators:n}}function sl(e,a,r){var n;void 0===a&&(a=function(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}(e));var i=r.allowNegative,t=r.prefix;void 0===t&&(t="");var o=r.suffix;void 0===o&&(o="");var s=r.decimalScale,l=a.from,c=a.to,d=c.start,u=c.end,h=ol(r),m=h.allowedDecimalSeparators,g=h.decimalSeparator,p=e[u]===g;if(Is(e)&&(e===t||e===o)&&""===a.lastValue)return e;if(u-d==1&&-1!==m.indexOf(e[d])){var b=0===s?"":g;e=e.substring(0,d)+b+e.substring(d+1,e.length)}var f=function(e,a,r){var n=!1,i=!1;t.startsWith("-")?n=!1:e.startsWith("--")?(n=!1,i=!0):o.startsWith("-")&&e.length===o.length?n=!1:"-"===e[0]&&(n=!0);var s=n?1:0;return i&&(s=2),s&&(e=e.substring(s),a-=s,r-=s),{value:e,start:a,end:r,hasNegation:n}},k=f(e,d,u),y=k.hasNegation;e=(n=k).value,d=n.start,u=n.end;var v=f(a.lastValue,l.start,l.end),w=v.start,z=v.end,j=v.value,x=e.substring(d,u);!(e.length&&j.length&&(w>j.length-o.length||z<t.length))||x&&o.startsWith(x)||(e=j);var $=0;e.startsWith(t)?$+=t.length:d<t.length&&($=d),u-=$;var q=(e=e.substring($)).length,C=e.length-o.length;e.endsWith(o)?q=C:(u>C||u>e.length-o.length)&&(q=u),e=e.substring(0,q),e=function(e,a){void 0===e&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),t=n.test(e);return e=e.replace(/-/g,""),i&&!t&&a&&(e="-"+e),e}(y?"-"+e:e,i),e=(e.match(function(e){return new RegExp("(^-)|[0-9]|"+Rs(e),"g")}(g))||[]).join("");var S=e.indexOf(g);e=e.replace(new RegExp(Rs(g),"g"),(function(e,a){return a===S?".":""}));var O=Ls(e,i),E=O.beforeDecimal,M=O.afterDecimal,_=O.addNegation;return c.end-c.start<l.end-l.start&&""===E&&p&&!parseFloat(M)&&(e=_?"-":""),e}function ll(e){e=function(e){var a=ol(e),r=a.thousandSeparator,n=a.decimalSeparator,i=e.prefix;void 0===i&&(i="");var t=e.allowNegative;if(void 0===t&&(t=!0),r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");return i.startsWith("-")&&t&&(console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: "+i+"\n allowNegative: "+t+"\n "),t=!1),Object.assign(Object.assign({},e),{allowNegative:t})}(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var a=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;void 0===i&&(i=Ns);var t=e.onBlur;void 0===t&&(t=Ns);var o=e.thousandSeparator,s=e.decimalScale,l=e.fixedDecimalScale,c=e.prefix;void 0===c&&(c="");var d=e.defaultValue,u=e.value,h=e.valueIsNumericString,m=e.onValueChange,g=Ds(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),p=ol(e),b=p.decimalSeparator,f=p.allowedDecimalSeparators,k=function(a){return tl(a,e)},y=function(a,r){return sl(a,r,e)},v=Fs(u)?d:u,w=null!=h?h:function(e,a,r){return""===e||!(null==a?void 0:a.match(/\d/))&&!(null==r?void 0:r.match(/\d/))&&"string"==typeof e&&!isNaN(Number(e))}(v,c,a);Fs(u)?Fs(d)||(w=w||"number"==typeof d):w=w||"number"==typeof u;var z=function(e){return Ps(e)?e:("number"==typeof e&&(e=Hs(e)),w&&"number"==typeof s?Ws(e,s,Boolean(l)):e)},j=al(z(u),z(d),Boolean(w),k,y,m),x=j[0],$=x.numAsString,q=x.formattedValue,C=j[1];return Object.assign(Object.assign({},g),{value:q,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===b||Is(e)},isCharacterSame:function(e){var a=e.currentValue,r=e.lastValue,n=e.formattedValue,i=e.currentValueIndex,t=e.formattedValueIndex,o=a[i],d=n[t],h=Js(r,a).to,m=function(e){return y(e).indexOf(".")+c.length};return!(0===u&&l&&s&&a[h.start]===b&&m(a)<i&&m(n)>t)&&(!!(i>=h.start&&i<h.end&&f&&f.includes(o)&&d===b)||o===d)},onValueChange:C,format:k,removeFormatting:y,getCaretBoundary:function(a){return function(e,a){var r=a.prefix;void 0===r&&(r="");var n=a.suffix;void 0===n&&(n="");var i=Array.from({length:e.length+1}).map((function(){return!0})),t="-"===e[0];i.fill(!1,0,r.length+(t?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}(a,e)},onKeyDown:function(e){var a=e.target,n=e.key,t=a.selectionStart,d=a.selectionEnd,u=a.value;if(void 0===u&&(u=""),("Backspace"===n||"Delete"===n)&&d<c.length)e.preventDefault();else if(t===d){"Backspace"===n&&"-"===u[0]&&t===c.length+1&&r&&Us(a,1),s&&l&&("Backspace"===n&&u[t-1]===b?(Us(a,t-1),e.preventDefault()):"Delete"===n&&u[t]===b&&e.preventDefault()),(null==f?void 0:f.includes(n))&&u[t]===b&&Us(a,t+1);var h=!0===o?",":o;"Backspace"===n&&u[t-1]===h&&Us(a,t-1),"Delete"===n&&u[t]===h&&Us(a,t+1),i(e)}else i(e)},onBlur:function(a){var r=$;if(r.match(/\d/g)||(r=""),n||(r=function(e){if(!e)return e;var a="-"===e[0];a&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(a?"-":"")+n+(i?"."+i:"")}(r)),l&&s&&(r=Ws(r,s,l)),r!==$){var i=tl(r,e);C({formattedValue:i,value:r,floatValue:parseFloat(r)},{event:a,source:Ts.event})}t(a)}})}function cl(a){var r=ll(a);return e.createElement(il,Object.assign({},r))}const dl=(e,a,r)=>0===e||e?a&&e<a?a:r&&e>r?r:e:a||0,ul=e.forwardRef((({inputRef:n,onChange:i,name:t,min:o,max:s,value:l,...c},d)=>{const u=a.useTheme(),[h,m]=e.useState(dl(l,o,s)||0),g=e=>{m((a=>dl(e?a+1:a-1,o,s)))},p=e.useCallback((()=>{const e=dl(h,o,s);i&&i({target:{value:e}}),m(e)}),[h]);return k.jsxs(k.Fragment,{children:[k.jsx(cl,{...c,style:{width:"100%"},getInputRef:n,allowNegative:o&&Math.sign(o),autoFocus:!1,value:h,onValueChange:({floatValue:e})=>{m(e)},onBlurCapture:p}),k.jsxs(a.Stack,{sx:{position:"absolute",top:0,right:0,height:"100%",ml:"auto",width:32,borderLeft:`1px solid ${u.custom.palette.stroke.default}`},children:[k.jsx(a.ButtonBase,{onClick:()=>g(!0),sx:{flex:1,borderTopRightRadius:u.spacing(u.custom.radius.md),fontSize:16,"&:hover":{background:u.custom.palette.interaction.hover}},children:k.jsx(r.ArrowDropUp,{fontSize:"inherit"})}),k.jsx(a.Divider,{}),k.jsx(a.ButtonBase,{onClick:()=>g(!1),sx:{flex:1,borderBottomRightRadius:u.spacing(u.custom.radius.md),fontSize:16,"&:hover":{background:u.custom.palette.interaction.hover}},children:k.jsx(r.ArrowDropDown,{fontSize:"inherit"})})]})]})})),hl=({startAdornment:e,endAdornment:r,placeholder:n,onChange:i,internalChange:t,inputRef:o,min:s,max:l,...c})=>k.jsx(Ge,{placeholder:n,sx:{height:C,"& .MuiOutlinedInput-input":{pl:e?1:2,pr:e?1:2}},inputRef:o,inputProps:{min:s,max:l},InputProps:{inputComponent:ul,endAdornment:r?k.jsx(a.InputAdornment,{position:"start",sx:{pr:1},children:r}):null},...c,onChange:e=>{i&&i(e),t&&t()}}),ml=(e,a)=>"light"===a?{fontWeight:400}:{fontWeight:500,textTransform:"uppercase"},gl=(e,a,r)=>{switch(a){case"peach":return{background:e.custom.palette.peach[100],color:"heavy"===r?e.custom.palette.peach[1e3]:e.custom.palette.peach[800]};case"peachDark":return{background:e.custom.palette.peach[800],color:e.custom.palette.peach[0]};case"purple":return{background:e.custom.palette.purple[100],color:"heavy"===r?e.custom.palette.purple[1e3]:e.custom.palette.purple[800]};default:return{background:e.custom.palette.neutral[100],color:"heavy"===r?e.custom.palette.neutral[1e3]:e.custom.palette.neutral[800]}}},pl=a.styled(a.Chip)((({theme:e,variation:a,weight:r})=>({borderRadius:e.spacing(e.custom.radius.md),height:28,...gl(e,a,r),"& .MuiChip-label":{fontSize:`${qe.sm.body.sm}`,padding:`0 ${e.spacing(e.custom.padding.sm)}`,...ml(0,r)},"& .MuiChip-icon":{width:"0.8em",height:"0.8em",marginRight:-4,...gl(e,a,r),...ml(0,r)}}))),bl=a.styled("iframe")((()=>({border:"none",height:"100%",width:"100%"}))),fl=({options:r,onChange:n,other:i,value:t,internalChange:o,...s})=>{const l=i?.enabled,c="other-option",d=`${c}-value-`,[u,h]=e.useState(t),[m,g]=e.useState(!1);e.useEffect((()=>{!m&&u?.includes(d)?g(!0):m&&g(!1)}),[u]);return k.jsxs(k.Fragment,{children:[k.jsxs(a.RadioGroup,{...s,value:u,sx:{display:"flex",gap:e=>e.custom.margin.sm,label:{"&:last-child":{mb:0},"&:hover":{"& .MuiRadio-root":{backgroundColor:e=>e.custom.palette.interaction.hover,"&.Mui-checked":{backgroundColor:e=>e.custom.palette.purple[500]}}}}},onChange:(e,a)=>{n&&n(a),h(a),o&&o()},children:[r?r.map(((e,a)=>k.jsx(Ve,{sx:{"& .MuiButtonBase-root.MuiRadio-root":{alignSelf:"baseline"}},...e,control:k.jsx(ta,{})},a))):null,l&&k.jsx(Ve,{label:i?.label||"Other",value:d,control:k.jsx(ta,{checked:u?.includes(d)})},c)]}),m&&k.jsx(a.Box,{sx:{mt:1},children:k.jsx(Ke,{fullWidth:!0,autoFocus:!0,placeholder:i?.placeholder,defaultValue:u?.replace(d,""),onChange:e=>{var a;n&&n((a=e.target.value,`${d}${a}`)),o&&o()},required:!0})})]})},kl=e.createContext({attributes:{},listeners:void 0,ref(){}}),yl=e=>o.defaultAnimateLayoutChanges({...e,wasDragging:!0});function vl({children:r,top:n,bottom:i,id:t}){const{attributes:l,isDragging:c,listeners:d,setNodeRef:u,setActivatorNodeRef:h,transform:m,transition:g}=o.useSortable({id:t,animateLayoutChanges:yl}),p=e.useMemo((()=>({attributes:l,listeners:d,ref:h})),[l,d,h]),b={opacity:c?.4:void 0,transform:s.CSS.Translate.toString(m),transition:g};return k.jsx(kl.Provider,{value:p,children:k.jsxs(a.Stack,{className:"SortableItem",...l,sx:{position:"relative",...b,width:"100%"},ref:u,children:[n&&n,k.jsx(a.Box,{...d,sx:{display:"flex",cursor:"grab"},children:r}),i&&i]})})}const wl={sideEffects:t.defaultDropAnimationSideEffects({styles:{active:{opacity:"0.4"}}})};function zl({children:e}){return i.createPortal(k.jsx(t.DragOverlay,{zIndex:999999,dropAnimation:wl,children:e}),document.body)}const jl=({nativeEvent:e})=>{let a=e.target;for(;a;){if(a.dataset.noDnd)return!1;a=a.parentElement}return!0};class xl extends t.MouseSensor{static activators=[{eventName:"onMouseDown",handler:jl}]}class $l extends t.TouchSensor{static activators=[{eventName:"onTouchStart",handler:jl}]}function ql({items:r,onChange:n,renderItem:i,disabled:s,direction:l}){if(!r)return;const[c,d]=e.useState(null),u=e.useMemo((()=>r.find((e=>e?.id===c?.id))),[c,r]),h=a.useTheme(),m=a.useMediaQuery(h.breakpoints.down("md")),g=t.useSensors(t.useSensor(xl,{activationConstraint:{distance:5}}),t.useSensor($l,{activationConstraint:{delay:m?300:0,tolerance:8}}),t.useSensor(t.KeyboardSensor,{coordinateGetter:o.sortableKeyboardCoordinates}));return k.jsxs(t.DndContext,{measuring:{droppable:{strategy:t.MeasuringStrategy.Always}},sensors:g,onDragStart:({active:e})=>{d(e)},onDragEnd:({active:e,over:a})=>{if(a&&e.id!==a?.id){const i=r.findIndex((({id:a})=>a===e.id)),t=r.findIndex((({id:e})=>e===a.id));n(o.arrayMove(r,i,t))}d(null)},onDragCancel:()=>{d(null)},children:[k.jsx(o.SortableContext,{items:r,disabled:s,strategy:"horizontal"===l?o.horizontalListSortingStrategy:o.verticalListSortingStrategy,children:k.jsx(a.Stack,{sx:{..."horizontal"===l&&{flexDirection:"row"},display:"flex",m:0,gap:1,padding:0,alignContent:"flex-start"},children:r.map((a=>k.jsx(e.Fragment,{children:i(a)},a.id)))})}),k.jsx(zl,{children:u?i(u,!0,!!c):null})]})}ql.Item=vl,ql.DragHandle=function(){const{attributes:r,listeners:n,ref:i}=e.useContext(kl);return k.jsx(a.Box,{...r,...n,ref:i,children:k.jsx("svg",{viewBox:"0 0 20 20",width:"12",children:k.jsx("path",{d:"M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"})})})};const Cl=({handleSelectAll:r,isIndeterminate:n,isAllSelected:i,sizing:t})=>{const[o,s]=e.useState(!1),l=a.useTheme();return e.useEffect((()=>{i&&s(i)}),[i]),k.jsxs(a.Stack,{direction:"row",gap:l.spacing(l.custom.padding.sm),onClick:e=>{const a=!o;s(a),r(e,a)},sx:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"flex-end",p:e=>e.custom.padding.sm},children:[k.jsx(a.FormLabel,{sx:{cursor:"pointer",fontSize:()=>t&&Se[t]},children:"Select all"}),k.jsx(We,{sizing:"default",indeterminate:n,checked:o})]})},Sl=e.forwardRef((({children:e,handleSelectAll:a,value:r=[],selections:n,sizing:i,...t},o)=>{const s=r.length===n.length,l=r.length>0&&r.length<n.length;return k.jsxs("ul",{ref:o,...t,children:[k.jsx(Cl,{handleSelectAll:a,isIndeterminate:l,isAllSelected:s,sizing:i}),e]})})),Ol="0px 4px 8px 0px #06040D14, 0px 16px 24px 0px #06040D14, 0px 0px 4px 2px #06040D0A, 0px 0px 0px 1px #FFFFFF29",El=e=>{switch(e){case"xs":return 24;case"md":return 32;default:return 40}},Ml=(e,a)=>({"& .MuiTypography-root":{height:El(a),fontSize:Se[a],display:"flex",alignItems:"center",paddingLeft:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm),paddingRight:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm)}}),_l=e=>({fontSize:`${qe.sm.body.md}`,borderRadius:e.spacing(e.custom.radius.md),position:"relative",padding:e.spacing(e.custom.padding.sm),"& .MuiSelect-outlined":{padding:0},"& .MuiSelect-select.MuiInputBase-input":{paddingRight:e.spacing(M.md)},"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",background:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.md),inset:0,zIndex:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-focused:before":{backgroundColor:e.custom.palette.interaction.press},"&.Mui-disabled:before":{backgroundColor:e.custom.palette.interaction.none},"& .MuiSelect-select":{position:"relative"}}),Al=(e,a)=>{switch(a){case"lg":return{height:El(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.lg,height:I.lg,top:`calc(50% - ${I.lg/2}px)`}};case"md":return{height:El(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.md,height:I.md,top:`calc(50% - ${I.md/2}px)`}};case"xs":return{height:El(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.xs,height:I.xs,top:`calc(50% - ${I.xs/2}px)`}};default:return{height:El("lg"),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.lg,height:I.lg,top:`calc(50% - ${I.lg/2}px)`}}}},Dl=e=>({position:"relative",fontSize:`${qe.sm.body.md}`,backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.text.primary,"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",inset:0,zIndex:1},"& > .MuiBox-root":{position:"relative",zIndex:2,width:"100%","& .MuiSvgIcon-root":{marginRight:e.spacing(e.custom.margin.sm),width:I.xl,height:I.xl},"& .MuiBox-root":{padding:e.spacing(e.custom.padding.sm),lineHeight:"22px"}}}),Tl=e=>({"&.MuiModal-root.MuiPopover-root":{"&.MuiMenu-root":{borderRadius:e.spacing(e.custom.radius.sm),"& .MuiPaper-root":{border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Ol}}}}),Nl=a.styled(a.Autocomplete)((({theme:e,sizing:a,value:r})=>({maxWidth:"100%",backgroundColor:e.custom.palette.surface.raised,borderRadius:e.spacing(e.custom.radius.md),border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiSvgIcon-root":{...a&&{width:I[a],height:I[a]}},"&.MuiAutocomplete-root .MuiOutlinedInput-root .MuiAutocomplete-input":{...a&&{height:"xs"===a?2*O+"px":3*O+"px"},paddingTop:0,paddingBottom:0,paddingLeft:r&&r?.length>0?0:e.spacing(e.custom.padding.sm),justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& .MuiAutocomplete-inputRoot":{...a&&{fontSize:Se[a],gap:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)},display:"flex",alignItems:"flex-start",paddingRight:3*O+"px",flexWrap:"wrap",height:"auto"},"& .MuiOutlinedInput-root":{display:"flex",alignItems:"center",padding:"0"},"& .MuiAutocomplete-tag":{...a&&{height:"xs"===a?2*O+"px":3*O+"px"},margin:0,"& .MuiSvgIcon-root":{height:"12px",width:"12px"}},"&.Mui-disabled":{backgroundColor:`${e.custom.palette.input.disabled}`,borderColor:`${e.custom.palette.stroke.disabled}`},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"& .MuiChip-root .MuiChip-label":{height:20,lineHeight:"20px",maxWidth:140,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`}}}))),Il=a.styled(a.Chip)((({theme:e,sizing:a})=>({borderRadius:e.spacing(e.custom.radius.sm),border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.default,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`},"& .MuiChip-deleteIcon":{fill:e.custom.palette.icon.primary,borderRadius:e.custom.radius.round,margin:0,"&:hover":{backgroundColor:e.custom.palette.interaction.hover},"&:active":{backgroundColor:e.custom.palette.interaction.press},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,fill:e.custom.palette.icon.disabled}}}))),Fl=a.styled(a.TextField)((({theme:e,sizing:a})=>({"& .MuiOutlinedInput-root":{padding:0,...a&&{margin:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)}},"& .MuiInputBase-input":{padding:"0 14px"},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}))),Pl=a.styled(a.Popper)((({theme:e,sizing:r})=>({"& .MuiPaper-root":{...r&&{margin:"lg"===r?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs),marginLeft:"lg"===r?`-${e.spacing(e.custom.padding.sm)}`:`-${e.spacing(e.custom.padding.xs)}`,marginTop:`calc(${"lg"===r?e.spacing(e.custom.margin.sm):e.spacing(e.custom.margin.xs)} + ${e.spacing(e.custom.margin.xs)})`},border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Ol,borderRadius:e.spacing(e.custom.radius.sm)},[`& .${a.autocompleteClasses.listbox}`]:{overflowX:"hidden",[`& .${a.autocompleteClasses.option}`]:{fontSize:Se[r],...r&&{height:"lg"===r?5*O+"px":4*O+"px"},"> span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'&[aria-selected="true"]':{backgroundColor:e.custom.palette.interaction.hover,display:"flex",alignItems:"center",justifyContent:"space-between"}}}}))),Rl=e=>k.jsx(Pl,{...e}),Ll=({selections:a,disableClearable:n=!1,disabled:i,internalChange:t,onChange:o,placeholder:s="",renderListItem:l,sizing:c="lg",value:d=[]})=>{const[u,h]=e.useState(a.filter((e=>d.includes(e?.value)))),m=(e,r)=>{if(o){const n=r?a.map((({value:e})=>e)):[];h(r?a:[]),o(e,n,"selectOption"),t&&t()}};return k.jsx(Nl,{disabledItemsFocusable:!0,autoFocus:!1,disableCloseOnSelect:!0,blurOnSelect:!1,popupIcon:k.jsx(r.KeyboardArrowDown,{}),sizing:c,disabled:i,disableClearable:n,autoComplete:!0,multiple:!0,renderInput:e=>k.jsx(Fl,{...e,placeholder:u.length>0?void 0:s,sizing:c}),options:a,renderTags:(e,a)=>e.map(((e,n)=>{const{key:i,...t}=a({index:n});return k.jsx(Il,{sizing:c,deleteIcon:k.jsx(r.CloseRounded,{fontSize:"small"}),label:e.label,...t},i)})),onChange:(e,a,r)=>{const n=a.map((({value:e})=>e));o&&(h(a),o(e,n,r)),t&&t()},PopperComponent:e=>k.jsx(Rl,{...e,sizing:c}),isOptionEqualToValue:(e,a)=>e.value===a.value,renderOption:(e,a,{selected:n})=>{const{key:i,...t}=e;return k.jsxs("li",{...t,children:[k.jsx("span",{children:l?l(a.label):a.label}),k.jsx(r.Check,{sx:{visibility:n?"visible":"hidden",fontSize:"16px"}})]},i)},ListboxComponent:e.forwardRef(((e,r)=>k.jsx(Sl,{ref:r,...e,handleSelectAll:m,value:u,selections:a,sizing:c}))),value:u})},Bl=a.styled(a.MenuItem)((({theme:e})=>({...{...Dl(e)},"&.Mui-focusVisible":{backgroundColor:e.custom.palette.interaction.none},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{backgroundColor:e.custom.palette.input.default}},"&.MuiButtonBase-root.MuiMenuItem-root.Mui-disabled":{backgroundColor:e.custom.palette.input.default,color:e.custom.palette.text.disabled,"&:before":{backgroundColor:e.custom.palette.interaction.disabled}},"&:hover":{backgroundColor:e.custom.palette.input.default,"&:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{"&:before":{backgroundColor:e.custom.palette.interaction.hover}},"&:before":{backgroundColor:e.custom.palette.interaction.hover}}},"&:active":{"&:before":{backgroundColor:e.custom.palette.interaction.press}}}))),Vl=({children:e,selected:n,...i})=>k.jsx(Bl,{...i,children:k.jsxs(a.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k.jsx(a.Box,{children:e}),n&&k.jsx(r.Check,{})]})}),Hl=a.styled(a.Select)((({theme:e,sizing:a})=>({...{..._l(e)},...a&&{...Al(e,a)},...a&&{...Ml(e,a)},backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiOutlinedInput-notchedOutline":{border:e.custom.palette.stroke.default},"&:hover":{"& .MuiOutlinedInput-notchedOutline":{borderColor:e.custom.palette.stroke.default}},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"&.Mui-disabled":{backgroundColor:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"& .MuiSvgIcon-root":{color:e.custom.palette.icon.disabled,transition:e.custom.easing.input}}}))),Wl=({selections:e,autoComplete:n=!1,disabled:i=!1,disablePortal:t=!1,inputRef:o,internalChange:s,onChange:l,placeholder:c="",selectOptionProps:d,sizing:u="lg",sx:h,value:m=[],renderListItem:g,...p})=>{const b=a.useTheme(),f=ls();return n?k.jsx(Ll,{selections:e,placeholder:c,disabled:i,sizing:u,onChange:(e,a)=>{l&&l(a),s&&s()},value:Array.isArray(m)?m:[],internalChange:s,renderListItem:g}):k.jsxs(Hl,{sizing:u,inputRef:o,MenuProps:{disablePortal:t,sx:Tl,anchorOrigin:{vertical:45,horizontal:"center"}},displayEmpty:!0,IconComponent:r.KeyboardArrowDown,renderValue:a=>c&&!a?k.jsx(ze,{component:"p",variation:"sm"===f||"md"===f?"sm":"lg",sx:{color:b.custom.palette.text.placeholder},children:c}):k.jsx(ze,{component:"p",variation:"sm"===f||"md"===f?"sm":"lg",children:e?.find((({value:e})=>e===a))?.label}),onChange:(e,a)=>{l&&l(e,a),s&&s()},sx:h,value:m,...p,children:[""!==c.trim()&&k.jsx(Vl,{disabled:!0,value:"","aria-label":"placeholder",children:c},"placeholder"),e?.map((({value:e,label:a})=>k.jsx(Vl,{value:e,...d,children:g?g(a):a},e)))]})},Ul=a.styled(a.Box)((({theme:e,disabled:a,fullWidth:r})=>({width:r?"100%":"auto",minWidth:240,backgroundColor:a?e.custom.palette.input.disabled:e.custom.palette.surface.raised,border:`1px solid ${a?e.custom.palette.stroke.disabled:e.custom.palette.stroke.default}`,borderRadius:e.spacing(e.custom.radius.lg),padding:e.spacing(e.custom.padding.md),position:"relative",zIndex:0,"&:after":{content:'""',backgroundColor:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.lg),position:"absolute",inset:0},"&:hover":{"&:after":{backgroundColor:e.custom.palette.interaction.hover}},"&:active":{"&:after":{backgroundColor:e.custom.palette.interaction.press}},"& svg":{fill:e.custom.palette.icon.primary},...a&&{background:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"&:after":{backgroundColor:e.custom.palette.interaction.none},"& .MuiBox-root > .MuiSvgIcon-root":{fill:"none"}}}))),Gl=a.styled(js)((({theme:e})=>({fontSize:qe.button.md,color:e.custom.palette.text.primary,lineHeight:"120%",letterSpacing:"0.16px"}))),Kl=({label:e="Placeholder",disabled:n,onChange:i,options:t,fullWidth:o})=>{const s=a.useTheme(),l=t.map((e=>e.label)).indexOf(e);return k.jsx(Ul,{disabled:n,fullWidth:o,children:k.jsxs(a.Stack,{display:"flex",justifyContent:"space-between",flexDirection:"row",alignItems:"center",sx:{position:"relative",zIndex:1},children:[k.jsxs(a.Box,{display:"flex",alignItems:"center",sx:{"& svg":{fill:s.custom.palette.icon.secondary}},children:[k.jsx(r.DragHandle,{sx:{width:I.lg,height:I.lg,mr:s.custom.padding.sm}}),k.jsx(Gl,{align:"left",disabled:n,children:e})]}),k.jsx(Wl,{sizing:"xs",selections:t.map(((e,a)=>({label:`${a+1}`,value:`${a}`}))),disabled:n,value:`${l}`,onChange:function(e){const a=l,r=Number(e.target.value),n=t;let o=1;const s=n.splice(a,o)[0];o=0,n.splice(r,o,s),i(n)},MenuProps:{anchorOrigin:{vertical:q,horizontal:"center"}}})]})})},Zl=({labelTop:r,labelBottom:n,disabled:i,fullWidth:t=!1,options:o,onChange:s,value:l,internalChange:c})=>{const d=a.useTheme(),[u,h]=e.useState(l||o);function m(e){h(e),s(e.map((({id:e})=>e))),c&&c()}return k.jsxs(a.Stack,{gap:d.custom.margin.sm,textAlign:"center",sx:{width:t?"100%":"auto"},children:[r&&k.jsx(js,{disabled:i,sx:{color:d.custom.palette.text.secondary},children:r}),k.jsx(ql,{onChange:function(e){h(e),s(e.map((({id:e})=>e))),c&&c()},items:u,direction:"vertical",renderItem:({...e})=>k.jsx(vl,{id:e.id,children:k.jsx(Kl,{onChange:m,...e,options:u,disabled:i,selections:e.selections,fullWidth:t})})}),n&&k.jsx(js,{disabled:i,sx:{color:d.custom.palette.text.secondary},children:n})]})};function Jl(e){this.content=e}function Yl(e,a,r){for(let n=0;;n++){if(n==e.childCount||n==a.childCount)return e.childCount==a.childCount?null:r;let i=e.child(n),t=a.child(n);if(i!=t){if(!i.sameMarkup(t))return r;if(i.isText&&i.text!=t.text){for(let e=0;i.text[e]==t.text[e];e++)r++;return r}if(i.content.size||t.content.size){let e=Yl(i.content,t.content,r+1);if(null!=e)return e}r+=i.nodeSize}else r+=i.nodeSize}}function Xl(e,a,r,n){for(let i=e.childCount,t=a.childCount;;){if(0==i||0==t)return i==t?null:{a:r,b:n};let o=e.child(--i),s=a.child(--t),l=o.nodeSize;if(o!=s){if(!o.sameMarkup(s))return{a:r,b:n};if(o.isText&&o.text!=s.text){let e=0,a=Math.min(o.text.length,s.text.length);for(;e<a&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,r--,n--;return{a:r,b:n}}if(o.content.size||s.content.size){let e=Xl(o.content,s.content,r-1,n-1);if(e)return e}r-=l,n-=l}else r-=l,n-=l}}Jl.prototype={constructor:Jl,find:function(e){for(var a=0;a<this.content.length;a+=2)if(this.content[a]===e)return a;return-1},get:function(e){var a=this.find(e);return-1==a?void 0:this.content[a+1]},update:function(e,a,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),t=n.content.slice();return-1==i?t.push(r||e,a):(t[i+1]=a,r&&(t[i]=r)),new Jl(t)},remove:function(e){var a=this.find(e);if(-1==a)return this;var r=this.content.slice();return r.splice(a,2),new Jl(r)},addToStart:function(e,a){return new Jl([e,a].concat(this.remove(e).content))},addToEnd:function(e,a){var r=this.remove(e).content.slice();return r.push(e,a),new Jl(r)},addBefore:function(e,a,r){var n=this.remove(a),i=n.content.slice(),t=n.find(e);return i.splice(-1==t?i.length:t,0,a,r),new Jl(i)},forEach:function(e){for(var a=0;a<this.content.length;a+=2)e(this.content[a],this.content[a+1])},prepend:function(e){return(e=Jl.from(e)).size?new Jl(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Jl.from(e)).size?new Jl(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var a=this;e=Jl.from(e);for(var r=0;r<e.content.length;r+=2)a=a.remove(e.content[r]);return a},toObject:function(){var e={};return this.forEach((function(a,r){e[a]=r})),e},get size(){return this.content.length>>1}},Jl.from=function(e){if(e instanceof Jl)return e;var a=[];if(e)for(var r in e)a.push(r,e[r]);return new Jl(a)};class Ql{constructor(e,a){if(this.content=e,this.size=a||0,null==a)for(let a=0;a<e.length;a++)this.size+=e[a].nodeSize}nodesBetween(e,a,r,n=0,i){for(let t=0,o=0;o<a;t++){let s=this.content[t],l=o+s.nodeSize;if(l>e&&!1!==r(s,n+o,i||null,t)&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,a-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,a,r,n){let i="",t=!0;return this.nodesBetween(e,a,((o,s)=>{let l=o.isText?o.text.slice(Math.max(e,s)-s,a-s):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(t?t=!1:i+=r),i+=l}),0),i}append(e){if(!e.size)return this;if(!this.size)return e;let a=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(a.isText&&a.sameMarkup(r)&&(n[n.length-1]=a.withText(a.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new Ql(n,this.size+e.size)}cut(e,a=this.size){if(0==e&&a==this.size)return this;let r=[],n=0;if(a>e)for(let i=0,t=0;t<a;i++){let o=this.content[i],s=t+o.nodeSize;s>e&&((t<e||s>a)&&(o=o.isText?o.cut(Math.max(0,e-t),Math.min(o.text.length,a-t)):o.cut(Math.max(0,e-t-1),Math.min(o.content.size,a-t-1))),r.push(o),n+=o.nodeSize),t=s}return new Ql(r,n)}cutByIndex(e,a){return e==a?Ql.empty:0==e&&a==this.content.length?this:new Ql(this.content.slice(e,a))}replaceChild(e,a){let r=this.content[e];if(r==a)return this;let n=this.content.slice(),i=this.size+a.nodeSize-r.nodeSize;return n[e]=a,new Ql(n,i)}addToStart(e){return new Ql([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ql(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let a=0;a<this.content.length;a++)if(!this.content[a].eq(e.content[a]))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 a=this.content[e];if(!a)throw new RangeError("Index "+e+" out of range for "+this);return a}maybeChild(e){return this.content[e]||null}forEach(e){for(let a=0,r=0;a<this.content.length;a++){let n=this.content[a];e(n,r,a),r+=n.nodeSize}}findDiffStart(e,a=0){return Yl(this,e,a)}findDiffEnd(e,a=this.size,r=e.size){return Xl(this,e,a,r)}findIndex(e,a=-1){if(0==e)return ac(0,e);if(e==this.size)return ac(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=n+this.child(r).nodeSize;if(i>=e)return i==e||a>0?ac(r+1,i):ac(r,n);n=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,a){if(!a)return Ql.empty;if(!Array.isArray(a))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ql(a.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ql.empty;let a,r=0;for(let n=0;n<e.length;n++){let i=e[n];r+=i.nodeSize,n&&i.isText&&e[n-1].sameMarkup(i)?(a||(a=e.slice(0,n)),a[a.length-1]=i.withText(a[a.length-1].text+i.text)):a&&a.push(i)}return new Ql(a||e,r)}static from(e){if(!e)return Ql.empty;if(e instanceof Ql)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ql([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ql.empty=new Ql([],0);const ec={index:0,offset:0};function ac(e,a){return ec.index=e,ec.offset=a,ec}function rc(e,a){if(e===a)return!0;if(!e||"object"!=typeof e||!a||"object"!=typeof a)return!1;let r=Array.isArray(e);if(Array.isArray(a)!=r)return!1;if(r){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!rc(e[r],a[r]))return!1}else{for(let r in e)if(!(r in a)||!rc(e[r],a[r]))return!1;for(let r in a)if(!(r in e))return!1}return!0}let nc=class e{constructor(e,a){this.type=e,this.attrs=a}addToSet(e){let a,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))a||(a=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(a||(a=e.slice(0,n)),a.push(this),r=!0),a&&a.push(i)}}return a||(a=e.slice()),r||a.push(this),a}removeFromSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return e.slice(0,a).concat(e.slice(a+1));return e}isInSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let a in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,a){if(!a)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[a.type];if(!r)throw new RangeError(`There is no mark type ${a.type} in this schema`);let n=r.create(a.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,a){if(e==a)return!0;if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(a[r]))return!1;return!0}static setFrom(a){if(!a||Array.isArray(a)&&0==a.length)return e.none;if(a instanceof e)return[a];let r=a.slice();return r.sort(((e,a)=>e.type.rank-a.type.rank)),r}};nc.none=[];class ic extends Error{}class tc{constructor(e,a,r){this.content=e,this.openStart=a,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,a){let r=sc(this.content,e+this.openStart,a);return r&&new tc(r,this.openStart,this.openEnd)}removeBetween(e,a){return new tc(oc(this.content,e+this.openStart,a+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,a){if(!a)return tc.empty;let r=a.openStart||0,n=a.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw new RangeError("Invalid input for Slice.fromJSON");return new tc(Ql.fromJSON(e,a.content),r,n)}static maxOpen(e,a=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(a||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(a||!r.type.spec.isolating);r=r.lastChild)n++;return new tc(e,r,n)}}function oc(e,a,r){let{index:n,offset:i}=e.findIndex(a),t=e.maybeChild(n),{index:o,offset:s}=e.findIndex(r);if(i==a||t.isText){if(s!=r&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,a).append(e.cut(r))}if(n!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(n,t.copy(oc(t.content,a-i-1,r-i-1)))}function sc(e,a,r,n){let{index:i,offset:t}=e.findIndex(a),o=e.maybeChild(i);if(t==a||o.isText)return e.cut(0,a).append(r).append(e.cut(a));let s=sc(o.content,a-t-1,r);return s&&e.replaceChild(i,o.copy(s))}function lc(e,a,r){if(r.openStart>e.depth)throw new ic("Inserted content deeper than insertion position");if(e.depth-r.openStart!=a.depth-r.openEnd)throw new ic("Inconsistent open depths");return cc(e,a,r,0)}function cc(e,a,r,n){let i=e.index(n),t=e.node(n);if(i==a.index(n)&&n<e.depth-r.openStart){let o=cc(e,a,r,n+1);return t.copy(t.content.replaceChild(i,o))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=n||a.depth!=n){let{start:i,end:o}=function(e,a){let r=a.depth-e.openStart,n=a.node(r),i=n.copy(e.content);for(let e=r-1;e>=0;e--)i=a.node(e).copy(Ql.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}(r,e);return gc(t,pc(e,i,o,a,n))}{let n=e.parent,i=n.content;return gc(n,i.cut(0,e.parentOffset).append(r.content).append(i.cut(a.parentOffset)))}}return gc(t,bc(e,a,n))}function dc(e,a){if(!a.type.compatibleContent(e.type))throw new ic("Cannot join "+a.type.name+" onto "+e.type.name)}function uc(e,a,r){let n=e.node(r);return dc(n,a.node(r)),n}function hc(e,a){let r=a.length-1;r>=0&&e.isText&&e.sameMarkup(a[r])?a[r]=e.withText(a[r].text+e.text):a.push(e)}function mc(e,a,r,n){let i=(a||e).node(r),t=0,o=a?a.index(r):i.childCount;e&&(t=e.index(r),e.depth>r?t++:e.textOffset&&(hc(e.nodeAfter,n),t++));for(let e=t;e<o;e++)hc(i.child(e),n);a&&a.depth==r&&a.textOffset&&hc(a.nodeBefore,n)}function gc(e,a){return e.type.checkContent(a),e.copy(a)}function pc(e,a,r,n,i){let t=e.depth>i&&uc(e,a,i+1),o=n.depth>i&&uc(r,n,i+1),s=[];return mc(null,e,i,s),t&&o&&a.index(i)==r.index(i)?(dc(t,o),hc(gc(t,pc(e,a,r,n,i+1)),s)):(t&&hc(gc(t,bc(e,a,i+1)),s),mc(a,r,i,s),o&&hc(gc(o,bc(r,n,i+1)),s)),mc(n,null,i,s),new Ql(s)}function bc(e,a,r){let n=[];if(mc(null,e,r,n),e.depth>r){hc(gc(uc(e,a,r+1),bc(e,a,r+1)),n)}return mc(a,null,r,n),new Ql(n)}tc.empty=new tc(Ql.empty,0,0);class fc{constructor(e,a,r){this.pos=e,this.path=a,this.parentOffset=r,this.depth=a.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,a=this.index(this.depth);if(a==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(a);return r?e.child(a).cut(r):n}get nodeBefore(){let e=this.index(this.depth),a=this.pos-this.path[this.path.length-1];return a?this.parent.child(e).cut(0,a):0==e?null:this.parent.child(e-1)}posAtIndex(e,a){a=this.resolveDepth(a);let r=this.path[3*a],n=0==a?0:this.path[3*a-1]+1;for(let a=0;a<e;a++)n+=r.child(a).nodeSize;return n}marks(){let e=this.parent,a=this.index();if(0==e.content.size)return nc.none;if(this.textOffset)return e.child(a).marks;let r=e.maybeChild(a-1),n=e.maybeChild(a);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var t=0;t<i.length;t++)!1!==i[t].type.spec.inclusive||n&&i[t].isInSet(n.marks)||(i=i[t--].removeFromSet(i));return i}marksAcross(e){let a=this.parent.maybeChild(this.index());if(!a||!a.isInline)return null;let r=a.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let a=this.depth;a>0;a--)if(this.start(a)<=e&&this.end(a)>=e)return a;return 0}blockRange(e=this,a){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!a||a(this.node(r))))return new wc(this,e,r);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 a=1;a<=this.depth;a++)e+=(e?"/":"")+this.node(a).type.name+"_"+this.index(a-1);return e+":"+this.parentOffset}static resolve(e,a){if(!(a>=0&&a<=e.content.size))throw new RangeError("Position "+a+" out of range");let r=[],n=0,i=a;for(let a=e;;){let{index:e,offset:t}=a.content.findIndex(i),o=i-t;if(r.push(a,e,n+t),!o)break;if(a=a.child(e),a.isText)break;i=o-1,n+=t+1}return new fc(a,r,i)}static resolveCached(e,a){let r=vc.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==a)return n}else vc.set(e,r=new kc);let n=r.elts[r.i]=fc.resolve(e,a);return r.i=(r.i+1)%yc,n}}class kc{constructor(){this.elts=[],this.i=0}}const yc=12,vc=new WeakMap;class wc{constructor(e,a,r){this.$from=e,this.$to=a,this.depth=r}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 zc=Object.create(null);let jc=class e{constructor(e,a,r,n=nc.none){this.type=e,this.attrs=a,this.marks=n,this.content=r||Ql.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,a,r,n=0){this.content.nodesBetween(e,a,r,n,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,a,r,n){return this.content.textBetween(e,a,r,n)}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,a,r){return this.type==e&&rc(this.attrs,a||e.defaultAttrs||zc)&&nc.sameSet(this.marks,r||nc.none)}copy(a=null){return a==this.content?this:new e(this.type,this.attrs,a,this.marks)}mark(a){return a==this.marks?this:new e(this.type,this.attrs,this.content,a)}cut(e,a=this.content.size){return 0==e&&a==this.content.size?this:this.copy(this.content.cut(e,a))}slice(e,a=this.content.size,r=!1){if(e==a)return tc.empty;let n=this.resolve(e),i=this.resolve(a),t=r?0:n.sharedDepth(a),o=n.start(t),s=n.node(t).content.cut(n.pos-o,i.pos-o);return new tc(s,n.depth-t,i.depth-t)}replace(e,a,r){return lc(this.resolve(e),this.resolve(a),r)}nodeAt(e){for(let a=this;;){let{index:r,offset:n}=a.content.findIndex(e);if(a=a.maybeChild(r),!a)return null;if(n==e||a.isText)return a;e-=n+1}}childAfter(e){let{index:a,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(a),index:a,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:a,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(a),index:a,offset:r};let n=this.content.child(a-1);return{node:n,index:a-1,offset:r-n.nodeSize}}resolve(e){return fc.resolveCached(this,e)}resolveNoCache(e){return fc.resolve(this,e)}rangeHasMark(e,a,r){let n=!1;return a>e&&this.nodesBetween(e,a,(e=>(r.isInSet(e.marks)&&(n=!0),!n))),n}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()+")"),$c(this.marks,e)}contentMatchAt(e){let a=this.type.contentMatch.matchFragment(this.content,0,e);if(!a)throw new Error("Called contentMatchAt on a node with invalid content");return a}canReplace(e,a,r=Ql.empty,n=0,i=r.childCount){let t=this.contentMatchAt(e).matchFragment(r,n,i),o=t&&t.matchFragment(this.content,a);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,a,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),t=i&&i.matchFragment(this.content,a);return!!t&&t.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=nc.none;for(let a=0;a<this.marks.length;a++){let r=this.marks[a];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!nc.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 a 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,a){if(!a)throw new RangeError("Invalid input for Node.fromJSON");let r;if(a.marks){if(!Array.isArray(a.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=a.marks.map(e.markFromJSON)}if("text"==a.type){if("string"!=typeof a.text)throw new RangeError("Invalid text node in JSON");return e.text(a.text,r)}let n=Ql.fromJSON(e,a.content),i=e.nodeType(a.type).create(a.attrs,n,r);return i.type.checkAttrs(i.attrs),i}};jc.prototype.text=void 0;class xc extends jc{constructor(e,a,r,n){if(super(e,a,null,n),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$c(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,a){return this.text.slice(e,a)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xc(this.type,this.attrs,e,this.marks)}cut(e=0,a=this.text.length){return 0==e&&a==this.text.length?this:this.withText(this.text.slice(e,a))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function $c(e,a){for(let r=e.length-1;r>=0;r--)a=e[r].type.name+"("+a+")";return a}class qc{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,a){let r=new Cc(e,a);if(null==r.next)return qc.empty;let n=Sc(r);r.next&&r.err("Unexpected trailing text");let i=function(e){let a=Object.create(null);return r(Dc(e,0));function r(n){let i=[];n.forEach((a=>{e[a].forEach((({term:a,to:r})=>{if(!a)return;let n;for(let e=0;e<i.length;e++)i[e][0]==a&&(n=i[e][1]);Dc(e,r).forEach((e=>{n||i.push([a,n=[]]),-1==n.indexOf(e)&&n.push(e)}))}))}));let t=a[n.join(",")]=new qc(n.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let n=i[e][1].sort(Ac);t.next.push({type:i[e][0],next:a[n.join(",")]||r(n)})}return t}}(function(e){let a=[[]];return i(t(e,0),r()),a;function r(){return a.push([])-1}function n(e,r,n){let i={term:n,to:r};return a[e].push(i),i}function i(e,a){e.forEach((e=>e.to=a))}function t(e,a){if("choice"==e.type)return e.exprs.reduce(((e,r)=>e.concat(t(r,a))),[]);if("seq"!=e.type){if("star"==e.type){let o=r();return n(a,o),i(t(e.expr,o),o),[n(o)]}if("plus"==e.type){let o=r();return i(t(e.expr,a),o),i(t(e.expr,o),o),[n(o)]}if("opt"==e.type)return[n(a)].concat(t(e.expr,a));if("range"==e.type){let o=a;for(let a=0;a<e.min;a++){let a=r();i(t(e.expr,o),a),o=a}if(-1==e.max)i(t(e.expr,o),o);else for(let a=e.min;a<e.max;a++){let a=r();n(o,a),i(t(e.expr,o),a),o=a}return[n(o)]}if("name"==e.type)return[n(a,void 0,e.value)];throw new Error("Unknown expr type")}for(let n=0;;n++){let o=t(e.exprs[n],a);if(n==e.exprs.length-1)return o;i(o,a=r())}}}(n));return function(e,a){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,t=[];for(let a=0;a<e.next.length;a++){let{type:r,next:o}=e.next[a];t.push(r.name),!i||r.isText||r.hasRequiredAttrs()||(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&a.err("Only non-generatable nodes ("+t.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}matchType(e){for(let a=0;a<this.next.length;a++)if(this.next[a].type==e)return this.next[a].next;return null}matchFragment(e,a=0,r=e.childCount){let n=this;for(let i=a;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}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:a}=this.next[e];if(!a.isText&&!a.hasRequiredAttrs())return a}return null}compatible(e){for(let a=0;a<this.next.length;a++)for(let r=0;r<e.next.length;r++)if(this.next[a].type==e.next[r].type)return!0;return!1}fillBefore(e,a=!1,r=0){let n=[this];return function i(t,o){let s=t.matchFragment(e,r);if(s&&(!a||s.validEnd))return Ql.from(o.map((e=>e.createAndFill())));for(let e=0;e<t.next.length;e++){let{type:a,next:r}=t.next[e];if(!a.isText&&!a.hasRequiredAttrs()&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(a));if(e)return e}}return null}(this,[])}findWrapping(e){for(let a=0;a<this.wrapCache.length;a+=2)if(this.wrapCache[a]==e)return this.wrapCache[a+1];let a=this.computeWrapping(e);return this.wrapCache.push(e,a),a}computeWrapping(e){let a=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let a=n;a.type;a=a.via)e.push(a.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:t,next:o}=i.next[e];t.isLeaf||t.hasRequiredAttrs()||t.name in a||n.type&&!o.validEnd||(r.push({match:t.contentMatch,type:t,via:n}),a[t.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 a(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&a(r.next[n].next)}(this),e.map(((a,r)=>{let n=r+(a.validEnd?"*":" ")+" ";for(let r=0;r<a.next.length;r++)n+=(r?", ":"")+a.next[r].type.name+"->"+e.indexOf(a.next[r].next);return n})).join("\n")}}qc.empty=new qc(!0);class Cc{constructor(e,a){this.string=e,this.nodeTypes=a,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 Sc(e){let a=[];do{a.push(Oc(e))}while(e.eat("|"));return 1==a.length?a[0]:{type:"choice",exprs:a}}function Oc(e){let a=[];do{a.push(Ec(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==a.length?a[0]:{type:"seq",exprs:a}}function Ec(e){let a=function(e){if(e.eat("(")){let a=Sc(e);return e.eat(")")||e.err("Missing closing paren"),a}if(!/\W/.test(e.next)){let a=function(e,a){let r=e.nodeTypes,n=r[a];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(a)&&i.push(n)}0==i.length&&e.err("No node type or group '"+a+"' found");return i}(e,e.next).map((a=>(null==e.inline?e.inline=a.isInline:e.inline!=a.isInline&&e.err("Mixing inline and block content"),{type:"name",value:a})));return e.pos++,1==a.length?a[0]:{type:"choice",exprs:a}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))a={type:"plus",expr:a};else if(e.eat("*"))a={type:"star",expr:a};else if(e.eat("?"))a={type:"opt",expr:a};else{if(!e.eat("{"))break;a=_c(e,a)}return a}function Mc(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let a=Number(e.next);return e.pos++,a}function _c(e,a){let r=Mc(e),n=r;return e.eat(",")&&(n="}"!=e.next?Mc(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:a}}function Ac(e,a){return a-e}function Dc(e,a){let r=[];return function a(n){let i=e[n];if(1==i.length&&!i[0].term)return a(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:t}=i[e];n||-1!=r.indexOf(t)||a(t)}}(a),r.sort(Ac)}function Tc(e){let a=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;a[r]=n.default}return a}function Nc(e,a){let r=Object.create(null);for(let n in e){let i=a&&a[n];if(void 0===i){let a=e[n];if(!a.hasDefault)throw new RangeError("No value supplied for attribute "+n);i=a.default}r[n]=i}return r}function Ic(e,a,r,n){for(let n in a)if(!(n in e))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in e){let n=e[r];n.validate&&n.validate(a[r])}}function Fc(e,a){let r=Object.create(null);if(a)for(let n in a)r[n]=new Rc(e,n,a[n]);return r}let Pc=class e{constructor(e,a,r){this.name=e,this.schema=a,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fc(e,r.attrs),this.defaultAttrs=Tc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==qc.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:Nc(this.attrs,e)}create(e=null,a,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new jc(this,this.computeAttrs(e),Ql.from(a),nc.setFrom(r))}createChecked(e=null,a,r){return a=Ql.from(a),this.checkContent(a),new jc(this,this.computeAttrs(e),a,nc.setFrom(r))}createAndFill(e=null,a,r){if(e=this.computeAttrs(e),(a=Ql.from(a)).size){let e=this.contentMatch.fillBefore(a);if(!e)return null;a=e.append(a)}let n=this.contentMatch.matchFragment(a),i=n&&n.fillBefore(Ql.empty,!0);return i?new jc(this,e,a.append(i),nc.setFrom(r)):null}validContent(e){let a=this.contentMatch.matchFragment(e);if(!a||!a.validEnd)return!1;for(let a=0;a<e.childCount;a++)if(!this.allowsMarks(e.child(a).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){Ic(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 a=0;a<e.length;a++)if(!this.allowsMarkType(e[a].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let a;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?a&&a.push(e[r]):a||(a=e.slice(0,r));return a?a.length?a:nc.none:e}static compile(a,r){let n=Object.create(null);a.forEach(((a,i)=>n[a]=new e(a,r,i)));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");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 Rc{constructor(e,a,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,a,r){let n=r.split("|");return r=>{let i=null===r?"null":typeof r;if(n.indexOf(i)<0)throw new RangeError(`Expected value of type ${n} for attribute ${a} on type ${e}, got ${i}`)}}(e,a,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Lc{constructor(e,a,r,n){this.name=e,this.rank=a,this.schema=r,this.spec=n,this.attrs=Fc(e,n.attrs),this.excluded=null;let i=Tc(this.attrs);this.instance=i?new nc(this,i):null}create(e=null){return!e&&this.instance?this.instance:new nc(this,Nc(this.attrs,e))}static compile(e,a){let r=Object.create(null),n=0;return e.forEach(((e,i)=>r[e]=new Lc(e,n++,a,i))),r}removeFromSet(e){for(var a=0;a<e.length;a++)e[a].type==this&&(e=e.slice(0,a).concat(e.slice(a+1)),a--);return e}isInSet(e){for(let a=0;a<e.length;a++)if(e[a].type==this)return e[a]}checkAttrs(e){Ic(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Bc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let a=this.spec={};for(let r in e)a[r]=e[r];a.nodes=Jl.from(e.nodes),a.marks=Jl.from(e.marks||{}),this.nodes=Pc.compile(this.spec.nodes,this),this.marks=Lc.compile(this.spec.marks,this);let r=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 a=this.nodes[e],n=a.spec.content||"",i=a.spec.marks;if(a.contentMatch=r[n]||(r[n]=qc.parse(n,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==i?null:i?Vc(this,i.split(" ")):""!=i&&a.inlineContent?null:[]}for(let e in this.marks){let a=this.marks[e],r=a.spec.excludes;a.excluded=null==r?[a]:""==r?[]:Vc(this,r.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,a=null,r,n){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Pc))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(a,r,n)}text(e,a){let r=this.nodes.text;return new xc(r,r.defaultAttrs,e,nc.setFrom(a))}mark(e,a){return"string"==typeof e&&(e=this.marks[e]),e.create(a)}nodeFromJSON(e){return jc.fromJSON(this,e)}markFromJSON(e){return nc.fromJSON(this,e)}nodeType(e){let a=this.nodes[e];if(!a)throw new RangeError("Unknown node type: "+e);return a}}function Vc(e,a){let r=[];for(let n=0;n<a.length;n++){let i=a[n],t=e.marks[i],o=t;if(t)r.push(t);else for(let a in e.marks){let n=e.marks[a];("_"==i||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=n)}if(!o)throw new SyntaxError("Unknown mark type: '"+a[n]+"'")}return r}class Hc{constructor(e,a){this.schema=e,this.rules=a,this.tags=[],this.styles=[];let r=this.matchedStyles=[];a.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let a=/[^=]*/.exec(e.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let r=e.nodes[a.node];return r.contentMatch.matchType(r)}))}parse(e,a={}){let r=new Jc(this,a,!1);return r.addAll(e,nc.none,a.from,a.to),r.finish()}parseSlice(e,a={}){let r=new Jc(this,a,!0);return r.addAll(e,nc.none,a.from,a.to),tc.maxOpen(r.finish())}matchTag(e,a,r){for(let n=r?this.tags.indexOf(r)+1:0;n<this.tags.length;n++){let r=this.tags[n];if(Yc(e,r.tag)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||a.matchesContext(r.context))){if(r.getAttrs){let a=r.getAttrs(e);if(!1===a)continue;r.attrs=a||void 0}return r}}}matchStyle(e,a,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],t=n.style;if(!(0!=t.indexOf(e)||n.context&&!r.matchesContext(n.context)||t.length>e.length&&(61!=t.charCodeAt(e.length)||t.slice(e.length+1)!=a))){if(n.getAttrs){let e=n.getAttrs(a);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let a=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<a.length;n++){let e=a[n];if((null==e.priority?50:e.priority)<r)break}a.splice(n,0,e)}for(let a in e.marks){let n=e.marks[a].spec.parseDOM;n&&n.forEach((e=>{r(e=Xc(e)),e.mark||e.ignore||e.clearMark||(e.mark=a)}))}for(let a in e.nodes){let n=e.nodes[a].spec.parseDOM;n&&n.forEach((e=>{r(e=Xc(e)),e.node||e.ignore||e.mark||(e.node=a)}))}return a}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Hc(e,Hc.schemaRules(e)))}}const Wc={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},Uc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Gc={ol:!0,ul:!0};function Kc(e,a,r){return null!=a?(a?1:0)|("full"===a?2:0):e&&"pre"==e.whitespace?3:-5&r}class Zc{constructor(e,a,r,n,i,t){this.type=e,this.attrs=a,this.marks=r,this.solid=n,this.options=t,this.content=[],this.activeMarks=nc.none,this.match=i||(4&t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let a=this.type.contentMatch.fillBefore(Ql.from(e));if(!a){let a,r=this.type.contentMatch;return(a=r.findWrapping(e.type))?(this.match=r,a):null}this.match=this.type.contentMatch.matchFragment(a)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,a=this.content[this.content.length-1];if(a&&a.isText&&(e=/[ \t\r\n\u000c]+$/.exec(a.text))){let r=a;a.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-e[0].length))}}let a=Ql.from(this.content);return!e&&this.match&&(a=a.append(this.match.fillBefore(Ql.empty,!0))),this.type?this.type.create(this.attrs,a,this.marks):a}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Wc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jc{constructor(e,a,r){this.parser=e,this.options=a,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n,i=a.topNode,t=Kc(null,a.preserveWhitespace,0)|(r?4:0);n=i?new Zc(i.type,i.attrs,nc.none,!0,a.topMatch||i.type.contentMatch,t):new Zc(r?null:e.schema.topNodeType,null,nc.none,!0,null,t),this.nodes=[n],this.find=a.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,a){3==e.nodeType?this.addTextNode(e,a):1==e.nodeType&&this.addElement(e,a)}addTextNode(e,a){let r=e.nodeValue,n=this.top,i=2&n.options?"full":this.localPreserveWS||(1&n.options)>0;if("full"===i||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)r="full"!==i?r.replace(/\r?\n|\r/g," "):r.replace(/\r\n?/g,"\n");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=n.content[n.content.length-1],i=e.previousSibling;(!a||i&&"BR"==i.nodeName||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),a),this.findInText(e)}else this.findInside(e)}addElement(e,a,r){let n=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let t,o=e.nodeName.toLowerCase();Gc.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let a=e.firstChild,r=null;a;a=a.nextSibling){let e=1==a.nodeType?a.nodeName.toLowerCase():null;e&&Gc.hasOwnProperty(e)&&r?(r.appendChild(a),a=r):"li"==e?r=a:e&&(r=null)}}(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(t=this.parser.matchTag(e,this,r));e:if(s?s.ignore:Uc.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,a);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let r,n=this.needsBlock;if(Wc.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),r=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,a);break e}let t=s&&s.skip?a:this.readStyles(e,a);t&&this.addAll(e,t),r&&this.sync(i),this.needsBlock=n}else{let r=this.readStyles(e,a);r&&this.addElementByRule(e,s,r,!1===s.consuming?t:void 0)}this.localPreserveWS=n}leafFallback(e,a){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),a)}ignoreFallback(e,a){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),a)}readStyles(e,a){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],i=r.getPropertyValue(n);if(i)for(let e;;){let r=this.parser.matchStyle(n,i,this,e);if(!r)break;if(r.ignore)return null;if(a=r.clearMark?a.filter((e=>!r.clearMark(e))):a.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;e=r}}return a}addElementByRule(e,a,r,n){let i,t;if(a.node)if(t=this.parser.schema.nodes[a.node],t.isLeaf)this.insertNode(t.create(a.attrs),r)||this.leafFallback(e,r);else{let e=this.enter(t,a.attrs||null,r,a.preserveWhitespace);e&&(i=!0,r=e)}else{let e=this.parser.schema.marks[a.mark];r=r.concat(e.create(a.attrs))}let o=this.top;if(t&&t.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(a.getContent)this.findInside(e),a.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,r)));else{let n=e;"string"==typeof a.contentElement?n=e.querySelector(a.contentElement):"function"==typeof a.contentElement?n=a.contentElement(e):a.contentElement&&(n=a.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}i&&this.sync(o)&&this.open--}addAll(e,a,r,n){let i=r||0;for(let t=r?e.childNodes[r]:e.firstChild,o=null==n?null:e.childNodes[n];t!=o;t=t.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(t,a);this.findAtPoint(e,i)}findPlace(e,a){let r,n;for(let a=this.open;a>=0;a--){let i=this.nodes[a],t=i.findWrapping(e);if(t&&(!r||r.length>t.length)&&(r=t,n=i,!t.length))break;if(i.solid)break}if(!r)return null;this.sync(n);for(let e=0;e<r.length;e++)a=this.enterInner(r[e],null,a,!1);return a}insertNode(e,a){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(a=this.enterInner(e,null,a))}let r=this.findPlace(e,a);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let n=nc.none;for(let i of r.concat(e.marks))(a.type?a.type.allowsMarkType(i.type):Qc(i.type,e.type))&&(n=i.addToSet(n));return a.content.push(e.mark(n)),!0}return!1}enter(e,a,r,n){let i=this.findPlace(e.create(a),r);return i&&(i=this.enterInner(e,a,r,!0,n)),i}enterInner(e,a,r,n=!1,i){this.closeExtra();let t=this.top;t.match=t.match&&t.match.matchType(e);let o=Kc(e,i,t.options);4&t.options&&0==t.content.length&&(o|=4);let s=nc.none;return r=r.filter((a=>!(t.type?t.type.allowsMarkType(a.type):Qc(a.type,e))||(s=a.addToSet(s),!1))),this.nodes.push(new Zc(e,a,s,n,null,o)),this.open++,r}closeExtra(e=!1){let a=this.nodes.length-1;if(a>this.open){for(;a>this.open;a--)this.nodes[a-1].content.push(this.nodes[a].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 a=this.open;a>=0;a--){if(this.nodes[a]==e)return this.open=a,!0;this.localPreserveWS&&(this.nodes[a].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let a=this.open;a>=0;a--){let r=this.nodes[a].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;a&&e++}return e}findAtPoint(e,a){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==a&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let a=0;a<this.find.length;a++)null==this.find[a].pos&&1==e.nodeType&&e.contains(this.find[a].node)&&(this.find[a].pos=this.currentPos)}findAround(e,a,r){if(e!=a&&this.find)for(let n=0;n<this.find.length;n++)if(null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)){a.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}}findInText(e){if(this.find)for(let a=0;a<this.find.length;a++)this.find[a].node==e&&(this.find[a].pos=this.currentPos-(e.nodeValue.length-this.find[a].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let a=e.split("/"),r=this.options.context,n=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(n?0:1),t=(e,o)=>{for(;e>=0;e--){let s=a[e];if(""==s){if(e==a.length-1||0==e)continue;for(;o>=i;o--)if(t(e-1,o))return!0;return!1}{let e=o>0||0==o&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return t(a.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let a=e.depth;a>=0;a--){let r=e.node(a).contentMatchAt(e.indexAfter(a)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let a=this.parser.schema.nodes[e];if(a.isTextblock&&a.defaultAttrs)return a}}}function Yc(e,a){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,a)}function Xc(e){let a={};for(let r in e)a[r]=e[r];return a}function Qc(e,a){let r=a.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let t=[],o=e=>{t.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:i}=e.edge(r);if(n==a)return!0;if(t.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class ed{constructor(e,a){this.nodes=e,this.marks=a}serializeFragment(e,a={},r){r||(r=rd(a).createDocumentFragment());let n=r,i=[];return e.forEach((e=>{if(i.length||e.marks.length){let r=0,t=0;for(;r<i.length&&t<e.marks.length;){let a=e.marks[t];if(this.marks[a.type.name]){if(!a.eq(i[r][0])||!1===a.type.spec.spanning)break;r++,t++}else t++}for(;r<i.length;)n=i.pop()[1];for(;t<e.marks.length;){let r=e.marks[t++],o=this.serializeMark(r,e.isInline,a);o&&(i.push([r,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(e,a))})),r}serializeNodeInner(e,a){let{dom:r,contentDOM:n}=td(rd(a),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,a,n)}return r}serializeNode(e,a={}){let r=this.serializeNodeInner(e,a);for(let n=e.marks.length-1;n>=0;n--){let i=this.serializeMark(e.marks[n],e.isInline,a);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,a,r={}){let n=this.marks[e.type.name];return n&&td(rd(r),n(e,a),null,e.attrs)}static renderSpec(e,a,r=null,n){return td(e,a,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ed(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let a=ad(e.nodes);return a.text||(a.text=e=>e.text),a}static marksFromSchema(e){return ad(e.marks)}}function ad(e){let a={};for(let r in e){let n=e[r].spec.toDOM;n&&(a[r]=n)}return a}function rd(e){return e.document||window.document}const nd=new WeakMap;function id(e){let a=nd.get(e);return void 0===a&&nd.set(e,a=function(e){let a=null;function r(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])a||(a=[]),a.push(e);else for(let a=0;a<e.length;a++)r(e[a]);else for(let a in e)r(e[a])}return r(e),a}(e)),a}function td(e,a,r,n){if("string"==typeof a)return{dom:e.createTextNode(a)};if(null!=a.nodeType)return{dom:a};if(a.dom&&null!=a.dom.nodeType)return a;let i,t=a[0];if("string"!=typeof t)throw new RangeError("Invalid array passed to renderSpec");if(n&&(i=id(n))&&i.indexOf(a)>-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 o,s=t.indexOf(" ");s>0&&(r=t.slice(0,s),t=t.slice(s+1));let l=r?e.createElementNS(r,t):e.createElement(t),c=a[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let a=e.indexOf(" ");a>0?l.setAttributeNS(e.slice(0,a),e.slice(a+1),c[e]):l.setAttribute(e,c[e])}}for(let i=d;i<a.length;i++){let t=a[i];if(0===t){if(i<a.length-1||i>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:a,contentDOM:i}=td(e,t,r,n);if(l.appendChild(a),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:l,contentDOM:o}}const od=Math.pow(2,16);function sd(e,a){return e+a*od}function ld(e){return 65535&e}class cd{constructor(e,a,r){this.pos=e,this.delInfo=a,this.recover=r}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 dd{constructor(e,a=!1){if(this.ranges=e,this.inverted=a,!e.length&&dd.empty)return dd.empty}recover(e){let a=0,r=ld(e);if(!this.inverted)for(let e=0;e<r;e++)a+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+a+function(e){return(e-(65535&e))/od}(e)}mapResult(e,a=1){return this._map(e,a,!1)}map(e,a=1){return this._map(e,a,!0)}_map(e,a,r){let n=0,i=this.inverted?2:1,t=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[o+i],c=this.ranges[o+t],d=s+l;if(e<=d){let i=s+n+((l?e==s?-1:e==d?1:a:a)<0?0:c);if(r)return i;let t=e==(a<0?s:d)?null:sd(o/3,e-s),u=e==s?2:e==d?1:4;return(a<0?e!=s:e!=d)&&(u|=8),new cd(i,u,t)}n+=c-l}return r?e+n:new cd(e+n,0,null)}touches(e,a){let r=0,n=ld(a),i=this.inverted?2:1,t=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let o=this.ranges[a]-(this.inverted?r:0);if(o>e)break;let s=this.ranges[a+i];if(e<=o+s&&a==3*n)return!0;r+=this.ranges[a+t]-s}return!1}forEach(e){let a=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let t=this.ranges[n],o=t-(this.inverted?i:0),s=t+(this.inverted?0:i),l=this.ranges[n+a],c=this.ranges[n+r];e(o,o+l,s,s+c),i+=c-l}}invert(){return new dd(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?dd.empty:new dd(e<0?[0,-e,0]:[0,0,e])}}dd.empty=new dd([]);class ud{constructor(e=[],a,r=0,n=e.length){this.maps=e,this.mirror=a,this.from=r,this.to=n}slice(e=0,a=this.maps.length){return new ud(this.maps,this.mirror,e,a)}copy(){return new ud(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,a){this.to=this.maps.push(e),null!=a&&this.setMirror(this.maps.length-1,a)}appendMapping(e){for(let a=0,r=this.maps.length;a<e.maps.length;a++){let n=e.getMirror(a);this.appendMap(e.maps[a],null!=n&&n<a?r+n:void 0)}}getMirror(e){if(this.mirror)for(let a=0;a<this.mirror.length;a++)if(this.mirror[a]==e)return this.mirror[a+(a%2?-1:1)]}setMirror(e,a){this.mirror||(this.mirror=[]),this.mirror.push(e,a)}appendMappingInverted(e){for(let a=e.maps.length-1,r=this.maps.length+e.maps.length;a>=0;a--){let n=e.getMirror(a);this.appendMap(e.maps[a].invert(),null!=n&&n>a?r-n-1:void 0)}}invert(){let e=new ud;return e.appendMappingInverted(this),e}map(e,a=1){if(this.mirror)return this._map(e,a,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,a);return e}mapResult(e,a=1){return this._map(e,a,!1)}_map(e,a,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this.maps[r].mapResult(e,a);if(null!=i.recover){let a=this.getMirror(r);if(null!=a&&a>r&&a<this.to){r=a,e=this.maps[a].recover(i.recover);continue}}n|=i.delInfo,e=i.pos}return r?e:new cd(e,n,null)}}const hd=Object.create(null);class md{getMap(){return dd.empty}merge(e){return null}static fromJSON(e,a){if(!a||!a.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=hd[a.stepType];if(!r)throw new RangeError(`No step type ${a.stepType} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in hd)throw new RangeError("Duplicate use of step JSON ID "+e);return hd[e]=a,a.prototype.jsonID=e,a}}class gd{constructor(e,a){this.doc=e,this.failed=a}static ok(e){return new gd(e,null)}static fail(e){return new gd(null,e)}static fromReplace(e,a,r,n){try{return gd.ok(e.replace(a,r,n))}catch(e){if(e instanceof ic)return gd.fail(e.message);throw e}}}function pd(e,a,r){let n=[];for(let i=0;i<e.childCount;i++){let t=e.child(i);t.content.size&&(t=t.copy(pd(t.content,a,t))),t.isInline&&(t=a(t,r,i)),n.push(t)}return Ql.fromArray(n)}class bd extends md{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.node(r.sharedDepth(this.to)),i=new tc(pd(a.content,((e,a)=>e.isAtom&&a.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),n),a.openStart,a.openEnd);return gd.fromReplace(e,this.from,this.to,i)}invert(){return new fd(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new bd(a.pos,r.pos,this.mark)}merge(e){return e instanceof bd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bd(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,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new bd(a.from,a.to,e.markFromJSON(a.mark))}}md.jsonID("addMark",bd);class fd extends md{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=new tc(pd(a.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),a.openStart,a.openEnd);return gd.fromReplace(e,this.from,this.to,r)}invert(){return new bd(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new fd(a.pos,r.pos,this.mark)}merge(e){return e instanceof fd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fd(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,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fd(a.from,a.to,e.markFromJSON(a.mark))}}md.jsonID("removeMark",fd);class kd extends md{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return gd.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.addToSet(a.marks));return gd.fromReplace(e,this.pos,this.pos+1,new tc(Ql.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);if(a){let e=this.mark.addToSet(a.marks);if(e.length==a.marks.length){for(let r=0;r<a.marks.length;r++)if(!a.marks[r].isInSet(e))return new kd(this.pos,a.marks[r]);return new kd(this.pos,this.mark)}}return new yd(this.pos,this.mark)}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new kd(a.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new kd(a.pos,e.markFromJSON(a.mark))}}md.jsonID("addNodeMark",kd);class yd extends md{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return gd.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.removeFromSet(a.marks));return gd.fromReplace(e,this.pos,this.pos+1,new tc(Ql.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);return a&&this.mark.isInSet(a.marks)?new kd(this.pos,this.mark):this}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new yd(a.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yd(a.pos,e.markFromJSON(a.mark))}}md.jsonID("removeNodeMark",yd);class vd extends md{constructor(e,a,r,n=!1){super(),this.from=e,this.to=a,this.slice=r,this.structure=n}apply(e){return this.structure&&zd(e,this.from,this.to)?gd.fail("Structure replace would overwrite content"):gd.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dd([this.from,this.to-this.from,this.slice.size])}invert(e){return new vd(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deletedAcross&&r.deletedAcross?null:new vd(a.pos,Math.max(a.pos,r.pos),this.slice)}merge(e){if(!(e instanceof vd)||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 a=this.slice.size+e.slice.size==0?tc.empty:new tc(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new vd(e.from,this.to,a,this.structure)}}{let a=this.slice.size+e.slice.size==0?tc.empty:new tc(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new vd(this.from,this.to+(e.to-e.from),a,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,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new vd(a.from,a.to,tc.fromJSON(e,a.slice),!!a.structure)}}md.jsonID("replace",vd);class wd extends md{constructor(e,a,r,n,i,t,o=!1){super(),this.from=e,this.to=a,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=t,this.structure=o}apply(e){if(this.structure&&(zd(e,this.from,this.gapFrom)||zd(e,this.gapTo,this.to)))return gd.fail("Structure gap-replace would overwrite content");let a=e.slice(this.gapFrom,this.gapTo);if(a.openStart||a.openEnd)return gd.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,a.content);return r?gd.fromReplace(e,this.from,this.to,r):gd.fail("Content does not fit in gap")}getMap(){return new dd([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let a=this.gapTo-this.gapFrom;return new wd(this.from,this.from+this.slice.size+a,this.from+this.insert,this.from+this.insert+a,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),n=this.from==this.gapFrom?a.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return a.deletedAcross&&r.deletedAcross||n<a.pos||i>r.pos?null:new wd(a.pos,r.pos,n,i,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,a){if("number"!=typeof a.from||"number"!=typeof a.to||"number"!=typeof a.gapFrom||"number"!=typeof a.gapTo||"number"!=typeof a.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new wd(a.from,a.to,a.gapFrom,a.gapTo,tc.fromJSON(e,a.slice),a.insert,!!a.structure)}}function zd(e,a,r){let n=e.resolve(a),i=r-a,t=n.depth;for(;i>0&&t>0&&n.indexAfter(t)==n.node(t).childCount;)t--,i--;if(i>0){let e=n.node(t).maybeChild(n.indexAfter(t));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function jd(e,a,r,n=r.contentMatch,i=!0){let t=e.doc.nodeAt(a),o=[],s=a+1;for(let a=0;a<t.childCount;a++){let l=t.child(a),c=s+l.nodeSize,d=n.matchType(l.type);if(d){n=d;for(let a=0;a<l.marks.length;a++)r.allowsMarkType(l.marks[a].type)||e.step(new fd(s,c,l.marks[a]));if(i&&l.isText&&"pre"!=r.whitespace){let e,a,n=/\r?\n|\r/g;for(;e=n.exec(l.text);)a||(a=new tc(Ql.from(r.schema.text(" ",r.allowedMarks(l.marks))),0,0)),o.push(new vd(s+e.index,s+e.index+e[0].length,a))}}else o.push(new vd(s,c,tc.empty));s=c}if(!n.validEnd){let a=n.fillBefore(Ql.empty,!0);e.replace(s,s,new tc(a,0,0))}for(let a=o.length-1;a>=0;a--)e.step(o[a])}function xd(e,a,r){return(0==a||e.canReplace(a,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function $d(e){let a=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let n=e.$from.node(r),i=e.$from.index(r),t=e.$to.indexAfter(r);if(r<e.depth&&n.canReplace(i,t,a))return r;if(0==r||n.type.spec.isolating||!xd(n,i,t))break}return null}function qd(e,a,r=null,n=e){let i=function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.contentMatchAt(n).findWrapping(a);if(!t)return null;let o=t.length?t[0]:a;return r.canReplaceWith(n,i,o)?t:null}(e,a),t=i&&function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.child(n),o=a.contentMatch.findWrapping(t.type);if(!o)return null;let s=(o.length?o[o.length-1]:a).contentMatch;for(let e=n;s&&e<i;e++)s=s.matchType(r.child(e).type);return s&&s.validEnd?o:null}(n,a);return t?i.map(Cd).concat({type:a,attrs:r}).concat(t.map(Cd)):null}function Cd(e){return{type:e,attrs:null}}function Sd(e,a,r,n){a.forEach(((i,t)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(n).map(r+1+t+o.index);e.replaceWith(i,i+1,a.type.schema.linebreakReplacement.create())}}}))}function Od(e,a,r,n){a.forEach(((i,t)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+t);e.replaceWith(i,i+1,a.type.schema.text("\n"))}}))}function Ed(e,a,r=1,n){let i=e.resolve(a),t=i.depth-r,o=n&&n[n.length-1]||i.parent;if(t<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,a=r-2;e>t;e--,a--){let r=i.node(e),t=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(t,r.childCount),s=n&&n[a+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let l=n&&n[a]||r;if(!r.canReplace(t+1,r.childCount)||!l.type.validContent(o))return!1}let s=i.indexAfter(t),l=n&&n[0];return i.node(t).canReplaceWith(s,s,l?l.type:i.node(t+1).type)}function Md(e,a){let r=e.resolve(a),n=r.index();return _d(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function _d(e,a){return!(!e||!a||e.isLeaf||!function(e,a){a.content.size||e.type.compatibleContent(a.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<a.childCount;i++){let t=a.child(i),o=t.type==n?e.type.schema.nodes.text:t.type;if(r=r.matchType(o),!r)return!1;if(!e.type.allowsMarks(t.marks))return!1}return r.validEnd}(e,a))}function Ad(e,a,r=-1){let n=e.resolve(a);for(let e=n.depth;;e--){let i,t,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,t=n.nodeAfter):r>0?(i=n.node(e+1),o++,t=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),t=n.node(e+1)),i&&!i.isTextblock&&_d(i,t)&&n.node(e).canReplace(o,o+1))return a;if(0==e)break;a=r<0?n.before(e):n.after(e)}}function Dd(e,a,r){let n=e.resolve(a);if(!r.content.size)return a;let i=r.content;for(let e=0;e<r.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==r.openStart&&r.size?2:1);e++)for(let a=n.depth;a>=0;a--){let r=a==n.depth?0:n.pos<=(n.start(a+1)+n.end(a+1))/2?-1:1,t=n.index(a)+(r>0?1:0),o=n.node(a),s=!1;if(1==e)s=o.canReplace(t,t,i);else{let e=o.contentMatchAt(t).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(t,t,e[0])}if(s)return 0==r?n.pos:r<0?n.before(a+1):n.after(a+1)}return null}function Td(e,a,r=a,n=tc.empty){if(a==r&&!n.size)return null;let i=e.resolve(a),t=e.resolve(r);return Nd(i,t,n)?new vd(a,r,n):new Id(i,t,n).fit()}function Nd(e,a,r){return!r.openStart&&!r.openEnd&&e.start()==a.start()&&e.parent.canReplace(e.index(),a.index(),r.content)}md.jsonID("replaceAround",wd);class Id{constructor(e,a,r){this.$from=e,this.$to=a,this.unplaced=r,this.frontier=[],this.placed=Ql.empty;for(let a=0;a<=e.depth;a++){let r=e.node(a);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Ql.from(e.node(a).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(),a=this.placed.size-this.depth-this.$from.depth,r=this.$from,n=this.close(e<0?this.$to:r.doc.resolve(e));if(!n)return null;let i=this.placed,t=r.depth,o=n.depth;for(;t&&o&&1==i.childCount;)i=i.firstChild.content,t--,o--;let s=new tc(i,t,o);return e>-1?new wd(r.pos,e,this.$to.pos,this.$to.end(),s,a):s.size||r.pos!=this.$to.pos?new vd(r.pos,n.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let a=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<e;r++){let i=a.firstChild;if(a.childCount>1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}a=i.content}for(let a=1;a<=2;a++)for(let r=1==a?e:this.unplaced.openStart;r>=0;r--){let e,n=null;r?(n=Rd(this.unplaced.content,r-1).firstChild,e=n.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let t,{type:o,match:s}=this.frontier[e],l=null;if(1==a&&(i?s.matchType(i.type)||(l=s.fillBefore(Ql.from(i),!1)):n&&o.compatibleContent(n.type)))return{sliceDepth:r,frontierDepth:e,parent:n,inject:l};if(2==a&&i&&(t=s.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:e,parent:n,wrap:t};if(n&&s.matchType(n.type))break}}}openMore(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Rd(e,a);return!(!n.childCount||n.firstChild.isLeaf)&&(this.unplaced=new tc(e,a+1,Math.max(r,n.size+a>=e.size-r?a+1:0)),!0)}dropNode(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Rd(e,a);if(n.childCount<=1&&a>0){let i=e.size-a<=a+n.size;this.unplaced=new tc(Fd(e,a-1,1),a-1,i?a-1:r)}else this.unplaced=new tc(Fd(e,a,1),a,r)}placeNodes({sliceDepth:e,frontierDepth:a,parent:r,inject:n,wrap:i}){for(;this.depth>a;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let t=this.unplaced,o=r?r.content:t.content,s=t.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[a];if(n){for(let e=0;e<n.childCount;e++)c.push(n.child(e));d=d.matchFragment(n)}let h=o.size+e-(t.content.size-t.openEnd);for(;l<o.childCount;){let e=o.child(l),a=d.matchType(e.type);if(!a)break;l++,(l>1||0==s||e.content.size)&&(d=a,c.push(Ld(e.mark(u.allowedMarks(e.marks)),1==l?s:0,l==o.childCount?h:-1)))}let m=l==o.childCount;m||(h=-1),this.placed=Pd(this.placed,a,Ql.from(c)),this.frontier[a].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,a=o;e<h;e++){let e=a.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),a=e.content}this.unplaced=m?0==e?tc.empty:new tc(Fd(t.content,e-1,1),e-1,h<0?t.openEnd:e-1):new tc(Fd(t.content,e,l),t.openStart,t.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,a=this.frontier[this.depth];if(!a.type.isTextblock||!Bd(this.$to,this.$to.depth,a.type,a.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){e:for(let a=Math.min(this.depth,e.depth);a>=0;a--){let{match:r,type:n}=this.frontier[a],i=a<e.depth&&e.end(a+1)==e.pos+(e.depth-(a+1)),t=Bd(e,a,n,r,i);if(t){for(let r=a-1;r>=0;r--){let{match:a,type:n}=this.frontier[r],i=Bd(e,r,n,a,!0);if(!i||i.childCount)continue e}return{depth:a,fit:t,move:i?e.doc.resolve(e.after(a+1)):e}}}}close(e){let a=this.findCloseLevel(e);if(!a)return null;for(;this.depth>a.depth;)this.closeFrontierNode();a.fit.childCount&&(this.placed=Pd(this.placed,a.depth,a.fit)),e=a.move;for(let r=a.depth+1;r<=e.depth;r++){let a=e.node(r),n=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,n)}return e}openFrontierNode(e,a=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=Pd(this.placed,this.depth,Ql.from(e.create(a,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Ql.empty,!0);e.childCount&&(this.placed=Pd(this.placed,this.frontier.length,e))}}function Fd(e,a,r){return 0==a?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Fd(e.firstChild.content,a-1,r)))}function Pd(e,a,r){return 0==a?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(Pd(e.lastChild.content,a-1,r)))}function Rd(e,a){for(let r=0;r<a;r++)e=e.firstChild.content;return e}function Ld(e,a,r){if(a<=0)return e;let n=e.content;return a>1&&(n=n.replaceChild(0,Ld(n.firstChild,a-1,1==n.childCount?r-1:0))),a>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(Ql.empty,!0)))),e.copy(n)}function Bd(e,a,r,n,i){let t=e.node(a),o=i?e.indexAfter(a):e.index(a);if(o==t.childCount&&!r.compatibleContent(t.type))return null;let s=n.fillBefore(t.content,!0,o);return s&&!function(e,a,r){for(let n=r;n<a.childCount;n++)if(!e.allowsMarks(a.child(n).marks))return!0;return!1}(r,t.content,o)?s:null}function Vd(e,a,r,n,i){if(a<r){let i=e.firstChild;e=e.replaceChild(0,i.copy(Vd(i.content,a+1,r,n,i)))}if(a>n){let a=i.contentMatchAt(0),r=a.fillBefore(e).append(e);e=r.append(a.matchFragment(r).fillBefore(Ql.empty,!0))}return e}function Hd(e,a){let r=[];for(let n=Math.min(e.depth,a.depth);n>=0;n--){let i=e.start(n);if(i<e.pos-(e.depth-n)||a.end(n)>a.pos+(a.depth-n)||e.node(n).type.spec.isolating||a.node(n).type.spec.isolating)break;(i==a.start(n)||n==e.depth&&n==a.depth&&e.parent.inlineContent&&a.parent.inlineContent&&n&&a.start(n-1)==i-1)&&r.push(n)}return r}class Wd extends md{constructor(e,a,r){super(),this.pos=e,this.attr=a,this.value=r}apply(e){let a=e.nodeAt(this.pos);if(!a)return gd.fail("No node at attribute step's position");let r=Object.create(null);for(let e in a.attrs)r[e]=a.attrs[e];r[this.attr]=this.value;let n=a.type.create(r,null,a.marks);return gd.fromReplace(e,this.pos,this.pos+1,new tc(Ql.from(n),0,a.isLeaf?0:1))}getMap(){return dd.empty}invert(e){return new Wd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new Wd(a.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,a){if("number"!=typeof a.pos||"string"!=typeof a.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wd(a.pos,a.attr,a.value)}}md.jsonID("attr",Wd);class Ud extends md{constructor(e,a){super(),this.attr=e,this.value=a}apply(e){let a=Object.create(null);for(let r in e.attrs)a[r]=e.attrs[r];a[this.attr]=this.value;let r=e.type.create(a,e.content,e.marks);return gd.ok(r)}getMap(){return dd.empty}invert(e){return new Ud(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,a){if("string"!=typeof a.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ud(a.attr,a.value)}}md.jsonID("docAttr",Ud);let Gd=class extends Error{};Gd=function e(a){let r=Error.call(this,a);return r.__proto__=e.prototype,r},(Gd.prototype=Object.create(Error.prototype)).constructor=Gd,Gd.prototype.name="TransformError";class Kd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ud}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let a=this.maybeStep(e);if(a.failed)throw new Gd(a.failed);return this}maybeStep(e){let a=e.apply(this.doc);return a.failed||this.addStep(e,a.doc),a}get docChanged(){return this.steps.length>0}addStep(e,a){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=a}replace(e,a=e,r=tc.empty){let n=Td(this.doc,e,a,r);return n&&this.step(n),this}replaceWith(e,a,r){return this.replace(e,a,new tc(Ql.from(r),0,0))}delete(e,a){return this.replace(e,a,tc.empty)}insert(e,a){return this.replaceWith(e,e,a)}replaceRange(e,a,r){return function(e,a,r,n){if(!n.size)return e.deleteRange(a,r);let i=e.doc.resolve(a),t=e.doc.resolve(r);if(Nd(i,t,n))return e.step(new vd(a,r,n));let o=Hd(i,e.doc.resolve(r));0==o[o.length-1]&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,a=i.pos-1;e>0;e--,a--){let r=i.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==a&&o.splice(1,0,-e)}let l=o.indexOf(s),c=[],d=n.openStart;for(let e=n.content,a=0;;a++){let r=e.firstChild;if(c.push(r),a==n.openStart)break;e=r.content}for(let e=d-1;e>=0;e--){let a=c[e],r=(u=a.type).spec.defining||u.spec.definingForContent;if(r&&!a.sameMarkup(i.node(Math.abs(s)-1)))d=e;else if(r||!a.type.isTextblock)break}var u;for(let a=n.openStart;a>=0;a--){let s=(a+d+1)%(n.openStart+1),u=c[s];if(u)for(let a=0;a<o.length;a++){let c=o[(a+l)%o.length],d=!0;c<0&&(d=!1,c=-c);let h=i.node(c-1),m=i.index(c-1);if(h.canReplaceWith(m,m,u.type,u.marks))return e.replace(i.before(c),d?t.after(c):r,new tc(Vd(n.content,0,n.openStart,s),s,n.openEnd))}}let h=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(a,r,n),!(e.steps.length>h));s--){let e=o[s];e<0||(a=i.before(e),r=t.after(e))}}(this,e,a,r),this}replaceRangeWith(e,a,r){return function(e,a,r,n){if(!n.isInline&&a==r&&e.doc.resolve(a).parent.content.size){let i=function(e,a,r){let n=e.resolve(a);if(n.parent.canReplaceWith(n.index(),n.index(),r))return a;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let a=n.index(e);if(n.node(e).canReplaceWith(a,a,r))return n.before(e+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let a=n.indexAfter(e);if(n.node(e).canReplaceWith(a,a,r))return n.after(e+1);if(a<n.node(e).childCount)return null}return null}(e.doc,a,n.type);null!=i&&(a=r=i)}e.replaceRange(a,r,new tc(Ql.from(n),0,0))}(this,e,a,r),this}deleteRange(e,a){return function(e,a,r){let n=e.doc.resolve(a),i=e.doc.resolve(r),t=Hd(n,i);for(let a=0;a<t.length;a++){let r=t[a],o=a==t.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return e.delete(n.start(r),i.end(r));if(r>0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let t=1;t<=n.depth&&t<=i.depth;t++)if(a-n.start(t)==n.depth-t&&r>n.end(t)&&i.end(t)-r!=i.depth-t&&n.start(t-1)==i.start(t-1)&&n.node(t-1).canReplace(n.index(t-1),i.index(t-1)))return e.delete(n.before(t),r);e.delete(a,r)}(this,e,a),this}lift(e,a){return function(e,a,r){let{$from:n,$to:i,depth:t}=a,o=n.before(t+1),s=i.after(t+1),l=o,c=s,d=Ql.empty,u=0;for(let e=t,a=!1;e>r;e--)a||n.index(e)>0?(a=!0,d=Ql.from(n.node(e).copy(d)),u++):l--;let h=Ql.empty,m=0;for(let e=t,a=!1;e>r;e--)a||i.after(e+1)<i.end(e)?(a=!0,h=Ql.from(i.node(e).copy(h)),m++):c++;e.step(new wd(l,c,o,s,new tc(d.append(h),u,m),d.size-u,!0))}(this,e,a),this}join(e,a=1){return function(e,a,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,t=e.doc.resolve(a-r),o=t.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,a=!!o.contentMatch.matchType(i);e&&!a?n=!1:!e&&a&&(n=!0)}let s=e.steps.length;if(!1===n){let n=e.doc.resolve(a+r);Od(e,n.node(),n.before(),s)}o.inlineContent&&jd(e,a+r-1,o,t.node().contentMatchAt(t.index()),null==n);let l=e.mapping.slice(s),c=l.map(a-r);if(e.step(new vd(c,l.map(a+r,-1),tc.empty,!0)),!0===n){let a=e.doc.resolve(c);Sd(e,a.node(),a.before(),e.steps.length)}}(this,e,a),this}wrap(e,a){return function(e,a,r){let n=Ql.empty;for(let e=r.length-1;e>=0;e--){if(n.size){let a=r[e].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Ql.from(r[e].type.create(r[e].attrs,n))}let i=a.start,t=a.end;e.step(new wd(i,t,i,t,new tc(n,0,0),r.length,!0))}(this,e,a),this}setBlockType(e,a=e,r,n=null){return function(e,a,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let t=e.steps.length;e.doc.nodesBetween(a,r,((a,r)=>{let o="function"==typeof i?i(a):i;if(a.isTextblock&&!a.hasMarkup(n,o)&&function(e,a,r){let n=e.resolve(a),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}(e.doc,e.mapping.slice(t).map(r),n)){let i=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,a=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!a?i=!1:!e&&a&&(i=!0)}!1===i&&Od(e,a,r,t),jd(e,e.mapping.slice(t).map(r,1),n,void 0,null===i);let s=e.mapping.slice(t),l=s.map(r,1),c=s.map(r+a.nodeSize,1);return e.step(new wd(l,c,l+1,c-1,new tc(Ql.from(n.create(o,null,a.marks)),0,0),1,!0)),!0===i&&Sd(e,a,r,t),!1}}))}(this,e,a,r,n),this}setNodeMarkup(e,a,r=null,n){return function(e,a,r,n,i){let t=e.doc.nodeAt(a);if(!t)throw new RangeError("No node at given position");r||(r=t.type);let o=r.create(n,null,i||t.marks);if(t.isLeaf)return e.replaceWith(a,a+t.nodeSize,o);if(!r.validContent(t.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new wd(a,a+t.nodeSize,a+1,a+t.nodeSize-1,new tc(Ql.from(o),0,0),1,!0))}(this,e,a,r,n),this}setNodeAttribute(e,a,r){return this.step(new Wd(e,a,r)),this}setDocAttribute(e,a){return this.step(new Ud(e,a)),this}addNodeMark(e,a){return this.step(new kd(e,a)),this}removeNodeMark(e,a){if(!(a instanceof nc)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(!(a=a.isInSet(r.marks)))return this}return this.step(new yd(e,a)),this}split(e,a=1,r){return function(e,a,r=1,n){let i=e.doc.resolve(a),t=Ql.empty,o=Ql.empty;for(let e=i.depth,a=i.depth-r,s=r-1;e>a;e--,s--){t=Ql.from(i.node(e).copy(t));let a=n&&n[s];o=Ql.from(a?a.type.create(a.attrs,o):i.node(e).copy(o))}e.step(new vd(a,a,new tc(t.append(o),r,r),!0))}(this,e,a,r),this}addMark(e,a,r){return function(e,a,r,n){let i,t,o=[],s=[];e.doc.nodesBetween(a,r,((e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,a),u=Math.min(l+e.nodeSize,r),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:o.push(i=new fd(c,u,d[e])));t&&t.to==c?t.to=u:s.push(t=new bd(c,u,n))}})),o.forEach((a=>e.step(a))),s.forEach((a=>e.step(a)))}(this,e,a,r),this}removeMark(e,a,r){return function(e,a,r,n){let i=[],t=0;e.doc.nodesBetween(a,r,((e,o)=>{if(!e.isInline)return;t++;let s=null;if(n instanceof Lc){let a,r=e.marks;for(;a=n.isInSet(r);)(s||(s=[])).push(a),r=a.removeFromSet(r)}else n?n.isInSet(e.marks)&&(s=[n]):s=e.marks;if(s&&s.length){let n=Math.min(o+e.nodeSize,r);for(let e=0;e<s.length;e++){let r,l=s[e];for(let e=0;e<i.length;e++){let a=i[e];a.step==t-1&&l.eq(i[e].style)&&(r=a)}r?(r.to=n,r.step=t):i.push({style:l,from:Math.max(o,a),to:n,step:t})}}})),i.forEach((a=>e.step(new fd(a.from,a.to,a.style))))}(this,e,a,r),this}clearIncompatible(e,a,r){return jd(this,e,a,r),this}}const Zd=Object.create(null);class Jd{constructor(e,a,r){this.$anchor=e,this.$head=a,this.ranges=r||[new Yd(e.min(a),e.max(a))]}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 a=0;a<e.length;a++)if(e[a].$from.pos!=e[a].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,a=tc.empty){let r=a.content.lastChild,n=null;for(let e=0;e<a.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,t=this.ranges;for(let o=0;o<t.length;o++){let{$from:s,$to:l}=t[o],c=e.mapping.slice(i);e.replaceRange(c.map(s.pos),c.map(l.pos),o?tc.empty:a),0==o&&su(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,a){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:t,$to:o}=n[i],s=e.mapping.slice(r),l=s.map(t.pos),c=s.map(o.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,a),su(e,r,a.isInline?-1:1))}}static findFrom(e,a,r=!1){let n=e.parent.inlineContent?new eu(e):ou(e.node(0),e.parent,e.pos,e.index(),a,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=a<0?ou(e.node(0),e.node(n),e.before(n+1),e.index(n),a,r):ou(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,a,r);if(i)return i}return null}static near(e,a=1){return this.findFrom(e,a)||this.findFrom(e,-a)||new iu(e.node(0))}static atStart(e){return ou(e,e,0,0,1)||new iu(e)}static atEnd(e){return ou(e,e,e.content.size,e.childCount,-1)||new iu(e)}static fromJSON(e,a){if(!a||!a.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Zd[a.type];if(!r)throw new RangeError(`No selection type ${a.type} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in Zd)throw new RangeError("Duplicate use of selection JSON ID "+e);return Zd[e]=a,a.prototype.jsonID=e,a}getBookmark(){return eu.between(this.$anchor,this.$head).getBookmark()}}Jd.prototype.visible=!0;class Yd{constructor(e,a){this.$from=e,this.$to=a}}let Xd=!1;function Qd(e){Xd||e.parent.inlineContent||(Xd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eu extends Jd{constructor(e,a=e){Qd(e),Qd(a),super(e,a)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,a){let r=e.resolve(a.map(this.head));if(!r.parent.inlineContent)return Jd.near(r);let n=e.resolve(a.map(this.anchor));return new eu(n.parent.inlineContent?n:r,r)}replace(e,a=tc.empty){if(super.replace(e,a),a==tc.empty){let a=this.$from.marksAcross(this.$to);a&&e.ensureMarks(a)}}eq(e){return e instanceof eu&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new au(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,a){if("number"!=typeof a.anchor||"number"!=typeof a.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new eu(e.resolve(a.anchor),e.resolve(a.head))}static create(e,a,r=a){let n=e.resolve(a);return new this(n,r==a?n:e.resolve(r))}static between(e,a,r){let n=e.pos-a.pos;if(r&&!n||(r=n>=0?1:-1),!a.parent.inlineContent){let e=Jd.findFrom(a,r,!0)||Jd.findFrom(a,-r,!0);if(!e)return Jd.near(a,r);a=e.$head}return e.parent.inlineContent||(0==n||(e=(Jd.findFrom(e,-r,!0)||Jd.findFrom(e,r,!0)).$anchor).pos<a.pos!=n<0)&&(e=a),new eu(e,a)}}Jd.jsonID("text",eu);class au{constructor(e,a){this.anchor=e,this.head=a}map(e){return new au(e.map(this.anchor),e.map(this.head))}resolve(e){return eu.between(e.resolve(this.anchor),e.resolve(this.head))}}class ru extends Jd{constructor(e){let a=e.nodeAfter,r=e.node(0).resolve(e.pos+a.nodeSize);super(e,r),this.node=a}map(e,a){let{deleted:r,pos:n}=a.mapResult(this.anchor),i=e.resolve(n);return r?Jd.near(i):new ru(i)}content(){return new tc(Ql.from(this.node),0,0)}eq(e){return e instanceof ru&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new nu(this.anchor)}static fromJSON(e,a){if("number"!=typeof a.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ru(e.resolve(a.anchor))}static create(e,a){return new ru(e.resolve(a))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}ru.prototype.visible=!1,Jd.jsonID("node",ru);class nu{constructor(e){this.anchor=e}map(e){let{deleted:a,pos:r}=e.mapResult(this.anchor);return a?new au(r,r):new nu(r)}resolve(e){let a=e.resolve(this.anchor),r=a.nodeAfter;return r&&ru.isSelectable(r)?new ru(a):Jd.near(a)}}class iu extends Jd{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,a=tc.empty){if(a==tc.empty){e.delete(0,e.doc.content.size);let a=Jd.atStart(e.doc);a.eq(e.selection)||e.setSelection(a)}else super.replace(e,a)}toJSON(){return{type:"all"}}static fromJSON(e){return new iu(e)}map(e){return new iu(e)}eq(e){return e instanceof iu}getBookmark(){return tu}}Jd.jsonID("all",iu);const tu={map(){return this},resolve:e=>new iu(e)};function ou(e,a,r,n,i,t=!1){if(a.inlineContent)return eu.create(e,r);for(let o=n-(i>0?0:1);i>0?o<a.childCount:o>=0;o+=i){let n=a.child(o);if(n.isAtom){if(!t&&ru.isSelectable(n))return ru.create(e,r-(i<0?n.nodeSize:0))}else{let a=ou(e,n,r+i,i<0?n.childCount:0,i,t);if(a)return a}r+=n.nodeSize*i}return null}function su(e,a,r){let n=e.steps.length-1;if(n<a)return;let i,t=e.steps[n];(t instanceof vd||t instanceof wd)&&(e.mapping.maps[n].forEach(((e,a,r,n)=>{null==i&&(i=n)})),e.setSelection(Jd.near(e.doc.resolve(i),r)))}class lu extends Kd{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 nc.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,a){super.addStep(e,a),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,a=!0){let r=this.selection;return a&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||nc.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,a,r){let n=this.doc.type.schema;if(null==a)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=a),r=null==r?a:r,!e)return this.deleteRange(a,r);let i=this.storedMarks;if(!i){let e=this.doc.resolve(a);i=r==a?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(a,r,n.text(e,i)),this.selection.empty||this.setSelection(Jd.near(this.selection.$to)),this}}setMeta(e,a){return this.meta["string"==typeof e?e:e.key]=a,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 cu(e,a){return a&&e?e.bind(a):e}class du{constructor(e,a,r){this.name=e,this.init=cu(a.init,r),this.apply=cu(a.apply,r)}}const uu=[new du("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new du("selection",{init:(e,a)=>e.selection||Jd.atStart(a.doc),apply:e=>e.selection}),new du("storedMarks",{init:e=>e.storedMarks||null,apply:(e,a,r,n)=>n.selection.$cursor?e.storedMarks:null}),new du("scrollToSelection",{init:()=>0,apply:(e,a)=>e.scrolledIntoView?a+1:a})];class hu{constructor(e,a){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=uu.slice(),a&&a.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 du(e.key,e.spec.state,e))}))}}class mu{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,a=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=a){let a=this.config.plugins[r];if(a.spec.filterTransaction&&!a.spec.filterTransaction.call(a,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let a=[e],r=this.applyInner(e),n=null;for(;;){let i=!1;for(let t=0;t<this.config.plugins.length;t++){let o=this.config.plugins[t];if(o.spec.appendTransaction){let s=n?n[t].n:0,l=n?n[t].state:this,c=s<a.length&&o.spec.appendTransaction.call(o,s?a.slice(s):a,l,r);if(c&&r.filterTransaction(c,t)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<t?{state:r,n:a.length}:{state:this,n:0})}a.push(c),r=r.applyInner(c),i=!0}n&&(n[t]={state:r,n:a.length})}}if(!i)return{state:r,transactions:a}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let a=new mu(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];a[i.name]=i.apply(e,this[i.name],this,a)}return a}get tr(){return new lu(this)}static create(e){let a=new hu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new mu(a);for(let n=0;n<a.fields.length;n++)r[a.fields[n].name]=a.fields[n].init(e,r);return r}reconfigure(e){let a=new hu(this.schema,e.plugins),r=a.fields,n=new mu(a);for(let a=0;a<r.length;a++){let i=r[a].name;n[i]=this.hasOwnProperty(i)?this[i]:r[a].init(e,n)}return n}toJSON(e){let a={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(a.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],i=n.spec.state;i&&i.toJSON&&(a[r]=i.toJSON.call(n,this[n.key]))}return a}static fromJSON(e,a,r){if(!a)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let n=new hu(e.schema,e.plugins),i=new mu(n);return n.fields.forEach((n=>{if("doc"==n.name)i.doc=jc.fromJSON(e.schema,a.doc);else if("selection"==n.name)i.selection=Jd.fromJSON(i.doc,a.selection);else if("storedMarks"==n.name)a.storedMarks&&(i.storedMarks=a.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let t in r){let o=r[t],s=o.spec.state;if(o.key==n.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(a,t))return void(i[n.name]=s.fromJSON.call(o,e,a[t],i))}i[n.name]=n.init(e,i)}})),i}}function gu(e,a,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(a):"handleDOMEvents"==n&&(i=gu(i,a,{})),r[n]=i}return r}class pu{constructor(e){this.spec=e,this.props={},e.props&&gu(e.props,this,this.props),this.key=e.key?e.key.key:fu("plugin")}getState(e){return e[this.key]}}const bu=Object.create(null);function fu(e){return e in bu?e+"$"+ ++bu[e]:(bu[e]=0,e+"$")}class ku{constructor(e="key"){this.key=fu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const yu=function(e){for(var a=0;;a++)if(!(e=e.previousSibling))return a},vu=function(e){let a=e.assignedSlot||e.parentNode;return a&&11==a.nodeType?a.host:a};let wu=null;const zu=function(e,a,r){let n=wu||(wu=document.createRange());return n.setEnd(e,null==r?e.nodeValue.length:r),n.setStart(e,a||0),n},ju=function(e,a,r,n){return r&&($u(e,a,r,n,-1)||$u(e,a,r,n,1))},xu=/^(img|br|input|textarea|hr)$/i;function $u(e,a,r,n,i){for(;;){if(e==r&&a==n)return!0;if(a==(i<0?0:qu(e))){let r=e.parentNode;if(!r||1!=r.nodeType||Cu(e)||xu.test(e.nodeName)||"false"==e.contentEditable)return!1;a=yu(e)+(i<0?0:1),e=r}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[a+(i<0?-1:0)]).contentEditable)return!1;a=i<0?qu(e):0}}}function qu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Cu(e){let a;for(let r=e;r&&!(a=r.pmViewDesc);r=r.parentNode);return a&&a.node&&a.node.isBlock&&(a.dom==e||a.contentDOM==e)}const Su=function(e){return e.focusNode&&ju(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ou(e,a){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=a,r}const Eu="undefined"!=typeof navigator?navigator:null,Mu="undefined"!=typeof document?document:null,_u=Eu&&Eu.userAgent||"",Au=/Edge\/(\d+)/.exec(_u),Du=/MSIE \d/.exec(_u),Tu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_u),Nu=!!(Du||Tu||Au),Iu=Du?document.documentMode:Tu?+Tu[1]:Au?+Au[1]:0,Fu=!Nu&&/gecko\/(\d+)/i.test(_u);Fu&&(/Firefox\/(\d+)/.exec(_u)||[0,0])[1];const Pu=!Nu&&/Chrome\/(\d+)/.exec(_u),Ru=!!Pu,Lu=Pu?+Pu[1]:0,Bu=!Nu&&!!Eu&&/Apple Computer/.test(Eu.vendor),Vu=Bu&&(/Mobile\/\w+/.test(_u)||!!Eu&&Eu.maxTouchPoints>2),Hu=Vu||!!Eu&&/Mac/.test(Eu.platform),Wu=!!Eu&&/Win/.test(Eu.platform),Uu=/Android \d/.test(_u),Gu=!!Mu&&"webkitFontSmoothing"in Mu.documentElement.style,Ku=Gu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Zu(e){let a=e.defaultView&&e.defaultView.visualViewport;return a?{left:0,right:a.width,top:0,bottom:a.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ju(e,a){return"number"==typeof e?e:e[a]}function Yu(e){let a=e.getBoundingClientRect(),r=a.width/e.offsetWidth||1,n=a.height/e.offsetHeight||1;return{left:a.left,right:a.left+e.clientWidth*r,top:a.top,bottom:a.top+e.clientHeight*n}}function Xu(e,a,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,t=e.dom.ownerDocument;for(let o=r||e.dom;o;o=vu(o)){if(1!=o.nodeType)continue;let e=o,r=e==t.body,s=r?Zu(t):Yu(e),l=0,c=0;if(a.top<s.top+Ju(n,"top")?c=-(s.top-a.top+Ju(i,"top")):a.bottom>s.bottom-Ju(n,"bottom")&&(c=a.bottom-a.top>s.bottom-s.top?a.top+Ju(i,"top")-s.top:a.bottom-s.bottom+Ju(i,"bottom")),a.left<s.left+Ju(n,"left")?l=-(s.left-a.left+Ju(i,"left")):a.right>s.right-Ju(n,"right")&&(l=a.right-s.right+Ju(i,"right")),l||c)if(r)t.defaultView.scrollBy(l,c);else{let r=e.scrollLeft,n=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-r,t=e.scrollTop-n;a={left:a.left-i,top:a.top-t,right:a.right-i,bottom:a.bottom-t}}if(r||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Qu(e){let a=[],r=e.ownerDocument;for(let n=e;n&&(a.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=vu(n));return a}function eh(e,a){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:t}=e[r];n.scrollTop!=i+a&&(n.scrollTop=i+a),n.scrollLeft!=t&&(n.scrollLeft=t)}}let ah=null;function rh(e,a){let r,n,i,t,o=2e8,s=0,l=a.top,c=a.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=zu(d).getClientRects()}for(let h=0;h<e.length;h++){let m=e[h];if(m.top<=l&&m.bottom>=c){l=Math.max(m.bottom,l),c=Math.min(m.top,c);let e=m.left>a.left?m.left-a.left:m.right<a.left?a.left-m.right:0;if(e<o){r=d,o=e,n=e&&3==r.nodeType?{left:m.right<a.left?m.right:m.left,top:a.top}:a,1==d.nodeType&&e&&(s=u+(a.left>=(m.left+m.right)/2?1:0));continue}}else m.top>a.top&&!i&&m.left<=a.left&&m.right>=a.left&&(i=d,t={left:Math.max(m.left,Math.min(m.right,a.left)),top:m.top});!r&&(a.left>=m.right&&a.top>=m.top||a.left>=m.left&&a.top>=m.bottom)&&(s=u+1)}}return!r&&i&&(r=i,n=t,o=0),r&&3==r.nodeType?function(e,a){let r=e.nodeValue.length,n=document.createRange();for(let i=0;i<r;i++){n.setEnd(e,i+1),n.setStart(e,i);let r=sh(n,1);if(r.top!=r.bottom&&nh(a,r))return{node:e,offset:i+(a.left>=(r.left+r.right)/2?1:0)}}return{node:e,offset:0}}(r,n):!r||o&&1==r.nodeType?{node:e,offset:s}:rh(r,n)}function nh(e,a){return e.left>=a.left-1&&e.left<=a.right+1&&e.top>=a.top-1&&e.top<=a.bottom+1}function ih(e,a,r){let n=e.childNodes.length;if(n&&r.top<r.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(a.top-r.top)/(r.bottom-r.top))-2)),t=i;;){let r=e.childNodes[t];if(1==r.nodeType){let e=r.getClientRects();for(let n=0;n<e.length;n++){let i=e[n];if(nh(a,i))return ih(r,a,i)}}if((t=(t+1)%n)==i)break}return e}function th(e,a){let r,n=e.dom.ownerDocument,i=0,t=function(e,a,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(a,r);if(n)return{node:n.offsetNode,offset:Math.min(qu(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(a,r);if(n)return{node:n.startContainer,offset:Math.min(qu(n.startContainer),n.startOffset)}}}(n,a.left,a.top);t&&({node:r,offset:i}=t);let o,s=(e.root.elementFromPoint?e.root:n).elementFromPoint(a.left,a.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){let r=e.dom.getBoundingClientRect();if(!nh(a,r))return null;if(s=ih(e.dom,a,r),!s)return null}if(Bu)for(let e=s;r&&e;e=vu(e))e.draggable&&(r=void 0);if(s=function(e,a){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&a.left<e.getBoundingClientRect().left?r:e}(s,a),r){if(Fu&&1==r.nodeType&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e,n=r.childNodes[i];"IMG"==n.nodeName&&(e=n.getBoundingClientRect()).right<=a.left&&e.bottom>a.top&&i++}let n;Gu&&i&&1==r.nodeType&&1==(n=r.childNodes[i-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=a.top&&i--,r==e.dom&&i==r.childNodes.length-1&&1==r.lastChild.nodeType&&a.top>r.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:0!=i&&1==r.nodeType&&"BR"==r.childNodes[i-1].nodeName||(o=function(e,a,r,n){let i=-1;for(let r=a,t=!1;r!=e.dom;){let a,o=e.docView.nearestDesc(r,!0);if(!o)return null;if(1==o.dom.nodeType&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((a=o.dom.getBoundingClientRect()).width||a.height)&&(o.node.isBlock&&o.parent&&(!t&&a.left>n.left||a.top>n.top?i=o.posBefore:(!t&&a.right<n.left||a.bottom<n.top)&&(i=o.posAfter),t=!0),!o.contentDOM&&i<0&&!o.node.isText))return(o.node.isBlock?n.top<(a.top+a.bottom)/2:n.left<(a.left+a.right)/2)?o.posBefore:o.posAfter;r=o.dom.parentNode}return i>-1?i:e.docView.posFromDOM(a,r,-1)}(e,r,i,a))}null==o&&(o=function(e,a,r){let{node:n,offset:i}=rh(a,r),t=-1;if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();t=e.left!=e.right&&r.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,t)}(e,s,a));let l=e.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function oh(e){return e.top<e.bottom||e.left<e.right}function sh(e,a){let r=e.getClientRects();if(r.length){let e=r[a<0?0:r.length-1];if(oh(e))return e}return Array.prototype.find.call(r,oh)||e.getBoundingClientRect()}const lh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ch(e,a,r){let{node:n,offset:i,atom:t}=e.docView.domFromPos(a,r<0?-1:1),o=Gu||Fu;if(3==n.nodeType){if(!o||!lh.test(n.nodeValue)&&(r<0?i:i!=n.nodeValue.length)){let e=i,a=i,t=r<0?1:-1;return r<0&&!i?(a++,t=-1):r>=0&&i==n.nodeValue.length?(e--,t=1):r<0?e--:a++,dh(sh(zu(n,e,a),t),t<0)}{let e=sh(zu(n,i,i),r);if(Fu&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let a=sh(zu(n,i-1,i-1),-1);if(a.top==e.top){let r=sh(zu(n,i,i+1),-1);if(r.top!=e.top)return dh(r,r.left<a.left)}}return e}}if(!e.state.doc.resolve(a-(t||0)).parent.inlineContent){if(null==t&&i&&(r<0||i==qu(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return uh(e.getBoundingClientRect(),!1)}if(null==t&&i<qu(n)){let e=n.childNodes[i];if(1==e.nodeType)return uh(e.getBoundingClientRect(),!0)}return uh(n.getBoundingClientRect(),r>=0)}if(null==t&&i&&(r<0||i==qu(n))){let e=n.childNodes[i-1],a=3==e.nodeType?zu(e,qu(e)-(o?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(a)return dh(sh(a,1),!1)}if(null==t&&i<qu(n)){let e=n.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let a=e?3==e.nodeType?zu(e,0,o?0:1):1==e.nodeType?e:null:null;if(a)return dh(sh(a,-1),!0)}return dh(sh(3==n.nodeType?zu(n):n,-r),r>=0)}function dh(e,a){if(0==e.width)return e;let r=a?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function uh(e,a){if(0==e.height)return e;let r=a?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function hh(e,a,r){let n=e.state,i=e.root.activeElement;n!=a&&e.updateState(a),i!=e.dom&&e.focus();try{return r()}finally{n!=a&&e.updateState(n),i!=e.dom&&i&&i.focus()}}const mh=/[\u0590-\u08ac]/;let gh=null,ph=null,bh=!1;function fh(e,a,r){return gh==a&&ph==r?bh:(gh=a,ph=r,bh="up"==r||"down"==r?function(e,a,r){let n=a.selection,i="up"==r?n.$from:n.$to;return hh(e,a,(()=>{let{node:a}=e.docView.domFromPos(i.pos,"up"==r?-1:1);for(;;){let r=e.docView.nearestDesc(a,!0);if(!r)break;if(r.node.isBlock){a=r.contentDOM||r.dom;break}a=r.dom.parentNode}let n=ch(e,i.pos,1);for(let e=a.firstChild;e;e=e.nextSibling){let a;if(1==e.nodeType)a=e.getClientRects();else{if(3!=e.nodeType)continue;a=zu(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<a.length;e++){let i=a[e];if(i.bottom>i.top+1&&("up"==r?n.top-i.top>2*(i.bottom-n.top):i.bottom-n.bottom>2*(n.bottom-i.top)))return!1}}return!0}))}(e,a,r):function(e,a,r){let{$head:n}=a.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,t=!i,o=i==n.parent.content.size,s=e.domSelection();return s?mh.test(n.parent.textContent)&&s.modify?hh(e,a,(()=>{let{focusNode:a,focusOffset:i,anchorNode:t,anchorOffset:o}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",r,"character");let c=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||a==d&&i==u;try{s.collapse(t,o),a&&(a!=t||i!=o)&&s.extend&&s.extend(a,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h})):"left"==r||"backward"==r?t:o:n.pos==n.start()||n.pos==n.end()}(e,a,r))}class kh{constructor(e,a,r,n){this.parent=e,this.children=a,this.dom=r,this.contentDOM=n,this.dirty=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,a,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let a=0;a<this.children.length;a++)e+=this.children[a].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 a=0,r=this.posAtStart;;a++){let n=this.children[a];if(n==e)return r;r+=n.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,a,r){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(r<0){let r,n;if(e==this.contentDOM)r=e.childNodes[a-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}{let r,n;if(e==this.contentDOM)r=e.childNodes[a];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}}let n;if(e==this.dom&&this.contentDOM)n=a>yu(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==a)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!1;break}if(a.previousSibling)break}if(null==n&&a==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!0;break}if(a.nextSibling)break}}return(null==n?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,a=!1){for(let r=!0,n=e;n;n=n.parentNode){let i,t=this.getDesc(n);if(t&&(!a||t.node)){if(!r||!(i=t.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return t;r=!1}}}getDesc(e){let a=e.pmViewDesc;for(let e=a;e;e=e.parent)if(e==this)return a}posFromDOM(e,a,r){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,a,r)}return-1}descAt(e){for(let a=0,r=0;a<this.children.length;a++){let n=this.children[a],i=r+n.size;if(r==e&&i!=r){for(;!n.border&&n.children.length;)n=n.children[0];return n}if(e<i)return n.descAt(e-r-n.border);r=i}}domFromPos(e,a){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,n=0;for(let a=0;r<this.children.length;r++){let i=this.children[r],t=a+i.size;if(t>e||i instanceof $h){n=e-a;break}a=t}if(n)return this.children[r].domFromPos(n-this.children[r].border,a);for(let e;r&&!(e=this.children[r-1]).size&&e instanceof yh&&e.side>=0;r--);if(a<=0){let e,n=!0;for(;e=r?this.children[r-1]:null,e&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&a&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,a):{node:this.contentDOM,offset:e?yu(e.dom)+1:0}}{let e,n=!0;for(;e=r<this.children.length?this.children[r]:null,e&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,a):{node:this.contentDOM,offset:e?yu(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,a,r=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:a,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let t=r,o=0;;o++){let r=this.children[o],s=t+r.size;if(-1==n&&e<=s){let i=t+r.border;if(e>=i&&a<=s-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(e,a,i);e=t;for(let a=o;a>0;a--){let r=this.children[a-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=yu(r.dom)+1;break}e-=r.size}-1==n&&(n=0)}if(n>-1&&(s>a||o==this.children.length-1)){a=s;for(let e=o+1;e<this.children.length;e++){let r=this.children[e];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=yu(r.dom);break}a+=r.size}-1==i&&(i=this.contentDOM.childNodes.length);break}t=s}return{node:this.contentDOM,from:e,to:a,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let a=this.children[e<0?0:this.children.length-1];return 0==a.size||a.emptyChildAt(e)}domAfterPos(e){let{node:a,offset:r}=this.domFromPos(e,0);if(1!=a.nodeType||r==a.childNodes.length)throw new RangeError("No node after pos "+e);return a.childNodes[r]}setSelection(e,a,r,n=!1){let i=Math.min(e,a),t=Math.max(e,a);for(let o=0,s=0;o<this.children.length;o++){let l=this.children[o],c=s+l.size;if(i>s&&t<c)return l.setSelection(e-s-l.border,a-s-l.border,r,n);s=c}let o=this.domFromPos(e,e?-1:1),s=a==e?o:this.domFromPos(a,a?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Fu||Bu)&&e==a){let{node:e,offset:a}=o;if(3==e.nodeType){if(d=!(!a||"\n"!=e.nodeValue[a-1]),d&&a==e.nodeValue.length)for(let a,r=e;r;r=r.parentNode){if(a=r.nextSibling){"BR"==a.nodeName&&(o=s={node:a.parentNode,offset:yu(a)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let r=e.childNodes[a-1];d=r&&("BR"==r.nodeName||"false"==r.contentEditable)}}if(Fu&&c.focusNode&&c.focusNode!=s.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||d&&Bu)&&ju(o.node,o.offset,c.anchorNode,c.anchorOffset)&&ju(s.node,s.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==a)&&!d){l.collapse(o.node,o.offset);try{e!=a&&l.extend(s.node,s.offset),u=!0}catch(e){}}if(!u){if(e>a){let e=o;o=s,s=e}let r=document.createRange();r.setEnd(s.node,s.offset),r.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(r)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,a){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],t=r+i.size;if(r==t?e<=t&&a>=r:e<t&&a>r){let n=r+i.border,o=t-i.border;if(e>=n&&a<=o)return this.dirty=e==r||a==t?2:1,void(e!=n||a!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-n,a-n):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}r=t}this.dirty=2}markParentsDirty(){let e=1;for(let a=this.parent;a;a=a.parent,e++){let r=1==e?2:1;a.dirty<r&&(a.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class yh extends kh{constructor(e,a,r,n){let i,t=a.type.toDOM;if("function"==typeof t&&(t=t(r,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n))),!a.type.spec.raw){if(1!=t.nodeType){let e=document.createElement("span");e.appendChild(t),t=e}t.contentEditable="false",t.classList.add("ProseMirror-widget")}super(e,[],t,null),this.widget=a,this.widget=a,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let a=this.widget.spec.stopEvent;return!!a&&a(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 side(){return this.widget.type.side}}class vh extends kh{constructor(e,a,r,n){super(e,[],a,null),this.textDOM=r,this.text=n}get size(){return this.text.length}localPosFromDOM(e,a){return e!=this.textDOM?this.posAtStart+(a?this.size:0):this.posAtStart+a}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class wh extends kh{constructor(e,a,r,n,i){super(e,[],r,n),this.mark=a,this.spec=i}static create(e,a,r,n){let i=n.nodeViews[a.type.name],t=i&&i(a,n,r);return t&&t.dom||(t=ed.renderSpec(document,a.type.spec.toDOM(a,r),null,a.attrs)),new wh(e,a,t.dom,t.contentDOM||t.dom,t)}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,a){if(super.markDirty(e,a),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,a,r){let n=wh.create(this.parent,this.mark,!0,r),i=this.children,t=this.size;a<t&&(i=Fh(i,a,t,r)),e>0&&(i=Fh(i,0,e,r));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class zh extends kh{constructor(e,a,r,n,i,t,o,s,l){super(e,[],i,t),this.node=a,this.outerDeco=r,this.innerDeco=n,this.nodeDOM=o}static create(e,a,r,n,i,t){let o,s=i.nodeViews[a.type.name],l=s&&s(a,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:t),r,n),c=l&&l.dom,d=l&&l.contentDOM;if(a.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(a.text);else if(!c){let e=ed.renderSpec(document,a.type.spec.toDOM(a),null,a.attrs);({dom:c,contentDOM:d}=e)}d||a.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),a.type.spec.draggable&&(c.draggable=!0));let u=c;return c=Ah(c,r,a),l?o=new qh(e,a,r,n,c,d||null,u,l,i,t+1):a.isText?new xh(e,a,r,n,c,u,i):new zh(e,a,r,n,c,d||null,u,i,t+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 a=this.children.length-1;a>=0;a--){let r=this.children[a];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ql.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,a,r){return 0==this.dirty&&e.eq(this.node)&&Dh(a,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,a){let r=this.node.inlineContent,n=a,i=e.composing?this.localCompositionInfo(e,a):null,t=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Nh(this,t&&t.node,e);!function(e,a,r,n){let i=a.locals(e),t=0;if(0==i.length){for(let r=0;r<e.childCount;r++){let o=e.child(r);n(o,i,a.forChild(t,o),r),t+=o.nodeSize}return}let o=0,s=[],l=null;for(let c=0;;){let d,u,h,m;for(;o<i.length&&i[o].to==t;){let e=i[o++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(Ih);for(let e=0;e<u.length;e++)r(u[e],c,!!l)}else r(d,c,!!l);if(l)m=-1,h=l,l=null;else{if(!(c<e.childCount))break;m=c,h=e.child(c++)}for(let e=0;e<s.length;e++)s[e].to<=t&&s.splice(e--,1);for(;o<i.length&&i[o].from<=t&&i[o].to>t;)s.push(i[o++]);let g=t+h.nodeSize;if(h.isText){let e=g;o<i.length&&i[o].from<e&&(e=i[o].from);for(let a=0;a<s.length;a++)s[a].to<e&&(e=s[a].to);e<g&&(l=h.cut(e-t),h=h.cut(0,e-t),g=e,m=-1)}else for(;o<i.length&&i[o].to<g;)o++;n(h,h.isInline&&!h.isLeaf?s.filter((e=>!e.inline)):s.slice(),a.forChild(t,h),m),t=g}}(this.node,this.innerDeco,((a,i,t)=>{a.spec.marks?s.syncToMarks(a.spec.marks,r,e):a.type.side>=0&&!t&&s.syncToMarks(i==this.node.childCount?nc.none:this.node.child(i).marks,r,e),s.placeWidget(a,e,n)}),((a,t,l,c)=>{let d;s.syncToMarks(a.marks,r,e),s.findNodeMatch(a,t,l,c)||o&&e.state.selection.from>n&&e.state.selection.to<n+a.nodeSize&&(d=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(a,t,l,d,e)||s.updateNextNode(a,t,l,e,c,n)||s.addNode(a,t,l,e,n),n+=a.nodeSize})),s.syncToMarks([],r,e),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(t&&this.protectLocalComposition(e,t),Ch(this.contentDOM,this.children,e),Vu&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let a=e.style.cssText;e.style.cssText=a+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=a}}(this.dom))}localCompositionInfo(e,a){let{from:r,to:n}=e.state.selection;if(!(e.state.selection instanceof eu)||r<a||n>a+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,t=function(e,a,r,n){for(let i=0,t=0;i<e.childCount&&t<=n;){let o=e.child(i++),s=t;if(t+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let a=e.child(i++);if(t+=a.nodeSize,!a.isText)break;l+=a.text}if(t>=r){if(t>=n&&l.slice(n-a.length-s,n-s)==a)return n-a.length;let e=s<n?l.lastIndexOf(a,n-s-1):-1;if(e>=0&&e+a.length+s>=r)return s+e;if(r==n&&l.length>=n+a.length-s&&l.slice(n-s,n-s+a.length)==a)return n}}return-1}(this.node.content,e,r-a,n-a);return t<0?null:{node:i,pos:t,text:e}}return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:a,pos:r,text:n}){if(this.getDesc(a))return;let i=a;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let t=new vh(this,i,a,n);e.input.compositionNodes.push(t),this.children=Fh(this.children,r,r+n.length,e,t)}update(e,a,r,n){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,a,r,n),!0)}updateInner(e,a,r,n){this.updateOuterDeco(a),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Dh(e,this.outerDeco))return;let a=1!=this.nodeDOM.nodeType,r=this.dom;this.dom=Mh(this.dom,this.nodeDOM,Eh(this.outerDeco,this.node,a),Eh(e,this.node,a)),this.dom!=r&&(r.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.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function jh(e,a,r,n,i){Ah(n,a,e);let t=new zh(void 0,e,a,r,n,n,n,i,0);return t.contentDOM&&t.updateChildren(i,0),t}class xh extends zh{constructor(e,a,r,n,i,t,o){super(e,a,r,n,i,null,t,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,a,r,n){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(a),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let a=this.nodeDOM;a;a=a.parentNode)if(a==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,a,r){return e==this.nodeDOM?this.posAtStart+Math.min(a,this.node.text.length):super.localPosFromDOM(e,a,r)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,a,r){let n=this.node.cut(e,a),i=document.createTextNode(n.text);return new xh(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,a){super.markDirty(e,a),this.dom==this.nodeDOM||0!=e&&a!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class $h extends kh{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 qh extends zh{constructor(e,a,r,n,i,t,o,s,l,c){super(e,a,r,n,i,t,o,l,c),this.spec=s}update(e,a,r,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,a,r);return i&&this.updateInner(e,a,r,n),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,a,r,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,a,r,n){this.spec.setSelection?this.spec.setSelection(e,a,r.root):super.setSelection(e,a,r,n)}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 Ch(e,a,r){let n=e.firstChild,i=!1;for(let t=0;t<a.length;t++){let o=a[t],s=o.dom;if(s.parentNode==e){for(;s!=n;)n=Th(n),i=!0;n=n.nextSibling}else i=!0,e.insertBefore(s,n);if(o instanceof wh){let a=n?n.previousSibling:e.lastChild;Ch(o.contentDOM,o.children,r),n=a?a.nextSibling:e.firstChild}}for(;n;)n=Th(n),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}const Sh=function(e){e&&(this.nodeName=e)};Sh.prototype=Object.create(null);const Oh=[new Sh];function Eh(e,a,r){if(0==e.length)return Oh;let n=r?Oh[0]:new Sh,i=[n];for(let t=0;t<e.length;t++){let o=e[t].type.attrs;if(o){o.nodeName&&i.push(n=new Sh(o.nodeName));for(let e in o){let t=o[e];null!=t&&(r&&1==i.length&&i.push(n=new Sh(a.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+t:"style"==e?n.style=(n.style?n.style+";":"")+t:"nodeName"!=e&&(n[e]=t))}}}return i}function Mh(e,a,r,n){if(r==Oh&&n==Oh)return a;let i=a;for(let a=0;a<n.length;a++){let t=n[a],o=r[a];if(a){let a;o&&o.nodeName==t.nodeName&&i!=e&&(a=i.parentNode)&&a.nodeName.toLowerCase()==t.nodeName||(a=document.createElement(t.nodeName),a.pmIsDeco=!0,a.appendChild(i),o=Oh[0]),i=a}_h(i,o||Oh[0],t)}return i}function _h(e,a,r){for(let n in a)"class"==n||"style"==n||"nodeName"==n||n in r||e.removeAttribute(n);for(let n in r)"class"!=n&&"style"!=n&&"nodeName"!=n&&r[n]!=a[n]&&e.setAttribute(n,r[n]);if(a.class!=r.class){let n=a.class?a.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)-1==i.indexOf(n[a])&&e.classList.remove(n[a]);for(let a=0;a<i.length;a++)-1==n.indexOf(i[a])&&e.classList.add(i[a]);0==e.classList.length&&e.removeAttribute("class")}if(a.style!=r.style){if(a.style){let r,n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;r=n.exec(a.style);)e.style.removeProperty(r[1])}r.style&&(e.style.cssText+=r.style)}}function Ah(e,a,r){return Mh(e,e,Oh,Eh(a,r,1!=e.nodeType))}function Dh(e,a){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(a[r].type))return!1;return!0}function Th(e){let a=e.nextSibling;return e.parentNode.removeChild(e),a}class Nh{constructor(e,a,r){this.lock=a,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,a){let r=a,n=r.children.length,i=e.childCount,t=new Map,o=[];e:for(;i>0;){let s;for(;;)if(n){let e=r.children[n-1];if(!(e instanceof wh)){s=e,n--;break}r=e,n=e.children.length}else{if(r==a)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=s.node;if(l){if(l!=e.child(i-1))break;--i,t.set(s,i),o.push(s)}}return{index:i,matched:t,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,a){if(e!=a){for(let r=e;r<a;r++)this.top.children[r].destroy();this.top.children.splice(e,a-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,a,r){let n=0,i=this.stack.length>>1,t=Math.min(i,e.length);for(;n<t&&(n==i-1?this.top:this.stack[n+1<<1]).matchesMark(e[n])&&!1!==e[n].type.spec.spanning;)n++;for(;n<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 n=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let r=this.top.children[a];if(r.matchesMark(e[i])&&!this.isLocked(r.dom)){n=a;break}}if(n>-1)n>this.index&&(this.changed=!0,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let n=wh.create(this.top,e[i],a,r);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,i++}}findNodeMatch(e,a,r,n){let i,t=-1;if(n>=this.preMatch.index&&(i=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&i.matchesNode(e,a,r))t=this.top.children.indexOf(i,this.index);else for(let n=this.index,i=Math.min(this.top.children.length,n+5);n<i;n++){let i=this.top.children[n];if(i.matchesNode(e,a,r)&&!this.preMatch.matched.has(i)){t=n;break}}return!(t<0)&&(this.destroyBetween(this.index,t),this.index++,!0)}updateNodeAt(e,a,r,n,i){let t=this.top.children[n];return 3==t.dirty&&t.dom==t.contentDOM&&(t.dirty=2),!!t.update(e,a,r,i)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let a=e.parentNode;if(!a)return-1;if(a==this.top.contentDOM){let a=e.pmViewDesc;if(a)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==a)return e;return-1}e=a}}updateNextNode(e,a,r,n,i,t){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof zh){let l=this.preMatch.matched.get(s);if(null!=l&&l!=i)return!1;let c,d=s.dom,u=this.isLocked(d)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Dh(a,s.outerDeco));if(!u&&s.update(e,a,r,n))return this.destroyBetween(this.index,o),s.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(s,e,a,r,n,t)))return this.destroyBetween(this.index,o),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,t+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,a,r,n,i,t){if(e.dirty||a.isAtom||!e.children.length||!e.node.content.eq(a.content)||!Dh(r,e.outerDeco)||!n.eq(e.innerDeco))return null;let o=zh.create(this.top,a,r,n,i,t);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,a,r,n,i){let t=zh.create(this.top,e,a,r,n,i);t.contentDOM&&t.updateChildren(n,i+1),this.top.children.splice(this.index++,0,t),this.changed=!0}placeWidget(e,a,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(!n||!n.matchesWidget(e)||e!=n.widget&&n.widget.type.toDOM.parentNode){let n=new yh(this.top,e,a,r);this.top.children.splice(this.index++,0,n),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],a=this.top;for(;e instanceof wh;)a=e,e=a.children[a.children.length-1];(!e||!(e instanceof xh)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bu||Ru)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",a),this.addHackNode("BR",this.top))}addHackNode(e,a){if(a==this.top&&this.index<a.children.length&&a.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);"IMG"==e&&(r.className="ProseMirror-separator",r.alt=""),"BR"==e&&(r.className="ProseMirror-trailingBreak");let n=new $h(this.top,[],r,null);a!=this.top?a.children.push(n):a.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Ih(e,a){return e.type.side-a.type.side}function Fh(e,a,r,n,i){let t=[];for(let o=0,s=0;o<e.length;o++){let l=e[o],c=s,d=s+=l.size;c>=r||d<=a?t.push(l):(c<a&&t.push(l.slice(0,a-c,n)),i&&(t.push(i),i=void 0),d>r&&t.push(l.slice(r-c,l.size,n)))}return t}function Ph(e,a=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),t=i&&0==i.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let s,l,c=n.resolve(o);if(Su(r)){for(s=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&ru.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,a,r){for(let n=0==a,i=a==qu(e);n||i;){if(e==r)return!0;let a=yu(e);if(!(e=e.parentNode))return!1;n=n&&0==a,i=i&&a==qu(e)}}(r.focusNode,r.focusOffset,i.dom))){let e=i.posBefore;l=new ru(o==e?c:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let a=o,i=o;for(let n=0;n<r.rangeCount;n++){let t=r.getRangeAt(n);a=Math.min(a,e.docView.posFromDOM(t.startContainer,t.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(t.endContainer,t.endOffset,-1))}if(a<0)return null;[s,o]=i==e.state.selection.anchor?[i,a]:[a,i],c=n.resolve(o)}else s=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(s<0)return null}let d=n.resolve(s);if(!l){l=Kh(e,d,c,"pointer"==a||e.state.selection.head<c.pos&&!t?1:-1)}return l}function Rh(e){return e.editable?e.hasFocus():Jh(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Lh(e,a=!1){let r=e.state.selection;if(Uh(e,r),Rh(e)){if(!a&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Ru){let a=e.domSelectionRange(),r=e.domObserver.currentSelection;if(a.anchorNode&&r.anchorNode&&ju(a.anchorNode,a.anchorOffset,r.anchorNode,r.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let a=e.domSelection(),r=document.createRange();if(!a)return;let n=e.cursorWrapper.dom,i="IMG"==n.nodeName;i?r.setStart(n.parentNode,yu(n)+1):r.setStart(n,0);r.collapse(!0),a.removeAllRanges(),a.addRange(r),!i&&!e.state.selection.visible&&Nu&&Iu<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let n,i,{anchor:t,head:o}=r;!Bh||r instanceof eu||(r.$from.parent.inlineContent||(n=Vh(e,r.from)),r.empty||r.$from.parent.inlineContent||(i=Vh(e,r.to))),e.docView.setSelection(t,o,e,a),Bh&&(n&&Wh(n),i&&Wh(i)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let a=e.dom.ownerDocument;a.removeEventListener("selectionchange",e.input.hideSelectionGuard);let r=e.domSelectionRange(),n=r.anchorNode,i=r.anchorOffset;a.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{r.anchorNode==n&&r.anchorOffset==i||(a.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Rh(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Bh=Bu||Ru&&Lu<63;function Vh(e,a){let{node:r,offset:n}=e.docView.domFromPos(a,0),i=n<r.childNodes.length?r.childNodes[n]:null,t=n?r.childNodes[n-1]:null;if(Bu&&i&&"false"==i.contentEditable)return Hh(i);if(!(i&&"false"!=i.contentEditable||t&&"false"!=t.contentEditable)){if(i)return Hh(i);if(t)return Hh(t)}}function Hh(e){return e.contentEditable="true",Bu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Wh(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Uh(e,a){if(a instanceof ru){let r=e.docView.descAt(a.from);r!=e.lastSelectedViewDesc&&(Gh(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else Gh(e)}function Gh(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Kh(e,a,r,n){return e.someProp("createSelectionBetween",(n=>n(e,a,r)))||eu.between(a,r,n)}function Zh(e){return!(e.editable&&!e.hasFocus())&&Jh(e)}function Jh(e){let a=e.domSelectionRange();if(!a.anchorNode)return!1;try{return e.dom.contains(3==a.anchorNode.nodeType?a.anchorNode.parentNode:a.anchorNode)&&(e.editable||e.dom.contains(3==a.focusNode.nodeType?a.focusNode.parentNode:a.focusNode))}catch(e){return!1}}function Yh(e,a){let{$anchor:r,$head:n}=e.selection,i=a>0?r.max(n):r.min(n),t=i.parent.inlineContent?i.depth?e.doc.resolve(a>0?i.after():i.before()):null:i;return t&&Jd.findFrom(t,a)}function Xh(e,a){return e.dispatch(e.state.tr.setSelection(a).scrollIntoView()),!0}function Qh(e,a,r){let n=e.state.selection;if(!(n instanceof eu)){if(n instanceof ru&&n.node.isInline)return Xh(e,new eu(a>0?n.$to:n.$from));{let r=Yh(e.state,a);return!!r&&Xh(e,r)}}if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:a<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let t=e.state.doc.resolve(r.pos+i.nodeSize*(a<0?-1:1));return Xh(e,new eu(n.$anchor,t))}if(!n.empty)return!1;if(e.endOfTextblock(a>0?"forward":"backward")){let r=Yh(e.state,a);return!!(r&&r instanceof ru)&&Xh(e,r)}if(!(Hu&&r.indexOf("m")>-1)){let r,i=n.$head,t=i.textOffset?null:a<0?i.nodeBefore:i.nodeAfter;if(!t||t.isText)return!1;let o=a<0?i.pos-t.nodeSize:i.pos;return!!(t.isAtom||(r=e.docView.descAt(o))&&!r.contentDOM)&&(ru.isSelectable(t)?Xh(e,new ru(a<0?e.state.doc.resolve(i.pos-t.nodeSize):i)):!!Gu&&Xh(e,new eu(e.state.doc.resolve(a<0?o:o+t.nodeSize))))}}function em(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function am(e,a){let r=e.pmViewDesc;return r&&0==r.size&&(a<0||e.nextSibling||"BR"!=e.nodeName)}function rm(e,a){return a<0?function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=!1;Fu&&1==r.nodeType&&n<em(r)&&am(r.childNodes[n],-1)&&(o=!0);for(;;)if(n>0){if(1!=r.nodeType)break;{let e=r.childNodes[n-1];if(am(e,-1))i=r,t=--n;else{if(3!=e.nodeType)break;r=e,n=r.nodeValue.length}}}else{if(nm(r))break;{let a=r.previousSibling;for(;a&&am(a,-1);)i=r.parentNode,t=yu(a),a=a.previousSibling;if(a)r=a,n=em(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}o?im(e,r,n):i&&im(e,i,t)}(e):function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=em(r);for(;;)if(n<o){if(1!=r.nodeType)break;if(!am(r.childNodes[n],1))break;i=r,t=++n}else{if(nm(r))break;{let a=r.nextSibling;for(;a&&am(a,1);)i=a.parentNode,t=yu(a)+1,a=a.nextSibling;if(a)r=a,n=0,o=em(r);else{if(r=r.parentNode,r==e.dom)break;n=o=0}}}i&&im(e,i,t)}(e)}function nm(e){let a=e.pmViewDesc;return a&&a.node&&a.node.isBlock}function im(e,a,r){if(3!=a.nodeType){let e,n;(n=function(e,a){for(;e&&a==e.childNodes.length&&!Cu(e);)a=yu(e)+1,e=e.parentNode;for(;e&&a<e.childNodes.length;){let r=e.childNodes[a];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;e=r,a=0}}(a,r))?(a=n,r=0):(e=function(e,a){for(;e&&!a&&!Cu(e);)a=yu(e),e=e.parentNode;for(;e&&a;){let r=e.childNodes[a-1];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;a=(e=r).childNodes.length}}(a,r))&&(a=e,r=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(Su(n)){let e=document.createRange();e.setEnd(a,r),e.setStart(a,r),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(a,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout((()=>{e.state==i&&Lh(e)}),50)}function tm(e,a){let r=e.state.doc.resolve(a);if(!Ru&&!Wu&&r.parent.inlineContent){let n=e.coordsAtPos(a);if(a>r.start()){let r=e.coordsAtPos(a-1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(a<r.end()){let r=e.coordsAtPos(a+1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function om(e,a,r){let n=e.state.selection;if(n instanceof eu&&!n.empty||r.indexOf("s")>-1)return!1;if(Hu&&r.indexOf("m")>-1)return!1;let{$from:i,$to:t}=n;if(!i.parent.inlineContent||e.endOfTextblock(a<0?"up":"down")){let r=Yh(e.state,a);if(r&&r instanceof ru)return Xh(e,r)}if(!i.parent.inlineContent){let r=a<0?i:t,o=n instanceof iu?Jd.near(r,a):Jd.findFrom(r,a);return!!o&&Xh(e,o)}return!1}function sm(e,a){if(!(e.state.selection instanceof eu))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(a>0?"forward":"backward"))return!0;let t=!r.textOffset&&(a<0?r.nodeBefore:r.nodeAfter);if(t&&!t.isText){let n=e.state.tr;return a<0?n.delete(r.pos-t.nodeSize,r.pos):n.delete(r.pos,r.pos+t.nodeSize),e.dispatch(n),!0}return!1}function lm(e,a,r){e.domObserver.stop(),a.contentEditable=r,e.domObserver.start()}function cm(e,a){let r=a.keyCode,n=function(e){let a="";return e.ctrlKey&&(a+="c"),e.metaKey&&(a+="m"),e.altKey&&(a+="a"),e.shiftKey&&(a+="s"),a}(a);if(8==r||Hu&&72==r&&"c"==n)return sm(e,-1)||rm(e,-1);if(46==r&&!a.shiftKey||Hu&&68==r&&"c"==n)return sm(e,1)||rm(e,1);if(13==r||27==r)return!0;if(37==r||Hu&&66==r&&"c"==n){let a=37==r?"ltr"==tm(e,e.state.selection.from)?-1:1:-1;return Qh(e,a,n)||rm(e,a)}if(39==r||Hu&&70==r&&"c"==n){let a=39==r?"ltr"==tm(e,e.state.selection.from)?1:-1:1;return Qh(e,a,n)||rm(e,a)}return 38==r||Hu&&80==r&&"c"==n?om(e,-1,n)||rm(e,-1):40==r||Hu&&78==r&&"c"==n?function(e){if(!Bu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:a,focusOffset:r}=e.domSelectionRange();if(a&&1==a.nodeType&&0==r&&a.firstChild&&"false"==a.firstChild.contentEditable){let r=a.firstChild;lm(e,r,"true"),setTimeout((()=>lm(e,r,"false")),20)}return!1}(e)||om(e,1,n)||rm(e,1):n==(Hu?"m":"c")&&(66==r||73==r||89==r||90==r)}function dm(e,a){e.someProp("transformCopied",(r=>{a=r(a,e)}));let r=[],{content:n,openStart:i,openEnd:t}=a;for(;i>1&&t>1&&1==n.childCount&&1==n.firstChild.childCount;){i--,t--;let e=n.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let o=e.someProp("clipboardSerializer")||ed.fromSchema(e.state.schema),s=vm(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let c,d=l.firstChild,u=0;for(;d&&1==d.nodeType&&(c=km[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let a=s.createElement(c[e]);for(;l.firstChild;)a.appendChild(l.firstChild);l.appendChild(a),u++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${t}${u?` -${u}`:""} ${JSON.stringify(r)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(r=>r(a,e)))||a.content.textBetween(0,a.content.size,"\n\n"),slice:a}}function um(e,a,r,n,i){let t,o,s=i.parent.type.spec.code;if(!r&&!a)return null;let l=a&&(n||s||!r);if(l){if(e.someProp("transformPastedText",(r=>{a=r(a,s||n,e)})),s)return a?new tc(Ql.from(e.state.schema.text(a.replace(/\r\n?/g,"\n"))),0,0):tc.empty;let r=e.someProp("clipboardTextParser",(r=>r(a,i,n,e)));if(r)o=r;else{let r=i.marks(),{schema:n}=e.state,o=ed.fromSchema(n);t=document.createElement("div"),a.split(/(?:\r\n?|\n)+/).forEach((e=>{let a=t.appendChild(document.createElement("p"));e&&a.appendChild(o.serializeNode(n.text(e,r)))}))}}else e.someProp("transformPastedHTML",(a=>{r=a(r,e)})),t=function(e){let a=/^(\s*<meta [^>]*>)*/.exec(e);a&&(e=e.slice(a[0].length));let r,n=vm().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(r=i&&km[i[1].toLowerCase()])&&(e=r.map((e=>"<"+e+">")).join("")+e+r.map((e=>"</"+e+">")).reverse().join(""));if(n.innerHTML=function(e){let a=window.trustedTypes;if(!a)return e;wm||(wm=a.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return wm.createHTML(e)}(e),r)for(let e=0;e<r.length;e++)n=n.querySelector(r[e])||n;return n}(r),Gu&&function(e){let a=e.querySelectorAll(Ru?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<a.length;r++){let n=a[r];1==n.childNodes.length&&" "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(t);let c=t&&t.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=t.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;t=e}if(!o){let a=e.someProp("clipboardParser")||e.someProp("domParser")||Hc.fromSchema(e.state.schema);o=a.parseSlice(t,{preserveWhitespace:!(!l&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||hm.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)o=function(e,a){if(!e.size)return e;let r,n=e.content.firstChild.type.schema;try{r=JSON.parse(a)}catch(a){return e}let{content:i,openStart:t,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let a=n.nodes[r[e]];if(!a||a.hasRequiredAttrs())break;i=Ql.from(a.create(r[e+1],i)),t++,o++}return new tc(i,t,o)}(fm(o,+d[1],+d[2]),d[4]);else if(o=tc.maxOpen(function(e,a){if(e.childCount<2)return e;for(let r=a.depth;r>=0;r--){let n,i=a.node(r).contentMatchAt(a.index(r)),t=[];if(e.forEach((e=>{if(!t)return;let a,r=i.findWrapping(e.type);if(!r)return t=null;if(a=t.length&&n.length&&gm(r,n,e,t[t.length-1],0))t[t.length-1]=a;else{t.length&&(t[t.length-1]=pm(t[t.length-1],n.length));let a=mm(e,r);t.push(a),i=i.matchType(a.type),n=r}})),t)return Ql.from(t)}return e}(o.content,i),!0),o.openStart||o.openEnd){let e=0,a=0;for(let a=o.content.firstChild;e<o.openStart&&!a.type.spec.isolating;e++,a=a.firstChild);for(let e=o.content.lastChild;a<o.openEnd&&!e.type.spec.isolating;a++,e=e.lastChild);o=fm(o,e,a)}return e.someProp("transformPasted",(a=>{o=a(o,e)})),o}const hm=/^(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 mm(e,a,r=0){for(let n=a.length-1;n>=r;n--)e=a[n].create(null,Ql.from(e));return e}function gm(e,a,r,n,i){if(i<e.length&&i<a.length&&e[i]==a[i]){let t=gm(e,a,r,n.lastChild,i+1);if(t)return n.copy(n.content.replaceChild(n.childCount-1,t));if(n.contentMatchAt(n.childCount).matchType(i==e.length-1?r.type:e[i+1]))return n.copy(n.content.append(Ql.from(mm(r,e,i+1))))}}function pm(e,a){if(0==a)return e;let r=e.content.replaceChild(e.childCount-1,pm(e.lastChild,a-1)),n=e.contentMatchAt(e.childCount).fillBefore(Ql.empty,!0);return e.copy(r.append(n))}function bm(e,a,r,n,i,t){let o=a<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(t=0),i<n-1&&(s=bm(s,a,r,n,i+1,t)),i>=r&&(s=a<0?o.contentMatchAt(0).fillBefore(s,t<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Ql.empty,!0))),e.replaceChild(a<0?0:e.childCount-1,o.copy(s))}function fm(e,a,r){return a<e.openStart&&(e=new tc(bm(e.content,-1,a,e.openStart,0,e.openEnd),a,e.openEnd)),r<e.openEnd&&(e=new tc(bm(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}const km={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 ym=null;function vm(){return ym||(ym=document.implementation.createHTMLDocument("title"))}let wm=null;const zm={},jm={},xm={touchstart:!0,touchmove:!0};class $m{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function qm(e,a){e.input.lastSelectionOrigin=a,e.input.lastSelectionTime=Date.now()}function Cm(e){e.someProp("handleDOMEvents",(a=>{for(let r in a)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=a=>Sm(e,a))}))}function Sm(e,a){return e.someProp("handleDOMEvents",(r=>{let n=r[a.type];return!!n&&(n(e,a)||a.defaultPrevented)}))}function Om(e,a){if(!a.bubbles)return!0;if(a.defaultPrevented)return!1;for(let r=a.target;r!=e.dom;r=r.parentNode)if(!r||11==r.nodeType||r.pmViewDesc&&r.pmViewDesc.stopEvent(a))return!1;return!0}function Em(e){return{left:e.clientX,top:e.clientY}}function Mm(e,a,r,n,i){if(-1==n)return!1;let t=e.state.doc.resolve(n);for(let n=t.depth+1;n>0;n--)if(e.someProp(a,(a=>n>t.depth?a(e,r,t.nodeAfter,t.before(n),i,!0):a(e,r,t.node(n),t.before(n),i,!1))))return!0;return!1}function _m(e,a,r){if(e.focused||e.focus(),e.state.selection.eq(a))return;let n=e.state.tr.setSelection(a);n.setMeta("pointer",!0),e.dispatch(n)}function Am(e,a,r,n,i){return Mm(e,"handleClickOn",a,r,n)||e.someProp("handleClick",(r=>r(e,a,n)))||(i?function(e,a){if(-1==a)return!1;let r,n,i=e.state.selection;i instanceof ru&&(r=i.node);let t=e.state.doc.resolve(a);for(let e=t.depth+1;e>0;e--){let a=e>t.depth?t.nodeAfter:t.node(e);if(ru.isSelectable(a)){n=r&&i.$from.depth>0&&e>=i.$from.depth&&t.before(i.$from.depth+1)==i.$from.pos?t.before(i.$from.depth):t.before(e);break}}return null!=n&&(_m(e,ru.create(e.state.doc,n)),!0)}(e,r):function(e,a){if(-1==a)return!1;let r=e.state.doc.resolve(a),n=r.nodeAfter;return!!(n&&n.isAtom&&ru.isSelectable(n))&&(_m(e,new ru(r)),!0)}(e,r))}function Dm(e,a,r,n){return Mm(e,"handleDoubleClickOn",a,r,n)||e.someProp("handleDoubleClick",(r=>r(e,a,n)))}function Tm(e,a,r,n){return Mm(e,"handleTripleClickOn",a,r,n)||e.someProp("handleTripleClick",(r=>r(e,a,n)))||function(e,a,r){if(0!=r.button)return!1;let n=e.state.doc;if(-1==a)return!!n.inlineContent&&(_m(e,eu.create(n,0,n.content.size)),!0);let i=n.resolve(a);for(let a=i.depth+1;a>0;a--){let r=a>i.depth?i.nodeAfter:i.node(a),t=i.before(a);if(r.inlineContent)_m(e,eu.create(n,t+1,t+1+r.content.size));else{if(!ru.isSelectable(r))continue;_m(e,ru.create(n,t))}return!0}}(e,r,n)}function Nm(e){return Hm(e)}jm.keydown=(e,a)=>{let r=a;if(e.input.shiftKey=16==r.keyCode||r.shiftKey,!Pm(e,r)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!Uu||!Ru||13!=r.keyCode))if(229!=r.keyCode&&e.domObserver.forceFlush(),!Vu||13!=r.keyCode||r.ctrlKey||r.altKey||r.metaKey)e.someProp("handleKeyDown",(a=>a(e,r)))||cm(e,r)?r.preventDefault():qm(e,"key");else{let a=Date.now();e.input.lastIOSEnter=a,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==a&&(e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},jm.keyup=(e,a)=>{16==a.keyCode&&(e.input.shiftKey=!1)},jm.keypress=(e,a)=>{let r=a;if(Pm(e,r)||!r.charCode||r.ctrlKey&&!r.altKey||Hu&&r.metaKey)return;if(e.someProp("handleKeyPress",(a=>a(e,r))))return void r.preventDefault();let n=e.state.selection;if(!(n instanceof eu&&n.$from.sameParent(n.$to))){let a=String.fromCharCode(r.charCode);/[\r\n]/.test(a)||e.someProp("handleTextInput",(r=>r(e,n.$from.pos,n.$to.pos,a)))||e.dispatch(e.state.tr.insertText(a).scrollIntoView()),r.preventDefault()}};const Im=Hu?"metaKey":"ctrlKey";zm.mousedown=(e,a)=>{let r=a;e.input.shiftKey=r.shiftKey;let n=Nm(e),i=Date.now(),t="singleClick";i-e.input.lastClick.time<500&&function(e,a){let r=a.x-e.clientX,n=a.y-e.clientY;return r*r+n*n<100}(r,e.input.lastClick)&&!r[Im]&&("singleClick"==e.input.lastClick.type?t="doubleClick":"doubleClick"==e.input.lastClick.type&&(t="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:t};let o=e.posAtCoords(Em(r));o&&("singleClick"==t?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Fm(e,o,r,!!n)):("doubleClick"==t?Dm:Tm)(e,o.pos,o.inside,r)?r.preventDefault():qm(e,"pointer"))};class Fm{constructor(e,a,r,n){let i,t;if(this.view=e,this.pos=a,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Im],this.allowDefault=r.shiftKey,a.inside>-1)i=e.state.doc.nodeAt(a.inside),t=a.inside;else{let r=e.state.doc.resolve(a.pos);i=r.parent,t=r.depth?r.before():0}const o=n?null:r.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&1==s.dom.nodeType?s.dom:null;let{selection:l}=e.state;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof ru&&l.from<=t&&l.to>t)&&(this.mightDrag={node:i,pos:t,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Fu||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)),qm(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((()=>Lh(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let a=this.pos;this.view.state.doc!=this.startDoc&&(a=this.view.posAtCoords(Em(e))),this.updateAllowDefault(e),this.allowDefault||!a?qm(this.view,"pointer"):Am(this.view,a.pos,a.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Bu&&this.mightDrag&&!this.mightDrag.node.isAtom||Ru&&!this.view.state.selection.visible&&Math.min(Math.abs(a.pos-this.view.state.selection.from),Math.abs(a.pos-this.view.state.selection.to))<=2)?(_m(this.view,Jd.near(this.view.state.doc.resolve(a.pos))),e.preventDefault()):qm(this.view,"pointer")}move(e){this.updateAllowDefault(e),qm(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 Pm(e,a){return!!e.composing||!!(Bu&&Math.abs(a.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}zm.touchstart=e=>{e.input.lastTouch=Date.now(),Nm(e),qm(e,"pointer")},zm.touchmove=e=>{e.input.lastTouch=Date.now(),qm(e,"pointer")},zm.contextmenu=e=>Nm(e);const Rm=Uu?5e3:-1;function Lm(e,a){clearTimeout(e.input.composingTimeout),a>-1&&(e.input.composingTimeout=setTimeout((()=>Hm(e)),a))}function Bm(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 Vm(e){let a=e.domSelectionRange();if(!a.focusNode)return null;let r=function(e,a){for(;;){if(3==e.nodeType&&a)return e;if(1==e.nodeType&&a>0){if("false"==e.contentEditable)return null;a=qu(e=e.childNodes[a-1])}else{if(!e.parentNode||Cu(e))return null;a=yu(e),e=e.parentNode}}}(a.focusNode,a.focusOffset),n=function(e,a){for(;;){if(3==e.nodeType&&a<e.nodeValue.length)return e;if(1==e.nodeType&&a<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[a],a=0}else{if(!e.parentNode||Cu(e))return null;a=yu(e)+1,e=e.parentNode}}}(a.focusNode,a.focusOffset);if(r&&n&&r!=n){let a=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!a||!a.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=r.pmViewDesc;if(e&&e.isText(r.nodeValue))return n}}return r||n}function Hm(e,a=!1){if(!(Uu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Bm(e),a||e.docView&&e.docView.dirty){let r=Ph(e);return r&&!r.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(r)):!e.markCursor&&!a||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}jm.compositionstart=jm.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:a}=e,r=a.selection.$to;if(a.selection instanceof eu&&(a.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||r.marks(),Hm(e,!0),e.markCursor=null;else if(Hm(e,!a.selection.empty),Fu&&a.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let a=e.domSelectionRange();for(let r=a.focusNode,n=a.focusOffset;r&&1==r.nodeType&&0!=n;){let a=n<0?r.lastChild:r.childNodes[n-1];if(!a)break;if(3==a.nodeType){let r=e.domSelection();r&&r.collapse(a,a.nodeValue.length);break}r=a,n=-1}}e.input.composing=!0}Lm(e,Rm)},jm.compositionend=(e,a)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=a.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Lm(e,20))};const Wm=Nu&&Iu<15||Vu&&Ku<604;function Um(e,a,r,n,i){let t=um(e,a,r,n,e.state.selection.$from);if(e.someProp("handlePaste",(a=>a(e,i,t||tc.empty))))return!0;if(!t)return!1;let o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(t),s=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(t);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Gm(e){let a=e.getData("text/plain")||e.getData("Text");if(a)return a;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}zm.copy=jm.cut=(e,a)=>{let r=a,n=e.state.selection,i="cut"==r.type;if(n.empty)return;let t=Wm?null:r.clipboardData,o=n.content(),{dom:s,text:l}=dm(e,o);t?(r.preventDefault(),t.clearData(),t.setData("text/html",s.innerHTML),t.setData("text/plain",l)):function(e,a){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(a),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(a),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout((()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()}),50)}(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},jm.paste=(e,a)=>{let r=a;if(e.composing&&!Uu)return;let n=Wm?null:r.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&Um(e,Gm(n),n.getData("text/html"),i,r)?r.preventDefault():function(e,a){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Um(e,n.value,null,i,a):Um(e,n.textContent,n.innerHTML,i,a)}),50)}(e,r)};class Km{constructor(e,a,r){this.slice=e,this.move=a,this.node=r}}const Zm=Hu?"altKey":"ctrlKey";zm.dragstart=(e,a)=>{let r=a,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i,t=e.state.selection,o=t.empty?null:e.posAtCoords(Em(r));if(o&&o.pos>=t.from&&o.pos<=(t instanceof ru?t.to-1:t.to));else if(n&&n.mightDrag)i=ru.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){let a=e.docView.nearestDesc(r.target,!0);a&&a.node.type.spec.draggable&&a!=e.docView&&(i=ru.create(e.state.doc,a.posBefore))}let s=(i||e.state.selection).content(),{dom:l,text:c,slice:d}=dm(e,s);(!r.dataTransfer.files.length||!Ru||Lu>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Wm?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",Wm||r.dataTransfer.setData("text/plain",c),e.dragging=new Km(d,!r[Zm],i)},zm.dragend=e=>{let a=e.dragging;window.setTimeout((()=>{e.dragging==a&&(e.dragging=null)}),50)},jm.dragover=jm.dragenter=(e,a)=>a.preventDefault(),jm.drop=(e,a)=>{let r=a,n=e.dragging;if(e.dragging=null,!r.dataTransfer)return;let i=e.posAtCoords(Em(r));if(!i)return;let t=e.state.doc.resolve(i.pos),o=n&&n.slice;o?e.someProp("transformPasted",(a=>{o=a(o,e)})):o=um(e,Gm(r.dataTransfer),Wm?null:r.dataTransfer.getData("text/html"),!1,t);let s=!(!n||r[Zm]);if(e.someProp("handleDrop",(a=>a(e,r,o||tc.empty,s))))return void r.preventDefault();if(!o)return;r.preventDefault();let l=o?Dd(e.state.doc,t.pos,o):t.pos;null==l&&(l=t.pos);let c=e.state.tr;if(s){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let m=c.doc.resolve(d);if(u&&ru.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new ru(m));else{let a=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,r,n,i)=>a=i)),c.setSelection(Kh(e,m,c.doc.resolve(a)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},zm.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())&&Lh(e)}),20))},zm.blur=(e,a)=>{let r=a;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},zm.beforeinput=(e,a)=>{if(Ru&&Uu&&"deleteContentBackward"==a.inputType){e.domObserver.flushSoon();let{domChangeCount:a}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=a)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(a=>a(e,Ou(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())}),50)}};for(let e in jm)zm[e]=jm[e];function Jm(e,a){if(e==a)return!0;for(let r in e)if(e[r]!==a[r])return!1;for(let r in a)if(!(r in e))return!1;return!0}class Ym{constructor(e,a){this.toDOM=e,this.spec=a||rg,this.side=this.spec.side||0}map(e,a,r,n){let{pos:i,deleted:t}=e.mapResult(a.from+n,this.side<0?-1:1);return t?null:new eg(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ym&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Jm(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Xm{constructor(e,a){this.attrs=e,this.spec=a||rg}map(e,a,r,n){let i=e.map(a.from+n,this.spec.inclusiveStart?-1:1)-r,t=e.map(a.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=t?null:new eg(i,t,this)}valid(e,a){return a.from<a.to}eq(e){return this==e||e instanceof Xm&&Jm(this.attrs,e.attrs)&&Jm(this.spec,e.spec)}static is(e){return e.type instanceof Xm}destroy(){}}class Qm{constructor(e,a){this.attrs=e,this.spec=a||rg}map(e,a,r,n){let i=e.mapResult(a.from+n,1);if(i.deleted)return null;let t=e.mapResult(a.to+n,-1);return t.deleted||t.pos<=i.pos?null:new eg(i.pos-r,t.pos-r,this)}valid(e,a){let r,{index:n,offset:i}=e.content.findIndex(a.from);return i==a.from&&!(r=e.child(n)).isText&&i+r.nodeSize==a.to}eq(e){return this==e||e instanceof Qm&&Jm(this.attrs,e.attrs)&&Jm(this.spec,e.spec)}destroy(){}}class eg{constructor(e,a,r){this.from=e,this.to=a,this.type=r}copy(e,a){return new eg(e,a,this.type)}eq(e,a=0){return this.type.eq(e.type)&&this.from+a==e.from&&this.to+a==e.to}map(e,a,r){return this.type.map(e,this,a,r)}static widget(e,a,r){return new eg(e,e,new Ym(a,r))}static inline(e,a,r,n){return new eg(e,a,new Xm(r,n))}static node(e,a,r,n){return new eg(e,a,new Qm(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof Xm}get widget(){return this.type instanceof Ym}}const ag=[],rg={};class ng{constructor(e,a){this.local=e.length?e:ag,this.children=a.length?a:ag}static create(e,a){return a.length?cg(a,e,0,rg):ig}find(e,a,r){let n=[];return this.findInner(null==e?0:e,null==a?1e9:a,n,0,r),n}findInner(e,a,r,n,i){for(let t=0;t<this.local.length;t++){let o=this.local[t];o.from<=a&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+n,o.to+n))}for(let t=0;t<this.children.length;t+=3)if(this.children[t]<a&&this.children[t+1]>e){let o=this.children[t]+1;this.children[t+2].findInner(e-o,a-o,r,n+o,i)}}map(e,a,r){return this==ig||0==e.maps.length?this:this.mapInner(e,a,0,0,r||rg)}mapInner(e,a,r,n,i){let t;for(let o=0;o<this.local.length;o++){let s=this.local[o].map(e,r,n);s&&s.type.valid(a,s)?(t||(t=[])).push(s):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,a,r,n,i,t,o){let s=e.slice();for(let e=0,a=t;e<r.maps.length;e++){let n=0;r.maps[e].forEach(((e,r,i,t)=>{let o=t-i-(r-e);for(let i=0;i<s.length;i+=3){let t=s[i+1];if(t<0||e>t+a-n)continue;let l=s[i]+a-n;r>=l?s[i+1]=e<=l?-2:-1:e>=a&&o&&(s[i]+=o,s[i+1]+=o)}n+=o})),a=r.maps[e].map(a,-1)}let l=!1;for(let a=0;a<s.length;a+=3)if(s[a+1]<0){if(-2==s[a+1]){l=!0,s[a+1]=-1;continue}let c=r.map(e[a]+t),d=c-i;if(d<0||d>=n.content.size){l=!0;continue}let u=r.map(e[a+1]+t,-1)-i,{index:h,offset:m}=n.content.findIndex(d),g=n.maybeChild(h);if(g&&m==d&&m+g.nodeSize==u){let n=s[a+2].mapInner(r,g,c+1,e[a]+t+1,o);n!=ig?(s[a]=d,s[a+1]=u,s[a+2]=n):(s[a+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,a,r,n,i,t,o){function s(e,a){for(let t=0;t<e.local.length;t++){let s=e.local[t].map(n,i,a);s?r.push(s):o.onRemove&&o.onRemove(e.local[t].spec)}for(let r=0;r<e.children.length;r+=3)s(e.children[r+2],e.children[r]+a+1)}for(let r=0;r<e.length;r+=3)-1==e[r+1]&&s(e[r+2],a[r]+t+1);return r}(s,e,a,r,i,t,o),c=cg(l,n,0,o);a=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,a=0;e<c.children.length;e+=3){let r=c.children[e];for(;a<s.length&&s[a]<r;)a+=3;s.splice(a,0,c.children[e],c.children[e+1],c.children[e+2])}}return new ng(a.sort(dg),s)}(this.children,t||[],e,a,r,n,i):t?new ng(t.sort(dg),ag):ig}add(e,a){return a.length?this==ig?ng.create(e,a):this.addInner(e,a,0):this}addInner(e,a,r){let n,i=0;e.forEach(((e,t)=>{let o,s=t+r;if(o=sg(a,e,s)){for(n||(n=this.children.slice());i<n.length&&n[i]<t;)i+=3;n[i]==t?n[i+2]=n[i+2].addInner(e,o,s+1):n.splice(i,0,t,t+e.nodeSize,cg(o,e,s+1,rg)),i+=3}}));let t=og(i?lg(a):a,-r);for(let a=0;a<t.length;a++)t[a].type.valid(e,t[a])||t.splice(a--,1);return new ng(t.length?this.local.concat(t).sort(dg):this.local,n||this.children)}remove(e){return 0==e.length||this==ig?this:this.removeInner(e,0)}removeInner(e,a){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i,t=r[n]+a,o=r[n+1]+a;for(let a,r=0;r<e.length;r++)(a=e[r])&&a.from>t&&a.to<o&&(e[r]=null,(i||(i=[])).push(a));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[n+2].removeInner(i,t+1);s!=ig?r[n+2]=s:(r.splice(n,3),n-=3)}if(n.length)for(let r,i=0;i<e.length;i++)if(r=e[i])for(let e=0;e<n.length;e++)n[e].eq(r,a)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1));return r==this.children&&n==this.local?this:n.length||r.length?new ng(n,r):ig}forChild(e,a){if(this==ig)return this;if(a.isLeaf)return ng.empty;let r,n;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,t=i+a.content.size;for(let e=0;e<this.local.length;e++){let a=this.local[e];if(a.from<t&&a.to>i&&a.type instanceof Xm){let e=Math.max(i,a.from)-i,r=Math.min(t,a.to)-i;e<r&&(n||(n=[])).push(a.copy(e,r))}}if(n){let e=new ng(n.sort(dg),ag);return r?new tg([e,r]):e}return r||ig}eq(e){if(this==e)return!0;if(!(e instanceof ng)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let a=0;a<this.local.length;a++)if(!this.local[a].eq(e.local[a]))return!1;for(let a=0;a<this.children.length;a+=3)if(this.children[a]!=e.children[a]||this.children[a+1]!=e.children[a+1]||!this.children[a+2].eq(e.children[a+2]))return!1;return!0}locals(e){return ug(this.localsInner(e))}localsInner(e){if(this==ig)return ag;if(e.inlineContent||!this.local.some(Xm.is))return this.local;let a=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Xm||a.push(this.local[e]);return a}forEachSet(e){e(this)}}ng.empty=new ng([],[]),ng.removeOverlap=ug;const ig=ng.empty;class tg{constructor(e){this.members=e}map(e,a){const r=this.members.map((r=>r.map(e,a,rg)));return tg.from(r)}forChild(e,a){if(a.isLeaf)return ng.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,a);i!=ig&&(i instanceof tg?r=r.concat(i.members):r.push(i))}return tg.from(r)}eq(e){if(!(e instanceof tg)||e.members.length!=this.members.length)return!1;for(let a=0;a<this.members.length;a++)if(!this.members[a].eq(e.members[a]))return!1;return!0}locals(e){let a,r=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length)if(a){r&&(a=a.slice(),r=!1);for(let e=0;e<i.length;e++)a.push(i[e])}else a=i}return a?ug(r?a:a.sort(dg)):ag}static from(e){switch(e.length){case 0:return ig;case 1:return e[0];default:return new tg(e.every((e=>e instanceof ng))?e:e.reduce(((e,a)=>e.concat(a instanceof ng?a:a.members)),[]))}}forEachSet(e){for(let a=0;a<this.members.length;a++)this.members[a].forEachSet(e)}}function og(e,a){if(!a||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new eg(i.from+a,i.to+a,i.type))}return r}function sg(e,a,r){if(a.isLeaf)return null;let n=r+a.nodeSize,i=null;for(let a,t=0;t<e.length;t++)(a=e[t])&&a.from>r&&a.to<n&&((i||(i=[])).push(a),e[t]=null);return i}function lg(e){let a=[];for(let r=0;r<e.length;r++)null!=e[r]&&a.push(e[r]);return a}function cg(e,a,r,n){let i=[],t=!1;a.forEach(((a,o)=>{let s=sg(e,a,o+r);if(s){t=!0;let e=cg(s,a,r+o+1,n);e!=ig&&i.push(o,o+a.nodeSize,e)}}));let o=og(t?lg(e):e,-r).sort(dg);for(let e=0;e<o.length;e++)o[e].type.valid(a,o[e])||(n.onRemove&&n.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new ng(o,i):ig}function dg(e,a){return e.from-a.from||e.to-a.to}function ug(e){let a=e;for(let r=0;r<a.length-1;r++){let n=a[r];if(n.from!=n.to)for(let i=r+1;i<a.length;i++){let t=a[i];if(t.from!=n.from){t.from<n.to&&(a==e&&(a=e.slice()),a[r]=n.copy(n.from,t.from),hg(a,i,n.copy(t.from,n.to)));break}t.to!=n.to&&(a==e&&(a=e.slice()),a[i]=t.copy(t.from,n.to),hg(a,i+1,t.copy(n.to,t.to)))}}return a}function hg(e,a,r){for(;a<e.length&&dg(r,e[a])>0;)a++;e.splice(a,0,r)}function mg(e){let a=[];return e.someProp("decorations",(r=>{let n=r(e.state);n&&n!=ig&&a.push(n)})),e.cursorWrapper&&a.push(ng.create(e.state.doc,[e.cursorWrapper.deco])),tg.from(a)}const gg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pg=Nu&&Iu<=11;class bg{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 fg{constructor(e,a){this.view=e,this.handleDOMChange=a,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bg,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let a=0;a<e.length;a++)this.queue.push(e[a]);Nu&&Iu<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),pg&&(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,gg)),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 a=0;a<e.length;a++)this.queue.push(e[a]);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(Zh(this.view)){if(this.suppressingSelectionUpdates)return Lh(this.view);if(Nu&&Iu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ju(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 a,r=new Set;for(let a=e.focusNode;a;a=vu(a))r.add(a);for(let n=e.anchorNode;n;n=vu(n))if(r.has(n)){a=n;break}let n=a&&this.view.docView.nearestDesc(a);return n&&n.ignoreMutation({type:"selection",target:3==a.nodeType?a.parentNode:a})?(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 a=this.pendingRecords();a.length&&(this.queue=[]);let r=e.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Zh(e)&&!this.ignoreSelectionChange(r),i=-1,t=-1,o=!1,s=[];if(e.editable)for(let e=0;e<a.length;e++){let r=this.registerMutation(a[e],s);r&&(i=i<0?r.from:Math.min(r.from,i),t=t<0?r.to:Math.max(r.to,t),r.typeOver&&(o=!0))}if(Fu&&s.length){let a=s.filter((e=>"BR"==e.nodeName));if(2==a.length){let[e,r]=a;e.parentNode&&e.parentNode.parentNode==r.parentNode?r.remove():e.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of a){let a=n.parentNode;!a||"LI"!=a.nodeName||r&&wg(e,r)==a||n.remove()}}}let l=null;i<0&&n&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Su(r)&&(l=Ph(e))&&l.eq(Jd.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Lh(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||n)&&(i>-1&&(e.docView.markDirty(i,t),function(e){if(kg.has(e))return;if(kg.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Fu,yg)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."),yg=!0}}(e)),this.handleDOMChange(i,t,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Lh(e),this.currentSelection.set(r))}registerMutation(e,a){if(a.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(r==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!r||r.ignoreMutation(e))return null;if("childList"==e.type){for(let r=0;r<e.addedNodes.length;r++){let n=e.addedNodes[r];a.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let n=e.previousSibling,i=e.nextSibling;if(Nu&&Iu<=11&&e.addedNodes.length)for(let a=0;a<e.addedNodes.length;a++){let{previousSibling:r,nextSibling:t}=e.addedNodes[a];(!r||Array.prototype.indexOf.call(e.addedNodes,r)<0)&&(n=r),(!t||Array.prototype.indexOf.call(e.addedNodes,t)<0)&&(i=t)}let t=n&&n.parentNode==e.target?yu(n)+1:0,o=r.localPosFromDOM(e.target,t,-1),s=i&&i.parentNode==e.target?yu(i):e.target.childNodes.length;return{from:o,to:r.localPosFromDOM(e.target,s,1)}}return"attributes"==e.type?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let kg=new WeakMap,yg=!1;function vg(e,a){let r=a.startContainer,n=a.startOffset,i=a.endContainer,t=a.endOffset,o=e.domAtPos(e.state.selection.anchor);return ju(o.node,o.offset,i,t)&&([r,n,i,t]=[i,t,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:t}}function wg(e,a){for(let r=a.parentNode;r&&r!=e.dom;r=r.parentNode){let a=e.docView.nearestDesc(r,!0);if(a&&a.node.isBlock)return r}return null}function zg(e){let a=e.pmViewDesc;if(a)return a.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Bu&&/^(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||Bu&&/^(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 jg=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xg(e,a,r,n,i){let t=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,a<0){let a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,r=Ph(e,a);if(r&&!e.state.selection.eq(r)){if(Ru&&Uu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))))return;let n=e.state.tr.setSelection(r);"pointer"==a?n.setMeta("pointer",!0):"key"==a&&n.scrollIntoView(),t&&n.setMeta("composition",t),e.dispatch(n)}return}let o=e.state.doc.resolve(a),s=o.sharedDepth(r);a=o.before(s+1),r=e.state.doc.resolve(r).after(s+1);let l,c,d=e.state.selection,u=function(e,a,r){let n,{node:i,fromOffset:t,toOffset:o,from:s,to:l}=e.docView.parseRange(a,r),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(n=[{node:d,offset:c.anchorOffset}],Su(c)||n.push({node:c.focusNode,offset:c.focusOffset})),Ru&&8===e.input.lastKeyCode)for(let e=o;e>t;e--){let a=i.childNodes[e-1],r=a.pmViewDesc;if("BR"==a.nodeName&&!r){o=e;break}if(!r||r.size)break}let u=e.state.doc,h=e.someProp("domParser")||Hc.fromSchema(e.state.schema),m=u.resolve(s),g=null,p=h.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:t,to:o,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:n,ruleFromNode:zg,context:m});if(n&&null!=n[0].pos){let e=n[0].pos,a=n[1]&&n[1].pos;null==a&&(a=e),g={anchor:e+s,head:a+s}}return{doc:p,sel:g,from:s,to:l}}(e,a,r),h=e.state.doc,m=h.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let g=function(e,a,r,n,i){let t=e.findDiffStart(a,r);if(null==t)return null;let{a:o,b:s}=e.findDiffEnd(a,r+e.size,r+a.size);if("end"==i){n-=o+Math.max(0,t-Math.min(o,s))-t}if(o<t&&e.size<a.size){let e=n<=t&&n>=o?t-n:0;t-=e,t&&t<a.size&&Cg(a.textBetween(t-1,t+1))&&(t+=e?1:-1),s=t+(s-o),o=t}else if(s<t){let a=n<=t&&n>=s?t-n:0;t-=a,t&&t<e.size&&Cg(e.textBetween(t-1,t+1))&&(t+=a?1:-1),o=t+(o-s),s=t}return{start:t,endA:o,endB:s}}(m.content,u.doc.content,u.from,l,c);if(g&&e.input.domChangeCount++,(Vu&&e.input.lastIOSEnter>Date.now()-225||Uu)&&i.some((e=>1==e.nodeType&&!jg.test(e.nodeName)))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof eu&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let a=$g(e,e.state.doc,u.sel);if(a&&!a.eq(e.state.selection)){let r=e.state.tr.setSelection(a);t&&r.setMeta("composition",t),e.dispatch(r)}}return}g={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof eu&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Nu&&Iu<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>u.from&&" "==u.doc.textBetween(g.start-u.from-1,g.start-u.from+1)&&(g.start--,g.endA--,g.endB--);let p,b=u.doc.resolveNoCache(g.start-u.from),f=u.doc.resolveNoCache(g.endB-u.from),k=h.resolve(g.start),y=b.sameParent(f)&&b.parent.inlineContent&&k.end()>=g.endA;if((Vu&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!y&&b.pos<u.doc.content.size&&!b.sameParent(f)&&(p=Jd.findFrom(u.doc.resolve(b.pos+1),1,!0))&&p.head==f.pos)&&e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>g.start&&function(e,a,r,n,i){if(r-a<=i.pos-n.pos||qg(n,!0,!1)<i.pos)return!1;let t=e.resolve(a);if(!n.parent.isTextblock){let e=t.nodeAfter;return null!=e&&r==a+e.nodeSize}if(t.parentOffset<t.parent.content.size||!t.parent.isTextblock)return!1;let o=e.resolve(qg(t,!0,!0));return!(!o.parent.isTextblock||o.pos>r||qg(o,!0,!1)<r)&&n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(h,g.start,g.endA,b,f)&&e.someProp("handleKeyDown",(a=>a(e,Ou(8,"Backspace")))))return void(Uu&&Ru&&e.domObserver.suppressSelectionUpdates());Ru&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),Uu&&!y&&b.start()!=f.start()&&0==f.parentOffset&&b.depth==f.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,f=u.doc.resolveNoCache(g.endB-u.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(a){return a(e,Ou(13,"Enter"))}))}),20));let v,w,z,j=g.start,x=g.endA;if(y)if(b.pos==f.pos)Nu&&Iu<=11&&0==b.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Lh(e)),20)),v=e.state.tr.delete(j,x),w=h.resolve(g.start).marksAcross(h.resolve(g.endA));else if(g.endA==g.endB&&(z=function(e,a){let r,n,i,t=e.firstChild.marks,o=a.firstChild.marks,s=t,l=o;for(let e=0;e<o.length;e++)s=o[e].removeFromSet(s);for(let e=0;e<t.length;e++)l=t[e].removeFromSet(l);if(1==s.length&&0==l.length)n=s[0],r="add",i=e=>e.mark(n.addToSet(e.marks));else{if(0!=s.length||1!=l.length)return null;n=l[0],r="remove",i=e=>e.mark(n.removeFromSet(e.marks))}let c=[];for(let e=0;e<a.childCount;e++)c.push(i(a.child(e)));if(Ql.from(c).eq(e))return{mark:n,type:r}}(b.parent.content.cut(b.parentOffset,f.parentOffset),k.parent.content.cut(k.parentOffset,g.endA-k.start()))))v=e.state.tr,"add"==z.type?v.addMark(j,x,z.mark):v.removeMark(j,x,z.mark);else if(b.parent.child(b.index()).isText&&b.index()==f.index()-(f.textOffset?0:1)){let a=b.parent.textBetween(b.parentOffset,f.parentOffset);if(e.someProp("handleTextInput",(r=>r(e,j,x,a))))return;v=e.state.tr.insertText(a,j,x)}if(v||(v=e.state.tr.replace(j,x,u.doc.slice(g.start-u.from,g.endB-u.from))),u.sel){let a=$g(e,v.doc,u.sel);a&&!(Ru&&e.composing&&a.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(a.head==j||a.head==v.mapping.map(x)-1)||Nu&&a.empty&&a.head==j)&&v.setSelection(a)}w&&v.ensureMarks(w),t&&v.setMeta("composition",t),e.dispatch(v.scrollIntoView())}function $g(e,a,r){return Math.max(r.anchor,r.head)>a.content.size?null:Kh(e,a.resolve(r.anchor),a.resolve(r.head))}function qg(e,a,r){let n=e.depth,i=a?e.end():e.pos;for(;n>0&&(a||e.indexAfter(n)==e.node(n).childCount);)n--,i++,a=!1;if(r){let a=e.node(n).maybeChild(e.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Cg(e){if(2!=e.length)return!1;let a=e.charCodeAt(0),r=e.charCodeAt(1);return a>=56320&&a<=57343&&r>=55296&&r<=56319}class Sg{constructor(e,a){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 $m,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=a,this.state=a.state,this.directPlugins=a.plugins||[],this.directPlugins.forEach(Ag),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=Mg(this),Eg(this),this.nodeViews=_g(this),this.docView=jh(this.state.doc,Og(this),mg(this),this.dom,this),this.domObserver=new fg(this,((e,a,r,n)=>xg(this,e,a,r,n))),this.domObserver.start(),function(e){for(let a in zm){let r=zm[a];e.dom.addEventListener(a,e.input.eventHandlers[a]=a=>{!Om(e,a)||Sm(e,a)||!e.editable&&a.type in jm||r(e,a)},xm[a]?{passive:!0}:void 0)}Bu&&e.dom.addEventListener("input",(()=>null)),Cm(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 a in e)this._props[a]=e[a];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Cm(this);let a=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ag),this.directPlugins=e.plugins),this.updateStateInner(e.state,a)}setProps(e){let a={};for(let e in this._props)a[e]=this._props[e];a.state=this.state;for(let r in e)a[r]=e[r];this.update(a)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,a){var r;let n=this.state,i=!1,t=!1;e.storedMarks&&this.composing&&(Bm(this),t=!0),this.state=e;let o=n.plugins!=e.plugins||this._props.plugins!=a.plugins;if(o||this._props.plugins!=a.plugins||this._props.nodeViews!=a.nodeViews){let e=_g(this);(function(e,a){let r=0,n=0;for(let n in e){if(e[n]!=a[n])return!0;r++}for(let e in a)n++;return r!=n})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||a.handleDOMEvents!=this._props.handleDOMEvents)&&Cm(this),this.editable=Mg(this),Eg(this);let s=mg(this),l=Og(this),c=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(n.selection)||(t=!0);let u="preserve"==c&&t&&null==this.dom.style.overflowAnchor&&function(e){let a,r,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let t=(n.left+n.right)/2,o=i+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=e.root.elementFromPoint(t,o);if(!n||n==e.dom||!e.dom.contains(n))continue;let s=n.getBoundingClientRect();if(s.top>=i-20){a=n,r=s.top;break}}return{refDOM:a,refTop:r,stack:Qu(e.dom)}}(this);if(t){this.domObserver.stop();let a=d&&(Nu||Ru)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,a){let r=Math.min(e.$anchor.sharedDepth(e.head),a.$anchor.sharedDepth(a.head));return e.$anchor.start(r)!=a.$anchor.start(r)}(n.selection,e.selection);if(d){let r=Ru?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Vm(this)),!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=jh(e.doc,l,s,this.dom,this)),r&&!this.trackWrites&&(a=!0)}a||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let a=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return ju(a.node,a.offset,r.anchorNode,r.anchorOffset)}(this))?Lh(this,a):(Uh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),(null===(r=this.dragging)||void 0===r?void 0:r.node)&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:a,stack:r}){let n=e?e.getBoundingClientRect().top:0;eh(r,0==n?0:n-a)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof ru){let a=this.docView.domAfterPos(this.state.selection.from);1==a.nodeType&&Xu(this,a.getBoundingClientRect(),e)}else Xu(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 a=0;a<this.pluginViews.length;a++){let r=this.pluginViews[a];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let a=this.directPlugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let a=this.state.plugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}updateDraggedNode(e,a){let r=e.node,n=-1;if(this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let e=r.from+(this.state.doc.content.size-a.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==r.node&&(n=e)}this.dragging=new Km(e.slice,e.move,n<0?void 0:ru.create(this.state.doc,n))}someProp(e,a){let r,n=this._props&&this._props[e];if(null!=n&&(r=a?a(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=a?a(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let t=i[n].props[e];if(null!=t&&(r=a?a(t):t))return r}}hasFocus(){if(Nu){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(ah)return e.focus(ah);let a=Qu(e);e.focus(null==ah?{get preventScroll(){return ah={preventScroll:!0},!0}}:void 0),ah||(ah=!1,eh(a,0))}(this.dom),Lh(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 th(this,e)}coordsAtPos(e,a=1){return ch(this,e,a)}domAtPos(e,a=0){return this.docView.domFromPos(e,a)}nodeDOM(e){let a=this.docView.descAt(e);return a?a.nodeDOM:null}posAtDOM(e,a,r=-1){let n=this.docView.posFromDOM(e,a,r);if(null==n)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(e,a){return fh(this,a||this.state,e)}pasteHTML(e,a){return Um(this,"",e,!1,a||new ClipboardEvent("paste"))}pasteText(e,a){return Um(this,e,null,!0,a||new ClipboardEvent("paste"))}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let a in e.input.eventHandlers)e.dom.removeEventListener(a,e.input.eventHandlers[a]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,wu=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,a){Sm(e,a)||!zm[a.type]||!e.editable&&a.type in jm||zm[a.type](e,a)}(this,e)}dispatch(e){let a=this._props.dispatchTransaction;a?a.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Bu&&11===this.root.nodeType&&function(e){let a=e.activeElement;for(;a&&a.shadowRoot;)a=a.shadowRoot.activeElement;return a}(this.dom.ownerDocument)==this.dom&&function(e,a){if(a.getComposedRanges){let r=a.getComposedRanges(e.root)[0];if(r)return vg(e,r)}let r;function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?vg(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Og(e){let a=Object.create(null);return a.class="ProseMirror",a.contenteditable=String(e.editable),e.someProp("attributes",(r=>{if("function"==typeof r&&(r=r(e.state)),r)for(let e in r)"class"==e?a.class+=" "+r[e]:"style"==e?a.style=(a.style?a.style+";":"")+r[e]:a[e]||"contenteditable"==e||"nodeName"==e||(a[e]=String(r[e]))})),a.translate||(a.translate="no"),[eg.node(0,e.state.doc.content.size,a)]}function Eg(e){if(e.markCursor){let a=document.createElement("img");a.className="ProseMirror-separator",a.setAttribute("mark-placeholder","true"),a.setAttribute("alt",""),e.cursorWrapper={dom:a,deco:eg.widget(e.state.selection.from,a,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Mg(e){return!e.someProp("editable",(a=>!1===a(e.state)))}function _g(e){let a=Object.create(null);function r(e){for(let r in e)Object.prototype.hasOwnProperty.call(a,r)||(a[r]=e[r])}return e.someProp("nodeViews",r),e.someProp("markViews",r),a}function Ag(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")}for(var Dg={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:"'"},Tg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ng="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ig="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Fg=0;Fg<10;Fg++)Dg[48+Fg]=Dg[96+Fg]=String(Fg);for(Fg=1;Fg<=24;Fg++)Dg[Fg+111]="F"+Fg;for(Fg=65;Fg<=90;Fg++)Dg[Fg]=String.fromCharCode(Fg+32),Tg[Fg]=String.fromCharCode(Fg);for(var Pg in Dg)Tg.hasOwnProperty(Pg)||(Tg[Pg]=Dg[Pg]);const Rg="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Lg(e){let a,r,n,i,t=e.split(/-(?!$)/),o=t[t.length-1];"Space"==o&&(o=" ");for(let e=0;e<t.length-1;e++){let o=t[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))a=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else{if(!/^mod$/i.test(o))throw new Error("Unrecognized modifier name: "+o);Rg?i=!0:r=!0}}return a&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),n&&(o="Shift-"+o),o}function Bg(e,a,r=!0){return a.altKey&&(e="Alt-"+e),a.ctrlKey&&(e="Ctrl-"+e),a.metaKey&&(e="Meta-"+e),r&&a.shiftKey&&(e="Shift-"+e),e}function Vg(e){let a=function(e){let a=Object.create(null);for(let r in e)a[Lg(r)]=e[r];return a}(e);return function(e,r){let n,i=function(e){var a=!(Ng&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Ig&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Tg:Dg)[e.keyCode]||e.key||"Unidentified";return"Esc"==a&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a}(r),t=a[Bg(i,r)];if(t&&t(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(r.shiftKey){let n=a[Bg(i,r,!1)];if(n&&n(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(n=Dg[r.keyCode])&&n!=i){let i=a[Bg(n,r)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}function Hg(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("backward",e):r.parentOffset>0)?null:r}function Wg(e,a,r){let n=a.nodeBefore,i=a.pos-1;for(;!n.isTextblock;i--){if(n.type.spec.isolating)return!1;let e=n.lastChild;if(!e)return!1;n=e}let t=a.nodeAfter,o=a.pos+1;for(;!t.isTextblock;o++){if(t.type.spec.isolating)return!1;let e=t.firstChild;if(!e)return!1;t=e}let s=Td(e.doc,i,o,tc.empty);if(!s||s.from!=i||s instanceof vd&&s.slice.size>=o-i)return!1;if(r){let a=e.tr.step(s);a.setSelection(eu.create(a.doc,i)),r(a.scrollIntoView())}return!0}function Ug(e,a,r=!1){for(let n=e;n;n="start"==a?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)return!1}return!1}function Gg(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){if(e.index(a)>0)return e.doc.resolve(e.before(a+1));if(e.node(a).type.spec.isolating)break}return null}function Kg(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)?null:r}function Zg(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){let r=e.node(a);if(e.index(a)+1<r.childCount)return e.doc.resolve(e.after(a+1));if(r.type.spec.isolating)break}return null}function Jg(e){for(let a=0;a<e.edgeCount;a++){let{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function Yg(e,a,r,n){let i,t,o=a.nodeBefore,s=a.nodeAfter,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&function(e,a,r){let n=a.nodeBefore,i=a.nodeAfter,t=a.index();return!(!(n&&i&&n.type.compatibleContent(i.type))||(!n.content.size&&a.parent.canReplace(t-1,t)?(r&&r(e.tr.delete(a.pos-n.nodeSize,a.pos).scrollIntoView()),0):!a.parent.canReplace(t,t+1)||!i.isTextblock&&!Md(e.doc,a.pos)||(r&&r(e.tr.join(a.pos).scrollIntoView()),0)))}(e,a,r))return!0;let c=!l&&a.parent.canReplace(a.index(),a.index()+1);if(c&&(i=(t=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&t.matchType(i[0]||s.type).validEnd){if(r){let n=a.pos+s.nodeSize,t=Ql.empty;for(let e=i.length-1;e>=0;e--)t=Ql.from(i[e].create(null,t));t=Ql.from(o.copy(t));let l=e.tr.step(new wd(a.pos-1,n,a.pos,n,new tc(t,1,0),i.length,!0)),c=l.doc.resolve(n+2*i.length);c.nodeAfter&&c.nodeAfter.type==o.type&&Md(l.doc,c.pos)&&l.join(c.pos),r(l.scrollIntoView())}return!0}let d=s.type.spec.isolating||n>0&&l?null:Jd.findFrom(a,1),u=d&&d.$from.blockRange(d.$to),h=u&&$d(u);if(null!=h&&h>=a.depth)return r&&r(e.tr.lift(u,h).scrollIntoView()),!0;if(c&&Ug(s,"start",!0)&&Ug(o,"end")){let n=o,i=[];for(;i.push(n),!n.isTextblock;)n=n.lastChild;let t=s,l=1;for(;!t.isTextblock;t=t.firstChild)l++;if(n.canReplace(n.childCount,n.childCount,t.content)){if(r){let n=Ql.empty;for(let e=i.length-1;e>=0;e--)n=Ql.from(i[e].copy(n));r(e.tr.step(new wd(a.pos-i.length,a.pos+s.nodeSize,a.pos+l,a.pos+s.nodeSize-l,new tc(n,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Xg(e){return function(a,r){let n=a.selection,i=e<0?n.$from:n.$to,t=i.depth;for(;i.node(t).isInline;){if(!t)return!1;t--}return!!i.node(t).isTextblock&&(r&&r(a.tr.setSelection(eu.create(a.doc,e<0?i.start(t):i.end(t)))),!0)}}const Qg=Xg(-1),ep=Xg(1);function ap(e,a=null){return function(r,n){let i=!1;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(t,o,((n,t)=>{if(i)return!1;if(n.isTextblock&&!n.hasMarkup(e,a))if(n.type==e)i=!0;else{let a=r.doc.resolve(t),n=a.index();i=a.parent.canReplaceWith(n,n+1,e)}}))}if(!i)return!1;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(t,o,e,a)}n(i.scrollIntoView())}return!0}}function rp(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t);if(!o)return!1;let s=n?r.tr:null;return!!function(e,a,r,n=null){let i=!1,t=a,o=a.$from.doc;if(a.depth>=2&&a.$from.node(a.depth-1).type.compatibleContent(r)&&0==a.startIndex){if(0==a.$from.index(a.depth-1))return!1;let e=o.resolve(a.start-2);t=new wc(e,e,a.depth),a.endIndex<a.parent.childCount&&(a=new wc(a.$from,o.resolve(a.$to.end(a.depth)),a.depth)),i=!0}let s=qd(t,r,n,a);if(!s)return!1;e&&function(e,a,r,n,i){let t=Ql.empty;for(let e=r.length-1;e>=0;e--)t=Ql.from(r[e].type.create(r[e].attrs,t));e.step(new wd(a.start-(n?2:0),a.end,a.start,a.end,new tc(t,0,0),r.length,!0));let o=0;for(let e=0;e<r.length;e++)r[e].type==i&&(o=e+1);let s=r.length-o,l=a.start+r.length-(n?2:0),c=a.parent;for(let r=a.startIndex,n=a.endIndex,i=!0;r<n;r++,i=!1)!i&&Ed(e.doc,l,s)&&(e.split(l,s),l+=2*s),l+=c.child(r).nodeSize}(e,a,s,i,r);return!0}(s,o,e,a)&&(n&&n(s.scrollIntoView()),!0)}}function np(e){return function(a,r){let{$from:n,$to:i}=a.selection,t=n.blockRange(i,(a=>a.childCount>0&&a.firstChild.type==e));return!!t&&(!r||(n.node(t.depth-1).type==e?function(e,a,r,n){let i=e.tr,t=n.end,o=n.$to.end(n.depth);t<o&&(i.step(new wd(t-1,o,t,o,new tc(Ql.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new wc(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const s=$d(n);if(null==s)return!1;i.lift(n,s);let l=i.mapping.map(t,-1)-1;Md(i.doc,l)&&i.join(l);return a(i.scrollIntoView()),!0}(a,r,e,t):function(e,a,r){let n=e.tr,i=r.parent;for(let e=r.end,a=r.endIndex-1,t=r.startIndex;a>t;a--)e-=i.child(a).nodeSize,n.delete(e-1,e+1);let t=n.doc.resolve(r.start),o=t.nodeAfter;if(n.mapping.map(r.end)!=r.start+t.nodeAfter.nodeSize)return!1;let s=0==r.startIndex,l=r.endIndex==i.childCount,c=t.node(-1),d=t.index(-1);if(!c.canReplace(d+(s?0:1),d+1,o.content.append(l?Ql.empty:Ql.from(i))))return!1;let u=t.pos,h=u+o.nodeSize;return n.step(new wd(u-(s?1:0),h+(l?1:0),u+1,h-1,new tc((s?Ql.empty:Ql.from(i.copy(Ql.empty))).append(l?Ql.empty:Ql.from(i.copy(Ql.empty))),s?0:1,l?0:1),s?0:1)),a(n.scrollIntoView()),!0}(a,r,t)))}}function ip(e){const{state:a,transaction:r}=e;let{selection:n}=r,{doc:i}=r,{storedMarks:t}=r;return{...a,apply:a.apply.bind(a),applyTransaction:a.applyTransaction.bind(a),plugins:a.plugins,schema:a.schema,reconfigure:a.reconfigure.bind(a),toJSON:a.toJSON.bind(a),get storedMarks(){return t},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,t=r.storedMarks,r}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class tp{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:a,state:r}=this,{view:n}=a,{tr:i}=r,t=this.buildProps(i);return Object.fromEntries(Object.entries(e).map((([e,a])=>[e,(...e)=>{const r=a(...e)(t);return i.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(i),r}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o=[],s=!!e,l=e||i.tr,c={...Object.fromEntries(Object.entries(r).map((([e,r])=>[e,(...e)=>{const n=this.buildProps(l,a),i=r(...e)(n);return o.push(i),c}]))),run:()=>(s||!a||l.getMeta("preventDispatch")||this.hasCustomState||t.dispatch(l),o.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:a,state:r}=this,n=!1,i=e||r.tr,t=this.buildProps(i,n),o=Object.fromEntries(Object.entries(a).map((([e,a])=>[e,(...e)=>a(...e)({...t,dispatch:void 0})])));return{...o,chain:()=>this.createChain(i,n)}}buildProps(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o={tr:e,editor:n,view:t,state:ip({state:i,transaction:e}),dispatch:a?()=>{}:void 0,chain:()=>this.createChain(e,a),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map((([e,a])=>[e,(...e)=>a(...e)(o)])))}};return o}}class op{constructor(){this.callbacks={}}on(e,a){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(a),this}emit(e,...a){const r=this.callbacks[e];return r&&r.forEach((e=>e.apply(this,a))),this}off(e,a){const r=this.callbacks[e];return r&&(a?this.callbacks[e]=r.filter((e=>e!==a)):delete this.callbacks[e]),this}once(e,a){const r=(...n)=>{this.off(e,r),a.apply(this,n)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function sp(e,a,r){if(void 0===e.config[a]&&e.parent)return sp(e.parent,a,r);if("function"==typeof e.config[a]){return e.config[a].bind({...r,parent:e.parent?sp(e.parent,a,r):null})}return e.config[a]}function lp(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function cp(e){const a=[],{nodeExtensions:r,markExtensions:n}=lp(e),i=[...r,...n],t={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const r=sp(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:i});if(!r)return;r().forEach((e=>{e.types.forEach((r=>{Object.entries(e.attributes).forEach((([e,n])=>{a.push({type:r,name:e,attribute:{...t,...n}})}))}))}))})),i.forEach((e=>{const r={name:e.name,options:e.options,storage:e.storage},n=sp(e,"addAttributes",r);if(!n)return;const i=n();Object.entries(i).forEach((([r,n])=>{const i={...t,...n};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,a.push({type:e.name,name:r,attribute:i})}))})),a}function dp(e,a){if("string"==typeof e){if(!a.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return a.nodes[e]}return e}function up(...e){return e.filter((e=>!!e)).reduce(((e,a)=>{const r={...e};return Object.entries(a).forEach((([e,a])=>{if(r[e])if("class"===e){const n=a?String(a).split(" "):[],i=r[e]?r[e].split(" "):[],t=n.filter((e=>!i.includes(e)));r[e]=[...i,...t].join(" ")}else if("style"===e){const n=a?a.split(";").map((e=>e.trim())).filter(Boolean):[],i=r[e]?r[e].split(";").map((e=>e.trim())).filter(Boolean):[],t=new Map;i.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),n.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),r[e]=Array.from(t.entries()).map((([e,a])=>`${e}: ${a}`)).join("; ")}else r[e]=a;else r[e]=a})),r}),{})}function hp(e,a){return a.filter((a=>a.type===e.type.name)).filter((e=>e.attribute.rendered)).map((a=>a.attribute.renderHTML?a.attribute.renderHTML(e.attrs)||{}:{[a.name]:e.attrs[a.name]})).reduce(((e,a)=>up(e,a)),{})}function mp(e){return"function"==typeof e}function gp(e,a=void 0,...r){return mp(e)?a?e.bind(a)(...r):e(...r):e}function pp(e,a){return"style"in e?e:{...e,getAttrs:r=>{const n=e.getAttrs?e.getAttrs(r):e.attrs;if(!1===n)return!1;const i=a.reduce(((e,a)=>{const n=a.attribute.parseHTML?a.attribute.parseHTML(r):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(r.getAttribute(a.name));return null==n?e:{...e,[a.name]:n}}),{});return{...n,...i}}}}function bp(e){return Object.fromEntries(Object.entries(e).filter((([e,a])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(a))&&null!=a)))}function fp(e,a){return a.nodes[e]||a.marks[e]||null}function kp(e,a){return Array.isArray(a)?a.some((a=>("string"==typeof a?a:a.name)===e.name)):a}function yp(e,a){const r=ed.fromSchema(a).serializeFragment(e),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(r),n.innerHTML}function vp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class wp{constructor(e){this.find=e.find,this.handler=e.handler}}function zp(e){var a;const{editor:r,from:n,to:i,text:t,rules:o,plugin:s}=e,{view:l}=r;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(null===(a=c.nodeBefore||c.nodeAfter)||void 0===a?void 0:a.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const u=((e,a=500)=>{let r="";const n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-a),n,((e,a,i,t)=>{var o,s;const l=(null===(s=(o=e.type.spec).toText)||void 0===s?void 0:s.call(o,{node:e,pos:a,parent:i,index:t}))||e.textContent||"%leaf%";r+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,n-a))})),r})(c)+t;return o.forEach((e=>{if(d)return;const a=((e,a)=>{if(vp(a))return a.exec(e);const r=a(e);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=e,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n})(u,e.find);if(!a)return;const o=l.state.tr,c=ip({state:l.state,transaction:o}),h={from:n-(a[0].length-t.length),to:i},{commands:m,chain:g,can:p}=new tp({editor:r,state:c});null!==e.handler({state:c,range:h,match:a,commands:m,chain:g,can:p})&&o.steps.length&&(o.setMeta(s,{transform:o,from:n,to:i,text:t}),l.dispatch(o),d=!0)})),d}function jp(e){const{editor:a,rules:r}=e,n=new pu({state:{init:()=>null,apply(e,i,t){const o=e.getMeta(n);if(o)return o;const s=e.getMeta("applyInputRules");return!!s&&setTimeout((()=>{let{text:e}=s;"string"==typeof e||(e=yp(Ql.from(e),t.schema));const{from:i}=s,o=i+e.length;zp({editor:a,from:i,to:o,text:e,rules:r,plugin:n})})),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,t,o)=>zp({editor:a,from:i,to:t,text:o,rules:r,plugin:n}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:i}=e.state.selection;i&&zp({editor:a,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})})),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;const{$cursor:t}=e.state.selection;return!!t&&zp({editor:a,from:t.pos,to:t.pos,text:"\n",rules:r,plugin:n})}},isInputRules:!0});return n}function xp(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function $p(e,a){const r={...e};return xp(e)&&xp(a)&&Object.keys(a).forEach((n=>{xp(a[n])&&xp(e[n])?r[n]=$p(e[n],a[n]):r[n]=a[n]})),r}class qp{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=gp(sp(this,"addOptions",{name:this.name}))),this.storage=gp(sp(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new qp(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>$p(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new qp(e);return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=gp(sp(a,"addOptions",{name:a.name})),a.storage=gp(sp(a,"addStorage",{name:a.name,options:a.options})),a}static handleExit({editor:e,mark:a}){const{tr:r}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){const i=n.marks();if(!!!i.find((e=>(null==e?void 0:e.type.name)===a.name)))return!1;const t=i.find((e=>(null==e?void 0:e.type.name)===a.name));return t&&r.removeStoredMark(t),r.insertText(" ",n.pos),e.view.dispatch(r),!0}return!1}}class Cp{constructor(e){this.find=e.find,this.handler=e.handler}}function Sp(e){const{editor:a,state:r,from:n,to:i,rule:t,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:c,can:d}=new tp({editor:a,state:r}),u=[];r.doc.nodesBetween(n,i,((e,a)=>{if(!e.isTextblock||e.type.spec.code)return;const h=Math.max(n,a),m=Math.min(i,a+e.content.size),g=((e,a,r)=>{if(vp(a))return[...e.matchAll(a)];const n=a(e,r);return n?n.map((a=>{const r=[a.text];return r.index=a.index,r.input=e,r.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(a.replaceWith)),r})):[]})(e.textBetween(h-a,m-a,void 0,""),t.find,o);g.forEach((e=>{if(void 0===e.index)return;const a=h+e.index+1,n=a+e[0].length,i={from:r.tr.mapping.map(a),to:r.tr.mapping.map(n)},m=t.handler({state:r,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:s});u.push(m)}))}));const h=u.every((e=>null!==e));return h}let Op=null;function Ep(e){const{editor:a,rules:r}=e;let n,i=null,t=!1,o=!1,s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}const l=({state:e,from:r,to:i,rule:t,pasteEvt:o})=>{const l=e.tr,c=ip({state:e,transaction:l});if(Sp({editor:a,state:c,from:Math.max(r-1,0),to:i.b-1,rule:t,pasteEvent:o,dropEvent:n})&&l.steps.length){try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}return s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}},c=r.map((e=>new pu({view(e){const r=r=>{var n;i=(null===(n=e.dom.parentElement)||void 0===n?void 0:n.contains(r.target))?e.dom.parentElement:null,i&&(Op=a)},n=()=>{Op&&(Op=null)};return window.addEventListener("dragstart",r),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",r),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,a)=>{if(o=i===e.dom.parentElement,n=a,!o){const e=Op;e&&setTimeout((()=>{const a=e.state.selection;a&&e.commands.deleteRange({from:a.from,to:a.to})}),10)}return!1},paste:(e,a)=>{var r;const n=null===(r=a.clipboardData)||void 0===r?void 0:r.getData("text/html");return s=a,t=!!(null==n?void 0:n.includes("data-pm-slice")),!1}}},appendTransaction:(a,r,n)=>{const i=a[0],c="paste"===i.getMeta("uiEvent")&&!t,d="drop"===i.getMeta("uiEvent")&&!o,u=i.getMeta("applyPasteRules"),h=!!u;if(!c&&!d&&!h)return;if(h){let{text:a}=u;"string"==typeof a||(a=yp(Ql.from(a),n.schema));const{from:r}=u,i=r+a.length,t=(e=>{var a;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(a=r.clipboardData)||void 0===a||a.setData("text/html",e),r})(a);return l({rule:e,state:n,from:r,to:{b:i},pasteEvt:t})}const m=r.doc.content.findDiffStart(n.doc.content),g=r.doc.content.findDiffEnd(n.doc.content);return"number"==typeof m&&g&&m!==g.b?l({rule:e,state:n,from:m,to:g,pasteEvt:s}):void 0}})));return c}class Mp{constructor(e,a){this.splittableMarks=[],this.editor=a,this.extensions=Mp.resolve(e),this.schema=function(e,a){var r;const n=cp(e),{nodeExtensions:i,markExtensions:t}=lp(e),o=null===(r=i.find((e=>sp(e,"topNode"))))||void 0===r?void 0:r.name,s=Object.fromEntries(i.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=bp({...e.reduce(((e,a)=>{const n=sp(a,"extendNodeSchema",t);return{...e,...n?n(r):{}}}),{}),content:gp(sp(r,"content",t)),marks:gp(sp(r,"marks",t)),group:gp(sp(r,"group",t)),inline:gp(sp(r,"inline",t)),atom:gp(sp(r,"atom",t)),selectable:gp(sp(r,"selectable",t)),draggable:gp(sp(r,"draggable",t)),code:gp(sp(r,"code",t)),whitespace:gp(sp(r,"whitespace",t)),linebreakReplacement:gp(sp(r,"linebreakReplacement",t)),defining:gp(sp(r,"defining",t)),isolating:gp(sp(r,"isolating",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=gp(sp(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>pp(e,i))));const l=sp(r,"renderHTML",t);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:hp(e,i)}));const c=sp(r,"renderText",t);return c&&(o.toText=c),[r.name,o]}))),l=Object.fromEntries(t.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=bp({...e.reduce(((e,a)=>{const n=sp(a,"extendMarkSchema",t);return{...e,...n?n(r):{}}}),{}),inclusive:gp(sp(r,"inclusive",t)),excludes:gp(sp(r,"excludes",t)),group:gp(sp(r,"group",t)),spanning:gp(sp(r,"spanning",t)),code:gp(sp(r,"code",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=gp(sp(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>pp(e,i))));const l=sp(r,"renderHTML",t);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:hp(e,i)})),[r.name,o]})));return new Bc({topNode:o,nodes:s,marks:l})}(this.extensions,a),this.setupExtensions()}static resolve(e){const a=Mp.sort(Mp.flatten(e)),r=function(e){const a=e.filter(((a,r)=>e.indexOf(a)!==r));return Array.from(new Set(a))}(a.map((e=>e.name)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),a}static flatten(e){return e.map((e=>{const a=sp(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return a?[e,...this.flatten(a())]:e})).flat(10)}static sort(e){return e.sort(((e,a)=>{const r=sp(e,"priority")||100,n=sp(a,"priority")||100;return r>n?-1:r<n?1:0}))}get commands(){return this.extensions.reduce(((e,a)=>{const r=sp(a,"addCommands",{name:a.name,options:a.options,storage:a.storage,editor:this.editor,type:fp(a.name,this.schema)});return r?{...e,...r()}:e}),{})}get plugins(){const{editor:e}=this,a=Mp.sort([...this.extensions].reverse()),r=[],n=[],i=a.map((a=>{const i={name:a.name,options:a.options,storage:a.storage,editor:e,type:fp(a.name,this.schema)},t=[],o=sp(a,"addKeyboardShortcuts",i);let s={};if("mark"===a.type&&sp(a,"exitable",i)&&(s.ArrowRight=()=>qp.handleExit({editor:e,mark:a})),o){const a=Object.fromEntries(Object.entries(o()).map((([a,r])=>[a,()=>r({editor:e})])));s={...s,...a}}const l=new pu({props:{handleKeyDown:Vg(s)}});t.push(l);const c=sp(a,"addInputRules",i);kp(a,e.options.enableInputRules)&&c&&r.push(...c());const d=sp(a,"addPasteRules",i);kp(a,e.options.enablePasteRules)&&d&&n.push(...d());const u=sp(a,"addProseMirrorPlugins",i);if(u){const e=u();t.push(...e)}return t})).flat();return[jp({editor:e,rules:r}),...Ep({editor:e,rules:n}),...i]}get attributes(){return cp(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:a}=lp(this.extensions);return Object.fromEntries(a.filter((e=>!!sp(e,"addNodeView"))).map((a=>{const r=this.attributes.filter((e=>e.type===a.name)),n={name:a.name,options:a.options,storage:a.storage,editor:e,type:dp(a.name,this.schema)},i=sp(a,"addNodeView",n);if(!i)return[];return[a.name,(n,t,o,s,l)=>{const c=hp(n,r);return i()({node:n,view:t,getPos:o,decorations:s,innerDecorations:l,editor:e,extension:a,HTMLAttributes:c})}]})))}setupExtensions(){this.extensions.forEach((e=>{var a;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:fp(e.name,this.schema)};if("mark"===e.type){(null===(a=gp(sp(e,"keepOnSplit",r)))||void 0===a||a)&&this.splittableMarks.push(e.name)}const n=sp(e,"onBeforeCreate",r),i=sp(e,"onCreate",r),t=sp(e,"onUpdate",r),o=sp(e,"onSelectionUpdate",r),s=sp(e,"onTransaction",r),l=sp(e,"onFocus",r),c=sp(e,"onBlur",r),d=sp(e,"onDestroy",r);n&&this.editor.on("beforeCreate",n),i&&this.editor.on("create",i),t&&this.editor.on("update",t),o&&this.editor.on("selectionUpdate",o),s&&this.editor.on("transaction",s),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class _p{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=gp(sp(this,"addOptions",{name:this.name}))),this.storage=gp(sp(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new _p(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>$p(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new _p({...this.config,...e});return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=gp(sp(a,"addOptions",{name:a.name})),a.storage=gp(sp(a,"addStorage",{name:a.name,options:a.options})),a}}function Ap(e,a,r){const{from:n,to:i}=a,{blockSeparator:t="\n\n",textSerializers:o={}}=r||{};let s="";return e.nodesBetween(n,i,((e,r,l,c)=>{var d;e.isBlock&&r>n&&(s+=t);const u=null==o?void 0:o[e.type.name];if(u)return l&&(s+=u({node:e,pos:r,parent:l,index:c,range:a})),!1;e.isText&&(s+=null===(d=null==e?void 0:e.text)||void 0===d?void 0:d.slice(Math.max(n,r)-r,i-r))})),s}function Dp(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,a])=>[e,a.spec.toText])))}const Tp=_p.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new pu({key:new ku("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:a,schema:r}=e,{doc:n,selection:i}=a,{ranges:t}=i,o=Math.min(...t.map((e=>e.$from.pos))),s=Math.max(...t.map((e=>e.$to.pos))),l=Dp(r);return Ap(n,{from:o,to:s},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function Np(e,a,r={strict:!0}){const n=Object.keys(a);return!n.length||n.every((n=>r.strict?a[n]===e[n]:vp(a[n])?a[n].test(e[n]):a[n]===e[n]))}function Ip(e,a,r={}){return e.find((e=>e.type===a&&Np(Object.fromEntries(Object.keys(r).map((a=>[a,e.attrs[a]]))),r)))}function Fp(e,a,r={}){return!!Ip(e,a,r)}function Pp(e,a,r){var n;if(!e||!a)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some((e=>e.type===a))||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some((e=>e.type===a)))return;r=r||(null===(n=i.node.marks[0])||void 0===n?void 0:n.attrs);if(!Ip([...i.node.marks],a,r))return;let t=i.index,o=e.start()+i.offset,s=t+1,l=o+i.node.nodeSize;for(;t>0&&Fp([...e.parent.child(t-1).marks],a,r);)t-=1,o-=e.parent.child(t).nodeSize;for(;s<e.parent.childCount&&Fp([...e.parent.child(s).marks],a,r);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function Rp(e,a){if("string"==typeof e){if(!a.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return a.marks[e]}return e}function Lp(e){return e instanceof eu}function Bp(e=0,a=0,r=0){return Math.min(Math.max(e,a),r)}function Vp(e,a=null){if(!a)return null;const r=Jd.atStart(e),n=Jd.atEnd(e);if("start"===a||!0===a)return r;if("end"===a)return n;const i=r.from,t=n.to;return"all"===a?eu.create(e,Bp(0,i,t),Bp(e.content.size,i,t)):eu.create(e,Bp(a,i,t),Bp(a,i,t))}const Hp=e=>{const a=e.childNodes;for(let r=a.length-1;r>=0;r-=1){const n=a[r];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):1===n.nodeType&&Hp(n)}return e};function Wp(e){const a=`<body>${e}</body>`,r=(new window.DOMParser).parseFromString(a,"text/html").body;return Hp(r)}function Up(e,a,r){if(e instanceof jc||e instanceof Ql)return e;r={slice:!0,parseOptions:{},...r};const n="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Ql.fromArray(e.map((e=>a.nodeFromJSON(e))));const n=a.nodeFromJSON(e);return r.errorOnInvalidContent&&n.check(),n}catch(n){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),Up("",a,r)}if(n){if(r.errorOnInvalidContent){let n=!1,i="";const t=new Bc({topNode:a.spec.topNode,marks:a.spec.marks,nodes:a.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(n=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(r.slice?Hc.fromSchema(t).parseSlice(Wp(e),r.parseOptions):Hc.fromSchema(t).parse(Wp(e),r.parseOptions),r.errorOnInvalidContent&&n)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const n=Hc.fromSchema(a);return r.slice?n.parseSlice(Wp(e),r.parseOptions).content:n.parse(Wp(e),r.parseOptions)}return Up("",a,r)}function Gp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Kp(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Zp(e,a,r={}){const{from:n,to:i,empty:t}=e.selection,o=a?dp(a,e.schema):null,s=[];e.doc.nodesBetween(n,i,((e,a)=>{if(e.isText)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);s.push({node:e,from:r,to:t})}));const l=i-n,c=s.filter((e=>!o||o.name===e.node.type.name)).filter((e=>Np(e.node.attrs,r,{strict:!1})));if(t)return!!c.length;return c.reduce(((e,a)=>e+a.to-a.from),0)>=l}function Jp(e,a){return a.nodes[e]?"node":a.marks[e]?"mark":null}function Yp(e,a){const r="string"==typeof a?[a]:a;return Object.keys(e).reduce(((a,n)=>(r.includes(n)||(a[n]=e[n]),a)),{})}function Xp(e,a,r={},n={}){return Up(e,a,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}function Qp(e,a){const r=Rp(a,e.schema),{from:n,to:i,empty:t}=e.selection,o=[];t?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,i,(e=>{o.push(...e.marks)}));const s=o.find((e=>e.type.name===r.name));return s?{...s.attrs}:{}}function eb(e){return a=>function(e,a){for(let r=e.depth;r>0;r-=1){const n=e.node(r);if(a(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}(a.$from,e)}function ab(e,a){const r=Jp("string"==typeof a?a:a.name,e.schema);return"node"===r?function(e,a){const r=dp(a,e.schema),{from:n,to:i}=e.selection,t=[];e.doc.nodesBetween(n,i,(e=>{t.push(e)}));const o=t.reverse().find((e=>e.type.name===r.name));return o?{...o.attrs}:{}}(e,a):"mark"===r?Qp(e,a):{}}function rb(e,a,r){const n=[];return e===a?r.resolve(e).marks().forEach((a=>{const i=Pp(r.resolve(e),a.type);i&&n.push({mark:a,...i})})):r.nodesBetween(e,a,((e,a)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&n.push(...e.marks.map((r=>({from:a,to:a+e.nodeSize,mark:r}))))})),n}function nb(e,a,r){return Object.fromEntries(Object.entries(r).filter((([r])=>{const n=e.find((e=>e.type===a&&e.name===r));return!!n&&n.attribute.keepOnSplit})))}function ib(e,a,r={}){const{empty:n,ranges:i}=e.selection,t=a?Rp(a,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!t||t.name===e.type.name)).find((e=>Np(e.attrs,r,{strict:!1})));let o=0;const s=[];if(i.forEach((({$from:a,$to:r})=>{const n=a.pos,i=r.pos;e.doc.nodesBetween(n,i,((e,a)=>{if(!e.isText&&!e.marks.length)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);o+=t-r,s.push(...e.marks.map((e=>({mark:e,from:r,to:t}))))}))})),0===o)return!1;const l=s.filter((e=>!t||t.name===e.mark.type.name)).filter((e=>Np(e.mark.attrs,r,{strict:!1}))).reduce(((e,a)=>e+a.to-a.from),0),c=s.filter((e=>!t||e.mark.type!==t&&e.mark.type.excludes(t))).reduce(((e,a)=>e+a.to-a.from),0);return(l>0?l+c:l)>=o}function tb(e,a){const{nodeExtensions:r}=lp(a),n=r.find((a=>a.name===e));if(!n)return!1;const i=gp(sp(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function ob(e,{checkChildren:a=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!==(n=e.text)&&void 0!==n?n:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(a){let n=!0;return e.content.forEach((e=>{!1!==n&&(ob(e,{ignoreWhitespace:r,checkChildren:a})||(n=!1))})),n}return!1}function sb(e,a){const r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){const n=r.filter((e=>null==a?void 0:a.includes(e.type.name)));e.tr.ensureMarks(n)}}const lb=(e,a)=>{const r=eb((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Md(e.doc,r.pos)||(e.join(r.pos),!0)},cb=(e,a)=>{const r=eb((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(r.start).after(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Md(e.doc,n)||(e.join(n),!0)};var db=Object.freeze({__proto__:null,blur:()=>({editor:e,view:a})=>(requestAnimationFrame((()=>{var r;e.isDestroyed||(a.dom.blur(),null===(r=null===window||void 0===window?void 0:window.getSelection())||void 0===r||r.removeAllRanges())})),!0),clearContent:(e=!1)=>({commands:a})=>a.setContent("",e),clearNodes:()=>({state:e,tr:a,dispatch:r})=>{const{selection:n}=a,{ranges:i}=n;return!r||(i.forEach((({$from:r,$to:n})=>{e.doc.nodesBetween(r.pos,n.pos,((e,r)=>{if(e.type.isText)return;const{doc:n,mapping:i}=a,t=n.resolve(i.map(r)),o=n.resolve(i.map(r+e.nodeSize)),s=t.blockRange(o);if(!s)return;const l=$d(s);if(e.type.isTextblock){const{defaultType:e}=t.parent.contentMatchAt(t.index());a.setNodeMarkup(s.start,e)}(l||0===l)&&a.lift(s,l)}))})),!0)},command:e=>a=>e(a),createParagraphNear:()=>({state:e,dispatch:a})=>((e,a)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof iu||n.parent.inlineContent||i.parent.inlineContent)return!1;let t=Jg(i.parent.contentMatchAt(i.indexAfter()));if(!t||!t.isTextblock)return!1;if(a){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(r,t.createAndFill());o.setSelection(eu.create(o.doc,r+1)),a(o.scrollIntoView())}return!0})(e,a),cut:(e,a)=>({editor:r,tr:n})=>{const{state:i}=r,t=i.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);const o=n.mapping.map(a);return n.insert(o,t.content),n.setSelection(new eu(n.doc.resolve(o-1))),!0},deleteCurrentNode:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return!1;const i=e.selection.$anchor;for(let r=i.depth;r>0;r-=1){if(i.node(r).type===n.type){if(a){const a=i.before(r),n=i.after(r);e.delete(a,n).scrollIntoView()}return!0}}return!1},deleteNode:e=>({tr:a,state:r,dispatch:n})=>{const i=dp(e,r.schema),t=a.selection.$anchor;for(let e=t.depth;e>0;e-=1){if(t.node(e).type===i){if(n){const r=t.before(e),n=t.after(e);a.delete(r,n).scrollIntoView()}return!0}}return!1},deleteRange:e=>({tr:a,dispatch:r})=>{const{from:n,to:i}=e;return r&&a.delete(n,i),!0},deleteSelection:()=>({state:e,dispatch:a})=>((e,a)=>!e.selection.empty&&(a&&a(e.tr.deleteSelection().scrollIntoView()),!0))(e,a),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),t=r.indexAfter(-1),o=Jg(i.contentMatchAt(t));if(!o||!i.canReplaceWith(t,t,o))return!1;if(a){let n=r.after(),i=e.tr.replaceWith(n,n,o.createAndFill());i.setSelection(Jd.near(i.doc.resolve(n),1)),a(i.scrollIntoView())}return!0})(e,a),extendMarkRange:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const t=Rp(e,n.schema),{doc:o,selection:s}=r,{$from:l,from:c,to:d}=s;if(i){const e=Pp(l,t,a);if(e&&e.from<=c&&e.to>=d){const a=eu.create(o,e.from,e.to);r.setSelection(a)}}return!0},first:e=>a=>{const r="function"==typeof e?e(a):e;for(let e=0;e<r.length;e+=1)if(r[e](a))return!0;return!1},focus:(e=null,a={})=>({editor:r,view:n,tr:i,dispatch:t})=>{a={scrollIntoView:!0,...a};const o=()=>{n.dom.focus(),requestAnimationFrame((()=>{r.isDestroyed||(n.focus(),(null==a?void 0:a.scrollIntoView)&&r.commands.scrollIntoView())}))};if(n.hasFocus()&&null===e||!1===e)return!0;if(t&&null===e&&!Lp(r.state.selection))return o(),!0;const s=Vp(i.doc,e)||r.state.selection,l=r.state.selection.eq(s);return t&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},forEach:(e,a)=>r=>e.every(((e,n)=>a(e,{...r,index:n}))),insertContent:(e,a)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,a),insertContentAt:(e,a,r)=>({tr:n,dispatch:i,editor:t})=>{var o;if(i){let i;r={parseOptions:t.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};try{i=Up(a,t.schema,{parseOptions:{preserveWhitespace:"full",...r.parseOptions},errorOnInvalidContent:null!==(o=r.errorOnInvalidContent)&&void 0!==o?o:t.options.enableContentCheck})}catch(e){return t.emit("contentError",{editor:t,error:e,disableCollaboration:()=>{t.storage.collaboration&&(t.storage.collaboration.isDisabled=!0)}}),!1}let{from:s,to:l}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},c=!0,d=!0;if(("type"in i?[i]:i).forEach((e=>{e.check(),c=!!c&&(e.isText&&0===e.marks.length),d=!!d&&e.isBlock})),s===l&&d){const{parent:e}=n.doc.resolve(s);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(s-=1,l+=1)}let u;if(c){if(Array.isArray(a))u=a.map((e=>e.text||"")).join("");else if(a instanceof Ql){let e="";a.forEach((a=>{a.text&&(e+=a.text)})),u=e}else u="object"==typeof a&&a&&a.text?a.text:a;n.insertText(u,s,l)}else u=i,n.replaceWith(s,l,u);r.updateSelection&&function(e,a,r){const n=e.steps.length-1;if(n<a)return;const i=e.steps[n];if(!(i instanceof vd||i instanceof wd))return;const t=e.mapping.maps[n];let o=0;t.forEach(((e,a,r,n)=>{0===o&&(o=n)})),e.setSelection(Jd.near(e.doc.resolve(o),r))}(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:s,text:u}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:s,text:u})}return!0},joinBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Hg(e,r);if(!n)return!1;let i=Gg(n);if(!i){let r=n.blockRange(),i=r&&$d(r);return null!=i&&(a&&a(e.tr.lift(r,i).scrollIntoView()),!0)}let t=i.nodeBefore;if(Yg(e,i,a,-1))return!0;if(0==n.parent.content.size&&(Ug(t,"end")||ru.isSelectable(t)))for(let r=n.depth;;r--){let o=Td(e.doc,n.before(r),n.after(r),tc.empty);if(o&&o.slice.size<o.to-o.from){if(a){let r=e.tr.step(o);r.setSelection(Ug(t,"end")?Jd.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):ru.create(r.doc,i.pos-t.nodeSize)),a(r.scrollIntoView())}return!0}if(1==r||n.node(r-1).childCount>1)break}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos-t.nodeSize,i.pos).scrollIntoView()),0))})(e,a),joinDown:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection;if(n instanceof ru){if(n.node.isTextblock||!Md(e.doc,n.to))return!1;r=n.to}else if(r=Ad(e.doc,n.to,1),null==r)return!1;return a&&a(e.tr.join(r).scrollIntoView()),!0})(e,a),joinForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Kg(e,r);if(!n)return!1;let i=Zg(n);if(!i)return!1;let t=i.nodeAfter;if(Yg(e,i,a,1))return!0;if(0==n.parent.content.size&&(Ug(t,"start")||ru.isSelectable(t))){let r=Td(e.doc,n.before(),n.after(),tc.empty);if(r&&r.slice.size<r.to-r.from){if(a){let n=e.tr.step(r);n.setSelection(Ug(t,"start")?Jd.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):ru.create(n.doc,n.mapping.map(i.pos))),a(n.scrollIntoView())}return!0}}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos,i.pos+t.nodeSize).scrollIntoView()),0))})(e,a),joinItemBackward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Ad(e.doc,e.selection.$from.pos,-1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinItemForward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Ad(e.doc,e.selection.$from.pos,1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Hg(e,r);if(!n)return!1;let i=Gg(n);return!!i&&Wg(e,i,a)})(e,a),joinTextblockForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Kg(e,r);if(!n)return!1;let i=Zg(n);return!!i&&Wg(e,i,a)})(e,a),joinUp:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection,i=n instanceof ru;if(i){if(n.node.isTextblock||!Md(e.doc,n.from))return!1;r=n.from}else if(r=Ad(e.doc,n.from,-1),null==r)return!1;if(a){let n=e.tr.join(r);i&&n.setSelection(ru.create(n.doc,r-e.doc.resolve(r).nodeBefore.nodeSize)),a(n.scrollIntoView())}return!0})(e,a),keyboardShortcut:e=>({editor:a,view:r,tr:n,dispatch:i})=>{const t=function(e){const a=e.split(/-(?!$)/);let r,n,i,t,o=a[a.length-1];"Space"===o&&(o=" ");for(let e=0;e<a.length-1;e+=1){const o=a[e];if(/^(cmd|meta|m)$/i.test(o))t=!0;else if(/^a(lt)?$/i.test(o))r=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))i=!0;else{if(!/^mod$/i.test(o))throw new Error(`Unrecognized modifier name: ${o}`);Gp()||Kp()?t=!0:n=!0}}return r&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),t&&(o=`Meta-${o}`),i&&(o=`Shift-${o}`),o}(e).split(/-(?!$)/),o=t.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),s=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:t.includes("Alt"),ctrlKey:t.includes("Ctrl"),metaKey:t.includes("Meta"),shiftKey:t.includes("Shift"),bubbles:!0,cancelable:!0}),l=a.captureTransaction((()=>{r.someProp("handleKeyDown",(e=>e(r,s)))}));return null==l||l.steps.forEach((e=>{const a=e.map(n.mapping);a&&i&&n.maybeStep(a)})),!0},lift:(e,a={})=>({state:r,dispatch:n})=>!!Zp(r,dp(e,r.schema),a)&&((e,a)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),t=i&&$d(i);return null!=t&&(a&&a(e.tr.lift(i,t).scrollIntoView()),!0)})(r,n),liftEmptyBlock:()=>({state:e,dispatch:a})=>((e,a)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(Ed(e.doc,n))return a&&a(e.tr.split(n).scrollIntoView()),!0}let n=r.blockRange(),i=n&&$d(n);return null!=i&&(a&&a(e.tr.lift(n,i).scrollIntoView()),!0)})(e,a),liftListItem:e=>({state:a,dispatch:r})=>np(dp(e,a.schema))(a,r),newlineInCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;return!(!r.parent.type.spec.code||!r.sameParent(n)||(a&&a(e.tr.insertText("\n").scrollIntoView()),0))})(e,a),resetAttributes:(e,a)=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=Jp("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=dp(e,n.schema)),"mark"===s&&(o=Rp(e,n.schema)),i&&r.selection.ranges.forEach((e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,n)=>{t&&t===e.type&&r.setNodeMarkup(n,void 0,Yp(e.attrs,a)),o&&e.marks.length&&e.marks.forEach((i=>{o===i.type&&r.addMark(n,n+e.nodeSize,o.create(Yp(i.attrs,a)))}))}))})),!0)},scrollIntoView:()=>({tr:e,dispatch:a})=>(a&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:a})=>{if(a){const a=new iu(e.doc);e.setSelection(a)}return!0},selectNodeBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;t=Gg(n)}let o=t&&t.nodeBefore;return!(!o||!ru.isSelectable(o)||(a&&a(e.tr.setSelection(ru.create(e.doc,t.pos-o.nodeSize)).scrollIntoView()),0))})(e,a),selectNodeForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;t=Zg(n)}let o=t&&t.nodeAfter;return!(!o||!ru.isSelectable(o)||(a&&a(e.tr.setSelection(ru.create(e.doc,t.pos)).scrollIntoView()),0))})(e,a),selectParentNode:()=>({state:e,dispatch:a})=>((e,a)=>{let r,{$from:n,to:i}=e.selection,t=n.sharedDepth(i);return 0!=t&&(r=n.before(t),a&&a(e.tr.setSelection(ru.create(e.doc,r))),!0)})(e,a),selectTextblockEnd:()=>({state:e,dispatch:a})=>ep(e,a),selectTextblockStart:()=>({state:e,dispatch:a})=>Qg(e,a),setContent:(e,a=!1,r={},n={})=>({editor:i,tr:t,dispatch:o,commands:s})=>{var l,c;const{doc:d}=t;if("full"!==r.preserveWhitespace){const s=Xp(e,i.schema,r,{errorOnInvalidContent:null!==(l=n.errorOnInvalidContent)&&void 0!==l?l:i.options.enableContentCheck});return o&&t.replaceWith(0,d.content.size,s).setMeta("preventUpdate",!a),!0}return o&&t.setMeta("preventUpdate",!a),s.insertContentAt({from:0,to:d.content.size},e,{parseOptions:r,errorOnInvalidContent:null!==(c=n.errorOnInvalidContent)&&void 0!==c?c:i.options.enableContentCheck})},setMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const{selection:t}=r,{empty:o,ranges:s}=t,l=Rp(e,n.schema);if(i)if(o){const e=Qp(n,l);r.addStoredMark(l.create({...e,...a}))}else s.forEach((e=>{const i=e.$from.pos,t=e.$to.pos;n.doc.nodesBetween(i,t,((e,n)=>{const o=Math.max(n,i),s=Math.min(n+e.nodeSize,t);e.marks.find((e=>e.type===l))?e.marks.forEach((e=>{l===e.type&&r.addMark(o,s,l.create({...e.attrs,...a}))})):r.addMark(o,s,l.create(a))}))}));return function(e,a,r){var n;const{selection:i}=a;let t=null;if(Lp(i)&&(t=i.$cursor),t){const a=null!==(n=e.storedMarks)&&void 0!==n?n:t.marks();return!!r.isInSet(a)||!a.some((e=>e.type.excludes(r)))}const{ranges:o}=i;return o.some((({$from:a,$to:n})=>{let i=0===a.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(r);return e.doc.nodesBetween(a.pos,n.pos,((e,a,n)=>{if(i)return!1;if(e.isInline){const a=!n||n.type.allowsMarkType(r),t=!!r.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(r)));i=a&&t}return!i})),i}))}(n,r,l)},setMeta:(e,a)=>({tr:r})=>(r.setMeta(e,a),!0),setNode:(e,a={})=>({state:r,dispatch:n,chain:i})=>{const t=dp(e,r.schema);let o;return r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),t.isTextblock?i().command((({commands:e})=>!!ap(t,{...o,...a})(r)||e.clearNodes())).command((({state:e})=>ap(t,{...o,...a})(e,n))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,n=Bp(e,0,r.content.size),i=ru.create(r,n);a.setSelection(i)}return!0},setTextSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,{from:n,to:i}="number"==typeof e?{from:e,to:e}:e,t=eu.atStart(r).from,o=eu.atEnd(r).to,s=Bp(n,t,o),l=Bp(i,t,o),c=eu.create(r,s,l);a.setSelection(c)}return!0},sinkListItem:e=>({state:a,dispatch:r})=>{const n=dp(e,a.schema);return(i=n,function(e,a){let{$from:r,$to:n}=e.selection,t=r.blockRange(n,(e=>e.childCount>0&&e.firstChild.type==i));if(!t)return!1;let o=t.startIndex;if(0==o)return!1;let s=t.parent,l=s.child(o-1);if(l.type!=i)return!1;if(a){let r=l.lastChild&&l.lastChild.type==s.type,n=Ql.from(r?i.create():null),o=new tc(Ql.from(i.create(null,Ql.from(s.type.create(null,n)))),r?3:1,0),c=t.start,d=t.end;a(e.tr.step(new wd(c-(r?3:1),d,c,d,o,1,!0)).scrollIntoView())}return!0})(a,r);var i},splitBlock:({keepMarks:e=!0}={})=>({tr:a,state:r,dispatch:n,editor:i})=>{const{selection:t,doc:o}=a,{$from:s,$to:l}=t,c=nb(i.extensionManager.attributes,s.node().type.name,s.node().attrs);if(t instanceof ru&&t.node.isBlock)return!(!s.parentOffset||!Ed(o,s.pos))&&(n&&(e&&sb(r,i.extensionManager.splittableMarks),a.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,u=0===s.depth?void 0:function(e){for(let a=0;a<e.edgeCount;a+=1){const{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}(s.node(-1).contentMatchAt(s.indexAfter(-1)));let h=d&&u?[{type:u,attrs:c}]:void 0,m=Ed(a.doc,a.mapping.map(s.pos),1,h);if(h||m||!Ed(a.doc,a.mapping.map(s.pos),1,u?[{type:u}]:void 0)||(m=!0,h=u?[{type:u,attrs:c}]:void 0),n){if(m&&(t instanceof eu&&a.deleteSelection(),a.split(a.mapping.map(s.pos),1,h),u&&!d&&!s.parentOffset&&s.parent.type!==u)){const e=a.mapping.map(s.before()),r=a.doc.resolve(e);s.node(-1).canReplaceWith(r.index(),r.index()+1,u)&&a.setNodeMarkup(a.mapping.map(s.before()),u)}e&&sb(r,i.extensionManager.splittableMarks),a.scrollIntoView()}return m},splitListItem:(e,a={})=>({tr:r,state:n,dispatch:i,editor:t})=>{var o;const s=dp(e,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==s)return!1;const h=t.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=Ql.empty;const n=l.index(-1)?1:l.index(-2)?2:3;for(let a=l.depth-n;a>=l.depth-3;a-=1)e=Ql.from(l.node(a).copy(e));const i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,t={...nb(h,l.node().type.name,l.node().attrs),...a},c=(null===(o=s.contentMatch.defaultType)||void 0===o?void 0:o.createAndFill(t))||void 0;e=e.append(Ql.from(s.createAndFill(null,c)||void 0));const d=l.before(l.depth-(n-1));r.replace(d,l.after(-i),new tc(e,4-n,0));let u=-1;r.doc.nodesBetween(d,r.doc.content.size,((e,a)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=a+1)})),u>-1&&r.setSelection(eu.near(r.doc.resolve(u))),r.scrollIntoView()}return!0}const m=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,g={...nb(h,u.type.name,u.attrs),...a},p={...nb(h,l.node().type.name,l.node().attrs),...a};r.delete(l.pos,c.pos);const b=m?[{type:s,attrs:g},{type:m,attrs:p}]:[{type:s,attrs:g}];if(!Ed(r.doc,l.pos,2))return!1;if(i){const{selection:e,storedMarks:a}=n,{splittableMarks:o}=t.extensionManager,s=a||e.$to.parentOffset&&e.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!s||!i)return!0;const c=s.filter((e=>o.includes(e.type.name)));r.ensureMarks(c)}return!0},toggleList:(e,a,r,n={})=>({editor:i,tr:t,state:o,dispatch:s,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,m=dp(e,o.schema),g=dp(a,o.schema),{selection:p,storedMarks:b}=o,{$from:f,$to:k}=p,y=f.blockRange(k),v=b||p.$to.parentOffset&&p.$from.marks();if(!y)return!1;const w=eb((e=>tb(e.type.name,u)))(p);if(y.depth>=1&&w&&y.depth-w.depth<=1){if(w.node.type===m)return c.liftListItem(g);if(tb(w.node.type.name,u)&&m.validContent(w.node.content)&&s)return l().command((()=>(t.setNodeMarkup(w.pos,m),!0))).command((()=>lb(t,m))).command((()=>cb(t,m))).run()}return r&&v&&s?l().command((()=>{const e=d().wrapInList(m,n),a=v.filter((e=>h.includes(e.type.name)));return t.ensureMarks(a),!!e||c.clearNodes()})).wrapInList(m,n).command((()=>lb(t,m))).command((()=>cb(t,m))).run():l().command((()=>!!d().wrapInList(m,n)||c.clearNodes())).wrapInList(m,n).command((()=>lb(t,m))).command((()=>cb(t,m))).run()},toggleMark:(e,a={},r={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:t=!1}=r,o=Rp(e,n.schema);return ib(n,o,a)?i.unsetMark(o,{extendEmptyMarkRange:t}):i.setMark(o,a)},toggleNode:(e,a,r={})=>({state:n,commands:i})=>{const t=dp(e,n.schema),o=dp(a,n.schema),s=Zp(n,t,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(t,{...l,...r})},toggleWrap:(e,a={})=>({state:r,commands:n})=>{const i=dp(e,r.schema);return Zp(r,i,a)?n.lift(i):n.wrapIn(i,a)},undoInputRule:()=>({state:e,dispatch:a})=>{const r=e.plugins;for(let n=0;n<r.length;n+=1){const i=r[n];let t;if(i.spec.isInputRules&&(t=i.getState(e))){if(a){const a=e.tr,r=t.transform;for(let e=r.steps.length-1;e>=0;e-=1)a.step(r.steps[e].invert(r.docs[e]));if(t.text){const r=a.doc.resolve(t.from).marks();a.replaceWith(t.from,t.to,e.schema.text(t.text,r))}else a.delete(t.from,t.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,{empty:n,ranges:i}=r;return n||a&&i.forEach((a=>{e.removeMark(a.$from.pos,a.$to.pos)})),!0},unsetMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{var t;const{extendEmptyMarkRange:o=!1}=a,{selection:s}=r,l=Rp(e,n.schema),{$from:c,empty:d,ranges:u}=s;if(!i)return!0;if(d&&o){let{from:e,to:a}=s;const n=null===(t=c.marks().find((e=>e.type===l)))||void 0===t?void 0:t.attrs,i=Pp(c,l,n);i&&(e=i.from,a=i.to),r.removeMark(e,a,l)}else u.forEach((e=>{r.removeMark(e.$from.pos,e.$to.pos,l)}));return r.removeStoredMark(l),!0},updateAttributes:(e,a={})=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=Jp("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=dp(e,n.schema)),"mark"===s&&(o=Rp(e,n.schema)),i&&r.selection.ranges.forEach((e=>{const i=e.$from.pos,s=e.$to.pos;let l,c,d,u;r.selection.empty?n.doc.nodesBetween(i,s,((e,a)=>{t&&t===e.type&&(d=Math.max(a,i),u=Math.min(a+e.nodeSize,s),l=a,c=e)})):n.doc.nodesBetween(i,s,((e,n)=>{n<i&&t&&t===e.type&&(d=Math.max(n,i),u=Math.min(n+e.nodeSize,s),l=n,c=e),n>=i&&n<=s&&(t&&t===e.type&&r.setNodeMarkup(n,void 0,{...e.attrs,...a}),o&&e.marks.length&&e.marks.forEach((t=>{if(o===t.type){const l=Math.max(n,i),c=Math.min(n+e.nodeSize,s);r.addMark(l,c,o.create({...t.attrs,...a}))}})))})),c&&(void 0!==l&&r.setNodeMarkup(l,void 0,{...c.attrs,...a}),o&&c.marks.length&&c.marks.forEach((e=>{o===e.type&&r.addMark(d,u,o.create({...e.attrs,...a}))})))})),!0)},wrapIn:(e,a={})=>({state:r,dispatch:n})=>function(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t),s=o&&qd(o,e,a);return!!s&&(n&&n(r.tr.wrap(o,s).scrollIntoView()),!0)}}(dp(e,r.schema),a)(r,n),wrapInList:(e,a={})=>({state:r,dispatch:n})=>rp(dp(e,r.schema),a)(r,n)});const ub=_p.create({name:"commands",addCommands:()=>({...db})}),hb=_p.create({name:"drop",addProseMirrorPlugins(){return[new pu({key:new ku("tiptapDrop"),props:{handleDrop:(e,a,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:a,slice:r,moved:n})}}})]}}),mb=_p.create({name:"editable",addProseMirrorPlugins(){return[new pu({key:new ku("editable"),props:{editable:()=>this.editor.options.editable}})]}}),gb=_p.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new pu({key:new ku("focusEvents"),props:{handleDOMEvents:{focus:(a,r)=>{e.isFocused=!0;const n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1},blur:(a,r)=>{e.isFocused=!1;const n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1}}}})]}}),pb=_p.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:a})=>{const{selection:r,doc:n}=a,{empty:i,$anchor:t}=r,{pos:o,parent:s}=t,l=t.parent.isTextblock&&o>0?a.doc.resolve(o-1):t,c=l.parent.type.spec.isolating,d=t.pos-t.parentOffset,u=c&&1===l.parent.childCount?d===t.pos:Jd.atStart(n).from===o;return!(!i||!s.type.isTextblock||s.textContent.length||!u||u&&"paragraph"===t.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),a=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),r={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:a,"Mod-Delete":a,"Mod-a":()=>this.editor.commands.selectAll()},n={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":a,"Ctrl-Alt-Backspace":a,"Alt-Delete":a,"Alt-d":a,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Gp()||Kp()?i:n},addProseMirrorPlugins(){return[new pu({key:new ku("clearDocument"),appendTransaction:(e,a,r)=>{const n=e.some((e=>e.docChanged))&&!a.doc.eq(r.doc),i=e.some((e=>e.getMeta("preventClearDocument")));if(!n||i)return;const{empty:t,from:o,to:s}=a.selection,l=Jd.atStart(a.doc).from,c=Jd.atEnd(a.doc).to;if(t||!(o===l&&s===c))return;if(!ob(r.doc))return;const d=r.tr,u=ip({state:r,transaction:d}),{commands:h}=new tp({editor:this.editor,state:u});return h.clearNodes(),d.steps.length?d:void 0}})]}}),bb=_p.create({name:"paste",addProseMirrorPlugins(){return[new pu({key:new ku("tiptapPaste"),props:{handlePaste:(e,a,r)=>{this.editor.emit("paste",{editor:this.editor,event:a,slice:r})}}})]}}),fb=_p.create({name:"tabindex",addProseMirrorPlugins(){return[new pu({key:new ku("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var kb=Object.freeze({__proto__:null,ClipboardTextSerializer:Tp,Commands:ub,Drop:hb,Editable:mb,FocusEvents:gb,Keymap:pb,Paste:bb,Tabindex:fb});class yb{get name(){return this.node.type.name}constructor(e,a,r=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=a,this.currentNode=n}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)&&void 0!==e?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let a=this.from,r=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}`);a=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:a,to:r},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 e=this.resolvedPos.start(this.resolvedPos.depth-1),a=this.resolvedPos.doc.resolve(e);return new yb(a,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new yb(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new yb(e,this.editor)}get children(){const e=[];return this.node.content.forEach(((a,r)=>{const n=a.isBlock&&!a.isTextblock,i=a.isAtom&&!a.isText,t=this.pos+r+(i?0:1),o=this.resolvedPos.doc.resolve(t);if(!n&&o.depth<=this.depth)return;const s=new yb(o,this.editor,n,n?a:null);n&&(s.actualDepth=this.depth+1),e.push(new yb(o,this.editor,n,n?a:null))})),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,a={}){let r=null,n=this.parent;for(;n&&!r;){if(n.node.type.name===e)if(Object.keys(a).length>0){const e=n.node.attrs,r=Object.keys(a);for(let n=0;n<r.length;n+=1){const i=r[n];if(e[i]!==a[i])break}}else r=n;n=n.parent}return r}querySelector(e,a={}){return this.querySelectorAll(e,a,!0)[0]||null}querySelectorAll(e,a={},r=!1){let n=[];if(!this.children||0===this.children.length)return n;const i=Object.keys(a);return this.children.forEach((t=>{if(!(r&&n.length>0)){if(t.node.type.name===e){i.every((e=>a[e]===t.node.attrs[e]))&&n.push(t)}r&&n.length>0||(n=n.concat(t.querySelectorAll(e,a,r)))}})),n}setAttribute(e){const{tr:a}=this.editor.state;a.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(a)}}class vb extends op{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:a,moved:r})=>this.options.onDrop(e,a,r))),this.on("paste",(({event:e,slice:a})=>this.options.onPaste(e,a))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}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&&document&&(this.css=function(e,a){const r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;const n=document.createElement("style");return a&&n.setAttribute("nonce",a),n.setAttribute("data-tiptap-style",""),n.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(n),n}('.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}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,a=!0){this.setOptions({editable:e}),a&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,a){const r=mp(a)?a(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;const a=this.state.plugins;let r=a;if([].concat(e).forEach((e=>{const n="string"==typeof e?`${e}$`:e.key;r=a.filter((e=>!e.key.startsWith(n)))})),a.length===r.length)return;const n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var e,a;const r=[...this.options.enableCoreExtensions?[mb,Tp.configure({blockSeparator:null===(a=null===(e=this.options.coreExtensionOptions)||void 0===e?void 0:e.clipboardTextSerializer)||void 0===a?void 0:a.blockSeparator}),ub,gb,pb,fb,hb,bb].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 Mp(r,this)}createCommandManager(){this.commandManager=new tp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let a;try{a=Xp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),a=Xp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Vp(a,this.options.autofocus);this.view=new Sg(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(e=this.options.editorProps)||void 0===e?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:mu.create({doc:a,selection:r||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const a=this.capturedTransaction;return this.capturedTransaction=null,a}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var a;return null===(a=this.capturedTransaction)||void 0===a?void 0:a.step(e)})):void(this.capturedTransaction=e);const a=this.state.apply(e),r=!this.state.selection.eq(a.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:a}),this.view.updateState(a),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const n=e.getMeta("focus"),i=e.getMeta("blur");n&&this.emit("focus",{editor:this,event:n.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return ab(this.state,e)}isActive(e,a){const r="string"==typeof e?e:null,n="string"==typeof e?a:e;return function(e,a,r={}){if(!a)return Zp(e,null,r)||ib(e,null,r);const n=Jp(a,e.schema);return"node"===n?Zp(e,a,r):"mark"===n&&ib(e,a,r)}(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return yp(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:a="\n\n",textSerializers:r={}}=e||{};return function(e,a){return Ap(e,{from:0,to:e.content.size},a)}(this.state.doc,{blockSeparator:a,textSerializers:{...Dp(this.schema),...r}})}get isEmpty(){return ob(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}$node(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelector(e,a))||null}$nodes(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelectorAll(e,a))||null}$pos(e){const a=this.state.doc.resolve(e);return new yb(a,this)}get $doc(){return this.$pos(0)}}function wb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n})=>{const i=gp(e.getAttributes,void 0,n);if(!1===i||null===i)return null;const{tr:t}=a,o=n[n.length-1],s=n[0];if(o){const n=s.search(/\S/),l=r.from+s.indexOf(o),c=l+o.length;if(rb(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>l)).length)return null;c<r.to&&t.delete(c,r.to),l>r.from&&t.delete(r.from+n,l);const d=r.from+n+o.length;t.addMark(r.from+n,d,e.type.create(i||{})),t.removeStoredMark(e.type)}}})}function zb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n})=>{const i=gp(e.getAttributes,void 0,n)||{},{tr:t}=a,o=r.from;let s=r.to;const l=e.type.create(i);if(n[1]){let e=o+n[0].lastIndexOf(n[1]);e>s?e=s:s=e+n[1].length;const a=n[0][n[0].length-1];t.insertText(a,o+n[0].length-1),t.replaceWith(e,s,l)}else if(n[0]){const a=e.type.isInline?o:o-1;t.insert(a,e.type.create(i)).delete(t.mapping.map(o),t.mapping.map(s))}t.scrollIntoView()}})}function jb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n})=>{const i=a.doc.resolve(r.from),t=gp(e.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;a.tr.delete(r.from,r.to).setBlockType(r.from,r.from,e.type,t)}})}function xb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n,chain:i})=>{const t=gp(e.getAttributes,void 0,n)||{},o=a.tr.delete(r.from,r.to),s=o.doc.resolve(r.from).blockRange(),l=s&&qd(s,e.type,t);if(!l)return null;if(o.wrap(s,l),e.keepMarks&&e.editor){const{selection:r,storedMarks:n}=a,{splittableMarks:i}=e.editor.extensionManager,t=n||r.$to.parentOffset&&r.$from.marks();if(t){const e=t.filter((e=>i.includes(e.type.name)));o.ensureMarks(e)}}if(e.keepAttributes){const a="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(a,t).run()}const c=o.doc.resolve(r.from-1).nodeBefore;c&&c.type===e.type&&Md(o.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(n,c))&&o.join(r.from-1)}})}let $b=class e{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=gp(sp(this,"addOptions",{name:this.name}))),this.storage=gp(sp(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(a={}){return new e(a)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>$p(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(a={}){const r=new e(a);return r.parent=this,this.child=r,r.name=a.name?a.name:r.parent.name,a.defaultOptions&&Object.keys(a.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=gp(sp(r,"addOptions",{name:r.name})),r.storage=gp(sp(r,"addStorage",{name:r.name,options:r.options})),r}};function qb(e){return new Cp({find:e.find,handler:({state:a,range:r,match:n,pasteEvent:i})=>{const t=gp(e.getAttributes,void 0,n,i);if(!1===t||null===t)return null;const{tr:o}=a,s=n[n.length-1],l=n[0];let c=r.to;if(s){const n=l.search(/\S/),i=r.from+l.indexOf(s),d=i+s.length;if(rb(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>i)).length)return null;d<r.to&&o.delete(d,r.to),i>r.from&&o.delete(r.from+n,i),c=r.from+n+s.length,o.addMark(r.from+n,c,e.type.create(t||{})),o.removeStoredMark(e.type)}}})}const Cb=_p.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new pu({key:new ku("placeholder"),props:{decorations:({doc:e,selection:a})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=a,i=[];if(!r)return null;const t=this.editor.isEmpty;return e.descendants(((e,a)=>{const r=n>=a&&n<=a+e.nodeSize,o=!e.isLeaf&&ob(e);if((r||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];t&&n.push(this.options.emptyEditorClass);const o=eg.node(a,a+e.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:a,hasAnchor:r}):this.options.placeholder});i.push(o)}return this.options.includeChildren})),ng.create(e,i)}}})]}}),Sb=qp.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",up(this.options.HTMLAttributes,e),0]},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()}}}),Ob=/^\s*>\s$/,Eb=$b.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",up(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[xb({find:Ob,type:this.type})]}}),Mb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_b=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Ab=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Db=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Tb=qp.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",up(this.options.HTMLAttributes,e),0]},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[wb({find:Mb,type:this.type}),wb({find:Ab,type:this.type})]},addPasteRules(){return[qb({find:_b,type:this.type}),qb({find:Db,type:this.type})]}}),Nb="textStyle",Ib=/^\s*([-+*])\s$/,Fb=$b.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",up(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Nb)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=xb({find:Ib,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xb({find:Ib,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Nb),editor:this.editor})),[e]}}),Pb=/(^|[^`])`([^`]+)`(?!`)/,Rb=/(^|[^`])`([^`]+)`(?!`)/g,Lb=qp.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",up(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[wb({find:Pb,type:this.type})]},addPasteRules(){return[qb({find:Rb,type:this.type})]}}),Bb=/^```([a-z]+)?[\s\n]$/,Vb=/^~~~([a-z]+)?[\s\n]$/,Hb=$b.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var a;const{languageClassPrefix:r}=this.options,n=[...(null===(a=e.firstElementChild)||void 0===a?void 0:a.classList)||[]].filter((e=>e.startsWith(r))).map((e=>e.replace(r,"")))[0];return n||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:a}){return["pre",up(this.options.HTMLAttributes,a),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.setNode(this.name,e),toggleCodeBlock:e=>({commands:a})=>a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:a}=this.editor.state.selection,r=1===a.pos;return!(!e||a.parent.type.name!==this.name)&&(!(!r&&a.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:a}=e,{selection:r}=a,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;const t=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return!(!t||!o)&&e.chain().command((({tr:e})=>(e.delete(n.pos-2,n.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:a}=e,{selection:r,doc:n}=a,{$from:i,empty:t}=r;if(!t||i.parent.type!==this.type)return!1;if(!(i.parentOffset===i.parent.nodeSize-2))return!1;const o=i.after();if(void 0===o)return!1;return n.nodeAt(o)?e.commands.command((({tr:e})=>(e.setSelection(Jd.near(n.resolve(o))),!0))):e.commands.exitCode()}}},addInputRules(){return[jb({find:Bb,type:this.type,getAttributes:e=>({language:e[1]})}),jb({find:Vb,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new pu({key:new ku("codeBlockVSCodeHandler"),props:{handlePaste:(e,a)=>{if(!a.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const r=a.clipboardData.getData("text/plain"),n=a.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,t=null==i?void 0:i.mode;if(!r||!t)return!1;const{tr:o,schema:s}=e.state,l=s.text(r.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:t},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(eu.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),Wb=$b.create({name:"doc",topNode:!0,content:"block+"});function Ub(e={}){return new pu({view:a=>new Gb(a,e)})}class Gb{constructor(e,a){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=a.width)&&void 0!==r?r:1,this.color=!1===a.color?void 0:a.color||"black",this.class=a.class,this.handlers=["dragover","dragend","drop","dragleave"].map((a=>{let r=e=>{this[a](e)};return e.dom.addEventListener(a,r),{name:a,handler:r}}))}destroy(){this.handlers.forEach((({name:e,handler:a})=>this.editorView.dom.removeEventListener(e,a)))}update(e,a){null!=this.cursorPos&&a.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,a=this.editorView.state.doc.resolve(this.cursorPos),r=!a.parent.inlineContent;if(r){let r=a.nodeBefore,n=a.nodeAfter;if(r||n){let a=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0));if(a){let i=a.getBoundingClientRect(),t=r?i.bottom:i.top;r&&n&&(t=(t+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:t-this.width/2,bottom:t+this.width/2}}}}if(!e){let a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let n,i,t=this.editorView.dom.offsetParent;if(this.element||(this.element=t.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),!t||t==document.body&&"static"==getComputedStyle(t).position)n=-pageXOffset,i=-pageYOffset;else{let e=t.getBoundingClientRect();n=e.left-t.scrollLeft,i=e.top-t.scrollTop}this.element.style.left=e.left-n+"px",this.element.style.top=e.top-i+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let a=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=a&&a.inside>=0&&this.editorView.state.doc.nodeAt(a.inside),n=r&&r.type.spec.disableDropCursor,i="function"==typeof n?n(this.editorView,a,e):n;if(a&&!i){let e=a.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Dd(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=a&&(e=a)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Kb=_p.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[Ub(this.options)]}});class Zb extends Jd{constructor(e){super(e,e)}map(e,a){let r=e.resolve(a.map(this.head));return Zb.valid(r)?new Zb(r):Jd.near(r)}content(){return tc.empty}eq(e){return e instanceof Zb&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Zb(e.resolve(a.pos))}getBookmark(){return new Jb(this.anchor)}static valid(e){let a=e.parent;if(a.isTextblock||!function(e){for(let a=e.depth;a>=0;a--){let r=e.index(a),n=e.node(a);if(0!=r)for(let e=n.child(r-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let a=e.depth;a>=0;a--){let r=e.indexAfter(a),n=e.node(a);if(r!=n.childCount)for(let e=n.child(r);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e))return!1;let r=a.type.spec.allowGapCursor;if(null!=r)return r;let n=a.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,a,r=!1){e:for(;;){if(!r&&Zb.valid(e))return e;let n=e.pos,i=null;for(let r=e.depth;;r--){let t=e.node(r);if(a>0?e.indexAfter(r)<t.childCount:e.index(r)>0){i=t.child(a>0?e.indexAfter(r):e.index(r)-1);break}if(0==r)return null;n+=a;let o=e.doc.resolve(n);if(Zb.valid(o))return o}for(;;){let t=a>0?i.firstChild:i.lastChild;if(!t){if(i.isAtom&&!i.isText&&!ru.isSelectable(i)){e=e.doc.resolve(n+i.nodeSize*a),r=!1;continue e}break}i=t,n+=a;let o=e.doc.resolve(n);if(Zb.valid(o))return o}return null}}}Zb.prototype.visible=!1,Zb.findFrom=Zb.findGapCursorFrom,Jd.jsonID("gapcursor",Zb);class Jb{constructor(e){this.pos=e}map(e){return new Jb(e.map(this.pos))}resolve(e){let a=e.resolve(this.pos);return Zb.valid(a)?new Zb(a):Jd.near(a)}}const Yb=Vg({ArrowLeft:Xb("horiz",-1),ArrowRight:Xb("horiz",1),ArrowUp:Xb("vert",-1),ArrowDown:Xb("vert",1)});function Xb(e,a){const r="vert"==e?a>0?"down":"up":a>0?"right":"left";return function(e,n,i){let t=e.selection,o=a>0?t.$to:t.$from,s=t.empty;if(t instanceof eu){if(!i.endOfTextblock(r)||0==o.depth)return!1;s=!1,o=e.doc.resolve(a>0?o.after():o.before())}let l=Zb.findGapCursorFrom(o,a,s);return!!l&&(n&&n(e.tr.setSelection(new Zb(l))),!0)}}function Qb(e,a,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(a);if(!Zb.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return!(i&&i.inside>-1&&ru.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new Zb(n))),!0)}function ef(e,a){if("insertCompositionText"!=a.inputType||!(e.state.selection instanceof Zb))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=Ql.empty;for(let e=n.length-1;e>=0;e--)i=Ql.from(n[e].createAndFill(null,i));let t=e.state.tr.replace(r.pos,r.pos,new tc(i,0,0));return t.setSelection(eu.near(t.doc.resolve(r.pos+1))),e.dispatch(t),!1}function af(e){if(!(e.selection instanceof Zb))return null;let a=document.createElement("div");return a.className="ProseMirror-gapcursor",ng.create(e.doc,[eg.widget(e.selection.head,a,{key:"gapcursor"})])}const rf=_p.create({name:"gapCursor",addProseMirrorPlugins:()=>[new pu({props:{decorations:af,createSelectionBetween:(e,a,r)=>a.pos==r.pos&&Zb.valid(r)?new Zb(r):null,handleClick:Qb,handleKeyDown:Yb,handleDOMEvents:{beforeinput:ef}}})],extendNodeSchema(e){var a;return{allowGapCursor:null!==(a=gp(sp(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==a?a:null}}}),nf=$b.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",up(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:a,state:r,editor:n})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:i}=r;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:t}=this.options,{splittableMarks:o}=n.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return a().insertContent({type:this.name}).command((({tr:e,dispatch:a})=>{if(a&&s&&t){const a=s.filter((e=>o.includes(e.type.name)));e.ensureMarks(a)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),tf=$b.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:a}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,up(this.options.HTMLAttributes,a),0]},addCommands(){return{setHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.setNode(this.name,e),toggleHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,a)=>({...e,[`Mod-Alt-${a}`]:()=>this.editor.commands.toggleHeading({level:a})})),{})},addInputRules(){return this.options.levels.map((e=>jb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var of=200,sf=function(){};sf.prototype.append=function(e){return e.length?(e=sf.from(e),!this.length&&e||e.length<of&&this.leafAppend(e)||this.length<of&&e.leafPrepend(this)||this.appendInner(e)):this},sf.prototype.prepend=function(e){return e.length?sf.from(e).append(this):this},sf.prototype.appendInner=function(e){return new cf(this,e)},sf.prototype.slice=function(e,a){return void 0===e&&(e=0),void 0===a&&(a=this.length),e>=a?sf.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,a))},sf.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},sf.prototype.forEach=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length),a<=r?this.forEachInner(e,a,r,0):this.forEachInvertedInner(e,a,r,0)},sf.prototype.map=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length);var n=[];return this.forEach((function(a,r){return n.push(e(a,r))}),a,r),n},sf.from=function(e){return e instanceof sf?e:e&&e.length?new lf(e):sf.empty};var lf=function(e){function a(a){e.call(this),this.values=a}e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a;var r={length:{configurable:!0},depth:{configurable:!0}};return a.prototype.flatten=function(){return this.values},a.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new a(this.values.slice(e,r))},a.prototype.getInner=function(e){return this.values[e]},a.prototype.forEachInner=function(e,a,r,n){for(var i=a;i<r;i++)if(!1===e(this.values[i],n+i))return!1},a.prototype.forEachInvertedInner=function(e,a,r,n){for(var i=a-1;i>=r;i--)if(!1===e(this.values[i],n+i))return!1},a.prototype.leafAppend=function(e){if(this.length+e.length<=of)return new a(this.values.concat(e.flatten()))},a.prototype.leafPrepend=function(e){if(this.length+e.length<=of)return new a(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(a.prototype,r),a}(sf);sf.empty=new lf([]);var cf=function(e){function a(a,r){e.call(this),this.left=a,this.right=r,this.length=a.length+r.length,this.depth=Math.max(a.depth,r.depth)+1}return e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a,a.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},a.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},a.prototype.forEachInner=function(e,a,r,n){var i=this.left.length;return!(a<i&&!1===this.left.forEachInner(e,a,Math.min(r,i),n))&&(!(r>i&&!1===this.right.forEachInner(e,Math.max(a-i,0),Math.min(this.length,r)-i,n+i))&&void 0)},a.prototype.forEachInvertedInner=function(e,a,r,n){var i=this.left.length;return!(a>i&&!1===this.right.forEachInvertedInner(e,a-i,Math.max(r,i)-i,n+i))&&(!(r<i&&!1===this.left.forEachInvertedInner(e,Math.min(a,i),r,n))&&void 0)},a.prototype.sliceInner=function(e,a){if(0==e&&a==this.length)return this;var r=this.left.length;return a<=r?this.left.slice(e,a):e>=r?this.right.slice(e-r,a-r):this.left.slice(e,r).append(this.right.slice(0,a-r))},a.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new a(this.left,r)},a.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new a(r,this.right)},a.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new a(this.left,new a(this.right,e)):new a(this,e)},a}(sf);class df{constructor(e,a){this.items=e,this.eventCount=a}popEvent(e,a){if(0==this.eventCount)return null;let r,n,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}a&&(r=this.remapping(i,this.items.length),n=r.maps.length);let t,o,s=e.tr,l=[],c=[];return this.items.forEach(((e,a)=>{if(!e.step)return r||(r=this.remapping(i,a+1),n=r.maps.length),n--,void c.push(e);if(r){c.push(new uf(e.map));let a,i=e.step.map(r.slice(n));i&&s.maybeStep(i).doc&&(a=s.mapping.maps[s.mapping.maps.length-1],l.push(new uf(a,void 0,void 0,l.length+c.length))),n--,a&&r.appendMap(a,n)}else s.maybeStep(e.step);return e.selection?(t=r?e.selection.map(r.slice(n)):e.selection,o=new df(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:s,selection:t}}addTransform(e,a,r,n){let i=[],t=this.eventCount,o=this.items,s=!n&&o.length?o.get(o.length-1):null;for(let r=0;r<e.steps.length;r++){let l,c=e.steps[r].invert(e.docs[r]),d=new uf(e.mapping.maps[r],c,a);(l=s&&s.merge(d))&&(d=l,r?i.pop():o=o.slice(0,o.length-1)),i.push(d),a&&(t++,a=void 0),n||(s=d)}let l=t-r.depth;return l>mf&&(o=function(e,a){let r;return e.forEach(((e,n)=>{if(e.selection&&0==a--)return r=n,!1})),e.slice(r)}(o,l),t-=l),new df(o.append(i),t)}remapping(e,a){let r=new ud;return this.items.forEach(((a,n)=>{let i=null!=a.mirrorOffset&&n-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,i)}),e,a),r}addMaps(e){return 0==this.eventCount?this:new df(this.items.append(e.map((e=>new uf(e)))),this.eventCount)}rebased(e,a){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-a),i=e.mapping,t=e.steps.length,o=this.eventCount;this.items.forEach((e=>{e.selection&&o--}),n);let s=a;this.items.forEach((a=>{let n=i.getMirror(--s);if(null==n)return;t=Math.min(t,n);let l=i.maps[n];if(a.step){let t=e.steps[n].invert(e.docs[n]),c=a.selection&&a.selection.map(i.slice(s+1,n));c&&o++,r.push(new uf(l,t,c))}else r.push(new uf(l))}),n);let l=[];for(let e=a;e<t;e++)l.push(new uf(i.maps[e]));let c=this.items.slice(0,n).append(l).append(r),d=new df(c,o);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach((a=>{a.step||e++})),e}compress(e=this.items.length){let a=this.remapping(0,e),r=a.maps.length,n=[],i=0;return this.items.forEach(((t,o)=>{if(o>=e)n.push(t),t.selection&&i++;else if(t.step){let e=t.step.map(a.slice(r)),o=e&&e.getMap();if(r--,o&&a.appendMap(o,r),e){let s=t.selection&&t.selection.map(a.slice(r));s&&i++;let l,c=new uf(o.invert(),e,s),d=n.length-1;(l=n.length&&n[d].merge(c))?n[d]=l:n.push(c)}}else t.map&&r--}),this.items.length,0),new df(sf.from(n.reverse()),i)}}df.empty=new df(sf.empty,0);class uf{constructor(e,a,r,n){this.map=e,this.step=a,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let a=e.step.merge(this.step);if(a)return new uf(a.getMap().invert(),a,this.selection)}}}class hf{constructor(e,a,r,n,i){this.done=e,this.undone=a,this.prevRanges=r,this.prevTime=n,this.prevComposition=i}}const mf=20;function gf(e){let a=[];for(let r=e.length-1;r>=0&&0==a.length;r--)e[r].forEach(((e,r,n,i)=>a.push(n,i)));return a}function pf(e,a){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let i=a.map(e[n],1),t=a.map(e[n+1],-1);i<=t&&r.push(i,t)}return r}let bf=!1,ff=null;function kf(e){let a=e.plugins;if(ff!=a){bf=!1,ff=a;for(let e=0;e<a.length;e++)if(a[e].spec.historyPreserveItems){bf=!0;break}}return bf}const yf=new ku("history"),vf=new ku("closeHistory");function wf(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new pu({key:yf,state:{init:()=>new hf(df.empty,df.empty,null,0,-1),apply:(a,r,n)=>function(e,a,r,n){let i,t=r.getMeta(yf);if(t)return t.historyState;r.getMeta(vf)&&(e=new hf(e.done,e.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(o&&o.getMeta(yf))return o.getMeta(yf).redo?new hf(e.done.addTransform(r,void 0,n,kf(a)),e.undone,gf(r.mapping.maps),e.prevTime,e.prevComposition):new hf(e.done,e.undone.addTransform(r,void 0,n,kf(a)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=r.getMeta("rebased"))?new hf(e.done.rebased(r,i),e.undone.rebased(r,i),pf(e.prevRanges,r.mapping),e.prevTime,e.prevComposition):new hf(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),pf(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let i=r.getMeta("composition"),t=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,a){if(!a)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach(((e,n)=>{for(let i=0;i<a.length;i+=2)e<=a[i+1]&&n>=a[i]&&(r=!0)})),r}(r,e.prevRanges)),s=o?pf(e.prevRanges,r.mapping):gf(r.mapping.maps);return new hf(e.done.addTransform(r,t?a.selection.getBookmark():void 0,n,kf(a)),df.empty,s,r.time,null==i?e.prevComposition:i)}}(r,n,a,e)},config:e,props:{handleDOMEvents:{beforeinput(e,a){let r=a.inputType,n="historyUndo"==r?jf:"historyRedo"==r?xf:null;return!!n&&(a.preventDefault(),n(e.state,e.dispatch))}}}})}function zf(e,a){return(r,n)=>{let i=yf.getState(r);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(n){let t=function(e,a,r){let n=kf(a),i=yf.get(a).spec.config,t=(r?e.undone:e.done).popEvent(a,n);if(!t)return null;let o=t.selection.resolve(t.transform.doc),s=(r?e.done:e.undone).addTransform(t.transform,a.selection.getBookmark(),i,n),l=new hf(r?s:t.remaining,r?t.remaining:s,null,0,-1);return t.transform.setSelection(o).setMeta(yf,{redo:r,historyState:l})}(i,r,e);t&&n(a?t.scrollIntoView():t)}return!0}}const jf=zf(!1,!0),xf=zf(!0,!0),$f=_p.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:a})=>jf(e,a),redo:()=>({state:e,dispatch:a})=>xf(e,a)}),addProseMirrorPlugins(){return[wf(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),qf=$b.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",up(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:a})=>{const{selection:r}=a,{$from:n,$to:i}=r,t=e();return 0===n.parentOffset?t.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):r instanceof ru?t.insertContentAt(i.pos,{type:this.name}):t.insertContent({type:this.name}),t.command((({tr:e,dispatch:a})=>{var r;if(a){const{$to:a}=e.selection,n=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?e.setSelection(eu.create(e.doc,a.pos+1)):a.nodeAfter.isBlock?e.setSelection(ru.create(e.doc,a.pos)):e.setSelection(eu.create(e.doc,a.pos));else{const i=null===(r=a.parent.type.contentMatch.defaultType)||void 0===r?void 0:r.create();i&&(e.insert(n,i),e.setSelection(eu.create(e.doc,n+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[zb({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Of=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ef=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mf=qp.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",up(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[wb({find:Cf,type:this.type}),wb({find:Of,type:this.type})]},addPasteRules(){return[qb({find:Sf,type:this.type}),qb({find:Ef,type:this.type})]}}),_f=$b.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",up(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Af="textStyle",Df=/^(\d+)\.\s$/,Tf=$b.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:a,...r}=e;return 1===a?["ol",up(this.options.HTMLAttributes,r),0]:["ol",up(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Af)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=xb({find:Df,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xb({find:Df,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Af)}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1],editor:this.editor})),[e]}}),Nf=$b.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",up(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),If=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ff=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pf=qp.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",up(this.options.HTMLAttributes,e),0]},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[wb({find:If,type:this.type})]},addPasteRules(){return[qb({find:Ff,type:this.type})]}}),Rf=$b.create({name:"text",group:"inline"}),Lf=_p.create({name:"starterKit",addExtensions(){var e,a,r,n,i,t,o,s,l,c,d,u,h,m,g,p,b,f;const k=[];return!1!==this.options.bold&&k.push(Tb.configure(null===(e=this.options)||void 0===e?void 0:e.bold)),!1!==this.options.blockquote&&k.push(Eb.configure(null===(a=this.options)||void 0===a?void 0:a.blockquote)),!1!==this.options.bulletList&&k.push(Fb.configure(null===(r=this.options)||void 0===r?void 0:r.bulletList)),!1!==this.options.code&&k.push(Lb.configure(null===(n=this.options)||void 0===n?void 0:n.code)),!1!==this.options.codeBlock&&k.push(Hb.configure(null===(i=this.options)||void 0===i?void 0:i.codeBlock)),!1!==this.options.document&&k.push(Wb.configure(null===(t=this.options)||void 0===t?void 0:t.document)),!1!==this.options.dropcursor&&k.push(Kb.configure(null===(o=this.options)||void 0===o?void 0:o.dropcursor)),!1!==this.options.gapcursor&&k.push(rf.configure(null===(s=this.options)||void 0===s?void 0:s.gapcursor)),!1!==this.options.hardBreak&&k.push(nf.configure(null===(l=this.options)||void 0===l?void 0:l.hardBreak)),!1!==this.options.heading&&k.push(tf.configure(null===(c=this.options)||void 0===c?void 0:c.heading)),!1!==this.options.history&&k.push($f.configure(null===(d=this.options)||void 0===d?void 0:d.history)),!1!==this.options.horizontalRule&&k.push(qf.configure(null===(u=this.options)||void 0===u?void 0:u.horizontalRule)),!1!==this.options.italic&&k.push(Mf.configure(null===(h=this.options)||void 0===h?void 0:h.italic)),!1!==this.options.listItem&&k.push(_f.configure(null===(m=this.options)||void 0===m?void 0:m.listItem)),!1!==this.options.orderedList&&k.push(Tf.configure(null===(g=this.options)||void 0===g?void 0:g.orderedList)),!1!==this.options.paragraph&&k.push(Nf.configure(null===(p=this.options)||void 0===p?void 0:p.paragraph)),!1!==this.options.strike&&k.push(Pf.configure(null===(b=this.options)||void 0===b?void 0:b.strike)),!1!==this.options.text&&k.push(Rf.configure(null===(f=this.options)||void 0===f?void 0:f.text)),k}}),Bf=Object.fromEntries?Object.fromEntries:e=>{if(!e||!e[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");const a={};return Object.keys(e).forEach((r=>{const[n,i]=e[r];a[n]=i})),a};function Vf(e){return Object.keys(e)}function Hf(e,a){if(!e)throw new Error(a)}function Wf(e,a){return a}const Uf=e=>{const a=e.length;let r=0,n="";for(;r<a;r++){const a=e[r];if(null==a)continue;let i;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=Uf(a);else{Hf(!Wf(0,!1)),"production"!==process.env.NODE_ENV&&void 0!==a.styles&&void 0!==a.name&&console.error("You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component."),i="";for(const e in a)a[e]&&e&&(i&&(i+=" "),i+=e)}break;default:i=a}i&&(n&&(n+=" "),n+=i)}return n};var Gf={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Kf=/[A-Z]|^ms/g,Zf=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Jf=function(e){return 45===e.charCodeAt(1)},Yf=function(e){return null!=e&&"boolean"!=typeof e},Xf=Nr((function(e){return Jf(e)?e:e.replace(Kf,"-$&").toLowerCase()})),Qf=function(e,a){switch(e){case"animation":case"animationName":if("string"==typeof a)return a.replace(Zf,(function(e,a,r){return ak={name:a,styles:r,next:ak},a}))}return 1===Gf[e]||Jf(e)||"number"!=typeof a||0===a?a:a+"px"};function ek(e,a,r){if(null==r)return"";var n=r;if(void 0!==n.__emotion_styles)return n;switch(typeof r){case"boolean":return"";case"object":var i=r;if(1===i.anim)return ak={name:i.name,styles:i.styles,next:ak},i.name;var t=r;if(void 0!==t.styles){var o=t.next;if(void 0!==o)for(;void 0!==o;)ak={name:o.name,styles:o.styles,next:ak},o=o.next;return t.styles+";"}return function(e,a,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=ek(e,a,r[i])+";";else for(var t in r){var o=r[t];if("object"!=typeof o){var s=o;null!=a&&void 0!==a[s]?n+=t+"{"+a[s]+"}":Yf(s)&&(n+=Xf(t)+":"+Qf(t,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=a&&void 0!==a[o[0]]){var l=ek(e,a,o);switch(t){case"animation":case"animationName":n+=Xf(t)+":"+l+";";break;default:n+=t+"{"+l+"}"}}else for(var c=0;c<o.length;c++)Yf(o[c])&&(n+=Xf(t)+":"+Qf(t,o[c])+";")}return n}(e,a,r)}var s=r;if(null==a)return s;var l=a[s];return void 0!==l?l:s}var ak,rk=/label:\s*([^\s;{]+)\s*(;|$)/g;var nk="undefined"!=typeof document;const{createCssAndCx:ik}={createCssAndCx:function(e){const{cache:a}=e,r=(...e)=>{const r=function(e,a,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,i="";ak=void 0;var t=e[0];null==t||void 0===t.raw?(n=!1,i+=ek(r,a,t)):i+=t[0];for(var o=1;o<e.length;o++)i+=ek(r,a,e[o]),n&&(i+=t[o]);rk.lastIndex=0;for(var s,l="";null!==(s=rk.exec(i));)l+="-"+s[1];var c=function(e){for(var a,r=0,n=0,i=e.length;i>=4;++n,i-=4)a=1540483477*(65535&(a=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(a>>>16)<<16),r=1540483477*(65535&(a^=a>>>24))+(59797*(a>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(i){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(i)+l;return{name:c,styles:i,next:ak}}(e,a.registered);!function(e,a){!function(e,a){var r=e.key+"-"+a.name;void 0===e.registered[r]&&(e.registered[r]=a.styles)}(e,a);var r=e.key+"-"+a.name;if(void 0===e.inserted[a.name]){var n="",i=a;do{var t=e.insert(a===i?"."+r:"",i,e.sheet,!0);nk||void 0===t||(n+=t),i=i.next}while(void 0!==i);!nk&&n.length}}(a,r);const n=`${a.key}-${r.name}`;{const r=e[0];(function(e){return e instanceof Object&&!("styles"in e)&&!("length"in e)&&!("__emotion_styles"in e)})(r)&&ok.saveClassNameCSSObjectMapping(a,n,r)}return n};return{css:r,cx:(...e)=>{const n=Uf(e),i=ok.fixClassName(a,n,r);return function(e,a,r){const n=[],i=function(e,a,r){var n="";return r.split(" ").forEach((function(r){void 0!==e[r]?a.push(e[r]+";"):r&&(n+=r+" ")})),n}(e,n,r);return n.length<2?r:i+a(n)}(a.registered,r,i)}}}};function tk(a){const{useCache:r}=a;return{useCssAndCx:function(){const a=r(),{css:n,cx:i}=function(a,r){var n;const i=e.useRef();return(!i.current||r.length!==(null===(n=i.current.prevDeps)||void 0===n?void 0:n.length)||i.current.prevDeps.map(((e,a)=>e===r[a])).indexOf(!1)>=0)&&(i.current={v:a(),prevDeps:[...r]}),i.current.v}((()=>ik({cache:a})),[a]);return{css:n,cx:i}}}}const ok=(()=>{const e=new WeakMap;return{saveClassNameCSSObjectMapping:(a,r,n)=>{let i=e.get(a);void 0===i&&(i=new Map,e.set(a,i)),i.set(r,n)},fixClassName:(a,r,n)=>{const i=e.get(a);return Uf(function(e){let a=!1;return e.map((([e,r])=>{if(void 0===r)return e;let n;if(a)n={"&&":r};else{n=e;for(const e in r)if(e.startsWith("@media")){a=!0;break}}return n}))}(r.split(" ").map((e=>[e,null==i?void 0:i.get(e)]))).map((e=>"string"==typeof e?e:n(e))))}}})();function sk(e){if(!(e instanceof Object)||"function"==typeof e)return e;const a=[];for(const r in e){const n=e[r],i=typeof n;if("string"!==i&&("number"!==i||isNaN(n))&&"boolean"!==i&&null!=n)return e;a.push(`${r}:${i}_${n}`)}return"xSqLiJdLMd9s"+a.join("|")}function lk(e,a,r){if(!(a instanceof Object))return e;const n={};return Vf(e).forEach((i=>n[i]=r(e[i],a[i]))),Vf(a).forEach((r=>{if(r in e)return;const i=a[r];"string"==typeof i&&(n[r]=i)})),n}const ck=({classes:a,theme:r,muiStyleOverridesParams:n,css:i,cx:t,name:o})=>{var s,l;if("makeStyle no name"!==o){if(void 0!==n&&void 0===o)throw new Error("To use muiStyleOverridesParams, you must specify a name using .withName('MyComponent')")}else o=void 0;let c;try{c=void 0===o?void 0:(null===(l=null===(s=r.components)||void 0===s?void 0:s[o])||void 0===l?void 0:l.styleOverrides)||void 0}catch(e){}const d=e.useMemo((()=>{if(void 0===c)return;const e={};for(const a in c){const t=c[a];t instanceof Object&&(e[a]=i("function"==typeof t?t({theme:r,ownerState:null==n?void 0:n.ownerState,...null==n?void 0:n.props}):t))}return e}),[c,sk(null==n?void 0:n.props),sk(null==n?void 0:n.ownerState),i]);return{classes:a=e.useMemo((()=>lk(a,d,t)),[a,d,t])}};let dk=0;function uk(a){const{useTheme:r,cache:n}=a,{useCache:i}=mk({cacheProvidedAtInception:n}),{useCssAndCx:t}=tk({useCache:i});return{makeStyles:function(a){const{name:n,uniqId:o=""+dk++}=null!=a?a:{},s="object"!=typeof n?n:Object.keys(n)[0];return function(a){const n="function"==typeof a?a:()=>a;return function(a,l){const c=r();let{css:d,cx:u}=t();const h=i();let m=e.useMemo((()=>{const e={},r="undefined"!=typeof Proxy&&new Proxy({},{get:(a,r)=>("symbol"==typeof r&&Hf(!1),e[r]=`${h.key}-${o}${void 0!==s?`-${s}`:""}-${r}-ref`)}),i=n(c,a,r||{}),t=Bf(Vf(i).map((a=>{const r=i[a];return r.label||(r.label=`${void 0!==s?`${s}-`:""}${a}`),[a,`${d(r)}${Wf(0,a in e)?` ${e[a]}`:""}`]})));return Vf(e).forEach((a=>{a in t||(t[a]=e[a])})),t}),[h,d,u,c,sk(a)]);{const a=null==l?void 0:l.props.classes;m=e.useMemo((()=>lk(m,a,u)),[m,sk(a),u])}{const e=ck({classes:m,css:d,cx:u,name:null!=s?s:"makeStyle no name",idOfUseStyles:o,muiStyleOverridesParams:l,theme:c});void 0!==e.classes&&(m=e.classes),void 0!==e.css&&(d=e.css),void 0!==e.cx&&(u=e.cx)}return{classes:m,theme:c,css:d,cx:u}}}},useStyles:function(){const e=r(),{css:a,cx:n}=t();return{theme:e,css:a,cx:n}}}}const hk=e.createContext(void 0),{createUseCache:mk}={createUseCache:function(a){const{cacheProvidedAtInception:r}=a;return{useCache:function(){var a;const i=n.__unsafe_useEmotionCache(),t=e.useContext(hk),o=null!==(a=null!=r?r:t)&&void 0!==a?a:i;if(null===o)throw new Error(["In order to get SSR working with tss-react you need to explicitly provide an Emotion cache.","MUI users be aware: This is not an error strictly related to tss-react, with or without tss-react,","MUI needs an Emotion cache to be provided for SSR to work.","Here is the MUI documentation related to SSR setup: https://mui.com/material-ui/guides/server-rendering/","TSS provides helper that makes the process of setting up SSR easier: https://docs.tss-react.dev/ssr"].join("\n"));return o}}}};function gk(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pk(a){const{useTheme:r,cache:n}=a,{makeStyles:i}=uk({useTheme:r,cache:n});function t(a,r,n){const t="string"==typeof a?(()=>{const r=a,n=function({children:a,...n}){return e.createElement(r,n,a)};return Object.defineProperty(n,"name",{value:gk(r)}),n})():a,o=(()=>{{const{name:e}=null!=n?n:{};if(void 0!==e)return"object"!=typeof e?e:Object.keys(e)[0]}let e;{const a=t.displayName;"string"==typeof a&&""!==a&&(e=a)}e:{if(void 0!==e)break e;const a=t.name;"string"==typeof a&&""!==a&&(e=a)}if(void 0!==e)return e=e.replace(/\$/g,"usd"),e=e.replace(/\(/g,"_").replace(/\)/g,"_"),e=e.replace(/[^a-zA-Z0-9-_]/g,"_"),e})(),s=i({...n,name:o})("function"==typeof r?(e,a,n)=>yk(r(e,a,n)):yk(r));function l(e){for(const a in e)if("root"!==a)return!0;return!1}const c=e.forwardRef((function(r,n){const{className:i,classes:o,...c}=r,{classes:d,cx:u}=s(r,{props:r}),h=u(d.root,i);return bk.set(d,{...d,root:h}),e.createElement(t,{ref:n,className:l(d)?i:h,..."string"==typeof a?{}:{classes:d},...c})}));return void 0!==o&&(c.displayName=`${gk(o)}WithStyles`,Object.defineProperty(c,"name",{value:c.displayName})),c}return t.getClasses=kk,{withStyles:t}}const bk=new WeakMap,fk="getClasses should only be used in conjunction with withStyles";function kk(e){const a=e.classes;if(void 0===a)throw new Error(fk);const r=bk.get(a);if(void 0===r)throw new Error(fk);return r}function yk(e){const a={},r={};return Object.keys(e).forEach((n=>(n.startsWith("@media")?r:a)[n]=e[n])),Object.keys(r).forEach((e=>{const n=r[e];Object.keys(n).forEach((r=>{var i;return a[r]={...null!==(i=a[r])&&void 0!==i?i:{},[e]:n[r]}}))})),a}const vk=(()=>{const e="object"==typeof document&&"function"==typeof(null===document||void 0===document?void 0:document.getElementById),a="undefined"!=typeof jest,r="undefined"!=typeof mocha,n="undefined"!=typeof __vitest_worker__;return!(e||a||r||n)})();function wk(e){zk=0,jk.splice(0,jk.length);const{useContext:a,usePlugin:r,cache:n}=e,{useCache:i}=mk({cacheProvidedAtInception:n}),{useCssAndCx:t}=tk({useCache:i});return{tss:xk({useContext:a,useCache:i,useCssAndCx:t,usePlugin:null!=r?r:({classes:e,cx:a,css:r})=>({classes:e,cx:a,css:r}),name:void 0,doesUseNestedSelectors:!1})}}let zk=0;const jk=[];function xk(e){const{useContext:a,useCache:r,useCssAndCx:n,usePlugin:i,name:t,doesUseNestedSelectors:o}=e;return{withParams:()=>xk({...e}),withName:a=>xk({...e,name:"object"!=typeof a?a:Object.keys(a)[0]}),withNestedSelectors:()=>xk({...e,doesUseNestedSelectors:!0}),create:e=>{const s="x"+zk++;if(void 0!==t)for(;;){const e=jk.find((e=>e.name===t));if(void 0===e)break;jk.splice(jk.indexOf(e),1)}const l="function"==typeof e?e:()=>e;return function(c){var d,u,h;const{classesOverrides:m,...g}=null!=c?c:{},p=a(),{css:b,cx:f}=n(),k=r(),y=function(e){const{cache:a,cssObjectByRuleNameOrGetCssObjectByRuleName:r,classesOverridesRef:n,paramsAndPluginParamsRef:i,idOfUseStyles:t,context:o,getClasses:s}=e;e:{const e=$k.get(a);if(void 0===e)break e;const s=e.get(r);if(void 0===s)break e;const l=s.get(n);if(void 0===l)break e;const c=l.get(i);if(void 0===c)break e;const d=c.find((({context:e})=>{if(e===o)return!0;if(Vf(e).length!==Vf(o).length)return!1;for(const a in e)if(sk(e[a])!==sk(o[a]))return!1;return!0}));if(void 0!==d){if((null==d?void 0:d.idOfUseStyles)===t)return d.result;c.splice(c.indexOf(d),1)}}const l=s();{$k.has(a)||$k.set(a,new WeakMap);const e=$k.get(a);Hf(void 0!==e),e.has(r)||e.set(r,new Map);const s=e.get(r);Hf(void 0!==s),s.has(n)||(s.size>200&&s.clear(),s.set(n,new Map));const c=s.get(n);if(Hf(void 0!==c),!c.has(i)){{const e="string"==typeof i?257:5;c.size<e||c.clear()}c.set(i,[])}let d=c.get(i);Hf(void 0!==d),d.length>5&&(d=[]),d.push({idOfUseStyles:t,context:o,result:l})}return l}({cache:k,cssObjectByRuleNameOrGetCssObjectByRuleName:e,classesOverridesRef:sk(m),paramsAndPluginParamsRef:sk(g),idOfUseStyles:s,context:p,getClasses:()=>{const e={},a=l({...c,...p,...o?{classes:"undefined"==typeof Proxy?{}:new Proxy({},{get:(a,r)=>{if("symbol"==typeof r&&Hf(!1),vk&&void 0===t)throw new Error(["tss-react: In SSR setups, in order to use nested selectors, you must also give a unique name to the useStyle function.",'Solution: Use tss.withName("ComponentName").withNestedSelectors<...>()... to set a name.'].join("\n"));e:{if(void 0===t)break e;let e=jk.find((e=>e.name===t&&e.idOfUseStyles===s));void 0===e&&(e={name:t,idOfUseStyles:s,nestedSelectorRuleNames:new Set},jk.push(e)),e.nestedSelectorRuleNames.add(r)}e:{if(void 0===t)break e;const e=void 0!==jk.find((e=>e.name===t&&e.idOfUseStyles!==s&&e.nestedSelectorRuleNames.has(r)));if(e)throw new Error([`tss-react: There are in your codebase two different useStyles named "${t}" that`,`both use use the nested selector ${r}.\n`,"This may lead to CSS class name collisions, causing nested selectors to target elements outside of the intended scope.\n","Solution: Ensure each useStyles using nested selectors has a unique name.\n",'Use: tss.withName("UniqueName").withNestedSelectors<...>()...'].join(" "))}return e[r]=`${k.key}-${void 0!==t?t:s}-${r}-ref`}})}:{}});let r=Bf(Vf(a).map((r=>{const n=a[r];return n.label||(n.label=`${void 0!==t?`${t}-`:""}${r}`),[r,`${b(n)}${Wf(0,r in e)?` ${e[r]}`:""}`]})));return Vf(e).forEach((a=>{a in r||(r[a]=e[a])})),r=lk(r,m,f),r}}),v=i({classes:y,css:b,cx:f,idOfUseStyles:s,name:t,...p,...g});return{classes:null!==(d=v.classes)&&void 0!==d?d:y,css:null!==(u=v.css)&&void 0!==u?u:b,cx:null!==(h=v.cx)&&void 0!==h?h:f,...p}}}}}const $k=new WeakMap;const{tss:qk}=wk({useContext:()=>({})});qk.create({});const{makeStyles:Ck,withStyles:Sk}={...uk(Ok={useTheme:qo}),...pk(Ok)};var Ok;const{tss:Ek}=wk({useContext:function(){return{theme:qo()}},usePlugin:ck});Ek.create({});var Mk=function(e,a){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=a(e[r],r,e);return i};var _k=function(){this.__data__=[],this.size=0};var Ak=function(e,a){return e===a||e!=e&&a!=a},Dk=Ak;var Tk=function(e,a){for(var r=e.length;r--;)if(Dk(e[r][0],a))return r;return-1},Nk=Tk,Ik=Array.prototype.splice;var Fk=function(e){var a=this.__data__,r=Nk(a,e);return!(r<0)&&(r==a.length-1?a.pop():Ik.call(a,r,1),--this.size,!0)},Pk=Tk;var Rk=function(e){var a=this.__data__,r=Pk(a,e);return r<0?void 0:a[r][1]},Lk=Tk;var Bk=Tk;var Vk=function(e,a){var r=this.__data__,n=Bk(r,e);return n<0?(++this.size,r.push([e,a])):r[n][1]=a,this},Hk=_k,Wk=Fk,Uk=Rk,Gk=function(e){return Lk(this.__data__,e)>-1},Kk=Vk;function Zk(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}Zk.prototype.clear=Hk,Zk.prototype.delete=Wk,Zk.prototype.get=Uk,Zk.prototype.has=Gk,Zk.prototype.set=Kk;var Jk=Zk,Yk=Jk;var Xk=function(){this.__data__=new Yk,this.size=0};var Qk=function(e){var a=this.__data__,r=a.delete(e);return this.size=a.size,r};var ey=function(e){return this.__data__.get(e)};var ay=function(e){return this.__data__.has(e)},ry="object"==typeof global&&global&&global.Object===Object&&global,ny=ry,iy="object"==typeof self&&self&&self.Object===Object&&self,ty=ny||iy||Function("return this")(),oy=ty.Symbol,sy=oy,ly=Object.prototype,cy=ly.hasOwnProperty,dy=ly.toString,uy=sy?sy.toStringTag:void 0;var hy=function(e){var a=cy.call(e,uy),r=e[uy];try{e[uy]=void 0;var n=!0}catch(e){}var i=dy.call(e);return n&&(a?e[uy]=r:delete e[uy]),i},my=Object.prototype.toString;var gy=hy,py=function(e){return my.call(e)},by=oy?oy.toStringTag:void 0;var fy=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":by&&by in Object(e)?gy(e):py(e)};var ky=function(e){var a=typeof e;return null!=e&&("object"==a||"function"==a)},yy=fy,vy=ky;var wy,zy=function(e){if(!vy(e))return!1;var a=yy(e);return"[object Function]"==a||"[object GeneratorFunction]"==a||"[object AsyncFunction]"==a||"[object Proxy]"==a},jy=ty["__core-js_shared__"],xy=(wy=/[^.]+$/.exec(jy&&jy.keys&&jy.keys.IE_PROTO||""))?"Symbol(src)_1."+wy:"";var $y=function(e){return!!xy&&xy in e},qy=Function.prototype.toString;var Cy=function(e){if(null!=e){try{return qy.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Sy=zy,Oy=$y,Ey=ky,My=Cy,_y=/^\[object .+?Constructor\]$/,Ay=Function.prototype,Dy=Object.prototype,Ty=Ay.toString,Ny=Dy.hasOwnProperty,Iy=RegExp("^"+Ty.call(Ny).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Fy=function(e){return!(!Ey(e)||Oy(e))&&(Sy(e)?Iy:_y).test(My(e))},Py=function(e,a){return null==e?void 0:e[a]};var Ry=function(e,a){var r=Py(e,a);return Fy(r)?r:void 0},Ly=Ry(ty,"Map"),By=Ry(Object,"create"),Vy=By;var Hy=function(){this.__data__=Vy?Vy(null):{},this.size=0};var Wy=function(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a},Uy=By,Gy=Object.prototype.hasOwnProperty;var Ky=function(e){var a=this.__data__;if(Uy){var r=a[e];return"__lodash_hash_undefined__"===r?void 0:r}return Gy.call(a,e)?a[e]:void 0},Zy=By,Jy=Object.prototype.hasOwnProperty;var Yy=By;var Xy=Hy,Qy=Wy,ev=Ky,av=function(e){var a=this.__data__;return Zy?void 0!==a[e]:Jy.call(a,e)},rv=function(e,a){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Yy&&void 0===a?"__lodash_hash_undefined__":a,this};function nv(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}nv.prototype.clear=Xy,nv.prototype.delete=Qy,nv.prototype.get=ev,nv.prototype.has=av,nv.prototype.set=rv;var iv=nv,tv=Jk,ov=Ly;var sv=function(e){var a=typeof e;return"string"==a||"number"==a||"symbol"==a||"boolean"==a?"__proto__"!==e:null===e};var lv=function(e,a){var r=e.__data__;return sv(a)?r["string"==typeof a?"string":"hash"]:r.map},cv=lv;var dv=function(e){var a=cv(this,e).delete(e);return this.size-=a?1:0,a},uv=lv;var hv=lv;var mv=lv;var gv=function(){this.size=0,this.__data__={hash:new iv,map:new(ov||tv),string:new iv}},pv=dv,bv=function(e){return uv(this,e).get(e)},fv=function(e){return hv(this,e).has(e)},kv=function(e,a){var r=mv(this,e),n=r.size;return r.set(e,a),this.size+=r.size==n?0:1,this};function yv(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}yv.prototype.clear=gv,yv.prototype.delete=pv,yv.prototype.get=bv,yv.prototype.has=fv,yv.prototype.set=kv;var vv=yv,wv=Jk,zv=Ly,jv=vv;var xv=Jk,$v=Xk,qv=Qk,Cv=ey,Sv=ay,Ov=function(e,a){var r=this.__data__;if(r instanceof wv){var n=r.__data__;if(!zv||n.length<199)return n.push([e,a]),this.size=++r.size,this;r=this.__data__=new jv(n)}return r.set(e,a),this.size=r.size,this};function Ev(e){var a=this.__data__=new xv(e);this.size=a.size}Ev.prototype.clear=$v,Ev.prototype.delete=qv,Ev.prototype.get=Cv,Ev.prototype.has=Sv,Ev.prototype.set=Ov;var Mv=Ev;var _v=function(e,a){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==a(e[r],r,e););return e},Av=Ry,Dv=function(){try{var e=Av(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tv=Dv;var Nv=function(e,a,r){"__proto__"==a&&Tv?Tv(e,a,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[a]=r},Iv=Nv,Fv=Ak,Pv=Object.prototype.hasOwnProperty;var Rv=function(e,a,r){var n=e[a];Pv.call(e,a)&&Fv(n,r)&&(void 0!==r||a in e)||Iv(e,a,r)},Lv=Rv,Bv=Nv;var Vv=function(e,a,r,n){var i=!r;r||(r={});for(var t=-1,o=a.length;++t<o;){var s=a[t],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),i?Bv(r,s,l):Lv(r,s,l)}return r};var Hv=function(e,a){for(var r=-1,n=Array(e);++r<e;)n[r]=a(r);return n};var Wv=function(e){return null!=e&&"object"==typeof e},Uv=fy,Gv=Wv;var Kv=function(e){return Gv(e)&&"[object Arguments]"==Uv(e)},Zv=Wv,Jv=Object.prototype,Yv=Jv.hasOwnProperty,Xv=Jv.propertyIsEnumerable,Qv=Kv(function(){return arguments}())?Kv:function(e){return Zv(e)&&Yv.call(e,"callee")&&!Xv.call(e,"callee")},ew=Array.isArray,aw={exports:{}};var rw=function(){return!1};!function(e,a){var r=ty,n=rw,i=a&&!a.nodeType&&a,t=i&&e&&!e.nodeType&&e,o=t&&t.exports===i?r.Buffer:void 0,s=(o?o.isBuffer:void 0)||n;e.exports=s}(aw,aw.exports);var nw=aw.exports,iw=/^(?:0|[1-9]\d*)$/;var tw=function(e,a){var r=typeof e;return!!(a=null==a?9007199254740991:a)&&("number"==r||"symbol"!=r&&iw.test(e))&&e>-1&&e%1==0&&e<a};var ow=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},sw=fy,lw=ow,cw=Wv,dw={};dw["[object Float32Array]"]=dw["[object Float64Array]"]=dw["[object Int8Array]"]=dw["[object Int16Array]"]=dw["[object Int32Array]"]=dw["[object Uint8Array]"]=dw["[object Uint8ClampedArray]"]=dw["[object Uint16Array]"]=dw["[object Uint32Array]"]=!0,dw["[object Arguments]"]=dw["[object Array]"]=dw["[object ArrayBuffer]"]=dw["[object Boolean]"]=dw["[object DataView]"]=dw["[object Date]"]=dw["[object Error]"]=dw["[object Function]"]=dw["[object Map]"]=dw["[object Number]"]=dw["[object Object]"]=dw["[object RegExp]"]=dw["[object Set]"]=dw["[object String]"]=dw["[object WeakMap]"]=!1;var uw=function(e){return cw(e)&&lw(e.length)&&!!dw[sw(e)]};var hw=function(e){return function(a){return e(a)}},mw={exports:{}};!function(e,a){var r=ry,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n&&r.process,o=function(){try{var e=i&&i.require&&i.require("util").types;return e||t&&t.binding&&t.binding("util")}catch(e){}}();e.exports=o}(mw,mw.exports);var gw=mw.exports,pw=uw,bw=hw,fw=gw&&gw.isTypedArray,kw=fw?bw(fw):pw,yw=Hv,vw=Qv,ww=ew,zw=nw,jw=tw,xw=kw,$w=Object.prototype.hasOwnProperty;var qw=function(e,a){var r=ww(e),n=!r&&vw(e),i=!r&&!n&&zw(e),t=!r&&!n&&!i&&xw(e),o=r||n||i||t,s=o?yw(e.length,String):[],l=s.length;for(var c in e)!a&&!$w.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||t&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||jw(c,l))||s.push(c);return s},Cw=Object.prototype;var Sw=function(e){var a=e&&e.constructor;return e===("function"==typeof a&&a.prototype||Cw)};var Ow=function(e,a){return function(r){return e(a(r))}},Ew=Ow(Object.keys,Object),Mw=Sw,_w=Ew,Aw=Object.prototype.hasOwnProperty;var Dw=function(e){if(!Mw(e))return _w(e);var a=[];for(var r in Object(e))Aw.call(e,r)&&"constructor"!=r&&a.push(r);return a},Tw=zy,Nw=ow;var Iw=function(e){return null!=e&&Nw(e.length)&&!Tw(e)},Fw=qw,Pw=Dw,Rw=Iw;var Lw=function(e){return Rw(e)?Fw(e):Pw(e)},Bw=Vv,Vw=Lw;var Hw=function(e,a){return e&&Bw(a,Vw(a),e)};var Ww=function(e){var a=[];if(null!=e)for(var r in Object(e))a.push(r);return a},Uw=ky,Gw=Sw,Kw=Ww,Zw=Object.prototype.hasOwnProperty;var Jw=function(e){if(!Uw(e))return Kw(e);var a=Gw(e),r=[];for(var n in e)("constructor"!=n||!a&&Zw.call(e,n))&&r.push(n);return r},Yw=qw,Xw=Jw,Qw=Iw;var ez=function(e){return Qw(e)?Yw(e,!0):Xw(e)},az=Vv,rz=ez;var nz=function(e,a){return e&&az(a,rz(a),e)},iz={exports:{}};!function(e,a){var r=ty,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n?r.Buffer:void 0,o=t?t.allocUnsafe:void 0;e.exports=function(e,a){if(a)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}}(iz,iz.exports);var tz=iz.exports;var oz=function(e,a){var r=-1,n=e.length;for(a||(a=Array(n));++r<n;)a[r]=e[r];return a};var sz=function(e,a){for(var r=-1,n=null==e?0:e.length,i=0,t=[];++r<n;){var o=e[r];a(o,r,e)&&(t[i++]=o)}return t};var lz=function(){return[]},cz=sz,dz=lz,uz=Object.prototype.propertyIsEnumerable,hz=Object.getOwnPropertySymbols,mz=hz?function(e){return null==e?[]:(e=Object(e),cz(hz(e),(function(a){return uz.call(e,a)})))}:dz,gz=Vv,pz=mz;var bz=function(e,a){return gz(e,pz(e),a)};var fz=function(e,a){for(var r=-1,n=a.length,i=e.length;++r<n;)e[i+r]=a[r];return e},kz=Ow(Object.getPrototypeOf,Object),yz=fz,vz=kz,wz=mz,zz=lz,jz=Object.getOwnPropertySymbols?function(e){for(var a=[];e;)yz(a,wz(e)),e=vz(e);return a}:zz,xz=Vv,$z=jz;var qz=function(e,a){return xz(e,$z(e),a)},Cz=fz,Sz=ew;var Oz=function(e,a,r){var n=a(e);return Sz(e)?n:Cz(n,r(e))},Ez=Oz,Mz=mz,_z=Lw;var Az=function(e){return Ez(e,_z,Mz)},Dz=Oz,Tz=jz,Nz=ez;var Iz=function(e){return Dz(e,Nz,Tz)},Fz=Ry(ty,"DataView"),Pz=Ly,Rz=Ry(ty,"Promise"),Lz=Ry(ty,"Set"),Bz=Ry(ty,"WeakMap"),Vz=fy,Hz=Cy,Wz="[object Map]",Uz="[object Promise]",Gz="[object Set]",Kz="[object WeakMap]",Zz="[object DataView]",Jz=Hz(Fz),Yz=Hz(Pz),Xz=Hz(Rz),Qz=Hz(Lz),ej=Hz(Bz),aj=Vz;(Fz&&aj(new Fz(new ArrayBuffer(1)))!=Zz||Pz&&aj(new Pz)!=Wz||Rz&&aj(Rz.resolve())!=Uz||Lz&&aj(new Lz)!=Gz||Bz&&aj(new Bz)!=Kz)&&(aj=function(e){var a=Vz(e),r="[object Object]"==a?e.constructor:void 0,n=r?Hz(r):"";if(n)switch(n){case Jz:return Zz;case Yz:return Wz;case Xz:return Uz;case Qz:return Gz;case ej:return Kz}return a});var rj=aj,nj=Object.prototype.hasOwnProperty;var ij=function(e){var a=e.length,r=new e.constructor(a);return a&&"string"==typeof e[0]&&nj.call(e,"index")&&(r.index=e.index,r.input=e.input),r},tj=ty.Uint8Array;var oj=function(e){var a=new e.constructor(e.byteLength);return new tj(a).set(new tj(e)),a},sj=oj;var lj=function(e,a){var r=a?sj(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},cj=/\w*$/;var dj=function(e){var a=new e.constructor(e.source,cj.exec(e));return a.lastIndex=e.lastIndex,a},uj=oy?oy.prototype:void 0,hj=uj?uj.valueOf:void 0;var mj=oj;var gj=oj,pj=lj,bj=dj,fj=function(e){return hj?Object(hj.call(e)):{}},kj=function(e,a){var r=a?mj(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var yj=function(e,a,r){var n=e.constructor;switch(a){case"[object ArrayBuffer]":return gj(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return pj(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return kj(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return bj(e);case"[object Symbol]":return fj(e)}},vj=ky,wj=Object.create,zj=function(){function e(){}return function(a){if(!vj(a))return{};if(wj)return wj(a);e.prototype=a;var r=new e;return e.prototype=void 0,r}}(),jj=zj,xj=kz,$j=Sw;var qj=function(e){return"function"!=typeof e.constructor||$j(e)?{}:jj(xj(e))},Cj=rj,Sj=Wv;var Oj=function(e){return Sj(e)&&"[object Map]"==Cj(e)},Ej=hw,Mj=gw&&gw.isMap,_j=Mj?Ej(Mj):Oj,Aj=rj,Dj=Wv;var Tj=function(e){return Dj(e)&&"[object Set]"==Aj(e)},Nj=hw,Ij=gw&&gw.isSet,Fj=Ij?Nj(Ij):Tj,Pj=Mv,Rj=_v,Lj=Rv,Bj=Hw,Vj=nz,Hj=tz,Wj=oz,Uj=bz,Gj=qz,Kj=Az,Zj=Iz,Jj=rj,Yj=ij,Xj=yj,Qj=qj,ex=ew,ax=nw,rx=_j,nx=ky,ix=Fj,tx=Lw,ox=ez,sx="[object Arguments]",lx="[object Function]",cx="[object Object]",dx={};dx[sx]=dx["[object Array]"]=dx["[object ArrayBuffer]"]=dx["[object DataView]"]=dx["[object Boolean]"]=dx["[object Date]"]=dx["[object Float32Array]"]=dx["[object Float64Array]"]=dx["[object Int8Array]"]=dx["[object Int16Array]"]=dx["[object Int32Array]"]=dx["[object Map]"]=dx["[object Number]"]=dx[cx]=dx["[object RegExp]"]=dx["[object Set]"]=dx["[object String]"]=dx["[object Symbol]"]=dx["[object Uint8Array]"]=dx["[object Uint8ClampedArray]"]=dx["[object Uint16Array]"]=dx["[object Uint32Array]"]=!0,dx["[object Error]"]=dx[lx]=dx["[object WeakMap]"]=!1;var ux=function e(a,r,n,i,t,o){var s,l=1&r,c=2&r,d=4&r;if(n&&(s=t?n(a,i,t,o):n(a)),void 0!==s)return s;if(!nx(a))return a;var u=ex(a);if(u){if(s=Yj(a),!l)return Wj(a,s)}else{var h=Jj(a),m=h==lx||"[object GeneratorFunction]"==h;if(ax(a))return Hj(a,l);if(h==cx||h==sx||m&&!t){if(s=c||m?{}:Qj(a),!l)return c?Gj(a,Vj(s,a)):Uj(a,Bj(s,a))}else{if(!dx[h])return t?a:{};s=Xj(a,h,l)}}o||(o=new Pj);var g=o.get(a);if(g)return g;o.set(a,s),ix(a)?a.forEach((function(i){s.add(e(i,r,n,i,a,o))})):rx(a)&&a.forEach((function(i,t){s.set(t,e(i,r,n,t,a,o))}));var p=u?void 0:(d?c?Zj:Kj:c?ox:tx)(a);return Rj(p||a,(function(i,t){p&&(i=a[t=i]),Lj(s,t,e(i,r,n,t,a,o))})),s},hx=fy,mx=Wv;var gx=function(e){return"symbol"==typeof e||mx(e)&&"[object Symbol]"==hx(e)},px=ew,bx=gx,fx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kx=/^\w*$/;var yx=function(e,a){if(px(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!bx(e))||(kx.test(e)||!fx.test(e)||null!=a&&e in Object(a))},vx=vv;function wx(e,a){if("function"!=typeof e||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=a?a.apply(this,n):n[0],t=r.cache;if(t.has(i))return t.get(i);var o=e.apply(this,n);return r.cache=t.set(i,o)||t,o};return r.cache=new(wx.Cache||vx),r}wx.Cache=vx;var zx=wx;var jx=function(e){var a=zx(e,(function(e){return 500===r.size&&r.clear(),e})),r=a.cache;return a},xx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$x=/\\(\\)?/g,qx=jx((function(e){var a=[];return 46===e.charCodeAt(0)&&a.push(""),e.replace(xx,(function(e,r,n,i){a.push(n?i.replace($x,"$1"):r||e)})),a})),Cx=qx,Sx=Mk,Ox=ew,Ex=gx,Mx=oy?oy.prototype:void 0,_x=Mx?Mx.toString:void 0;var Ax=function e(a){if("string"==typeof a)return a;if(Ox(a))return Sx(a,e)+"";if(Ex(a))return _x?_x.call(a):"";var r=a+"";return"0"==r&&1/a==-1/0?"-0":r},Dx=Ax;var Tx=ew,Nx=yx,Ix=Cx,Fx=function(e){return null==e?"":Dx(e)};var Px=function(e,a){return Tx(e)?e:Nx(e,a)?[e]:Ix(Fx(e))};var Rx=function(e){var a=null==e?0:e.length;return a?e[a-1]:void 0},Lx=gx;var Bx=function(e){if("string"==typeof e||Lx(e))return e;var a=e+"";return"0"==a&&1/e==-1/0?"-0":a},Vx=Px,Hx=Bx;var Wx=function(e,a){for(var r=0,n=(a=Vx(a,e)).length;null!=e&&r<n;)e=e[Hx(a[r++])];return r&&r==n?e:void 0};var Ux=function(e,a,r){var n=-1,i=e.length;a<0&&(a=-a>i?0:i+a),(r=r>i?i:r)<0&&(r+=i),i=a>r?0:r-a>>>0,a>>>=0;for(var t=Array(i);++n<i;)t[n]=e[n+a];return t},Gx=Wx,Kx=Ux;var Zx=Px,Jx=Rx,Yx=function(e,a){return a.length<2?e:Gx(e,Kx(a,0,-1))},Xx=Bx;var Qx=function(e,a){return a=Zx(a,e),null==(e=Yx(e,a))||delete e[Xx(Jx(a))]},e$=fy,a$=kz,r$=Wv,n$=Function.prototype,i$=Object.prototype,t$=n$.toString,o$=i$.hasOwnProperty,s$=t$.call(Object);var l$=function(e){if(!r$(e)||"[object Object]"!=e$(e))return!1;var a=a$(e);if(null===a)return!0;var r=o$.call(a,"constructor")&&a.constructor;return"function"==typeof r&&r instanceof r&&t$.call(r)==s$};var c$=function(e){return l$(e)?void 0:e},d$=Qv,u$=ew,h$=oy?oy.isConcatSpreadable:void 0;var m$=fz,g$=function(e){return u$(e)||d$(e)||!!(h$&&e&&e[h$])};var p$=function e(a,r,n,i,t){var o=-1,s=a.length;for(n||(n=g$),t||(t=[]);++o<s;){var l=a[o];r>0&&n(l)?r>1?e(l,r-1,n,i,t):m$(t,l):i||(t[t.length]=l)}return t},b$=p$;var f$=function(e){return(null==e?0:e.length)?b$(e,1):[]};var k$=function(e,a,r){switch(r.length){case 0:return e.call(a);case 1:return e.call(a,r[0]);case 2:return e.call(a,r[0],r[1]);case 3:return e.call(a,r[0],r[1],r[2])}return e.apply(a,r)},y$=Math.max;var v$=function(e,a,r){return a=y$(void 0===a?e.length-1:a,0),function(){for(var n=arguments,i=-1,t=y$(n.length-a,0),o=Array(t);++i<t;)o[i]=n[a+i];i=-1;for(var s=Array(a+1);++i<a;)s[i]=n[i];return s[a]=r(o),k$(e,this,s)}};var w$=function(e){return function(){return e}},z$=Dv,j$=z$?function(e,a){return z$(e,"toString",{configurable:!0,enumerable:!1,value:w$(a),writable:!0})}:function(e){return e},x$=Date.now;var $$=function(e){var a=0,r=0;return function(){var n=x$(),i=16-(n-r);if(r=n,i>0){if(++a>=800)return arguments[0]}else a=0;return e.apply(void 0,arguments)}}(j$),q$=f$,C$=v$,S$=$$;var O$=Mk,E$=ux,M$=Qx,_$=Px,A$=Vv,D$=c$,T$=Iz,N$=function(e){return S$(C$(e,void 0,q$),e+"")}((function(e,a){var r={};if(null==e)return r;var n=!1;a=O$(a,(function(a){return a=_$(a,e),n||(n=a.length>1),a})),A$(e,T$(e),r),n&&(r=E$(r,7,D$));for(var i=a.length;i--;)M$(r,a[i]);return r})),I$=u(N$);const F$=1,P$=2,R$=2;function L$(e){const r=Object.keys(e.typography.h1).some((e=>e.includes("@media"))),i=n.keyframes`
|
|
40
|
+
*/"production"===process.env.NODE_ENV?bi.exports=function(){if(pi)return fi;pi=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),t=Symbol.for("react.consumer"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.for("react.client.reference");function g(h){if("object"==typeof h&&null!==h){var m=h.$$typeof;switch(m){case e:switch(h=h.type){case r:case i:case n:case l:case c:return h;default:switch(h=h&&h.$$typeof){case o:case s:case u:case d:case t:return h;default:return m}}case a:return m}}}return fi.ContextConsumer=t,fi.ContextProvider=o,fi.Element=e,fi.ForwardRef=s,fi.Fragment=r,fi.Lazy=u,fi.Memo=d,fi.Portal=a,fi.Profiler=i,fi.StrictMode=n,fi.Suspense=l,fi.SuspenseList=c,fi.isContextConsumer=function(e){return g(e)===t},fi.isContextProvider=function(e){return g(e)===o},fi.isElement=function(a){return"object"==typeof a&&null!==a&&a.$$typeof===e},fi.isForwardRef=function(e){return g(e)===s},fi.isFragment=function(e){return g(e)===r},fi.isLazy=function(e){return g(e)===u},fi.isMemo=function(e){return g(e)===d},fi.isPortal=function(e){return g(e)===a},fi.isProfiler=function(e){return g(e)===i},fi.isStrictMode=function(e){return g(e)===n},fi.isSuspense=function(e){return g(e)===l},fi.isSuspenseList=function(e){return g(e)===c},fi.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===i||e===n||e===l||e===c||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===u||e.$$typeof===d||e.$$typeof===o||e.$$typeof===t||e.$$typeof===s||e.$$typeof===m||void 0!==e.getModuleId)},fi.typeOf=g,fi}():bi.exports=(ki||(ki=1,"production"!==process.env.NODE_ENV&&function(){function e(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case a:switch(e=e.type){case n:case t:case i:case c:case d:return e;default:switch(e=e&&e.$$typeof){case s:case l:case h:case u:case o:return e;default:return m}}case r:return m}}}var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),t=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=Symbol.for("react.client.reference");yi.ContextConsumer=o,yi.ContextProvider=s,yi.Element=a,yi.ForwardRef=l,yi.Fragment=n,yi.Lazy=h,yi.Memo=u,yi.Portal=r,yi.Profiler=t,yi.StrictMode=i,yi.Suspense=c,yi.SuspenseList=d,yi.isContextConsumer=function(a){return e(a)===o},yi.isContextProvider=function(a){return e(a)===s},yi.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},yi.isForwardRef=function(a){return e(a)===l},yi.isFragment=function(a){return e(a)===n},yi.isLazy=function(a){return e(a)===h},yi.isMemo=function(a){return e(a)===u},yi.isPortal=function(a){return e(a)===r},yi.isProfiler=function(a){return e(a)===t},yi.isStrictMode=function(a){return e(a)===i},yi.isSuspense=function(a){return e(a)===c},yi.isSuspenseList=function(a){return e(a)===d},yi.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===t||e===i||e===c||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===u||e.$$typeof===s||e.$$typeof===o||e.$$typeof===l||e.$$typeof===g||void 0!==e.getModuleId)},yi.typeOf=e}()),yi);var vi=bi.exports;const wi=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function zi(e){const a=`${e}`.match(wi);return a&&a[1]||""}function ji(e,a=""){return e.displayName||e.name||zi(e)||a}function xi(e,a,r){const n=ji(a);return e.displayName||(""!==n?`${r}(${n})`:r)}var $i=Object.freeze({__proto__:null,default:function(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return ji(e,"Component");if("object"==typeof e)switch(e.$$typeof){case vi.ForwardRef:return xi(e,e.render,"ForwardRef");case vi.Memo:return xi(e,e.type,"memo");default:return}}},getFunctionName:zi});function qi(e,a){const r=ma({},a);return Object.keys(e).forEach((n=>{if(n.toString().match(/^(components|slots)$/))r[n]=ma({},e[n],r[n]);else if(n.toString().match(/^(componentsProps|slotProps)$/)){const i=e[n]||{},t=a[n];r[n]={},t&&Object.keys(t)?i&&Object.keys(i)?(r[n]=ma({},t),Object.keys(i).forEach((e=>{r[n][e]=qi(i[e],t[e])}))):r[n]=t:r[n]=i}else void 0===r[n]&&(r[n]=e[n])})),r}const Ci="undefined"!=typeof window?d.useLayoutEffect:d.useEffect;function Si(e,a,r,n,i){const[t,o]=d.useState((()=>i&&r?r(e).matches:n?n(e).matches:a));return Ci((()=>{let a=!0;if(!r)return;const n=r(e),i=()=>{a&&o(n.matches)};return i(),n.addListener(i),()=>{a=!1,n.removeListener(i)}}),[e,r]),t}const Oi=d.useSyncExternalStore;function Ei(e,a,r,n,i){const t=d.useCallback((()=>a),[a]),o=d.useMemo((()=>{if(i&&r)return()=>r(e).matches;if(null!==n){const{matches:a}=n(e);return()=>a}return t}),[t,e,n,i,r]),[s,l]=d.useMemo((()=>{if(null===r)return[t,()=>()=>{}];const a=r(e);return[()=>a.matches,e=>(a.addListener(e),()=>{a.removeListener(e)})]}),[t,r,e]);return Oi(l,s,o)}function Mi(e,a={}){const r=ci(),n="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:i=!1,matchMedia:t=(n?window.matchMedia:null),ssrMatchMedia:o=null,noSsr:s=!1}=function(e){const{theme:a,name:r,props:n}=e;return a&&a.components&&a.components[r]&&a.components[r].defaultProps?qi(a.components[r].defaultProps,n):n}({name:"MuiUseMediaQuery",props:a,theme:r});"production"!==process.env.NODE_ENV&&"function"==typeof e&&null===r&&console.error(["MUI: The `query` argument provided is invalid.","You are providing a function without a theme in the context.","One of the parent elements needs to use a ThemeProvider."].join("\n"));let l="function"==typeof e?e(r):e;l=l.replace(/^@media( ?)/m,"");const c=(void 0!==Oi?Ei:Si)(l,i,t,o,s);return"production"!==process.env.NODE_ENV&&d.useDebugValue({query:l,match:c}),c}var _i=Object.freeze({__proto__:null,default:function(e,a=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(a,Math.min(e,r))}});const Ai="exact-prop: ";const Di=d.createContext(null);function Ti(){const e=d.useContext(Di);return"production"!==process.env.NODE_ENV&&d.useDebugValue(e),e}"production"!==process.env.NODE_ENV&&(Di.displayName="ThemeContext");var Ni="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";function Ii(e){const{children:a,theme:r}=e,n=Ti();"production"!==process.env.NODE_ENV&&null===n&&"function"==typeof r&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const i=d.useMemo((()=>{const e=null===n?r:function(e,a){if("function"==typeof a){const r=a(e);return"production"!==process.env.NODE_ENV&&(r||console.error(["MUI: You should return an object from your theme function, i.e.","<ThemeProvider theme={() => ({})} />"].join("\n"))),r}return ma({},e,a)}(n,r);return null!=e&&(e[Ni]=null!==n),e}),[r,n]);return k.jsx(Di.Provider,{value:i,children:a})}"production"!==process.env.NODE_ENV&&(Ii.propTypes={children:La.node,theme:La.oneOfType([La.object,La.func]).isRequired}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Ii.propTypes=function(e){return"production"===process.env.NODE_ENV?e:ma({},e,{[Ai]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Ii.propTypes));const Fi="exact-prop: ";const Pi=["value"],Ri=d.createContext();function Li(e){let{value:a}=e,r=ga(e,Pi);return k.jsx(Ri.Provider,ma({value:null==a||a},r))}"production"!==process.env.NODE_ENV&&(Li.propTypes={children:La.node,value:La.bool});const Bi=d.createContext(void 0);function Vi({value:e,children:a}){return k.jsx(Bi.Provider,{value:e,children:a})}function Hi({props:e,name:a}){return function(e){const{theme:a,name:r,props:n}=e;if(!a||!a.components||!a.components[r])return n;const i=a.components[r];return i.defaultProps?qi(i.defaultProps,n):i.styleOverrides||i.variants?n:qi(i,n)}({props:e,name:a,theme:{components:d.useContext(Bi)}})}"production"!==process.env.NODE_ENV&&(Vi.propTypes={children:La.node,value:La.object});const Wi={};function Ui(e,a,r,n=!1){return d.useMemo((()=>{const i=e&&a[e]||a;if("function"==typeof r){const t=r(i),o=e?ma({},a,{[e]:t}):t;return n?()=>o:o}return ma({},a,e?{[e]:r}:r)}),[e,a,r,n])}function Gi(e){const{children:a,theme:r,themeId:i}=e,t=ci(Wi),o=Ti()||Wi;"production"!==process.env.NODE_ENV&&(null===t&&"function"==typeof r||i&&t&&!t[i]&&"function"==typeof r)&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const s=Ui(i,t,r),l=Ui(i,o,r,!0),c="rtl"===s.direction;return k.jsx(Ii,{theme:l,children:k.jsx(n.ThemeContext.Provider,{value:s,children:k.jsx(Li,{value:c,children:k.jsx(Vi,{value:null==s?void 0:s.components,children:a})})})})}function Ki(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function Zi(e){if(d.isValidElement(e)||!Ki(e))return e;const a={};return Object.keys(e).forEach((r=>{a[r]=Zi(e[r])})),a}function Ji(e,a,r={clone:!0}){const n=r.clone?ma({},e):e;return Ki(e)&&Ki(a)&&Object.keys(a).forEach((i=>{d.isValidElement(a[i])?n[i]=a[i]:Ki(a[i])&&Object.prototype.hasOwnProperty.call(e,i)&&Ki(e[i])?n[i]=Ji(e[i],a[i],r):r.clone?n[i]=Ki(a[i])?Zi(a[i]):a[i]:n[i]=a[i]})),n}"production"!==process.env.NODE_ENV&&(Gi.propTypes={children:La.node,theme:La.oneOfType([La.func,La.object]).isRequired,themeId:La.string}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Gi.propTypes=function(e){return"production"===process.env.NODE_ENV?e:ma({},e,{[Fi]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Gi.propTypes));const Yi=e=>e,Xi=(()=>{let e=Yi;return{configure(a){e=a},generate:a=>e(a),reset(){e=Yi}}})(),Qi={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function et(e,a,r="Mui"){const n=Qi[a];return n?`${r}-${n}`:`${Xi.generate(e)}-${a}`}function at(e,a){return ma({toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}}},a)}var rt,nt={},it={exports:{}};(rt=it).exports=function(e){return e&&e.__esModule?e:{default:e}},rt.exports.__esModule=!0,rt.exports.default=rt.exports;var tt=it.exports,ot=h(fa),st=h(_i),lt=tt;Object.defineProperty(nt,"__esModule",{value:!0}),nt.alpha=wt,nt.blend=function(e,a,r,n=1){const i=(e,a)=>Math.round((e**(1/n)*(1-r)+a**(1/n)*r)**n),t=bt(e),o=bt(a),s=[i(t.values[0],o.values[0]),i(t.values[1],o.values[1]),i(t.values[2],o.values[2])];return kt({type:"rgb",values:s})},nt.colorChannel=void 0;var ct=nt.darken=zt;nt.decomposeColor=bt,nt.emphasize=xt;var dt=nt.getContrastRatio=function(e,a){const r=vt(e),n=vt(a);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)};nt.getLuminance=vt,nt.hexToRgb=pt,nt.hslToRgb=yt;var ut=nt.lighten=jt;nt.private_safeAlpha=function(e,a,r){try{return wt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.private_safeColorChannel=void 0,nt.private_safeDarken=function(e,a,r){try{return zt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.private_safeEmphasize=function(e,a,r){try{return xt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.private_safeLighten=function(e,a,r){try{return jt(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},nt.recomposeColor=kt,nt.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:a}=bt(e);return`#${a.map(((e,a)=>function(e){const a=e.toString(16);return 1===a.length?`0${a}`:a}(3===a?Math.round(255*e):e))).join("")}`};var ht=lt(ot),mt=lt(st);function gt(e,a=0,r=1){return"production"!==process.env.NODE_ENV&&(e<a||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${a}, ${r}].`),(0,mt.default)(e,a,r)}function pt(e){e=e.slice(1);const a=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(a);return r&&1===r[0].length&&(r=r.map((e=>e+e))),r?`rgb${4===r.length?"a":""}(${r.map(((e,a)=>a<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}function bt(e){if(e.type)return e;if("#"===e.charAt(0))return bt(pt(e));const a=e.indexOf("("),r=e.substring(0,a);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(r))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,ht.default)(9,e));let n,i=e.substring(a+1,e.length-1);if("color"===r){if(i=i.split(" "),n=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,ht.default)(10,n))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:r,values:i,colorSpace:n}}const ft=e=>{const a=bt(e);return a.values.slice(0,3).map(((e,r)=>-1!==a.type.indexOf("hsl")&&0!==r?`${e}%`:e)).join(" ")};nt.colorChannel=ft;function kt(e){const{type:a,colorSpace:r}=e;let{values:n}=e;return-1!==a.indexOf("rgb")?n=n.map(((e,a)=>a<3?parseInt(e,10):e)):-1!==a.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==a.indexOf("color")?`${r} ${n.join(" ")}`:`${n.join(", ")}`,`${a}(${n})`}function yt(e){e=bt(e);const{values:a}=e,r=a[0],n=a[1]/100,i=a[2]/100,t=n*Math.min(i,1-i),o=(e,a=(e+r/30)%12)=>i-t*Math.max(Math.min(a-3,9-a,1),-1);let s="rgb";const l=[Math.round(255*o(0)),Math.round(255*o(8)),Math.round(255*o(4))];return"hsla"===e.type&&(s+="a",l.push(a[3])),kt({type:s,values:l})}function vt(e){let a="hsl"===(e=bt(e)).type||"hsla"===e.type?bt(yt(e)).values:e.values;return a=a.map((a=>("color"!==e.type&&(a/=255),a<=.03928?a/12.92:((a+.055)/1.055)**2.4))),Number((.2126*a[0]+.7152*a[1]+.0722*a[2]).toFixed(3))}function wt(e,a){return e=bt(e),a=gt(a),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${a}`:e.values[3]=a,kt(e)}function zt(e,a){if(e=bt(e),a=gt(a),-1!==e.type.indexOf("hsl"))e.values[2]*=1-a;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-a;return kt(e)}function jt(e,a){if(e=bt(e),a=gt(a),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*a;else if(-1!==e.type.indexOf("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*a;else if(-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*a;return kt(e)}function xt(e,a=.15){return vt(e)>.5?zt(e,a):jt(e,a)}nt.private_safeColorChannel=(e,a)=>{try{return ft(e)}catch(r){return a&&"production"!==process.env.NODE_ENV&&console.warn(a),e}};const $t={black:"#000",white:"#fff"},qt={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ct="#f3e5f5",St="#ce93d8",Ot="#ba68c8",Et="#ab47bc",Mt="#9c27b0",_t="#7b1fa2",At="#e57373",Dt="#ef5350",Tt="#f44336",Nt="#d32f2f",It="#c62828",Ft="#ffb74d",Pt="#ffa726",Rt="#ff9800",Lt="#f57c00",Bt="#e65100",Vt="#e3f2fd",Ht="#90caf9",Wt="#42a5f5",Ut="#1976d2",Gt="#1565c0",Kt="#4fc3f7",Zt="#29b6f6",Jt="#03a9f4",Yt="#0288d1",Xt="#01579b",Qt="#81c784",eo="#66bb6a",ao="#4caf50",ro="#388e3c",no="#2e7d32",io="#1b5e20",to=["mode","contrastThreshold","tonalOffset"],oo={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:$t.white,default:$t.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},so={text:{primary:$t.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:$t.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function lo(e,a,r,n){const i=n.light||n,t=n.dark||1.5*n;e[a]||(e.hasOwnProperty(r)?e[a]=e[r]:"light"===a?e.light=ut(e.main,i):"dark"===a&&(e.dark=ct(e.main,t)))}function co(e){const{mode:a="light",contrastThreshold:r=3,tonalOffset:n=.2}=e,i=ga(e,to),t=e.primary||function(e="light"){return"dark"===e?{main:Ht,light:Vt,dark:Wt}:{main:Ut,light:Wt,dark:Gt}}(a),o=e.secondary||function(e="light"){return"dark"===e?{main:St,light:Ct,dark:Et}:{main:Mt,light:Ot,dark:_t}}(a),s=e.error||function(e="light"){return"dark"===e?{main:Tt,light:At,dark:Nt}:{main:Nt,light:Dt,dark:It}}(a),l=e.info||function(e="light"){return"dark"===e?{main:Zt,light:Kt,dark:Yt}:{main:Yt,light:Jt,dark:Xt}}(a),c=e.success||function(e="light"){return"dark"===e?{main:eo,light:Qt,dark:ro}:{main:no,light:ao,dark:io}}(a),d=e.warning||function(e="light"){return"dark"===e?{main:Pt,light:Ft,dark:Lt}:{main:"#ed6c02",light:Rt,dark:Bt}}(a);function u(e){const a=dt(e,so.text.primary)>=r?so.text.primary:oo.text.primary;if("production"!==process.env.NODE_ENV){const r=dt(e,a);r<3&&console.error([`MUI: The contrast ratio of ${r}:1 for ${a} on ${e}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join("\n"))}return a}const h=({color:e,name:a,mainShade:r=500,lightShade:i=300,darkShade:t=700})=>{if(!(e=ma({},e)).main&&e[r]&&(e.main=e[r]),!e.hasOwnProperty("main"))throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\nThe color object needs to have a \`main\` property or a \`${r}\` property.`:ua(11,a?` (${a})`:"",r));if("string"!=typeof e.main)throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\n\`color.main\` should be a string, but \`${JSON.stringify(e.main)}\` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from "@mui/material/colors";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });`:ua(12,a?` (${a})`:"",JSON.stringify(e.main)));return lo(e,"light",i,n),lo(e,"dark",t,n),e.contrastText||(e.contrastText=u(e.main)),e},m={dark:so,light:oo};"production"!==process.env.NODE_ENV&&(m[a]||console.error(`MUI: The palette mode \`${a}\` is not supported.`));return Ji(ma({common:ma({},$t),mode:a,primary:h({color:t,name:"primary"}),secondary:h({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:s,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:l,name:"info"}),success:h({color:c,name:"success"}),grey:qt,contrastThreshold:r,getContrastText:u,augmentColor:h,tonalOffset:n},m[a]),i)}const uo=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];const ho={textTransform:"uppercase"},mo='"Roboto", "Helvetica", "Arial", sans-serif';function go(e,a){const r="function"==typeof a?a(e):a,{fontFamily:n=mo,fontSize:i=14,fontWeightLight:t=300,fontWeightRegular:o=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:d,pxToRem:u}=r,h=ga(r,uo);"production"!==process.env.NODE_ENV&&("number"!=typeof i&&console.error("MUI: `fontSize` is required to be a number."),"number"!=typeof c&&console.error("MUI: `htmlFontSize` is required to be a number."));const m=i/14,g=u||(e=>e/c*m+"rem"),p=(e,a,r,i,t)=>{return ma({fontFamily:n,fontWeight:e,fontSize:g(a),lineHeight:r},n===mo?{letterSpacing:(o=i/a,Math.round(1e5*o)/1e5)+"em"}:{},t,d);var o},b={h1:p(t,96,1.167,-1.5),h2:p(t,60,1.2,-.5),h3:p(o,48,1.167,0),h4:p(o,34,1.235,.25),h5:p(o,24,1.334,0),h6:p(s,20,1.6,.15),subtitle1:p(o,16,1.75,.15),subtitle2:p(s,14,1.57,.1),body1:p(o,16,1.5,.15),body2:p(o,14,1.43,.15),button:p(s,14,1.75,.4,ho),caption:p(o,12,1.66,.4),overline:p(o,12,2.66,1,ho),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Ji(ma({htmlFontSize:c,pxToRem:g,fontFamily:n,fontSize:i,fontWeightLight:t,fontWeightRegular:o,fontWeightMedium:s,fontWeightBold:l},b),h,{clone:!1})}function po(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const bo=["none",po(0,2,1,-1,0,1,1,0,0,1,3,0),po(0,3,1,-2,0,2,2,0,0,1,5,0),po(0,3,3,-2,0,3,4,0,0,1,8,0),po(0,2,4,-1,0,4,5,0,0,1,10,0),po(0,3,5,-1,0,5,8,0,0,1,14,0),po(0,3,5,-1,0,6,10,0,0,1,18,0),po(0,4,5,-2,0,7,10,1,0,2,16,1),po(0,5,5,-3,0,8,10,1,0,3,14,2),po(0,5,6,-3,0,9,12,1,0,3,16,2),po(0,6,6,-3,0,10,14,1,0,4,18,3),po(0,6,7,-4,0,11,15,1,0,4,20,3),po(0,7,8,-4,0,12,17,2,0,5,22,4),po(0,7,8,-4,0,13,19,2,0,5,24,4),po(0,7,9,-4,0,14,21,2,0,5,26,4),po(0,8,9,-5,0,15,22,2,0,6,28,5),po(0,8,10,-5,0,16,24,2,0,6,30,5),po(0,8,11,-5,0,17,26,2,0,6,32,5),po(0,9,11,-5,0,18,28,2,0,7,34,6),po(0,9,12,-6,0,19,29,2,0,7,36,6),po(0,10,13,-6,0,20,31,3,0,8,38,7),po(0,10,13,-6,0,21,33,3,0,8,40,7),po(0,10,14,-6,0,22,35,3,0,8,42,7),po(0,11,14,-7,0,23,36,3,0,9,44,8),po(0,11,15,-7,0,24,38,3,0,9,46,8)],fo=["duration","easing","delay"],ko={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},yo={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function vo(e){return`${Math.round(e)}ms`}function wo(e){if(!e)return 0;const a=e/36;return Math.round(10*(4+15*a**.25+a/5))}function zo(e){const a=ma({},ko,e.easing),r=ma({},yo,e.duration);return ma({getAutoHeightDuration:wo,create:(e=["all"],n={})=>{const{duration:i=r.standard,easing:t=a.easeInOut,delay:o=0}=n,s=ga(n,fo);if("production"!==process.env.NODE_ENV){const a=e=>"string"==typeof e,r=e=>!isNaN(parseFloat(e));a(e)||Array.isArray(e)||console.error('MUI: Argument "props" must be a string or Array.'),r(i)||a(i)||console.error(`MUI: Argument "duration" must be a number or a string but found ${i}.`),a(t)||console.error('MUI: Argument "easing" must be a string.'),r(o)||a(o)||console.error('MUI: Argument "delay" must be a number or a string.'),"object"!=typeof n&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join("\n")),0!==Object.keys(s).length&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(s).join(",")}].`)}return(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof i?i:vo(i)} ${t} ${"string"==typeof o?o:vo(o)}`)).join(",")}},e,{easing:a,duration:r})}const jo={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},xo=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];const $o=function(e={},...a){const{mixins:r={},palette:n={},transitions:i={},typography:t={}}=e,o=ga(e,xo);if(e.vars)throw new Error("production"!==process.env.NODE_ENV?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":ua(18));const s=co(n),l=si(e);let c=Ji(l,{mixins:at(l.breakpoints,r),palette:s,shadows:bo.slice(),typography:go(s,t),transitions:zo(i),zIndex:ma({},jo)});if(c=Ji(c,o),c=a.reduce(((e,a)=>Ji(e,a)),c),"production"!==process.env.NODE_ENV){const e=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],a=(a,r)=>{let n;for(n in a){const i=a[n];if(-1!==e.indexOf(n)&&Object.keys(i).length>0){if("production"!==process.env.NODE_ENV){const e=et("",n);console.error([`MUI: The \`${r}\` component increases the CSS specificity of the \`${n}\` internal state.`,"You can not override it like this: ",JSON.stringify(a,null,2),"",`Instead, you need to use the '&.${e}' syntax:`,JSON.stringify({root:{[`&.${e}`]:i}},null,2),"","https://mui.com/r/state-classes-guide"].join("\n"))}a[n]={}}}};Object.keys(c.components).forEach((e=>{const r=c.components[e].styleOverrides;r&&0===e.indexOf("Mui")&&a(r,e)}))}return c.unstable_sxConfig=ma({},ri,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return ii({sx:e,theme:this})},c}();function qo(){const e=function(e=di){return ci(e)}($o);return"production"!==process.env.NODE_ENV&&d.useDebugValue(e),e[ha]||e}var Co,So={},Oo={exports:{}};var Eo,Mo={exports:{}};var _o=h(Jr),Ao=h(en),Do=h(un),To=h($i),No=h(li),Io=h(hi),Fo=tt;Object.defineProperty(So,"__esModule",{value:!0});var Po=So.default=function(e={}){const{themeId:a,defaultTheme:r=Qo,rootShouldForwardProp:n=Xo,slotShouldForwardProp:i=Xo}=e,t=e=>(0,Go.default)((0,Ro.default)({},e,{theme:as((0,Ro.default)({},e,{defaultTheme:r,themeId:a}))}));return t.__mui_systemSx=!0,(e,o={})=>{(0,Bo.internal_processStyles)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:s,slot:l,skipVariantsResolver:c,skipSx:d,overridesResolver:u=rs(es(l))}=o,h=(0,Lo.default)(o,Jo),m=void 0!==c?c:l&&"Root"!==l&&"root"!==l||!1,g=d||!1;let p;"production"!==process.env.NODE_ENV&&s&&(p=`${s}-${es(l||"Root")}`);let b=Xo;"Root"===l||"root"===l?b=n:l?b=i:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(b=void 0);const f=(0,Bo.default)(e,(0,Ro.default)({shouldForwardProp:b,label:p},h)),k=e=>"function"==typeof e&&e.__emotion_real!==e||(0,Vo.isPlainObject)(e)?n=>ns(e,(0,Ro.default)({},n,{theme:as({theme:n.theme,defaultTheme:r,themeId:a})})):e,y=(n,...i)=>{let o=k(n);const c=i?i.map(k):[];s&&u&&c.push((e=>{const n=as((0,Ro.default)({},e,{defaultTheme:r,themeId:a}));if(!n.components||!n.components[s]||!n.components[s].styleOverrides)return null;const i=n.components[s].styleOverrides,t={};return Object.entries(i).forEach((([a,r])=>{t[a]=ns(r,(0,Ro.default)({},e,{theme:n}))})),u(e,t)})),s&&!m&&c.push((e=>{var n;const i=as((0,Ro.default)({},e,{defaultTheme:r,themeId:a}));return ns({variants:null==i||null==(n=i.components)||null==(n=n[s])?void 0:n.variants},(0,Ro.default)({},e,{theme:i}))})),g||c.push(t);const d=c.length-i.length;if(Array.isArray(n)&&d>0){const e=new Array(d).fill("");o=[...n,...e],o.raw=[...n.raw,...e]}const h=f(o,...c);if("production"!==process.env.NODE_ENV){let a;s&&(a=`${s}${(0,Ho.default)(l||"")}`),void 0===a&&(a=`Styled(${(0,Wo.default)(e)})`),h.displayName=a}return e.muiName&&(h.muiName=e.muiName),h};return f.withConfig&&(y.withConfig=f.withConfig),y}};So.shouldForwardProp=Xo,So.systemDefaultTheme=void 0;var Ro=Fo((Co||(Co=1,function(e){function a(){return e.exports=a=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}(Oo)),Oo.exports)),Lo=Fo((Eo||(Eo=1,function(e){e.exports=function(e,a){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(a.includes(n))continue;r[n]=e[n]}return r},e.exports.__esModule=!0,e.exports.default=e.exports}(Mo)),Mo.exports)),Bo=function(e,a){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=Yo(a);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if("default"!==t&&Object.prototype.hasOwnProperty.call(e,t)){var o=i?Object.getOwnPropertyDescriptor(e,t):null;o&&(o.get||o.set)?Object.defineProperty(n,t,o):n[t]=e[t]}return n.default=e,r&&r.set(e,n),n}(_o),Vo=Ao,Ho=Fo(Do),Wo=Fo(To),Uo=Fo(No),Go=Fo(Io);const Ko=["ownerState"],Zo=["variants"],Jo=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Yo(e){if("function"!=typeof WeakMap)return null;var a=new WeakMap,r=new WeakMap;return(Yo=function(e){return e?r:a})(e)}function Xo(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const Qo=So.systemDefaultTheme=(0,Uo.default)(),es=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function as({defaultTheme:e,theme:a,themeId:r}){return n=a,0===Object.keys(n).length?e:a[r]||a;var n}function rs(e){return e?(a,r)=>r[e]:null}function ns(e,a){let{ownerState:r}=a,n=(0,Lo.default)(a,Ko);const i="function"==typeof e?e((0,Ro.default)({ownerState:r},n)):e;if(Array.isArray(i))return i.flatMap((e=>ns(e,(0,Ro.default)({ownerState:r},n))));if(i&&"object"==typeof i&&Array.isArray(i.variants)){const{variants:e=[]}=i;let a=(0,Lo.default)(i,Zo);return e.forEach((e=>{let i=!0;"function"==typeof e.props?i=e.props((0,Ro.default)({ownerState:r},n,r)):Object.keys(e.props).forEach((a=>{(null==r?void 0:r[a])!==e.props[a]&&n[a]!==e.props[a]&&(i=!1)})),i&&(Array.isArray(a)||(a=[a]),a.push("function"==typeof e.style?e.style((0,Ro.default)({ownerState:r},n,r)):e.style))})),a}return i}const is=Po({themeId:ha,defaultTheme:$o,rootShouldForwardProp:e=>function(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}(e)&&"classes"!==e}),ts=["theme"];function ss(e){let{theme:a}=e,r=ga(e,ts);const n=a[ha];return k.jsx(Gi,ma({},r,{themeId:n?ha:void 0,theme:n||a}))}"production"!==process.env.NODE_ENV&&(ss.propTypes={children:La.node,theme:La.oneOfType([La.object,La.func]).isRequired});const ls=()=>{const e=qo();return[...e.breakpoints.keys].reduce(((a,r)=>Mi(e.breakpoints.up(r))?r:a),null)??"sm"},cs=e=>({backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.icon.primary}),ds=e=>({backgroundColor:e.custom.palette.purple[100],color:e.custom.palette.icon.primary,"&:hover":{"&:before":{background:e.custom.palette.interaction.hoverOnDark}},"&:active":{"&:before":{background:e.custom.palette.interaction.pressOnDark}}}),us=e=>({backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,color:e.custom.palette.icon.primary,"&.MuiIconButton-root:disabled":{border:"none"}}),hs=e=>({backgroundColor:e.custom.palette.surface.raised,boxShadow:e.custom.elevation.raised,color:e.custom.palette.icon.primary,"&:focus-visible:after":{boxShadow:e.custom.boxShadow.input.focus},"&.MuiIconButton-root:disabled":{boxShadow:"none"}}),ms=(e,a)=>({borderRadius:"default"===e?a.spacing(a.custom.radius.md):a.custom.radius.round}),gs={xs:3*O,sm:3.5*O,md:4*O,lg:5*O,xl:6*O},ps=e=>({height:gs[e],width:gs[e]}),bs={xs:2*O,sm:2*O,md:2*O,lg:2.5*O,xl:3*O},fs=e=>({height:bs[e],width:bs[e]}),ks=a.styled(a.IconButton)((({theme:e,variation:a,shape:r="default",sizing:n})=>({boxSizing:"border-box",transition:"all 200ms ease","&:before, &:after":{...r&&{...ms(r,e)},transition:"all 250ms ease",content:'""',position:"absolute",inset:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&:focus:before":{backgroundColor:e.custom.palette.interaction.hover},"&:active:before":{backgroundColor:e.custom.palette.interaction.press},"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus},...r&&{...ms(r,e)},...n&&{...ps(n)},"&.MuiIconButton-root":{..."default"===a&&{...cs(e)},..."toggle"===a&&{...ds(e)},..."outlined"===a&&{...us(e)},..."raised"===a&&{...hs(e)},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,color:e.custom.palette.icon.disabled}},"& .MuiSvgIcon-root":{...n&&{...fs(n)},position:"relative",zIndex:1}}))),ys=({icon:e,loading:a,sizing:r,...n})=>k.jsx(ks,{...n,sizing:r,children:a?k.jsx(Pe,{sizing:r}):e}),vs=(e,a)=>({"&:after":{content:'""',position:"absolute",bottom:0,width:0,height:1,borderBottom:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderBottomLeftRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderTopLeftRadius:0,"&:after":{content:"none"}}}),ws=(e,a)=>({"&:after":{content:'""',position:"absolute",right:0,width:1,height:0,borderRight:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopLeftRadius:0,borderBottomLeftRadius:0,"&:after":{content:"none"}}}),zs=a.styled(a.ButtonGroup)((({theme:e,variation:a,orientation:r="horizontal",iconColor:n,sizing:i="lg",groupRaised:t=!1})=>({"&.MuiButtonGroup-root":{border:`1px solid ${e.custom.palette.stroke.default}`,...t&&{boxShadow:e.custom.elevation.raised,border:"none"},"& > button":{..."default"===a&&{...cs(e)},..."toggle"===a&&{...ds(e)},..."vertical"===r&&{...vs(e)},..."horizontal"===r&&{...ws(e)},...i&&{...ps(i)}},"& .MuiSvgIcon-root":{...i&&{...fs(i)},fill:n||"inherit"}}}))),js=({sx:e,...a})=>k.jsx(ea,{...a,sx:y({fontSize:{xs:qe.sm.body.md,sm:qe.sm.body.md,md:qe.sm.body.md,lg:qe.lg.body.md,xl:qe.lg.body.md}},!!e&&{...e})}),xs=a.styled(a.Box)((({theme:e})=>({"& .MuiGrid-item":{"&:first-of-type":{"& .MuiBox-root":{"&:before":{width:x,borderRadius:e.custom.radius.round,right:"50%",transform:`translateX(-${x}px)`,left:"auto"}}},"&:last-child":{"& .MuiBox-root":{"&:after":{width:x,borderRadius:e.custom.radius.round,right:"auto",left:"50%",transform:`translateX(${x}px)`}}}}}))),$s=({children:e,width:a})=>k.jsx(xs,{sx:{width:a},children:e}),qs=a.styled(aa)((()=>({lineHeight:"110%",textAlign:"center",width:"100%"}))),Cs=({disabled:e,children:a})=>k.jsx(qs,{showicon:!1,disabled:e,sx:{cursor:"inherit"},children:a}),Ss=a.styled(ta)((()=>({marginRight:0}))),Os=a.styled(a.Box)((({theme:e})=>({posiion:"relative","&:before":{content:'""',position:"absolute",top:"50%",left:0,height:z,width:`calc(50% - ${q/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default},"&:after":{content:'""',position:"absolute",top:"50%",right:0,height:z,width:`calc(50% - ${q/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default}}))),Es=e=>k.jsx(Os,{sx:{textAlign:"center",position:"relative"},children:k.jsx(Ss,{...e})}),Ms=({options:e=[],disabled:r=!1,sizing:n="lg",onChange:i,internalChange:t,value:o})=>{const s=a.useTheme();function l(e){console.warn(e),i(e.value),t&&t()}return k.jsx(a.Box,{children:k.jsx($s,{children:k.jsx(a.Grid,{container:!0,justifyContent:"space-between",children:e.map((e=>k.jsxs(a.Grid,{item:!0,sm:!0,onClick:()=>l(e),sx:{cursor:"pointer",textAlign:"center","&:hover":{"& .MuiButtonBase-root.MuiRadio-root":{"&:before":{backgroundColor:s.custom.palette.interaction.hover}}},"&:active":{"& .MuiButtonBase-root.MuiRadio-root":{backgroundColor:s.custom.palette.input.default,borderColor:s.custom.palette.stroke.focus,boxShadow:s.custom.boxShadow.input.focus,"&:before":{backgroundColor:s.custom.palette.interaction.press},"&.Mui-checked":{backgroundColor:s.custom.palette.purple[500]}}}},children:[k.jsx(Es,{sizing:n,disabled:r,onChange:a=>l(e),checked:o===e.value},e.value),k.jsx(a.Box,{sx:{mt:E.xs,width:"100%"},children:k.jsx(Cs,{disabled:r,children:e.label})})]},e.value)))})})})},_s=a.styled(a.Link)((({theme:e,disabled:a})=>({"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus,borderRadius:e.spacing(e.custom.radius.sm),outline:"none"},"&.MuiLink-root":{transition:"all 200ms ease",display:"inline",cursor:"pointer",color:a?e.custom.palette.text.lockedWhite:e.custom.palette.text.textLink,textDecorationColor:e.custom.palette.text.textLink,pointerEvents:a?"none":"auto","&:hover":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover},"&:active":{color:e.custom.palette.text.textLinkHover,textDecorationColor:e.custom.palette.text.textLinkHover},"&:visited":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink}}}))),As=e=>e.target&&"_blank"===e.target?k.jsx(_s,{rel:"noopener",...e}):k.jsx(_s,{...e});function Ds(e,a){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)a.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}var Ts;function Ns(){}function Is(e){return!!(e||"").match(/\d/)}function Fs(e){return null==e}function Ps(e){return Fs(e)||function(e){return"number"==typeof e&&isNaN(e)}(e)||"number"==typeof e&&!isFinite(e)}function Rs(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Ls(e,a){void 0===a&&(a=!0);var r="-"===e[0],n=r&&a,i=(e=e.replace("-","")).split(".");return{beforeDecimal:i[0],afterDecimal:i[1]||"",hasNegation:r,addNegation:n}}function Bs(e,a,r){for(var n="",i=r?"0":"",t=0;t<=a-1;t++)n+=e[t]||i;return n}function Vs(e,a){return Array(a+1).join(e)}function Hs(e){var a=e+"",r="-"===a[0]?"-":"";r&&(a=a.substring(1));var n=a.split(/[eE]/g),i=n[0],t=n[1];if(!(t=Number(t)))return r+i;var o=1+t,s=(i=i.replace(".","")).length;return o<0?i="0."+Vs("0",Math.abs(o))+i:o>=s?i+=Vs("0",o-s):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Ws(e,a,r){if(-1!==["","-"].indexOf(e))return e;var n=(-1!==e.indexOf(".")||r)&&a,i=Ls(e),t=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,l=parseFloat("0."+(o||"0")),c=(o.length<=a?"0."+o:l.toFixed(a)).split("."),d=t;return t&&Number(c[0])&&(d=t.split("").reverse().reduce((function(e,a,r){return e.length>r?(Number(e[0])+Number(a)).toString()+e.substring(1,e.length):a+e}),c[0])),""+(s?"-":"")+d+(n?".":"")+Bs(c[1]||"",a,r)}function Us(e,a){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",a),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(a,a),!0):(e.focus(),!1)}}!function(e){e.event="event",e.props="prop"}(Ts||(Ts={}));var Gs,Ks,Zs,Js=(Gs=function(e,a){for(var r=0,n=0,i=e.length,t=a.length;e[r]===a[r]&&r<i;)r++;for(;e[i-1-n]===a[t-1-n]&&t-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:t-n}}},Zs=void 0,function(){for(var e=[],a=arguments.length;a--;)e[a]=arguments[a];return Ks&&e.length===Ks.length&&e.every((function(e,a){return e===Ks[a]}))?Zs:(Ks=e,Zs=Gs.apply(void 0,e))});function Ys(e){return Math.max(e.selectionStart,e.selectionEnd)}function Xs(e){var a=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return a[n]===r[i]}function Qs(e,a,r,n){var i,t,o,s=e.length;if(i=a,t=0,o=s,a=Math.min(Math.max(i,t),o),"left"===n){for(;a>=0&&!r[a];)a--;-1===a&&(a=r.indexOf(!0))}else{for(;a<=s&&!r[a];)a++;a>s&&(a=r.lastIndexOf(!0))}return-1===a&&(a=s),a}function el(e){for(var a=Array.from({length:e.length+1}).map((function(){return!0})),r=0,n=a.length;r<n;r++)a[r]=Boolean(Is(e[r])||Is(e[r-1]));return a}function al(a,r,n,i,t,o){void 0===o&&(o=Ns);var s=function(a){var r=e.useRef(a);r.current=a;var n=e.useRef((function(){for(var e=[],a=arguments.length;a--;)e[a]=arguments[a];return r.current.apply(r,e)}));return n.current}((function(e,a){var r,n;return Ps(e)?(n="",r=""):"number"==typeof e||a?(n="number"==typeof e?Hs(e):e,r=i(n)):(n=t(e,void 0),r=i(n)),{formattedValue:r,numAsString:n}})),l=e.useState((function(){return s(Fs(a)?r:a,n)})),c=l[0],d=l[1],u=a,h=n;Fs(a)&&(u=c.numAsString,h=!0);var m=s(u,h);return e.useMemo((function(){d(m)}),[m.formattedValue]),[c,function(e,a){e.formattedValue!==c.formattedValue&&d({formattedValue:e.formattedValue,numAsString:e.value}),o(e,a)}]}function rl(e){return e.replace(/[^0-9]/g,"")}function nl(e){return e}function il(a){var r=a.type;void 0===r&&(r="text");var n=a.displayType;void 0===n&&(n="input");var i=a.customInput,t=a.renderText,o=a.getInputRef,s=a.format;void 0===s&&(s=nl);var l=a.removeFormatting;void 0===l&&(l=rl);var c=a.defaultValue,d=a.valueIsNumericString,u=a.onValueChange,h=a.isAllowed,m=a.onChange;void 0===m&&(m=Ns);var g=a.onKeyDown;void 0===g&&(g=Ns);var p=a.onMouseUp;void 0===p&&(p=Ns);var b=a.onFocus;void 0===b&&(b=Ns);var f=a.onBlur;void 0===f&&(f=Ns);var k=a.value,y=a.getCaretBoundary;void 0===y&&(y=el);var v=a.isValidInputCharacter;void 0===v&&(v=Is);var w=a.isCharacterSame,z=Ds(a,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),j=al(k,c,Boolean(d),s,l,u),x=j[0],$=x.formattedValue,q=x.numAsString,C=j[1],S=e.useRef(),O=e.useRef({formattedValue:$,numAsString:q}),E=function(e,a){O.current={formattedValue:e.formattedValue,numAsString:e.value},C(e,a)},M=e.useState(!1),_=M[0],A=M[1],D=e.useRef(null),T=e.useRef({setCaretTimeout:null,focusTimeout:null});e.useEffect((function(){return A(!0),function(){clearTimeout(T.current.setCaretTimeout),clearTimeout(T.current.focusTimeout)}}),[]);var N=s,I=function(e,a){var r=parseFloat(a);return{formattedValue:e,value:a,floatValue:isNaN(r)?void 0:r}},F=function(e,a,r){0===e.selectionStart&&e.selectionEnd===e.value.length||(Us(e,a),T.current.setCaretTimeout=setTimeout((function(){e.value===r&&e.selectionStart!==a&&Us(e,a)}),0))},P=function(e,a,r){return Qs(e,a,y(e),r)},R=function(e,a,r){var n=y(a),i=function(e,a,r,n,i,t,o){void 0===o&&(o=Xs);var s=i.findIndex((function(e){return e})),l=e.slice(0,s);a||r.startsWith(l)||(a=l,r=l+r,n+=l.length);for(var c=r.length,d=e.length,u={},h=new Array(c),m=0;m<c;m++){h[m]=-1;for(var g=0,p=d;g<p;g++)if(o({currentValue:r,lastValue:a,formattedValue:e,currentValueIndex:m,formattedValueIndex:g})&&!0!==u[g]){h[m]=g,u[g]=!0;break}}for(var b=n;b<c&&(-1===h[b]||!t(r[b]));)b++;var f=b===c||-1===h[b]?d:h[b];for(b=n-1;b>0&&-1===h[b];)b--;var k=-1===b||-1===h[b]?0:h[b]+1;return k>f?f:n-k<f-n?k:f}(a,$,e,r,n,v,w);return i=Qs(a,i,n)};e.useEffect((function(){var e=O.current,a=e.formattedValue,r=e.numAsString;$===a&&q===r||E(I($,q),{event:void 0,source:Ts.props})}),[$,q]);var L=D.current?Ys(D.current):void 0;("undefined"!=typeof window?e.useLayoutEffect:e.useEffect)((function(){var e=D.current;if($!==O.current.formattedValue&&e){var a=R(O.current.formattedValue,$,L);e.value=$,F(e,a,$)}}),[$]);var B=function(e,a,r){var n=a.target,i=S.current?function(e,a){var r=Math.min(e.selectionStart,a);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:a}}}(S.current,n.selectionEnd):Js($,e),t=Object.assign(Object.assign({},i),{lastValue:$}),o=l(e,t),s=N(o);if(o=l(s,void 0),h&&!h(I(s,o))){var c=a.target,d=Ys(c),u=R(e,$,d);return c.value=$,F(c,u,$),!1}return function(e){var a=e.formattedValue;void 0===a&&(a="");var r,n=e.input,i=e.source,t=e.event,o=e.numAsString;if(n){var s=e.inputValue||n.value,l=Ys(n);n.value=a,void 0!==(r=R(s,a,l))&&F(n,r,a)}a!==$&&E(I(a,o),{event:t,source:i})}({formattedValue:s,numAsString:o,inputValue:e,event:a,source:r,input:a.target}),!0},V=function(e,a){void 0===a&&(a=0);var r=e.selectionStart,n=e.selectionEnd;S.current={selectionStart:r,selectionEnd:n+a}},H=!_||"undefined"==typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",W=Object.assign({inputMode:H},z,{type:r,value:$,onChange:function(e){var a=e.target.value;B(a,e,Ts.event)&&m(e),S.current=void 0},onKeyDown:function(e){var a,r=e.target,n=e.key,i=r.selectionStart,t=r.selectionEnd,o=r.value;void 0===o&&(o=""),"ArrowLeft"===n||"Backspace"===n?a=Math.max(i-1,0):"ArrowRight"===n?a=Math.min(i+1,o.length):"Delete"===n&&(a=i);var s=0;"Delete"===n&&i===t&&(s=1);var l="ArrowLeft"===n||"ArrowRight"===n;if(void 0===a||i!==t&&!l)return g(e),void V(r,s);var c=a;l?(c=P(o,a,"ArrowLeft"===n?"left":"right"))!==a&&e.preventDefault():"Delete"!==n||v(o[a])?"Backspace"!==n||v(o[a])||(c=P(o,a,"left")):c=P(o,a,"right");c!==a&&F(r,c,o),g(e),V(r,s)},onMouseUp:function(e){var a=e.target,r=function(){var e=a.selectionStart,r=a.selectionEnd,n=a.value;if(void 0===n&&(n=""),e===r){var i=P(n,e);i!==e&&F(a,i,n)}};r(),requestAnimationFrame((function(){r()})),p(e),V(a)},onFocus:function(e){e.persist&&e.persist();var a=e.target,r=e.currentTarget;D.current=a,T.current.focusTimeout=setTimeout((function(){var n=a.selectionStart,i=a.selectionEnd,t=a.value;void 0===t&&(t="");var o=P(t,n);o===n||0===n&&i===t.length||F(a,o,t),b(Object.assign(Object.assign({},e),{currentTarget:r}))}),0)},onBlur:function(e){D.current=null,clearTimeout(T.current.focusTimeout),clearTimeout(T.current.setCaretTimeout),f(e)}});if("text"===n)return t?e.createElement(e.Fragment,null,t($,z)||null):e.createElement("span",Object.assign({},z,{ref:o}),$);if(i){var U=i;return e.createElement(U,Object.assign({},W,{ref:o}))}return e.createElement("input",Object.assign({},W,{ref:o}))}function tl(e,a){var r=a.decimalScale,n=a.fixedDecimalScale,i=a.prefix;void 0===i&&(i="");var t=a.suffix;void 0===t&&(t="");var o=a.allowNegative,s=a.thousandsGroupStyle;if(void 0===s&&(s="thousand"),""===e||"-"===e)return e;var l=ol(a),c=l.thousandSeparator,d=l.decimalSeparator,u=0!==r&&-1!==e.indexOf(".")||r&&n,h=Ls(e,o),m=h.beforeDecimal,g=h.afterDecimal,p=h.addNegation;return void 0!==r&&(g=Bs(g,r,!!n)),c&&(m=function(e,a,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),i=e.search(/[1-9]/);return i=-1===i?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+a)}(m,c,s)),i&&(m=i+m),t&&(g+=t),p&&(m="-"+m),e=m+(u&&d||"")+g}function ol(e){var a=e.decimalSeparator;void 0===a&&(a=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[a,"."]),{decimalSeparator:a,thousandSeparator:r,allowedDecimalSeparators:n}}function sl(e,a,r){var n;void 0===a&&(a=function(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}(e));var i=r.allowNegative,t=r.prefix;void 0===t&&(t="");var o=r.suffix;void 0===o&&(o="");var s=r.decimalScale,l=a.from,c=a.to,d=c.start,u=c.end,h=ol(r),m=h.allowedDecimalSeparators,g=h.decimalSeparator,p=e[u]===g;if(Is(e)&&(e===t||e===o)&&""===a.lastValue)return e;if(u-d==1&&-1!==m.indexOf(e[d])){var b=0===s?"":g;e=e.substring(0,d)+b+e.substring(d+1,e.length)}var f=function(e,a,r){var n=!1,i=!1;t.startsWith("-")?n=!1:e.startsWith("--")?(n=!1,i=!0):o.startsWith("-")&&e.length===o.length?n=!1:"-"===e[0]&&(n=!0);var s=n?1:0;return i&&(s=2),s&&(e=e.substring(s),a-=s,r-=s),{value:e,start:a,end:r,hasNegation:n}},k=f(e,d,u),y=k.hasNegation;e=(n=k).value,d=n.start,u=n.end;var v=f(a.lastValue,l.start,l.end),w=v.start,z=v.end,j=v.value,x=e.substring(d,u);!(e.length&&j.length&&(w>j.length-o.length||z<t.length))||x&&o.startsWith(x)||(e=j);var $=0;e.startsWith(t)?$+=t.length:d<t.length&&($=d),u-=$;var q=(e=e.substring($)).length,C=e.length-o.length;e.endsWith(o)?q=C:(u>C||u>e.length-o.length)&&(q=u),e=e.substring(0,q),e=function(e,a){void 0===e&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),t=n.test(e);return e=e.replace(/-/g,""),i&&!t&&a&&(e="-"+e),e}(y?"-"+e:e,i),e=(e.match(function(e){return new RegExp("(^-)|[0-9]|"+Rs(e),"g")}(g))||[]).join("");var S=e.indexOf(g);e=e.replace(new RegExp(Rs(g),"g"),(function(e,a){return a===S?".":""}));var O=Ls(e,i),E=O.beforeDecimal,M=O.afterDecimal,_=O.addNegation;return c.end-c.start<l.end-l.start&&""===E&&p&&!parseFloat(M)&&(e=_?"-":""),e}function ll(e){e=function(e){var a=ol(e),r=a.thousandSeparator,n=a.decimalSeparator,i=e.prefix;void 0===i&&(i="");var t=e.allowNegative;if(void 0===t&&(t=!0),r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");return i.startsWith("-")&&t&&(console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: "+i+"\n allowNegative: "+t+"\n "),t=!1),Object.assign(Object.assign({},e),{allowNegative:t})}(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var a=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;void 0===i&&(i=Ns);var t=e.onBlur;void 0===t&&(t=Ns);var o=e.thousandSeparator,s=e.decimalScale,l=e.fixedDecimalScale,c=e.prefix;void 0===c&&(c="");var d=e.defaultValue,u=e.value,h=e.valueIsNumericString,m=e.onValueChange,g=Ds(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),p=ol(e),b=p.decimalSeparator,f=p.allowedDecimalSeparators,k=function(a){return tl(a,e)},y=function(a,r){return sl(a,r,e)},v=Fs(u)?d:u,w=null!=h?h:function(e,a,r){return""===e||!(null==a?void 0:a.match(/\d/))&&!(null==r?void 0:r.match(/\d/))&&"string"==typeof e&&!isNaN(Number(e))}(v,c,a);Fs(u)?Fs(d)||(w=w||"number"==typeof d):w=w||"number"==typeof u;var z=function(e){return Ps(e)?e:("number"==typeof e&&(e=Hs(e)),w&&"number"==typeof s?Ws(e,s,Boolean(l)):e)},j=al(z(u),z(d),Boolean(w),k,y,m),x=j[0],$=x.numAsString,q=x.formattedValue,C=j[1];return Object.assign(Object.assign({},g),{value:q,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===b||Is(e)},isCharacterSame:function(e){var a=e.currentValue,r=e.lastValue,n=e.formattedValue,i=e.currentValueIndex,t=e.formattedValueIndex,o=a[i],d=n[t],h=Js(r,a).to,m=function(e){return y(e).indexOf(".")+c.length};return!(0===u&&l&&s&&a[h.start]===b&&m(a)<i&&m(n)>t)&&(!!(i>=h.start&&i<h.end&&f&&f.includes(o)&&d===b)||o===d)},onValueChange:C,format:k,removeFormatting:y,getCaretBoundary:function(a){return function(e,a){var r=a.prefix;void 0===r&&(r="");var n=a.suffix;void 0===n&&(n="");var i=Array.from({length:e.length+1}).map((function(){return!0})),t="-"===e[0];i.fill(!1,0,r.length+(t?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}(a,e)},onKeyDown:function(e){var a=e.target,n=e.key,t=a.selectionStart,d=a.selectionEnd,u=a.value;if(void 0===u&&(u=""),("Backspace"===n||"Delete"===n)&&d<c.length)e.preventDefault();else if(t===d){"Backspace"===n&&"-"===u[0]&&t===c.length+1&&r&&Us(a,1),s&&l&&("Backspace"===n&&u[t-1]===b?(Us(a,t-1),e.preventDefault()):"Delete"===n&&u[t]===b&&e.preventDefault()),(null==f?void 0:f.includes(n))&&u[t]===b&&Us(a,t+1);var h=!0===o?",":o;"Backspace"===n&&u[t-1]===h&&Us(a,t-1),"Delete"===n&&u[t]===h&&Us(a,t+1),i(e)}else i(e)},onBlur:function(a){var r=$;if(r.match(/\d/g)||(r=""),n||(r=function(e){if(!e)return e;var a="-"===e[0];a&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(a?"-":"")+n+(i?"."+i:"")}(r)),l&&s&&(r=Ws(r,s,l)),r!==$){var i=tl(r,e);C({formattedValue:i,value:r,floatValue:parseFloat(r)},{event:a,source:Ts.event})}t(a)}})}function cl(a){var r=ll(a);return e.createElement(il,Object.assign({},r))}const dl=(e,a,r)=>0===e||e?a&&e<a?a:r&&e>r?r:e:a||0,ul=e.forwardRef((({inputRef:n,onChange:i,name:t,min:o,max:s,value:l,...c},d)=>{const u=a.useTheme(),[h,m]=e.useState(dl(l,o,s)||0),g=e=>{m((a=>dl(e?a+1:a-1,o,s)))},p=e.useCallback((()=>{const e=dl(h,o,s);i&&i({target:{value:e}}),m(e)}),[h]);return k.jsxs(k.Fragment,{children:[k.jsx(cl,{...c,style:{width:"100%"},getInputRef:n,allowNegative:o&&Math.sign(o),autoFocus:!1,value:h,onValueChange:({floatValue:e})=>{m(e)},onBlurCapture:p}),k.jsxs(a.Stack,{sx:{position:"absolute",top:0,right:0,height:"100%",ml:"auto",width:32,borderLeft:`1px solid ${u.custom.palette.stroke.default}`},children:[k.jsx(a.ButtonBase,{onClick:()=>g(!0),sx:{flex:1,borderTopRightRadius:u.spacing(u.custom.radius.md),fontSize:16,"&:hover":{background:u.custom.palette.interaction.hover}},children:k.jsx(r.ArrowDropUp,{fontSize:"inherit"})}),k.jsx(a.Divider,{}),k.jsx(a.ButtonBase,{onClick:()=>g(!1),sx:{flex:1,borderBottomRightRadius:u.spacing(u.custom.radius.md),fontSize:16,"&:hover":{background:u.custom.palette.interaction.hover}},children:k.jsx(r.ArrowDropDown,{fontSize:"inherit"})})]})]})})),hl=({startAdornment:e,endAdornment:r,placeholder:n,onChange:i,internalChange:t,inputRef:o,min:s,max:l,...c})=>k.jsx(Ge,{placeholder:n,sx:{height:C,"& .MuiOutlinedInput-input":{pl:e?1:2,pr:e?1:2}},inputRef:o,inputProps:{min:s,max:l},InputProps:{inputComponent:ul,endAdornment:r?k.jsx(a.InputAdornment,{position:"start",sx:{pr:1},children:r}):null},...c,onChange:e=>{i&&i(e),t&&t()}}),ml=(e,a)=>"light"===a?{fontWeight:400}:{fontWeight:500,textTransform:"uppercase"},gl=(e,a,r)=>{switch(a){case"peach":return{background:e.custom.palette.peach[100],color:"heavy"===r?e.custom.palette.peach[1e3]:e.custom.palette.peach[800]};case"peachDark":return{background:e.custom.palette.peach[800],color:e.custom.palette.peach[0]};case"purple":return{background:e.custom.palette.purple[100],color:"heavy"===r?e.custom.palette.purple[1e3]:e.custom.palette.purple[800]};default:return{background:e.custom.palette.neutral[100],color:"heavy"===r?e.custom.palette.neutral[1e3]:e.custom.palette.neutral[800]}}},pl=a.styled(a.Chip)((({theme:e,variation:a,weight:r})=>({borderRadius:e.spacing(e.custom.radius.md),height:28,...gl(e,a,r),"& .MuiChip-label":{fontSize:`${qe.sm.body.sm}`,padding:`0 ${e.spacing(e.custom.padding.sm)}`,...ml(0,r)},"& .MuiChip-icon":{width:"0.8em",height:"0.8em",marginRight:-4,...gl(e,a,r),...ml(0,r)}}))),bl=a.styled("iframe")((()=>({border:"none",height:"100%",width:"100%"}))),fl=({options:r,onChange:n,other:i,value:t,internalChange:o,...s})=>{const l=i?.enabled,c="other-option",d=`${c}-value-`,[u,h]=e.useState(t),[m,g]=e.useState(!1);e.useEffect((()=>{!m&&u?.includes(d)?g(!0):m&&g(!1)}),[u]);return k.jsxs(k.Fragment,{children:[k.jsxs(a.RadioGroup,{...s,value:u,sx:{display:"flex",gap:e=>e.custom.margin.sm,label:{"&:last-child":{mb:0},"&:hover":{"& .MuiRadio-root":{backgroundColor:e=>e.custom.palette.interaction.hover,"&.Mui-checked":{backgroundColor:e=>e.custom.palette.purple[500]}}}}},onChange:(e,a)=>{n&&n(a),h(a),o&&o()},children:[r?r.map(((e,a)=>k.jsx(Ve,{sx:{"& .MuiButtonBase-root.MuiRadio-root":{alignSelf:"baseline"}},...e,control:k.jsx(ta,{})},a))):null,l&&k.jsx(Ve,{label:i?.label||"Other",value:d,control:k.jsx(ta,{checked:u?.includes(d)})},c)]}),m&&k.jsx(a.Box,{sx:{mt:1},children:k.jsx(Ke,{fullWidth:!0,autoFocus:!0,placeholder:i?.placeholder,defaultValue:u?.replace(d,""),onChange:e=>{var a;n&&n((a=e.target.value,`${d}${a}`)),o&&o()},required:!0})})]})},kl=e.createContext({attributes:{},listeners:void 0,ref(){}}),yl=e=>o.defaultAnimateLayoutChanges({...e,wasDragging:!0});function vl({children:r,top:n,bottom:i,id:t}){const{attributes:l,isDragging:c,listeners:d,setNodeRef:u,setActivatorNodeRef:h,transform:m,transition:g}=o.useSortable({id:t,animateLayoutChanges:yl}),p=e.useMemo((()=>({attributes:l,listeners:d,ref:h})),[l,d,h]),b={opacity:c?.4:void 0,transform:s.CSS.Translate.toString(m),transition:g};return k.jsx(kl.Provider,{value:p,children:k.jsxs(a.Stack,{className:"SortableItem",...l,sx:{position:"relative",...b,width:"100%"},ref:u,children:[n&&n,k.jsx(a.Box,{...d,sx:{display:"flex",cursor:"grab"},children:r}),i&&i]})})}const wl={sideEffects:t.defaultDropAnimationSideEffects({styles:{active:{opacity:"0.4"}}})};function zl({children:e}){return i.createPortal(k.jsx(t.DragOverlay,{zIndex:999999,dropAnimation:wl,children:e}),document.body)}const jl=({nativeEvent:e})=>{let a=e.target;for(;a;){if(a.dataset.noDnd)return!1;a=a.parentElement}return!0};class xl extends t.MouseSensor{static activators=[{eventName:"onMouseDown",handler:jl}]}class $l extends t.TouchSensor{static activators=[{eventName:"onTouchStart",handler:jl}]}function ql({items:r,onChange:n,renderItem:i,disabled:s,direction:l}){if(!r)return;const[c,d]=e.useState(null),u=e.useMemo((()=>r.find((e=>e?.id===c?.id))),[c,r]),h=a.useTheme(),m=a.useMediaQuery(h.breakpoints.down("md")),g=t.useSensors(t.useSensor(xl,{activationConstraint:{distance:5}}),t.useSensor($l,{activationConstraint:{delay:m?300:0,tolerance:8}}),t.useSensor(t.KeyboardSensor,{coordinateGetter:o.sortableKeyboardCoordinates}));return k.jsxs(t.DndContext,{measuring:{droppable:{strategy:t.MeasuringStrategy.Always}},sensors:g,onDragStart:({active:e})=>{d(e)},onDragEnd:({active:e,over:a})=>{if(a&&e.id!==a?.id){const i=r.findIndex((({id:a})=>a===e.id)),t=r.findIndex((({id:e})=>e===a.id));n(o.arrayMove(r,i,t))}d(null)},onDragCancel:()=>{d(null)},children:[k.jsx(o.SortableContext,{items:r,disabled:s,strategy:"horizontal"===l?o.horizontalListSortingStrategy:o.verticalListSortingStrategy,children:k.jsx(a.Stack,{sx:{..."horizontal"===l&&{flexDirection:"row"},display:"flex",m:0,gap:1,padding:0,alignContent:"flex-start"},children:r.map((a=>k.jsx(e.Fragment,{children:i(a)},a.id)))})}),k.jsx(zl,{children:u?i(u,!0,!!c):null})]})}ql.Item=vl,ql.DragHandle=function(){const{attributes:r,listeners:n,ref:i}=e.useContext(kl);return k.jsx(a.Box,{...r,...n,ref:i,children:k.jsx("svg",{viewBox:"0 0 20 20",width:"12",children:k.jsx("path",{d:"M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"})})})};const Cl=({handleSelectAll:r,isIndeterminate:n,isAllSelected:i,sizing:t})=>{const[o,s]=e.useState(!1),l=a.useTheme();return e.useEffect((()=>{i&&s(i)}),[i]),k.jsxs(a.Stack,{direction:"row",gap:l.spacing(l.custom.padding.sm),onClick:e=>{const a=!o;s(a),r(e,a)},sx:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"flex-end",p:e=>e.custom.padding.sm},children:[k.jsx(a.FormLabel,{sx:{cursor:"pointer",fontSize:()=>t&&Se[t]},children:"Select all"}),k.jsx(We,{sizing:"default",indeterminate:n,checked:o})]})},Sl=e.forwardRef((({children:e,handleSelectAll:a,value:r=[],selections:n,sizing:i,...t},o)=>{const s=r.length===n.length,l=r.length>0&&r.length<n.length;return k.jsxs("ul",{ref:o,...t,children:[k.jsx(Cl,{handleSelectAll:a,isIndeterminate:l,isAllSelected:s,sizing:i}),e]})})),Ol="0px 4px 8px 0px #06040D14, 0px 16px 24px 0px #06040D14, 0px 0px 4px 2px #06040D0A, 0px 0px 0px 1px #FFFFFF29",El=e=>{switch(e){case"xs":return 24;case"md":return 32;default:return 40}},Ml=(e,a)=>({"& .MuiTypography-root":{height:El(a),fontSize:Se[a],display:"flex",alignItems:"center",paddingLeft:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm),paddingRight:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm)}}),_l=e=>({fontSize:`${qe.sm.body.md}`,borderRadius:e.spacing(e.custom.radius.md),position:"relative",padding:e.spacing(e.custom.padding.sm),"& .MuiSelect-outlined":{padding:0},"& .MuiSelect-select.MuiInputBase-input":{paddingRight:e.spacing(M.md)},"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",background:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.md),inset:0,zIndex:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-focused:before":{backgroundColor:e.custom.palette.interaction.press},"&.Mui-disabled:before":{backgroundColor:e.custom.palette.interaction.none},"& .MuiSelect-select":{position:"relative"}}),Al=(e,a)=>{switch(a){case"lg":return{height:El(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.lg,height:I.lg,top:`calc(50% - ${I.lg/2}px)`}};case"md":return{height:El(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.md,height:I.md,top:`calc(50% - ${I.md/2}px)`}};case"xs":return{height:El(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.xs,height:I.xs,top:`calc(50% - ${I.xs/2}px)`}};default:return{height:El("lg"),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:I.lg,height:I.lg,top:`calc(50% - ${I.lg/2}px)`}}}},Dl=e=>({position:"relative",fontSize:`${qe.sm.body.md}`,backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.text.primary,"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",inset:0,zIndex:1},"& > .MuiBox-root":{position:"relative",zIndex:2,width:"100%","& .MuiSvgIcon-root":{marginRight:e.spacing(e.custom.margin.sm),width:I.xl,height:I.xl},"& .MuiBox-root":{padding:e.spacing(e.custom.padding.sm),lineHeight:"22px"}}}),Tl=e=>({"&.MuiModal-root.MuiPopover-root":{"&.MuiMenu-root":{borderRadius:e.spacing(e.custom.radius.sm),"& .MuiPaper-root":{border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Ol}}}}),Nl=a.styled(a.Autocomplete)((({theme:e,sizing:a,value:r})=>({maxWidth:"100%",backgroundColor:e.custom.palette.surface.raised,borderRadius:e.spacing(e.custom.radius.md),border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiSvgIcon-root":{...a&&{width:I[a],height:I[a]}},"&.MuiAutocomplete-root .MuiOutlinedInput-root .MuiAutocomplete-input":{...a&&{height:"xs"===a?2*O+"px":3*O+"px"},paddingTop:0,paddingBottom:0,paddingLeft:r&&r?.length>0?0:e.spacing(e.custom.padding.sm),justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& .MuiAutocomplete-inputRoot":{...a&&{fontSize:Se[a],gap:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)},display:"flex",alignItems:"flex-start",paddingRight:3*O+"px",flexWrap:"wrap",height:"auto"},"& .MuiOutlinedInput-root":{display:"flex",alignItems:"center",padding:"0"},"& .MuiAutocomplete-tag":{...a&&{height:"xs"===a?2*O+"px":3*O+"px"},margin:0,"& .MuiSvgIcon-root":{height:"12px",width:"12px"}},"&.Mui-disabled":{backgroundColor:`${e.custom.palette.input.disabled}`,borderColor:`${e.custom.palette.stroke.disabled}`},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"& .MuiChip-root .MuiChip-label":{height:20,lineHeight:"20px",maxWidth:140,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`}}}))),Il=a.styled(a.Chip)((({theme:e,sizing:a})=>({borderRadius:e.spacing(e.custom.radius.sm),border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.default,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`},"& .MuiChip-deleteIcon":{fill:e.custom.palette.icon.primary,borderRadius:e.custom.radius.round,margin:0,"&:hover":{backgroundColor:e.custom.palette.interaction.hover},"&:active":{backgroundColor:e.custom.palette.interaction.press},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,fill:e.custom.palette.icon.disabled}}}))),Fl=a.styled(a.TextField)((({theme:e,sizing:a})=>({"& .MuiOutlinedInput-root":{padding:0,...a&&{margin:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)}},"& .MuiInputBase-input":{padding:"0 14px"},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}))),Pl=a.styled(a.Popper)((({theme:e,sizing:r})=>({"& .MuiPaper-root":{...r&&{margin:"lg"===r?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs),marginLeft:"lg"===r?`-${e.spacing(e.custom.padding.sm)}`:`-${e.spacing(e.custom.padding.xs)}`,marginTop:`calc(${"lg"===r?e.spacing(e.custom.margin.sm):e.spacing(e.custom.margin.xs)} + ${e.spacing(e.custom.margin.xs)})`},border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Ol,borderRadius:e.spacing(e.custom.radius.sm)},[`& .${a.autocompleteClasses.listbox}`]:{overflowX:"hidden",[`& .${a.autocompleteClasses.option}`]:{fontSize:Se[r],...r&&{height:"lg"===r?5*O+"px":4*O+"px"},"> span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'&[aria-selected="true"]':{backgroundColor:e.custom.palette.interaction.hover,display:"flex",alignItems:"center",justifyContent:"space-between"}}}}))),Rl=e=>k.jsx(Pl,{...e}),Ll=({selections:a,disableClearable:n=!1,disabled:i,internalChange:t,onChange:o,placeholder:s="",renderListItem:l,sizing:c="lg",value:d=[]})=>{const[u,h]=e.useState(a.filter((e=>d.includes(e?.value)))),m=(e,r)=>{if(o){const n=r?a.map((({value:e})=>e)):[];h(r?a:[]),o(e,n,"selectOption"),t&&t()}};return k.jsx(Nl,{disabledItemsFocusable:!0,autoFocus:!1,disableCloseOnSelect:!0,blurOnSelect:!1,popupIcon:k.jsx(r.KeyboardArrowDown,{}),sizing:c,disabled:i,disableClearable:n,autoComplete:!0,multiple:!0,renderInput:e=>k.jsx(Fl,{...e,placeholder:u.length>0?void 0:s,sizing:c}),options:a,renderTags:(e,a)=>e.map(((e,n)=>{const{key:i,...t}=a({index:n});return k.jsx(Il,{sizing:c,deleteIcon:k.jsx(r.CloseRounded,{fontSize:"small"}),label:e.label,...t},i)})),onChange:(e,a,r)=>{const n=a.map((({value:e})=>e));o&&(h(a),o(e,n,r)),t&&t()},PopperComponent:e=>k.jsx(Rl,{...e,sizing:c}),isOptionEqualToValue:(e,a)=>e.value===a.value,renderOption:(e,a,{selected:n})=>{const{key:i,...t}=e;return k.jsxs("li",{...t,children:[k.jsx("span",{children:l?l(a.label):a.label}),k.jsx(r.Check,{sx:{visibility:n?"visible":"hidden",fontSize:"16px"}})]},i)},ListboxComponent:e.forwardRef(((e,r)=>k.jsx(Sl,{ref:r,...e,handleSelectAll:m,value:u,selections:a,sizing:c}))),value:u})},Bl=a.styled(a.MenuItem)((({theme:e})=>({...{...Dl(e)},"&.Mui-focusVisible":{backgroundColor:e.custom.palette.interaction.none},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{backgroundColor:e.custom.palette.input.default}},"&.MuiButtonBase-root.MuiMenuItem-root.Mui-disabled":{backgroundColor:e.custom.palette.input.default,color:e.custom.palette.text.disabled,"&:before":{backgroundColor:e.custom.palette.interaction.disabled}},"&:hover":{backgroundColor:e.custom.palette.input.default,"&:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{"&:before":{backgroundColor:e.custom.palette.interaction.hover}},"&:before":{backgroundColor:e.custom.palette.interaction.hover}}},"&:active":{"&:before":{backgroundColor:e.custom.palette.interaction.press}}}))),Vl=({children:e,selected:n,...i})=>k.jsx(Bl,{...i,children:k.jsxs(a.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k.jsx(a.Box,{children:e}),n&&k.jsx(r.Check,{})]})}),Hl=a.styled(a.Select)((({theme:e,sizing:a})=>({...{..._l(e)},...a&&{...Al(e,a)},...a&&{...Ml(e,a)},backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiOutlinedInput-notchedOutline":{border:e.custom.palette.stroke.default},"&:hover":{"& .MuiOutlinedInput-notchedOutline":{borderColor:e.custom.palette.stroke.default}},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"&.Mui-disabled":{backgroundColor:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"& .MuiSvgIcon-root":{color:e.custom.palette.icon.disabled,transition:e.custom.easing.input}}}))),Wl=({selections:e,autoComplete:n=!1,disabled:i=!1,disablePortal:t=!1,inputRef:o,internalChange:s,onChange:l,placeholder:c="",selectOptionProps:d,sizing:u="lg",sx:h,value:m=[],renderListItem:g,...p})=>{const b=a.useTheme(),f=ls();return n?k.jsx(Ll,{selections:e,placeholder:c,disabled:i,sizing:u,onChange:(e,a)=>{l&&l(a),s&&s()},value:Array.isArray(m)?m:[],internalChange:s,renderListItem:g}):k.jsxs(Hl,{sizing:u,inputRef:o,MenuProps:{disablePortal:t,sx:Tl,anchorOrigin:{vertical:45,horizontal:"center"}},displayEmpty:!0,IconComponent:r.KeyboardArrowDown,renderValue:a=>c&&!a?k.jsx(ze,{component:"p",variation:"sm"===f||"md"===f?"sm":"lg",sx:{color:b.custom.palette.text.placeholder},children:c}):k.jsx(ze,{component:"p",variation:"sm"===f||"md"===f?"sm":"lg",children:e?.find((({value:e})=>e===a))?.label}),onChange:(e,a)=>{l&&l(e,a),s&&s()},sx:h,value:m,...p,children:[""!==c.trim()&&k.jsx(Vl,{disabled:!0,value:"","aria-label":"placeholder",children:c},"placeholder"),e?.map((({value:e,label:a})=>k.jsx(Vl,{value:e,...d,children:g?g(a):a},e)))]})},Ul=a.styled(a.Box)((({theme:e,disabled:a,fullWidth:r})=>({width:r?"100%":"auto",minWidth:240,backgroundColor:a?e.custom.palette.input.disabled:e.custom.palette.surface.raised,border:`1px solid ${a?e.custom.palette.stroke.disabled:e.custom.palette.stroke.default}`,borderRadius:e.spacing(e.custom.radius.lg),padding:e.spacing(e.custom.padding.md),position:"relative",zIndex:0,"&:after":{content:'""',backgroundColor:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.lg),position:"absolute",inset:0},"&:hover":{"&:after":{backgroundColor:e.custom.palette.interaction.hover}},"&:active":{"&:after":{backgroundColor:e.custom.palette.interaction.press}},"& svg":{fill:e.custom.palette.icon.primary},...a&&{background:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"&:after":{backgroundColor:e.custom.palette.interaction.none},"& .MuiBox-root > .MuiSvgIcon-root":{fill:"none"}}}))),Gl=a.styled(js)((({theme:e})=>({fontSize:qe.button.md,color:e.custom.palette.text.primary,lineHeight:"120%",letterSpacing:"0.16px"}))),Kl=({label:e="Placeholder",disabled:n,onChange:i,options:t,fullWidth:o})=>{const s=a.useTheme(),l=t.map((e=>e.label)).indexOf(e);return k.jsx(Ul,{disabled:n,fullWidth:o,children:k.jsxs(a.Stack,{display:"flex",justifyContent:"space-between",flexDirection:"row",alignItems:"center",sx:{position:"relative",zIndex:1},children:[k.jsxs(a.Box,{display:"flex",alignItems:"center",sx:{"& svg":{fill:s.custom.palette.icon.secondary}},children:[k.jsx(r.DragHandle,{sx:{width:I.lg,height:I.lg,mr:s.custom.padding.sm}}),k.jsx(Gl,{align:"left",disabled:n,children:e})]}),k.jsx(Wl,{sizing:"xs",selections:t.map(((e,a)=>({label:`${a+1}`,value:`${a}`}))),disabled:n,value:`${l}`,onChange:function(e){const a=l,r=Number(e.target.value),n=t;let o=1;const s=n.splice(a,o)[0];o=0,n.splice(r,o,s),i(n)},MenuProps:{anchorOrigin:{vertical:q,horizontal:"center"}}})]})})},Zl=({labelTop:r,labelBottom:n,disabled:i,fullWidth:t=!1,options:o,onChange:s,value:l,internalChange:c})=>{const d=a.useTheme(),[u,h]=e.useState(l||o);function m(e){h(e),s(e.map((({id:e})=>e))),c&&c()}return k.jsxs(a.Stack,{gap:d.custom.margin.sm,textAlign:"center",sx:{width:t?"100%":"auto"},children:[r&&k.jsx(js,{disabled:i,sx:{color:d.custom.palette.text.secondary},children:r}),k.jsx(ql,{onChange:function(e){h(e),s(e.map((({id:e})=>e))),c&&c()},items:u,direction:"vertical",renderItem:({...e})=>k.jsx(vl,{id:e.id,children:k.jsx(Kl,{onChange:m,...e,options:u,disabled:i,selections:e.selections,fullWidth:t})})}),n&&k.jsx(js,{disabled:i,sx:{color:d.custom.palette.text.secondary},children:n})]})};function Jl(e){this.content=e}function Yl(e,a,r){for(let n=0;;n++){if(n==e.childCount||n==a.childCount)return e.childCount==a.childCount?null:r;let i=e.child(n),t=a.child(n);if(i!=t){if(!i.sameMarkup(t))return r;if(i.isText&&i.text!=t.text){for(let e=0;i.text[e]==t.text[e];e++)r++;return r}if(i.content.size||t.content.size){let e=Yl(i.content,t.content,r+1);if(null!=e)return e}r+=i.nodeSize}else r+=i.nodeSize}}function Xl(e,a,r,n){for(let i=e.childCount,t=a.childCount;;){if(0==i||0==t)return i==t?null:{a:r,b:n};let o=e.child(--i),s=a.child(--t),l=o.nodeSize;if(o!=s){if(!o.sameMarkup(s))return{a:r,b:n};if(o.isText&&o.text!=s.text){let e=0,a=Math.min(o.text.length,s.text.length);for(;e<a&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,r--,n--;return{a:r,b:n}}if(o.content.size||s.content.size){let e=Xl(o.content,s.content,r-1,n-1);if(e)return e}r-=l,n-=l}else r-=l,n-=l}}Jl.prototype={constructor:Jl,find:function(e){for(var a=0;a<this.content.length;a+=2)if(this.content[a]===e)return a;return-1},get:function(e){var a=this.find(e);return-1==a?void 0:this.content[a+1]},update:function(e,a,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),t=n.content.slice();return-1==i?t.push(r||e,a):(t[i+1]=a,r&&(t[i]=r)),new Jl(t)},remove:function(e){var a=this.find(e);if(-1==a)return this;var r=this.content.slice();return r.splice(a,2),new Jl(r)},addToStart:function(e,a){return new Jl([e,a].concat(this.remove(e).content))},addToEnd:function(e,a){var r=this.remove(e).content.slice();return r.push(e,a),new Jl(r)},addBefore:function(e,a,r){var n=this.remove(a),i=n.content.slice(),t=n.find(e);return i.splice(-1==t?i.length:t,0,a,r),new Jl(i)},forEach:function(e){for(var a=0;a<this.content.length;a+=2)e(this.content[a],this.content[a+1])},prepend:function(e){return(e=Jl.from(e)).size?new Jl(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Jl.from(e)).size?new Jl(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var a=this;e=Jl.from(e);for(var r=0;r<e.content.length;r+=2)a=a.remove(e.content[r]);return a},toObject:function(){var e={};return this.forEach((function(a,r){e[a]=r})),e},get size(){return this.content.length>>1}},Jl.from=function(e){if(e instanceof Jl)return e;var a=[];if(e)for(var r in e)a.push(r,e[r]);return new Jl(a)};class Ql{constructor(e,a){if(this.content=e,this.size=a||0,null==a)for(let a=0;a<e.length;a++)this.size+=e[a].nodeSize}nodesBetween(e,a,r,n=0,i){for(let t=0,o=0;o<a;t++){let s=this.content[t],l=o+s.nodeSize;if(l>e&&!1!==r(s,n+o,i||null,t)&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,a-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,a,r,n){let i="",t=!0;return this.nodesBetween(e,a,((o,s)=>{let l=o.isText?o.text.slice(Math.max(e,s)-s,a-s):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(t?t=!1:i+=r),i+=l}),0),i}append(e){if(!e.size)return this;if(!this.size)return e;let a=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(a.isText&&a.sameMarkup(r)&&(n[n.length-1]=a.withText(a.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new Ql(n,this.size+e.size)}cut(e,a=this.size){if(0==e&&a==this.size)return this;let r=[],n=0;if(a>e)for(let i=0,t=0;t<a;i++){let o=this.content[i],s=t+o.nodeSize;s>e&&((t<e||s>a)&&(o=o.isText?o.cut(Math.max(0,e-t),Math.min(o.text.length,a-t)):o.cut(Math.max(0,e-t-1),Math.min(o.content.size,a-t-1))),r.push(o),n+=o.nodeSize),t=s}return new Ql(r,n)}cutByIndex(e,a){return e==a?Ql.empty:0==e&&a==this.content.length?this:new Ql(this.content.slice(e,a))}replaceChild(e,a){let r=this.content[e];if(r==a)return this;let n=this.content.slice(),i=this.size+a.nodeSize-r.nodeSize;return n[e]=a,new Ql(n,i)}addToStart(e){return new Ql([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ql(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let a=0;a<this.content.length;a++)if(!this.content[a].eq(e.content[a]))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 a=this.content[e];if(!a)throw new RangeError("Index "+e+" out of range for "+this);return a}maybeChild(e){return this.content[e]||null}forEach(e){for(let a=0,r=0;a<this.content.length;a++){let n=this.content[a];e(n,r,a),r+=n.nodeSize}}findDiffStart(e,a=0){return Yl(this,e,a)}findDiffEnd(e,a=this.size,r=e.size){return Xl(this,e,a,r)}findIndex(e,a=-1){if(0==e)return ac(0,e);if(e==this.size)return ac(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=n+this.child(r).nodeSize;if(i>=e)return i==e||a>0?ac(r+1,i):ac(r,n);n=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,a){if(!a)return Ql.empty;if(!Array.isArray(a))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ql(a.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ql.empty;let a,r=0;for(let n=0;n<e.length;n++){let i=e[n];r+=i.nodeSize,n&&i.isText&&e[n-1].sameMarkup(i)?(a||(a=e.slice(0,n)),a[a.length-1]=i.withText(a[a.length-1].text+i.text)):a&&a.push(i)}return new Ql(a||e,r)}static from(e){if(!e)return Ql.empty;if(e instanceof Ql)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Ql([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Ql.empty=new Ql([],0);const ec={index:0,offset:0};function ac(e,a){return ec.index=e,ec.offset=a,ec}function rc(e,a){if(e===a)return!0;if(!e||"object"!=typeof e||!a||"object"!=typeof a)return!1;let r=Array.isArray(e);if(Array.isArray(a)!=r)return!1;if(r){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!rc(e[r],a[r]))return!1}else{for(let r in e)if(!(r in a)||!rc(e[r],a[r]))return!1;for(let r in a)if(!(r in e))return!1}return!0}let nc=class e{constructor(e,a){this.type=e,this.attrs=a}addToSet(e){let a,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))a||(a=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(a||(a=e.slice(0,n)),a.push(this),r=!0),a&&a.push(i)}}return a||(a=e.slice()),r||a.push(this),a}removeFromSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return e.slice(0,a).concat(e.slice(a+1));return e}isInSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let a in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,a){if(!a)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[a.type];if(!r)throw new RangeError(`There is no mark type ${a.type} in this schema`);let n=r.create(a.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,a){if(e==a)return!0;if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(a[r]))return!1;return!0}static setFrom(a){if(!a||Array.isArray(a)&&0==a.length)return e.none;if(a instanceof e)return[a];let r=a.slice();return r.sort(((e,a)=>e.type.rank-a.type.rank)),r}};nc.none=[];class ic extends Error{}class tc{constructor(e,a,r){this.content=e,this.openStart=a,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,a){let r=sc(this.content,e+this.openStart,a);return r&&new tc(r,this.openStart,this.openEnd)}removeBetween(e,a){return new tc(oc(this.content,e+this.openStart,a+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,a){if(!a)return tc.empty;let r=a.openStart||0,n=a.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw new RangeError("Invalid input for Slice.fromJSON");return new tc(Ql.fromJSON(e,a.content),r,n)}static maxOpen(e,a=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(a||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(a||!r.type.spec.isolating);r=r.lastChild)n++;return new tc(e,r,n)}}function oc(e,a,r){let{index:n,offset:i}=e.findIndex(a),t=e.maybeChild(n),{index:o,offset:s}=e.findIndex(r);if(i==a||t.isText){if(s!=r&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,a).append(e.cut(r))}if(n!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(n,t.copy(oc(t.content,a-i-1,r-i-1)))}function sc(e,a,r,n){let{index:i,offset:t}=e.findIndex(a),o=e.maybeChild(i);if(t==a||o.isText)return e.cut(0,a).append(r).append(e.cut(a));let s=sc(o.content,a-t-1,r);return s&&e.replaceChild(i,o.copy(s))}function lc(e,a,r){if(r.openStart>e.depth)throw new ic("Inserted content deeper than insertion position");if(e.depth-r.openStart!=a.depth-r.openEnd)throw new ic("Inconsistent open depths");return cc(e,a,r,0)}function cc(e,a,r,n){let i=e.index(n),t=e.node(n);if(i==a.index(n)&&n<e.depth-r.openStart){let o=cc(e,a,r,n+1);return t.copy(t.content.replaceChild(i,o))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=n||a.depth!=n){let{start:i,end:o}=function(e,a){let r=a.depth-e.openStart,n=a.node(r),i=n.copy(e.content);for(let e=r-1;e>=0;e--)i=a.node(e).copy(Ql.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}(r,e);return gc(t,pc(e,i,o,a,n))}{let n=e.parent,i=n.content;return gc(n,i.cut(0,e.parentOffset).append(r.content).append(i.cut(a.parentOffset)))}}return gc(t,bc(e,a,n))}function dc(e,a){if(!a.type.compatibleContent(e.type))throw new ic("Cannot join "+a.type.name+" onto "+e.type.name)}function uc(e,a,r){let n=e.node(r);return dc(n,a.node(r)),n}function hc(e,a){let r=a.length-1;r>=0&&e.isText&&e.sameMarkup(a[r])?a[r]=e.withText(a[r].text+e.text):a.push(e)}function mc(e,a,r,n){let i=(a||e).node(r),t=0,o=a?a.index(r):i.childCount;e&&(t=e.index(r),e.depth>r?t++:e.textOffset&&(hc(e.nodeAfter,n),t++));for(let e=t;e<o;e++)hc(i.child(e),n);a&&a.depth==r&&a.textOffset&&hc(a.nodeBefore,n)}function gc(e,a){return e.type.checkContent(a),e.copy(a)}function pc(e,a,r,n,i){let t=e.depth>i&&uc(e,a,i+1),o=n.depth>i&&uc(r,n,i+1),s=[];return mc(null,e,i,s),t&&o&&a.index(i)==r.index(i)?(dc(t,o),hc(gc(t,pc(e,a,r,n,i+1)),s)):(t&&hc(gc(t,bc(e,a,i+1)),s),mc(a,r,i,s),o&&hc(gc(o,bc(r,n,i+1)),s)),mc(n,null,i,s),new Ql(s)}function bc(e,a,r){let n=[];if(mc(null,e,r,n),e.depth>r){hc(gc(uc(e,a,r+1),bc(e,a,r+1)),n)}return mc(a,null,r,n),new Ql(n)}tc.empty=new tc(Ql.empty,0,0);class fc{constructor(e,a,r){this.pos=e,this.path=a,this.parentOffset=r,this.depth=a.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,a=this.index(this.depth);if(a==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(a);return r?e.child(a).cut(r):n}get nodeBefore(){let e=this.index(this.depth),a=this.pos-this.path[this.path.length-1];return a?this.parent.child(e).cut(0,a):0==e?null:this.parent.child(e-1)}posAtIndex(e,a){a=this.resolveDepth(a);let r=this.path[3*a],n=0==a?0:this.path[3*a-1]+1;for(let a=0;a<e;a++)n+=r.child(a).nodeSize;return n}marks(){let e=this.parent,a=this.index();if(0==e.content.size)return nc.none;if(this.textOffset)return e.child(a).marks;let r=e.maybeChild(a-1),n=e.maybeChild(a);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var t=0;t<i.length;t++)!1!==i[t].type.spec.inclusive||n&&i[t].isInSet(n.marks)||(i=i[t--].removeFromSet(i));return i}marksAcross(e){let a=this.parent.maybeChild(this.index());if(!a||!a.isInline)return null;let r=a.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let a=this.depth;a>0;a--)if(this.start(a)<=e&&this.end(a)>=e)return a;return 0}blockRange(e=this,a){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!a||a(this.node(r))))return new wc(this,e,r);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 a=1;a<=this.depth;a++)e+=(e?"/":"")+this.node(a).type.name+"_"+this.index(a-1);return e+":"+this.parentOffset}static resolve(e,a){if(!(a>=0&&a<=e.content.size))throw new RangeError("Position "+a+" out of range");let r=[],n=0,i=a;for(let a=e;;){let{index:e,offset:t}=a.content.findIndex(i),o=i-t;if(r.push(a,e,n+t),!o)break;if(a=a.child(e),a.isText)break;i=o-1,n+=t+1}return new fc(a,r,i)}static resolveCached(e,a){let r=vc.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==a)return n}else vc.set(e,r=new kc);let n=r.elts[r.i]=fc.resolve(e,a);return r.i=(r.i+1)%yc,n}}class kc{constructor(){this.elts=[],this.i=0}}const yc=12,vc=new WeakMap;class wc{constructor(e,a,r){this.$from=e,this.$to=a,this.depth=r}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 zc=Object.create(null);let jc=class e{constructor(e,a,r,n=nc.none){this.type=e,this.attrs=a,this.marks=n,this.content=r||Ql.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,a,r,n=0){this.content.nodesBetween(e,a,r,n,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,a,r,n){return this.content.textBetween(e,a,r,n)}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,a,r){return this.type==e&&rc(this.attrs,a||e.defaultAttrs||zc)&&nc.sameSet(this.marks,r||nc.none)}copy(a=null){return a==this.content?this:new e(this.type,this.attrs,a,this.marks)}mark(a){return a==this.marks?this:new e(this.type,this.attrs,this.content,a)}cut(e,a=this.content.size){return 0==e&&a==this.content.size?this:this.copy(this.content.cut(e,a))}slice(e,a=this.content.size,r=!1){if(e==a)return tc.empty;let n=this.resolve(e),i=this.resolve(a),t=r?0:n.sharedDepth(a),o=n.start(t),s=n.node(t).content.cut(n.pos-o,i.pos-o);return new tc(s,n.depth-t,i.depth-t)}replace(e,a,r){return lc(this.resolve(e),this.resolve(a),r)}nodeAt(e){for(let a=this;;){let{index:r,offset:n}=a.content.findIndex(e);if(a=a.maybeChild(r),!a)return null;if(n==e||a.isText)return a;e-=n+1}}childAfter(e){let{index:a,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(a),index:a,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:a,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(a),index:a,offset:r};let n=this.content.child(a-1);return{node:n,index:a-1,offset:r-n.nodeSize}}resolve(e){return fc.resolveCached(this,e)}resolveNoCache(e){return fc.resolve(this,e)}rangeHasMark(e,a,r){let n=!1;return a>e&&this.nodesBetween(e,a,(e=>(r.isInSet(e.marks)&&(n=!0),!n))),n}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()+")"),$c(this.marks,e)}contentMatchAt(e){let a=this.type.contentMatch.matchFragment(this.content,0,e);if(!a)throw new Error("Called contentMatchAt on a node with invalid content");return a}canReplace(e,a,r=Ql.empty,n=0,i=r.childCount){let t=this.contentMatchAt(e).matchFragment(r,n,i),o=t&&t.matchFragment(this.content,a);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,a,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),t=i&&i.matchFragment(this.content,a);return!!t&&t.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=nc.none;for(let a=0;a<this.marks.length;a++){let r=this.marks[a];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!nc.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 a 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,a){if(!a)throw new RangeError("Invalid input for Node.fromJSON");let r;if(a.marks){if(!Array.isArray(a.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=a.marks.map(e.markFromJSON)}if("text"==a.type){if("string"!=typeof a.text)throw new RangeError("Invalid text node in JSON");return e.text(a.text,r)}let n=Ql.fromJSON(e,a.content),i=e.nodeType(a.type).create(a.attrs,n,r);return i.type.checkAttrs(i.attrs),i}};jc.prototype.text=void 0;class xc extends jc{constructor(e,a,r,n){if(super(e,a,null,n),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$c(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,a){return this.text.slice(e,a)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new xc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new xc(this.type,this.attrs,e,this.marks)}cut(e=0,a=this.text.length){return 0==e&&a==this.text.length?this:this.withText(this.text.slice(e,a))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function $c(e,a){for(let r=e.length-1;r>=0;r--)a=e[r].type.name+"("+a+")";return a}class qc{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,a){let r=new Cc(e,a);if(null==r.next)return qc.empty;let n=Sc(r);r.next&&r.err("Unexpected trailing text");let i=function(e){let a=Object.create(null);return r(Dc(e,0));function r(n){let i=[];n.forEach((a=>{e[a].forEach((({term:a,to:r})=>{if(!a)return;let n;for(let e=0;e<i.length;e++)i[e][0]==a&&(n=i[e][1]);Dc(e,r).forEach((e=>{n||i.push([a,n=[]]),-1==n.indexOf(e)&&n.push(e)}))}))}));let t=a[n.join(",")]=new qc(n.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let n=i[e][1].sort(Ac);t.next.push({type:i[e][0],next:a[n.join(",")]||r(n)})}return t}}(function(e){let a=[[]];return i(t(e,0),r()),a;function r(){return a.push([])-1}function n(e,r,n){let i={term:n,to:r};return a[e].push(i),i}function i(e,a){e.forEach((e=>e.to=a))}function t(e,a){if("choice"==e.type)return e.exprs.reduce(((e,r)=>e.concat(t(r,a))),[]);if("seq"!=e.type){if("star"==e.type){let o=r();return n(a,o),i(t(e.expr,o),o),[n(o)]}if("plus"==e.type){let o=r();return i(t(e.expr,a),o),i(t(e.expr,o),o),[n(o)]}if("opt"==e.type)return[n(a)].concat(t(e.expr,a));if("range"==e.type){let o=a;for(let a=0;a<e.min;a++){let a=r();i(t(e.expr,o),a),o=a}if(-1==e.max)i(t(e.expr,o),o);else for(let a=e.min;a<e.max;a++){let a=r();n(o,a),i(t(e.expr,o),a),o=a}return[n(o)]}if("name"==e.type)return[n(a,void 0,e.value)];throw new Error("Unknown expr type")}for(let n=0;;n++){let o=t(e.exprs[n],a);if(n==e.exprs.length-1)return o;i(o,a=r())}}}(n));return function(e,a){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,t=[];for(let a=0;a<e.next.length;a++){let{type:r,next:o}=e.next[a];t.push(r.name),!i||r.isText||r.hasRequiredAttrs()||(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&a.err("Only non-generatable nodes ("+t.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}matchType(e){for(let a=0;a<this.next.length;a++)if(this.next[a].type==e)return this.next[a].next;return null}matchFragment(e,a=0,r=e.childCount){let n=this;for(let i=a;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}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:a}=this.next[e];if(!a.isText&&!a.hasRequiredAttrs())return a}return null}compatible(e){for(let a=0;a<this.next.length;a++)for(let r=0;r<e.next.length;r++)if(this.next[a].type==e.next[r].type)return!0;return!1}fillBefore(e,a=!1,r=0){let n=[this];return function i(t,o){let s=t.matchFragment(e,r);if(s&&(!a||s.validEnd))return Ql.from(o.map((e=>e.createAndFill())));for(let e=0;e<t.next.length;e++){let{type:a,next:r}=t.next[e];if(!a.isText&&!a.hasRequiredAttrs()&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(a));if(e)return e}}return null}(this,[])}findWrapping(e){for(let a=0;a<this.wrapCache.length;a+=2)if(this.wrapCache[a]==e)return this.wrapCache[a+1];let a=this.computeWrapping(e);return this.wrapCache.push(e,a),a}computeWrapping(e){let a=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let a=n;a.type;a=a.via)e.push(a.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:t,next:o}=i.next[e];t.isLeaf||t.hasRequiredAttrs()||t.name in a||n.type&&!o.validEnd||(r.push({match:t.contentMatch,type:t,via:n}),a[t.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 a(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&a(r.next[n].next)}(this),e.map(((a,r)=>{let n=r+(a.validEnd?"*":" ")+" ";for(let r=0;r<a.next.length;r++)n+=(r?", ":"")+a.next[r].type.name+"->"+e.indexOf(a.next[r].next);return n})).join("\n")}}qc.empty=new qc(!0);class Cc{constructor(e,a){this.string=e,this.nodeTypes=a,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 Sc(e){let a=[];do{a.push(Oc(e))}while(e.eat("|"));return 1==a.length?a[0]:{type:"choice",exprs:a}}function Oc(e){let a=[];do{a.push(Ec(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==a.length?a[0]:{type:"seq",exprs:a}}function Ec(e){let a=function(e){if(e.eat("(")){let a=Sc(e);return e.eat(")")||e.err("Missing closing paren"),a}if(!/\W/.test(e.next)){let a=function(e,a){let r=e.nodeTypes,n=r[a];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(a)&&i.push(n)}0==i.length&&e.err("No node type or group '"+a+"' found");return i}(e,e.next).map((a=>(null==e.inline?e.inline=a.isInline:e.inline!=a.isInline&&e.err("Mixing inline and block content"),{type:"name",value:a})));return e.pos++,1==a.length?a[0]:{type:"choice",exprs:a}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))a={type:"plus",expr:a};else if(e.eat("*"))a={type:"star",expr:a};else if(e.eat("?"))a={type:"opt",expr:a};else{if(!e.eat("{"))break;a=_c(e,a)}return a}function Mc(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let a=Number(e.next);return e.pos++,a}function _c(e,a){let r=Mc(e),n=r;return e.eat(",")&&(n="}"!=e.next?Mc(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:a}}function Ac(e,a){return a-e}function Dc(e,a){let r=[];return function a(n){let i=e[n];if(1==i.length&&!i[0].term)return a(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:t}=i[e];n||-1!=r.indexOf(t)||a(t)}}(a),r.sort(Ac)}function Tc(e){let a=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;a[r]=n.default}return a}function Nc(e,a){let r=Object.create(null);for(let n in e){let i=a&&a[n];if(void 0===i){let a=e[n];if(!a.hasDefault)throw new RangeError("No value supplied for attribute "+n);i=a.default}r[n]=i}return r}function Ic(e,a,r,n){for(let n in a)if(!(n in e))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in e){let n=e[r];n.validate&&n.validate(a[r])}}function Fc(e,a){let r=Object.create(null);if(a)for(let n in a)r[n]=new Rc(e,n,a[n]);return r}let Pc=class e{constructor(e,a,r){this.name=e,this.schema=a,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fc(e,r.attrs),this.defaultAttrs=Tc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==qc.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:Nc(this.attrs,e)}create(e=null,a,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new jc(this,this.computeAttrs(e),Ql.from(a),nc.setFrom(r))}createChecked(e=null,a,r){return a=Ql.from(a),this.checkContent(a),new jc(this,this.computeAttrs(e),a,nc.setFrom(r))}createAndFill(e=null,a,r){if(e=this.computeAttrs(e),(a=Ql.from(a)).size){let e=this.contentMatch.fillBefore(a);if(!e)return null;a=e.append(a)}let n=this.contentMatch.matchFragment(a),i=n&&n.fillBefore(Ql.empty,!0);return i?new jc(this,e,a.append(i),nc.setFrom(r)):null}validContent(e){let a=this.contentMatch.matchFragment(e);if(!a||!a.validEnd)return!1;for(let a=0;a<e.childCount;a++)if(!this.allowsMarks(e.child(a).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){Ic(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 a=0;a<e.length;a++)if(!this.allowsMarkType(e[a].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let a;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?a&&a.push(e[r]):a||(a=e.slice(0,r));return a?a.length?a:nc.none:e}static compile(a,r){let n=Object.create(null);a.forEach(((a,i)=>n[a]=new e(a,r,i)));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");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 Rc{constructor(e,a,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,a,r){let n=r.split("|");return r=>{let i=null===r?"null":typeof r;if(n.indexOf(i)<0)throw new RangeError(`Expected value of type ${n} for attribute ${a} on type ${e}, got ${i}`)}}(e,a,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Lc{constructor(e,a,r,n){this.name=e,this.rank=a,this.schema=r,this.spec=n,this.attrs=Fc(e,n.attrs),this.excluded=null;let i=Tc(this.attrs);this.instance=i?new nc(this,i):null}create(e=null){return!e&&this.instance?this.instance:new nc(this,Nc(this.attrs,e))}static compile(e,a){let r=Object.create(null),n=0;return e.forEach(((e,i)=>r[e]=new Lc(e,n++,a,i))),r}removeFromSet(e){for(var a=0;a<e.length;a++)e[a].type==this&&(e=e.slice(0,a).concat(e.slice(a+1)),a--);return e}isInSet(e){for(let a=0;a<e.length;a++)if(e[a].type==this)return e[a]}checkAttrs(e){Ic(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Bc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let a=this.spec={};for(let r in e)a[r]=e[r];a.nodes=Jl.from(e.nodes),a.marks=Jl.from(e.marks||{}),this.nodes=Pc.compile(this.spec.nodes,this),this.marks=Lc.compile(this.spec.marks,this);let r=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 a=this.nodes[e],n=a.spec.content||"",i=a.spec.marks;if(a.contentMatch=r[n]||(r[n]=qc.parse(n,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==i?null:i?Vc(this,i.split(" ")):""!=i&&a.inlineContent?null:[]}for(let e in this.marks){let a=this.marks[e],r=a.spec.excludes;a.excluded=null==r?[a]:""==r?[]:Vc(this,r.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,a=null,r,n){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Pc))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(a,r,n)}text(e,a){let r=this.nodes.text;return new xc(r,r.defaultAttrs,e,nc.setFrom(a))}mark(e,a){return"string"==typeof e&&(e=this.marks[e]),e.create(a)}nodeFromJSON(e){return jc.fromJSON(this,e)}markFromJSON(e){return nc.fromJSON(this,e)}nodeType(e){let a=this.nodes[e];if(!a)throw new RangeError("Unknown node type: "+e);return a}}function Vc(e,a){let r=[];for(let n=0;n<a.length;n++){let i=a[n],t=e.marks[i],o=t;if(t)r.push(t);else for(let a in e.marks){let n=e.marks[a];("_"==i||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=n)}if(!o)throw new SyntaxError("Unknown mark type: '"+a[n]+"'")}return r}class Hc{constructor(e,a){this.schema=e,this.rules=a,this.tags=[],this.styles=[];let r=this.matchedStyles=[];a.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let a=/[^=]*/.exec(e.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let r=e.nodes[a.node];return r.contentMatch.matchType(r)}))}parse(e,a={}){let r=new Jc(this,a,!1);return r.addAll(e,nc.none,a.from,a.to),r.finish()}parseSlice(e,a={}){let r=new Jc(this,a,!0);return r.addAll(e,nc.none,a.from,a.to),tc.maxOpen(r.finish())}matchTag(e,a,r){for(let n=r?this.tags.indexOf(r)+1:0;n<this.tags.length;n++){let r=this.tags[n];if(Yc(e,r.tag)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||a.matchesContext(r.context))){if(r.getAttrs){let a=r.getAttrs(e);if(!1===a)continue;r.attrs=a||void 0}return r}}}matchStyle(e,a,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],t=n.style;if(!(0!=t.indexOf(e)||n.context&&!r.matchesContext(n.context)||t.length>e.length&&(61!=t.charCodeAt(e.length)||t.slice(e.length+1)!=a))){if(n.getAttrs){let e=n.getAttrs(a);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let a=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<a.length;n++){let e=a[n];if((null==e.priority?50:e.priority)<r)break}a.splice(n,0,e)}for(let a in e.marks){let n=e.marks[a].spec.parseDOM;n&&n.forEach((e=>{r(e=Xc(e)),e.mark||e.ignore||e.clearMark||(e.mark=a)}))}for(let a in e.nodes){let n=e.nodes[a].spec.parseDOM;n&&n.forEach((e=>{r(e=Xc(e)),e.node||e.ignore||e.mark||(e.node=a)}))}return a}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Hc(e,Hc.schemaRules(e)))}}const Wc={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},Uc={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Gc={ol:!0,ul:!0};function Kc(e,a,r){return null!=a?(a?1:0)|("full"===a?2:0):e&&"pre"==e.whitespace?3:-5&r}class Zc{constructor(e,a,r,n,i,t){this.type=e,this.attrs=a,this.marks=r,this.solid=n,this.options=t,this.content=[],this.activeMarks=nc.none,this.match=i||(4&t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let a=this.type.contentMatch.fillBefore(Ql.from(e));if(!a){let a,r=this.type.contentMatch;return(a=r.findWrapping(e.type))?(this.match=r,a):null}this.match=this.type.contentMatch.matchFragment(a)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,a=this.content[this.content.length-1];if(a&&a.isText&&(e=/[ \t\r\n\u000c]+$/.exec(a.text))){let r=a;a.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-e[0].length))}}let a=Ql.from(this.content);return!e&&this.match&&(a=a.append(this.match.fillBefore(Ql.empty,!0))),this.type?this.type.create(this.attrs,a,this.marks):a}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Wc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Jc{constructor(e,a,r){this.parser=e,this.options=a,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n,i=a.topNode,t=Kc(null,a.preserveWhitespace,0)|(r?4:0);n=i?new Zc(i.type,i.attrs,nc.none,!0,a.topMatch||i.type.contentMatch,t):new Zc(r?null:e.schema.topNodeType,null,nc.none,!0,null,t),this.nodes=[n],this.find=a.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,a){3==e.nodeType?this.addTextNode(e,a):1==e.nodeType&&this.addElement(e,a)}addTextNode(e,a){let r=e.nodeValue,n=this.top,i=2&n.options?"full":this.localPreserveWS||(1&n.options)>0;if("full"===i||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)r="full"!==i?r.replace(/\r?\n|\r/g," "):r.replace(/\r\n?/g,"\n");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=n.content[n.content.length-1],i=e.previousSibling;(!a||i&&"BR"==i.nodeName||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),a),this.findInText(e)}else this.findInside(e)}addElement(e,a,r){let n=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let t,o=e.nodeName.toLowerCase();Gc.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let a=e.firstChild,r=null;a;a=a.nextSibling){let e=1==a.nodeType?a.nodeName.toLowerCase():null;e&&Gc.hasOwnProperty(e)&&r?(r.appendChild(a),a=r):"li"==e?r=a:e&&(r=null)}}(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(t=this.parser.matchTag(e,this,r));e:if(s?s.ignore:Uc.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,a);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let r,n=this.needsBlock;if(Wc.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),r=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,a);break e}let t=s&&s.skip?a:this.readStyles(e,a);t&&this.addAll(e,t),r&&this.sync(i),this.needsBlock=n}else{let r=this.readStyles(e,a);r&&this.addElementByRule(e,s,r,!1===s.consuming?t:void 0)}this.localPreserveWS=n}leafFallback(e,a){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),a)}ignoreFallback(e,a){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),a)}readStyles(e,a){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],i=r.getPropertyValue(n);if(i)for(let e;;){let r=this.parser.matchStyle(n,i,this,e);if(!r)break;if(r.ignore)return null;if(a=r.clearMark?a.filter((e=>!r.clearMark(e))):a.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;e=r}}return a}addElementByRule(e,a,r,n){let i,t;if(a.node)if(t=this.parser.schema.nodes[a.node],t.isLeaf)this.insertNode(t.create(a.attrs),r)||this.leafFallback(e,r);else{let e=this.enter(t,a.attrs||null,r,a.preserveWhitespace);e&&(i=!0,r=e)}else{let e=this.parser.schema.marks[a.mark];r=r.concat(e.create(a.attrs))}let o=this.top;if(t&&t.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(a.getContent)this.findInside(e),a.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,r)));else{let n=e;"string"==typeof a.contentElement?n=e.querySelector(a.contentElement):"function"==typeof a.contentElement?n=a.contentElement(e):a.contentElement&&(n=a.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}i&&this.sync(o)&&this.open--}addAll(e,a,r,n){let i=r||0;for(let t=r?e.childNodes[r]:e.firstChild,o=null==n?null:e.childNodes[n];t!=o;t=t.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(t,a);this.findAtPoint(e,i)}findPlace(e,a){let r,n;for(let a=this.open;a>=0;a--){let i=this.nodes[a],t=i.findWrapping(e);if(t&&(!r||r.length>t.length)&&(r=t,n=i,!t.length))break;if(i.solid)break}if(!r)return null;this.sync(n);for(let e=0;e<r.length;e++)a=this.enterInner(r[e],null,a,!1);return a}insertNode(e,a){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(a=this.enterInner(e,null,a))}let r=this.findPlace(e,a);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let n=nc.none;for(let i of r.concat(e.marks))(a.type?a.type.allowsMarkType(i.type):Qc(i.type,e.type))&&(n=i.addToSet(n));return a.content.push(e.mark(n)),!0}return!1}enter(e,a,r,n){let i=this.findPlace(e.create(a),r);return i&&(i=this.enterInner(e,a,r,!0,n)),i}enterInner(e,a,r,n=!1,i){this.closeExtra();let t=this.top;t.match=t.match&&t.match.matchType(e);let o=Kc(e,i,t.options);4&t.options&&0==t.content.length&&(o|=4);let s=nc.none;return r=r.filter((a=>!(t.type?t.type.allowsMarkType(a.type):Qc(a.type,e))||(s=a.addToSet(s),!1))),this.nodes.push(new Zc(e,a,s,n,null,o)),this.open++,r}closeExtra(e=!1){let a=this.nodes.length-1;if(a>this.open){for(;a>this.open;a--)this.nodes[a-1].content.push(this.nodes[a].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 a=this.open;a>=0;a--){if(this.nodes[a]==e)return this.open=a,!0;this.localPreserveWS&&(this.nodes[a].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let a=this.open;a>=0;a--){let r=this.nodes[a].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;a&&e++}return e}findAtPoint(e,a){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==a&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let a=0;a<this.find.length;a++)null==this.find[a].pos&&1==e.nodeType&&e.contains(this.find[a].node)&&(this.find[a].pos=this.currentPos)}findAround(e,a,r){if(e!=a&&this.find)for(let n=0;n<this.find.length;n++)if(null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)){a.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}}findInText(e){if(this.find)for(let a=0;a<this.find.length;a++)this.find[a].node==e&&(this.find[a].pos=this.currentPos-(e.nodeValue.length-this.find[a].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let a=e.split("/"),r=this.options.context,n=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(n?0:1),t=(e,o)=>{for(;e>=0;e--){let s=a[e];if(""==s){if(e==a.length-1||0==e)continue;for(;o>=i;o--)if(t(e-1,o))return!0;return!1}{let e=o>0||0==o&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return t(a.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let a=e.depth;a>=0;a--){let r=e.node(a).contentMatchAt(e.indexAfter(a)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let a=this.parser.schema.nodes[e];if(a.isTextblock&&a.defaultAttrs)return a}}}function Yc(e,a){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,a)}function Xc(e){let a={};for(let r in e)a[r]=e[r];return a}function Qc(e,a){let r=a.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let t=[],o=e=>{t.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:i}=e.edge(r);if(n==a)return!0;if(t.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class ed{constructor(e,a){this.nodes=e,this.marks=a}serializeFragment(e,a={},r){r||(r=rd(a).createDocumentFragment());let n=r,i=[];return e.forEach((e=>{if(i.length||e.marks.length){let r=0,t=0;for(;r<i.length&&t<e.marks.length;){let a=e.marks[t];if(this.marks[a.type.name]){if(!a.eq(i[r][0])||!1===a.type.spec.spanning)break;r++,t++}else t++}for(;r<i.length;)n=i.pop()[1];for(;t<e.marks.length;){let r=e.marks[t++],o=this.serializeMark(r,e.isInline,a);o&&(i.push([r,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(e,a))})),r}serializeNodeInner(e,a){let{dom:r,contentDOM:n}=td(rd(a),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,a,n)}return r}serializeNode(e,a={}){let r=this.serializeNodeInner(e,a);for(let n=e.marks.length-1;n>=0;n--){let i=this.serializeMark(e.marks[n],e.isInline,a);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,a,r={}){let n=this.marks[e.type.name];return n&&td(rd(r),n(e,a),null,e.attrs)}static renderSpec(e,a,r=null,n){return td(e,a,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ed(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let a=ad(e.nodes);return a.text||(a.text=e=>e.text),a}static marksFromSchema(e){return ad(e.marks)}}function ad(e){let a={};for(let r in e){let n=e[r].spec.toDOM;n&&(a[r]=n)}return a}function rd(e){return e.document||window.document}const nd=new WeakMap;function id(e){let a=nd.get(e);return void 0===a&&nd.set(e,a=function(e){let a=null;function r(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])a||(a=[]),a.push(e);else for(let a=0;a<e.length;a++)r(e[a]);else for(let a in e)r(e[a])}return r(e),a}(e)),a}function td(e,a,r,n){if("string"==typeof a)return{dom:e.createTextNode(a)};if(null!=a.nodeType)return{dom:a};if(a.dom&&null!=a.dom.nodeType)return a;let i,t=a[0];if("string"!=typeof t)throw new RangeError("Invalid array passed to renderSpec");if(n&&(i=id(n))&&i.indexOf(a)>-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 o,s=t.indexOf(" ");s>0&&(r=t.slice(0,s),t=t.slice(s+1));let l=r?e.createElementNS(r,t):e.createElement(t),c=a[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let a=e.indexOf(" ");a>0?l.setAttributeNS(e.slice(0,a),e.slice(a+1),c[e]):l.setAttribute(e,c[e])}}for(let i=d;i<a.length;i++){let t=a[i];if(0===t){if(i<a.length-1||i>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:a,contentDOM:i}=td(e,t,r,n);if(l.appendChild(a),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:l,contentDOM:o}}const od=Math.pow(2,16);function sd(e,a){return e+a*od}function ld(e){return 65535&e}class cd{constructor(e,a,r){this.pos=e,this.delInfo=a,this.recover=r}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 dd{constructor(e,a=!1){if(this.ranges=e,this.inverted=a,!e.length&&dd.empty)return dd.empty}recover(e){let a=0,r=ld(e);if(!this.inverted)for(let e=0;e<r;e++)a+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+a+function(e){return(e-(65535&e))/od}(e)}mapResult(e,a=1){return this._map(e,a,!1)}map(e,a=1){return this._map(e,a,!0)}_map(e,a,r){let n=0,i=this.inverted?2:1,t=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[o+i],c=this.ranges[o+t],d=s+l;if(e<=d){let i=s+n+((l?e==s?-1:e==d?1:a:a)<0?0:c);if(r)return i;let t=e==(a<0?s:d)?null:sd(o/3,e-s),u=e==s?2:e==d?1:4;return(a<0?e!=s:e!=d)&&(u|=8),new cd(i,u,t)}n+=c-l}return r?e+n:new cd(e+n,0,null)}touches(e,a){let r=0,n=ld(a),i=this.inverted?2:1,t=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let o=this.ranges[a]-(this.inverted?r:0);if(o>e)break;let s=this.ranges[a+i];if(e<=o+s&&a==3*n)return!0;r+=this.ranges[a+t]-s}return!1}forEach(e){let a=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let t=this.ranges[n],o=t-(this.inverted?i:0),s=t+(this.inverted?0:i),l=this.ranges[n+a],c=this.ranges[n+r];e(o,o+l,s,s+c),i+=c-l}}invert(){return new dd(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?dd.empty:new dd(e<0?[0,-e,0]:[0,0,e])}}dd.empty=new dd([]);class ud{constructor(e=[],a,r=0,n=e.length){this.maps=e,this.mirror=a,this.from=r,this.to=n}slice(e=0,a=this.maps.length){return new ud(this.maps,this.mirror,e,a)}copy(){return new ud(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,a){this.to=this.maps.push(e),null!=a&&this.setMirror(this.maps.length-1,a)}appendMapping(e){for(let a=0,r=this.maps.length;a<e.maps.length;a++){let n=e.getMirror(a);this.appendMap(e.maps[a],null!=n&&n<a?r+n:void 0)}}getMirror(e){if(this.mirror)for(let a=0;a<this.mirror.length;a++)if(this.mirror[a]==e)return this.mirror[a+(a%2?-1:1)]}setMirror(e,a){this.mirror||(this.mirror=[]),this.mirror.push(e,a)}appendMappingInverted(e){for(let a=e.maps.length-1,r=this.maps.length+e.maps.length;a>=0;a--){let n=e.getMirror(a);this.appendMap(e.maps[a].invert(),null!=n&&n>a?r-n-1:void 0)}}invert(){let e=new ud;return e.appendMappingInverted(this),e}map(e,a=1){if(this.mirror)return this._map(e,a,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,a);return e}mapResult(e,a=1){return this._map(e,a,!1)}_map(e,a,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this.maps[r].mapResult(e,a);if(null!=i.recover){let a=this.getMirror(r);if(null!=a&&a>r&&a<this.to){r=a,e=this.maps[a].recover(i.recover);continue}}n|=i.delInfo,e=i.pos}return r?e:new cd(e,n,null)}}const hd=Object.create(null);class md{getMap(){return dd.empty}merge(e){return null}static fromJSON(e,a){if(!a||!a.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=hd[a.stepType];if(!r)throw new RangeError(`No step type ${a.stepType} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in hd)throw new RangeError("Duplicate use of step JSON ID "+e);return hd[e]=a,a.prototype.jsonID=e,a}}class gd{constructor(e,a){this.doc=e,this.failed=a}static ok(e){return new gd(e,null)}static fail(e){return new gd(null,e)}static fromReplace(e,a,r,n){try{return gd.ok(e.replace(a,r,n))}catch(e){if(e instanceof ic)return gd.fail(e.message);throw e}}}function pd(e,a,r){let n=[];for(let i=0;i<e.childCount;i++){let t=e.child(i);t.content.size&&(t=t.copy(pd(t.content,a,t))),t.isInline&&(t=a(t,r,i)),n.push(t)}return Ql.fromArray(n)}class bd extends md{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.node(r.sharedDepth(this.to)),i=new tc(pd(a.content,((e,a)=>e.isAtom&&a.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),n),a.openStart,a.openEnd);return gd.fromReplace(e,this.from,this.to,i)}invert(){return new fd(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new bd(a.pos,r.pos,this.mark)}merge(e){return e instanceof bd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bd(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,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new bd(a.from,a.to,e.markFromJSON(a.mark))}}md.jsonID("addMark",bd);class fd extends md{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=new tc(pd(a.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),a.openStart,a.openEnd);return gd.fromReplace(e,this.from,this.to,r)}invert(){return new bd(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new fd(a.pos,r.pos,this.mark)}merge(e){return e instanceof fd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fd(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,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fd(a.from,a.to,e.markFromJSON(a.mark))}}md.jsonID("removeMark",fd);class kd extends md{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return gd.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.addToSet(a.marks));return gd.fromReplace(e,this.pos,this.pos+1,new tc(Ql.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);if(a){let e=this.mark.addToSet(a.marks);if(e.length==a.marks.length){for(let r=0;r<a.marks.length;r++)if(!a.marks[r].isInSet(e))return new kd(this.pos,a.marks[r]);return new kd(this.pos,this.mark)}}return new yd(this.pos,this.mark)}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new kd(a.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new kd(a.pos,e.markFromJSON(a.mark))}}md.jsonID("addNodeMark",kd);class yd extends md{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return gd.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.removeFromSet(a.marks));return gd.fromReplace(e,this.pos,this.pos+1,new tc(Ql.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);return a&&this.mark.isInSet(a.marks)?new kd(this.pos,this.mark):this}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new yd(a.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yd(a.pos,e.markFromJSON(a.mark))}}md.jsonID("removeNodeMark",yd);class vd extends md{constructor(e,a,r,n=!1){super(),this.from=e,this.to=a,this.slice=r,this.structure=n}apply(e){return this.structure&&zd(e,this.from,this.to)?gd.fail("Structure replace would overwrite content"):gd.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dd([this.from,this.to-this.from,this.slice.size])}invert(e){return new vd(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deletedAcross&&r.deletedAcross?null:new vd(a.pos,Math.max(a.pos,r.pos),this.slice)}merge(e){if(!(e instanceof vd)||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 a=this.slice.size+e.slice.size==0?tc.empty:new tc(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new vd(e.from,this.to,a,this.structure)}}{let a=this.slice.size+e.slice.size==0?tc.empty:new tc(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new vd(this.from,this.to+(e.to-e.from),a,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,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new vd(a.from,a.to,tc.fromJSON(e,a.slice),!!a.structure)}}md.jsonID("replace",vd);class wd extends md{constructor(e,a,r,n,i,t,o=!1){super(),this.from=e,this.to=a,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=t,this.structure=o}apply(e){if(this.structure&&(zd(e,this.from,this.gapFrom)||zd(e,this.gapTo,this.to)))return gd.fail("Structure gap-replace would overwrite content");let a=e.slice(this.gapFrom,this.gapTo);if(a.openStart||a.openEnd)return gd.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,a.content);return r?gd.fromReplace(e,this.from,this.to,r):gd.fail("Content does not fit in gap")}getMap(){return new dd([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let a=this.gapTo-this.gapFrom;return new wd(this.from,this.from+this.slice.size+a,this.from+this.insert,this.from+this.insert+a,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),n=this.from==this.gapFrom?a.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return a.deletedAcross&&r.deletedAcross||n<a.pos||i>r.pos?null:new wd(a.pos,r.pos,n,i,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,a){if("number"!=typeof a.from||"number"!=typeof a.to||"number"!=typeof a.gapFrom||"number"!=typeof a.gapTo||"number"!=typeof a.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new wd(a.from,a.to,a.gapFrom,a.gapTo,tc.fromJSON(e,a.slice),a.insert,!!a.structure)}}function zd(e,a,r){let n=e.resolve(a),i=r-a,t=n.depth;for(;i>0&&t>0&&n.indexAfter(t)==n.node(t).childCount;)t--,i--;if(i>0){let e=n.node(t).maybeChild(n.indexAfter(t));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function jd(e,a,r,n=r.contentMatch,i=!0){let t=e.doc.nodeAt(a),o=[],s=a+1;for(let a=0;a<t.childCount;a++){let l=t.child(a),c=s+l.nodeSize,d=n.matchType(l.type);if(d){n=d;for(let a=0;a<l.marks.length;a++)r.allowsMarkType(l.marks[a].type)||e.step(new fd(s,c,l.marks[a]));if(i&&l.isText&&"pre"!=r.whitespace){let e,a,n=/\r?\n|\r/g;for(;e=n.exec(l.text);)a||(a=new tc(Ql.from(r.schema.text(" ",r.allowedMarks(l.marks))),0,0)),o.push(new vd(s+e.index,s+e.index+e[0].length,a))}}else o.push(new vd(s,c,tc.empty));s=c}if(!n.validEnd){let a=n.fillBefore(Ql.empty,!0);e.replace(s,s,new tc(a,0,0))}for(let a=o.length-1;a>=0;a--)e.step(o[a])}function xd(e,a,r){return(0==a||e.canReplace(a,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function $d(e){let a=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let n=e.$from.node(r),i=e.$from.index(r),t=e.$to.indexAfter(r);if(r<e.depth&&n.canReplace(i,t,a))return r;if(0==r||n.type.spec.isolating||!xd(n,i,t))break}return null}function qd(e,a,r=null,n=e){let i=function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.contentMatchAt(n).findWrapping(a);if(!t)return null;let o=t.length?t[0]:a;return r.canReplaceWith(n,i,o)?t:null}(e,a),t=i&&function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.child(n),o=a.contentMatch.findWrapping(t.type);if(!o)return null;let s=(o.length?o[o.length-1]:a).contentMatch;for(let e=n;s&&e<i;e++)s=s.matchType(r.child(e).type);return s&&s.validEnd?o:null}(n,a);return t?i.map(Cd).concat({type:a,attrs:r}).concat(t.map(Cd)):null}function Cd(e){return{type:e,attrs:null}}function Sd(e,a,r,n){a.forEach(((i,t)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(n).map(r+1+t+o.index);e.replaceWith(i,i+1,a.type.schema.linebreakReplacement.create())}}}))}function Od(e,a,r,n){a.forEach(((i,t)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+t);e.replaceWith(i,i+1,a.type.schema.text("\n"))}}))}function Ed(e,a,r=1,n){let i=e.resolve(a),t=i.depth-r,o=n&&n[n.length-1]||i.parent;if(t<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,a=r-2;e>t;e--,a--){let r=i.node(e),t=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(t,r.childCount),s=n&&n[a+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let l=n&&n[a]||r;if(!r.canReplace(t+1,r.childCount)||!l.type.validContent(o))return!1}let s=i.indexAfter(t),l=n&&n[0];return i.node(t).canReplaceWith(s,s,l?l.type:i.node(t+1).type)}function Md(e,a){let r=e.resolve(a),n=r.index();return _d(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function _d(e,a){return!(!e||!a||e.isLeaf||!function(e,a){a.content.size||e.type.compatibleContent(a.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<a.childCount;i++){let t=a.child(i),o=t.type==n?e.type.schema.nodes.text:t.type;if(r=r.matchType(o),!r)return!1;if(!e.type.allowsMarks(t.marks))return!1}return r.validEnd}(e,a))}function Ad(e,a,r=-1){let n=e.resolve(a);for(let e=n.depth;;e--){let i,t,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,t=n.nodeAfter):r>0?(i=n.node(e+1),o++,t=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),t=n.node(e+1)),i&&!i.isTextblock&&_d(i,t)&&n.node(e).canReplace(o,o+1))return a;if(0==e)break;a=r<0?n.before(e):n.after(e)}}function Dd(e,a,r){let n=e.resolve(a);if(!r.content.size)return a;let i=r.content;for(let e=0;e<r.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==r.openStart&&r.size?2:1);e++)for(let a=n.depth;a>=0;a--){let r=a==n.depth?0:n.pos<=(n.start(a+1)+n.end(a+1))/2?-1:1,t=n.index(a)+(r>0?1:0),o=n.node(a),s=!1;if(1==e)s=o.canReplace(t,t,i);else{let e=o.contentMatchAt(t).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(t,t,e[0])}if(s)return 0==r?n.pos:r<0?n.before(a+1):n.after(a+1)}return null}function Td(e,a,r=a,n=tc.empty){if(a==r&&!n.size)return null;let i=e.resolve(a),t=e.resolve(r);return Nd(i,t,n)?new vd(a,r,n):new Id(i,t,n).fit()}function Nd(e,a,r){return!r.openStart&&!r.openEnd&&e.start()==a.start()&&e.parent.canReplace(e.index(),a.index(),r.content)}md.jsonID("replaceAround",wd);class Id{constructor(e,a,r){this.$from=e,this.$to=a,this.unplaced=r,this.frontier=[],this.placed=Ql.empty;for(let a=0;a<=e.depth;a++){let r=e.node(a);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Ql.from(e.node(a).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(),a=this.placed.size-this.depth-this.$from.depth,r=this.$from,n=this.close(e<0?this.$to:r.doc.resolve(e));if(!n)return null;let i=this.placed,t=r.depth,o=n.depth;for(;t&&o&&1==i.childCount;)i=i.firstChild.content,t--,o--;let s=new tc(i,t,o);return e>-1?new wd(r.pos,e,this.$to.pos,this.$to.end(),s,a):s.size||r.pos!=this.$to.pos?new vd(r.pos,n.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let a=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<e;r++){let i=a.firstChild;if(a.childCount>1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}a=i.content}for(let a=1;a<=2;a++)for(let r=1==a?e:this.unplaced.openStart;r>=0;r--){let e,n=null;r?(n=Rd(this.unplaced.content,r-1).firstChild,e=n.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let t,{type:o,match:s}=this.frontier[e],l=null;if(1==a&&(i?s.matchType(i.type)||(l=s.fillBefore(Ql.from(i),!1)):n&&o.compatibleContent(n.type)))return{sliceDepth:r,frontierDepth:e,parent:n,inject:l};if(2==a&&i&&(t=s.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:e,parent:n,wrap:t};if(n&&s.matchType(n.type))break}}}openMore(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Rd(e,a);return!(!n.childCount||n.firstChild.isLeaf)&&(this.unplaced=new tc(e,a+1,Math.max(r,n.size+a>=e.size-r?a+1:0)),!0)}dropNode(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Rd(e,a);if(n.childCount<=1&&a>0){let i=e.size-a<=a+n.size;this.unplaced=new tc(Fd(e,a-1,1),a-1,i?a-1:r)}else this.unplaced=new tc(Fd(e,a,1),a,r)}placeNodes({sliceDepth:e,frontierDepth:a,parent:r,inject:n,wrap:i}){for(;this.depth>a;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let t=this.unplaced,o=r?r.content:t.content,s=t.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[a];if(n){for(let e=0;e<n.childCount;e++)c.push(n.child(e));d=d.matchFragment(n)}let h=o.size+e-(t.content.size-t.openEnd);for(;l<o.childCount;){let e=o.child(l),a=d.matchType(e.type);if(!a)break;l++,(l>1||0==s||e.content.size)&&(d=a,c.push(Ld(e.mark(u.allowedMarks(e.marks)),1==l?s:0,l==o.childCount?h:-1)))}let m=l==o.childCount;m||(h=-1),this.placed=Pd(this.placed,a,Ql.from(c)),this.frontier[a].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,a=o;e<h;e++){let e=a.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),a=e.content}this.unplaced=m?0==e?tc.empty:new tc(Fd(t.content,e-1,1),e-1,h<0?t.openEnd:e-1):new tc(Fd(t.content,e,l),t.openStart,t.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,a=this.frontier[this.depth];if(!a.type.isTextblock||!Bd(this.$to,this.$to.depth,a.type,a.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){e:for(let a=Math.min(this.depth,e.depth);a>=0;a--){let{match:r,type:n}=this.frontier[a],i=a<e.depth&&e.end(a+1)==e.pos+(e.depth-(a+1)),t=Bd(e,a,n,r,i);if(t){for(let r=a-1;r>=0;r--){let{match:a,type:n}=this.frontier[r],i=Bd(e,r,n,a,!0);if(!i||i.childCount)continue e}return{depth:a,fit:t,move:i?e.doc.resolve(e.after(a+1)):e}}}}close(e){let a=this.findCloseLevel(e);if(!a)return null;for(;this.depth>a.depth;)this.closeFrontierNode();a.fit.childCount&&(this.placed=Pd(this.placed,a.depth,a.fit)),e=a.move;for(let r=a.depth+1;r<=e.depth;r++){let a=e.node(r),n=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,n)}return e}openFrontierNode(e,a=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=Pd(this.placed,this.depth,Ql.from(e.create(a,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Ql.empty,!0);e.childCount&&(this.placed=Pd(this.placed,this.frontier.length,e))}}function Fd(e,a,r){return 0==a?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Fd(e.firstChild.content,a-1,r)))}function Pd(e,a,r){return 0==a?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(Pd(e.lastChild.content,a-1,r)))}function Rd(e,a){for(let r=0;r<a;r++)e=e.firstChild.content;return e}function Ld(e,a,r){if(a<=0)return e;let n=e.content;return a>1&&(n=n.replaceChild(0,Ld(n.firstChild,a-1,1==n.childCount?r-1:0))),a>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(Ql.empty,!0)))),e.copy(n)}function Bd(e,a,r,n,i){let t=e.node(a),o=i?e.indexAfter(a):e.index(a);if(o==t.childCount&&!r.compatibleContent(t.type))return null;let s=n.fillBefore(t.content,!0,o);return s&&!function(e,a,r){for(let n=r;n<a.childCount;n++)if(!e.allowsMarks(a.child(n).marks))return!0;return!1}(r,t.content,o)?s:null}function Vd(e,a,r,n,i){if(a<r){let i=e.firstChild;e=e.replaceChild(0,i.copy(Vd(i.content,a+1,r,n,i)))}if(a>n){let a=i.contentMatchAt(0),r=a.fillBefore(e).append(e);e=r.append(a.matchFragment(r).fillBefore(Ql.empty,!0))}return e}function Hd(e,a){let r=[];for(let n=Math.min(e.depth,a.depth);n>=0;n--){let i=e.start(n);if(i<e.pos-(e.depth-n)||a.end(n)>a.pos+(a.depth-n)||e.node(n).type.spec.isolating||a.node(n).type.spec.isolating)break;(i==a.start(n)||n==e.depth&&n==a.depth&&e.parent.inlineContent&&a.parent.inlineContent&&n&&a.start(n-1)==i-1)&&r.push(n)}return r}class Wd extends md{constructor(e,a,r){super(),this.pos=e,this.attr=a,this.value=r}apply(e){let a=e.nodeAt(this.pos);if(!a)return gd.fail("No node at attribute step's position");let r=Object.create(null);for(let e in a.attrs)r[e]=a.attrs[e];r[this.attr]=this.value;let n=a.type.create(r,null,a.marks);return gd.fromReplace(e,this.pos,this.pos+1,new tc(Ql.from(n),0,a.isLeaf?0:1))}getMap(){return dd.empty}invert(e){return new Wd(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new Wd(a.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,a){if("number"!=typeof a.pos||"string"!=typeof a.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wd(a.pos,a.attr,a.value)}}md.jsonID("attr",Wd);class Ud extends md{constructor(e,a){super(),this.attr=e,this.value=a}apply(e){let a=Object.create(null);for(let r in e.attrs)a[r]=e.attrs[r];a[this.attr]=this.value;let r=e.type.create(a,e.content,e.marks);return gd.ok(r)}getMap(){return dd.empty}invert(e){return new Ud(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,a){if("string"!=typeof a.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ud(a.attr,a.value)}}md.jsonID("docAttr",Ud);let Gd=class extends Error{};Gd=function e(a){let r=Error.call(this,a);return r.__proto__=e.prototype,r},(Gd.prototype=Object.create(Error.prototype)).constructor=Gd,Gd.prototype.name="TransformError";class Kd{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ud}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let a=this.maybeStep(e);if(a.failed)throw new Gd(a.failed);return this}maybeStep(e){let a=e.apply(this.doc);return a.failed||this.addStep(e,a.doc),a}get docChanged(){return this.steps.length>0}addStep(e,a){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=a}replace(e,a=e,r=tc.empty){let n=Td(this.doc,e,a,r);return n&&this.step(n),this}replaceWith(e,a,r){return this.replace(e,a,new tc(Ql.from(r),0,0))}delete(e,a){return this.replace(e,a,tc.empty)}insert(e,a){return this.replaceWith(e,e,a)}replaceRange(e,a,r){return function(e,a,r,n){if(!n.size)return e.deleteRange(a,r);let i=e.doc.resolve(a),t=e.doc.resolve(r);if(Nd(i,t,n))return e.step(new vd(a,r,n));let o=Hd(i,e.doc.resolve(r));0==o[o.length-1]&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,a=i.pos-1;e>0;e--,a--){let r=i.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==a&&o.splice(1,0,-e)}let l=o.indexOf(s),c=[],d=n.openStart;for(let e=n.content,a=0;;a++){let r=e.firstChild;if(c.push(r),a==n.openStart)break;e=r.content}for(let e=d-1;e>=0;e--){let a=c[e],r=(u=a.type).spec.defining||u.spec.definingForContent;if(r&&!a.sameMarkup(i.node(Math.abs(s)-1)))d=e;else if(r||!a.type.isTextblock)break}var u;for(let a=n.openStart;a>=0;a--){let s=(a+d+1)%(n.openStart+1),u=c[s];if(u)for(let a=0;a<o.length;a++){let c=o[(a+l)%o.length],d=!0;c<0&&(d=!1,c=-c);let h=i.node(c-1),m=i.index(c-1);if(h.canReplaceWith(m,m,u.type,u.marks))return e.replace(i.before(c),d?t.after(c):r,new tc(Vd(n.content,0,n.openStart,s),s,n.openEnd))}}let h=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(a,r,n),!(e.steps.length>h));s--){let e=o[s];e<0||(a=i.before(e),r=t.after(e))}}(this,e,a,r),this}replaceRangeWith(e,a,r){return function(e,a,r,n){if(!n.isInline&&a==r&&e.doc.resolve(a).parent.content.size){let i=function(e,a,r){let n=e.resolve(a);if(n.parent.canReplaceWith(n.index(),n.index(),r))return a;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let a=n.index(e);if(n.node(e).canReplaceWith(a,a,r))return n.before(e+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let a=n.indexAfter(e);if(n.node(e).canReplaceWith(a,a,r))return n.after(e+1);if(a<n.node(e).childCount)return null}return null}(e.doc,a,n.type);null!=i&&(a=r=i)}e.replaceRange(a,r,new tc(Ql.from(n),0,0))}(this,e,a,r),this}deleteRange(e,a){return function(e,a,r){let n=e.doc.resolve(a),i=e.doc.resolve(r),t=Hd(n,i);for(let a=0;a<t.length;a++){let r=t[a],o=a==t.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return e.delete(n.start(r),i.end(r));if(r>0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let t=1;t<=n.depth&&t<=i.depth;t++)if(a-n.start(t)==n.depth-t&&r>n.end(t)&&i.end(t)-r!=i.depth-t&&n.start(t-1)==i.start(t-1)&&n.node(t-1).canReplace(n.index(t-1),i.index(t-1)))return e.delete(n.before(t),r);e.delete(a,r)}(this,e,a),this}lift(e,a){return function(e,a,r){let{$from:n,$to:i,depth:t}=a,o=n.before(t+1),s=i.after(t+1),l=o,c=s,d=Ql.empty,u=0;for(let e=t,a=!1;e>r;e--)a||n.index(e)>0?(a=!0,d=Ql.from(n.node(e).copy(d)),u++):l--;let h=Ql.empty,m=0;for(let e=t,a=!1;e>r;e--)a||i.after(e+1)<i.end(e)?(a=!0,h=Ql.from(i.node(e).copy(h)),m++):c++;e.step(new wd(l,c,o,s,new tc(d.append(h),u,m),d.size-u,!0))}(this,e,a),this}join(e,a=1){return function(e,a,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,t=e.doc.resolve(a-r),o=t.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,a=!!o.contentMatch.matchType(i);e&&!a?n=!1:!e&&a&&(n=!0)}let s=e.steps.length;if(!1===n){let n=e.doc.resolve(a+r);Od(e,n.node(),n.before(),s)}o.inlineContent&&jd(e,a+r-1,o,t.node().contentMatchAt(t.index()),null==n);let l=e.mapping.slice(s),c=l.map(a-r);if(e.step(new vd(c,l.map(a+r,-1),tc.empty,!0)),!0===n){let a=e.doc.resolve(c);Sd(e,a.node(),a.before(),e.steps.length)}}(this,e,a),this}wrap(e,a){return function(e,a,r){let n=Ql.empty;for(let e=r.length-1;e>=0;e--){if(n.size){let a=r[e].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Ql.from(r[e].type.create(r[e].attrs,n))}let i=a.start,t=a.end;e.step(new wd(i,t,i,t,new tc(n,0,0),r.length,!0))}(this,e,a),this}setBlockType(e,a=e,r,n=null){return function(e,a,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let t=e.steps.length;e.doc.nodesBetween(a,r,((a,r)=>{let o="function"==typeof i?i(a):i;if(a.isTextblock&&!a.hasMarkup(n,o)&&function(e,a,r){let n=e.resolve(a),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}(e.doc,e.mapping.slice(t).map(r),n)){let i=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,a=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!a?i=!1:!e&&a&&(i=!0)}!1===i&&Od(e,a,r,t),jd(e,e.mapping.slice(t).map(r,1),n,void 0,null===i);let s=e.mapping.slice(t),l=s.map(r,1),c=s.map(r+a.nodeSize,1);return e.step(new wd(l,c,l+1,c-1,new tc(Ql.from(n.create(o,null,a.marks)),0,0),1,!0)),!0===i&&Sd(e,a,r,t),!1}}))}(this,e,a,r,n),this}setNodeMarkup(e,a,r=null,n){return function(e,a,r,n,i){let t=e.doc.nodeAt(a);if(!t)throw new RangeError("No node at given position");r||(r=t.type);let o=r.create(n,null,i||t.marks);if(t.isLeaf)return e.replaceWith(a,a+t.nodeSize,o);if(!r.validContent(t.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new wd(a,a+t.nodeSize,a+1,a+t.nodeSize-1,new tc(Ql.from(o),0,0),1,!0))}(this,e,a,r,n),this}setNodeAttribute(e,a,r){return this.step(new Wd(e,a,r)),this}setDocAttribute(e,a){return this.step(new Ud(e,a)),this}addNodeMark(e,a){return this.step(new kd(e,a)),this}removeNodeMark(e,a){if(!(a instanceof nc)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(!(a=a.isInSet(r.marks)))return this}return this.step(new yd(e,a)),this}split(e,a=1,r){return function(e,a,r=1,n){let i=e.doc.resolve(a),t=Ql.empty,o=Ql.empty;for(let e=i.depth,a=i.depth-r,s=r-1;e>a;e--,s--){t=Ql.from(i.node(e).copy(t));let a=n&&n[s];o=Ql.from(a?a.type.create(a.attrs,o):i.node(e).copy(o))}e.step(new vd(a,a,new tc(t.append(o),r,r),!0))}(this,e,a,r),this}addMark(e,a,r){return function(e,a,r,n){let i,t,o=[],s=[];e.doc.nodesBetween(a,r,((e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,a),u=Math.min(l+e.nodeSize,r),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:o.push(i=new fd(c,u,d[e])));t&&t.to==c?t.to=u:s.push(t=new bd(c,u,n))}})),o.forEach((a=>e.step(a))),s.forEach((a=>e.step(a)))}(this,e,a,r),this}removeMark(e,a,r){return function(e,a,r,n){let i=[],t=0;e.doc.nodesBetween(a,r,((e,o)=>{if(!e.isInline)return;t++;let s=null;if(n instanceof Lc){let a,r=e.marks;for(;a=n.isInSet(r);)(s||(s=[])).push(a),r=a.removeFromSet(r)}else n?n.isInSet(e.marks)&&(s=[n]):s=e.marks;if(s&&s.length){let n=Math.min(o+e.nodeSize,r);for(let e=0;e<s.length;e++){let r,l=s[e];for(let e=0;e<i.length;e++){let a=i[e];a.step==t-1&&l.eq(i[e].style)&&(r=a)}r?(r.to=n,r.step=t):i.push({style:l,from:Math.max(o,a),to:n,step:t})}}})),i.forEach((a=>e.step(new fd(a.from,a.to,a.style))))}(this,e,a,r),this}clearIncompatible(e,a,r){return jd(this,e,a,r),this}}const Zd=Object.create(null);class Jd{constructor(e,a,r){this.$anchor=e,this.$head=a,this.ranges=r||[new Yd(e.min(a),e.max(a))]}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 a=0;a<e.length;a++)if(e[a].$from.pos!=e[a].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,a=tc.empty){let r=a.content.lastChild,n=null;for(let e=0;e<a.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,t=this.ranges;for(let o=0;o<t.length;o++){let{$from:s,$to:l}=t[o],c=e.mapping.slice(i);e.replaceRange(c.map(s.pos),c.map(l.pos),o?tc.empty:a),0==o&&su(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,a){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:t,$to:o}=n[i],s=e.mapping.slice(r),l=s.map(t.pos),c=s.map(o.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,a),su(e,r,a.isInline?-1:1))}}static findFrom(e,a,r=!1){let n=e.parent.inlineContent?new eu(e):ou(e.node(0),e.parent,e.pos,e.index(),a,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=a<0?ou(e.node(0),e.node(n),e.before(n+1),e.index(n),a,r):ou(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,a,r);if(i)return i}return null}static near(e,a=1){return this.findFrom(e,a)||this.findFrom(e,-a)||new iu(e.node(0))}static atStart(e){return ou(e,e,0,0,1)||new iu(e)}static atEnd(e){return ou(e,e,e.content.size,e.childCount,-1)||new iu(e)}static fromJSON(e,a){if(!a||!a.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Zd[a.type];if(!r)throw new RangeError(`No selection type ${a.type} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in Zd)throw new RangeError("Duplicate use of selection JSON ID "+e);return Zd[e]=a,a.prototype.jsonID=e,a}getBookmark(){return eu.between(this.$anchor,this.$head).getBookmark()}}Jd.prototype.visible=!0;class Yd{constructor(e,a){this.$from=e,this.$to=a}}let Xd=!1;function Qd(e){Xd||e.parent.inlineContent||(Xd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eu extends Jd{constructor(e,a=e){Qd(e),Qd(a),super(e,a)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,a){let r=e.resolve(a.map(this.head));if(!r.parent.inlineContent)return Jd.near(r);let n=e.resolve(a.map(this.anchor));return new eu(n.parent.inlineContent?n:r,r)}replace(e,a=tc.empty){if(super.replace(e,a),a==tc.empty){let a=this.$from.marksAcross(this.$to);a&&e.ensureMarks(a)}}eq(e){return e instanceof eu&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new au(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,a){if("number"!=typeof a.anchor||"number"!=typeof a.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new eu(e.resolve(a.anchor),e.resolve(a.head))}static create(e,a,r=a){let n=e.resolve(a);return new this(n,r==a?n:e.resolve(r))}static between(e,a,r){let n=e.pos-a.pos;if(r&&!n||(r=n>=0?1:-1),!a.parent.inlineContent){let e=Jd.findFrom(a,r,!0)||Jd.findFrom(a,-r,!0);if(!e)return Jd.near(a,r);a=e.$head}return e.parent.inlineContent||(0==n||(e=(Jd.findFrom(e,-r,!0)||Jd.findFrom(e,r,!0)).$anchor).pos<a.pos!=n<0)&&(e=a),new eu(e,a)}}Jd.jsonID("text",eu);class au{constructor(e,a){this.anchor=e,this.head=a}map(e){return new au(e.map(this.anchor),e.map(this.head))}resolve(e){return eu.between(e.resolve(this.anchor),e.resolve(this.head))}}class ru extends Jd{constructor(e){let a=e.nodeAfter,r=e.node(0).resolve(e.pos+a.nodeSize);super(e,r),this.node=a}map(e,a){let{deleted:r,pos:n}=a.mapResult(this.anchor),i=e.resolve(n);return r?Jd.near(i):new ru(i)}content(){return new tc(Ql.from(this.node),0,0)}eq(e){return e instanceof ru&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new nu(this.anchor)}static fromJSON(e,a){if("number"!=typeof a.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ru(e.resolve(a.anchor))}static create(e,a){return new ru(e.resolve(a))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}ru.prototype.visible=!1,Jd.jsonID("node",ru);class nu{constructor(e){this.anchor=e}map(e){let{deleted:a,pos:r}=e.mapResult(this.anchor);return a?new au(r,r):new nu(r)}resolve(e){let a=e.resolve(this.anchor),r=a.nodeAfter;return r&&ru.isSelectable(r)?new ru(a):Jd.near(a)}}class iu extends Jd{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,a=tc.empty){if(a==tc.empty){e.delete(0,e.doc.content.size);let a=Jd.atStart(e.doc);a.eq(e.selection)||e.setSelection(a)}else super.replace(e,a)}toJSON(){return{type:"all"}}static fromJSON(e){return new iu(e)}map(e){return new iu(e)}eq(e){return e instanceof iu}getBookmark(){return tu}}Jd.jsonID("all",iu);const tu={map(){return this},resolve:e=>new iu(e)};function ou(e,a,r,n,i,t=!1){if(a.inlineContent)return eu.create(e,r);for(let o=n-(i>0?0:1);i>0?o<a.childCount:o>=0;o+=i){let n=a.child(o);if(n.isAtom){if(!t&&ru.isSelectable(n))return ru.create(e,r-(i<0?n.nodeSize:0))}else{let a=ou(e,n,r+i,i<0?n.childCount:0,i,t);if(a)return a}r+=n.nodeSize*i}return null}function su(e,a,r){let n=e.steps.length-1;if(n<a)return;let i,t=e.steps[n];(t instanceof vd||t instanceof wd)&&(e.mapping.maps[n].forEach(((e,a,r,n)=>{null==i&&(i=n)})),e.setSelection(Jd.near(e.doc.resolve(i),r)))}class lu extends Kd{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 nc.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,a){super.addStep(e,a),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,a=!0){let r=this.selection;return a&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||nc.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,a,r){let n=this.doc.type.schema;if(null==a)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=a),r=null==r?a:r,!e)return this.deleteRange(a,r);let i=this.storedMarks;if(!i){let e=this.doc.resolve(a);i=r==a?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(a,r,n.text(e,i)),this.selection.empty||this.setSelection(Jd.near(this.selection.$to)),this}}setMeta(e,a){return this.meta["string"==typeof e?e:e.key]=a,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 cu(e,a){return a&&e?e.bind(a):e}class du{constructor(e,a,r){this.name=e,this.init=cu(a.init,r),this.apply=cu(a.apply,r)}}const uu=[new du("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new du("selection",{init:(e,a)=>e.selection||Jd.atStart(a.doc),apply:e=>e.selection}),new du("storedMarks",{init:e=>e.storedMarks||null,apply:(e,a,r,n)=>n.selection.$cursor?e.storedMarks:null}),new du("scrollToSelection",{init:()=>0,apply:(e,a)=>e.scrolledIntoView?a+1:a})];class hu{constructor(e,a){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=uu.slice(),a&&a.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 du(e.key,e.spec.state,e))}))}}class mu{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,a=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=a){let a=this.config.plugins[r];if(a.spec.filterTransaction&&!a.spec.filterTransaction.call(a,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let a=[e],r=this.applyInner(e),n=null;for(;;){let i=!1;for(let t=0;t<this.config.plugins.length;t++){let o=this.config.plugins[t];if(o.spec.appendTransaction){let s=n?n[t].n:0,l=n?n[t].state:this,c=s<a.length&&o.spec.appendTransaction.call(o,s?a.slice(s):a,l,r);if(c&&r.filterTransaction(c,t)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<t?{state:r,n:a.length}:{state:this,n:0})}a.push(c),r=r.applyInner(c),i=!0}n&&(n[t]={state:r,n:a.length})}}if(!i)return{state:r,transactions:a}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let a=new mu(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];a[i.name]=i.apply(e,this[i.name],this,a)}return a}get tr(){return new lu(this)}static create(e){let a=new hu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new mu(a);for(let n=0;n<a.fields.length;n++)r[a.fields[n].name]=a.fields[n].init(e,r);return r}reconfigure(e){let a=new hu(this.schema,e.plugins),r=a.fields,n=new mu(a);for(let a=0;a<r.length;a++){let i=r[a].name;n[i]=this.hasOwnProperty(i)?this[i]:r[a].init(e,n)}return n}toJSON(e){let a={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(a.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],i=n.spec.state;i&&i.toJSON&&(a[r]=i.toJSON.call(n,this[n.key]))}return a}static fromJSON(e,a,r){if(!a)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let n=new hu(e.schema,e.plugins),i=new mu(n);return n.fields.forEach((n=>{if("doc"==n.name)i.doc=jc.fromJSON(e.schema,a.doc);else if("selection"==n.name)i.selection=Jd.fromJSON(i.doc,a.selection);else if("storedMarks"==n.name)a.storedMarks&&(i.storedMarks=a.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let t in r){let o=r[t],s=o.spec.state;if(o.key==n.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(a,t))return void(i[n.name]=s.fromJSON.call(o,e,a[t],i))}i[n.name]=n.init(e,i)}})),i}}function gu(e,a,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(a):"handleDOMEvents"==n&&(i=gu(i,a,{})),r[n]=i}return r}class pu{constructor(e){this.spec=e,this.props={},e.props&&gu(e.props,this,this.props),this.key=e.key?e.key.key:fu("plugin")}getState(e){return e[this.key]}}const bu=Object.create(null);function fu(e){return e in bu?e+"$"+ ++bu[e]:(bu[e]=0,e+"$")}class ku{constructor(e="key"){this.key=fu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const yu=function(e){for(var a=0;;a++)if(!(e=e.previousSibling))return a},vu=function(e){let a=e.assignedSlot||e.parentNode;return a&&11==a.nodeType?a.host:a};let wu=null;const zu=function(e,a,r){let n=wu||(wu=document.createRange());return n.setEnd(e,null==r?e.nodeValue.length:r),n.setStart(e,a||0),n},ju=function(e,a,r,n){return r&&($u(e,a,r,n,-1)||$u(e,a,r,n,1))},xu=/^(img|br|input|textarea|hr)$/i;function $u(e,a,r,n,i){for(;;){if(e==r&&a==n)return!0;if(a==(i<0?0:qu(e))){let r=e.parentNode;if(!r||1!=r.nodeType||Cu(e)||xu.test(e.nodeName)||"false"==e.contentEditable)return!1;a=yu(e)+(i<0?0:1),e=r}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[a+(i<0?-1:0)]).contentEditable)return!1;a=i<0?qu(e):0}}}function qu(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Cu(e){let a;for(let r=e;r&&!(a=r.pmViewDesc);r=r.parentNode);return a&&a.node&&a.node.isBlock&&(a.dom==e||a.contentDOM==e)}const Su=function(e){return e.focusNode&&ju(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ou(e,a){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=a,r}const Eu="undefined"!=typeof navigator?navigator:null,Mu="undefined"!=typeof document?document:null,_u=Eu&&Eu.userAgent||"",Au=/Edge\/(\d+)/.exec(_u),Du=/MSIE \d/.exec(_u),Tu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_u),Nu=!!(Du||Tu||Au),Iu=Du?document.documentMode:Tu?+Tu[1]:Au?+Au[1]:0,Fu=!Nu&&/gecko\/(\d+)/i.test(_u);Fu&&(/Firefox\/(\d+)/.exec(_u)||[0,0])[1];const Pu=!Nu&&/Chrome\/(\d+)/.exec(_u),Ru=!!Pu,Lu=Pu?+Pu[1]:0,Bu=!Nu&&!!Eu&&/Apple Computer/.test(Eu.vendor),Vu=Bu&&(/Mobile\/\w+/.test(_u)||!!Eu&&Eu.maxTouchPoints>2),Hu=Vu||!!Eu&&/Mac/.test(Eu.platform),Wu=!!Eu&&/Win/.test(Eu.platform),Uu=/Android \d/.test(_u),Gu=!!Mu&&"webkitFontSmoothing"in Mu.documentElement.style,Ku=Gu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Zu(e){let a=e.defaultView&&e.defaultView.visualViewport;return a?{left:0,right:a.width,top:0,bottom:a.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ju(e,a){return"number"==typeof e?e:e[a]}function Yu(e){let a=e.getBoundingClientRect(),r=a.width/e.offsetWidth||1,n=a.height/e.offsetHeight||1;return{left:a.left,right:a.left+e.clientWidth*r,top:a.top,bottom:a.top+e.clientHeight*n}}function Xu(e,a,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,t=e.dom.ownerDocument;for(let o=r||e.dom;o;o=vu(o)){if(1!=o.nodeType)continue;let e=o,r=e==t.body,s=r?Zu(t):Yu(e),l=0,c=0;if(a.top<s.top+Ju(n,"top")?c=-(s.top-a.top+Ju(i,"top")):a.bottom>s.bottom-Ju(n,"bottom")&&(c=a.bottom-a.top>s.bottom-s.top?a.top+Ju(i,"top")-s.top:a.bottom-s.bottom+Ju(i,"bottom")),a.left<s.left+Ju(n,"left")?l=-(s.left-a.left+Ju(i,"left")):a.right>s.right-Ju(n,"right")&&(l=a.right-s.right+Ju(i,"right")),l||c)if(r)t.defaultView.scrollBy(l,c);else{let r=e.scrollLeft,n=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-r,t=e.scrollTop-n;a={left:a.left-i,top:a.top-t,right:a.right-i,bottom:a.bottom-t}}if(r||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Qu(e){let a=[],r=e.ownerDocument;for(let n=e;n&&(a.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=vu(n));return a}function eh(e,a){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:t}=e[r];n.scrollTop!=i+a&&(n.scrollTop=i+a),n.scrollLeft!=t&&(n.scrollLeft=t)}}let ah=null;function rh(e,a){let r,n,i,t,o=2e8,s=0,l=a.top,c=a.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=zu(d).getClientRects()}for(let h=0;h<e.length;h++){let m=e[h];if(m.top<=l&&m.bottom>=c){l=Math.max(m.bottom,l),c=Math.min(m.top,c);let e=m.left>a.left?m.left-a.left:m.right<a.left?a.left-m.right:0;if(e<o){r=d,o=e,n=e&&3==r.nodeType?{left:m.right<a.left?m.right:m.left,top:a.top}:a,1==d.nodeType&&e&&(s=u+(a.left>=(m.left+m.right)/2?1:0));continue}}else m.top>a.top&&!i&&m.left<=a.left&&m.right>=a.left&&(i=d,t={left:Math.max(m.left,Math.min(m.right,a.left)),top:m.top});!r&&(a.left>=m.right&&a.top>=m.top||a.left>=m.left&&a.top>=m.bottom)&&(s=u+1)}}return!r&&i&&(r=i,n=t,o=0),r&&3==r.nodeType?function(e,a){let r=e.nodeValue.length,n=document.createRange();for(let i=0;i<r;i++){n.setEnd(e,i+1),n.setStart(e,i);let r=sh(n,1);if(r.top!=r.bottom&&nh(a,r))return{node:e,offset:i+(a.left>=(r.left+r.right)/2?1:0)}}return{node:e,offset:0}}(r,n):!r||o&&1==r.nodeType?{node:e,offset:s}:rh(r,n)}function nh(e,a){return e.left>=a.left-1&&e.left<=a.right+1&&e.top>=a.top-1&&e.top<=a.bottom+1}function ih(e,a,r){let n=e.childNodes.length;if(n&&r.top<r.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(a.top-r.top)/(r.bottom-r.top))-2)),t=i;;){let r=e.childNodes[t];if(1==r.nodeType){let e=r.getClientRects();for(let n=0;n<e.length;n++){let i=e[n];if(nh(a,i))return ih(r,a,i)}}if((t=(t+1)%n)==i)break}return e}function th(e,a){let r,n=e.dom.ownerDocument,i=0,t=function(e,a,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(a,r);if(n)return{node:n.offsetNode,offset:Math.min(qu(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(a,r);if(n)return{node:n.startContainer,offset:Math.min(qu(n.startContainer),n.startOffset)}}}(n,a.left,a.top);t&&({node:r,offset:i}=t);let o,s=(e.root.elementFromPoint?e.root:n).elementFromPoint(a.left,a.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){let r=e.dom.getBoundingClientRect();if(!nh(a,r))return null;if(s=ih(e.dom,a,r),!s)return null}if(Bu)for(let e=s;r&&e;e=vu(e))e.draggable&&(r=void 0);if(s=function(e,a){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&a.left<e.getBoundingClientRect().left?r:e}(s,a),r){if(Fu&&1==r.nodeType&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e,n=r.childNodes[i];"IMG"==n.nodeName&&(e=n.getBoundingClientRect()).right<=a.left&&e.bottom>a.top&&i++}let n;Gu&&i&&1==r.nodeType&&1==(n=r.childNodes[i-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=a.top&&i--,r==e.dom&&i==r.childNodes.length-1&&1==r.lastChild.nodeType&&a.top>r.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:0!=i&&1==r.nodeType&&"BR"==r.childNodes[i-1].nodeName||(o=function(e,a,r,n){let i=-1;for(let r=a,t=!1;r!=e.dom;){let a,o=e.docView.nearestDesc(r,!0);if(!o)return null;if(1==o.dom.nodeType&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((a=o.dom.getBoundingClientRect()).width||a.height)&&(o.node.isBlock&&o.parent&&(!t&&a.left>n.left||a.top>n.top?i=o.posBefore:(!t&&a.right<n.left||a.bottom<n.top)&&(i=o.posAfter),t=!0),!o.contentDOM&&i<0&&!o.node.isText))return(o.node.isBlock?n.top<(a.top+a.bottom)/2:n.left<(a.left+a.right)/2)?o.posBefore:o.posAfter;r=o.dom.parentNode}return i>-1?i:e.docView.posFromDOM(a,r,-1)}(e,r,i,a))}null==o&&(o=function(e,a,r){let{node:n,offset:i}=rh(a,r),t=-1;if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();t=e.left!=e.right&&r.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,t)}(e,s,a));let l=e.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function oh(e){return e.top<e.bottom||e.left<e.right}function sh(e,a){let r=e.getClientRects();if(r.length){let e=r[a<0?0:r.length-1];if(oh(e))return e}return Array.prototype.find.call(r,oh)||e.getBoundingClientRect()}const lh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ch(e,a,r){let{node:n,offset:i,atom:t}=e.docView.domFromPos(a,r<0?-1:1),o=Gu||Fu;if(3==n.nodeType){if(!o||!lh.test(n.nodeValue)&&(r<0?i:i!=n.nodeValue.length)){let e=i,a=i,t=r<0?1:-1;return r<0&&!i?(a++,t=-1):r>=0&&i==n.nodeValue.length?(e--,t=1):r<0?e--:a++,dh(sh(zu(n,e,a),t),t<0)}{let e=sh(zu(n,i,i),r);if(Fu&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let a=sh(zu(n,i-1,i-1),-1);if(a.top==e.top){let r=sh(zu(n,i,i+1),-1);if(r.top!=e.top)return dh(r,r.left<a.left)}}return e}}if(!e.state.doc.resolve(a-(t||0)).parent.inlineContent){if(null==t&&i&&(r<0||i==qu(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return uh(e.getBoundingClientRect(),!1)}if(null==t&&i<qu(n)){let e=n.childNodes[i];if(1==e.nodeType)return uh(e.getBoundingClientRect(),!0)}return uh(n.getBoundingClientRect(),r>=0)}if(null==t&&i&&(r<0||i==qu(n))){let e=n.childNodes[i-1],a=3==e.nodeType?zu(e,qu(e)-(o?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(a)return dh(sh(a,1),!1)}if(null==t&&i<qu(n)){let e=n.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let a=e?3==e.nodeType?zu(e,0,o?0:1):1==e.nodeType?e:null:null;if(a)return dh(sh(a,-1),!0)}return dh(sh(3==n.nodeType?zu(n):n,-r),r>=0)}function dh(e,a){if(0==e.width)return e;let r=a?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function uh(e,a){if(0==e.height)return e;let r=a?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function hh(e,a,r){let n=e.state,i=e.root.activeElement;n!=a&&e.updateState(a),i!=e.dom&&e.focus();try{return r()}finally{n!=a&&e.updateState(n),i!=e.dom&&i&&i.focus()}}const mh=/[\u0590-\u08ac]/;let gh=null,ph=null,bh=!1;function fh(e,a,r){return gh==a&&ph==r?bh:(gh=a,ph=r,bh="up"==r||"down"==r?function(e,a,r){let n=a.selection,i="up"==r?n.$from:n.$to;return hh(e,a,(()=>{let{node:a}=e.docView.domFromPos(i.pos,"up"==r?-1:1);for(;;){let r=e.docView.nearestDesc(a,!0);if(!r)break;if(r.node.isBlock){a=r.contentDOM||r.dom;break}a=r.dom.parentNode}let n=ch(e,i.pos,1);for(let e=a.firstChild;e;e=e.nextSibling){let a;if(1==e.nodeType)a=e.getClientRects();else{if(3!=e.nodeType)continue;a=zu(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<a.length;e++){let i=a[e];if(i.bottom>i.top+1&&("up"==r?n.top-i.top>2*(i.bottom-n.top):i.bottom-n.bottom>2*(n.bottom-i.top)))return!1}}return!0}))}(e,a,r):function(e,a,r){let{$head:n}=a.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,t=!i,o=i==n.parent.content.size,s=e.domSelection();return s?mh.test(n.parent.textContent)&&s.modify?hh(e,a,(()=>{let{focusNode:a,focusOffset:i,anchorNode:t,anchorOffset:o}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",r,"character");let c=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||a==d&&i==u;try{s.collapse(t,o),a&&(a!=t||i!=o)&&s.extend&&s.extend(a,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h})):"left"==r||"backward"==r?t:o:n.pos==n.start()||n.pos==n.end()}(e,a,r))}class kh{constructor(e,a,r,n){this.parent=e,this.children=a,this.dom=r,this.contentDOM=n,this.dirty=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,a,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let a=0;a<this.children.length;a++)e+=this.children[a].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 a=0,r=this.posAtStart;;a++){let n=this.children[a];if(n==e)return r;r+=n.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,a,r){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(r<0){let r,n;if(e==this.contentDOM)r=e.childNodes[a-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}{let r,n;if(e==this.contentDOM)r=e.childNodes[a];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}}let n;if(e==this.dom&&this.contentDOM)n=a>yu(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==a)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!1;break}if(a.previousSibling)break}if(null==n&&a==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!0;break}if(a.nextSibling)break}}return(null==n?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,a=!1){for(let r=!0,n=e;n;n=n.parentNode){let i,t=this.getDesc(n);if(t&&(!a||t.node)){if(!r||!(i=t.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return t;r=!1}}}getDesc(e){let a=e.pmViewDesc;for(let e=a;e;e=e.parent)if(e==this)return a}posFromDOM(e,a,r){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,a,r)}return-1}descAt(e){for(let a=0,r=0;a<this.children.length;a++){let n=this.children[a],i=r+n.size;if(r==e&&i!=r){for(;!n.border&&n.children.length;)n=n.children[0];return n}if(e<i)return n.descAt(e-r-n.border);r=i}}domFromPos(e,a){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,n=0;for(let a=0;r<this.children.length;r++){let i=this.children[r],t=a+i.size;if(t>e||i instanceof $h){n=e-a;break}a=t}if(n)return this.children[r].domFromPos(n-this.children[r].border,a);for(let e;r&&!(e=this.children[r-1]).size&&e instanceof yh&&e.side>=0;r--);if(a<=0){let e,n=!0;for(;e=r?this.children[r-1]:null,e&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&a&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,a):{node:this.contentDOM,offset:e?yu(e.dom)+1:0}}{let e,n=!0;for(;e=r<this.children.length?this.children[r]:null,e&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,a):{node:this.contentDOM,offset:e?yu(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,a,r=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:a,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let t=r,o=0;;o++){let r=this.children[o],s=t+r.size;if(-1==n&&e<=s){let i=t+r.border;if(e>=i&&a<=s-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(e,a,i);e=t;for(let a=o;a>0;a--){let r=this.children[a-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=yu(r.dom)+1;break}e-=r.size}-1==n&&(n=0)}if(n>-1&&(s>a||o==this.children.length-1)){a=s;for(let e=o+1;e<this.children.length;e++){let r=this.children[e];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=yu(r.dom);break}a+=r.size}-1==i&&(i=this.contentDOM.childNodes.length);break}t=s}return{node:this.contentDOM,from:e,to:a,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let a=this.children[e<0?0:this.children.length-1];return 0==a.size||a.emptyChildAt(e)}domAfterPos(e){let{node:a,offset:r}=this.domFromPos(e,0);if(1!=a.nodeType||r==a.childNodes.length)throw new RangeError("No node after pos "+e);return a.childNodes[r]}setSelection(e,a,r,n=!1){let i=Math.min(e,a),t=Math.max(e,a);for(let o=0,s=0;o<this.children.length;o++){let l=this.children[o],c=s+l.size;if(i>s&&t<c)return l.setSelection(e-s-l.border,a-s-l.border,r,n);s=c}let o=this.domFromPos(e,e?-1:1),s=a==e?o:this.domFromPos(a,a?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Fu||Bu)&&e==a){let{node:e,offset:a}=o;if(3==e.nodeType){if(d=!(!a||"\n"!=e.nodeValue[a-1]),d&&a==e.nodeValue.length)for(let a,r=e;r;r=r.parentNode){if(a=r.nextSibling){"BR"==a.nodeName&&(o=s={node:a.parentNode,offset:yu(a)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let r=e.childNodes[a-1];d=r&&("BR"==r.nodeName||"false"==r.contentEditable)}}if(Fu&&c.focusNode&&c.focusNode!=s.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||d&&Bu)&&ju(o.node,o.offset,c.anchorNode,c.anchorOffset)&&ju(s.node,s.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==a)&&!d){l.collapse(o.node,o.offset);try{e!=a&&l.extend(s.node,s.offset),u=!0}catch(e){}}if(!u){if(e>a){let e=o;o=s,s=e}let r=document.createRange();r.setEnd(s.node,s.offset),r.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(r)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,a){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],t=r+i.size;if(r==t?e<=t&&a>=r:e<t&&a>r){let n=r+i.border,o=t-i.border;if(e>=n&&a<=o)return this.dirty=e==r||a==t?2:1,void(e!=n||a!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-n,a-n):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}r=t}this.dirty=2}markParentsDirty(){let e=1;for(let a=this.parent;a;a=a.parent,e++){let r=1==e?2:1;a.dirty<r&&(a.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class yh extends kh{constructor(e,a,r,n){let i,t=a.type.toDOM;if("function"==typeof t&&(t=t(r,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n))),!a.type.spec.raw){if(1!=t.nodeType){let e=document.createElement("span");e.appendChild(t),t=e}t.contentEditable="false",t.classList.add("ProseMirror-widget")}super(e,[],t,null),this.widget=a,this.widget=a,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let a=this.widget.spec.stopEvent;return!!a&&a(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 side(){return this.widget.type.side}}class vh extends kh{constructor(e,a,r,n){super(e,[],a,null),this.textDOM=r,this.text=n}get size(){return this.text.length}localPosFromDOM(e,a){return e!=this.textDOM?this.posAtStart+(a?this.size:0):this.posAtStart+a}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class wh extends kh{constructor(e,a,r,n,i){super(e,[],r,n),this.mark=a,this.spec=i}static create(e,a,r,n){let i=n.nodeViews[a.type.name],t=i&&i(a,n,r);return t&&t.dom||(t=ed.renderSpec(document,a.type.spec.toDOM(a,r),null,a.attrs)),new wh(e,a,t.dom,t.contentDOM||t.dom,t)}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,a){if(super.markDirty(e,a),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,a,r){let n=wh.create(this.parent,this.mark,!0,r),i=this.children,t=this.size;a<t&&(i=Fh(i,a,t,r)),e>0&&(i=Fh(i,0,e,r));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class zh extends kh{constructor(e,a,r,n,i,t,o,s,l){super(e,[],i,t),this.node=a,this.outerDeco=r,this.innerDeco=n,this.nodeDOM=o}static create(e,a,r,n,i,t){let o,s=i.nodeViews[a.type.name],l=s&&s(a,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:t),r,n),c=l&&l.dom,d=l&&l.contentDOM;if(a.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(a.text);else if(!c){let e=ed.renderSpec(document,a.type.spec.toDOM(a),null,a.attrs);({dom:c,contentDOM:d}=e)}d||a.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),a.type.spec.draggable&&(c.draggable=!0));let u=c;return c=Ah(c,r,a),l?o=new qh(e,a,r,n,c,d||null,u,l,i,t+1):a.isText?new xh(e,a,r,n,c,u,i):new zh(e,a,r,n,c,d||null,u,i,t+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 a=this.children.length-1;a>=0;a--){let r=this.children[a];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ql.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,a,r){return 0==this.dirty&&e.eq(this.node)&&Dh(a,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,a){let r=this.node.inlineContent,n=a,i=e.composing?this.localCompositionInfo(e,a):null,t=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Nh(this,t&&t.node,e);!function(e,a,r,n){let i=a.locals(e),t=0;if(0==i.length){for(let r=0;r<e.childCount;r++){let o=e.child(r);n(o,i,a.forChild(t,o),r),t+=o.nodeSize}return}let o=0,s=[],l=null;for(let c=0;;){let d,u,h,m;for(;o<i.length&&i[o].to==t;){let e=i[o++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(Ih);for(let e=0;e<u.length;e++)r(u[e],c,!!l)}else r(d,c,!!l);if(l)m=-1,h=l,l=null;else{if(!(c<e.childCount))break;m=c,h=e.child(c++)}for(let e=0;e<s.length;e++)s[e].to<=t&&s.splice(e--,1);for(;o<i.length&&i[o].from<=t&&i[o].to>t;)s.push(i[o++]);let g=t+h.nodeSize;if(h.isText){let e=g;o<i.length&&i[o].from<e&&(e=i[o].from);for(let a=0;a<s.length;a++)s[a].to<e&&(e=s[a].to);e<g&&(l=h.cut(e-t),h=h.cut(0,e-t),g=e,m=-1)}else for(;o<i.length&&i[o].to<g;)o++;n(h,h.isInline&&!h.isLeaf?s.filter((e=>!e.inline)):s.slice(),a.forChild(t,h),m),t=g}}(this.node,this.innerDeco,((a,i,t)=>{a.spec.marks?s.syncToMarks(a.spec.marks,r,e):a.type.side>=0&&!t&&s.syncToMarks(i==this.node.childCount?nc.none:this.node.child(i).marks,r,e),s.placeWidget(a,e,n)}),((a,t,l,c)=>{let d;s.syncToMarks(a.marks,r,e),s.findNodeMatch(a,t,l,c)||o&&e.state.selection.from>n&&e.state.selection.to<n+a.nodeSize&&(d=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(a,t,l,d,e)||s.updateNextNode(a,t,l,e,c,n)||s.addNode(a,t,l,e,n),n+=a.nodeSize})),s.syncToMarks([],r,e),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(t&&this.protectLocalComposition(e,t),Ch(this.contentDOM,this.children,e),Vu&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let a=e.style.cssText;e.style.cssText=a+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=a}}(this.dom))}localCompositionInfo(e,a){let{from:r,to:n}=e.state.selection;if(!(e.state.selection instanceof eu)||r<a||n>a+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,t=function(e,a,r,n){for(let i=0,t=0;i<e.childCount&&t<=n;){let o=e.child(i++),s=t;if(t+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let a=e.child(i++);if(t+=a.nodeSize,!a.isText)break;l+=a.text}if(t>=r){if(t>=n&&l.slice(n-a.length-s,n-s)==a)return n-a.length;let e=s<n?l.lastIndexOf(a,n-s-1):-1;if(e>=0&&e+a.length+s>=r)return s+e;if(r==n&&l.length>=n+a.length-s&&l.slice(n-s,n-s+a.length)==a)return n}}return-1}(this.node.content,e,r-a,n-a);return t<0?null:{node:i,pos:t,text:e}}return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:a,pos:r,text:n}){if(this.getDesc(a))return;let i=a;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let t=new vh(this,i,a,n);e.input.compositionNodes.push(t),this.children=Fh(this.children,r,r+n.length,e,t)}update(e,a,r,n){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,a,r,n),!0)}updateInner(e,a,r,n){this.updateOuterDeco(a),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Dh(e,this.outerDeco))return;let a=1!=this.nodeDOM.nodeType,r=this.dom;this.dom=Mh(this.dom,this.nodeDOM,Eh(this.outerDeco,this.node,a),Eh(e,this.node,a)),this.dom!=r&&(r.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.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function jh(e,a,r,n,i){Ah(n,a,e);let t=new zh(void 0,e,a,r,n,n,n,i,0);return t.contentDOM&&t.updateChildren(i,0),t}class xh extends zh{constructor(e,a,r,n,i,t,o){super(e,a,r,n,i,null,t,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,a,r,n){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(a),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let a=this.nodeDOM;a;a=a.parentNode)if(a==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,a,r){return e==this.nodeDOM?this.posAtStart+Math.min(a,this.node.text.length):super.localPosFromDOM(e,a,r)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,a,r){let n=this.node.cut(e,a),i=document.createTextNode(n.text);return new xh(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,a){super.markDirty(e,a),this.dom==this.nodeDOM||0!=e&&a!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class $h extends kh{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 qh extends zh{constructor(e,a,r,n,i,t,o,s,l,c){super(e,a,r,n,i,t,o,l,c),this.spec=s}update(e,a,r,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,a,r);return i&&this.updateInner(e,a,r,n),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,a,r,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,a,r,n){this.spec.setSelection?this.spec.setSelection(e,a,r.root):super.setSelection(e,a,r,n)}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 Ch(e,a,r){let n=e.firstChild,i=!1;for(let t=0;t<a.length;t++){let o=a[t],s=o.dom;if(s.parentNode==e){for(;s!=n;)n=Th(n),i=!0;n=n.nextSibling}else i=!0,e.insertBefore(s,n);if(o instanceof wh){let a=n?n.previousSibling:e.lastChild;Ch(o.contentDOM,o.children,r),n=a?a.nextSibling:e.firstChild}}for(;n;)n=Th(n),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}const Sh=function(e){e&&(this.nodeName=e)};Sh.prototype=Object.create(null);const Oh=[new Sh];function Eh(e,a,r){if(0==e.length)return Oh;let n=r?Oh[0]:new Sh,i=[n];for(let t=0;t<e.length;t++){let o=e[t].type.attrs;if(o){o.nodeName&&i.push(n=new Sh(o.nodeName));for(let e in o){let t=o[e];null!=t&&(r&&1==i.length&&i.push(n=new Sh(a.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+t:"style"==e?n.style=(n.style?n.style+";":"")+t:"nodeName"!=e&&(n[e]=t))}}}return i}function Mh(e,a,r,n){if(r==Oh&&n==Oh)return a;let i=a;for(let a=0;a<n.length;a++){let t=n[a],o=r[a];if(a){let a;o&&o.nodeName==t.nodeName&&i!=e&&(a=i.parentNode)&&a.nodeName.toLowerCase()==t.nodeName||(a=document.createElement(t.nodeName),a.pmIsDeco=!0,a.appendChild(i),o=Oh[0]),i=a}_h(i,o||Oh[0],t)}return i}function _h(e,a,r){for(let n in a)"class"==n||"style"==n||"nodeName"==n||n in r||e.removeAttribute(n);for(let n in r)"class"!=n&&"style"!=n&&"nodeName"!=n&&r[n]!=a[n]&&e.setAttribute(n,r[n]);if(a.class!=r.class){let n=a.class?a.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)-1==i.indexOf(n[a])&&e.classList.remove(n[a]);for(let a=0;a<i.length;a++)-1==n.indexOf(i[a])&&e.classList.add(i[a]);0==e.classList.length&&e.removeAttribute("class")}if(a.style!=r.style){if(a.style){let r,n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;r=n.exec(a.style);)e.style.removeProperty(r[1])}r.style&&(e.style.cssText+=r.style)}}function Ah(e,a,r){return Mh(e,e,Oh,Eh(a,r,1!=e.nodeType))}function Dh(e,a){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(a[r].type))return!1;return!0}function Th(e){let a=e.nextSibling;return e.parentNode.removeChild(e),a}class Nh{constructor(e,a,r){this.lock=a,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,a){let r=a,n=r.children.length,i=e.childCount,t=new Map,o=[];e:for(;i>0;){let s;for(;;)if(n){let e=r.children[n-1];if(!(e instanceof wh)){s=e,n--;break}r=e,n=e.children.length}else{if(r==a)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=s.node;if(l){if(l!=e.child(i-1))break;--i,t.set(s,i),o.push(s)}}return{index:i,matched:t,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,a){if(e!=a){for(let r=e;r<a;r++)this.top.children[r].destroy();this.top.children.splice(e,a-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,a,r){let n=0,i=this.stack.length>>1,t=Math.min(i,e.length);for(;n<t&&(n==i-1?this.top:this.stack[n+1<<1]).matchesMark(e[n])&&!1!==e[n].type.spec.spanning;)n++;for(;n<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 n=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let r=this.top.children[a];if(r.matchesMark(e[i])&&!this.isLocked(r.dom)){n=a;break}}if(n>-1)n>this.index&&(this.changed=!0,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let n=wh.create(this.top,e[i],a,r);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,i++}}findNodeMatch(e,a,r,n){let i,t=-1;if(n>=this.preMatch.index&&(i=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&i.matchesNode(e,a,r))t=this.top.children.indexOf(i,this.index);else for(let n=this.index,i=Math.min(this.top.children.length,n+5);n<i;n++){let i=this.top.children[n];if(i.matchesNode(e,a,r)&&!this.preMatch.matched.has(i)){t=n;break}}return!(t<0)&&(this.destroyBetween(this.index,t),this.index++,!0)}updateNodeAt(e,a,r,n,i){let t=this.top.children[n];return 3==t.dirty&&t.dom==t.contentDOM&&(t.dirty=2),!!t.update(e,a,r,i)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let a=e.parentNode;if(!a)return-1;if(a==this.top.contentDOM){let a=e.pmViewDesc;if(a)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==a)return e;return-1}e=a}}updateNextNode(e,a,r,n,i,t){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof zh){let l=this.preMatch.matched.get(s);if(null!=l&&l!=i)return!1;let c,d=s.dom,u=this.isLocked(d)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Dh(a,s.outerDeco));if(!u&&s.update(e,a,r,n))return this.destroyBetween(this.index,o),s.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(s,e,a,r,n,t)))return this.destroyBetween(this.index,o),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,t+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,a,r,n,i,t){if(e.dirty||a.isAtom||!e.children.length||!e.node.content.eq(a.content)||!Dh(r,e.outerDeco)||!n.eq(e.innerDeco))return null;let o=zh.create(this.top,a,r,n,i,t);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,a,r,n,i){let t=zh.create(this.top,e,a,r,n,i);t.contentDOM&&t.updateChildren(n,i+1),this.top.children.splice(this.index++,0,t),this.changed=!0}placeWidget(e,a,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(!n||!n.matchesWidget(e)||e!=n.widget&&n.widget.type.toDOM.parentNode){let n=new yh(this.top,e,a,r);this.top.children.splice(this.index++,0,n),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],a=this.top;for(;e instanceof wh;)a=e,e=a.children[a.children.length-1];(!e||!(e instanceof xh)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bu||Ru)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",a),this.addHackNode("BR",this.top))}addHackNode(e,a){if(a==this.top&&this.index<a.children.length&&a.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);"IMG"==e&&(r.className="ProseMirror-separator",r.alt=""),"BR"==e&&(r.className="ProseMirror-trailingBreak");let n=new $h(this.top,[],r,null);a!=this.top?a.children.push(n):a.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Ih(e,a){return e.type.side-a.type.side}function Fh(e,a,r,n,i){let t=[];for(let o=0,s=0;o<e.length;o++){let l=e[o],c=s,d=s+=l.size;c>=r||d<=a?t.push(l):(c<a&&t.push(l.slice(0,a-c,n)),i&&(t.push(i),i=void 0),d>r&&t.push(l.slice(r-c,l.size,n)))}return t}function Ph(e,a=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),t=i&&0==i.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let s,l,c=n.resolve(o);if(Su(r)){for(s=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&ru.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,a,r){for(let n=0==a,i=a==qu(e);n||i;){if(e==r)return!0;let a=yu(e);if(!(e=e.parentNode))return!1;n=n&&0==a,i=i&&a==qu(e)}}(r.focusNode,r.focusOffset,i.dom))){let e=i.posBefore;l=new ru(o==e?c:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let a=o,i=o;for(let n=0;n<r.rangeCount;n++){let t=r.getRangeAt(n);a=Math.min(a,e.docView.posFromDOM(t.startContainer,t.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(t.endContainer,t.endOffset,-1))}if(a<0)return null;[s,o]=i==e.state.selection.anchor?[i,a]:[a,i],c=n.resolve(o)}else s=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(s<0)return null}let d=n.resolve(s);if(!l){l=Kh(e,d,c,"pointer"==a||e.state.selection.head<c.pos&&!t?1:-1)}return l}function Rh(e){return e.editable?e.hasFocus():Jh(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Lh(e,a=!1){let r=e.state.selection;if(Uh(e,r),Rh(e)){if(!a&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Ru){let a=e.domSelectionRange(),r=e.domObserver.currentSelection;if(a.anchorNode&&r.anchorNode&&ju(a.anchorNode,a.anchorOffset,r.anchorNode,r.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let a=e.domSelection(),r=document.createRange();if(!a)return;let n=e.cursorWrapper.dom,i="IMG"==n.nodeName;i?r.setStart(n.parentNode,yu(n)+1):r.setStart(n,0);r.collapse(!0),a.removeAllRanges(),a.addRange(r),!i&&!e.state.selection.visible&&Nu&&Iu<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let n,i,{anchor:t,head:o}=r;!Bh||r instanceof eu||(r.$from.parent.inlineContent||(n=Vh(e,r.from)),r.empty||r.$from.parent.inlineContent||(i=Vh(e,r.to))),e.docView.setSelection(t,o,e,a),Bh&&(n&&Wh(n),i&&Wh(i)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let a=e.dom.ownerDocument;a.removeEventListener("selectionchange",e.input.hideSelectionGuard);let r=e.domSelectionRange(),n=r.anchorNode,i=r.anchorOffset;a.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{r.anchorNode==n&&r.anchorOffset==i||(a.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Rh(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Bh=Bu||Ru&&Lu<63;function Vh(e,a){let{node:r,offset:n}=e.docView.domFromPos(a,0),i=n<r.childNodes.length?r.childNodes[n]:null,t=n?r.childNodes[n-1]:null;if(Bu&&i&&"false"==i.contentEditable)return Hh(i);if(!(i&&"false"!=i.contentEditable||t&&"false"!=t.contentEditable)){if(i)return Hh(i);if(t)return Hh(t)}}function Hh(e){return e.contentEditable="true",Bu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Wh(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Uh(e,a){if(a instanceof ru){let r=e.docView.descAt(a.from);r!=e.lastSelectedViewDesc&&(Gh(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else Gh(e)}function Gh(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Kh(e,a,r,n){return e.someProp("createSelectionBetween",(n=>n(e,a,r)))||eu.between(a,r,n)}function Zh(e){return!(e.editable&&!e.hasFocus())&&Jh(e)}function Jh(e){let a=e.domSelectionRange();if(!a.anchorNode)return!1;try{return e.dom.contains(3==a.anchorNode.nodeType?a.anchorNode.parentNode:a.anchorNode)&&(e.editable||e.dom.contains(3==a.focusNode.nodeType?a.focusNode.parentNode:a.focusNode))}catch(e){return!1}}function Yh(e,a){let{$anchor:r,$head:n}=e.selection,i=a>0?r.max(n):r.min(n),t=i.parent.inlineContent?i.depth?e.doc.resolve(a>0?i.after():i.before()):null:i;return t&&Jd.findFrom(t,a)}function Xh(e,a){return e.dispatch(e.state.tr.setSelection(a).scrollIntoView()),!0}function Qh(e,a,r){let n=e.state.selection;if(!(n instanceof eu)){if(n instanceof ru&&n.node.isInline)return Xh(e,new eu(a>0?n.$to:n.$from));{let r=Yh(e.state,a);return!!r&&Xh(e,r)}}if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:a<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let t=e.state.doc.resolve(r.pos+i.nodeSize*(a<0?-1:1));return Xh(e,new eu(n.$anchor,t))}if(!n.empty)return!1;if(e.endOfTextblock(a>0?"forward":"backward")){let r=Yh(e.state,a);return!!(r&&r instanceof ru)&&Xh(e,r)}if(!(Hu&&r.indexOf("m")>-1)){let r,i=n.$head,t=i.textOffset?null:a<0?i.nodeBefore:i.nodeAfter;if(!t||t.isText)return!1;let o=a<0?i.pos-t.nodeSize:i.pos;return!!(t.isAtom||(r=e.docView.descAt(o))&&!r.contentDOM)&&(ru.isSelectable(t)?Xh(e,new ru(a<0?e.state.doc.resolve(i.pos-t.nodeSize):i)):!!Gu&&Xh(e,new eu(e.state.doc.resolve(a<0?o:o+t.nodeSize))))}}function em(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function am(e,a){let r=e.pmViewDesc;return r&&0==r.size&&(a<0||e.nextSibling||"BR"!=e.nodeName)}function rm(e,a){return a<0?function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=!1;Fu&&1==r.nodeType&&n<em(r)&&am(r.childNodes[n],-1)&&(o=!0);for(;;)if(n>0){if(1!=r.nodeType)break;{let e=r.childNodes[n-1];if(am(e,-1))i=r,t=--n;else{if(3!=e.nodeType)break;r=e,n=r.nodeValue.length}}}else{if(nm(r))break;{let a=r.previousSibling;for(;a&&am(a,-1);)i=r.parentNode,t=yu(a),a=a.previousSibling;if(a)r=a,n=em(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}o?im(e,r,n):i&&im(e,i,t)}(e):function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=em(r);for(;;)if(n<o){if(1!=r.nodeType)break;if(!am(r.childNodes[n],1))break;i=r,t=++n}else{if(nm(r))break;{let a=r.nextSibling;for(;a&&am(a,1);)i=a.parentNode,t=yu(a)+1,a=a.nextSibling;if(a)r=a,n=0,o=em(r);else{if(r=r.parentNode,r==e.dom)break;n=o=0}}}i&&im(e,i,t)}(e)}function nm(e){let a=e.pmViewDesc;return a&&a.node&&a.node.isBlock}function im(e,a,r){if(3!=a.nodeType){let e,n;(n=function(e,a){for(;e&&a==e.childNodes.length&&!Cu(e);)a=yu(e)+1,e=e.parentNode;for(;e&&a<e.childNodes.length;){let r=e.childNodes[a];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;e=r,a=0}}(a,r))?(a=n,r=0):(e=function(e,a){for(;e&&!a&&!Cu(e);)a=yu(e),e=e.parentNode;for(;e&&a;){let r=e.childNodes[a-1];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;a=(e=r).childNodes.length}}(a,r))&&(a=e,r=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(Su(n)){let e=document.createRange();e.setEnd(a,r),e.setStart(a,r),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(a,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout((()=>{e.state==i&&Lh(e)}),50)}function tm(e,a){let r=e.state.doc.resolve(a);if(!Ru&&!Wu&&r.parent.inlineContent){let n=e.coordsAtPos(a);if(a>r.start()){let r=e.coordsAtPos(a-1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(a<r.end()){let r=e.coordsAtPos(a+1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function om(e,a,r){let n=e.state.selection;if(n instanceof eu&&!n.empty||r.indexOf("s")>-1)return!1;if(Hu&&r.indexOf("m")>-1)return!1;let{$from:i,$to:t}=n;if(!i.parent.inlineContent||e.endOfTextblock(a<0?"up":"down")){let r=Yh(e.state,a);if(r&&r instanceof ru)return Xh(e,r)}if(!i.parent.inlineContent){let r=a<0?i:t,o=n instanceof iu?Jd.near(r,a):Jd.findFrom(r,a);return!!o&&Xh(e,o)}return!1}function sm(e,a){if(!(e.state.selection instanceof eu))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(a>0?"forward":"backward"))return!0;let t=!r.textOffset&&(a<0?r.nodeBefore:r.nodeAfter);if(t&&!t.isText){let n=e.state.tr;return a<0?n.delete(r.pos-t.nodeSize,r.pos):n.delete(r.pos,r.pos+t.nodeSize),e.dispatch(n),!0}return!1}function lm(e,a,r){e.domObserver.stop(),a.contentEditable=r,e.domObserver.start()}function cm(e,a){let r=a.keyCode,n=function(e){let a="";return e.ctrlKey&&(a+="c"),e.metaKey&&(a+="m"),e.altKey&&(a+="a"),e.shiftKey&&(a+="s"),a}(a);if(8==r||Hu&&72==r&&"c"==n)return sm(e,-1)||rm(e,-1);if(46==r&&!a.shiftKey||Hu&&68==r&&"c"==n)return sm(e,1)||rm(e,1);if(13==r||27==r)return!0;if(37==r||Hu&&66==r&&"c"==n){let a=37==r?"ltr"==tm(e,e.state.selection.from)?-1:1:-1;return Qh(e,a,n)||rm(e,a)}if(39==r||Hu&&70==r&&"c"==n){let a=39==r?"ltr"==tm(e,e.state.selection.from)?1:-1:1;return Qh(e,a,n)||rm(e,a)}return 38==r||Hu&&80==r&&"c"==n?om(e,-1,n)||rm(e,-1):40==r||Hu&&78==r&&"c"==n?function(e){if(!Bu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:a,focusOffset:r}=e.domSelectionRange();if(a&&1==a.nodeType&&0==r&&a.firstChild&&"false"==a.firstChild.contentEditable){let r=a.firstChild;lm(e,r,"true"),setTimeout((()=>lm(e,r,"false")),20)}return!1}(e)||om(e,1,n)||rm(e,1):n==(Hu?"m":"c")&&(66==r||73==r||89==r||90==r)}function dm(e,a){e.someProp("transformCopied",(r=>{a=r(a,e)}));let r=[],{content:n,openStart:i,openEnd:t}=a;for(;i>1&&t>1&&1==n.childCount&&1==n.firstChild.childCount;){i--,t--;let e=n.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let o=e.someProp("clipboardSerializer")||ed.fromSchema(e.state.schema),s=vm(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let c,d=l.firstChild,u=0;for(;d&&1==d.nodeType&&(c=km[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let a=s.createElement(c[e]);for(;l.firstChild;)a.appendChild(l.firstChild);l.appendChild(a),u++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${t}${u?` -${u}`:""} ${JSON.stringify(r)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(r=>r(a,e)))||a.content.textBetween(0,a.content.size,"\n\n"),slice:a}}function um(e,a,r,n,i){let t,o,s=i.parent.type.spec.code;if(!r&&!a)return null;let l=a&&(n||s||!r);if(l){if(e.someProp("transformPastedText",(r=>{a=r(a,s||n,e)})),s)return a?new tc(Ql.from(e.state.schema.text(a.replace(/\r\n?/g,"\n"))),0,0):tc.empty;let r=e.someProp("clipboardTextParser",(r=>r(a,i,n,e)));if(r)o=r;else{let r=i.marks(),{schema:n}=e.state,o=ed.fromSchema(n);t=document.createElement("div"),a.split(/(?:\r\n?|\n)+/).forEach((e=>{let a=t.appendChild(document.createElement("p"));e&&a.appendChild(o.serializeNode(n.text(e,r)))}))}}else e.someProp("transformPastedHTML",(a=>{r=a(r,e)})),t=function(e){let a=/^(\s*<meta [^>]*>)*/.exec(e);a&&(e=e.slice(a[0].length));let r,n=vm().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(r=i&&km[i[1].toLowerCase()])&&(e=r.map((e=>"<"+e+">")).join("")+e+r.map((e=>"</"+e+">")).reverse().join(""));if(n.innerHTML=function(e){let a=window.trustedTypes;if(!a)return e;wm||(wm=a.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return wm.createHTML(e)}(e),r)for(let e=0;e<r.length;e++)n=n.querySelector(r[e])||n;return n}(r),Gu&&function(e){let a=e.querySelectorAll(Ru?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<a.length;r++){let n=a[r];1==n.childNodes.length&&" "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(t);let c=t&&t.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=t.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;t=e}if(!o){let a=e.someProp("clipboardParser")||e.someProp("domParser")||Hc.fromSchema(e.state.schema);o=a.parseSlice(t,{preserveWhitespace:!(!l&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||hm.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)o=function(e,a){if(!e.size)return e;let r,n=e.content.firstChild.type.schema;try{r=JSON.parse(a)}catch(a){return e}let{content:i,openStart:t,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let a=n.nodes[r[e]];if(!a||a.hasRequiredAttrs())break;i=Ql.from(a.create(r[e+1],i)),t++,o++}return new tc(i,t,o)}(fm(o,+d[1],+d[2]),d[4]);else if(o=tc.maxOpen(function(e,a){if(e.childCount<2)return e;for(let r=a.depth;r>=0;r--){let n,i=a.node(r).contentMatchAt(a.index(r)),t=[];if(e.forEach((e=>{if(!t)return;let a,r=i.findWrapping(e.type);if(!r)return t=null;if(a=t.length&&n.length&&gm(r,n,e,t[t.length-1],0))t[t.length-1]=a;else{t.length&&(t[t.length-1]=pm(t[t.length-1],n.length));let a=mm(e,r);t.push(a),i=i.matchType(a.type),n=r}})),t)return Ql.from(t)}return e}(o.content,i),!0),o.openStart||o.openEnd){let e=0,a=0;for(let a=o.content.firstChild;e<o.openStart&&!a.type.spec.isolating;e++,a=a.firstChild);for(let e=o.content.lastChild;a<o.openEnd&&!e.type.spec.isolating;a++,e=e.lastChild);o=fm(o,e,a)}return e.someProp("transformPasted",(a=>{o=a(o,e)})),o}const hm=/^(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 mm(e,a,r=0){for(let n=a.length-1;n>=r;n--)e=a[n].create(null,Ql.from(e));return e}function gm(e,a,r,n,i){if(i<e.length&&i<a.length&&e[i]==a[i]){let t=gm(e,a,r,n.lastChild,i+1);if(t)return n.copy(n.content.replaceChild(n.childCount-1,t));if(n.contentMatchAt(n.childCount).matchType(i==e.length-1?r.type:e[i+1]))return n.copy(n.content.append(Ql.from(mm(r,e,i+1))))}}function pm(e,a){if(0==a)return e;let r=e.content.replaceChild(e.childCount-1,pm(e.lastChild,a-1)),n=e.contentMatchAt(e.childCount).fillBefore(Ql.empty,!0);return e.copy(r.append(n))}function bm(e,a,r,n,i,t){let o=a<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(t=0),i<n-1&&(s=bm(s,a,r,n,i+1,t)),i>=r&&(s=a<0?o.contentMatchAt(0).fillBefore(s,t<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Ql.empty,!0))),e.replaceChild(a<0?0:e.childCount-1,o.copy(s))}function fm(e,a,r){return a<e.openStart&&(e=new tc(bm(e.content,-1,a,e.openStart,0,e.openEnd),a,e.openEnd)),r<e.openEnd&&(e=new tc(bm(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}const km={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 ym=null;function vm(){return ym||(ym=document.implementation.createHTMLDocument("title"))}let wm=null;const zm={},jm={},xm={touchstart:!0,touchmove:!0};class $m{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function qm(e,a){e.input.lastSelectionOrigin=a,e.input.lastSelectionTime=Date.now()}function Cm(e){e.someProp("handleDOMEvents",(a=>{for(let r in a)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=a=>Sm(e,a))}))}function Sm(e,a){return e.someProp("handleDOMEvents",(r=>{let n=r[a.type];return!!n&&(n(e,a)||a.defaultPrevented)}))}function Om(e,a){if(!a.bubbles)return!0;if(a.defaultPrevented)return!1;for(let r=a.target;r!=e.dom;r=r.parentNode)if(!r||11==r.nodeType||r.pmViewDesc&&r.pmViewDesc.stopEvent(a))return!1;return!0}function Em(e){return{left:e.clientX,top:e.clientY}}function Mm(e,a,r,n,i){if(-1==n)return!1;let t=e.state.doc.resolve(n);for(let n=t.depth+1;n>0;n--)if(e.someProp(a,(a=>n>t.depth?a(e,r,t.nodeAfter,t.before(n),i,!0):a(e,r,t.node(n),t.before(n),i,!1))))return!0;return!1}function _m(e,a,r){if(e.focused||e.focus(),e.state.selection.eq(a))return;let n=e.state.tr.setSelection(a);n.setMeta("pointer",!0),e.dispatch(n)}function Am(e,a,r,n,i){return Mm(e,"handleClickOn",a,r,n)||e.someProp("handleClick",(r=>r(e,a,n)))||(i?function(e,a){if(-1==a)return!1;let r,n,i=e.state.selection;i instanceof ru&&(r=i.node);let t=e.state.doc.resolve(a);for(let e=t.depth+1;e>0;e--){let a=e>t.depth?t.nodeAfter:t.node(e);if(ru.isSelectable(a)){n=r&&i.$from.depth>0&&e>=i.$from.depth&&t.before(i.$from.depth+1)==i.$from.pos?t.before(i.$from.depth):t.before(e);break}}return null!=n&&(_m(e,ru.create(e.state.doc,n)),!0)}(e,r):function(e,a){if(-1==a)return!1;let r=e.state.doc.resolve(a),n=r.nodeAfter;return!!(n&&n.isAtom&&ru.isSelectable(n))&&(_m(e,new ru(r)),!0)}(e,r))}function Dm(e,a,r,n){return Mm(e,"handleDoubleClickOn",a,r,n)||e.someProp("handleDoubleClick",(r=>r(e,a,n)))}function Tm(e,a,r,n){return Mm(e,"handleTripleClickOn",a,r,n)||e.someProp("handleTripleClick",(r=>r(e,a,n)))||function(e,a,r){if(0!=r.button)return!1;let n=e.state.doc;if(-1==a)return!!n.inlineContent&&(_m(e,eu.create(n,0,n.content.size)),!0);let i=n.resolve(a);for(let a=i.depth+1;a>0;a--){let r=a>i.depth?i.nodeAfter:i.node(a),t=i.before(a);if(r.inlineContent)_m(e,eu.create(n,t+1,t+1+r.content.size));else{if(!ru.isSelectable(r))continue;_m(e,ru.create(n,t))}return!0}}(e,r,n)}function Nm(e){return Hm(e)}jm.keydown=(e,a)=>{let r=a;if(e.input.shiftKey=16==r.keyCode||r.shiftKey,!Pm(e,r)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!Uu||!Ru||13!=r.keyCode))if(229!=r.keyCode&&e.domObserver.forceFlush(),!Vu||13!=r.keyCode||r.ctrlKey||r.altKey||r.metaKey)e.someProp("handleKeyDown",(a=>a(e,r)))||cm(e,r)?r.preventDefault():qm(e,"key");else{let a=Date.now();e.input.lastIOSEnter=a,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==a&&(e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},jm.keyup=(e,a)=>{16==a.keyCode&&(e.input.shiftKey=!1)},jm.keypress=(e,a)=>{let r=a;if(Pm(e,r)||!r.charCode||r.ctrlKey&&!r.altKey||Hu&&r.metaKey)return;if(e.someProp("handleKeyPress",(a=>a(e,r))))return void r.preventDefault();let n=e.state.selection;if(!(n instanceof eu&&n.$from.sameParent(n.$to))){let a=String.fromCharCode(r.charCode);/[\r\n]/.test(a)||e.someProp("handleTextInput",(r=>r(e,n.$from.pos,n.$to.pos,a)))||e.dispatch(e.state.tr.insertText(a).scrollIntoView()),r.preventDefault()}};const Im=Hu?"metaKey":"ctrlKey";zm.mousedown=(e,a)=>{let r=a;e.input.shiftKey=r.shiftKey;let n=Nm(e),i=Date.now(),t="singleClick";i-e.input.lastClick.time<500&&function(e,a){let r=a.x-e.clientX,n=a.y-e.clientY;return r*r+n*n<100}(r,e.input.lastClick)&&!r[Im]&&("singleClick"==e.input.lastClick.type?t="doubleClick":"doubleClick"==e.input.lastClick.type&&(t="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:t};let o=e.posAtCoords(Em(r));o&&("singleClick"==t?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Fm(e,o,r,!!n)):("doubleClick"==t?Dm:Tm)(e,o.pos,o.inside,r)?r.preventDefault():qm(e,"pointer"))};class Fm{constructor(e,a,r,n){let i,t;if(this.view=e,this.pos=a,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Im],this.allowDefault=r.shiftKey,a.inside>-1)i=e.state.doc.nodeAt(a.inside),t=a.inside;else{let r=e.state.doc.resolve(a.pos);i=r.parent,t=r.depth?r.before():0}const o=n?null:r.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&1==s.dom.nodeType?s.dom:null;let{selection:l}=e.state;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof ru&&l.from<=t&&l.to>t)&&(this.mightDrag={node:i,pos:t,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Fu||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)),qm(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((()=>Lh(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let a=this.pos;this.view.state.doc!=this.startDoc&&(a=this.view.posAtCoords(Em(e))),this.updateAllowDefault(e),this.allowDefault||!a?qm(this.view,"pointer"):Am(this.view,a.pos,a.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Bu&&this.mightDrag&&!this.mightDrag.node.isAtom||Ru&&!this.view.state.selection.visible&&Math.min(Math.abs(a.pos-this.view.state.selection.from),Math.abs(a.pos-this.view.state.selection.to))<=2)?(_m(this.view,Jd.near(this.view.state.doc.resolve(a.pos))),e.preventDefault()):qm(this.view,"pointer")}move(e){this.updateAllowDefault(e),qm(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 Pm(e,a){return!!e.composing||!!(Bu&&Math.abs(a.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}zm.touchstart=e=>{e.input.lastTouch=Date.now(),Nm(e),qm(e,"pointer")},zm.touchmove=e=>{e.input.lastTouch=Date.now(),qm(e,"pointer")},zm.contextmenu=e=>Nm(e);const Rm=Uu?5e3:-1;function Lm(e,a){clearTimeout(e.input.composingTimeout),a>-1&&(e.input.composingTimeout=setTimeout((()=>Hm(e)),a))}function Bm(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 Vm(e){let a=e.domSelectionRange();if(!a.focusNode)return null;let r=function(e,a){for(;;){if(3==e.nodeType&&a)return e;if(1==e.nodeType&&a>0){if("false"==e.contentEditable)return null;a=qu(e=e.childNodes[a-1])}else{if(!e.parentNode||Cu(e))return null;a=yu(e),e=e.parentNode}}}(a.focusNode,a.focusOffset),n=function(e,a){for(;;){if(3==e.nodeType&&a<e.nodeValue.length)return e;if(1==e.nodeType&&a<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[a],a=0}else{if(!e.parentNode||Cu(e))return null;a=yu(e)+1,e=e.parentNode}}}(a.focusNode,a.focusOffset);if(r&&n&&r!=n){let a=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!a||!a.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=r.pmViewDesc;if(e&&e.isText(r.nodeValue))return n}}return r||n}function Hm(e,a=!1){if(!(Uu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Bm(e),a||e.docView&&e.docView.dirty){let r=Ph(e);return r&&!r.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(r)):!e.markCursor&&!a||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}jm.compositionstart=jm.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:a}=e,r=a.selection.$to;if(a.selection instanceof eu&&(a.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||r.marks(),Hm(e,!0),e.markCursor=null;else if(Hm(e,!a.selection.empty),Fu&&a.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let a=e.domSelectionRange();for(let r=a.focusNode,n=a.focusOffset;r&&1==r.nodeType&&0!=n;){let a=n<0?r.lastChild:r.childNodes[n-1];if(!a)break;if(3==a.nodeType){let r=e.domSelection();r&&r.collapse(a,a.nodeValue.length);break}r=a,n=-1}}e.input.composing=!0}Lm(e,Rm)},jm.compositionend=(e,a)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=a.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Lm(e,20))};const Wm=Nu&&Iu<15||Vu&&Ku<604;function Um(e,a,r,n,i){let t=um(e,a,r,n,e.state.selection.$from);if(e.someProp("handlePaste",(a=>a(e,i,t||tc.empty))))return!0;if(!t)return!1;let o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(t),s=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(t);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Gm(e){let a=e.getData("text/plain")||e.getData("Text");if(a)return a;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}zm.copy=jm.cut=(e,a)=>{let r=a,n=e.state.selection,i="cut"==r.type;if(n.empty)return;let t=Wm?null:r.clipboardData,o=n.content(),{dom:s,text:l}=dm(e,o);t?(r.preventDefault(),t.clearData(),t.setData("text/html",s.innerHTML),t.setData("text/plain",l)):function(e,a){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(a),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(a),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout((()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()}),50)}(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},jm.paste=(e,a)=>{let r=a;if(e.composing&&!Uu)return;let n=Wm?null:r.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&Um(e,Gm(n),n.getData("text/html"),i,r)?r.preventDefault():function(e,a){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Um(e,n.value,null,i,a):Um(e,n.textContent,n.innerHTML,i,a)}),50)}(e,r)};class Km{constructor(e,a,r){this.slice=e,this.move=a,this.node=r}}const Zm=Hu?"altKey":"ctrlKey";zm.dragstart=(e,a)=>{let r=a,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i,t=e.state.selection,o=t.empty?null:e.posAtCoords(Em(r));if(o&&o.pos>=t.from&&o.pos<=(t instanceof ru?t.to-1:t.to));else if(n&&n.mightDrag)i=ru.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){let a=e.docView.nearestDesc(r.target,!0);a&&a.node.type.spec.draggable&&a!=e.docView&&(i=ru.create(e.state.doc,a.posBefore))}let s=(i||e.state.selection).content(),{dom:l,text:c,slice:d}=dm(e,s);(!r.dataTransfer.files.length||!Ru||Lu>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Wm?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",Wm||r.dataTransfer.setData("text/plain",c),e.dragging=new Km(d,!r[Zm],i)},zm.dragend=e=>{let a=e.dragging;window.setTimeout((()=>{e.dragging==a&&(e.dragging=null)}),50)},jm.dragover=jm.dragenter=(e,a)=>a.preventDefault(),jm.drop=(e,a)=>{let r=a,n=e.dragging;if(e.dragging=null,!r.dataTransfer)return;let i=e.posAtCoords(Em(r));if(!i)return;let t=e.state.doc.resolve(i.pos),o=n&&n.slice;o?e.someProp("transformPasted",(a=>{o=a(o,e)})):o=um(e,Gm(r.dataTransfer),Wm?null:r.dataTransfer.getData("text/html"),!1,t);let s=!(!n||r[Zm]);if(e.someProp("handleDrop",(a=>a(e,r,o||tc.empty,s))))return void r.preventDefault();if(!o)return;r.preventDefault();let l=o?Dd(e.state.doc,t.pos,o):t.pos;null==l&&(l=t.pos);let c=e.state.tr;if(s){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let m=c.doc.resolve(d);if(u&&ru.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new ru(m));else{let a=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,r,n,i)=>a=i)),c.setSelection(Kh(e,m,c.doc.resolve(a)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},zm.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())&&Lh(e)}),20))},zm.blur=(e,a)=>{let r=a;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},zm.beforeinput=(e,a)=>{if(Ru&&Uu&&"deleteContentBackward"==a.inputType){e.domObserver.flushSoon();let{domChangeCount:a}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=a)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(a=>a(e,Ou(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())}),50)}};for(let e in jm)zm[e]=jm[e];function Jm(e,a){if(e==a)return!0;for(let r in e)if(e[r]!==a[r])return!1;for(let r in a)if(!(r in e))return!1;return!0}class Ym{constructor(e,a){this.toDOM=e,this.spec=a||rg,this.side=this.spec.side||0}map(e,a,r,n){let{pos:i,deleted:t}=e.mapResult(a.from+n,this.side<0?-1:1);return t?null:new eg(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ym&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Jm(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Xm{constructor(e,a){this.attrs=e,this.spec=a||rg}map(e,a,r,n){let i=e.map(a.from+n,this.spec.inclusiveStart?-1:1)-r,t=e.map(a.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=t?null:new eg(i,t,this)}valid(e,a){return a.from<a.to}eq(e){return this==e||e instanceof Xm&&Jm(this.attrs,e.attrs)&&Jm(this.spec,e.spec)}static is(e){return e.type instanceof Xm}destroy(){}}class Qm{constructor(e,a){this.attrs=e,this.spec=a||rg}map(e,a,r,n){let i=e.mapResult(a.from+n,1);if(i.deleted)return null;let t=e.mapResult(a.to+n,-1);return t.deleted||t.pos<=i.pos?null:new eg(i.pos-r,t.pos-r,this)}valid(e,a){let r,{index:n,offset:i}=e.content.findIndex(a.from);return i==a.from&&!(r=e.child(n)).isText&&i+r.nodeSize==a.to}eq(e){return this==e||e instanceof Qm&&Jm(this.attrs,e.attrs)&&Jm(this.spec,e.spec)}destroy(){}}class eg{constructor(e,a,r){this.from=e,this.to=a,this.type=r}copy(e,a){return new eg(e,a,this.type)}eq(e,a=0){return this.type.eq(e.type)&&this.from+a==e.from&&this.to+a==e.to}map(e,a,r){return this.type.map(e,this,a,r)}static widget(e,a,r){return new eg(e,e,new Ym(a,r))}static inline(e,a,r,n){return new eg(e,a,new Xm(r,n))}static node(e,a,r,n){return new eg(e,a,new Qm(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof Xm}get widget(){return this.type instanceof Ym}}const ag=[],rg={};class ng{constructor(e,a){this.local=e.length?e:ag,this.children=a.length?a:ag}static create(e,a){return a.length?cg(a,e,0,rg):ig}find(e,a,r){let n=[];return this.findInner(null==e?0:e,null==a?1e9:a,n,0,r),n}findInner(e,a,r,n,i){for(let t=0;t<this.local.length;t++){let o=this.local[t];o.from<=a&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+n,o.to+n))}for(let t=0;t<this.children.length;t+=3)if(this.children[t]<a&&this.children[t+1]>e){let o=this.children[t]+1;this.children[t+2].findInner(e-o,a-o,r,n+o,i)}}map(e,a,r){return this==ig||0==e.maps.length?this:this.mapInner(e,a,0,0,r||rg)}mapInner(e,a,r,n,i){let t;for(let o=0;o<this.local.length;o++){let s=this.local[o].map(e,r,n);s&&s.type.valid(a,s)?(t||(t=[])).push(s):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,a,r,n,i,t,o){let s=e.slice();for(let e=0,a=t;e<r.maps.length;e++){let n=0;r.maps[e].forEach(((e,r,i,t)=>{let o=t-i-(r-e);for(let i=0;i<s.length;i+=3){let t=s[i+1];if(t<0||e>t+a-n)continue;let l=s[i]+a-n;r>=l?s[i+1]=e<=l?-2:-1:e>=a&&o&&(s[i]+=o,s[i+1]+=o)}n+=o})),a=r.maps[e].map(a,-1)}let l=!1;for(let a=0;a<s.length;a+=3)if(s[a+1]<0){if(-2==s[a+1]){l=!0,s[a+1]=-1;continue}let c=r.map(e[a]+t),d=c-i;if(d<0||d>=n.content.size){l=!0;continue}let u=r.map(e[a+1]+t,-1)-i,{index:h,offset:m}=n.content.findIndex(d),g=n.maybeChild(h);if(g&&m==d&&m+g.nodeSize==u){let n=s[a+2].mapInner(r,g,c+1,e[a]+t+1,o);n!=ig?(s[a]=d,s[a+1]=u,s[a+2]=n):(s[a+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,a,r,n,i,t,o){function s(e,a){for(let t=0;t<e.local.length;t++){let s=e.local[t].map(n,i,a);s?r.push(s):o.onRemove&&o.onRemove(e.local[t].spec)}for(let r=0;r<e.children.length;r+=3)s(e.children[r+2],e.children[r]+a+1)}for(let r=0;r<e.length;r+=3)-1==e[r+1]&&s(e[r+2],a[r]+t+1);return r}(s,e,a,r,i,t,o),c=cg(l,n,0,o);a=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,a=0;e<c.children.length;e+=3){let r=c.children[e];for(;a<s.length&&s[a]<r;)a+=3;s.splice(a,0,c.children[e],c.children[e+1],c.children[e+2])}}return new ng(a.sort(dg),s)}(this.children,t||[],e,a,r,n,i):t?new ng(t.sort(dg),ag):ig}add(e,a){return a.length?this==ig?ng.create(e,a):this.addInner(e,a,0):this}addInner(e,a,r){let n,i=0;e.forEach(((e,t)=>{let o,s=t+r;if(o=sg(a,e,s)){for(n||(n=this.children.slice());i<n.length&&n[i]<t;)i+=3;n[i]==t?n[i+2]=n[i+2].addInner(e,o,s+1):n.splice(i,0,t,t+e.nodeSize,cg(o,e,s+1,rg)),i+=3}}));let t=og(i?lg(a):a,-r);for(let a=0;a<t.length;a++)t[a].type.valid(e,t[a])||t.splice(a--,1);return new ng(t.length?this.local.concat(t).sort(dg):this.local,n||this.children)}remove(e){return 0==e.length||this==ig?this:this.removeInner(e,0)}removeInner(e,a){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i,t=r[n]+a,o=r[n+1]+a;for(let a,r=0;r<e.length;r++)(a=e[r])&&a.from>t&&a.to<o&&(e[r]=null,(i||(i=[])).push(a));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[n+2].removeInner(i,t+1);s!=ig?r[n+2]=s:(r.splice(n,3),n-=3)}if(n.length)for(let r,i=0;i<e.length;i++)if(r=e[i])for(let e=0;e<n.length;e++)n[e].eq(r,a)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1));return r==this.children&&n==this.local?this:n.length||r.length?new ng(n,r):ig}forChild(e,a){if(this==ig)return this;if(a.isLeaf)return ng.empty;let r,n;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,t=i+a.content.size;for(let e=0;e<this.local.length;e++){let a=this.local[e];if(a.from<t&&a.to>i&&a.type instanceof Xm){let e=Math.max(i,a.from)-i,r=Math.min(t,a.to)-i;e<r&&(n||(n=[])).push(a.copy(e,r))}}if(n){let e=new ng(n.sort(dg),ag);return r?new tg([e,r]):e}return r||ig}eq(e){if(this==e)return!0;if(!(e instanceof ng)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let a=0;a<this.local.length;a++)if(!this.local[a].eq(e.local[a]))return!1;for(let a=0;a<this.children.length;a+=3)if(this.children[a]!=e.children[a]||this.children[a+1]!=e.children[a+1]||!this.children[a+2].eq(e.children[a+2]))return!1;return!0}locals(e){return ug(this.localsInner(e))}localsInner(e){if(this==ig)return ag;if(e.inlineContent||!this.local.some(Xm.is))return this.local;let a=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Xm||a.push(this.local[e]);return a}forEachSet(e){e(this)}}ng.empty=new ng([],[]),ng.removeOverlap=ug;const ig=ng.empty;class tg{constructor(e){this.members=e}map(e,a){const r=this.members.map((r=>r.map(e,a,rg)));return tg.from(r)}forChild(e,a){if(a.isLeaf)return ng.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,a);i!=ig&&(i instanceof tg?r=r.concat(i.members):r.push(i))}return tg.from(r)}eq(e){if(!(e instanceof tg)||e.members.length!=this.members.length)return!1;for(let a=0;a<this.members.length;a++)if(!this.members[a].eq(e.members[a]))return!1;return!0}locals(e){let a,r=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length)if(a){r&&(a=a.slice(),r=!1);for(let e=0;e<i.length;e++)a.push(i[e])}else a=i}return a?ug(r?a:a.sort(dg)):ag}static from(e){switch(e.length){case 0:return ig;case 1:return e[0];default:return new tg(e.every((e=>e instanceof ng))?e:e.reduce(((e,a)=>e.concat(a instanceof ng?a:a.members)),[]))}}forEachSet(e){for(let a=0;a<this.members.length;a++)this.members[a].forEachSet(e)}}function og(e,a){if(!a||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new eg(i.from+a,i.to+a,i.type))}return r}function sg(e,a,r){if(a.isLeaf)return null;let n=r+a.nodeSize,i=null;for(let a,t=0;t<e.length;t++)(a=e[t])&&a.from>r&&a.to<n&&((i||(i=[])).push(a),e[t]=null);return i}function lg(e){let a=[];for(let r=0;r<e.length;r++)null!=e[r]&&a.push(e[r]);return a}function cg(e,a,r,n){let i=[],t=!1;a.forEach(((a,o)=>{let s=sg(e,a,o+r);if(s){t=!0;let e=cg(s,a,r+o+1,n);e!=ig&&i.push(o,o+a.nodeSize,e)}}));let o=og(t?lg(e):e,-r).sort(dg);for(let e=0;e<o.length;e++)o[e].type.valid(a,o[e])||(n.onRemove&&n.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new ng(o,i):ig}function dg(e,a){return e.from-a.from||e.to-a.to}function ug(e){let a=e;for(let r=0;r<a.length-1;r++){let n=a[r];if(n.from!=n.to)for(let i=r+1;i<a.length;i++){let t=a[i];if(t.from!=n.from){t.from<n.to&&(a==e&&(a=e.slice()),a[r]=n.copy(n.from,t.from),hg(a,i,n.copy(t.from,n.to)));break}t.to!=n.to&&(a==e&&(a=e.slice()),a[i]=t.copy(t.from,n.to),hg(a,i+1,t.copy(n.to,t.to)))}}return a}function hg(e,a,r){for(;a<e.length&&dg(r,e[a])>0;)a++;e.splice(a,0,r)}function mg(e){let a=[];return e.someProp("decorations",(r=>{let n=r(e.state);n&&n!=ig&&a.push(n)})),e.cursorWrapper&&a.push(ng.create(e.state.doc,[e.cursorWrapper.deco])),tg.from(a)}const gg={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pg=Nu&&Iu<=11;class bg{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 fg{constructor(e,a){this.view=e,this.handleDOMChange=a,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bg,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let a=0;a<e.length;a++)this.queue.push(e[a]);Nu&&Iu<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),pg&&(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,gg)),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 a=0;a<e.length;a++)this.queue.push(e[a]);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(Zh(this.view)){if(this.suppressingSelectionUpdates)return Lh(this.view);if(Nu&&Iu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ju(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 a,r=new Set;for(let a=e.focusNode;a;a=vu(a))r.add(a);for(let n=e.anchorNode;n;n=vu(n))if(r.has(n)){a=n;break}let n=a&&this.view.docView.nearestDesc(a);return n&&n.ignoreMutation({type:"selection",target:3==a.nodeType?a.parentNode:a})?(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 a=this.pendingRecords();a.length&&(this.queue=[]);let r=e.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Zh(e)&&!this.ignoreSelectionChange(r),i=-1,t=-1,o=!1,s=[];if(e.editable)for(let e=0;e<a.length;e++){let r=this.registerMutation(a[e],s);r&&(i=i<0?r.from:Math.min(r.from,i),t=t<0?r.to:Math.max(r.to,t),r.typeOver&&(o=!0))}if(Fu&&s.length){let a=s.filter((e=>"BR"==e.nodeName));if(2==a.length){let[e,r]=a;e.parentNode&&e.parentNode.parentNode==r.parentNode?r.remove():e.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of a){let a=n.parentNode;!a||"LI"!=a.nodeName||r&&wg(e,r)==a||n.remove()}}}let l=null;i<0&&n&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Su(r)&&(l=Ph(e))&&l.eq(Jd.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Lh(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||n)&&(i>-1&&(e.docView.markDirty(i,t),function(e){if(kg.has(e))return;if(kg.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Fu,yg)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."),yg=!0}}(e)),this.handleDOMChange(i,t,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Lh(e),this.currentSelection.set(r))}registerMutation(e,a){if(a.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(r==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!r||r.ignoreMutation(e))return null;if("childList"==e.type){for(let r=0;r<e.addedNodes.length;r++){let n=e.addedNodes[r];a.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let n=e.previousSibling,i=e.nextSibling;if(Nu&&Iu<=11&&e.addedNodes.length)for(let a=0;a<e.addedNodes.length;a++){let{previousSibling:r,nextSibling:t}=e.addedNodes[a];(!r||Array.prototype.indexOf.call(e.addedNodes,r)<0)&&(n=r),(!t||Array.prototype.indexOf.call(e.addedNodes,t)<0)&&(i=t)}let t=n&&n.parentNode==e.target?yu(n)+1:0,o=r.localPosFromDOM(e.target,t,-1),s=i&&i.parentNode==e.target?yu(i):e.target.childNodes.length;return{from:o,to:r.localPosFromDOM(e.target,s,1)}}return"attributes"==e.type?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let kg=new WeakMap,yg=!1;function vg(e,a){let r=a.startContainer,n=a.startOffset,i=a.endContainer,t=a.endOffset,o=e.domAtPos(e.state.selection.anchor);return ju(o.node,o.offset,i,t)&&([r,n,i,t]=[i,t,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:t}}function wg(e,a){for(let r=a.parentNode;r&&r!=e.dom;r=r.parentNode){let a=e.docView.nearestDesc(r,!0);if(a&&a.node.isBlock)return r}return null}function zg(e){let a=e.pmViewDesc;if(a)return a.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Bu&&/^(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||Bu&&/^(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 jg=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function xg(e,a,r,n,i){let t=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,a<0){let a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,r=Ph(e,a);if(r&&!e.state.selection.eq(r)){if(Ru&&Uu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))))return;let n=e.state.tr.setSelection(r);"pointer"==a?n.setMeta("pointer",!0):"key"==a&&n.scrollIntoView(),t&&n.setMeta("composition",t),e.dispatch(n)}return}let o=e.state.doc.resolve(a),s=o.sharedDepth(r);a=o.before(s+1),r=e.state.doc.resolve(r).after(s+1);let l,c,d=e.state.selection,u=function(e,a,r){let n,{node:i,fromOffset:t,toOffset:o,from:s,to:l}=e.docView.parseRange(a,r),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(n=[{node:d,offset:c.anchorOffset}],Su(c)||n.push({node:c.focusNode,offset:c.focusOffset})),Ru&&8===e.input.lastKeyCode)for(let e=o;e>t;e--){let a=i.childNodes[e-1],r=a.pmViewDesc;if("BR"==a.nodeName&&!r){o=e;break}if(!r||r.size)break}let u=e.state.doc,h=e.someProp("domParser")||Hc.fromSchema(e.state.schema),m=u.resolve(s),g=null,p=h.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:t,to:o,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:n,ruleFromNode:zg,context:m});if(n&&null!=n[0].pos){let e=n[0].pos,a=n[1]&&n[1].pos;null==a&&(a=e),g={anchor:e+s,head:a+s}}return{doc:p,sel:g,from:s,to:l}}(e,a,r),h=e.state.doc,m=h.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let g=function(e,a,r,n,i){let t=e.findDiffStart(a,r);if(null==t)return null;let{a:o,b:s}=e.findDiffEnd(a,r+e.size,r+a.size);if("end"==i){n-=o+Math.max(0,t-Math.min(o,s))-t}if(o<t&&e.size<a.size){let e=n<=t&&n>=o?t-n:0;t-=e,t&&t<a.size&&Cg(a.textBetween(t-1,t+1))&&(t+=e?1:-1),s=t+(s-o),o=t}else if(s<t){let a=n<=t&&n>=s?t-n:0;t-=a,t&&t<e.size&&Cg(e.textBetween(t-1,t+1))&&(t+=a?1:-1),o=t+(o-s),s=t}return{start:t,endA:o,endB:s}}(m.content,u.doc.content,u.from,l,c);if(g&&e.input.domChangeCount++,(Vu&&e.input.lastIOSEnter>Date.now()-225||Uu)&&i.some((e=>1==e.nodeType&&!jg.test(e.nodeName)))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof eu&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let a=$g(e,e.state.doc,u.sel);if(a&&!a.eq(e.state.selection)){let r=e.state.tr.setSelection(a);t&&r.setMeta("composition",t),e.dispatch(r)}}return}g={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof eu&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Nu&&Iu<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>u.from&&" "==u.doc.textBetween(g.start-u.from-1,g.start-u.from+1)&&(g.start--,g.endA--,g.endB--);let p,b=u.doc.resolveNoCache(g.start-u.from),f=u.doc.resolveNoCache(g.endB-u.from),k=h.resolve(g.start),y=b.sameParent(f)&&b.parent.inlineContent&&k.end()>=g.endA;if((Vu&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!y&&b.pos<u.doc.content.size&&!b.sameParent(f)&&(p=Jd.findFrom(u.doc.resolve(b.pos+1),1,!0))&&p.head==f.pos)&&e.someProp("handleKeyDown",(a=>a(e,Ou(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>g.start&&function(e,a,r,n,i){if(r-a<=i.pos-n.pos||qg(n,!0,!1)<i.pos)return!1;let t=e.resolve(a);if(!n.parent.isTextblock){let e=t.nodeAfter;return null!=e&&r==a+e.nodeSize}if(t.parentOffset<t.parent.content.size||!t.parent.isTextblock)return!1;let o=e.resolve(qg(t,!0,!0));return!(!o.parent.isTextblock||o.pos>r||qg(o,!0,!1)<r)&&n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(h,g.start,g.endA,b,f)&&e.someProp("handleKeyDown",(a=>a(e,Ou(8,"Backspace")))))return void(Uu&&Ru&&e.domObserver.suppressSelectionUpdates());Ru&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),Uu&&!y&&b.start()!=f.start()&&0==f.parentOffset&&b.depth==f.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,f=u.doc.resolveNoCache(g.endB-u.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(a){return a(e,Ou(13,"Enter"))}))}),20));let v,w,z,j=g.start,x=g.endA;if(y)if(b.pos==f.pos)Nu&&Iu<=11&&0==b.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Lh(e)),20)),v=e.state.tr.delete(j,x),w=h.resolve(g.start).marksAcross(h.resolve(g.endA));else if(g.endA==g.endB&&(z=function(e,a){let r,n,i,t=e.firstChild.marks,o=a.firstChild.marks,s=t,l=o;for(let e=0;e<o.length;e++)s=o[e].removeFromSet(s);for(let e=0;e<t.length;e++)l=t[e].removeFromSet(l);if(1==s.length&&0==l.length)n=s[0],r="add",i=e=>e.mark(n.addToSet(e.marks));else{if(0!=s.length||1!=l.length)return null;n=l[0],r="remove",i=e=>e.mark(n.removeFromSet(e.marks))}let c=[];for(let e=0;e<a.childCount;e++)c.push(i(a.child(e)));if(Ql.from(c).eq(e))return{mark:n,type:r}}(b.parent.content.cut(b.parentOffset,f.parentOffset),k.parent.content.cut(k.parentOffset,g.endA-k.start()))))v=e.state.tr,"add"==z.type?v.addMark(j,x,z.mark):v.removeMark(j,x,z.mark);else if(b.parent.child(b.index()).isText&&b.index()==f.index()-(f.textOffset?0:1)){let a=b.parent.textBetween(b.parentOffset,f.parentOffset);if(e.someProp("handleTextInput",(r=>r(e,j,x,a))))return;v=e.state.tr.insertText(a,j,x)}if(v||(v=e.state.tr.replace(j,x,u.doc.slice(g.start-u.from,g.endB-u.from))),u.sel){let a=$g(e,v.doc,u.sel);a&&!(Ru&&e.composing&&a.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(a.head==j||a.head==v.mapping.map(x)-1)||Nu&&a.empty&&a.head==j)&&v.setSelection(a)}w&&v.ensureMarks(w),t&&v.setMeta("composition",t),e.dispatch(v.scrollIntoView())}function $g(e,a,r){return Math.max(r.anchor,r.head)>a.content.size?null:Kh(e,a.resolve(r.anchor),a.resolve(r.head))}function qg(e,a,r){let n=e.depth,i=a?e.end():e.pos;for(;n>0&&(a||e.indexAfter(n)==e.node(n).childCount);)n--,i++,a=!1;if(r){let a=e.node(n).maybeChild(e.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Cg(e){if(2!=e.length)return!1;let a=e.charCodeAt(0),r=e.charCodeAt(1);return a>=56320&&a<=57343&&r>=55296&&r<=56319}class Sg{constructor(e,a){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 $m,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=a,this.state=a.state,this.directPlugins=a.plugins||[],this.directPlugins.forEach(Ag),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=Mg(this),Eg(this),this.nodeViews=_g(this),this.docView=jh(this.state.doc,Og(this),mg(this),this.dom,this),this.domObserver=new fg(this,((e,a,r,n)=>xg(this,e,a,r,n))),this.domObserver.start(),function(e){for(let a in zm){let r=zm[a];e.dom.addEventListener(a,e.input.eventHandlers[a]=a=>{!Om(e,a)||Sm(e,a)||!e.editable&&a.type in jm||r(e,a)},xm[a]?{passive:!0}:void 0)}Bu&&e.dom.addEventListener("input",(()=>null)),Cm(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 a in e)this._props[a]=e[a];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Cm(this);let a=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ag),this.directPlugins=e.plugins),this.updateStateInner(e.state,a)}setProps(e){let a={};for(let e in this._props)a[e]=this._props[e];a.state=this.state;for(let r in e)a[r]=e[r];this.update(a)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,a){var r;let n=this.state,i=!1,t=!1;e.storedMarks&&this.composing&&(Bm(this),t=!0),this.state=e;let o=n.plugins!=e.plugins||this._props.plugins!=a.plugins;if(o||this._props.plugins!=a.plugins||this._props.nodeViews!=a.nodeViews){let e=_g(this);(function(e,a){let r=0,n=0;for(let n in e){if(e[n]!=a[n])return!0;r++}for(let e in a)n++;return r!=n})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||a.handleDOMEvents!=this._props.handleDOMEvents)&&Cm(this),this.editable=Mg(this),Eg(this);let s=mg(this),l=Og(this),c=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(n.selection)||(t=!0);let u="preserve"==c&&t&&null==this.dom.style.overflowAnchor&&function(e){let a,r,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let t=(n.left+n.right)/2,o=i+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=e.root.elementFromPoint(t,o);if(!n||n==e.dom||!e.dom.contains(n))continue;let s=n.getBoundingClientRect();if(s.top>=i-20){a=n,r=s.top;break}}return{refDOM:a,refTop:r,stack:Qu(e.dom)}}(this);if(t){this.domObserver.stop();let a=d&&(Nu||Ru)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,a){let r=Math.min(e.$anchor.sharedDepth(e.head),a.$anchor.sharedDepth(a.head));return e.$anchor.start(r)!=a.$anchor.start(r)}(n.selection,e.selection);if(d){let r=Ru?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Vm(this)),!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=jh(e.doc,l,s,this.dom,this)),r&&!this.trackWrites&&(a=!0)}a||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let a=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return ju(a.node,a.offset,r.anchorNode,r.anchorOffset)}(this))?Lh(this,a):(Uh(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),(null===(r=this.dragging)||void 0===r?void 0:r.node)&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:a,stack:r}){let n=e?e.getBoundingClientRect().top:0;eh(r,0==n?0:n-a)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof ru){let a=this.docView.domAfterPos(this.state.selection.from);1==a.nodeType&&Xu(this,a.getBoundingClientRect(),e)}else Xu(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 a=0;a<this.pluginViews.length;a++){let r=this.pluginViews[a];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let a=this.directPlugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let a=this.state.plugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}updateDraggedNode(e,a){let r=e.node,n=-1;if(this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let e=r.from+(this.state.doc.content.size-a.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==r.node&&(n=e)}this.dragging=new Km(e.slice,e.move,n<0?void 0:ru.create(this.state.doc,n))}someProp(e,a){let r,n=this._props&&this._props[e];if(null!=n&&(r=a?a(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=a?a(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let t=i[n].props[e];if(null!=t&&(r=a?a(t):t))return r}}hasFocus(){if(Nu){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(ah)return e.focus(ah);let a=Qu(e);e.focus(null==ah?{get preventScroll(){return ah={preventScroll:!0},!0}}:void 0),ah||(ah=!1,eh(a,0))}(this.dom),Lh(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 th(this,e)}coordsAtPos(e,a=1){return ch(this,e,a)}domAtPos(e,a=0){return this.docView.domFromPos(e,a)}nodeDOM(e){let a=this.docView.descAt(e);return a?a.nodeDOM:null}posAtDOM(e,a,r=-1){let n=this.docView.posFromDOM(e,a,r);if(null==n)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(e,a){return fh(this,a||this.state,e)}pasteHTML(e,a){return Um(this,"",e,!1,a||new ClipboardEvent("paste"))}pasteText(e,a){return Um(this,e,null,!0,a||new ClipboardEvent("paste"))}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let a in e.input.eventHandlers)e.dom.removeEventListener(a,e.input.eventHandlers[a]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,wu=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,a){Sm(e,a)||!zm[a.type]||!e.editable&&a.type in jm||zm[a.type](e,a)}(this,e)}dispatch(e){let a=this._props.dispatchTransaction;a?a.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Bu&&11===this.root.nodeType&&function(e){let a=e.activeElement;for(;a&&a.shadowRoot;)a=a.shadowRoot.activeElement;return a}(this.dom.ownerDocument)==this.dom&&function(e,a){if(a.getComposedRanges){let r=a.getComposedRanges(e.root)[0];if(r)return vg(e,r)}let r;function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?vg(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Og(e){let a=Object.create(null);return a.class="ProseMirror",a.contenteditable=String(e.editable),e.someProp("attributes",(r=>{if("function"==typeof r&&(r=r(e.state)),r)for(let e in r)"class"==e?a.class+=" "+r[e]:"style"==e?a.style=(a.style?a.style+";":"")+r[e]:a[e]||"contenteditable"==e||"nodeName"==e||(a[e]=String(r[e]))})),a.translate||(a.translate="no"),[eg.node(0,e.state.doc.content.size,a)]}function Eg(e){if(e.markCursor){let a=document.createElement("img");a.className="ProseMirror-separator",a.setAttribute("mark-placeholder","true"),a.setAttribute("alt",""),e.cursorWrapper={dom:a,deco:eg.widget(e.state.selection.from,a,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Mg(e){return!e.someProp("editable",(a=>!1===a(e.state)))}function _g(e){let a=Object.create(null);function r(e){for(let r in e)Object.prototype.hasOwnProperty.call(a,r)||(a[r]=e[r])}return e.someProp("nodeViews",r),e.someProp("markViews",r),a}function Ag(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")}for(var Dg={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:"'"},Tg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ng="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ig="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Fg=0;Fg<10;Fg++)Dg[48+Fg]=Dg[96+Fg]=String(Fg);for(Fg=1;Fg<=24;Fg++)Dg[Fg+111]="F"+Fg;for(Fg=65;Fg<=90;Fg++)Dg[Fg]=String.fromCharCode(Fg+32),Tg[Fg]=String.fromCharCode(Fg);for(var Pg in Dg)Tg.hasOwnProperty(Pg)||(Tg[Pg]=Dg[Pg]);const Rg="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Lg(e){let a,r,n,i,t=e.split(/-(?!$)/),o=t[t.length-1];"Space"==o&&(o=" ");for(let e=0;e<t.length-1;e++){let o=t[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))a=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else{if(!/^mod$/i.test(o))throw new Error("Unrecognized modifier name: "+o);Rg?i=!0:r=!0}}return a&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),n&&(o="Shift-"+o),o}function Bg(e,a,r=!0){return a.altKey&&(e="Alt-"+e),a.ctrlKey&&(e="Ctrl-"+e),a.metaKey&&(e="Meta-"+e),r&&a.shiftKey&&(e="Shift-"+e),e}function Vg(e){let a=function(e){let a=Object.create(null);for(let r in e)a[Lg(r)]=e[r];return a}(e);return function(e,r){let n,i=function(e){var a=!(Ng&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Ig&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Tg:Dg)[e.keyCode]||e.key||"Unidentified";return"Esc"==a&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a}(r),t=a[Bg(i,r)];if(t&&t(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(r.shiftKey){let n=a[Bg(i,r,!1)];if(n&&n(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(n=Dg[r.keyCode])&&n!=i){let i=a[Bg(n,r)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}function Hg(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("backward",e):r.parentOffset>0)?null:r}function Wg(e,a,r){let n=a.nodeBefore,i=a.pos-1;for(;!n.isTextblock;i--){if(n.type.spec.isolating)return!1;let e=n.lastChild;if(!e)return!1;n=e}let t=a.nodeAfter,o=a.pos+1;for(;!t.isTextblock;o++){if(t.type.spec.isolating)return!1;let e=t.firstChild;if(!e)return!1;t=e}let s=Td(e.doc,i,o,tc.empty);if(!s||s.from!=i||s instanceof vd&&s.slice.size>=o-i)return!1;if(r){let a=e.tr.step(s);a.setSelection(eu.create(a.doc,i)),r(a.scrollIntoView())}return!0}function Ug(e,a,r=!1){for(let n=e;n;n="start"==a?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)return!1}return!1}function Gg(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){if(e.index(a)>0)return e.doc.resolve(e.before(a+1));if(e.node(a).type.spec.isolating)break}return null}function Kg(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)?null:r}function Zg(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){let r=e.node(a);if(e.index(a)+1<r.childCount)return e.doc.resolve(e.after(a+1));if(r.type.spec.isolating)break}return null}function Jg(e){for(let a=0;a<e.edgeCount;a++){let{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function Yg(e,a,r,n){let i,t,o=a.nodeBefore,s=a.nodeAfter,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&function(e,a,r){let n=a.nodeBefore,i=a.nodeAfter,t=a.index();return!(!(n&&i&&n.type.compatibleContent(i.type))||(!n.content.size&&a.parent.canReplace(t-1,t)?(r&&r(e.tr.delete(a.pos-n.nodeSize,a.pos).scrollIntoView()),0):!a.parent.canReplace(t,t+1)||!i.isTextblock&&!Md(e.doc,a.pos)||(r&&r(e.tr.join(a.pos).scrollIntoView()),0)))}(e,a,r))return!0;let c=!l&&a.parent.canReplace(a.index(),a.index()+1);if(c&&(i=(t=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&t.matchType(i[0]||s.type).validEnd){if(r){let n=a.pos+s.nodeSize,t=Ql.empty;for(let e=i.length-1;e>=0;e--)t=Ql.from(i[e].create(null,t));t=Ql.from(o.copy(t));let l=e.tr.step(new wd(a.pos-1,n,a.pos,n,new tc(t,1,0),i.length,!0)),c=l.doc.resolve(n+2*i.length);c.nodeAfter&&c.nodeAfter.type==o.type&&Md(l.doc,c.pos)&&l.join(c.pos),r(l.scrollIntoView())}return!0}let d=s.type.spec.isolating||n>0&&l?null:Jd.findFrom(a,1),u=d&&d.$from.blockRange(d.$to),h=u&&$d(u);if(null!=h&&h>=a.depth)return r&&r(e.tr.lift(u,h).scrollIntoView()),!0;if(c&&Ug(s,"start",!0)&&Ug(o,"end")){let n=o,i=[];for(;i.push(n),!n.isTextblock;)n=n.lastChild;let t=s,l=1;for(;!t.isTextblock;t=t.firstChild)l++;if(n.canReplace(n.childCount,n.childCount,t.content)){if(r){let n=Ql.empty;for(let e=i.length-1;e>=0;e--)n=Ql.from(i[e].copy(n));r(e.tr.step(new wd(a.pos-i.length,a.pos+s.nodeSize,a.pos+l,a.pos+s.nodeSize-l,new tc(n,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Xg(e){return function(a,r){let n=a.selection,i=e<0?n.$from:n.$to,t=i.depth;for(;i.node(t).isInline;){if(!t)return!1;t--}return!!i.node(t).isTextblock&&(r&&r(a.tr.setSelection(eu.create(a.doc,e<0?i.start(t):i.end(t)))),!0)}}const Qg=Xg(-1),ep=Xg(1);function ap(e,a=null){return function(r,n){let i=!1;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(t,o,((n,t)=>{if(i)return!1;if(n.isTextblock&&!n.hasMarkup(e,a))if(n.type==e)i=!0;else{let a=r.doc.resolve(t),n=a.index();i=a.parent.canReplaceWith(n,n+1,e)}}))}if(!i)return!1;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(t,o,e,a)}n(i.scrollIntoView())}return!0}}function rp(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t);if(!o)return!1;let s=n?r.tr:null;return!!function(e,a,r,n=null){let i=!1,t=a,o=a.$from.doc;if(a.depth>=2&&a.$from.node(a.depth-1).type.compatibleContent(r)&&0==a.startIndex){if(0==a.$from.index(a.depth-1))return!1;let e=o.resolve(a.start-2);t=new wc(e,e,a.depth),a.endIndex<a.parent.childCount&&(a=new wc(a.$from,o.resolve(a.$to.end(a.depth)),a.depth)),i=!0}let s=qd(t,r,n,a);if(!s)return!1;e&&function(e,a,r,n,i){let t=Ql.empty;for(let e=r.length-1;e>=0;e--)t=Ql.from(r[e].type.create(r[e].attrs,t));e.step(new wd(a.start-(n?2:0),a.end,a.start,a.end,new tc(t,0,0),r.length,!0));let o=0;for(let e=0;e<r.length;e++)r[e].type==i&&(o=e+1);let s=r.length-o,l=a.start+r.length-(n?2:0),c=a.parent;for(let r=a.startIndex,n=a.endIndex,i=!0;r<n;r++,i=!1)!i&&Ed(e.doc,l,s)&&(e.split(l,s),l+=2*s),l+=c.child(r).nodeSize}(e,a,s,i,r);return!0}(s,o,e,a)&&(n&&n(s.scrollIntoView()),!0)}}function np(e){return function(a,r){let{$from:n,$to:i}=a.selection,t=n.blockRange(i,(a=>a.childCount>0&&a.firstChild.type==e));return!!t&&(!r||(n.node(t.depth-1).type==e?function(e,a,r,n){let i=e.tr,t=n.end,o=n.$to.end(n.depth);t<o&&(i.step(new wd(t-1,o,t,o,new tc(Ql.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new wc(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const s=$d(n);if(null==s)return!1;i.lift(n,s);let l=i.mapping.map(t,-1)-1;Md(i.doc,l)&&i.join(l);return a(i.scrollIntoView()),!0}(a,r,e,t):function(e,a,r){let n=e.tr,i=r.parent;for(let e=r.end,a=r.endIndex-1,t=r.startIndex;a>t;a--)e-=i.child(a).nodeSize,n.delete(e-1,e+1);let t=n.doc.resolve(r.start),o=t.nodeAfter;if(n.mapping.map(r.end)!=r.start+t.nodeAfter.nodeSize)return!1;let s=0==r.startIndex,l=r.endIndex==i.childCount,c=t.node(-1),d=t.index(-1);if(!c.canReplace(d+(s?0:1),d+1,o.content.append(l?Ql.empty:Ql.from(i))))return!1;let u=t.pos,h=u+o.nodeSize;return n.step(new wd(u-(s?1:0),h+(l?1:0),u+1,h-1,new tc((s?Ql.empty:Ql.from(i.copy(Ql.empty))).append(l?Ql.empty:Ql.from(i.copy(Ql.empty))),s?0:1,l?0:1),s?0:1)),a(n.scrollIntoView()),!0}(a,r,t)))}}function ip(e){const{state:a,transaction:r}=e;let{selection:n}=r,{doc:i}=r,{storedMarks:t}=r;return{...a,apply:a.apply.bind(a),applyTransaction:a.applyTransaction.bind(a),plugins:a.plugins,schema:a.schema,reconfigure:a.reconfigure.bind(a),toJSON:a.toJSON.bind(a),get storedMarks(){return t},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,t=r.storedMarks,r}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class tp{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:a,state:r}=this,{view:n}=a,{tr:i}=r,t=this.buildProps(i);return Object.fromEntries(Object.entries(e).map((([e,a])=>[e,(...e)=>{const r=a(...e)(t);return i.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(i),r}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o=[],s=!!e,l=e||i.tr,c={...Object.fromEntries(Object.entries(r).map((([e,r])=>[e,(...e)=>{const n=this.buildProps(l,a),i=r(...e)(n);return o.push(i),c}]))),run:()=>(s||!a||l.getMeta("preventDispatch")||this.hasCustomState||t.dispatch(l),o.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:a,state:r}=this,n=!1,i=e||r.tr,t=this.buildProps(i,n),o=Object.fromEntries(Object.entries(a).map((([e,a])=>[e,(...e)=>a(...e)({...t,dispatch:void 0})])));return{...o,chain:()=>this.createChain(i,n)}}buildProps(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o={tr:e,editor:n,view:t,state:ip({state:i,transaction:e}),dispatch:a?()=>{}:void 0,chain:()=>this.createChain(e,a),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map((([e,a])=>[e,(...e)=>a(...e)(o)])))}};return o}}class op{constructor(){this.callbacks={}}on(e,a){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(a),this}emit(e,...a){const r=this.callbacks[e];return r&&r.forEach((e=>e.apply(this,a))),this}off(e,a){const r=this.callbacks[e];return r&&(a?this.callbacks[e]=r.filter((e=>e!==a)):delete this.callbacks[e]),this}once(e,a){const r=(...n)=>{this.off(e,r),a.apply(this,n)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function sp(e,a,r){if(void 0===e.config[a]&&e.parent)return sp(e.parent,a,r);if("function"==typeof e.config[a]){return e.config[a].bind({...r,parent:e.parent?sp(e.parent,a,r):null})}return e.config[a]}function lp(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function cp(e){const a=[],{nodeExtensions:r,markExtensions:n}=lp(e),i=[...r,...n],t={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const r=sp(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:i});if(!r)return;r().forEach((e=>{e.types.forEach((r=>{Object.entries(e.attributes).forEach((([e,n])=>{a.push({type:r,name:e,attribute:{...t,...n}})}))}))}))})),i.forEach((e=>{const r={name:e.name,options:e.options,storage:e.storage},n=sp(e,"addAttributes",r);if(!n)return;const i=n();Object.entries(i).forEach((([r,n])=>{const i={...t,...n};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,a.push({type:e.name,name:r,attribute:i})}))})),a}function dp(e,a){if("string"==typeof e){if(!a.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return a.nodes[e]}return e}function up(...e){return e.filter((e=>!!e)).reduce(((e,a)=>{const r={...e};return Object.entries(a).forEach((([e,a])=>{if(r[e])if("class"===e){const n=a?String(a).split(" "):[],i=r[e]?r[e].split(" "):[],t=n.filter((e=>!i.includes(e)));r[e]=[...i,...t].join(" ")}else if("style"===e){const n=a?a.split(";").map((e=>e.trim())).filter(Boolean):[],i=r[e]?r[e].split(";").map((e=>e.trim())).filter(Boolean):[],t=new Map;i.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),n.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),r[e]=Array.from(t.entries()).map((([e,a])=>`${e}: ${a}`)).join("; ")}else r[e]=a;else r[e]=a})),r}),{})}function hp(e,a){return a.filter((a=>a.type===e.type.name)).filter((e=>e.attribute.rendered)).map((a=>a.attribute.renderHTML?a.attribute.renderHTML(e.attrs)||{}:{[a.name]:e.attrs[a.name]})).reduce(((e,a)=>up(e,a)),{})}function mp(e){return"function"==typeof e}function gp(e,a=void 0,...r){return mp(e)?a?e.bind(a)(...r):e(...r):e}function pp(e,a){return"style"in e?e:{...e,getAttrs:r=>{const n=e.getAttrs?e.getAttrs(r):e.attrs;if(!1===n)return!1;const i=a.reduce(((e,a)=>{const n=a.attribute.parseHTML?a.attribute.parseHTML(r):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(r.getAttribute(a.name));return null==n?e:{...e,[a.name]:n}}),{});return{...n,...i}}}}function bp(e){return Object.fromEntries(Object.entries(e).filter((([e,a])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(a))&&null!=a)))}function fp(e,a){return a.nodes[e]||a.marks[e]||null}function kp(e,a){return Array.isArray(a)?a.some((a=>("string"==typeof a?a:a.name)===e.name)):a}function yp(e,a){const r=ed.fromSchema(a).serializeFragment(e),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(r),n.innerHTML}function vp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class wp{constructor(e){this.find=e.find,this.handler=e.handler}}function zp(e){var a;const{editor:r,from:n,to:i,text:t,rules:o,plugin:s}=e,{view:l}=r;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(null===(a=c.nodeBefore||c.nodeAfter)||void 0===a?void 0:a.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const u=((e,a=500)=>{let r="";const n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-a),n,((e,a,i,t)=>{var o,s;const l=(null===(s=(o=e.type.spec).toText)||void 0===s?void 0:s.call(o,{node:e,pos:a,parent:i,index:t}))||e.textContent||"%leaf%";r+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,n-a))})),r})(c)+t;return o.forEach((e=>{if(d)return;const a=((e,a)=>{if(vp(a))return a.exec(e);const r=a(e);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=e,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n})(u,e.find);if(!a)return;const o=l.state.tr,c=ip({state:l.state,transaction:o}),h={from:n-(a[0].length-t.length),to:i},{commands:m,chain:g,can:p}=new tp({editor:r,state:c});null!==e.handler({state:c,range:h,match:a,commands:m,chain:g,can:p})&&o.steps.length&&(o.setMeta(s,{transform:o,from:n,to:i,text:t}),l.dispatch(o),d=!0)})),d}function jp(e){const{editor:a,rules:r}=e,n=new pu({state:{init:()=>null,apply(e,i,t){const o=e.getMeta(n);if(o)return o;const s=e.getMeta("applyInputRules");return!!s&&setTimeout((()=>{let{text:e}=s;"string"==typeof e||(e=yp(Ql.from(e),t.schema));const{from:i}=s,o=i+e.length;zp({editor:a,from:i,to:o,text:e,rules:r,plugin:n})})),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,t,o)=>zp({editor:a,from:i,to:t,text:o,rules:r,plugin:n}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:i}=e.state.selection;i&&zp({editor:a,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})})),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;const{$cursor:t}=e.state.selection;return!!t&&zp({editor:a,from:t.pos,to:t.pos,text:"\n",rules:r,plugin:n})}},isInputRules:!0});return n}function xp(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function $p(e,a){const r={...e};return xp(e)&&xp(a)&&Object.keys(a).forEach((n=>{xp(a[n])&&xp(e[n])?r[n]=$p(e[n],a[n]):r[n]=a[n]})),r}class qp{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=gp(sp(this,"addOptions",{name:this.name}))),this.storage=gp(sp(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new qp(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>$p(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new qp(e);return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=gp(sp(a,"addOptions",{name:a.name})),a.storage=gp(sp(a,"addStorage",{name:a.name,options:a.options})),a}static handleExit({editor:e,mark:a}){const{tr:r}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){const i=n.marks();if(!!!i.find((e=>(null==e?void 0:e.type.name)===a.name)))return!1;const t=i.find((e=>(null==e?void 0:e.type.name)===a.name));return t&&r.removeStoredMark(t),r.insertText(" ",n.pos),e.view.dispatch(r),!0}return!1}}class Cp{constructor(e){this.find=e.find,this.handler=e.handler}}function Sp(e){const{editor:a,state:r,from:n,to:i,rule:t,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:c,can:d}=new tp({editor:a,state:r}),u=[];r.doc.nodesBetween(n,i,((e,a)=>{if(!e.isTextblock||e.type.spec.code)return;const h=Math.max(n,a),m=Math.min(i,a+e.content.size),g=((e,a,r)=>{if(vp(a))return[...e.matchAll(a)];const n=a(e,r);return n?n.map((a=>{const r=[a.text];return r.index=a.index,r.input=e,r.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(a.replaceWith)),r})):[]})(e.textBetween(h-a,m-a,void 0,""),t.find,o);g.forEach((e=>{if(void 0===e.index)return;const a=h+e.index+1,n=a+e[0].length,i={from:r.tr.mapping.map(a),to:r.tr.mapping.map(n)},m=t.handler({state:r,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:s});u.push(m)}))}));const h=u.every((e=>null!==e));return h}let Op=null;function Ep(e){const{editor:a,rules:r}=e;let n,i=null,t=!1,o=!1,s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}const l=({state:e,from:r,to:i,rule:t,pasteEvt:o})=>{const l=e.tr,c=ip({state:e,transaction:l});if(Sp({editor:a,state:c,from:Math.max(r-1,0),to:i.b-1,rule:t,pasteEvent:o,dropEvent:n})&&l.steps.length){try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}return s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}},c=r.map((e=>new pu({view(e){const r=r=>{var n;i=(null===(n=e.dom.parentElement)||void 0===n?void 0:n.contains(r.target))?e.dom.parentElement:null,i&&(Op=a)},n=()=>{Op&&(Op=null)};return window.addEventListener("dragstart",r),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",r),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,a)=>{if(o=i===e.dom.parentElement,n=a,!o){const e=Op;e&&setTimeout((()=>{const a=e.state.selection;a&&e.commands.deleteRange({from:a.from,to:a.to})}),10)}return!1},paste:(e,a)=>{var r;const n=null===(r=a.clipboardData)||void 0===r?void 0:r.getData("text/html");return s=a,t=!!(null==n?void 0:n.includes("data-pm-slice")),!1}}},appendTransaction:(a,r,n)=>{const i=a[0],c="paste"===i.getMeta("uiEvent")&&!t,d="drop"===i.getMeta("uiEvent")&&!o,u=i.getMeta("applyPasteRules"),h=!!u;if(!c&&!d&&!h)return;if(h){let{text:a}=u;"string"==typeof a||(a=yp(Ql.from(a),n.schema));const{from:r}=u,i=r+a.length,t=(e=>{var a;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(a=r.clipboardData)||void 0===a||a.setData("text/html",e),r})(a);return l({rule:e,state:n,from:r,to:{b:i},pasteEvt:t})}const m=r.doc.content.findDiffStart(n.doc.content),g=r.doc.content.findDiffEnd(n.doc.content);return"number"==typeof m&&g&&m!==g.b?l({rule:e,state:n,from:m,to:g,pasteEvt:s}):void 0}})));return c}class Mp{constructor(e,a){this.splittableMarks=[],this.editor=a,this.extensions=Mp.resolve(e),this.schema=function(e,a){var r;const n=cp(e),{nodeExtensions:i,markExtensions:t}=lp(e),o=null===(r=i.find((e=>sp(e,"topNode"))))||void 0===r?void 0:r.name,s=Object.fromEntries(i.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=bp({...e.reduce(((e,a)=>{const n=sp(a,"extendNodeSchema",t);return{...e,...n?n(r):{}}}),{}),content:gp(sp(r,"content",t)),marks:gp(sp(r,"marks",t)),group:gp(sp(r,"group",t)),inline:gp(sp(r,"inline",t)),atom:gp(sp(r,"atom",t)),selectable:gp(sp(r,"selectable",t)),draggable:gp(sp(r,"draggable",t)),code:gp(sp(r,"code",t)),whitespace:gp(sp(r,"whitespace",t)),linebreakReplacement:gp(sp(r,"linebreakReplacement",t)),defining:gp(sp(r,"defining",t)),isolating:gp(sp(r,"isolating",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=gp(sp(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>pp(e,i))));const l=sp(r,"renderHTML",t);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:hp(e,i)}));const c=sp(r,"renderText",t);return c&&(o.toText=c),[r.name,o]}))),l=Object.fromEntries(t.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=bp({...e.reduce(((e,a)=>{const n=sp(a,"extendMarkSchema",t);return{...e,...n?n(r):{}}}),{}),inclusive:gp(sp(r,"inclusive",t)),excludes:gp(sp(r,"excludes",t)),group:gp(sp(r,"group",t)),spanning:gp(sp(r,"spanning",t)),code:gp(sp(r,"code",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=gp(sp(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>pp(e,i))));const l=sp(r,"renderHTML",t);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:hp(e,i)})),[r.name,o]})));return new Bc({topNode:o,nodes:s,marks:l})}(this.extensions,a),this.setupExtensions()}static resolve(e){const a=Mp.sort(Mp.flatten(e)),r=function(e){const a=e.filter(((a,r)=>e.indexOf(a)!==r));return Array.from(new Set(a))}(a.map((e=>e.name)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),a}static flatten(e){return e.map((e=>{const a=sp(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return a?[e,...this.flatten(a())]:e})).flat(10)}static sort(e){return e.sort(((e,a)=>{const r=sp(e,"priority")||100,n=sp(a,"priority")||100;return r>n?-1:r<n?1:0}))}get commands(){return this.extensions.reduce(((e,a)=>{const r=sp(a,"addCommands",{name:a.name,options:a.options,storage:a.storage,editor:this.editor,type:fp(a.name,this.schema)});return r?{...e,...r()}:e}),{})}get plugins(){const{editor:e}=this,a=Mp.sort([...this.extensions].reverse()),r=[],n=[],i=a.map((a=>{const i={name:a.name,options:a.options,storage:a.storage,editor:e,type:fp(a.name,this.schema)},t=[],o=sp(a,"addKeyboardShortcuts",i);let s={};if("mark"===a.type&&sp(a,"exitable",i)&&(s.ArrowRight=()=>qp.handleExit({editor:e,mark:a})),o){const a=Object.fromEntries(Object.entries(o()).map((([a,r])=>[a,()=>r({editor:e})])));s={...s,...a}}const l=new pu({props:{handleKeyDown:Vg(s)}});t.push(l);const c=sp(a,"addInputRules",i);kp(a,e.options.enableInputRules)&&c&&r.push(...c());const d=sp(a,"addPasteRules",i);kp(a,e.options.enablePasteRules)&&d&&n.push(...d());const u=sp(a,"addProseMirrorPlugins",i);if(u){const e=u();t.push(...e)}return t})).flat();return[jp({editor:e,rules:r}),...Ep({editor:e,rules:n}),...i]}get attributes(){return cp(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:a}=lp(this.extensions);return Object.fromEntries(a.filter((e=>!!sp(e,"addNodeView"))).map((a=>{const r=this.attributes.filter((e=>e.type===a.name)),n={name:a.name,options:a.options,storage:a.storage,editor:e,type:dp(a.name,this.schema)},i=sp(a,"addNodeView",n);if(!i)return[];return[a.name,(n,t,o,s,l)=>{const c=hp(n,r);return i()({node:n,view:t,getPos:o,decorations:s,innerDecorations:l,editor:e,extension:a,HTMLAttributes:c})}]})))}setupExtensions(){this.extensions.forEach((e=>{var a;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:fp(e.name,this.schema)};if("mark"===e.type){(null===(a=gp(sp(e,"keepOnSplit",r)))||void 0===a||a)&&this.splittableMarks.push(e.name)}const n=sp(e,"onBeforeCreate",r),i=sp(e,"onCreate",r),t=sp(e,"onUpdate",r),o=sp(e,"onSelectionUpdate",r),s=sp(e,"onTransaction",r),l=sp(e,"onFocus",r),c=sp(e,"onBlur",r),d=sp(e,"onDestroy",r);n&&this.editor.on("beforeCreate",n),i&&this.editor.on("create",i),t&&this.editor.on("update",t),o&&this.editor.on("selectionUpdate",o),s&&this.editor.on("transaction",s),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class _p{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=gp(sp(this,"addOptions",{name:this.name}))),this.storage=gp(sp(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new _p(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>$p(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new _p({...this.config,...e});return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=gp(sp(a,"addOptions",{name:a.name})),a.storage=gp(sp(a,"addStorage",{name:a.name,options:a.options})),a}}function Ap(e,a,r){const{from:n,to:i}=a,{blockSeparator:t="\n\n",textSerializers:o={}}=r||{};let s="";return e.nodesBetween(n,i,((e,r,l,c)=>{var d;e.isBlock&&r>n&&(s+=t);const u=null==o?void 0:o[e.type.name];if(u)return l&&(s+=u({node:e,pos:r,parent:l,index:c,range:a})),!1;e.isText&&(s+=null===(d=null==e?void 0:e.text)||void 0===d?void 0:d.slice(Math.max(n,r)-r,i-r))})),s}function Dp(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,a])=>[e,a.spec.toText])))}const Tp=_p.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new pu({key:new ku("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:a,schema:r}=e,{doc:n,selection:i}=a,{ranges:t}=i,o=Math.min(...t.map((e=>e.$from.pos))),s=Math.max(...t.map((e=>e.$to.pos))),l=Dp(r);return Ap(n,{from:o,to:s},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function Np(e,a,r={strict:!0}){const n=Object.keys(a);return!n.length||n.every((n=>r.strict?a[n]===e[n]:vp(a[n])?a[n].test(e[n]):a[n]===e[n]))}function Ip(e,a,r={}){return e.find((e=>e.type===a&&Np(Object.fromEntries(Object.keys(r).map((a=>[a,e.attrs[a]]))),r)))}function Fp(e,a,r={}){return!!Ip(e,a,r)}function Pp(e,a,r){var n;if(!e||!a)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some((e=>e.type===a))||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some((e=>e.type===a)))return;r=r||(null===(n=i.node.marks[0])||void 0===n?void 0:n.attrs);if(!Ip([...i.node.marks],a,r))return;let t=i.index,o=e.start()+i.offset,s=t+1,l=o+i.node.nodeSize;for(;t>0&&Fp([...e.parent.child(t-1).marks],a,r);)t-=1,o-=e.parent.child(t).nodeSize;for(;s<e.parent.childCount&&Fp([...e.parent.child(s).marks],a,r);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function Rp(e,a){if("string"==typeof e){if(!a.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return a.marks[e]}return e}function Lp(e){return e instanceof eu}function Bp(e=0,a=0,r=0){return Math.min(Math.max(e,a),r)}function Vp(e,a=null){if(!a)return null;const r=Jd.atStart(e),n=Jd.atEnd(e);if("start"===a||!0===a)return r;if("end"===a)return n;const i=r.from,t=n.to;return"all"===a?eu.create(e,Bp(0,i,t),Bp(e.content.size,i,t)):eu.create(e,Bp(a,i,t),Bp(a,i,t))}const Hp=e=>{const a=e.childNodes;for(let r=a.length-1;r>=0;r-=1){const n=a[r];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):1===n.nodeType&&Hp(n)}return e};function Wp(e){const a=`<body>${e}</body>`,r=(new window.DOMParser).parseFromString(a,"text/html").body;return Hp(r)}function Up(e,a,r){if(e instanceof jc||e instanceof Ql)return e;r={slice:!0,parseOptions:{},...r};const n="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Ql.fromArray(e.map((e=>a.nodeFromJSON(e))));const n=a.nodeFromJSON(e);return r.errorOnInvalidContent&&n.check(),n}catch(n){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),Up("",a,r)}if(n){if(r.errorOnInvalidContent){let n=!1,i="";const t=new Bc({topNode:a.spec.topNode,marks:a.spec.marks,nodes:a.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(n=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(r.slice?Hc.fromSchema(t).parseSlice(Wp(e),r.parseOptions):Hc.fromSchema(t).parse(Wp(e),r.parseOptions),r.errorOnInvalidContent&&n)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const n=Hc.fromSchema(a);return r.slice?n.parseSlice(Wp(e),r.parseOptions).content:n.parse(Wp(e),r.parseOptions)}return Up("",a,r)}function Gp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Kp(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Zp(e,a,r={}){const{from:n,to:i,empty:t}=e.selection,o=a?dp(a,e.schema):null,s=[];e.doc.nodesBetween(n,i,((e,a)=>{if(e.isText)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);s.push({node:e,from:r,to:t})}));const l=i-n,c=s.filter((e=>!o||o.name===e.node.type.name)).filter((e=>Np(e.node.attrs,r,{strict:!1})));if(t)return!!c.length;return c.reduce(((e,a)=>e+a.to-a.from),0)>=l}function Jp(e,a){return a.nodes[e]?"node":a.marks[e]?"mark":null}function Yp(e,a){const r="string"==typeof a?[a]:a;return Object.keys(e).reduce(((a,n)=>(r.includes(n)||(a[n]=e[n]),a)),{})}function Xp(e,a,r={},n={}){return Up(e,a,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}function Qp(e,a){const r=Rp(a,e.schema),{from:n,to:i,empty:t}=e.selection,o=[];t?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,i,(e=>{o.push(...e.marks)}));const s=o.find((e=>e.type.name===r.name));return s?{...s.attrs}:{}}function eb(e){return a=>function(e,a){for(let r=e.depth;r>0;r-=1){const n=e.node(r);if(a(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}(a.$from,e)}function ab(e,a){const r=Jp("string"==typeof a?a:a.name,e.schema);return"node"===r?function(e,a){const r=dp(a,e.schema),{from:n,to:i}=e.selection,t=[];e.doc.nodesBetween(n,i,(e=>{t.push(e)}));const o=t.reverse().find((e=>e.type.name===r.name));return o?{...o.attrs}:{}}(e,a):"mark"===r?Qp(e,a):{}}function rb(e,a,r){const n=[];return e===a?r.resolve(e).marks().forEach((a=>{const i=Pp(r.resolve(e),a.type);i&&n.push({mark:a,...i})})):r.nodesBetween(e,a,((e,a)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&n.push(...e.marks.map((r=>({from:a,to:a+e.nodeSize,mark:r}))))})),n}function nb(e,a,r){return Object.fromEntries(Object.entries(r).filter((([r])=>{const n=e.find((e=>e.type===a&&e.name===r));return!!n&&n.attribute.keepOnSplit})))}function ib(e,a,r={}){const{empty:n,ranges:i}=e.selection,t=a?Rp(a,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!t||t.name===e.type.name)).find((e=>Np(e.attrs,r,{strict:!1})));let o=0;const s=[];if(i.forEach((({$from:a,$to:r})=>{const n=a.pos,i=r.pos;e.doc.nodesBetween(n,i,((e,a)=>{if(!e.isText&&!e.marks.length)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);o+=t-r,s.push(...e.marks.map((e=>({mark:e,from:r,to:t}))))}))})),0===o)return!1;const l=s.filter((e=>!t||t.name===e.mark.type.name)).filter((e=>Np(e.mark.attrs,r,{strict:!1}))).reduce(((e,a)=>e+a.to-a.from),0),c=s.filter((e=>!t||e.mark.type!==t&&e.mark.type.excludes(t))).reduce(((e,a)=>e+a.to-a.from),0);return(l>0?l+c:l)>=o}function tb(e,a){const{nodeExtensions:r}=lp(a),n=r.find((a=>a.name===e));if(!n)return!1;const i=gp(sp(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function ob(e,{checkChildren:a=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!==(n=e.text)&&void 0!==n?n:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(a){let n=!0;return e.content.forEach((e=>{!1!==n&&(ob(e,{ignoreWhitespace:r,checkChildren:a})||(n=!1))})),n}return!1}function sb(e,a){const r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){const n=r.filter((e=>null==a?void 0:a.includes(e.type.name)));e.tr.ensureMarks(n)}}const lb=(e,a)=>{const r=eb((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Md(e.doc,r.pos)||(e.join(r.pos),!0)},cb=(e,a)=>{const r=eb((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(r.start).after(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Md(e.doc,n)||(e.join(n),!0)};var db=Object.freeze({__proto__:null,blur:()=>({editor:e,view:a})=>(requestAnimationFrame((()=>{var r;e.isDestroyed||(a.dom.blur(),null===(r=null===window||void 0===window?void 0:window.getSelection())||void 0===r||r.removeAllRanges())})),!0),clearContent:(e=!1)=>({commands:a})=>a.setContent("",e),clearNodes:()=>({state:e,tr:a,dispatch:r})=>{const{selection:n}=a,{ranges:i}=n;return!r||(i.forEach((({$from:r,$to:n})=>{e.doc.nodesBetween(r.pos,n.pos,((e,r)=>{if(e.type.isText)return;const{doc:n,mapping:i}=a,t=n.resolve(i.map(r)),o=n.resolve(i.map(r+e.nodeSize)),s=t.blockRange(o);if(!s)return;const l=$d(s);if(e.type.isTextblock){const{defaultType:e}=t.parent.contentMatchAt(t.index());a.setNodeMarkup(s.start,e)}(l||0===l)&&a.lift(s,l)}))})),!0)},command:e=>a=>e(a),createParagraphNear:()=>({state:e,dispatch:a})=>((e,a)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof iu||n.parent.inlineContent||i.parent.inlineContent)return!1;let t=Jg(i.parent.contentMatchAt(i.indexAfter()));if(!t||!t.isTextblock)return!1;if(a){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(r,t.createAndFill());o.setSelection(eu.create(o.doc,r+1)),a(o.scrollIntoView())}return!0})(e,a),cut:(e,a)=>({editor:r,tr:n})=>{const{state:i}=r,t=i.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);const o=n.mapping.map(a);return n.insert(o,t.content),n.setSelection(new eu(n.doc.resolve(o-1))),!0},deleteCurrentNode:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return!1;const i=e.selection.$anchor;for(let r=i.depth;r>0;r-=1){if(i.node(r).type===n.type){if(a){const a=i.before(r),n=i.after(r);e.delete(a,n).scrollIntoView()}return!0}}return!1},deleteNode:e=>({tr:a,state:r,dispatch:n})=>{const i=dp(e,r.schema),t=a.selection.$anchor;for(let e=t.depth;e>0;e-=1){if(t.node(e).type===i){if(n){const r=t.before(e),n=t.after(e);a.delete(r,n).scrollIntoView()}return!0}}return!1},deleteRange:e=>({tr:a,dispatch:r})=>{const{from:n,to:i}=e;return r&&a.delete(n,i),!0},deleteSelection:()=>({state:e,dispatch:a})=>((e,a)=>!e.selection.empty&&(a&&a(e.tr.deleteSelection().scrollIntoView()),!0))(e,a),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),t=r.indexAfter(-1),o=Jg(i.contentMatchAt(t));if(!o||!i.canReplaceWith(t,t,o))return!1;if(a){let n=r.after(),i=e.tr.replaceWith(n,n,o.createAndFill());i.setSelection(Jd.near(i.doc.resolve(n),1)),a(i.scrollIntoView())}return!0})(e,a),extendMarkRange:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const t=Rp(e,n.schema),{doc:o,selection:s}=r,{$from:l,from:c,to:d}=s;if(i){const e=Pp(l,t,a);if(e&&e.from<=c&&e.to>=d){const a=eu.create(o,e.from,e.to);r.setSelection(a)}}return!0},first:e=>a=>{const r="function"==typeof e?e(a):e;for(let e=0;e<r.length;e+=1)if(r[e](a))return!0;return!1},focus:(e=null,a={})=>({editor:r,view:n,tr:i,dispatch:t})=>{a={scrollIntoView:!0,...a};const o=()=>{n.dom.focus(),requestAnimationFrame((()=>{r.isDestroyed||(n.focus(),(null==a?void 0:a.scrollIntoView)&&r.commands.scrollIntoView())}))};if(n.hasFocus()&&null===e||!1===e)return!0;if(t&&null===e&&!Lp(r.state.selection))return o(),!0;const s=Vp(i.doc,e)||r.state.selection,l=r.state.selection.eq(s);return t&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},forEach:(e,a)=>r=>e.every(((e,n)=>a(e,{...r,index:n}))),insertContent:(e,a)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,a),insertContentAt:(e,a,r)=>({tr:n,dispatch:i,editor:t})=>{var o;if(i){let i;r={parseOptions:t.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};try{i=Up(a,t.schema,{parseOptions:{preserveWhitespace:"full",...r.parseOptions},errorOnInvalidContent:null!==(o=r.errorOnInvalidContent)&&void 0!==o?o:t.options.enableContentCheck})}catch(e){return t.emit("contentError",{editor:t,error:e,disableCollaboration:()=>{t.storage.collaboration&&(t.storage.collaboration.isDisabled=!0)}}),!1}let{from:s,to:l}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},c=!0,d=!0;if(("type"in i?[i]:i).forEach((e=>{e.check(),c=!!c&&(e.isText&&0===e.marks.length),d=!!d&&e.isBlock})),s===l&&d){const{parent:e}=n.doc.resolve(s);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(s-=1,l+=1)}let u;if(c){if(Array.isArray(a))u=a.map((e=>e.text||"")).join("");else if(a instanceof Ql){let e="";a.forEach((a=>{a.text&&(e+=a.text)})),u=e}else u="object"==typeof a&&a&&a.text?a.text:a;n.insertText(u,s,l)}else u=i,n.replaceWith(s,l,u);r.updateSelection&&function(e,a,r){const n=e.steps.length-1;if(n<a)return;const i=e.steps[n];if(!(i instanceof vd||i instanceof wd))return;const t=e.mapping.maps[n];let o=0;t.forEach(((e,a,r,n)=>{0===o&&(o=n)})),e.setSelection(Jd.near(e.doc.resolve(o),r))}(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:s,text:u}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:s,text:u})}return!0},joinBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Hg(e,r);if(!n)return!1;let i=Gg(n);if(!i){let r=n.blockRange(),i=r&&$d(r);return null!=i&&(a&&a(e.tr.lift(r,i).scrollIntoView()),!0)}let t=i.nodeBefore;if(Yg(e,i,a,-1))return!0;if(0==n.parent.content.size&&(Ug(t,"end")||ru.isSelectable(t)))for(let r=n.depth;;r--){let o=Td(e.doc,n.before(r),n.after(r),tc.empty);if(o&&o.slice.size<o.to-o.from){if(a){let r=e.tr.step(o);r.setSelection(Ug(t,"end")?Jd.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):ru.create(r.doc,i.pos-t.nodeSize)),a(r.scrollIntoView())}return!0}if(1==r||n.node(r-1).childCount>1)break}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos-t.nodeSize,i.pos).scrollIntoView()),0))})(e,a),joinDown:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection;if(n instanceof ru){if(n.node.isTextblock||!Md(e.doc,n.to))return!1;r=n.to}else if(r=Ad(e.doc,n.to,1),null==r)return!1;return a&&a(e.tr.join(r).scrollIntoView()),!0})(e,a),joinForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Kg(e,r);if(!n)return!1;let i=Zg(n);if(!i)return!1;let t=i.nodeAfter;if(Yg(e,i,a,1))return!0;if(0==n.parent.content.size&&(Ug(t,"start")||ru.isSelectable(t))){let r=Td(e.doc,n.before(),n.after(),tc.empty);if(r&&r.slice.size<r.to-r.from){if(a){let n=e.tr.step(r);n.setSelection(Ug(t,"start")?Jd.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):ru.create(n.doc,n.mapping.map(i.pos))),a(n.scrollIntoView())}return!0}}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos,i.pos+t.nodeSize).scrollIntoView()),0))})(e,a),joinItemBackward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Ad(e.doc,e.selection.$from.pos,-1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinItemForward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Ad(e.doc,e.selection.$from.pos,1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Hg(e,r);if(!n)return!1;let i=Gg(n);return!!i&&Wg(e,i,a)})(e,a),joinTextblockForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=Kg(e,r);if(!n)return!1;let i=Zg(n);return!!i&&Wg(e,i,a)})(e,a),joinUp:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection,i=n instanceof ru;if(i){if(n.node.isTextblock||!Md(e.doc,n.from))return!1;r=n.from}else if(r=Ad(e.doc,n.from,-1),null==r)return!1;if(a){let n=e.tr.join(r);i&&n.setSelection(ru.create(n.doc,r-e.doc.resolve(r).nodeBefore.nodeSize)),a(n.scrollIntoView())}return!0})(e,a),keyboardShortcut:e=>({editor:a,view:r,tr:n,dispatch:i})=>{const t=function(e){const a=e.split(/-(?!$)/);let r,n,i,t,o=a[a.length-1];"Space"===o&&(o=" ");for(let e=0;e<a.length-1;e+=1){const o=a[e];if(/^(cmd|meta|m)$/i.test(o))t=!0;else if(/^a(lt)?$/i.test(o))r=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))i=!0;else{if(!/^mod$/i.test(o))throw new Error(`Unrecognized modifier name: ${o}`);Gp()||Kp()?t=!0:n=!0}}return r&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),t&&(o=`Meta-${o}`),i&&(o=`Shift-${o}`),o}(e).split(/-(?!$)/),o=t.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),s=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:t.includes("Alt"),ctrlKey:t.includes("Ctrl"),metaKey:t.includes("Meta"),shiftKey:t.includes("Shift"),bubbles:!0,cancelable:!0}),l=a.captureTransaction((()=>{r.someProp("handleKeyDown",(e=>e(r,s)))}));return null==l||l.steps.forEach((e=>{const a=e.map(n.mapping);a&&i&&n.maybeStep(a)})),!0},lift:(e,a={})=>({state:r,dispatch:n})=>!!Zp(r,dp(e,r.schema),a)&&((e,a)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),t=i&&$d(i);return null!=t&&(a&&a(e.tr.lift(i,t).scrollIntoView()),!0)})(r,n),liftEmptyBlock:()=>({state:e,dispatch:a})=>((e,a)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(Ed(e.doc,n))return a&&a(e.tr.split(n).scrollIntoView()),!0}let n=r.blockRange(),i=n&&$d(n);return null!=i&&(a&&a(e.tr.lift(n,i).scrollIntoView()),!0)})(e,a),liftListItem:e=>({state:a,dispatch:r})=>np(dp(e,a.schema))(a,r),newlineInCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;return!(!r.parent.type.spec.code||!r.sameParent(n)||(a&&a(e.tr.insertText("\n").scrollIntoView()),0))})(e,a),resetAttributes:(e,a)=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=Jp("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=dp(e,n.schema)),"mark"===s&&(o=Rp(e,n.schema)),i&&r.selection.ranges.forEach((e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,n)=>{t&&t===e.type&&r.setNodeMarkup(n,void 0,Yp(e.attrs,a)),o&&e.marks.length&&e.marks.forEach((i=>{o===i.type&&r.addMark(n,n+e.nodeSize,o.create(Yp(i.attrs,a)))}))}))})),!0)},scrollIntoView:()=>({tr:e,dispatch:a})=>(a&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:a})=>{if(a){const a=new iu(e.doc);e.setSelection(a)}return!0},selectNodeBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;t=Gg(n)}let o=t&&t.nodeBefore;return!(!o||!ru.isSelectable(o)||(a&&a(e.tr.setSelection(ru.create(e.doc,t.pos-o.nodeSize)).scrollIntoView()),0))})(e,a),selectNodeForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;t=Zg(n)}let o=t&&t.nodeAfter;return!(!o||!ru.isSelectable(o)||(a&&a(e.tr.setSelection(ru.create(e.doc,t.pos)).scrollIntoView()),0))})(e,a),selectParentNode:()=>({state:e,dispatch:a})=>((e,a)=>{let r,{$from:n,to:i}=e.selection,t=n.sharedDepth(i);return 0!=t&&(r=n.before(t),a&&a(e.tr.setSelection(ru.create(e.doc,r))),!0)})(e,a),selectTextblockEnd:()=>({state:e,dispatch:a})=>ep(e,a),selectTextblockStart:()=>({state:e,dispatch:a})=>Qg(e,a),setContent:(e,a=!1,r={},n={})=>({editor:i,tr:t,dispatch:o,commands:s})=>{var l,c;const{doc:d}=t;if("full"!==r.preserveWhitespace){const s=Xp(e,i.schema,r,{errorOnInvalidContent:null!==(l=n.errorOnInvalidContent)&&void 0!==l?l:i.options.enableContentCheck});return o&&t.replaceWith(0,d.content.size,s).setMeta("preventUpdate",!a),!0}return o&&t.setMeta("preventUpdate",!a),s.insertContentAt({from:0,to:d.content.size},e,{parseOptions:r,errorOnInvalidContent:null!==(c=n.errorOnInvalidContent)&&void 0!==c?c:i.options.enableContentCheck})},setMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const{selection:t}=r,{empty:o,ranges:s}=t,l=Rp(e,n.schema);if(i)if(o){const e=Qp(n,l);r.addStoredMark(l.create({...e,...a}))}else s.forEach((e=>{const i=e.$from.pos,t=e.$to.pos;n.doc.nodesBetween(i,t,((e,n)=>{const o=Math.max(n,i),s=Math.min(n+e.nodeSize,t);e.marks.find((e=>e.type===l))?e.marks.forEach((e=>{l===e.type&&r.addMark(o,s,l.create({...e.attrs,...a}))})):r.addMark(o,s,l.create(a))}))}));return function(e,a,r){var n;const{selection:i}=a;let t=null;if(Lp(i)&&(t=i.$cursor),t){const a=null!==(n=e.storedMarks)&&void 0!==n?n:t.marks();return!!r.isInSet(a)||!a.some((e=>e.type.excludes(r)))}const{ranges:o}=i;return o.some((({$from:a,$to:n})=>{let i=0===a.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(r);return e.doc.nodesBetween(a.pos,n.pos,((e,a,n)=>{if(i)return!1;if(e.isInline){const a=!n||n.type.allowsMarkType(r),t=!!r.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(r)));i=a&&t}return!i})),i}))}(n,r,l)},setMeta:(e,a)=>({tr:r})=>(r.setMeta(e,a),!0),setNode:(e,a={})=>({state:r,dispatch:n,chain:i})=>{const t=dp(e,r.schema);let o;return r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),t.isTextblock?i().command((({commands:e})=>!!ap(t,{...o,...a})(r)||e.clearNodes())).command((({state:e})=>ap(t,{...o,...a})(e,n))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,n=Bp(e,0,r.content.size),i=ru.create(r,n);a.setSelection(i)}return!0},setTextSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,{from:n,to:i}="number"==typeof e?{from:e,to:e}:e,t=eu.atStart(r).from,o=eu.atEnd(r).to,s=Bp(n,t,o),l=Bp(i,t,o),c=eu.create(r,s,l);a.setSelection(c)}return!0},sinkListItem:e=>({state:a,dispatch:r})=>{const n=dp(e,a.schema);return(i=n,function(e,a){let{$from:r,$to:n}=e.selection,t=r.blockRange(n,(e=>e.childCount>0&&e.firstChild.type==i));if(!t)return!1;let o=t.startIndex;if(0==o)return!1;let s=t.parent,l=s.child(o-1);if(l.type!=i)return!1;if(a){let r=l.lastChild&&l.lastChild.type==s.type,n=Ql.from(r?i.create():null),o=new tc(Ql.from(i.create(null,Ql.from(s.type.create(null,n)))),r?3:1,0),c=t.start,d=t.end;a(e.tr.step(new wd(c-(r?3:1),d,c,d,o,1,!0)).scrollIntoView())}return!0})(a,r);var i},splitBlock:({keepMarks:e=!0}={})=>({tr:a,state:r,dispatch:n,editor:i})=>{const{selection:t,doc:o}=a,{$from:s,$to:l}=t,c=nb(i.extensionManager.attributes,s.node().type.name,s.node().attrs);if(t instanceof ru&&t.node.isBlock)return!(!s.parentOffset||!Ed(o,s.pos))&&(n&&(e&&sb(r,i.extensionManager.splittableMarks),a.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,u=0===s.depth?void 0:function(e){for(let a=0;a<e.edgeCount;a+=1){const{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}(s.node(-1).contentMatchAt(s.indexAfter(-1)));let h=d&&u?[{type:u,attrs:c}]:void 0,m=Ed(a.doc,a.mapping.map(s.pos),1,h);if(h||m||!Ed(a.doc,a.mapping.map(s.pos),1,u?[{type:u}]:void 0)||(m=!0,h=u?[{type:u,attrs:c}]:void 0),n){if(m&&(t instanceof eu&&a.deleteSelection(),a.split(a.mapping.map(s.pos),1,h),u&&!d&&!s.parentOffset&&s.parent.type!==u)){const e=a.mapping.map(s.before()),r=a.doc.resolve(e);s.node(-1).canReplaceWith(r.index(),r.index()+1,u)&&a.setNodeMarkup(a.mapping.map(s.before()),u)}e&&sb(r,i.extensionManager.splittableMarks),a.scrollIntoView()}return m},splitListItem:(e,a={})=>({tr:r,state:n,dispatch:i,editor:t})=>{var o;const s=dp(e,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==s)return!1;const h=t.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=Ql.empty;const n=l.index(-1)?1:l.index(-2)?2:3;for(let a=l.depth-n;a>=l.depth-3;a-=1)e=Ql.from(l.node(a).copy(e));const i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,t={...nb(h,l.node().type.name,l.node().attrs),...a},c=(null===(o=s.contentMatch.defaultType)||void 0===o?void 0:o.createAndFill(t))||void 0;e=e.append(Ql.from(s.createAndFill(null,c)||void 0));const d=l.before(l.depth-(n-1));r.replace(d,l.after(-i),new tc(e,4-n,0));let u=-1;r.doc.nodesBetween(d,r.doc.content.size,((e,a)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=a+1)})),u>-1&&r.setSelection(eu.near(r.doc.resolve(u))),r.scrollIntoView()}return!0}const m=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,g={...nb(h,u.type.name,u.attrs),...a},p={...nb(h,l.node().type.name,l.node().attrs),...a};r.delete(l.pos,c.pos);const b=m?[{type:s,attrs:g},{type:m,attrs:p}]:[{type:s,attrs:g}];if(!Ed(r.doc,l.pos,2))return!1;if(i){const{selection:e,storedMarks:a}=n,{splittableMarks:o}=t.extensionManager,s=a||e.$to.parentOffset&&e.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!s||!i)return!0;const c=s.filter((e=>o.includes(e.type.name)));r.ensureMarks(c)}return!0},toggleList:(e,a,r,n={})=>({editor:i,tr:t,state:o,dispatch:s,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,m=dp(e,o.schema),g=dp(a,o.schema),{selection:p,storedMarks:b}=o,{$from:f,$to:k}=p,y=f.blockRange(k),v=b||p.$to.parentOffset&&p.$from.marks();if(!y)return!1;const w=eb((e=>tb(e.type.name,u)))(p);if(y.depth>=1&&w&&y.depth-w.depth<=1){if(w.node.type===m)return c.liftListItem(g);if(tb(w.node.type.name,u)&&m.validContent(w.node.content)&&s)return l().command((()=>(t.setNodeMarkup(w.pos,m),!0))).command((()=>lb(t,m))).command((()=>cb(t,m))).run()}return r&&v&&s?l().command((()=>{const e=d().wrapInList(m,n),a=v.filter((e=>h.includes(e.type.name)));return t.ensureMarks(a),!!e||c.clearNodes()})).wrapInList(m,n).command((()=>lb(t,m))).command((()=>cb(t,m))).run():l().command((()=>!!d().wrapInList(m,n)||c.clearNodes())).wrapInList(m,n).command((()=>lb(t,m))).command((()=>cb(t,m))).run()},toggleMark:(e,a={},r={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:t=!1}=r,o=Rp(e,n.schema);return ib(n,o,a)?i.unsetMark(o,{extendEmptyMarkRange:t}):i.setMark(o,a)},toggleNode:(e,a,r={})=>({state:n,commands:i})=>{const t=dp(e,n.schema),o=dp(a,n.schema),s=Zp(n,t,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(t,{...l,...r})},toggleWrap:(e,a={})=>({state:r,commands:n})=>{const i=dp(e,r.schema);return Zp(r,i,a)?n.lift(i):n.wrapIn(i,a)},undoInputRule:()=>({state:e,dispatch:a})=>{const r=e.plugins;for(let n=0;n<r.length;n+=1){const i=r[n];let t;if(i.spec.isInputRules&&(t=i.getState(e))){if(a){const a=e.tr,r=t.transform;for(let e=r.steps.length-1;e>=0;e-=1)a.step(r.steps[e].invert(r.docs[e]));if(t.text){const r=a.doc.resolve(t.from).marks();a.replaceWith(t.from,t.to,e.schema.text(t.text,r))}else a.delete(t.from,t.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,{empty:n,ranges:i}=r;return n||a&&i.forEach((a=>{e.removeMark(a.$from.pos,a.$to.pos)})),!0},unsetMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{var t;const{extendEmptyMarkRange:o=!1}=a,{selection:s}=r,l=Rp(e,n.schema),{$from:c,empty:d,ranges:u}=s;if(!i)return!0;if(d&&o){let{from:e,to:a}=s;const n=null===(t=c.marks().find((e=>e.type===l)))||void 0===t?void 0:t.attrs,i=Pp(c,l,n);i&&(e=i.from,a=i.to),r.removeMark(e,a,l)}else u.forEach((e=>{r.removeMark(e.$from.pos,e.$to.pos,l)}));return r.removeStoredMark(l),!0},updateAttributes:(e,a={})=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=Jp("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=dp(e,n.schema)),"mark"===s&&(o=Rp(e,n.schema)),i&&r.selection.ranges.forEach((e=>{const i=e.$from.pos,s=e.$to.pos;let l,c,d,u;r.selection.empty?n.doc.nodesBetween(i,s,((e,a)=>{t&&t===e.type&&(d=Math.max(a,i),u=Math.min(a+e.nodeSize,s),l=a,c=e)})):n.doc.nodesBetween(i,s,((e,n)=>{n<i&&t&&t===e.type&&(d=Math.max(n,i),u=Math.min(n+e.nodeSize,s),l=n,c=e),n>=i&&n<=s&&(t&&t===e.type&&r.setNodeMarkup(n,void 0,{...e.attrs,...a}),o&&e.marks.length&&e.marks.forEach((t=>{if(o===t.type){const l=Math.max(n,i),c=Math.min(n+e.nodeSize,s);r.addMark(l,c,o.create({...t.attrs,...a}))}})))})),c&&(void 0!==l&&r.setNodeMarkup(l,void 0,{...c.attrs,...a}),o&&c.marks.length&&c.marks.forEach((e=>{o===e.type&&r.addMark(d,u,o.create({...e.attrs,...a}))})))})),!0)},wrapIn:(e,a={})=>({state:r,dispatch:n})=>function(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t),s=o&&qd(o,e,a);return!!s&&(n&&n(r.tr.wrap(o,s).scrollIntoView()),!0)}}(dp(e,r.schema),a)(r,n),wrapInList:(e,a={})=>({state:r,dispatch:n})=>rp(dp(e,r.schema),a)(r,n)});const ub=_p.create({name:"commands",addCommands:()=>({...db})}),hb=_p.create({name:"drop",addProseMirrorPlugins(){return[new pu({key:new ku("tiptapDrop"),props:{handleDrop:(e,a,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:a,slice:r,moved:n})}}})]}}),mb=_p.create({name:"editable",addProseMirrorPlugins(){return[new pu({key:new ku("editable"),props:{editable:()=>this.editor.options.editable}})]}}),gb=_p.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new pu({key:new ku("focusEvents"),props:{handleDOMEvents:{focus:(a,r)=>{e.isFocused=!0;const n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1},blur:(a,r)=>{e.isFocused=!1;const n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1}}}})]}}),pb=_p.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:a})=>{const{selection:r,doc:n}=a,{empty:i,$anchor:t}=r,{pos:o,parent:s}=t,l=t.parent.isTextblock&&o>0?a.doc.resolve(o-1):t,c=l.parent.type.spec.isolating,d=t.pos-t.parentOffset,u=c&&1===l.parent.childCount?d===t.pos:Jd.atStart(n).from===o;return!(!i||!s.type.isTextblock||s.textContent.length||!u||u&&"paragraph"===t.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),a=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),r={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:a,"Mod-Delete":a,"Mod-a":()=>this.editor.commands.selectAll()},n={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":a,"Ctrl-Alt-Backspace":a,"Alt-Delete":a,"Alt-d":a,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Gp()||Kp()?i:n},addProseMirrorPlugins(){return[new pu({key:new ku("clearDocument"),appendTransaction:(e,a,r)=>{const n=e.some((e=>e.docChanged))&&!a.doc.eq(r.doc),i=e.some((e=>e.getMeta("preventClearDocument")));if(!n||i)return;const{empty:t,from:o,to:s}=a.selection,l=Jd.atStart(a.doc).from,c=Jd.atEnd(a.doc).to;if(t||!(o===l&&s===c))return;if(!ob(r.doc))return;const d=r.tr,u=ip({state:r,transaction:d}),{commands:h}=new tp({editor:this.editor,state:u});return h.clearNodes(),d.steps.length?d:void 0}})]}}),bb=_p.create({name:"paste",addProseMirrorPlugins(){return[new pu({key:new ku("tiptapPaste"),props:{handlePaste:(e,a,r)=>{this.editor.emit("paste",{editor:this.editor,event:a,slice:r})}}})]}}),fb=_p.create({name:"tabindex",addProseMirrorPlugins(){return[new pu({key:new ku("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var kb=Object.freeze({__proto__:null,ClipboardTextSerializer:Tp,Commands:ub,Drop:hb,Editable:mb,FocusEvents:gb,Keymap:pb,Paste:bb,Tabindex:fb});class yb{get name(){return this.node.type.name}constructor(e,a,r=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=a,this.currentNode=n}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)&&void 0!==e?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let a=this.from,r=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}`);a=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:a,to:r},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 e=this.resolvedPos.start(this.resolvedPos.depth-1),a=this.resolvedPos.doc.resolve(e);return new yb(a,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new yb(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new yb(e,this.editor)}get children(){const e=[];return this.node.content.forEach(((a,r)=>{const n=a.isBlock&&!a.isTextblock,i=a.isAtom&&!a.isText,t=this.pos+r+(i?0:1),o=this.resolvedPos.doc.resolve(t);if(!n&&o.depth<=this.depth)return;const s=new yb(o,this.editor,n,n?a:null);n&&(s.actualDepth=this.depth+1),e.push(new yb(o,this.editor,n,n?a:null))})),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,a={}){let r=null,n=this.parent;for(;n&&!r;){if(n.node.type.name===e)if(Object.keys(a).length>0){const e=n.node.attrs,r=Object.keys(a);for(let n=0;n<r.length;n+=1){const i=r[n];if(e[i]!==a[i])break}}else r=n;n=n.parent}return r}querySelector(e,a={}){return this.querySelectorAll(e,a,!0)[0]||null}querySelectorAll(e,a={},r=!1){let n=[];if(!this.children||0===this.children.length)return n;const i=Object.keys(a);return this.children.forEach((t=>{if(!(r&&n.length>0)){if(t.node.type.name===e){i.every((e=>a[e]===t.node.attrs[e]))&&n.push(t)}r&&n.length>0||(n=n.concat(t.querySelectorAll(e,a,r)))}})),n}setAttribute(e){const{tr:a}=this.editor.state;a.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(a)}}class vb extends op{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:a,moved:r})=>this.options.onDrop(e,a,r))),this.on("paste",(({event:e,slice:a})=>this.options.onPaste(e,a))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}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&&document&&(this.css=function(e,a){const r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;const n=document.createElement("style");return a&&n.setAttribute("nonce",a),n.setAttribute("data-tiptap-style",""),n.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(n),n}('.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}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,a=!0){this.setOptions({editable:e}),a&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,a){const r=mp(a)?a(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;const a=this.state.plugins;let r=a;if([].concat(e).forEach((e=>{const n="string"==typeof e?`${e}$`:e.key;r=a.filter((e=>!e.key.startsWith(n)))})),a.length===r.length)return;const n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var e,a;const r=[...this.options.enableCoreExtensions?[mb,Tp.configure({blockSeparator:null===(a=null===(e=this.options.coreExtensionOptions)||void 0===e?void 0:e.clipboardTextSerializer)||void 0===a?void 0:a.blockSeparator}),ub,gb,pb,fb,hb,bb].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 Mp(r,this)}createCommandManager(){this.commandManager=new tp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let a;try{a=Xp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),a=Xp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Vp(a,this.options.autofocus);this.view=new Sg(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(e=this.options.editorProps)||void 0===e?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:mu.create({doc:a,selection:r||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const a=this.capturedTransaction;return this.capturedTransaction=null,a}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var a;return null===(a=this.capturedTransaction)||void 0===a?void 0:a.step(e)})):void(this.capturedTransaction=e);const a=this.state.apply(e),r=!this.state.selection.eq(a.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:a}),this.view.updateState(a),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const n=e.getMeta("focus"),i=e.getMeta("blur");n&&this.emit("focus",{editor:this,event:n.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return ab(this.state,e)}isActive(e,a){const r="string"==typeof e?e:null,n="string"==typeof e?a:e;return function(e,a,r={}){if(!a)return Zp(e,null,r)||ib(e,null,r);const n=Jp(a,e.schema);return"node"===n?Zp(e,a,r):"mark"===n&&ib(e,a,r)}(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return yp(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:a="\n\n",textSerializers:r={}}=e||{};return function(e,a){return Ap(e,{from:0,to:e.content.size},a)}(this.state.doc,{blockSeparator:a,textSerializers:{...Dp(this.schema),...r}})}get isEmpty(){return ob(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}$node(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelector(e,a))||null}$nodes(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelectorAll(e,a))||null}$pos(e){const a=this.state.doc.resolve(e);return new yb(a,this)}get $doc(){return this.$pos(0)}}function wb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n})=>{const i=gp(e.getAttributes,void 0,n);if(!1===i||null===i)return null;const{tr:t}=a,o=n[n.length-1],s=n[0];if(o){const n=s.search(/\S/),l=r.from+s.indexOf(o),c=l+o.length;if(rb(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>l)).length)return null;c<r.to&&t.delete(c,r.to),l>r.from&&t.delete(r.from+n,l);const d=r.from+n+o.length;t.addMark(r.from+n,d,e.type.create(i||{})),t.removeStoredMark(e.type)}}})}function zb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n})=>{const i=gp(e.getAttributes,void 0,n)||{},{tr:t}=a,o=r.from;let s=r.to;const l=e.type.create(i);if(n[1]){let e=o+n[0].lastIndexOf(n[1]);e>s?e=s:s=e+n[1].length;const a=n[0][n[0].length-1];t.insertText(a,o+n[0].length-1),t.replaceWith(e,s,l)}else if(n[0]){const a=e.type.isInline?o:o-1;t.insert(a,e.type.create(i)).delete(t.mapping.map(o),t.mapping.map(s))}t.scrollIntoView()}})}function jb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n})=>{const i=a.doc.resolve(r.from),t=gp(e.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;a.tr.delete(r.from,r.to).setBlockType(r.from,r.from,e.type,t)}})}function xb(e){return new wp({find:e.find,handler:({state:a,range:r,match:n,chain:i})=>{const t=gp(e.getAttributes,void 0,n)||{},o=a.tr.delete(r.from,r.to),s=o.doc.resolve(r.from).blockRange(),l=s&&qd(s,e.type,t);if(!l)return null;if(o.wrap(s,l),e.keepMarks&&e.editor){const{selection:r,storedMarks:n}=a,{splittableMarks:i}=e.editor.extensionManager,t=n||r.$to.parentOffset&&r.$from.marks();if(t){const e=t.filter((e=>i.includes(e.type.name)));o.ensureMarks(e)}}if(e.keepAttributes){const a="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(a,t).run()}const c=o.doc.resolve(r.from-1).nodeBefore;c&&c.type===e.type&&Md(o.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(n,c))&&o.join(r.from-1)}})}let $b=class e{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=gp(sp(this,"addOptions",{name:this.name}))),this.storage=gp(sp(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(a={}){return new e(a)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>$p(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(a={}){const r=new e(a);return r.parent=this,this.child=r,r.name=a.name?a.name:r.parent.name,a.defaultOptions&&Object.keys(a.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=gp(sp(r,"addOptions",{name:r.name})),r.storage=gp(sp(r,"addStorage",{name:r.name,options:r.options})),r}};function qb(e){return new Cp({find:e.find,handler:({state:a,range:r,match:n,pasteEvent:i})=>{const t=gp(e.getAttributes,void 0,n,i);if(!1===t||null===t)return null;const{tr:o}=a,s=n[n.length-1],l=n[0];let c=r.to;if(s){const n=l.search(/\S/),i=r.from+l.indexOf(s),d=i+s.length;if(rb(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>i)).length)return null;d<r.to&&o.delete(d,r.to),i>r.from&&o.delete(r.from+n,i),c=r.from+n+s.length,o.addMark(r.from+n,c,e.type.create(t||{})),o.removeStoredMark(e.type)}}})}const Cb=_p.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new pu({key:new ku("placeholder"),props:{decorations:({doc:e,selection:a})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=a,i=[];if(!r)return null;const t=this.editor.isEmpty;return e.descendants(((e,a)=>{const r=n>=a&&n<=a+e.nodeSize,o=!e.isLeaf&&ob(e);if((r||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];t&&n.push(this.options.emptyEditorClass);const o=eg.node(a,a+e.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:a,hasAnchor:r}):this.options.placeholder});i.push(o)}return this.options.includeChildren})),ng.create(e,i)}}})]}}),Sb=qp.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",up(this.options.HTMLAttributes,e),0]},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()}}}),Ob=/^\s*>\s$/,Eb=$b.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",up(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[xb({find:Ob,type:this.type})]}}),Mb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_b=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Ab=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Db=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Tb=qp.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",up(this.options.HTMLAttributes,e),0]},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[wb({find:Mb,type:this.type}),wb({find:Ab,type:this.type})]},addPasteRules(){return[qb({find:_b,type:this.type}),qb({find:Db,type:this.type})]}}),Nb="textStyle",Ib=/^\s*([-+*])\s$/,Fb=$b.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",up(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Nb)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=xb({find:Ib,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xb({find:Ib,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Nb),editor:this.editor})),[e]}}),Pb=/(^|[^`])`([^`]+)`(?!`)/,Rb=/(^|[^`])`([^`]+)`(?!`)/g,Lb=qp.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",up(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[wb({find:Pb,type:this.type})]},addPasteRules(){return[qb({find:Rb,type:this.type})]}}),Bb=/^```([a-z]+)?[\s\n]$/,Vb=/^~~~([a-z]+)?[\s\n]$/,Hb=$b.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var a;const{languageClassPrefix:r}=this.options,n=[...(null===(a=e.firstElementChild)||void 0===a?void 0:a.classList)||[]].filter((e=>e.startsWith(r))).map((e=>e.replace(r,"")))[0];return n||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:a}){return["pre",up(this.options.HTMLAttributes,a),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.setNode(this.name,e),toggleCodeBlock:e=>({commands:a})=>a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:a}=this.editor.state.selection,r=1===a.pos;return!(!e||a.parent.type.name!==this.name)&&(!(!r&&a.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:a}=e,{selection:r}=a,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;const t=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return!(!t||!o)&&e.chain().command((({tr:e})=>(e.delete(n.pos-2,n.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:a}=e,{selection:r,doc:n}=a,{$from:i,empty:t}=r;if(!t||i.parent.type!==this.type)return!1;if(!(i.parentOffset===i.parent.nodeSize-2))return!1;const o=i.after();if(void 0===o)return!1;return n.nodeAt(o)?e.commands.command((({tr:e})=>(e.setSelection(Jd.near(n.resolve(o))),!0))):e.commands.exitCode()}}},addInputRules(){return[jb({find:Bb,type:this.type,getAttributes:e=>({language:e[1]})}),jb({find:Vb,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new pu({key:new ku("codeBlockVSCodeHandler"),props:{handlePaste:(e,a)=>{if(!a.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const r=a.clipboardData.getData("text/plain"),n=a.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,t=null==i?void 0:i.mode;if(!r||!t)return!1;const{tr:o,schema:s}=e.state,l=s.text(r.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:t},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(eu.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),Wb=$b.create({name:"doc",topNode:!0,content:"block+"});function Ub(e={}){return new pu({view:a=>new Gb(a,e)})}class Gb{constructor(e,a){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=a.width)&&void 0!==r?r:1,this.color=!1===a.color?void 0:a.color||"black",this.class=a.class,this.handlers=["dragover","dragend","drop","dragleave"].map((a=>{let r=e=>{this[a](e)};return e.dom.addEventListener(a,r),{name:a,handler:r}}))}destroy(){this.handlers.forEach((({name:e,handler:a})=>this.editorView.dom.removeEventListener(e,a)))}update(e,a){null!=this.cursorPos&&a.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,a=this.editorView.state.doc.resolve(this.cursorPos),r=!a.parent.inlineContent;if(r){let r=a.nodeBefore,n=a.nodeAfter;if(r||n){let a=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0));if(a){let i=a.getBoundingClientRect(),t=r?i.bottom:i.top;r&&n&&(t=(t+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:t-this.width/2,bottom:t+this.width/2}}}}if(!e){let a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let n,i,t=this.editorView.dom.offsetParent;if(this.element||(this.element=t.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),!t||t==document.body&&"static"==getComputedStyle(t).position)n=-pageXOffset,i=-pageYOffset;else{let e=t.getBoundingClientRect();n=e.left-t.scrollLeft,i=e.top-t.scrollTop}this.element.style.left=e.left-n+"px",this.element.style.top=e.top-i+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let a=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=a&&a.inside>=0&&this.editorView.state.doc.nodeAt(a.inside),n=r&&r.type.spec.disableDropCursor,i="function"==typeof n?n(this.editorView,a,e):n;if(a&&!i){let e=a.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Dd(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=a&&(e=a)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Kb=_p.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[Ub(this.options)]}});class Zb extends Jd{constructor(e){super(e,e)}map(e,a){let r=e.resolve(a.map(this.head));return Zb.valid(r)?new Zb(r):Jd.near(r)}content(){return tc.empty}eq(e){return e instanceof Zb&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Zb(e.resolve(a.pos))}getBookmark(){return new Jb(this.anchor)}static valid(e){let a=e.parent;if(a.isTextblock||!function(e){for(let a=e.depth;a>=0;a--){let r=e.index(a),n=e.node(a);if(0!=r)for(let e=n.child(r-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let a=e.depth;a>=0;a--){let r=e.indexAfter(a),n=e.node(a);if(r!=n.childCount)for(let e=n.child(r);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e))return!1;let r=a.type.spec.allowGapCursor;if(null!=r)return r;let n=a.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,a,r=!1){e:for(;;){if(!r&&Zb.valid(e))return e;let n=e.pos,i=null;for(let r=e.depth;;r--){let t=e.node(r);if(a>0?e.indexAfter(r)<t.childCount:e.index(r)>0){i=t.child(a>0?e.indexAfter(r):e.index(r)-1);break}if(0==r)return null;n+=a;let o=e.doc.resolve(n);if(Zb.valid(o))return o}for(;;){let t=a>0?i.firstChild:i.lastChild;if(!t){if(i.isAtom&&!i.isText&&!ru.isSelectable(i)){e=e.doc.resolve(n+i.nodeSize*a),r=!1;continue e}break}i=t,n+=a;let o=e.doc.resolve(n);if(Zb.valid(o))return o}return null}}}Zb.prototype.visible=!1,Zb.findFrom=Zb.findGapCursorFrom,Jd.jsonID("gapcursor",Zb);class Jb{constructor(e){this.pos=e}map(e){return new Jb(e.map(this.pos))}resolve(e){let a=e.resolve(this.pos);return Zb.valid(a)?new Zb(a):Jd.near(a)}}const Yb=Vg({ArrowLeft:Xb("horiz",-1),ArrowRight:Xb("horiz",1),ArrowUp:Xb("vert",-1),ArrowDown:Xb("vert",1)});function Xb(e,a){const r="vert"==e?a>0?"down":"up":a>0?"right":"left";return function(e,n,i){let t=e.selection,o=a>0?t.$to:t.$from,s=t.empty;if(t instanceof eu){if(!i.endOfTextblock(r)||0==o.depth)return!1;s=!1,o=e.doc.resolve(a>0?o.after():o.before())}let l=Zb.findGapCursorFrom(o,a,s);return!!l&&(n&&n(e.tr.setSelection(new Zb(l))),!0)}}function Qb(e,a,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(a);if(!Zb.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return!(i&&i.inside>-1&&ru.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new Zb(n))),!0)}function ef(e,a){if("insertCompositionText"!=a.inputType||!(e.state.selection instanceof Zb))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=Ql.empty;for(let e=n.length-1;e>=0;e--)i=Ql.from(n[e].createAndFill(null,i));let t=e.state.tr.replace(r.pos,r.pos,new tc(i,0,0));return t.setSelection(eu.near(t.doc.resolve(r.pos+1))),e.dispatch(t),!1}function af(e){if(!(e.selection instanceof Zb))return null;let a=document.createElement("div");return a.className="ProseMirror-gapcursor",ng.create(e.doc,[eg.widget(e.selection.head,a,{key:"gapcursor"})])}const rf=_p.create({name:"gapCursor",addProseMirrorPlugins:()=>[new pu({props:{decorations:af,createSelectionBetween:(e,a,r)=>a.pos==r.pos&&Zb.valid(r)?new Zb(r):null,handleClick:Qb,handleKeyDown:Yb,handleDOMEvents:{beforeinput:ef}}})],extendNodeSchema(e){var a;return{allowGapCursor:null!==(a=gp(sp(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==a?a:null}}}),nf=$b.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",up(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:a,state:r,editor:n})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:i}=r;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:t}=this.options,{splittableMarks:o}=n.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return a().insertContent({type:this.name}).command((({tr:e,dispatch:a})=>{if(a&&s&&t){const a=s.filter((e=>o.includes(e.type.name)));e.ensureMarks(a)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),tf=$b.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:a}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,up(this.options.HTMLAttributes,a),0]},addCommands(){return{setHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.setNode(this.name,e),toggleHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,a)=>({...e,[`Mod-Alt-${a}`]:()=>this.editor.commands.toggleHeading({level:a})})),{})},addInputRules(){return this.options.levels.map((e=>jb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var of=200,sf=function(){};sf.prototype.append=function(e){return e.length?(e=sf.from(e),!this.length&&e||e.length<of&&this.leafAppend(e)||this.length<of&&e.leafPrepend(this)||this.appendInner(e)):this},sf.prototype.prepend=function(e){return e.length?sf.from(e).append(this):this},sf.prototype.appendInner=function(e){return new cf(this,e)},sf.prototype.slice=function(e,a){return void 0===e&&(e=0),void 0===a&&(a=this.length),e>=a?sf.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,a))},sf.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},sf.prototype.forEach=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length),a<=r?this.forEachInner(e,a,r,0):this.forEachInvertedInner(e,a,r,0)},sf.prototype.map=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length);var n=[];return this.forEach((function(a,r){return n.push(e(a,r))}),a,r),n},sf.from=function(e){return e instanceof sf?e:e&&e.length?new lf(e):sf.empty};var lf=function(e){function a(a){e.call(this),this.values=a}e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a;var r={length:{configurable:!0},depth:{configurable:!0}};return a.prototype.flatten=function(){return this.values},a.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new a(this.values.slice(e,r))},a.prototype.getInner=function(e){return this.values[e]},a.prototype.forEachInner=function(e,a,r,n){for(var i=a;i<r;i++)if(!1===e(this.values[i],n+i))return!1},a.prototype.forEachInvertedInner=function(e,a,r,n){for(var i=a-1;i>=r;i--)if(!1===e(this.values[i],n+i))return!1},a.prototype.leafAppend=function(e){if(this.length+e.length<=of)return new a(this.values.concat(e.flatten()))},a.prototype.leafPrepend=function(e){if(this.length+e.length<=of)return new a(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(a.prototype,r),a}(sf);sf.empty=new lf([]);var cf=function(e){function a(a,r){e.call(this),this.left=a,this.right=r,this.length=a.length+r.length,this.depth=Math.max(a.depth,r.depth)+1}return e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a,a.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},a.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},a.prototype.forEachInner=function(e,a,r,n){var i=this.left.length;return!(a<i&&!1===this.left.forEachInner(e,a,Math.min(r,i),n))&&(!(r>i&&!1===this.right.forEachInner(e,Math.max(a-i,0),Math.min(this.length,r)-i,n+i))&&void 0)},a.prototype.forEachInvertedInner=function(e,a,r,n){var i=this.left.length;return!(a>i&&!1===this.right.forEachInvertedInner(e,a-i,Math.max(r,i)-i,n+i))&&(!(r<i&&!1===this.left.forEachInvertedInner(e,Math.min(a,i),r,n))&&void 0)},a.prototype.sliceInner=function(e,a){if(0==e&&a==this.length)return this;var r=this.left.length;return a<=r?this.left.slice(e,a):e>=r?this.right.slice(e-r,a-r):this.left.slice(e,r).append(this.right.slice(0,a-r))},a.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new a(this.left,r)},a.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new a(r,this.right)},a.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new a(this.left,new a(this.right,e)):new a(this,e)},a}(sf);class df{constructor(e,a){this.items=e,this.eventCount=a}popEvent(e,a){if(0==this.eventCount)return null;let r,n,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}a&&(r=this.remapping(i,this.items.length),n=r.maps.length);let t,o,s=e.tr,l=[],c=[];return this.items.forEach(((e,a)=>{if(!e.step)return r||(r=this.remapping(i,a+1),n=r.maps.length),n--,void c.push(e);if(r){c.push(new uf(e.map));let a,i=e.step.map(r.slice(n));i&&s.maybeStep(i).doc&&(a=s.mapping.maps[s.mapping.maps.length-1],l.push(new uf(a,void 0,void 0,l.length+c.length))),n--,a&&r.appendMap(a,n)}else s.maybeStep(e.step);return e.selection?(t=r?e.selection.map(r.slice(n)):e.selection,o=new df(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:s,selection:t}}addTransform(e,a,r,n){let i=[],t=this.eventCount,o=this.items,s=!n&&o.length?o.get(o.length-1):null;for(let r=0;r<e.steps.length;r++){let l,c=e.steps[r].invert(e.docs[r]),d=new uf(e.mapping.maps[r],c,a);(l=s&&s.merge(d))&&(d=l,r?i.pop():o=o.slice(0,o.length-1)),i.push(d),a&&(t++,a=void 0),n||(s=d)}let l=t-r.depth;return l>mf&&(o=function(e,a){let r;return e.forEach(((e,n)=>{if(e.selection&&0==a--)return r=n,!1})),e.slice(r)}(o,l),t-=l),new df(o.append(i),t)}remapping(e,a){let r=new ud;return this.items.forEach(((a,n)=>{let i=null!=a.mirrorOffset&&n-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,i)}),e,a),r}addMaps(e){return 0==this.eventCount?this:new df(this.items.append(e.map((e=>new uf(e)))),this.eventCount)}rebased(e,a){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-a),i=e.mapping,t=e.steps.length,o=this.eventCount;this.items.forEach((e=>{e.selection&&o--}),n);let s=a;this.items.forEach((a=>{let n=i.getMirror(--s);if(null==n)return;t=Math.min(t,n);let l=i.maps[n];if(a.step){let t=e.steps[n].invert(e.docs[n]),c=a.selection&&a.selection.map(i.slice(s+1,n));c&&o++,r.push(new uf(l,t,c))}else r.push(new uf(l))}),n);let l=[];for(let e=a;e<t;e++)l.push(new uf(i.maps[e]));let c=this.items.slice(0,n).append(l).append(r),d=new df(c,o);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach((a=>{a.step||e++})),e}compress(e=this.items.length){let a=this.remapping(0,e),r=a.maps.length,n=[],i=0;return this.items.forEach(((t,o)=>{if(o>=e)n.push(t),t.selection&&i++;else if(t.step){let e=t.step.map(a.slice(r)),o=e&&e.getMap();if(r--,o&&a.appendMap(o,r),e){let s=t.selection&&t.selection.map(a.slice(r));s&&i++;let l,c=new uf(o.invert(),e,s),d=n.length-1;(l=n.length&&n[d].merge(c))?n[d]=l:n.push(c)}}else t.map&&r--}),this.items.length,0),new df(sf.from(n.reverse()),i)}}df.empty=new df(sf.empty,0);class uf{constructor(e,a,r,n){this.map=e,this.step=a,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let a=e.step.merge(this.step);if(a)return new uf(a.getMap().invert(),a,this.selection)}}}class hf{constructor(e,a,r,n,i){this.done=e,this.undone=a,this.prevRanges=r,this.prevTime=n,this.prevComposition=i}}const mf=20;function gf(e){let a=[];for(let r=e.length-1;r>=0&&0==a.length;r--)e[r].forEach(((e,r,n,i)=>a.push(n,i)));return a}function pf(e,a){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let i=a.map(e[n],1),t=a.map(e[n+1],-1);i<=t&&r.push(i,t)}return r}let bf=!1,ff=null;function kf(e){let a=e.plugins;if(ff!=a){bf=!1,ff=a;for(let e=0;e<a.length;e++)if(a[e].spec.historyPreserveItems){bf=!0;break}}return bf}const yf=new ku("history"),vf=new ku("closeHistory");function wf(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new pu({key:yf,state:{init:()=>new hf(df.empty,df.empty,null,0,-1),apply:(a,r,n)=>function(e,a,r,n){let i,t=r.getMeta(yf);if(t)return t.historyState;r.getMeta(vf)&&(e=new hf(e.done,e.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(o&&o.getMeta(yf))return o.getMeta(yf).redo?new hf(e.done.addTransform(r,void 0,n,kf(a)),e.undone,gf(r.mapping.maps),e.prevTime,e.prevComposition):new hf(e.done,e.undone.addTransform(r,void 0,n,kf(a)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=r.getMeta("rebased"))?new hf(e.done.rebased(r,i),e.undone.rebased(r,i),pf(e.prevRanges,r.mapping),e.prevTime,e.prevComposition):new hf(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),pf(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let i=r.getMeta("composition"),t=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,a){if(!a)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach(((e,n)=>{for(let i=0;i<a.length;i+=2)e<=a[i+1]&&n>=a[i]&&(r=!0)})),r}(r,e.prevRanges)),s=o?pf(e.prevRanges,r.mapping):gf(r.mapping.maps);return new hf(e.done.addTransform(r,t?a.selection.getBookmark():void 0,n,kf(a)),df.empty,s,r.time,null==i?e.prevComposition:i)}}(r,n,a,e)},config:e,props:{handleDOMEvents:{beforeinput(e,a){let r=a.inputType,n="historyUndo"==r?jf:"historyRedo"==r?xf:null;return!!n&&(a.preventDefault(),n(e.state,e.dispatch))}}}})}function zf(e,a){return(r,n)=>{let i=yf.getState(r);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(n){let t=function(e,a,r){let n=kf(a),i=yf.get(a).spec.config,t=(r?e.undone:e.done).popEvent(a,n);if(!t)return null;let o=t.selection.resolve(t.transform.doc),s=(r?e.done:e.undone).addTransform(t.transform,a.selection.getBookmark(),i,n),l=new hf(r?s:t.remaining,r?t.remaining:s,null,0,-1);return t.transform.setSelection(o).setMeta(yf,{redo:r,historyState:l})}(i,r,e);t&&n(a?t.scrollIntoView():t)}return!0}}const jf=zf(!1,!0),xf=zf(!0,!0),$f=_p.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:a})=>jf(e,a),redo:()=>({state:e,dispatch:a})=>xf(e,a)}),addProseMirrorPlugins(){return[wf(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),qf=$b.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",up(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:a})=>{const{selection:r}=a,{$from:n,$to:i}=r,t=e();return 0===n.parentOffset?t.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):r instanceof ru?t.insertContentAt(i.pos,{type:this.name}):t.insertContent({type:this.name}),t.command((({tr:e,dispatch:a})=>{var r;if(a){const{$to:a}=e.selection,n=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?e.setSelection(eu.create(e.doc,a.pos+1)):a.nodeAfter.isBlock?e.setSelection(ru.create(e.doc,a.pos)):e.setSelection(eu.create(e.doc,a.pos));else{const i=null===(r=a.parent.type.contentMatch.defaultType)||void 0===r?void 0:r.create();i&&(e.insert(n,i),e.setSelection(eu.create(e.doc,n+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[zb({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Of=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ef=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mf=qp.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",up(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)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[wb({find:Cf,type:this.type}),wb({find:Of,type:this.type})]},addPasteRules(){return[qb({find:Sf,type:this.type}),qb({find:Ef,type:this.type})]}}),_f=$b.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",up(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Af="textStyle",Df=/^(\d+)\.\s$/,Tf=$b.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:a,...r}=e;return 1===a?["ol",up(this.options.HTMLAttributes,r),0]:["ol",up(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Af)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=xb({find:Df,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xb({find:Df,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Af)}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1],editor:this.editor})),[e]}}),Nf=$b.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",up(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),If=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ff=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Pf=qp.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",up(this.options.HTMLAttributes,e),0]},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[wb({find:If,type:this.type})]},addPasteRules(){return[qb({find:Ff,type:this.type})]}}),Rf=$b.create({name:"text",group:"inline"}),Lf=_p.create({name:"starterKit",addExtensions(){var e,a,r,n,i,t,o,s,l,c,d,u,h,m,g,p,b,f;const k=[];return!1!==this.options.bold&&k.push(Tb.configure(null===(e=this.options)||void 0===e?void 0:e.bold)),!1!==this.options.blockquote&&k.push(Eb.configure(null===(a=this.options)||void 0===a?void 0:a.blockquote)),!1!==this.options.bulletList&&k.push(Fb.configure(null===(r=this.options)||void 0===r?void 0:r.bulletList)),!1!==this.options.code&&k.push(Lb.configure(null===(n=this.options)||void 0===n?void 0:n.code)),!1!==this.options.codeBlock&&k.push(Hb.configure(null===(i=this.options)||void 0===i?void 0:i.codeBlock)),!1!==this.options.document&&k.push(Wb.configure(null===(t=this.options)||void 0===t?void 0:t.document)),!1!==this.options.dropcursor&&k.push(Kb.configure(null===(o=this.options)||void 0===o?void 0:o.dropcursor)),!1!==this.options.gapcursor&&k.push(rf.configure(null===(s=this.options)||void 0===s?void 0:s.gapcursor)),!1!==this.options.hardBreak&&k.push(nf.configure(null===(l=this.options)||void 0===l?void 0:l.hardBreak)),!1!==this.options.heading&&k.push(tf.configure(null===(c=this.options)||void 0===c?void 0:c.heading)),!1!==this.options.history&&k.push($f.configure(null===(d=this.options)||void 0===d?void 0:d.history)),!1!==this.options.horizontalRule&&k.push(qf.configure(null===(u=this.options)||void 0===u?void 0:u.horizontalRule)),!1!==this.options.italic&&k.push(Mf.configure(null===(h=this.options)||void 0===h?void 0:h.italic)),!1!==this.options.listItem&&k.push(_f.configure(null===(m=this.options)||void 0===m?void 0:m.listItem)),!1!==this.options.orderedList&&k.push(Tf.configure(null===(g=this.options)||void 0===g?void 0:g.orderedList)),!1!==this.options.paragraph&&k.push(Nf.configure(null===(p=this.options)||void 0===p?void 0:p.paragraph)),!1!==this.options.strike&&k.push(Pf.configure(null===(b=this.options)||void 0===b?void 0:b.strike)),!1!==this.options.text&&k.push(Rf.configure(null===(f=this.options)||void 0===f?void 0:f.text)),k}}),Bf=Object.fromEntries?Object.fromEntries:e=>{if(!e||!e[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");const a={};return Object.keys(e).forEach((r=>{const[n,i]=e[r];a[n]=i})),a};function Vf(e){return Object.keys(e)}function Hf(e,a){if(!e)throw new Error(a)}function Wf(e,a){return a}const Uf=e=>{const a=e.length;let r=0,n="";for(;r<a;r++){const a=e[r];if(null==a)continue;let i;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=Uf(a);else{Hf(!Wf(0,!1)),"production"!==process.env.NODE_ENV&&void 0!==a.styles&&void 0!==a.name&&console.error("You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component."),i="";for(const e in a)a[e]&&e&&(i&&(i+=" "),i+=e)}break;default:i=a}i&&(n&&(n+=" "),n+=i)}return n};var Gf={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Kf=/[A-Z]|^ms/g,Zf=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Jf=function(e){return 45===e.charCodeAt(1)},Yf=function(e){return null!=e&&"boolean"!=typeof e},Xf=Nr((function(e){return Jf(e)?e:e.replace(Kf,"-$&").toLowerCase()})),Qf=function(e,a){switch(e){case"animation":case"animationName":if("string"==typeof a)return a.replace(Zf,(function(e,a,r){return ak={name:a,styles:r,next:ak},a}))}return 1===Gf[e]||Jf(e)||"number"!=typeof a||0===a?a:a+"px"};function ek(e,a,r){if(null==r)return"";var n=r;if(void 0!==n.__emotion_styles)return n;switch(typeof r){case"boolean":return"";case"object":var i=r;if(1===i.anim)return ak={name:i.name,styles:i.styles,next:ak},i.name;var t=r;if(void 0!==t.styles){var o=t.next;if(void 0!==o)for(;void 0!==o;)ak={name:o.name,styles:o.styles,next:ak},o=o.next;return t.styles+";"}return function(e,a,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=ek(e,a,r[i])+";";else for(var t in r){var o=r[t];if("object"!=typeof o){var s=o;null!=a&&void 0!==a[s]?n+=t+"{"+a[s]+"}":Yf(s)&&(n+=Xf(t)+":"+Qf(t,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=a&&void 0!==a[o[0]]){var l=ek(e,a,o);switch(t){case"animation":case"animationName":n+=Xf(t)+":"+l+";";break;default:n+=t+"{"+l+"}"}}else for(var c=0;c<o.length;c++)Yf(o[c])&&(n+=Xf(t)+":"+Qf(t,o[c])+";")}return n}(e,a,r)}var s=r;if(null==a)return s;var l=a[s];return void 0!==l?l:s}var ak,rk=/label:\s*([^\s;{]+)\s*(;|$)/g;var nk="undefined"!=typeof document;const{createCssAndCx:ik}={createCssAndCx:function(e){const{cache:a}=e,r=(...e)=>{const r=function(e,a,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,i="";ak=void 0;var t=e[0];null==t||void 0===t.raw?(n=!1,i+=ek(r,a,t)):i+=t[0];for(var o=1;o<e.length;o++)i+=ek(r,a,e[o]),n&&(i+=t[o]);rk.lastIndex=0;for(var s,l="";null!==(s=rk.exec(i));)l+="-"+s[1];var c=function(e){for(var a,r=0,n=0,i=e.length;i>=4;++n,i-=4)a=1540483477*(65535&(a=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(a>>>16)<<16),r=1540483477*(65535&(a^=a>>>24))+(59797*(a>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(i){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(i)+l;return{name:c,styles:i,next:ak}}(e,a.registered);!function(e,a){!function(e,a){var r=e.key+"-"+a.name;void 0===e.registered[r]&&(e.registered[r]=a.styles)}(e,a);var r=e.key+"-"+a.name;if(void 0===e.inserted[a.name]){var n="",i=a;do{var t=e.insert(a===i?"."+r:"",i,e.sheet,!0);nk||void 0===t||(n+=t),i=i.next}while(void 0!==i);!nk&&n.length}}(a,r);const n=`${a.key}-${r.name}`;{const r=e[0];(function(e){return e instanceof Object&&!("styles"in e)&&!("length"in e)&&!("__emotion_styles"in e)})(r)&&ok.saveClassNameCSSObjectMapping(a,n,r)}return n};return{css:r,cx:(...e)=>{const n=Uf(e),i=ok.fixClassName(a,n,r);return function(e,a,r){const n=[],i=function(e,a,r){var n="";return r.split(" ").forEach((function(r){void 0!==e[r]?a.push(e[r]+";"):r&&(n+=r+" ")})),n}(e,n,r);return n.length<2?r:i+a(n)}(a.registered,r,i)}}}};function tk(a){const{useCache:r}=a;return{useCssAndCx:function(){const a=r(),{css:n,cx:i}=function(a,r){var n;const i=e.useRef();return(!i.current||r.length!==(null===(n=i.current.prevDeps)||void 0===n?void 0:n.length)||i.current.prevDeps.map(((e,a)=>e===r[a])).indexOf(!1)>=0)&&(i.current={v:a(),prevDeps:[...r]}),i.current.v}((()=>ik({cache:a})),[a]);return{css:n,cx:i}}}}const ok=(()=>{const e=new WeakMap;return{saveClassNameCSSObjectMapping:(a,r,n)=>{let i=e.get(a);void 0===i&&(i=new Map,e.set(a,i)),i.set(r,n)},fixClassName:(a,r,n)=>{const i=e.get(a);return Uf(function(e){let a=!1;return e.map((([e,r])=>{if(void 0===r)return e;let n;if(a)n={"&&":r};else{n=e;for(const e in r)if(e.startsWith("@media")){a=!0;break}}return n}))}(r.split(" ").map((e=>[e,null==i?void 0:i.get(e)]))).map((e=>"string"==typeof e?e:n(e))))}}})();function sk(e){if(!(e instanceof Object)||"function"==typeof e)return e;const a=[];for(const r in e){const n=e[r],i=typeof n;if("string"!==i&&("number"!==i||isNaN(n))&&"boolean"!==i&&null!=n)return e;a.push(`${r}:${i}_${n}`)}return"xSqLiJdLMd9s"+a.join("|")}function lk(e,a,r){if(!(a instanceof Object))return e;const n={};return Vf(e).forEach((i=>n[i]=r(e[i],a[i]))),Vf(a).forEach((r=>{if(r in e)return;const i=a[r];"string"==typeof i&&(n[r]=i)})),n}const ck=({classes:a,theme:r,muiStyleOverridesParams:n,css:i,cx:t,name:o})=>{var s,l;if("makeStyle no name"!==o){if(void 0!==n&&void 0===o)throw new Error("To use muiStyleOverridesParams, you must specify a name using .withName('MyComponent')")}else o=void 0;let c;try{c=void 0===o?void 0:(null===(l=null===(s=r.components)||void 0===s?void 0:s[o])||void 0===l?void 0:l.styleOverrides)||void 0}catch(e){}const d=e.useMemo((()=>{if(void 0===c)return;const e={};for(const a in c){const t=c[a];t instanceof Object&&(e[a]=i("function"==typeof t?t({theme:r,ownerState:null==n?void 0:n.ownerState,...null==n?void 0:n.props}):t))}return e}),[c,sk(null==n?void 0:n.props),sk(null==n?void 0:n.ownerState),i]);return{classes:a=e.useMemo((()=>lk(a,d,t)),[a,d,t])}};let dk=0;function uk(a){const{useTheme:r,cache:n}=a,{useCache:i}=mk({cacheProvidedAtInception:n}),{useCssAndCx:t}=tk({useCache:i});return{makeStyles:function(a){const{name:n,uniqId:o=""+dk++}=null!=a?a:{},s="object"!=typeof n?n:Object.keys(n)[0];return function(a){const n="function"==typeof a?a:()=>a;return function(a,l){const c=r();let{css:d,cx:u}=t();const h=i();let m=e.useMemo((()=>{const e={},r="undefined"!=typeof Proxy&&new Proxy({},{get:(a,r)=>("symbol"==typeof r&&Hf(!1),e[r]=`${h.key}-${o}${void 0!==s?`-${s}`:""}-${r}-ref`)}),i=n(c,a,r||{}),t=Bf(Vf(i).map((a=>{const r=i[a];return r.label||(r.label=`${void 0!==s?`${s}-`:""}${a}`),[a,`${d(r)}${Wf(0,a in e)?` ${e[a]}`:""}`]})));return Vf(e).forEach((a=>{a in t||(t[a]=e[a])})),t}),[h,d,u,c,sk(a)]);{const a=null==l?void 0:l.props.classes;m=e.useMemo((()=>lk(m,a,u)),[m,sk(a),u])}{const e=ck({classes:m,css:d,cx:u,name:null!=s?s:"makeStyle no name",idOfUseStyles:o,muiStyleOverridesParams:l,theme:c});void 0!==e.classes&&(m=e.classes),void 0!==e.css&&(d=e.css),void 0!==e.cx&&(u=e.cx)}return{classes:m,theme:c,css:d,cx:u}}}},useStyles:function(){const e=r(),{css:a,cx:n}=t();return{theme:e,css:a,cx:n}}}}const hk=e.createContext(void 0),{createUseCache:mk}={createUseCache:function(a){const{cacheProvidedAtInception:r}=a;return{useCache:function(){var a;const i=n.__unsafe_useEmotionCache(),t=e.useContext(hk),o=null!==(a=null!=r?r:t)&&void 0!==a?a:i;if(null===o)throw new Error(["In order to get SSR working with tss-react you need to explicitly provide an Emotion cache.","MUI users be aware: This is not an error strictly related to tss-react, with or without tss-react,","MUI needs an Emotion cache to be provided for SSR to work.","Here is the MUI documentation related to SSR setup: https://mui.com/material-ui/guides/server-rendering/","TSS provides helper that makes the process of setting up SSR easier: https://docs.tss-react.dev/ssr"].join("\n"));return o}}}};function gk(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pk(a){const{useTheme:r,cache:n}=a,{makeStyles:i}=uk({useTheme:r,cache:n});function t(a,r,n){const t="string"==typeof a?(()=>{const r=a,n=function({children:a,...n}){return e.createElement(r,n,a)};return Object.defineProperty(n,"name",{value:gk(r)}),n})():a,o=(()=>{{const{name:e}=null!=n?n:{};if(void 0!==e)return"object"!=typeof e?e:Object.keys(e)[0]}let e;{const a=t.displayName;"string"==typeof a&&""!==a&&(e=a)}e:{if(void 0!==e)break e;const a=t.name;"string"==typeof a&&""!==a&&(e=a)}if(void 0!==e)return e=e.replace(/\$/g,"usd"),e=e.replace(/\(/g,"_").replace(/\)/g,"_"),e=e.replace(/[^a-zA-Z0-9-_]/g,"_"),e})(),s=i({...n,name:o})("function"==typeof r?(e,a,n)=>yk(r(e,a,n)):yk(r));function l(e){for(const a in e)if("root"!==a)return!0;return!1}const c=e.forwardRef((function(r,n){const{className:i,classes:o,...c}=r,{classes:d,cx:u}=s(r,{props:r}),h=u(d.root,i);return bk.set(d,{...d,root:h}),e.createElement(t,{ref:n,className:l(d)?i:h,..."string"==typeof a?{}:{classes:d},...c})}));return void 0!==o&&(c.displayName=`${gk(o)}WithStyles`,Object.defineProperty(c,"name",{value:c.displayName})),c}return t.getClasses=kk,{withStyles:t}}const bk=new WeakMap,fk="getClasses should only be used in conjunction with withStyles";function kk(e){const a=e.classes;if(void 0===a)throw new Error(fk);const r=bk.get(a);if(void 0===r)throw new Error(fk);return r}function yk(e){const a={},r={};return Object.keys(e).forEach((n=>(n.startsWith("@media")?r:a)[n]=e[n])),Object.keys(r).forEach((e=>{const n=r[e];Object.keys(n).forEach((r=>{var i;return a[r]={...null!==(i=a[r])&&void 0!==i?i:{},[e]:n[r]}}))})),a}const vk=(()=>{const e="object"==typeof document&&"function"==typeof(null===document||void 0===document?void 0:document.getElementById),a="undefined"!=typeof jest,r="undefined"!=typeof mocha,n="undefined"!=typeof __vitest_worker__;return!(e||a||r||n)})();function wk(e){zk=0,jk.splice(0,jk.length);const{useContext:a,usePlugin:r,cache:n}=e,{useCache:i}=mk({cacheProvidedAtInception:n}),{useCssAndCx:t}=tk({useCache:i});return{tss:xk({useContext:a,useCache:i,useCssAndCx:t,usePlugin:null!=r?r:({classes:e,cx:a,css:r})=>({classes:e,cx:a,css:r}),name:void 0,doesUseNestedSelectors:!1})}}let zk=0;const jk=[];function xk(e){const{useContext:a,useCache:r,useCssAndCx:n,usePlugin:i,name:t,doesUseNestedSelectors:o}=e;return{withParams:()=>xk({...e}),withName:a=>xk({...e,name:"object"!=typeof a?a:Object.keys(a)[0]}),withNestedSelectors:()=>xk({...e,doesUseNestedSelectors:!0}),create:e=>{const s="x"+zk++;if(void 0!==t)for(;;){const e=jk.find((e=>e.name===t));if(void 0===e)break;jk.splice(jk.indexOf(e),1)}const l="function"==typeof e?e:()=>e;return function(c){var d,u,h;const{classesOverrides:m,...g}=null!=c?c:{},p=a(),{css:b,cx:f}=n(),k=r(),y=function(e){const{cache:a,cssObjectByRuleNameOrGetCssObjectByRuleName:r,classesOverridesRef:n,paramsAndPluginParamsRef:i,idOfUseStyles:t,context:o,getClasses:s}=e;e:{const e=$k.get(a);if(void 0===e)break e;const s=e.get(r);if(void 0===s)break e;const l=s.get(n);if(void 0===l)break e;const c=l.get(i);if(void 0===c)break e;const d=c.find((({context:e})=>{if(e===o)return!0;if(Vf(e).length!==Vf(o).length)return!1;for(const a in e)if(sk(e[a])!==sk(o[a]))return!1;return!0}));if(void 0!==d){if((null==d?void 0:d.idOfUseStyles)===t)return d.result;c.splice(c.indexOf(d),1)}}const l=s();{$k.has(a)||$k.set(a,new WeakMap);const e=$k.get(a);Hf(void 0!==e),e.has(r)||e.set(r,new Map);const s=e.get(r);Hf(void 0!==s),s.has(n)||(s.size>200&&s.clear(),s.set(n,new Map));const c=s.get(n);if(Hf(void 0!==c),!c.has(i)){{const e="string"==typeof i?257:5;c.size<e||c.clear()}c.set(i,[])}let d=c.get(i);Hf(void 0!==d),d.length>5&&(d=[]),d.push({idOfUseStyles:t,context:o,result:l})}return l}({cache:k,cssObjectByRuleNameOrGetCssObjectByRuleName:e,classesOverridesRef:sk(m),paramsAndPluginParamsRef:sk(g),idOfUseStyles:s,context:p,getClasses:()=>{const e={},a=l({...c,...p,...o?{classes:"undefined"==typeof Proxy?{}:new Proxy({},{get:(a,r)=>{if("symbol"==typeof r&&Hf(!1),vk&&void 0===t)throw new Error(["tss-react: In SSR setups, in order to use nested selectors, you must also give a unique name to the useStyle function.",'Solution: Use tss.withName("ComponentName").withNestedSelectors<...>()... to set a name.'].join("\n"));e:{if(void 0===t)break e;let e=jk.find((e=>e.name===t&&e.idOfUseStyles===s));void 0===e&&(e={name:t,idOfUseStyles:s,nestedSelectorRuleNames:new Set},jk.push(e)),e.nestedSelectorRuleNames.add(r)}e:{if(void 0===t)break e;const e=void 0!==jk.find((e=>e.name===t&&e.idOfUseStyles!==s&&e.nestedSelectorRuleNames.has(r)));if(e)throw new Error([`tss-react: There are in your codebase two different useStyles named "${t}" that`,`both use use the nested selector ${r}.\n`,"This may lead to CSS class name collisions, causing nested selectors to target elements outside of the intended scope.\n","Solution: Ensure each useStyles using nested selectors has a unique name.\n",'Use: tss.withName("UniqueName").withNestedSelectors<...>()...'].join(" "))}return e[r]=`${k.key}-${void 0!==t?t:s}-${r}-ref`}})}:{}});let r=Bf(Vf(a).map((r=>{const n=a[r];return n.label||(n.label=`${void 0!==t?`${t}-`:""}${r}`),[r,`${b(n)}${Wf(0,r in e)?` ${e[r]}`:""}`]})));return Vf(e).forEach((a=>{a in r||(r[a]=e[a])})),r=lk(r,m,f),r}}),v=i({classes:y,css:b,cx:f,idOfUseStyles:s,name:t,...p,...g});return{classes:null!==(d=v.classes)&&void 0!==d?d:y,css:null!==(u=v.css)&&void 0!==u?u:b,cx:null!==(h=v.cx)&&void 0!==h?h:f,...p}}}}}const $k=new WeakMap;const{tss:qk}=wk({useContext:()=>({})});qk.create({});const{makeStyles:Ck,withStyles:Sk}={...uk(Ok={useTheme:qo}),...pk(Ok)};var Ok;const{tss:Ek}=wk({useContext:function(){return{theme:qo()}},usePlugin:ck});Ek.create({});var Mk=function(e,a){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=a(e[r],r,e);return i};var _k=function(){this.__data__=[],this.size=0};var Ak=function(e,a){return e===a||e!=e&&a!=a},Dk=Ak;var Tk=function(e,a){for(var r=e.length;r--;)if(Dk(e[r][0],a))return r;return-1},Nk=Tk,Ik=Array.prototype.splice;var Fk=function(e){var a=this.__data__,r=Nk(a,e);return!(r<0)&&(r==a.length-1?a.pop():Ik.call(a,r,1),--this.size,!0)},Pk=Tk;var Rk=function(e){var a=this.__data__,r=Pk(a,e);return r<0?void 0:a[r][1]},Lk=Tk;var Bk=Tk;var Vk=function(e,a){var r=this.__data__,n=Bk(r,e);return n<0?(++this.size,r.push([e,a])):r[n][1]=a,this},Hk=_k,Wk=Fk,Uk=Rk,Gk=function(e){return Lk(this.__data__,e)>-1},Kk=Vk;function Zk(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}Zk.prototype.clear=Hk,Zk.prototype.delete=Wk,Zk.prototype.get=Uk,Zk.prototype.has=Gk,Zk.prototype.set=Kk;var Jk=Zk,Yk=Jk;var Xk=function(){this.__data__=new Yk,this.size=0};var Qk=function(e){var a=this.__data__,r=a.delete(e);return this.size=a.size,r};var ey=function(e){return this.__data__.get(e)};var ay=function(e){return this.__data__.has(e)},ry="object"==typeof global&&global&&global.Object===Object&&global,ny=ry,iy="object"==typeof self&&self&&self.Object===Object&&self,ty=ny||iy||Function("return this")(),oy=ty.Symbol,sy=oy,ly=Object.prototype,cy=ly.hasOwnProperty,dy=ly.toString,uy=sy?sy.toStringTag:void 0;var hy=function(e){var a=cy.call(e,uy),r=e[uy];try{e[uy]=void 0;var n=!0}catch(e){}var i=dy.call(e);return n&&(a?e[uy]=r:delete e[uy]),i},my=Object.prototype.toString;var gy=hy,py=function(e){return my.call(e)},by=oy?oy.toStringTag:void 0;var fy=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":by&&by in Object(e)?gy(e):py(e)};var ky=function(e){var a=typeof e;return null!=e&&("object"==a||"function"==a)},yy=fy,vy=ky;var wy,zy=function(e){if(!vy(e))return!1;var a=yy(e);return"[object Function]"==a||"[object GeneratorFunction]"==a||"[object AsyncFunction]"==a||"[object Proxy]"==a},jy=ty["__core-js_shared__"],xy=(wy=/[^.]+$/.exec(jy&&jy.keys&&jy.keys.IE_PROTO||""))?"Symbol(src)_1."+wy:"";var $y=function(e){return!!xy&&xy in e},qy=Function.prototype.toString;var Cy=function(e){if(null!=e){try{return qy.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Sy=zy,Oy=$y,Ey=ky,My=Cy,_y=/^\[object .+?Constructor\]$/,Ay=Function.prototype,Dy=Object.prototype,Ty=Ay.toString,Ny=Dy.hasOwnProperty,Iy=RegExp("^"+Ty.call(Ny).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Fy=function(e){return!(!Ey(e)||Oy(e))&&(Sy(e)?Iy:_y).test(My(e))},Py=function(e,a){return null==e?void 0:e[a]};var Ry=function(e,a){var r=Py(e,a);return Fy(r)?r:void 0},Ly=Ry(ty,"Map"),By=Ry(Object,"create"),Vy=By;var Hy=function(){this.__data__=Vy?Vy(null):{},this.size=0};var Wy=function(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a},Uy=By,Gy=Object.prototype.hasOwnProperty;var Ky=function(e){var a=this.__data__;if(Uy){var r=a[e];return"__lodash_hash_undefined__"===r?void 0:r}return Gy.call(a,e)?a[e]:void 0},Zy=By,Jy=Object.prototype.hasOwnProperty;var Yy=By;var Xy=Hy,Qy=Wy,ev=Ky,av=function(e){var a=this.__data__;return Zy?void 0!==a[e]:Jy.call(a,e)},rv=function(e,a){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Yy&&void 0===a?"__lodash_hash_undefined__":a,this};function nv(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}nv.prototype.clear=Xy,nv.prototype.delete=Qy,nv.prototype.get=ev,nv.prototype.has=av,nv.prototype.set=rv;var iv=nv,tv=Jk,ov=Ly;var sv=function(e){var a=typeof e;return"string"==a||"number"==a||"symbol"==a||"boolean"==a?"__proto__"!==e:null===e};var lv=function(e,a){var r=e.__data__;return sv(a)?r["string"==typeof a?"string":"hash"]:r.map},cv=lv;var dv=function(e){var a=cv(this,e).delete(e);return this.size-=a?1:0,a},uv=lv;var hv=lv;var mv=lv;var gv=function(){this.size=0,this.__data__={hash:new iv,map:new(ov||tv),string:new iv}},pv=dv,bv=function(e){return uv(this,e).get(e)},fv=function(e){return hv(this,e).has(e)},kv=function(e,a){var r=mv(this,e),n=r.size;return r.set(e,a),this.size+=r.size==n?0:1,this};function yv(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}yv.prototype.clear=gv,yv.prototype.delete=pv,yv.prototype.get=bv,yv.prototype.has=fv,yv.prototype.set=kv;var vv=yv,wv=Jk,zv=Ly,jv=vv;var xv=Jk,$v=Xk,qv=Qk,Cv=ey,Sv=ay,Ov=function(e,a){var r=this.__data__;if(r instanceof wv){var n=r.__data__;if(!zv||n.length<199)return n.push([e,a]),this.size=++r.size,this;r=this.__data__=new jv(n)}return r.set(e,a),this.size=r.size,this};function Ev(e){var a=this.__data__=new xv(e);this.size=a.size}Ev.prototype.clear=$v,Ev.prototype.delete=qv,Ev.prototype.get=Cv,Ev.prototype.has=Sv,Ev.prototype.set=Ov;var Mv=Ev;var _v=function(e,a){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==a(e[r],r,e););return e},Av=Ry,Dv=function(){try{var e=Av(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tv=Dv;var Nv=function(e,a,r){"__proto__"==a&&Tv?Tv(e,a,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[a]=r},Iv=Nv,Fv=Ak,Pv=Object.prototype.hasOwnProperty;var Rv=function(e,a,r){var n=e[a];Pv.call(e,a)&&Fv(n,r)&&(void 0!==r||a in e)||Iv(e,a,r)},Lv=Rv,Bv=Nv;var Vv=function(e,a,r,n){var i=!r;r||(r={});for(var t=-1,o=a.length;++t<o;){var s=a[t],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),i?Bv(r,s,l):Lv(r,s,l)}return r};var Hv=function(e,a){for(var r=-1,n=Array(e);++r<e;)n[r]=a(r);return n};var Wv=function(e){return null!=e&&"object"==typeof e},Uv=fy,Gv=Wv;var Kv=function(e){return Gv(e)&&"[object Arguments]"==Uv(e)},Zv=Wv,Jv=Object.prototype,Yv=Jv.hasOwnProperty,Xv=Jv.propertyIsEnumerable,Qv=Kv(function(){return arguments}())?Kv:function(e){return Zv(e)&&Yv.call(e,"callee")&&!Xv.call(e,"callee")},ew=Array.isArray,aw={exports:{}};var rw=function(){return!1};!function(e,a){var r=ty,n=rw,i=a&&!a.nodeType&&a,t=i&&e&&!e.nodeType&&e,o=t&&t.exports===i?r.Buffer:void 0,s=(o?o.isBuffer:void 0)||n;e.exports=s}(aw,aw.exports);var nw=aw.exports,iw=/^(?:0|[1-9]\d*)$/;var tw=function(e,a){var r=typeof e;return!!(a=null==a?9007199254740991:a)&&("number"==r||"symbol"!=r&&iw.test(e))&&e>-1&&e%1==0&&e<a};var ow=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},sw=fy,lw=ow,cw=Wv,dw={};dw["[object Float32Array]"]=dw["[object Float64Array]"]=dw["[object Int8Array]"]=dw["[object Int16Array]"]=dw["[object Int32Array]"]=dw["[object Uint8Array]"]=dw["[object Uint8ClampedArray]"]=dw["[object Uint16Array]"]=dw["[object Uint32Array]"]=!0,dw["[object Arguments]"]=dw["[object Array]"]=dw["[object ArrayBuffer]"]=dw["[object Boolean]"]=dw["[object DataView]"]=dw["[object Date]"]=dw["[object Error]"]=dw["[object Function]"]=dw["[object Map]"]=dw["[object Number]"]=dw["[object Object]"]=dw["[object RegExp]"]=dw["[object Set]"]=dw["[object String]"]=dw["[object WeakMap]"]=!1;var uw=function(e){return cw(e)&&lw(e.length)&&!!dw[sw(e)]};var hw=function(e){return function(a){return e(a)}},mw={exports:{}};!function(e,a){var r=ry,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n&&r.process,o=function(){try{var e=i&&i.require&&i.require("util").types;return e||t&&t.binding&&t.binding("util")}catch(e){}}();e.exports=o}(mw,mw.exports);var gw=mw.exports,pw=uw,bw=hw,fw=gw&&gw.isTypedArray,kw=fw?bw(fw):pw,yw=Hv,vw=Qv,ww=ew,zw=nw,jw=tw,xw=kw,$w=Object.prototype.hasOwnProperty;var qw=function(e,a){var r=ww(e),n=!r&&vw(e),i=!r&&!n&&zw(e),t=!r&&!n&&!i&&xw(e),o=r||n||i||t,s=o?yw(e.length,String):[],l=s.length;for(var c in e)!a&&!$w.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||t&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||jw(c,l))||s.push(c);return s},Cw=Object.prototype;var Sw=function(e){var a=e&&e.constructor;return e===("function"==typeof a&&a.prototype||Cw)};var Ow=function(e,a){return function(r){return e(a(r))}},Ew=Ow(Object.keys,Object),Mw=Sw,_w=Ew,Aw=Object.prototype.hasOwnProperty;var Dw=function(e){if(!Mw(e))return _w(e);var a=[];for(var r in Object(e))Aw.call(e,r)&&"constructor"!=r&&a.push(r);return a},Tw=zy,Nw=ow;var Iw=function(e){return null!=e&&Nw(e.length)&&!Tw(e)},Fw=qw,Pw=Dw,Rw=Iw;var Lw=function(e){return Rw(e)?Fw(e):Pw(e)},Bw=Vv,Vw=Lw;var Hw=function(e,a){return e&&Bw(a,Vw(a),e)};var Ww=function(e){var a=[];if(null!=e)for(var r in Object(e))a.push(r);return a},Uw=ky,Gw=Sw,Kw=Ww,Zw=Object.prototype.hasOwnProperty;var Jw=function(e){if(!Uw(e))return Kw(e);var a=Gw(e),r=[];for(var n in e)("constructor"!=n||!a&&Zw.call(e,n))&&r.push(n);return r},Yw=qw,Xw=Jw,Qw=Iw;var ez=function(e){return Qw(e)?Yw(e,!0):Xw(e)},az=Vv,rz=ez;var nz=function(e,a){return e&&az(a,rz(a),e)},iz={exports:{}};!function(e,a){var r=ty,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n?r.Buffer:void 0,o=t?t.allocUnsafe:void 0;e.exports=function(e,a){if(a)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}}(iz,iz.exports);var tz=iz.exports;var oz=function(e,a){var r=-1,n=e.length;for(a||(a=Array(n));++r<n;)a[r]=e[r];return a};var sz=function(e,a){for(var r=-1,n=null==e?0:e.length,i=0,t=[];++r<n;){var o=e[r];a(o,r,e)&&(t[i++]=o)}return t};var lz=function(){return[]},cz=sz,dz=lz,uz=Object.prototype.propertyIsEnumerable,hz=Object.getOwnPropertySymbols,mz=hz?function(e){return null==e?[]:(e=Object(e),cz(hz(e),(function(a){return uz.call(e,a)})))}:dz,gz=Vv,pz=mz;var bz=function(e,a){return gz(e,pz(e),a)};var fz=function(e,a){for(var r=-1,n=a.length,i=e.length;++r<n;)e[i+r]=a[r];return e},kz=Ow(Object.getPrototypeOf,Object),yz=fz,vz=kz,wz=mz,zz=lz,jz=Object.getOwnPropertySymbols?function(e){for(var a=[];e;)yz(a,wz(e)),e=vz(e);return a}:zz,xz=Vv,$z=jz;var qz=function(e,a){return xz(e,$z(e),a)},Cz=fz,Sz=ew;var Oz=function(e,a,r){var n=a(e);return Sz(e)?n:Cz(n,r(e))},Ez=Oz,Mz=mz,_z=Lw;var Az=function(e){return Ez(e,_z,Mz)},Dz=Oz,Tz=jz,Nz=ez;var Iz=function(e){return Dz(e,Nz,Tz)},Fz=Ry(ty,"DataView"),Pz=Ly,Rz=Ry(ty,"Promise"),Lz=Ry(ty,"Set"),Bz=Ry(ty,"WeakMap"),Vz=fy,Hz=Cy,Wz="[object Map]",Uz="[object Promise]",Gz="[object Set]",Kz="[object WeakMap]",Zz="[object DataView]",Jz=Hz(Fz),Yz=Hz(Pz),Xz=Hz(Rz),Qz=Hz(Lz),ej=Hz(Bz),aj=Vz;(Fz&&aj(new Fz(new ArrayBuffer(1)))!=Zz||Pz&&aj(new Pz)!=Wz||Rz&&aj(Rz.resolve())!=Uz||Lz&&aj(new Lz)!=Gz||Bz&&aj(new Bz)!=Kz)&&(aj=function(e){var a=Vz(e),r="[object Object]"==a?e.constructor:void 0,n=r?Hz(r):"";if(n)switch(n){case Jz:return Zz;case Yz:return Wz;case Xz:return Uz;case Qz:return Gz;case ej:return Kz}return a});var rj=aj,nj=Object.prototype.hasOwnProperty;var ij=function(e){var a=e.length,r=new e.constructor(a);return a&&"string"==typeof e[0]&&nj.call(e,"index")&&(r.index=e.index,r.input=e.input),r},tj=ty.Uint8Array;var oj=function(e){var a=new e.constructor(e.byteLength);return new tj(a).set(new tj(e)),a},sj=oj;var lj=function(e,a){var r=a?sj(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},cj=/\w*$/;var dj=function(e){var a=new e.constructor(e.source,cj.exec(e));return a.lastIndex=e.lastIndex,a},uj=oy?oy.prototype:void 0,hj=uj?uj.valueOf:void 0;var mj=oj;var gj=oj,pj=lj,bj=dj,fj=function(e){return hj?Object(hj.call(e)):{}},kj=function(e,a){var r=a?mj(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var yj=function(e,a,r){var n=e.constructor;switch(a){case"[object ArrayBuffer]":return gj(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return pj(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return kj(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return bj(e);case"[object Symbol]":return fj(e)}},vj=ky,wj=Object.create,zj=function(){function e(){}return function(a){if(!vj(a))return{};if(wj)return wj(a);e.prototype=a;var r=new e;return e.prototype=void 0,r}}(),jj=zj,xj=kz,$j=Sw;var qj=function(e){return"function"!=typeof e.constructor||$j(e)?{}:jj(xj(e))},Cj=rj,Sj=Wv;var Oj=function(e){return Sj(e)&&"[object Map]"==Cj(e)},Ej=hw,Mj=gw&&gw.isMap,_j=Mj?Ej(Mj):Oj,Aj=rj,Dj=Wv;var Tj=function(e){return Dj(e)&&"[object Set]"==Aj(e)},Nj=hw,Ij=gw&&gw.isSet,Fj=Ij?Nj(Ij):Tj,Pj=Mv,Rj=_v,Lj=Rv,Bj=Hw,Vj=nz,Hj=tz,Wj=oz,Uj=bz,Gj=qz,Kj=Az,Zj=Iz,Jj=rj,Yj=ij,Xj=yj,Qj=qj,ex=ew,ax=nw,rx=_j,nx=ky,ix=Fj,tx=Lw,ox=ez,sx="[object Arguments]",lx="[object Function]",cx="[object Object]",dx={};dx[sx]=dx["[object Array]"]=dx["[object ArrayBuffer]"]=dx["[object DataView]"]=dx["[object Boolean]"]=dx["[object Date]"]=dx["[object Float32Array]"]=dx["[object Float64Array]"]=dx["[object Int8Array]"]=dx["[object Int16Array]"]=dx["[object Int32Array]"]=dx["[object Map]"]=dx["[object Number]"]=dx[cx]=dx["[object RegExp]"]=dx["[object Set]"]=dx["[object String]"]=dx["[object Symbol]"]=dx["[object Uint8Array]"]=dx["[object Uint8ClampedArray]"]=dx["[object Uint16Array]"]=dx["[object Uint32Array]"]=!0,dx["[object Error]"]=dx[lx]=dx["[object WeakMap]"]=!1;var ux=function e(a,r,n,i,t,o){var s,l=1&r,c=2&r,d=4&r;if(n&&(s=t?n(a,i,t,o):n(a)),void 0!==s)return s;if(!nx(a))return a;var u=ex(a);if(u){if(s=Yj(a),!l)return Wj(a,s)}else{var h=Jj(a),m=h==lx||"[object GeneratorFunction]"==h;if(ax(a))return Hj(a,l);if(h==cx||h==sx||m&&!t){if(s=c||m?{}:Qj(a),!l)return c?Gj(a,Vj(s,a)):Uj(a,Bj(s,a))}else{if(!dx[h])return t?a:{};s=Xj(a,h,l)}}o||(o=new Pj);var g=o.get(a);if(g)return g;o.set(a,s),ix(a)?a.forEach((function(i){s.add(e(i,r,n,i,a,o))})):rx(a)&&a.forEach((function(i,t){s.set(t,e(i,r,n,t,a,o))}));var p=u?void 0:(d?c?Zj:Kj:c?ox:tx)(a);return Rj(p||a,(function(i,t){p&&(i=a[t=i]),Lj(s,t,e(i,r,n,t,a,o))})),s},hx=fy,mx=Wv;var gx=function(e){return"symbol"==typeof e||mx(e)&&"[object Symbol]"==hx(e)},px=ew,bx=gx,fx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kx=/^\w*$/;var yx=function(e,a){if(px(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!bx(e))||(kx.test(e)||!fx.test(e)||null!=a&&e in Object(a))},vx=vv;function wx(e,a){if("function"!=typeof e||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=a?a.apply(this,n):n[0],t=r.cache;if(t.has(i))return t.get(i);var o=e.apply(this,n);return r.cache=t.set(i,o)||t,o};return r.cache=new(wx.Cache||vx),r}wx.Cache=vx;var zx=wx;var jx=function(e){var a=zx(e,(function(e){return 500===r.size&&r.clear(),e})),r=a.cache;return a},xx=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$x=/\\(\\)?/g,qx=jx((function(e){var a=[];return 46===e.charCodeAt(0)&&a.push(""),e.replace(xx,(function(e,r,n,i){a.push(n?i.replace($x,"$1"):r||e)})),a})),Cx=qx,Sx=Mk,Ox=ew,Ex=gx,Mx=oy?oy.prototype:void 0,_x=Mx?Mx.toString:void 0;var Ax=function e(a){if("string"==typeof a)return a;if(Ox(a))return Sx(a,e)+"";if(Ex(a))return _x?_x.call(a):"";var r=a+"";return"0"==r&&1/a==-1/0?"-0":r},Dx=Ax;var Tx=ew,Nx=yx,Ix=Cx,Fx=function(e){return null==e?"":Dx(e)};var Px=function(e,a){return Tx(e)?e:Nx(e,a)?[e]:Ix(Fx(e))};var Rx=function(e){var a=null==e?0:e.length;return a?e[a-1]:void 0},Lx=gx;var Bx=function(e){if("string"==typeof e||Lx(e))return e;var a=e+"";return"0"==a&&1/e==-1/0?"-0":a},Vx=Px,Hx=Bx;var Wx=function(e,a){for(var r=0,n=(a=Vx(a,e)).length;null!=e&&r<n;)e=e[Hx(a[r++])];return r&&r==n?e:void 0};var Ux=function(e,a,r){var n=-1,i=e.length;a<0&&(a=-a>i?0:i+a),(r=r>i?i:r)<0&&(r+=i),i=a>r?0:r-a>>>0,a>>>=0;for(var t=Array(i);++n<i;)t[n]=e[n+a];return t},Gx=Wx,Kx=Ux;var Zx=Px,Jx=Rx,Yx=function(e,a){return a.length<2?e:Gx(e,Kx(a,0,-1))},Xx=Bx;var Qx=function(e,a){return a=Zx(a,e),null==(e=Yx(e,a))||delete e[Xx(Jx(a))]},e$=fy,a$=kz,r$=Wv,n$=Function.prototype,i$=Object.prototype,t$=n$.toString,o$=i$.hasOwnProperty,s$=t$.call(Object);var l$=function(e){if(!r$(e)||"[object Object]"!=e$(e))return!1;var a=a$(e);if(null===a)return!0;var r=o$.call(a,"constructor")&&a.constructor;return"function"==typeof r&&r instanceof r&&t$.call(r)==s$};var c$=function(e){return l$(e)?void 0:e},d$=Qv,u$=ew,h$=oy?oy.isConcatSpreadable:void 0;var m$=fz,g$=function(e){return u$(e)||d$(e)||!!(h$&&e&&e[h$])};var p$=function e(a,r,n,i,t){var o=-1,s=a.length;for(n||(n=g$),t||(t=[]);++o<s;){var l=a[o];r>0&&n(l)?r>1?e(l,r-1,n,i,t):m$(t,l):i||(t[t.length]=l)}return t},b$=p$;var f$=function(e){return(null==e?0:e.length)?b$(e,1):[]};var k$=function(e,a,r){switch(r.length){case 0:return e.call(a);case 1:return e.call(a,r[0]);case 2:return e.call(a,r[0],r[1]);case 3:return e.call(a,r[0],r[1],r[2])}return e.apply(a,r)},y$=Math.max;var v$=function(e,a,r){return a=y$(void 0===a?e.length-1:a,0),function(){for(var n=arguments,i=-1,t=y$(n.length-a,0),o=Array(t);++i<t;)o[i]=n[a+i];i=-1;for(var s=Array(a+1);++i<a;)s[i]=n[i];return s[a]=r(o),k$(e,this,s)}};var w$=function(e){return function(){return e}},z$=Dv,j$=z$?function(e,a){return z$(e,"toString",{configurable:!0,enumerable:!1,value:w$(a),writable:!0})}:function(e){return e},x$=Date.now;var $$=function(e){var a=0,r=0;return function(){var n=x$(),i=16-(n-r);if(r=n,i>0){if(++a>=800)return arguments[0]}else a=0;return e.apply(void 0,arguments)}}(j$),q$=f$,C$=v$,S$=$$;var O$=Mk,E$=ux,M$=Qx,_$=Px,A$=Vv,D$=c$,T$=Iz,N$=function(e){return S$(C$(e,void 0,q$),e+"")}((function(e,a){var r={};if(null==e)return r;var n=!1;a=O$(a,(function(a){return a=_$(a,e),n||(n=a.length>1),a})),A$(e,T$(e),r),n&&(r=E$(r,7,D$));for(var i=a.length;i--;)M$(r,a[i]);return r})),I$=u(N$);const F$=1,P$=2,R$=2;function L$(e){const r=Object.keys(e.typography.h1).some((e=>e.includes("@media"))),i=n.keyframes`
|
|
41
41
|
0%, 95% {
|
|
42
42
|
opacity: 1;
|
|
43
43
|
}
|