sykpcomposer 0.0.183 → 0.0.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -16,34 +16,34 @@ object-assign
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- */var hf;function j_(){return hf||(hf=1,function(n){process.env.NODE_ENV!=="production"&&function(){var e=U,t=ia(),r=60103,i=60106;n.Fragment=60107;var s=60108,o=60114,a=60109,l=60110,u=60112,g=60113,d=60120,f=60115,m=60116,y=60121,b=60122,C=60117,S=60129,A=60131;if(typeof Symbol=="function"&&Symbol.for){var v=Symbol.for;r=v("react.element"),i=v("react.portal"),n.Fragment=v("react.fragment"),s=v("react.strict_mode"),o=v("react.profiler"),a=v("react.provider"),l=v("react.context"),u=v("react.forward_ref"),g=v("react.suspense"),d=v("react.suspense_list"),f=v("react.memo"),m=v("react.lazy"),y=v("react.block"),b=v("react.server.block"),C=v("react.fundamental"),v("react.scope"),v("react.opaque.id"),S=v("react.debug_trace_mode"),v("react.offscreen"),A=v("react.legacy_hidden")}var k=typeof Symbol=="function"&&Symbol.iterator,T="@@iterator";function N($){if($===null||typeof $!="object")return null;var pe=k&&$[k]||$[T];return typeof pe=="function"?pe:null}var h=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function I($){{for(var pe=arguments.length,Me=new Array(pe>1?pe-1:0),We=1;We<pe;We++)Me[We-1]=arguments[We];O("error",$,Me)}}function O($,pe,Me){{var We=h.ReactDebugCurrentFrame,wt=We.getStackAddendum();wt!==""&&(pe+="%s",Me=Me.concat([wt]));var vt=Me.map(function(ct){return""+ct});vt.unshift("Warning: "+pe),Function.prototype.apply.call(console[$],console,vt)}}var j=!1;function P($){return!!(typeof $=="string"||typeof $=="function"||$===n.Fragment||$===o||$===S||$===s||$===g||$===d||$===A||j||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===f||$.$$typeof===a||$.$$typeof===l||$.$$typeof===u||$.$$typeof===C||$.$$typeof===y||$[0]===b))}function q($,pe,Me){var We=pe.displayName||pe.name||"";return $.displayName||(We!==""?Me+"("+We+")":Me)}function G($){return $.displayName||"Context"}function ne($){if($==null)return null;if(typeof $.tag=="number"&&I("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof $=="function")return $.displayName||$.name||null;if(typeof $=="string")return $;switch($){case n.Fragment:return"Fragment";case i:return"Portal";case o:return"Profiler";case s:return"StrictMode";case g:return"Suspense";case d:return"SuspenseList"}if(typeof $=="object")switch($.$$typeof){case l:var pe=$;return G(pe)+".Consumer";case a:var Me=$;return G(Me._context)+".Provider";case u:return q($,$.render,"ForwardRef");case f:return ne($.type);case y:return ne($._render);case m:{var We=$,wt=We._payload,vt=We._init;try{return ne(vt(wt))}catch{return null}}}return null}var oe=0,ue,fe,Ee,be,ae,de,xe;function Te(){}Te.__reactDisabledLog=!0;function ve(){{if(oe===0){ue=console.log,fe=console.info,Ee=console.warn,be=console.error,ae=console.group,de=console.groupCollapsed,xe=console.groupEnd;var $={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:$,log:$,warn:$,error:$,group:$,groupCollapsed:$,groupEnd:$})}oe++}}function Fe(){{if(oe--,oe===0){var $={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},$,{value:ue}),info:t({},$,{value:fe}),warn:t({},$,{value:Ee}),error:t({},$,{value:be}),group:t({},$,{value:ae}),groupCollapsed:t({},$,{value:de}),groupEnd:t({},$,{value:xe})})}oe<0&&I("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ae=h.ReactCurrentDispatcher,Ne;function ze($,pe,Me){{if(Ne===void 0)try{throw Error()}catch(wt){var We=wt.stack.trim().match(/\n( *(at )?)/);Ne=We&&We[1]||""}return`
20
- `+Ne+$}}var Ce=!1,Pe;{var ft=typeof WeakMap=="function"?WeakMap:Map;Pe=new ft}function we($,pe){if(!$||Ce)return"";{var Me=Pe.get($);if(Me!==void 0)return Me}var We;Ce=!0;var wt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var vt;vt=Ae.current,Ae.current=null,ve();try{if(pe){var ct=function(){throw Error()};if(Object.defineProperty(ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ct,[])}catch(Un){We=Un}Reflect.construct($,[],ct)}else{try{ct.call()}catch(Un){We=Un}$.call(ct.prototype)}}else{try{throw Error()}catch(Un){We=Un}$()}}catch(Un){if(Un&&We&&typeof Un.stack=="string"){for(var et=Un.stack.split(`
19
+ */var hf;function j_(){return hf||(hf=1,function(n){process.env.NODE_ENV!=="production"&&function(){var e=U,t=ia(),r=60103,i=60106;n.Fragment=60107;var s=60108,o=60114,a=60109,l=60110,u=60112,g=60113,d=60120,f=60115,m=60116,y=60121,b=60122,C=60117,S=60129,A=60131;if(typeof Symbol=="function"&&Symbol.for){var v=Symbol.for;r=v("react.element"),i=v("react.portal"),n.Fragment=v("react.fragment"),s=v("react.strict_mode"),o=v("react.profiler"),a=v("react.provider"),l=v("react.context"),u=v("react.forward_ref"),g=v("react.suspense"),d=v("react.suspense_list"),f=v("react.memo"),m=v("react.lazy"),y=v("react.block"),b=v("react.server.block"),C=v("react.fundamental"),v("react.scope"),v("react.opaque.id"),S=v("react.debug_trace_mode"),v("react.offscreen"),A=v("react.legacy_hidden")}var k=typeof Symbol=="function"&&Symbol.iterator,T="@@iterator";function N($){if($===null||typeof $!="object")return null;var pe=k&&$[k]||$[T];return typeof pe=="function"?pe:null}var h=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function I($){{for(var pe=arguments.length,Ne=new Array(pe>1?pe-1:0),We=1;We<pe;We++)Ne[We-1]=arguments[We];O("error",$,Ne)}}function O($,pe,Ne){{var We=h.ReactDebugCurrentFrame,wt=We.getStackAddendum();wt!==""&&(pe+="%s",Ne=Ne.concat([wt]));var vt=Ne.map(function(ct){return""+ct});vt.unshift("Warning: "+pe),Function.prototype.apply.call(console[$],console,vt)}}var j=!1;function P($){return!!(typeof $=="string"||typeof $=="function"||$===n.Fragment||$===o||$===S||$===s||$===g||$===d||$===A||j||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===f||$.$$typeof===a||$.$$typeof===l||$.$$typeof===u||$.$$typeof===C||$.$$typeof===y||$[0]===b))}function q($,pe,Ne){var We=pe.displayName||pe.name||"";return $.displayName||(We!==""?Ne+"("+We+")":Ne)}function G($){return $.displayName||"Context"}function ee($){if($==null)return null;if(typeof $.tag=="number"&&I("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof $=="function")return $.displayName||$.name||null;if(typeof $=="string")return $;switch($){case n.Fragment:return"Fragment";case i:return"Portal";case o:return"Profiler";case s:return"StrictMode";case g:return"Suspense";case d:return"SuspenseList"}if(typeof $=="object")switch($.$$typeof){case l:var pe=$;return G(pe)+".Consumer";case a:var Ne=$;return G(Ne._context)+".Provider";case u:return q($,$.render,"ForwardRef");case f:return ee($.type);case y:return ee($._render);case m:{var We=$,wt=We._payload,vt=We._init;try{return ee(vt(wt))}catch{return null}}}return null}var ue=0,ae,ge,Le,be,oe,fe,Ce;function Te(){}Te.__reactDisabledLog=!0;function ve(){{if(ue===0){ae=console.log,ge=console.info,Le=console.warn,be=console.error,oe=console.group,fe=console.groupCollapsed,Ce=console.groupEnd;var $={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:$,log:$,warn:$,error:$,group:$,groupCollapsed:$,groupEnd:$})}ue++}}function Fe(){{if(ue--,ue===0){var $={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},$,{value:ae}),info:t({},$,{value:ge}),warn:t({},$,{value:Le}),error:t({},$,{value:be}),group:t({},$,{value:oe}),groupCollapsed:t({},$,{value:fe}),groupEnd:t({},$,{value:Ce})})}ue<0&&I("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var De=h.ReactCurrentDispatcher,ke;function ze($,pe,Ne){{if(ke===void 0)try{throw Error()}catch(wt){var We=wt.stack.trim().match(/\n( *(at )?)/);ke=We&&We[1]||""}return`
20
+ `+ke+$}}var xe=!1,Pe;{var ft=typeof WeakMap=="function"?WeakMap:Map;Pe=new ft}function we($,pe){if(!$||xe)return"";{var Ne=Pe.get($);if(Ne!==void 0)return Ne}var We;xe=!0;var wt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var vt;vt=De.current,De.current=null,ve();try{if(pe){var ct=function(){throw Error()};if(Object.defineProperty(ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ct,[])}catch(Un){We=Un}Reflect.construct($,[],ct)}else{try{ct.call()}catch(Un){We=Un}$.call(ct.prototype)}}else{try{throw Error()}catch(Un){We=Un}$()}}catch(Un){if(Un&&We&&typeof Un.stack=="string"){for(var et=Un.stack.split(`
21
21
  `),ln=We.stack.split(`
22
22
  `),Ot=et.length-1,jt=ln.length-1;Ot>=1&&jt>=0&&et[Ot]!==ln[jt];)jt--;for(;Ot>=1&&jt>=0;Ot--,jt--)if(et[Ot]!==ln[jt]){if(Ot!==1||jt!==1)do if(Ot--,jt--,jt<0||et[Ot]!==ln[jt]){var ar=`
23
- `+et[Ot].replace(" at new "," at ");return typeof $=="function"&&Pe.set($,ar),ar}while(Ot>=1&&jt>=0);break}}}finally{Ce=!1,Ae.current=vt,Fe(),Error.prepareStackTrace=wt}var Bn=$?$.displayName||$.name:"",Xo=Bn?ze(Bn):"";return typeof $=="function"&&Pe.set($,Xo),Xo}function yt($,pe,Me){return we($,!1)}function Wt($){var pe=$.prototype;return!!(pe&&pe.isReactComponent)}function Z($,pe,Me){if($==null)return"";if(typeof $=="function")return we($,Wt($));if(typeof $=="string")return ze($);switch($){case g:return ze("Suspense");case d:return ze("SuspenseList")}if(typeof $=="object")switch($.$$typeof){case u:return yt($.render);case f:return Z($.type,pe,Me);case y:return yt($._render);case m:{var We=$,wt=We._payload,vt=We._init;try{return Z(vt(wt),pe,Me)}catch{}}}return""}var re={},ye=h.ReactDebugCurrentFrame;function Ie($){if($){var pe=$._owner,Me=Z($.type,$._source,pe?pe.type:null);ye.setExtraStackFrame(Me)}else ye.setExtraStackFrame(null)}function B($,pe,Me,We,wt){{var vt=Function.call.bind(Object.prototype.hasOwnProperty);for(var ct in $)if(vt($,ct)){var et=void 0;try{if(typeof $[ct]!="function"){var ln=Error((We||"React class")+": "+Me+" type `"+ct+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof $[ct]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ln.name="Invariant Violation",ln}et=$[ct](pe,ct,We,Me,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ot){et=Ot}et&&!(et instanceof Error)&&(Ie(wt),I("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",We||"React class",Me,ct,typeof et),Ie(null)),et instanceof Error&&!(et.message in re)&&(re[et.message]=!0,Ie(wt),I("Failed %s type: %s",Me,et.message),Ie(null))}}}var _=h.ReactCurrentOwner,E=Object.prototype.hasOwnProperty,R={key:!0,ref:!0,__self:!0,__source:!0},Y,J,K;K={};function ke($){if(E.call($,"ref")){var pe=Object.getOwnPropertyDescriptor($,"ref").get;if(pe&&pe.isReactWarning)return!1}return $.ref!==void 0}function Je($){if(E.call($,"key")){var pe=Object.getOwnPropertyDescriptor($,"key").get;if(pe&&pe.isReactWarning)return!1}return $.key!==void 0}function Ct($,pe){if(typeof $.ref=="string"&&_.current&&pe&&_.current.stateNode!==pe){var Me=ne(_.current.type);K[Me]||(I('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ne(_.current.type),$.ref),K[Me]=!0)}}function Ze($,pe){{var Me=function(){Y||(Y=!0,I("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",pe))};Me.isReactWarning=!0,Object.defineProperty($,"key",{get:Me,configurable:!0})}}function Ge($,pe){{var Me=function(){J||(J=!0,I("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",pe))};Me.isReactWarning=!0,Object.defineProperty($,"ref",{get:Me,configurable:!0})}}var Ft=function($,pe,Me,We,wt,vt,ct){var et={$$typeof:r,type:$,key:pe,ref:Me,props:ct,_owner:vt};return et._store={},Object.defineProperty(et._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(et,"_self",{configurable:!1,enumerable:!1,writable:!1,value:We}),Object.defineProperty(et,"_source",{configurable:!1,enumerable:!1,writable:!1,value:wt}),Object.freeze&&(Object.freeze(et.props),Object.freeze(et)),et};function wn($,pe,Me,We,wt){{var vt,ct={},et=null,ln=null;Me!==void 0&&(et=""+Me),Je(pe)&&(et=""+pe.key),ke(pe)&&(ln=pe.ref,Ct(pe,wt));for(vt in pe)E.call(pe,vt)&&!R.hasOwnProperty(vt)&&(ct[vt]=pe[vt]);if($&&$.defaultProps){var Ot=$.defaultProps;for(vt in Ot)ct[vt]===void 0&&(ct[vt]=Ot[vt])}if(et||ln){var jt=typeof $=="function"?$.displayName||$.name||"Unknown":$;et&&Ze(ct,jt),ln&&Ge(ct,jt)}return Ft($,et,ln,wt,We,_.current,ct)}}var Vt=h.ReactCurrentOwner,hn=h.ReactDebugCurrentFrame;function qt($){if($){var pe=$._owner,Me=Z($.type,$._source,pe?pe.type:null);hn.setExtraStackFrame(Me)}else hn.setExtraStackFrame(null)}var Gn;Gn=!1;function gi($){return typeof $=="object"&&$!==null&&$.$$typeof===r}function qo(){{if(Vt.current){var $=ne(Vt.current.type);if($)return`
23
+ `+et[Ot].replace(" at new "," at ");return typeof $=="function"&&Pe.set($,ar),ar}while(Ot>=1&&jt>=0);break}}}finally{xe=!1,De.current=vt,Fe(),Error.prepareStackTrace=wt}var Bn=$?$.displayName||$.name:"",Xo=Bn?ze(Bn):"";return typeof $=="function"&&Pe.set($,Xo),Xo}function yt($,pe,Ne){return we($,!1)}function Wt($){var pe=$.prototype;return!!(pe&&pe.isReactComponent)}function Z($,pe,Ne){if($==null)return"";if(typeof $=="function")return we($,Wt($));if(typeof $=="string")return ze($);switch($){case g:return ze("Suspense");case d:return ze("SuspenseList")}if(typeof $=="object")switch($.$$typeof){case u:return yt($.render);case f:return Z($.type,pe,Ne);case y:return yt($._render);case m:{var We=$,wt=We._payload,vt=We._init;try{return Z(vt(wt),pe,Ne)}catch{}}}return""}var re={},ye=h.ReactDebugCurrentFrame;function Ae($){if($){var pe=$._owner,Ne=Z($.type,$._source,pe?pe.type:null);ye.setExtraStackFrame(Ne)}else ye.setExtraStackFrame(null)}function B($,pe,Ne,We,wt){{var vt=Function.call.bind(Object.prototype.hasOwnProperty);for(var ct in $)if(vt($,ct)){var et=void 0;try{if(typeof $[ct]!="function"){var ln=Error((We||"React class")+": "+Ne+" type `"+ct+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof $[ct]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ln.name="Invariant Violation",ln}et=$[ct](pe,ct,We,Ne,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ot){et=Ot}et&&!(et instanceof Error)&&(Ae(wt),I("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",We||"React class",Ne,ct,typeof et),Ae(null)),et instanceof Error&&!(et.message in re)&&(re[et.message]=!0,Ae(wt),I("Failed %s type: %s",Ne,et.message),Ae(null))}}}var _=h.ReactCurrentOwner,E=Object.prototype.hasOwnProperty,R={key:!0,ref:!0,__self:!0,__source:!0},Y,J,K;K={};function Ee($){if(E.call($,"ref")){var pe=Object.getOwnPropertyDescriptor($,"ref").get;if(pe&&pe.isReactWarning)return!1}return $.ref!==void 0}function Je($){if(E.call($,"key")){var pe=Object.getOwnPropertyDescriptor($,"key").get;if(pe&&pe.isReactWarning)return!1}return $.key!==void 0}function Ct($,pe){if(typeof $.ref=="string"&&_.current&&pe&&_.current.stateNode!==pe){var Ne=ee(_.current.type);K[Ne]||(I('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ee(_.current.type),$.ref),K[Ne]=!0)}}function Ze($,pe){{var Ne=function(){Y||(Y=!0,I("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",pe))};Ne.isReactWarning=!0,Object.defineProperty($,"key",{get:Ne,configurable:!0})}}function Ge($,pe){{var Ne=function(){J||(J=!0,I("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",pe))};Ne.isReactWarning=!0,Object.defineProperty($,"ref",{get:Ne,configurable:!0})}}var Ft=function($,pe,Ne,We,wt,vt,ct){var et={$$typeof:r,type:$,key:pe,ref:Ne,props:ct,_owner:vt};return et._store={},Object.defineProperty(et._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(et,"_self",{configurable:!1,enumerable:!1,writable:!1,value:We}),Object.defineProperty(et,"_source",{configurable:!1,enumerable:!1,writable:!1,value:wt}),Object.freeze&&(Object.freeze(et.props),Object.freeze(et)),et};function wn($,pe,Ne,We,wt){{var vt,ct={},et=null,ln=null;Ne!==void 0&&(et=""+Ne),Je(pe)&&(et=""+pe.key),Ee(pe)&&(ln=pe.ref,Ct(pe,wt));for(vt in pe)E.call(pe,vt)&&!R.hasOwnProperty(vt)&&(ct[vt]=pe[vt]);if($&&$.defaultProps){var Ot=$.defaultProps;for(vt in Ot)ct[vt]===void 0&&(ct[vt]=Ot[vt])}if(et||ln){var jt=typeof $=="function"?$.displayName||$.name||"Unknown":$;et&&Ze(ct,jt),ln&&Ge(ct,jt)}return Ft($,et,ln,wt,We,_.current,ct)}}var Vt=h.ReactCurrentOwner,hn=h.ReactDebugCurrentFrame;function qt($){if($){var pe=$._owner,Ne=Z($.type,$._source,pe?pe.type:null);hn.setExtraStackFrame(Ne)}else hn.setExtraStackFrame(null)}var Gn;Gn=!1;function gi($){return typeof $=="object"&&$!==null&&$.$$typeof===r}function qo(){{if(Vt.current){var $=ee(Vt.current.type);if($)return`
24
24
 
25
- Check the render method of \``+$+"`."}return""}}function Ul($){{if($!==void 0){var pe=$.fileName.replace(/^.*[\\\/]/,""),Me=$.lineNumber;return`
25
+ Check the render method of \``+$+"`."}return""}}function Ul($){{if($!==void 0){var pe=$.fileName.replace(/^.*[\\\/]/,""),Ne=$.lineNumber;return`
26
26
 
27
- Check your code at `+pe+":"+Me+"."}return""}}var Hl={};function pi($){{var pe=qo();if(!pe){var Me=typeof $=="string"?$:$.displayName||$.name;Me&&(pe=`
27
+ Check your code at `+pe+":"+Ne+"."}return""}}var Hl={};function pi($){{var pe=qo();if(!pe){var Ne=typeof $=="string"?$:$.displayName||$.name;Ne&&(pe=`
28
28
 
29
- Check the top-level render call using <`+Me+">.")}return pe}}function mi($,pe){{if(!$._store||$._store.validated||$.key!=null)return;$._store.validated=!0;var Me=pi(pe);if(Hl[Me])return;Hl[Me]=!0;var We="";$&&$._owner&&$._owner!==Vt.current&&(We=" It was passed a child from "+ne($._owner.type)+"."),qt($),I('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Me,We),qt(null)}}function Ko($,pe){{if(typeof $!="object")return;if(Array.isArray($))for(var Me=0;Me<$.length;Me++){var We=$[Me];gi(We)&&mi(We,pe)}else if(gi($))$._store&&($._store.validated=!0);else if($){var wt=N($);if(typeof wt=="function"&&wt!==$.entries)for(var vt=wt.call($),ct;!(ct=vt.next()).done;)gi(ct.value)&&mi(ct.value,pe)}}}function Wl($){{var pe=$.type;if(pe==null||typeof pe=="string")return;var Me;if(typeof pe=="function")Me=pe.propTypes;else if(typeof pe=="object"&&(pe.$$typeof===u||pe.$$typeof===f))Me=pe.propTypes;else return;if(Me){var We=ne(pe);B(Me,$.props,"prop",We,$)}else if(pe.PropTypes!==void 0&&!Gn){Gn=!0;var wt=ne(pe);I("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",wt||"Unknown")}typeof pe.getDefaultProps=="function"&&!pe.getDefaultProps.isReactClassApproved&&I("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mn($){{for(var pe=Object.keys($.props),Me=0;Me<pe.length;Me++){var We=pe[Me];if(We!=="children"&&We!=="key"){qt($),I("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",We),qt(null);break}}$.ref!==null&&(qt($),I("Invalid attribute `ref` supplied to `React.Fragment`."),qt(null))}}function an($,pe,Me,We,wt,vt){{var ct=P($);if(!ct){var et="";($===void 0||typeof $=="object"&&$!==null&&Object.keys($).length===0)&&(et+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ln=Ul(wt);ln?et+=ln:et+=qo();var Ot;$===null?Ot="null":Array.isArray($)?Ot="array":$!==void 0&&$.$$typeof===r?(Ot="<"+(ne($.type)||"Unknown")+" />",et=" Did you accidentally export a JSX literal instead of a component?"):Ot=typeof $,I("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ot,et)}var jt=wn($,pe,Me,wt,vt);if(jt==null)return jt;if(ct){var ar=pe.children;if(ar!==void 0)if(We)if(Array.isArray(ar)){for(var Bn=0;Bn<ar.length;Bn++)Ko(ar[Bn],$);Object.freeze&&Object.freeze(ar)}else I("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ko(ar,$)}return $===n.Fragment?Mn(jt):Wl(jt),jt}}function Go($,pe,Me){return an($,pe,Me,!0)}function Yd($,pe,Me){return an($,pe,Me,!1)}var $l=Yd,Yl=Go;n.jsx=$l,n.jsxs=Yl}()}(tc)),tc}process.env.NODE_ENV==="production"?Ql.exports=O_():Ql.exports=j_();var F=Ql.exports;const gf=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],pf=gf[Math.floor(Math.random()*gf.length)],P_=U.createContext({clientID:0,color:pf[1],isCollabActive:!1,name:pf[0],yjsDocMap:new Map});function mf(n,e){const t=U.useContext(P_);return n!=null&&(t.name=n),e!=null&&(t.color=e),t}function F_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var z_=F_(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const sa=U.createContext(null);function yf(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function $t(){const n=U.useContext(sa);return n==null&&z_(8),n}function wi(n){return{}}const Hn={},_f={},$s={},qr={},Ji={},Ys={},vi={},oa={},nc={},Zi={},xi={},mn={},aa={},la={},B_={},rc={},U_={},ic={},H_={},sc={},oc={},Ci={},W_={},Vs={},qs={},Ks={},bf={},$_={},Y_={},wf={},ca={},Qi={},es={},ua={},V_={},da={},ac={},lc={},vf={},xf={},cc={},Cf={},q_={},Qn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K_=Qn&&"documentMode"in document?document.documentMode:null,er=Qn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Kr=Qn&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),fa=!(!Qn||!("InputEvent"in window)||K_)&&"getTargetRanges"in new window.InputEvent("input"),uc=Qn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ha=Qn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,G_=Qn&&/Android/.test(navigator.userAgent),Sf=Qn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),X_=Qn&&G_&&Sf,dc=Qn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Sf,Gs=1,Gr=3,Si=0,Tf=1,ts=2,J_=0,Z_=1,Q_=2,ga=4,pa=8,fc=128,e0=112|(3|ga|pa)|fc,hc=1,gc=2,pc=3,mc=4,yc=5,_c=6,ma=uc||ha||dc?" ":"​",Ir=`
29
+ Check the top-level render call using <`+Ne+">.")}return pe}}function mi($,pe){{if(!$._store||$._store.validated||$.key!=null)return;$._store.validated=!0;var Ne=pi(pe);if(Hl[Ne])return;Hl[Ne]=!0;var We="";$&&$._owner&&$._owner!==Vt.current&&(We=" It was passed a child from "+ee($._owner.type)+"."),qt($),I('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Ne,We),qt(null)}}function Ko($,pe){{if(typeof $!="object")return;if(Array.isArray($))for(var Ne=0;Ne<$.length;Ne++){var We=$[Ne];gi(We)&&mi(We,pe)}else if(gi($))$._store&&($._store.validated=!0);else if($){var wt=N($);if(typeof wt=="function"&&wt!==$.entries)for(var vt=wt.call($),ct;!(ct=vt.next()).done;)gi(ct.value)&&mi(ct.value,pe)}}}function Wl($){{var pe=$.type;if(pe==null||typeof pe=="string")return;var Ne;if(typeof pe=="function")Ne=pe.propTypes;else if(typeof pe=="object"&&(pe.$$typeof===u||pe.$$typeof===f))Ne=pe.propTypes;else return;if(Ne){var We=ee(pe);B(Ne,$.props,"prop",We,$)}else if(pe.PropTypes!==void 0&&!Gn){Gn=!0;var wt=ee(pe);I("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",wt||"Unknown")}typeof pe.getDefaultProps=="function"&&!pe.getDefaultProps.isReactClassApproved&&I("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mn($){{for(var pe=Object.keys($.props),Ne=0;Ne<pe.length;Ne++){var We=pe[Ne];if(We!=="children"&&We!=="key"){qt($),I("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",We),qt(null);break}}$.ref!==null&&(qt($),I("Invalid attribute `ref` supplied to `React.Fragment`."),qt(null))}}function an($,pe,Ne,We,wt,vt){{var ct=P($);if(!ct){var et="";($===void 0||typeof $=="object"&&$!==null&&Object.keys($).length===0)&&(et+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ln=Ul(wt);ln?et+=ln:et+=qo();var Ot;$===null?Ot="null":Array.isArray($)?Ot="array":$!==void 0&&$.$$typeof===r?(Ot="<"+(ee($.type)||"Unknown")+" />",et=" Did you accidentally export a JSX literal instead of a component?"):Ot=typeof $,I("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ot,et)}var jt=wn($,pe,Ne,wt,vt);if(jt==null)return jt;if(ct){var ar=pe.children;if(ar!==void 0)if(We)if(Array.isArray(ar)){for(var Bn=0;Bn<ar.length;Bn++)Ko(ar[Bn],$);Object.freeze&&Object.freeze(ar)}else I("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ko(ar,$)}return $===n.Fragment?Mn(jt):Wl(jt),jt}}function Go($,pe,Ne){return an($,pe,Ne,!0)}function Yd($,pe,Ne){return an($,pe,Ne,!1)}var $l=Yd,Yl=Go;n.jsx=$l,n.jsxs=Yl}()}(tc)),tc}process.env.NODE_ENV==="production"?Ql.exports=O_():Ql.exports=j_();var F=Ql.exports;const gf=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],pf=gf[Math.floor(Math.random()*gf.length)],P_=U.createContext({clientID:0,color:pf[1],isCollabActive:!1,name:pf[0],yjsDocMap:new Map});function mf(n,e){const t=U.useContext(P_);return n!=null&&(t.name=n),e!=null&&(t.color=e),t}function F_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var z_=F_(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const sa=U.createContext(null);function yf(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function $t(){const n=U.useContext(sa);return n==null&&z_(8),n}function wi(n){return{}}const Hn={},_f={},$s={},qr={},Ji={},Ys={},vi={},oa={},nc={},Zi={},xi={},mn={},aa={},la={},B_={},rc={},U_={},ic={},H_={},sc={},oc={},Ci={},W_={},Vs={},qs={},Ks={},bf={},$_={},Y_={},wf={},ca={},Qi={},es={},ua={},V_={},da={},ac={},lc={},vf={},xf={},cc={},Cf={},q_={},Qn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K_=Qn&&"documentMode"in document?document.documentMode:null,er=Qn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Kr=Qn&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),fa=!(!Qn||!("InputEvent"in window)||K_)&&"getTargetRanges"in new window.InputEvent("input"),uc=Qn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ha=Qn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,G_=Qn&&/Android/.test(navigator.userAgent),Sf=Qn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),X_=Qn&&G_&&Sf,dc=Qn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Sf,Gs=1,Gr=3,Si=0,Tf=1,ts=2,J_=0,Z_=1,Q_=2,ga=4,pa=8,fc=128,e0=112|(3|ga|pa)|fc,hc=1,gc=2,pc=3,mc=4,yc=5,_c=6,ma=uc||ha||dc?" ":"​",Ir=`
30
30
 
31
- `,t0=Kr?" ":ma,Ef="֑-߿יִ-﷽ﹰ-ﻼ",kf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",n0=new RegExp("^[^"+kf+"]*["+Ef+"]"),r0=new RegExp("^[^"+Ef+"]*["+kf+"]"),Rr={bold:1,code:16,highlight:fc,italic:2,strikethrough:ga,subscript:32,superscript:64,underline:pa},i0={directionless:1,unmergeable:2},Nf={center:gc,end:_c,justify:mc,left:hc,right:pc,start:yc},s0={[gc]:"center",[_c]:"end",[mc]:"justify",[hc]:"left",[pc]:"right",[yc]:"start"},o0={normal:0,segmented:2,token:1},a0={[J_]:"normal",[Q_]:"segmented",[Z_]:"token"};function l0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var De=l0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function ya(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const c0=100;let bc=!1,wc=0;function u0(n){wc=n.timeStamp}function vc(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function d0(n,e,t){const r=fr(t._window);let i=null,s=null;r!==null&&r.anchorNode===n&&(i=r.anchorOffset,s=r.focusOffset);const o=n.nodeValue;o!==null&&kc(e,o,i,s,!1)}function f0(n,e,t){if(he(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===Gr&&t.isAttached()}function Mf(n,e,t){bc=!0;const r=performance.now()-wc>c0;try{Rn(n,()=>{const i=ge()||function(f){return f.getEditorState().read(()=>{const m=ge();return m!==null?m.clone():null})}(n),s=new Map,o=n.getRootElement(),a=n._editorState,l=n._blockCursorElement;let u=!1,g="";for(let f=0;f<e.length;f++){const m=e[f],y=m.type,b=m.target;let C=Pt(b,a);if(!(C===null&&b!==o||gt(C))){if(y==="characterData")r&&me(C)&&f0(i,b,C)&&d0(b,C,n);else if(y==="childList"){u=!0;const S=m.addedNodes;for(let k=0;k<S.length;k++){const T=S[k],N=Ff(T),h=T.parentNode;if(h!=null&&T!==l&&N===null&&(T.nodeName!=="BR"||!vc(T,h,n))){if(Kr){const I=T.innerText||T.nodeValue;I&&(g+=I)}h.removeChild(T)}}const A=m.removedNodes,v=A.length;if(v>0){let k=0;for(let T=0;T<v;T++){const N=A[T];(N.nodeName==="BR"&&vc(N,b,n)||l===N)&&(b.appendChild(N),k++)}v!==k&&(b===o&&(C=Uf(a)),s.set(b,C))}}}}if(s.size>0)for(const[f,m]of s)if(ie(m)){const y=m.getChildrenKeys();let b=f.firstChild;for(let C=0;C<y.length;C++){const S=y[C],A=n.getElementByKey(S);A!==null&&(b==null?(f.appendChild(A),b=A):b!==A&&f.replaceChild(A,b),b=b.nextSibling)}}else me(m)&&m.markDirty();const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const m=d[f],y=m.addedNodes,b=m.target;for(let C=0;C<y.length;C++){const S=y[C],A=S.parentNode;A==null||S.nodeName!=="BR"||vc(S,b,n)||A.removeChild(S)}}t.takeRecords()}i!==null&&(u&&(i.dirty=!0,Nt(i)),Kr&&Jf(n)&&i.insertRawText(g))})}finally{bc=!1}}function Df(n){const e=n._observer;e!==null&&Mf(n,e.takeRecords(),e)}function Af(n){(function(e){wc===0&&Sa(e).addEventListener("textInput",u0,!0)})(n),n._observer=new MutationObserver((e,t)=>{Mf(n,e,t)})}function If(n,e){const t=n.__mode,r=n.__format,i=n.__style,s=e.__mode,o=e.__format,a=e.__style;return!(t!==null&&t!==s||r!==null&&r!==o||i!==null&&i!==a)}function Rf(n,e){const t=n.mergeWithSibling(e),r=Ut()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Lf(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&me(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(If(e,r)){r=Rf(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(If(r,t)){r=Rf(r,t);break}break}t.remove()}}else r.remove()}function xc(n){return Of(n.anchor),Of(n.focus),n}function Of(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),me(r)){n.set(r.__key,i?r.getTextContentSize():0,"text");break}if(!ie(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element")}}let h0=1;const g0=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Cc(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return gt(Pt(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&e.__lexicalEditor==null)}function Xs(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!Cc(e)&&jf(e)===n}catch{return!1}}function jf(n){let e=n;for(;e!=null;){const t=e.__lexicalEditor;if(t!=null)return t;e=xa(e)}return null}function ns(n){return n.isToken()||n.isSegmented()}function p0(n){return n.nodeType===Gr}function _a(n){let e=n;for(;e!=null;){if(p0(e))return e;e=e.firstChild}return null}function Sc(n,e,t){const r=Rr[e];if(t!==null&&(n&r)==(t&r))return n;let i=n^r;return e==="subscript"?i&=~Rr.superscript:e==="superscript"&&(i&=~Rr.subscript),i}function m0(n){return me(n)||hr(n)||gt(n)}function Pf(n,e){if(e!=null)return void(n.__key=e);Sn(),Lh();const t=Ut(),r=gr(),i=""+h0++;r._nodeMap.set(i,n),ie(n)?t._dirtyElements.set(i,!0):t._dirtyLeaves.add(i),t._cloneNotNeeded.add(i),t._dirtyType=Tf,n.__key=i}function Ti(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling();if(i===null)if(s!==null){const o=s.getWritable();r.__first=s.__key,o.__prev=null}else r.__first=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(s===null)if(i!==null){const o=i.getWritable();r.__last=i.__key,o.__next=null}else r.__last=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function ba(n){Lh();const e=n.getLatest(),t=e.__parent,r=gr(),i=Ut(),s=r._nodeMap,o=i._dirtyElements;t!==null&&function(l,u,g){let d=l;for(;d!==null;){if(g.has(d))return;const f=u.get(d);if(f===void 0)break;g.set(d,!1),d=f.__parent}}(t,s,o);const a=e.__key;i._dirtyType=Tf,ie(n)?o.set(a,!0):i._dirtyLeaves.add(a)}function nn(n){Sn();const e=Ut(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=tt(t);r!==null&&r.getWritable()}if(n!==null){const r=tt(n);r!==null&&r.getWritable()}}}function Xr(){return ls()?null:Ut()._compositionKey}function tt(n,e){const t=(e||gr())._nodeMap.get(n);return t===void 0?null:t}function Ff(n,e){const t=n[`__lexicalKey_${Ut()._key}`];return t!==void 0?tt(t,e):null}function Pt(n,e){let t=n;for(;t!=null;){const r=Ff(t,e);if(r!==null)return r;t=xa(t)}return null}function zf(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Bf(n){return n.read(()=>dt().getTextContent())}function dt(){return Uf(gr())}function Uf(n){return n._nodeMap.get("root")}function Nt(n){Sn();const e=gr();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function rs(n){const e=Ut(),t=function(r,i){let s=r;for(;s!=null;){const o=s[`__lexicalKey_${i._key}`];if(o!==void 0)return o;s=xa(s)}return null}(n,e);return t===null?n===e.getRootElement()?tt("root"):null:tt(t)}function Hf(n,e){return e?n.getTextContentSize():0}function Wf(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Tc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function $f(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Yf(n){return n.nodeType===Gr?n.nodeValue:null}function Ec(n,e,t){const r=fr(e._window);if(r===null)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(i!==null){let a=Yf(i);const l=Pt(i);if(a!==null&&me(l)){if(a===ma&&t){const u=t.length;a=t,s=u,o=u}a!==null&&kc(l,a,s,o,n)}}}function kc(n,e,t,r,i){let s=n;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let a=e;(o||i)&&e[e.length-1]===ma&&(a=e.slice(0,-1));const l=s.getTextContent();if(i||a!==l){if(a===""){if(nn(null),uc||ha||dc)s.remove();else{const b=Ut();setTimeout(()=>{b.update(()=>{s.isAttached()&&s.remove()})},20)}return}const u=s.getParent(),g=ti(),d=s.getTextContentSize(),f=Xr(),m=s.getKey();if(s.isToken()||f!==null&&m===f&&!o||he(g)&&(u!==null&&!u.canInsertTextBefore()&&g.anchor.offset===0||g.anchor.key===n.__key&&g.anchor.offset===0&&!s.canInsertTextBefore()&&!o||g.focus.key===n.__key&&g.focus.offset===d&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const y=ge();if(!he(y)||t===null||r===null)return void s.setTextContent(a);if(y.setTextNodeRange(s,t,s,r),s.isSegmented()){const b=Bt(s.getTextContent());s.replace(b),s=b}s.setTextContent(a)}}}function y0(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),i=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(s){const o=s.getPreviousSibling();return(me(o)||ie(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}function Vf(n){return n==="ArrowLeft"}function qf(n){return n==="ArrowRight"}function Js(n,e){return er?n:e}function Kf(n){return n==="Enter"}function Zs(n){return n==="Backspace"}function Qs(n){return n==="Delete"}function Gf(n,e,t){return n.toLowerCase()==="a"&&Js(e,t)}function _0(){const n=dt();Nt(xc(n.select(0,n.getChildrenSize())))}function eo(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const i=n[e];if(typeof i=="string"){const s=ya(i);return t[e]=s,s}return i}function Nc(n,e,t,r,i){if(t.size===0)return;const s=r.__type,o=r.__key,a=e.get(s);a===void 0&&De(33,s);const l=a.klass;let u=n.get(l);u===void 0&&(u=new Map,n.set(l,u));const g=u.get(o),d=g==="destroyed"&&i==="created";(g===void 0||d)&&u.set(o,d?"updated":i)}function b0(n){const e=gr(),t=e._readOnly,r=n.getType(),i=e._nodeMap,s=[];for(const[,o]of i)o instanceof n&&o.__type===r&&(t||o.isAttached())&&s.push(o);return s}function Xf(n,e,t){const r=n.getParent();let i=t,s=n;return r!==null&&(e&&t===0?(i=s.getIndexWithinParent(),s=r):e||t!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function to(n,e){const t=n.offset;if(n.type==="element")return Xf(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const i=e?r.getPreviousSibling():r.getNextSibling();return i===null?Xf(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):i}}return null}function Jf(n){const e=Sa(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function Oe(n,e,t){return Fh(n,e,t)}function wa(n){return!dn(n)&&!n.isLastChild()&&!n.isInline()}function va(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&De(75,e),t}function xa(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Ca(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Sa(n){const e=n._window;return e===null&&De(78),e}function w0(n){let e=n.getParentOrThrow();for(;e!==null;){if(un(e))return e;e=e.getParentOrThrow()}return e}function un(n){return dn(n)||ie(n)&&n.isShadowRoot()}function v0(n){const e=n.constructor.clone(n);return Pf(e,null),e}function dr(n){const e=Ut(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&De(97);const i=r.replace;if(i!==null){const s=i(n);return s instanceof n.constructor||De(98),s}return n}function Mc(n,e){!dn(n.getParent())||ie(e)||gt(e)||De(99)}function Dc(n){return(gt(n)||ie(n)&&!n.canBeEmpty())&&!n.isInline()}function Ac(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function x0(n,e,t){let r=n._blockCursorElement;if(he(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const i=t.anchor,s=i.getNode(),o=i.offset;let a=!1,l=null;if(o===s.getChildrenSize())Dc(s.getChildAtIndex(o-1))&&(a=!0);else{const u=s.getChildAtIndex(o);if(Dc(u)){const g=u.getPreviousSibling();(g===null||Dc(g))&&(a=!0,l=n.getElementByKey(u.__key))}}if(a){const u=n.getElementByKey(s.__key);return r===null&&(n._blockCursorElement=r=function(g){const d=g.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let m=d.blockCursor;if(m!==void 0){if(typeof m=="string"){const y=ya(m);m=d.blockCursor=y}m!==void 0&&f.classList.add(...m)}return f}(n._config)),e.style.caretColor="transparent",void(l===null?u.appendChild(r):u.insertBefore(r,l))}}r!==null&&Ac(r,n,e)}function fr(n){return Qn?(n||window).getSelection():null}function C0(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),un(n)&&De(102);const r=o=>{const a=o.getParentOrThrow(),l=un(a),u=o!==t||l?v0(o):o;if(l)return ie(o)&&ie(u)||De(133),o.insertAfter(u),[o,u,u];{const[g,d,f]=r(a),m=o.getNextSiblings();return f.append(u,...m),[g,d,u]}},[i,s]=r(t);return[i,s]}function no(n){return n.nodeType===1}function S0(n){const e=new RegExp(/^(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|#text)$/,"i");return n.nodeName.match(e)!==null}function T0(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function is(n){if(dn(n)||gt(n)&&!n.isInline())return!0;if(!ie(n)||un(n))return!1;const e=n.getFirstChild(),t=e===null||hr(e)||me(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Ic(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Zf(n,e,t,r,i,s){let o=n.getFirstChild();for(;o!==null;){const a=o.__key;o.__parent===e&&(ie(o)&&Zf(o,a,t,r,i,s),t.has(a)||s.delete(a),i.push(a)),o=o.getNextSibling()}}let Jr,yn,ro,Ta,Rc,Lc,Ei,tr,Oc,io,Kt="",_n="",nr=null,Lr="",Qf=!1,Ea=!1,ka=null;function Na(n,e){const t=Ei.get(n);if(e!==null){const r=zc(n);r.parentNode===e&&e.removeChild(r)}if(tr.has(n)||yn._keyToDOMMap.delete(n),ie(t)){const r=Da(t,Ei);jc(r,0,r.length-1,null)}t!==void 0&&Nc(io,ro,Ta,t,"destroyed")}function jc(n,e,t,r){let i=e;for(;i<=t;++i){const s=n[i];s!==void 0&&Na(s,r)}}function ki(n,e){n.setProperty("text-align",e)}const E0="40px";function eh(n,e){const t=Jr.theme.indent;if(typeof t=="string"){const i=n.classList.contains(t);e>0&&!i?n.classList.add(t):e<1&&i&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||E0;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function th(n,e){const t=n.style;e===0?ki(t,""):e===hc?ki(t,"left"):e===gc?ki(t,"center"):e===pc?ki(t,"right"):e===mc?ki(t,"justify"):e===yc?ki(t,"start"):e===_c&&ki(t,"end")}function Ma(n,e,t){const r=tr.get(n);r===void 0&&De(60);const i=r.createDOM(Jr,yn);if(function(s,o,a){const l=a._keyToDOMMap;o["__lexicalKey_"+a._key]=s,l.set(s,o)}(n,i,yn),me(r)?i.setAttribute("data-lexical-text","true"):gt(r)&&i.setAttribute("data-lexical-decorator","true"),ie(r)){const s=r.__indent,o=r.__size;if(s!==0&&eh(i,s),o!==0){const l=o-1;(function(u,g,d,f){const m=_n;_n="",Pc(u,d,0,g,f,null),ih(d,f),_n=m})(Da(r,tr),l,r,i)}const a=r.__format;a!==0&&th(i,a),r.isInline()||rh(null,r,i),wa(r)&&(Kt+=Ir,Lr+=Ir)}else{const s=r.getTextContent();if(gt(r)){const o=r.decorate(yn,Jr);o!==null&&sh(n,o),i.contentEditable="false"}else me(r)&&(r.isDirectionless()||(_n+=s));Kt+=s,Lr+=s}if(e!==null)if(t!=null)e.insertBefore(i,t);else{const s=e.__lexicalLineBreak;s!=null?e.insertBefore(i,s):e.appendChild(i)}return Nc(io,ro,Ta,r,"created"),i}function Pc(n,e,t,r,i,s){const o=Kt;Kt="";let a=t;for(;a<=r;++a){Ma(n[a],i,s);const l=tr.get(n[a]);l!==null&&nr===null&&me(l)&&(nr=l.getFormat())}wa(e)&&(Kt+=Ir),i.__lexicalTextContent=Kt,Kt=o+Kt}function nh(n,e){const t=e.get(n);return hr(t)||gt(t)&&t.isInline()}function rh(n,e,t){const r=n!==null&&(n.__size===0||nh(n.__last,Ei)),i=e.__size===0||nh(e.__last,tr);if(r){if(!i){const s=t.__lexicalLineBreak;s!=null&&t.removeChild(s),t.__lexicalLineBreak=null}}else if(i){const s=document.createElement("br");t.__lexicalLineBreak=s,t.appendChild(s)}}function ih(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==_n||r!==ka){const s=_n==="",o=s?ka:(i=_n,n0.test(i)?"rtl":r0.test(i)?"ltr":null);if(o!==r){const a=e.classList,l=Jr.theme;let u=r!==null?l[r]:void 0,g=o!==null?l[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=ya(u);u=l[r]=d}a.remove(...u)}if(o===null||s&&o==="ltr")e.removeAttribute("dir");else{if(g!==void 0){if(typeof g=="string"){const d=ya(g);g=l[o]=d}g!==void 0&&a.add(...g)}e.dir=o}Ea||(n.getWritable().__dir=o)}ka=o,e.__lexicalDirTextContent=_n,e.__lexicalDir=o}var i}function k0(n,e,t){const r=_n;var i;_n="",nr=null,function(s,o,a){const l=Kt,u=s.__size,g=o.__size;if(Kt="",u===1&&g===1){const d=s.__first,f=o.__first;if(d===f)so(d,a);else{const y=zc(d),b=Ma(f,null,null);a.replaceChild(b,y),Na(d,null)}const m=tr.get(f);nr===null&&me(m)&&(nr=m.getFormat())}else{const d=Da(s,Ei),f=Da(o,tr);if(u===0)g!==0&&Pc(f,o,0,g-1,a,null);else if(g===0){if(u!==0){const m=a.__lexicalLineBreak==null;jc(d,0,u-1,m?null:a),m&&(a.textContent="")}}else(function(m,y,b,C,S,A){const v=C-1,k=S-1;let T,N,h=(j=A,j.firstChild),I=0,O=0;for(var j;I<=v&&O<=k;){const G=y[I],ne=b[O];if(G===ne)h=Fc(so(ne,A)),I++,O++;else{T===void 0&&(T=new Set(y)),N===void 0&&(N=new Set(b));const ue=N.has(G),fe=T.has(ne);if(ue)if(fe){const Ee=va(yn,ne);Ee===h?h=Fc(so(ne,A)):(h!=null?A.insertBefore(Ee,h):A.appendChild(Ee),so(ne,A)),I++,O++}else Ma(ne,A,h),O++;else h=Fc(zc(G)),Na(G,A),I++}const oe=tr.get(ne);oe!==null&&nr===null&&me(oe)&&(nr=oe.getFormat())}const P=I>v,q=O>k;if(P&&!q){const G=b[k+1];Pc(b,m,O,k,A,G===void 0?null:yn.getElementByKey(G))}else q&&!P&&jc(y,I,v,A)})(o,d,f,u,g,a)}wa(o)&&(Kt+=Ir),a.__lexicalTextContent=Kt,Kt=l+Kt}(n,e,t),ih(e,t),us(i=e)&&nr!=null&&nr!==i.__textFormat&&!Ea&&i.setTextFormat(nr),_n=r,nr=null}function Da(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e.get(r);i===void 0&&De(101),t.push(r),r=i.__next}return t}function so(n,e){const t=Ei.get(n);let r=tr.get(n);t!==void 0&&r!==void 0||De(61);const i=Qf||Lc.has(n)||Rc.has(n),s=va(yn,n);if(t===r&&!i){if(ie(t)){const o=s.__lexicalTextContent;o!==void 0&&(Kt+=o,Lr+=o);const a=s.__lexicalDirTextContent;a!==void 0&&(_n+=a)}else{const o=t.getTextContent();me(t)&&!t.isDirectionless()&&(_n+=o),Lr+=o,Kt+=o}return s}if(t!==r&&i&&Nc(io,ro,Ta,r,"updated"),r.updateDOM(t,s,Jr)){const o=Ma(n,null,null);return e===null&&De(62),e.replaceChild(o,s),Na(n,null),o}if(ie(t)&&ie(r)){const o=r.__indent;o!==t.__indent&&eh(s,o);const a=r.__format;a!==t.__format&&th(s,a),i&&(k0(t,r,s),dn(r)||r.isInline()||rh(t,r,s)),wa(r)&&(Kt+=Ir,Lr+=Ir)}else{const o=r.getTextContent();if(gt(r)){const a=r.decorate(yn,Jr);a!==null&&sh(n,a)}else me(r)&&!r.isDirectionless()&&(_n+=o);Kt+=o,Lr+=o}if(!Ea&&dn(r)&&r.__cachedText!==Lr){const o=r.getWritable();o.__cachedText=Lr,r=o}return s}function sh(n,e){let t=yn._pendingDecorators;const r=yn._decorators;if(t===null){if(r[n]===e)return;t=zf(yn)}t[n]=e}function Fc(n){let e=n.nextSibling;return e!==null&&e===yn._blockCursorElement&&(e=e.nextSibling),e}function N0(n,e,t,r,i,s){Kt="",Lr="",_n="",Qf=r===ts,ka=null,yn=t,Jr=t._config,ro=t._nodes,Ta=yn._listeners.mutation,Rc=i,Lc=s,Ei=n._nodeMap,tr=e._nodeMap,Ea=e._readOnly,Oc=new Map(t._keyToDOMMap);const o=new Map;return io=o,so("root",null),yn=void 0,ro=void 0,Rc=void 0,Lc=void 0,Ei=void 0,tr=void 0,Jr=void 0,Oc=void 0,io=void 0,o}function zc(n){const e=Oc.get(n);return e===void 0&&De(75,n),e}const Or=Object.freeze({}),Bc=30,Uc=[["keydown",function(n,e){if(oo=n.timeStamp,oh=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:i,metaKey:s,altKey:o}=n;Oe(e,B_,n)||t!=null&&(function(a,l,u,g){return qf(a)&&!l&&!g&&!u}(t,i,o,s)?Oe(e,rc,n):function(a,l,u,g,d){return qf(a)&&!g&&!u&&(l||d)}(t,i,r,o,s)?Oe(e,U_,n):function(a,l,u,g){return Vf(a)&&!l&&!g&&!u}(t,i,o,s)?Oe(e,ic,n):function(a,l,u,g,d){return Vf(a)&&!g&&!u&&(l||d)}(t,i,r,o,s)?Oe(e,H_,n):function(a,l,u){return function(g){return g==="ArrowUp"}(a)&&!l&&!u}(t,i,s)?Oe(e,sc,n):function(a,l,u){return function(g){return g==="ArrowDown"}(a)&&!l&&!u}(t,i,s)?Oe(e,oc,n):function(a,l){return Kf(a)&&l}(t,r)?(ao=!0,Oe(e,Ci,n)):function(a){return a===" "}(t)?Oe(e,W_,n):function(a,l){return er&&l&&a.toLowerCase()==="o"}(t,i)?(n.preventDefault(),ao=!0,Oe(e,Ji,!0)):function(a,l){return Kf(a)&&!l}(t,r)?(ao=!1,Oe(e,Ci,n)):function(a,l,u,g){return er?!l&&!u&&(Zs(a)||a.toLowerCase()==="h"&&g):!(g||l||u)&&Zs(a)}(t,o,s,i)?Zs(t)?Oe(e,Vs,n):(n.preventDefault(),Oe(e,qr,!0)):function(a){return a==="Escape"}(t)?Oe(e,qs,n):function(a,l,u,g,d){return er?!(u||g||d)&&(Qs(a)||a.toLowerCase()==="d"&&l):!(l||g||d)&&Qs(a)}(t,i,r,o,s)?Qs(t)?Oe(e,Ks,n):(n.preventDefault(),Oe(e,qr,!1)):function(a,l,u){return Zs(a)&&(er?l:u)}(t,o,i)?(n.preventDefault(),Oe(e,Zi,!0)):function(a,l,u){return Qs(a)&&(er?l:u)}(t,o,i)?(n.preventDefault(),Oe(e,Zi,!1)):function(a,l){return er&&l&&Zs(a)}(t,s)?(n.preventDefault(),Oe(e,xi,!0)):function(a,l){return er&&l&&Qs(a)}(t,s)?(n.preventDefault(),Oe(e,xi,!1)):function(a,l,u,g){return a.toLowerCase()==="b"&&!l&&Js(u,g)}(t,o,s,i)?(n.preventDefault(),Oe(e,mn,"bold")):function(a,l,u,g){return a.toLowerCase()==="u"&&!l&&Js(u,g)}(t,o,s,i)?(n.preventDefault(),Oe(e,mn,"underline")):function(a,l,u,g){return a.toLowerCase()==="i"&&!l&&Js(u,g)}(t,o,s,i)?(n.preventDefault(),Oe(e,mn,"italic")):function(a,l,u,g){return a==="Tab"&&!l&&!u&&!g}(t,o,i,s)?Oe(e,bf,n):function(a,l,u,g){return a.toLowerCase()==="z"&&!l&&Js(u,g)}(t,r,s,i)?(n.preventDefault(),Oe(e,aa,void 0)):function(a,l,u,g){return er?a.toLowerCase()==="z"&&u&&l:a.toLowerCase()==="y"&&g||a.toLowerCase()==="z"&&g&&l}(t,r,s,i)?(n.preventDefault(),Oe(e,la,void 0)):Dt(e._editorState._selection)?function(a,l,u,g){return!l&&a.toLowerCase()==="c"&&(er?u:g)}(t,r,s,i)?(n.preventDefault(),Oe(e,da,n)):function(a,l,u,g){return!l&&a.toLowerCase()==="x"&&(er?u:g)}(t,r,s,i)?(n.preventDefault(),Oe(e,ac,n)):Gf(t,s,i)&&(n.preventDefault(),Oe(e,lc,n)):!Kr&&Gf(t,s,i)&&(n.preventDefault(),Oe(e,lc,n)),function(a,l,u,g){return a||l||u||g}(i,r,o,s)&&Oe(e,q_,n))}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&Rn(e,()=>{gt(Pt(t))||(Wc=!0)})}],["compositionstart",function(n,e){Rn(e,()=>{const t=ge();if(he(t)&&!e.isComposing()){const r=t.anchor,i=t.anchor.getNode();nn(r.key),(n.timeStamp<oo+Bc||r.type==="element"||!t.isCollapsed()||i.getFormat()!==t.format||me(i)&&i.getStyle()!==t.style)&&Oe(e,vi,t0)}})}],["compositionend",function(n,e){Kr?lo=!0:Rn(e,()=>{$c(e,n.data)})}],["input",function(n,e){n.stopPropagation(),Rn(e,()=>{const t=ge(),r=n.data,i=fh(n);if(r!=null&&he(t)&&ch(t,i,r,n.timeStamp,!1)){lo&&($c(e,r),lo=!1);const s=t.anchor.getNode(),o=fr(e._window);if(o===null)return;const a=t.isBackward(),l=a?t.anchor.offset:t.focus.offset,u=a?t.focus.offset:t.anchor.offset;fa&&!t.isCollapsed()&&me(s)&&o.anchorNode!==null&&s.getTextContent().slice(0,l)+r+s.getTextContent().slice(l+u)===Yf(o.anchorNode)||Oe(e,vi,r);const g=r.length;Kr&&g>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=g),uc||ha||dc||!e.isComposing()||(oo=0,nn(null))}else Ec(!1,e,r!==null?r:void 0),lo&&($c(e,r||void 0),lo=!1);Sn(),Df(Ut())}),ss=null}],["click",function(n,e){Rn(e,()=>{const t=ge(),r=fr(e._window),i=ti();if(r){if(he(t)){const s=t.anchor,o=s.getNode();s.type==="element"&&s.offset===0&&t.isCollapsed()&&!dn(o)&&dt().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(ie(o)?o.select(0):o.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const s=r.anchorNode;if(s!==null){const o=s.nodeType;(o===Gs||o===Gr)&&Nt(ja(i,r,e,n))}}}Oe(e,$s,n)})}],["cut",Or],["copy",Or],["dragstart",Or],["dragover",Or],["dragend",Or],["paste",Or],["focus",Or],["blur",Or],["drop",Or]];fa&&Uc.push(["beforeinput",(n,e)=>function(t,r){const i=t.inputType,s=fh(t);i==="deleteCompositionText"||Kr&&Jf(r)||i!=="insertCompositionText"&&Rn(r,()=>{const o=ge();if(i==="deleteContentBackward"){if(o===null){const m=ti();if(!he(m))return;Nt(m.clone())}if(he(o)){const m=o.anchor.key===o.focus.key;if(a=t.timeStamp,oh==="MediaLast"&&a<oo+Bc&&r.isComposing()&&m){if(nn(null),oo=0,setTimeout(()=>{Rn(r,()=>{nn(null)})},Bc),he(o)){const y=o.anchor.getNode();y.markDirty(),o.format=y.getFormat(),me(y)||De(142),o.style=y.getStyle()}}else{nn(null),t.preventDefault();const y=o.anchor.getNode().getTextContent(),b=o.anchor.offset===0&&o.focus.offset===y.length;X_&&m&&!b||Oe(r,qr,!0)}return}}var a;if(!he(o))return;const l=t.data;ss!==null&&Ec(!1,r,ss),o.dirty&&ss===null||!o.isCollapsed()||dn(o.anchor.getNode())||s===null||o.applyDOMRange(s),ss=null;const u=o.anchor,g=o.focus,d=u.getNode(),f=g.getNode();if(i!=="insertText"&&i!=="insertTranspose")switch(t.preventDefault(),i){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Oe(r,vi,t);break;case"insertFromComposition":nn(null),Oe(r,vi,t);break;case"insertLineBreak":nn(null),Oe(r,Ji,!1);break;case"insertParagraph":nn(null),ao&&!ha?(ao=!1,Oe(r,Ji,!1)):Oe(r,Ys,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Oe(r,oa,t);break;case"deleteByComposition":(function(m,y){return m!==y||ie(m)||ie(y)||!m.isToken()||!y.isToken()})(d,f)&&Oe(r,nc,t);break;case"deleteByDrag":case"deleteByCut":Oe(r,nc,t);break;case"deleteContent":Oe(r,qr,!1);break;case"deleteWordBackward":Oe(r,Zi,!0);break;case"deleteWordForward":Oe(r,Zi,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Oe(r,xi,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Oe(r,xi,!1);break;case"formatStrikeThrough":Oe(r,mn,"strikethrough");break;case"formatBold":Oe(r,mn,"bold");break;case"formatItalic":Oe(r,mn,"italic");break;case"formatUnderline":Oe(r,mn,"underline");break;case"historyUndo":Oe(r,aa,void 0);break;case"historyRedo":Oe(r,la,void 0)}else{if(l===`
32
- `)t.preventDefault(),Oe(r,Ji,!1);else if(l===Ir)t.preventDefault(),Oe(r,Ys,void 0);else if(l==null&&t.dataTransfer){const m=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(m)}else l!=null&&ch(o,s,l,t.timeStamp,!0)?(t.preventDefault(),Oe(r,vi,l)):ss=l;ah=t.timeStamp}})}(n,e)]);let oo=0,oh=null,ah=0,ss=null;const Aa=new WeakMap;let Hc=!1,Wc=!1,ao=!1,lo=!1,lh=[0,"",0,"root",0];function ch(n,e,t,r,i){const s=n.anchor,o=n.focus,a=s.getNode(),l=Ut(),u=fr(l._window),g=u!==null?u.anchorNode:null,d=s.key,f=l.getElementByKey(d),m=t.length;return d!==o.key||!me(a)||(!i&&(!fa||ah<r+50)||a.isDirty()&&m<2||Wf(t))&&s.offset!==o.offset&&!a.isComposing()||ns(a)||a.isDirty()&&m>1||(i||!fa)&&f!==null&&!a.isComposing()&&g!==_a(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||a.getFormat()!==n.format||a.getStyle()!==n.style||y0(n,a)}function uh(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===Gr&&e!==0&&e!==n.nodeValue.length}function dh(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=n;Hc&&(Hc=!1,uh(r,i)&&uh(s,o))||Rn(e,()=>{if(!t)return void Nt(null);if(!Xs(e,r,s))return;const a=ge();if(he(a)){const l=a.anchor,u=l.getNode();if(a.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(a.dirty=!0);const g=Sa(e).event,d=g?g.timeStamp:performance.now(),[f,m,y,b,C]=lh,S=dt(),A=e.isComposing()===!1&&S.getTextContent()==="";if(d<C+200&&l.offset===y&&l.key===b)a.format=f,a.style=m;else if(l.type==="text")me(u)||De(141),a.format=u.getFormat(),a.style=u.getStyle();else if(l.type==="element"&&!A){const v=l.getNode();v instanceof cs&&v.getChildrenSize()===0?a.format=v.getTextFormat():a.format=0,a.style=""}}else{const g=l.key,d=a.focus.key,f=a.getNodes(),m=f.length,y=a.isBackward(),b=y?o:i,C=y?i:o,S=y?d:g,A=y?g:d;let v=e0,k=!1;for(let T=0;T<m;T++){const N=f[T],h=N.getTextContentSize();if(me(N)&&h!==0&&!(T===0&&N.__key===S&&b===h||T===m-1&&N.__key===A&&C===0)&&(k=!0,v&=N.getFormat(),v===0))break}a.format=k?v:0}}Oe(e,Hn,void 0)})}function fh(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function $c(n,e){const t=n._compositionKey;if(nn(null),t!==null&&e!=null){if(e===""){const r=tt(t),i=_a(n.getElementByKey(t));return void(i!==null&&i.nodeValue!==null&&me(r)&&kc(r,i.nodeValue,null,null,!0))}if(e[e.length-1]===`
33
- `){const r=ge();if(he(r)){const i=r.focus;return r.anchor.set(i.key,i.offset,i.type),void Oe(n,Ci,null)}}}Ec(!0,n,e)}function hh(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const os=new Map;function gh(n){const e=n.target,t=fr(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const r=jf(t.anchorNode);if(r===null)return;Wc&&(Wc=!1,Rn(r,()=>{const u=ti(),g=t.anchorNode;if(g===null)return;const d=g.nodeType;d!==Gs&&d!==Gr||Nt(ja(u,t,r,n))}));const i=Tc(r),s=i[i.length-1],o=s._key,a=os.get(o),l=a||s;l!==r&&dh(t,l,!1),dh(t,r,!0),r!==s?os.set(o,r):a&&os.delete(o)}function ph(n){n._lexicalHandled=!0}function mh(n){return n._lexicalHandled===!0}function M0(n){const e=n.ownerDocument,t=Aa.get(e);t===void 0&&De(162);const r=t-1;r>=0||De(164),Aa.set(e,r),r===0&&e.removeEventListener("selectionchange",gh);const i=n.__lexicalEditor;i!=null&&(function(o){if(o._parentEditor!==null){const a=Tc(o),l=a[a.length-1]._key;os.get(l)===o&&os.delete(l)}else os.delete(o._key)}(i),n.__lexicalEditor=null);const s=hh(n);for(let o=0;o<s.length;o++)s[o]();n.__lexicalEventHandles=[]}function Yc(n,e,t){Sn();const r=n.__key,i=n.getParent();if(i===null)return;const s=function(a){const l=ge();if(!he(l)||!ie(a))return l;const{anchor:u,focus:g}=l,d=u.getNode(),f=g.getNode();return Ca(d,a)&&u.set(a.__key,0,"element"),Ca(f,a)&&g.set(a.__key,0,"element"),l}(n);let o=!1;if(he(s)&&e){const a=s.anchor,l=s.focus;a.key===r&&(Fa(a,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0),l.key===r&&(Fa(l,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0)}else Dt(s)&&e&&n.isSelected()&&n.selectPrevious();if(he(s)&&e&&!o){const a=n.getIndexWithinParent();Ti(n),Pa(s,i,a,-1)}else Ti(n);t||un(i)||i.canBeEmpty()||!i.isEmpty()||Yc(i,e),e&&dn(i)&&i.isEmpty()&&i.selectEnd()}class Ia{static getType(){De(64,this.name)}static clone(e){De(65,this.name)}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Pf(this,e)}getType(){return this.__type}isInline(){De(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=tt(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||ge();if(t==null)return!1;const r=t.getNodes().some(i=>i.__key===this.__key);return(me(this)||!he(t)||t.anchor.type!=="element"||t.focus.type!=="element"||t.anchor.key!==t.focus.key||t.anchor.offset!==t.focus.offset)&&r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),r=0;for(;t!==null;){if(this.is(t))return r;r++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:tt(e)}getParentOrThrow(){const e=this.getParent();return e===null&&De(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(un(t))return ie(e)||De(138),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&De(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:tt(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let r=t.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:tt(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),r=e.getParents();ie(this)&&t.unshift(this),ie(e)&&r.unshift(e);const i=t.length,s=r.length;if(i===0||s===0||t[i-1]!==r[s-1])return null;const o=new Set(r);for(let a=0;a<i;a++){const l=t[a];if(o.has(l))return l}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let r=0,i=0,s=this;for(;;){const o=s.getParentOrThrow();if(o===t){r=s.getIndexWithinParent();break}s=o}for(s=e;;){const o=s.getParentOrThrow();if(o===t){i=s.getIndexWithinParent();break}s=o}return r<i}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let r=e;for(;r!==null;){if(r.__key===t)return!0;r=r.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),r=[],i=new Set;let s=this;for(;s!==null;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const a=ie(s)?t?s.getFirstChild():s.getLastChild():null;if(a!==null){s=a;continue}const l=t?s.getNextSibling():s.getPreviousSibling();if(l!==null){s=l;continue}const u=s.getParentOrThrow();if(i.has(u.__key)||r.push(u),u===e)break;let g=null,d=u;do{if(d===null&&De(68),g=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;g!==null||i.has(d.__key)||r.push(d)}while(g===null);s=g}return t||r.reverse(),r}isDirty(){const e=Ut()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=tt(this.__key);return e===null&&De(113),e}getWritable(){Sn();const e=gr(),t=Ut(),r=e._nodeMap,i=this.__key,s=this.getLatest(),o=s.__parent,a=t._cloneNotNeeded,l=ge();if(l!==null&&l.setCachedNodes(null),a.has(i))return ba(s),s;const u=s.constructor.clone(s);return u.__parent=o,u.__next=s.__next,u.__prev=s.__prev,ie(s)&&ie(u)?(us(s)&&us(u)&&(u.__textFormat=s.__textFormat),u.__first=s.__first,u.__last=s.__last,u.__size=s.__size,u.__indent=s.__indent,u.__format=s.__format,u.__dir=s.__dir):me(s)&&me(u)&&(u.__format=s.__format,u.__style=s.__style,u.__mode=s.__mode,u.__detail=s.__detail),a.add(i),u.__key=i,ba(u),r.set(i,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){De(70)}updateDOM(e,t,r){De(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){De(72)}static importJSON(e){De(18,this.name)}static transform(){return null}remove(e){Yc(this,!0,e)}replace(e,t){Sn();let r=ge();r!==null&&(r=r.clone()),Mc(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),u=l.__size;Ti(a);const g=i.getPreviousSibling(),d=i.getNextSibling(),f=i.__prev,m=i.__next,y=i.__parent;if(Yc(i,!1,!0),g===null?l.__first=o:g.getWritable().__next=o,a.__prev=f,d===null?l.__last=o:d.getWritable().__prev=o,a.__next=m,a.__parent=y,l.__size=u,t&&(ie(this)&&ie(a)||De(139),this.getChildren().forEach(b=>{a.append(b)})),he(r)){Nt(r);const b=r.anchor,C=r.focus;b.key===s&&Ch(b,a),C.key===s&&Ch(C,a)}return Xr()===s&&nn(o),a}insertAfter(e,t=!0){Sn(),Mc(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.getParent(),o=ge();let a=!1,l=!1;if(s!==null){const m=e.getIndexWithinParent();if(Ti(i),he(o)){const y=s.__key,b=o.anchor,C=o.focus;a=b.type==="element"&&b.key===y&&b.offset===m+1,l=C.type==="element"&&C.key===y&&C.offset===m+1}}const u=this.getNextSibling(),g=this.getParentOrThrow().getWritable(),d=i.__key,f=r.__next;if(u===null?g.__last=d:u.getWritable().__prev=d,g.__size++,r.__next=d,i.__next=f,i.__prev=r.__key,i.__parent=r.__parent,t&&he(o)){const m=this.getIndexWithinParent();Pa(o,g,m+1);const y=g.__key;a&&o.anchor.set(y,m+2,"element"),l&&o.focus.set(y,m+2,"element")}return e}insertBefore(e,t=!0){Sn(),Mc(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.__key;Ti(i);const o=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=r.__prev,u=this.getIndexWithinParent();o===null?a.__first=s:o.getWritable().__next=s,a.__size++,r.__prev=s,i.__prev=l,i.__next=r.__key,i.__parent=r.__parent;const g=ge();return t&&he(g)&&Pa(g,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return _t()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Sn();const r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(ie(r))return r.select();if(!me(r)){const s=r.getIndexWithinParent()+1;return i.select(s,s)}return r.select(e,t)}selectNext(e,t){Sn();const r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(ie(r))return r.select(0,0);if(!me(r)){const s=r.getIndexWithinParent();return i.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}}class co extends Ia{static getType(){return"linebreak"}static clone(e){return new co(e.__key)}constructor(e){super(e)}getTextContent(){return`
34
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null){const i=r.firstChild;if(i===t||i.nextSibling===t&&yh(i)){const s=r.lastChild;if(s===t||s.previousSibling===t&&yh(s))return!0}}return!1}(e)?null:{conversion:D0,priority:0}}}static importJSON(e){return as()}exportJSON(){return{type:"linebreak",version:1}}}function D0(n){return{node:as()}}function as(){return dr(new co)}function hr(n){return n instanceof co}function yh(n){return n.nodeType===Gr&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function Vc(n,e){return 16&e?"code":e&fc?"mark":32&e?"sub":64&e?"sup":null}function qc(n,e){return 1&e?"strong":2&e?"em":"span"}function _h(n,e,t,r,i){const s=r.classList;let o=eo(i,"base");o!==void 0&&s.add(...o),o=eo(i,"underlineStrikethrough");let a=!1;const l=e&pa&&e&ga;o!==void 0&&(t&pa&&t&ga?(a=!0,l||s.add(...o)):l&&s.remove(...o));for(const u in Rr){const g=Rr[u];if(o=eo(i,u),o!==void 0)if(t&g){if(a&&(u==="underline"||u==="strikethrough")){e&g&&s.remove(...o);continue}e&g&&(!l||u!=="underline")&&u!=="strikethrough"||s.add(...o)}else e&g&&s.remove(...o)}}function bh(n,e,t){const r=e.firstChild,i=t.isComposing(),s=n+(i?ma:"");if(r==null)e.textContent=s;else{const o=r.nodeValue;if(o!==s)if(i||Kr){const[a,l,u]=function(g,d){const f=g.length,m=d.length;let y=0,b=0;for(;y<f&&y<m&&g[y]===d[y];)y++;for(;b+y<f&&b+y<m&&g[f-b-1]===d[m-b-1];)b++;return[y,f-y-b,d.slice(y,m-b)]}(o,s);l!==0&&r.deleteData(a,l),r.insertData(a,u)}else r.nodeValue=s}}function wh(n,e,t,r,i,s){bh(i,n,e);const o=s.theme.text;o!==void 0&&_h(0,0,r,n,o)}function Ra(n,e){const t=document.createElement(e);return t.appendChild(n),t}class Ni extends Ia{static getType(){return"text"}static clone(e){return new Ni(e.__text,e.__key)}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return a0[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Xr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Rr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Sc(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,i=Vc(0,r),s=qc(0,r),o=i===null?s:i,a=document.createElement(o);let l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),i!==null&&(l=document.createElement(s),a.appendChild(l)),wh(l,this,0,r,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,t,r){const i=this.__text,s=e.__format,o=this.__format,a=Vc(0,s),l=Vc(0,o),u=qc(0,s),g=qc(0,o);if((a===null?u:a)!==(l===null?g:l))return!0;if(a===l&&u!==g){const b=t.firstChild;b==null&&De(48);const C=document.createElement(g);return wh(C,this,0,o,i,r),t.replaceChild(C,b),!1}let d=t;l!==null&&a!==null&&(d=t.firstChild,d==null&&De(49)),bh(i,d,this);const f=r.theme.text;f!==void 0&&s!==o&&_h(0,s,o,d,f);const m=e.__style,y=this.__style;return m!==y&&(t.style.cssText=y),!1}static importDOM(){return{"#text":()=>({conversion:L0,priority:0}),b:()=>({conversion:I0,priority:0}),code:()=>({conversion:Zr,priority:0}),em:()=>({conversion:Zr,priority:0}),i:()=>({conversion:Zr,priority:0}),s:()=>({conversion:Zr,priority:0}),span:()=>({conversion:A0,priority:0}),strong:()=>({conversion:Zr,priority:0}),sub:()=>({conversion:Zr,priority:0}),sup:()=>({conversion:Zr,priority:0}),u:()=>({conversion:Zr,priority:0})}}static importJSON(e){const t=Bt(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&no(t)||De(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Ra(t,"b")),this.hasFormat("italic")&&(t=Ra(t,"i")),this.hasFormat("strikethrough")&&(t=Ra(t,"s")),this.hasFormat("underline")&&(t=Ra(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Rr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?i0[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Sc(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=o0[e];if(this.__mode===t)return this;const r=this.getWritable();return r.__mode=t,r}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){Sn();let r=e,i=t;const s=ge(),o=this.getTextContent(),a=this.__key;if(typeof o=="string"){const l=o.length;r===void 0&&(r=l),i===void 0&&(i=l)}else r=0,i=0;if(!he(s))return Dh(a,r,a,i,"text","text");{const l=Xr();l!==s.anchor.key&&l!==s.focus.key||nn(a),s.setTextNodeRange(this,r,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,i){const s=this.getWritable(),o=s.__text,a=r.length;let l=e;l<0&&(l=a+l,l<0&&(l=0));const u=ge();if(i&&he(u)){const d=e+a;u.setTextNodeRange(s,d,s,d)}const g=o.slice(0,l)+r+o.slice(l+t);return s.__text=g,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Sn();const t=this.getLatest(),r=t.getTextContent(),i=t.__key,s=Xr(),o=new Set(e),a=[],l=r.length;let u="";for(let h=0;h<l;h++)u!==""&&o.has(h)&&(a.push(u),u=""),u+=r[h];u!==""&&a.push(u);const g=a.length;if(g===0)return[];if(a[0]===r)return[t];const d=a[0],f=t.getParentOrThrow();let m;const y=t.getFormat(),b=t.getStyle(),C=t.__detail;let S=!1;t.isSegmented()?(m=Bt(d),m.__format=y,m.__style=b,m.__detail=C,S=!0):(m=t.getWritable(),m.__text=d);const A=ge(),v=[m];let k=d.length;for(let h=1;h<g;h++){const I=a[h],O=I.length,j=Bt(I).getWritable();j.__format=y,j.__style=b,j.__detail=C;const P=j.__key,q=k+O;if(he(A)){const G=A.anchor,ne=A.focus;G.key===i&&G.type==="text"&&G.offset>k&&G.offset<=q&&(G.key=P,G.offset-=k,A.dirty=!0),ne.key===i&&ne.type==="text"&&ne.offset>k&&ne.offset<=q&&(ne.key=P,ne.offset-=k,A.dirty=!0)}s===i&&nn(P),k=q,v.push(j)}(function(h){const I=h.getPreviousSibling(),O=h.getNextSibling();I!==null&&ba(I),O!==null&&ba(O)})(this);const T=f.getWritable(),N=this.getIndexWithinParent();return S?(T.splice(N,0,v),this.remove()):T.splice(N,1,v),he(A)&&Pa(A,f,N,g-1),v}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||De(50);const r=this.__key,i=e.__key,s=this.__text,o=s.length;Xr()===i&&nn(r);const a=ge();if(he(a)){const d=a.anchor,f=a.focus;d!==null&&d.key===i&&(Ih(d,t,r,e,o),a.dirty=!0),f!==null&&f.key===i&&(Ih(f,t,r,e,o),a.dirty=!0)}const l=e.__text,u=t?l+s:s+l;this.setTextContent(u);const g=this.getWritable();return e.remove(),g}isTextEntity(){return!1}}function A0(n){return{forChild:Kc(n.style),node:null}}function I0(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:Kc(e.style,t?void 0:"bold"),node:null}}const vh=new WeakMap;function R0(n){return n.nodeName==="PRE"||n.nodeType===Gs&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function L0(n){const e=n;n.parentElement===null&&De(129);let t=e.textContent||"";if(function(r){let i,s=r.parentNode;const o=[r];for(;s!==null&&(i=vh.get(s))===void 0&&!R0(s);)o.push(s),s=s.parentNode;const a=i===void 0?s:i;for(let l=0;l<o.length;l++)vh.set(o[l],a);return a}(e)!==null){const r=t.split(/(\r?\n|\t)/),i=[],s=r.length;for(let o=0;o<s;o++){const a=r[o];a===`
31
+ `,t0=Kr?" ":ma,Ef="֑-߿יִ-﷽ﹰ-ﻼ",kf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",n0=new RegExp("^[^"+kf+"]*["+Ef+"]"),r0=new RegExp("^[^"+Ef+"]*["+kf+"]"),Rr={bold:1,code:16,highlight:fc,italic:2,strikethrough:ga,subscript:32,superscript:64,underline:pa},i0={directionless:1,unmergeable:2},Nf={center:gc,end:_c,justify:mc,left:hc,right:pc,start:yc},s0={[gc]:"center",[_c]:"end",[mc]:"justify",[hc]:"left",[pc]:"right",[yc]:"start"},o0={normal:0,segmented:2,token:1},a0={[J_]:"normal",[Q_]:"segmented",[Z_]:"token"};function l0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Me=l0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function ya(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const c0=100;let bc=!1,wc=0;function u0(n){wc=n.timeStamp}function vc(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function d0(n,e,t){const r=fr(t._window);let i=null,s=null;r!==null&&r.anchorNode===n&&(i=r.anchorOffset,s=r.focusOffset);const o=n.nodeValue;o!==null&&kc(e,o,i,s,!1)}function f0(n,e,t){if(de(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===Gr&&t.isAttached()}function Mf(n,e,t){bc=!0;const r=performance.now()-wc>c0;try{Rn(n,()=>{const i=he()||function(f){return f.getEditorState().read(()=>{const m=he();return m!==null?m.clone():null})}(n),s=new Map,o=n.getRootElement(),a=n._editorState,l=n._blockCursorElement;let u=!1,g="";for(let f=0;f<e.length;f++){const m=e[f],y=m.type,b=m.target;let C=Pt(b,a);if(!(C===null&&b!==o||gt(C))){if(y==="characterData")r&&me(C)&&f0(i,b,C)&&d0(b,C,n);else if(y==="childList"){u=!0;const S=m.addedNodes;for(let k=0;k<S.length;k++){const T=S[k],N=Ff(T),h=T.parentNode;if(h!=null&&T!==l&&N===null&&(T.nodeName!=="BR"||!vc(T,h,n))){if(Kr){const I=T.innerText||T.nodeValue;I&&(g+=I)}h.removeChild(T)}}const A=m.removedNodes,v=A.length;if(v>0){let k=0;for(let T=0;T<v;T++){const N=A[T];(N.nodeName==="BR"&&vc(N,b,n)||l===N)&&(b.appendChild(N),k++)}v!==k&&(b===o&&(C=Uf(a)),s.set(b,C))}}}}if(s.size>0)for(const[f,m]of s)if(ie(m)){const y=m.getChildrenKeys();let b=f.firstChild;for(let C=0;C<y.length;C++){const S=y[C],A=n.getElementByKey(S);A!==null&&(b==null?(f.appendChild(A),b=A):b!==A&&f.replaceChild(A,b),b=b.nextSibling)}}else me(m)&&m.markDirty();const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const m=d[f],y=m.addedNodes,b=m.target;for(let C=0;C<y.length;C++){const S=y[C],A=S.parentNode;A==null||S.nodeName!=="BR"||vc(S,b,n)||A.removeChild(S)}}t.takeRecords()}i!==null&&(u&&(i.dirty=!0,Nt(i)),Kr&&Jf(n)&&i.insertRawText(g))})}finally{bc=!1}}function Df(n){const e=n._observer;e!==null&&Mf(n,e.takeRecords(),e)}function Af(n){(function(e){wc===0&&Sa(e).addEventListener("textInput",u0,!0)})(n),n._observer=new MutationObserver((e,t)=>{Mf(n,e,t)})}function If(n,e){const t=n.__mode,r=n.__format,i=n.__style,s=e.__mode,o=e.__format,a=e.__style;return!(t!==null&&t!==s||r!==null&&r!==o||i!==null&&i!==a)}function Rf(n,e){const t=n.mergeWithSibling(e),r=Ut()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Lf(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&me(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(If(e,r)){r=Rf(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(If(r,t)){r=Rf(r,t);break}break}t.remove()}}else r.remove()}function xc(n){return Of(n.anchor),Of(n.focus),n}function Of(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),me(r)){n.set(r.__key,i?r.getTextContentSize():0,"text");break}if(!ie(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element")}}let h0=1;const g0=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Cc(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return gt(Pt(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&e.__lexicalEditor==null)}function Xs(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!Cc(e)&&jf(e)===n}catch{return!1}}function jf(n){let e=n;for(;e!=null;){const t=e.__lexicalEditor;if(t!=null)return t;e=xa(e)}return null}function ns(n){return n.isToken()||n.isSegmented()}function p0(n){return n.nodeType===Gr}function _a(n){let e=n;for(;e!=null;){if(p0(e))return e;e=e.firstChild}return null}function Sc(n,e,t){const r=Rr[e];if(t!==null&&(n&r)==(t&r))return n;let i=n^r;return e==="subscript"?i&=~Rr.superscript:e==="superscript"&&(i&=~Rr.subscript),i}function m0(n){return me(n)||hr(n)||gt(n)}function Pf(n,e){if(e!=null)return void(n.__key=e);Sn(),Lh();const t=Ut(),r=gr(),i=""+h0++;r._nodeMap.set(i,n),ie(n)?t._dirtyElements.set(i,!0):t._dirtyLeaves.add(i),t._cloneNotNeeded.add(i),t._dirtyType=Tf,n.__key=i}function Ti(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling();if(i===null)if(s!==null){const o=s.getWritable();r.__first=s.__key,o.__prev=null}else r.__first=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(s===null)if(i!==null){const o=i.getWritable();r.__last=i.__key,o.__next=null}else r.__last=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function ba(n){Lh();const e=n.getLatest(),t=e.__parent,r=gr(),i=Ut(),s=r._nodeMap,o=i._dirtyElements;t!==null&&function(l,u,g){let d=l;for(;d!==null;){if(g.has(d))return;const f=u.get(d);if(f===void 0)break;g.set(d,!1),d=f.__parent}}(t,s,o);const a=e.__key;i._dirtyType=Tf,ie(n)?o.set(a,!0):i._dirtyLeaves.add(a)}function nn(n){Sn();const e=Ut(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=tt(t);r!==null&&r.getWritable()}if(n!==null){const r=tt(n);r!==null&&r.getWritable()}}}function Xr(){return ls()?null:Ut()._compositionKey}function tt(n,e){const t=(e||gr())._nodeMap.get(n);return t===void 0?null:t}function Ff(n,e){const t=n[`__lexicalKey_${Ut()._key}`];return t!==void 0?tt(t,e):null}function Pt(n,e){let t=n;for(;t!=null;){const r=Ff(t,e);if(r!==null)return r;t=xa(t)}return null}function zf(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Bf(n){return n.read(()=>dt().getTextContent())}function dt(){return Uf(gr())}function Uf(n){return n._nodeMap.get("root")}function Nt(n){Sn();const e=gr();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function rs(n){const e=Ut(),t=function(r,i){let s=r;for(;s!=null;){const o=s[`__lexicalKey_${i._key}`];if(o!==void 0)return o;s=xa(s)}return null}(n,e);return t===null?n===e.getRootElement()?tt("root"):null:tt(t)}function Hf(n,e){return e?n.getTextContentSize():0}function Wf(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Tc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function $f(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Yf(n){return n.nodeType===Gr?n.nodeValue:null}function Ec(n,e,t){const r=fr(e._window);if(r===null)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(i!==null){let a=Yf(i);const l=Pt(i);if(a!==null&&me(l)){if(a===ma&&t){const u=t.length;a=t,s=u,o=u}a!==null&&kc(l,a,s,o,n)}}}function kc(n,e,t,r,i){let s=n;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let a=e;(o||i)&&e[e.length-1]===ma&&(a=e.slice(0,-1));const l=s.getTextContent();if(i||a!==l){if(a===""){if(nn(null),uc||ha||dc)s.remove();else{const b=Ut();setTimeout(()=>{b.update(()=>{s.isAttached()&&s.remove()})},20)}return}const u=s.getParent(),g=ti(),d=s.getTextContentSize(),f=Xr(),m=s.getKey();if(s.isToken()||f!==null&&m===f&&!o||de(g)&&(u!==null&&!u.canInsertTextBefore()&&g.anchor.offset===0||g.anchor.key===n.__key&&g.anchor.offset===0&&!s.canInsertTextBefore()&&!o||g.focus.key===n.__key&&g.focus.offset===d&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const y=he();if(!de(y)||t===null||r===null)return void s.setTextContent(a);if(y.setTextNodeRange(s,t,s,r),s.isSegmented()){const b=Bt(s.getTextContent());s.replace(b),s=b}s.setTextContent(a)}}}function y0(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),i=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(s){const o=s.getPreviousSibling();return(me(o)||ie(o)&&o.isInline())&&!o.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}function Vf(n){return n==="ArrowLeft"}function qf(n){return n==="ArrowRight"}function Js(n,e){return er?n:e}function Kf(n){return n==="Enter"}function Zs(n){return n==="Backspace"}function Qs(n){return n==="Delete"}function Gf(n,e,t){return n.toLowerCase()==="a"&&Js(e,t)}function _0(){const n=dt();Nt(xc(n.select(0,n.getChildrenSize())))}function eo(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const i=n[e];if(typeof i=="string"){const s=ya(i);return t[e]=s,s}return i}function Nc(n,e,t,r,i){if(t.size===0)return;const s=r.__type,o=r.__key,a=e.get(s);a===void 0&&Me(33,s);const l=a.klass;let u=n.get(l);u===void 0&&(u=new Map,n.set(l,u));const g=u.get(o),d=g==="destroyed"&&i==="created";(g===void 0||d)&&u.set(o,d?"updated":i)}function b0(n){const e=gr(),t=e._readOnly,r=n.getType(),i=e._nodeMap,s=[];for(const[,o]of i)o instanceof n&&o.__type===r&&(t||o.isAttached())&&s.push(o);return s}function Xf(n,e,t){const r=n.getParent();let i=t,s=n;return r!==null&&(e&&t===0?(i=s.getIndexWithinParent(),s=r):e||t!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function to(n,e){const t=n.offset;if(n.type==="element")return Xf(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const i=e?r.getPreviousSibling():r.getNextSibling();return i===null?Xf(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):i}}return null}function Jf(n){const e=Sa(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function Oe(n,e,t){return Fh(n,e,t)}function wa(n){return!dn(n)&&!n.isLastChild()&&!n.isInline()}function va(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&Me(75,e),t}function xa(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Ca(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Sa(n){const e=n._window;return e===null&&Me(78),e}function w0(n){let e=n.getParentOrThrow();for(;e!==null;){if(un(e))return e;e=e.getParentOrThrow()}return e}function un(n){return dn(n)||ie(n)&&n.isShadowRoot()}function v0(n){const e=n.constructor.clone(n);return Pf(e,null),e}function dr(n){const e=Ut(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&Me(97);const i=r.replace;if(i!==null){const s=i(n);return s instanceof n.constructor||Me(98),s}return n}function Mc(n,e){!dn(n.getParent())||ie(e)||gt(e)||Me(99)}function Dc(n){return(gt(n)||ie(n)&&!n.canBeEmpty())&&!n.isInline()}function Ac(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function x0(n,e,t){let r=n._blockCursorElement;if(de(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const i=t.anchor,s=i.getNode(),o=i.offset;let a=!1,l=null;if(o===s.getChildrenSize())Dc(s.getChildAtIndex(o-1))&&(a=!0);else{const u=s.getChildAtIndex(o);if(Dc(u)){const g=u.getPreviousSibling();(g===null||Dc(g))&&(a=!0,l=n.getElementByKey(u.__key))}}if(a){const u=n.getElementByKey(s.__key);return r===null&&(n._blockCursorElement=r=function(g){const d=g.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let m=d.blockCursor;if(m!==void 0){if(typeof m=="string"){const y=ya(m);m=d.blockCursor=y}m!==void 0&&f.classList.add(...m)}return f}(n._config)),e.style.caretColor="transparent",void(l===null?u.appendChild(r):u.insertBefore(r,l))}}r!==null&&Ac(r,n,e)}function fr(n){return Qn?(n||window).getSelection():null}function C0(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),un(n)&&Me(102);const r=o=>{const a=o.getParentOrThrow(),l=un(a),u=o!==t||l?v0(o):o;if(l)return ie(o)&&ie(u)||Me(133),o.insertAfter(u),[o,u,u];{const[g,d,f]=r(a),m=o.getNextSiblings();return f.append(u,...m),[g,d,u]}},[i,s]=r(t);return[i,s]}function no(n){return n.nodeType===1}function S0(n){const e=new RegExp(/^(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|#text)$/,"i");return n.nodeName.match(e)!==null}function T0(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function is(n){if(dn(n)||gt(n)&&!n.isInline())return!0;if(!ie(n)||un(n))return!1;const e=n.getFirstChild(),t=e===null||hr(e)||me(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Ic(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Zf(n,e,t,r,i,s){let o=n.getFirstChild();for(;o!==null;){const a=o.__key;o.__parent===e&&(ie(o)&&Zf(o,a,t,r,i,s),t.has(a)||s.delete(a),i.push(a)),o=o.getNextSibling()}}let Jr,yn,ro,Ta,Rc,Lc,Ei,tr,Oc,io,Kt="",_n="",nr=null,Lr="",Qf=!1,Ea=!1,ka=null;function Na(n,e){const t=Ei.get(n);if(e!==null){const r=zc(n);r.parentNode===e&&e.removeChild(r)}if(tr.has(n)||yn._keyToDOMMap.delete(n),ie(t)){const r=Da(t,Ei);jc(r,0,r.length-1,null)}t!==void 0&&Nc(io,ro,Ta,t,"destroyed")}function jc(n,e,t,r){let i=e;for(;i<=t;++i){const s=n[i];s!==void 0&&Na(s,r)}}function ki(n,e){n.setProperty("text-align",e)}const E0="40px";function eh(n,e){const t=Jr.theme.indent;if(typeof t=="string"){const i=n.classList.contains(t);e>0&&!i?n.classList.add(t):e<1&&i&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||E0;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function th(n,e){const t=n.style;e===0?ki(t,""):e===hc?ki(t,"left"):e===gc?ki(t,"center"):e===pc?ki(t,"right"):e===mc?ki(t,"justify"):e===yc?ki(t,"start"):e===_c&&ki(t,"end")}function Ma(n,e,t){const r=tr.get(n);r===void 0&&Me(60);const i=r.createDOM(Jr,yn);if(function(s,o,a){const l=a._keyToDOMMap;o["__lexicalKey_"+a._key]=s,l.set(s,o)}(n,i,yn),me(r)?i.setAttribute("data-lexical-text","true"):gt(r)&&i.setAttribute("data-lexical-decorator","true"),ie(r)){const s=r.__indent,o=r.__size;if(s!==0&&eh(i,s),o!==0){const l=o-1;(function(u,g,d,f){const m=_n;_n="",Pc(u,d,0,g,f,null),ih(d,f),_n=m})(Da(r,tr),l,r,i)}const a=r.__format;a!==0&&th(i,a),r.isInline()||rh(null,r,i),wa(r)&&(Kt+=Ir,Lr+=Ir)}else{const s=r.getTextContent();if(gt(r)){const o=r.decorate(yn,Jr);o!==null&&sh(n,o),i.contentEditable="false"}else me(r)&&(r.isDirectionless()||(_n+=s));Kt+=s,Lr+=s}if(e!==null)if(t!=null)e.insertBefore(i,t);else{const s=e.__lexicalLineBreak;s!=null?e.insertBefore(i,s):e.appendChild(i)}return Nc(io,ro,Ta,r,"created"),i}function Pc(n,e,t,r,i,s){const o=Kt;Kt="";let a=t;for(;a<=r;++a){Ma(n[a],i,s);const l=tr.get(n[a]);l!==null&&nr===null&&me(l)&&(nr=l.getFormat())}wa(e)&&(Kt+=Ir),i.__lexicalTextContent=Kt,Kt=o+Kt}function nh(n,e){const t=e.get(n);return hr(t)||gt(t)&&t.isInline()}function rh(n,e,t){const r=n!==null&&(n.__size===0||nh(n.__last,Ei)),i=e.__size===0||nh(e.__last,tr);if(r){if(!i){const s=t.__lexicalLineBreak;s!=null&&t.removeChild(s),t.__lexicalLineBreak=null}}else if(i){const s=document.createElement("br");t.__lexicalLineBreak=s,t.appendChild(s)}}function ih(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==_n||r!==ka){const s=_n==="",o=s?ka:(i=_n,n0.test(i)?"rtl":r0.test(i)?"ltr":null);if(o!==r){const a=e.classList,l=Jr.theme;let u=r!==null?l[r]:void 0,g=o!==null?l[o]:void 0;if(u!==void 0){if(typeof u=="string"){const d=ya(u);u=l[r]=d}a.remove(...u)}if(o===null||s&&o==="ltr")e.removeAttribute("dir");else{if(g!==void 0){if(typeof g=="string"){const d=ya(g);g=l[o]=d}g!==void 0&&a.add(...g)}e.dir=o}Ea||(n.getWritable().__dir=o)}ka=o,e.__lexicalDirTextContent=_n,e.__lexicalDir=o}var i}function k0(n,e,t){const r=_n;var i;_n="",nr=null,function(s,o,a){const l=Kt,u=s.__size,g=o.__size;if(Kt="",u===1&&g===1){const d=s.__first,f=o.__first;if(d===f)so(d,a);else{const y=zc(d),b=Ma(f,null,null);a.replaceChild(b,y),Na(d,null)}const m=tr.get(f);nr===null&&me(m)&&(nr=m.getFormat())}else{const d=Da(s,Ei),f=Da(o,tr);if(u===0)g!==0&&Pc(f,o,0,g-1,a,null);else if(g===0){if(u!==0){const m=a.__lexicalLineBreak==null;jc(d,0,u-1,m?null:a),m&&(a.textContent="")}}else(function(m,y,b,C,S,A){const v=C-1,k=S-1;let T,N,h=(j=A,j.firstChild),I=0,O=0;for(var j;I<=v&&O<=k;){const G=y[I],ee=b[O];if(G===ee)h=Fc(so(ee,A)),I++,O++;else{T===void 0&&(T=new Set(y)),N===void 0&&(N=new Set(b));const ae=N.has(G),ge=T.has(ee);if(ae)if(ge){const Le=va(yn,ee);Le===h?h=Fc(so(ee,A)):(h!=null?A.insertBefore(Le,h):A.appendChild(Le),so(ee,A)),I++,O++}else Ma(ee,A,h),O++;else h=Fc(zc(G)),Na(G,A),I++}const ue=tr.get(ee);ue!==null&&nr===null&&me(ue)&&(nr=ue.getFormat())}const P=I>v,q=O>k;if(P&&!q){const G=b[k+1];Pc(b,m,O,k,A,G===void 0?null:yn.getElementByKey(G))}else q&&!P&&jc(y,I,v,A)})(o,d,f,u,g,a)}wa(o)&&(Kt+=Ir),a.__lexicalTextContent=Kt,Kt=l+Kt}(n,e,t),ih(e,t),us(i=e)&&nr!=null&&nr!==i.__textFormat&&!Ea&&i.setTextFormat(nr),_n=r,nr=null}function Da(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e.get(r);i===void 0&&Me(101),t.push(r),r=i.__next}return t}function so(n,e){const t=Ei.get(n);let r=tr.get(n);t!==void 0&&r!==void 0||Me(61);const i=Qf||Lc.has(n)||Rc.has(n),s=va(yn,n);if(t===r&&!i){if(ie(t)){const o=s.__lexicalTextContent;o!==void 0&&(Kt+=o,Lr+=o);const a=s.__lexicalDirTextContent;a!==void 0&&(_n+=a)}else{const o=t.getTextContent();me(t)&&!t.isDirectionless()&&(_n+=o),Lr+=o,Kt+=o}return s}if(t!==r&&i&&Nc(io,ro,Ta,r,"updated"),r.updateDOM(t,s,Jr)){const o=Ma(n,null,null);return e===null&&Me(62),e.replaceChild(o,s),Na(n,null),o}if(ie(t)&&ie(r)){const o=r.__indent;o!==t.__indent&&eh(s,o);const a=r.__format;a!==t.__format&&th(s,a),i&&(k0(t,r,s),dn(r)||r.isInline()||rh(t,r,s)),wa(r)&&(Kt+=Ir,Lr+=Ir)}else{const o=r.getTextContent();if(gt(r)){const a=r.decorate(yn,Jr);a!==null&&sh(n,a)}else me(r)&&!r.isDirectionless()&&(_n+=o);Kt+=o,Lr+=o}if(!Ea&&dn(r)&&r.__cachedText!==Lr){const o=r.getWritable();o.__cachedText=Lr,r=o}return s}function sh(n,e){let t=yn._pendingDecorators;const r=yn._decorators;if(t===null){if(r[n]===e)return;t=zf(yn)}t[n]=e}function Fc(n){let e=n.nextSibling;return e!==null&&e===yn._blockCursorElement&&(e=e.nextSibling),e}function N0(n,e,t,r,i,s){Kt="",Lr="",_n="",Qf=r===ts,ka=null,yn=t,Jr=t._config,ro=t._nodes,Ta=yn._listeners.mutation,Rc=i,Lc=s,Ei=n._nodeMap,tr=e._nodeMap,Ea=e._readOnly,Oc=new Map(t._keyToDOMMap);const o=new Map;return io=o,so("root",null),yn=void 0,ro=void 0,Rc=void 0,Lc=void 0,Ei=void 0,tr=void 0,Jr=void 0,Oc=void 0,io=void 0,o}function zc(n){const e=Oc.get(n);return e===void 0&&Me(75,n),e}const Or=Object.freeze({}),Bc=30,Uc=[["keydown",function(n,e){if(oo=n.timeStamp,oh=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:i,metaKey:s,altKey:o}=n;Oe(e,B_,n)||t!=null&&(function(a,l,u,g){return qf(a)&&!l&&!g&&!u}(t,i,o,s)?Oe(e,rc,n):function(a,l,u,g,d){return qf(a)&&!g&&!u&&(l||d)}(t,i,r,o,s)?Oe(e,U_,n):function(a,l,u,g){return Vf(a)&&!l&&!g&&!u}(t,i,o,s)?Oe(e,ic,n):function(a,l,u,g,d){return Vf(a)&&!g&&!u&&(l||d)}(t,i,r,o,s)?Oe(e,H_,n):function(a,l,u){return function(g){return g==="ArrowUp"}(a)&&!l&&!u}(t,i,s)?Oe(e,sc,n):function(a,l,u){return function(g){return g==="ArrowDown"}(a)&&!l&&!u}(t,i,s)?Oe(e,oc,n):function(a,l){return Kf(a)&&l}(t,r)?(ao=!0,Oe(e,Ci,n)):function(a){return a===" "}(t)?Oe(e,W_,n):function(a,l){return er&&l&&a.toLowerCase()==="o"}(t,i)?(n.preventDefault(),ao=!0,Oe(e,Ji,!0)):function(a,l){return Kf(a)&&!l}(t,r)?(ao=!1,Oe(e,Ci,n)):function(a,l,u,g){return er?!l&&!u&&(Zs(a)||a.toLowerCase()==="h"&&g):!(g||l||u)&&Zs(a)}(t,o,s,i)?Zs(t)?Oe(e,Vs,n):(n.preventDefault(),Oe(e,qr,!0)):function(a){return a==="Escape"}(t)?Oe(e,qs,n):function(a,l,u,g,d){return er?!(u||g||d)&&(Qs(a)||a.toLowerCase()==="d"&&l):!(l||g||d)&&Qs(a)}(t,i,r,o,s)?Qs(t)?Oe(e,Ks,n):(n.preventDefault(),Oe(e,qr,!1)):function(a,l,u){return Zs(a)&&(er?l:u)}(t,o,i)?(n.preventDefault(),Oe(e,Zi,!0)):function(a,l,u){return Qs(a)&&(er?l:u)}(t,o,i)?(n.preventDefault(),Oe(e,Zi,!1)):function(a,l){return er&&l&&Zs(a)}(t,s)?(n.preventDefault(),Oe(e,xi,!0)):function(a,l){return er&&l&&Qs(a)}(t,s)?(n.preventDefault(),Oe(e,xi,!1)):function(a,l,u,g){return a.toLowerCase()==="b"&&!l&&Js(u,g)}(t,o,s,i)?(n.preventDefault(),Oe(e,mn,"bold")):function(a,l,u,g){return a.toLowerCase()==="u"&&!l&&Js(u,g)}(t,o,s,i)?(n.preventDefault(),Oe(e,mn,"underline")):function(a,l,u,g){return a.toLowerCase()==="i"&&!l&&Js(u,g)}(t,o,s,i)?(n.preventDefault(),Oe(e,mn,"italic")):function(a,l,u,g){return a==="Tab"&&!l&&!u&&!g}(t,o,i,s)?Oe(e,bf,n):function(a,l,u,g){return a.toLowerCase()==="z"&&!l&&Js(u,g)}(t,r,s,i)?(n.preventDefault(),Oe(e,aa,void 0)):function(a,l,u,g){return er?a.toLowerCase()==="z"&&u&&l:a.toLowerCase()==="y"&&g||a.toLowerCase()==="z"&&g&&l}(t,r,s,i)?(n.preventDefault(),Oe(e,la,void 0)):Dt(e._editorState._selection)?function(a,l,u,g){return!l&&a.toLowerCase()==="c"&&(er?u:g)}(t,r,s,i)?(n.preventDefault(),Oe(e,da,n)):function(a,l,u,g){return!l&&a.toLowerCase()==="x"&&(er?u:g)}(t,r,s,i)?(n.preventDefault(),Oe(e,ac,n)):Gf(t,s,i)&&(n.preventDefault(),Oe(e,lc,n)):!Kr&&Gf(t,s,i)&&(n.preventDefault(),Oe(e,lc,n)),function(a,l,u,g){return a||l||u||g}(i,r,o,s)&&Oe(e,q_,n))}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&Rn(e,()=>{gt(Pt(t))||(Wc=!0)})}],["compositionstart",function(n,e){Rn(e,()=>{const t=he();if(de(t)&&!e.isComposing()){const r=t.anchor,i=t.anchor.getNode();nn(r.key),(n.timeStamp<oo+Bc||r.type==="element"||!t.isCollapsed()||i.getFormat()!==t.format||me(i)&&i.getStyle()!==t.style)&&Oe(e,vi,t0)}})}],["compositionend",function(n,e){Kr?lo=!0:Rn(e,()=>{$c(e,n.data)})}],["input",function(n,e){n.stopPropagation(),Rn(e,()=>{const t=he(),r=n.data,i=fh(n);if(r!=null&&de(t)&&ch(t,i,r,n.timeStamp,!1)){lo&&($c(e,r),lo=!1);const s=t.anchor.getNode(),o=fr(e._window);if(o===null)return;const a=t.isBackward(),l=a?t.anchor.offset:t.focus.offset,u=a?t.focus.offset:t.anchor.offset;fa&&!t.isCollapsed()&&me(s)&&o.anchorNode!==null&&s.getTextContent().slice(0,l)+r+s.getTextContent().slice(l+u)===Yf(o.anchorNode)||Oe(e,vi,r);const g=r.length;Kr&&g>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=g),uc||ha||dc||!e.isComposing()||(oo=0,nn(null))}else Ec(!1,e,r!==null?r:void 0),lo&&($c(e,r||void 0),lo=!1);Sn(),Df(Ut())}),ss=null}],["click",function(n,e){Rn(e,()=>{const t=he(),r=fr(e._window),i=ti();if(r){if(de(t)){const s=t.anchor,o=s.getNode();s.type==="element"&&s.offset===0&&t.isCollapsed()&&!dn(o)&&dt().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()&&(ie(o)?o.select(0):o.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const s=r.anchorNode;if(s!==null){const o=s.nodeType;(o===Gs||o===Gr)&&Nt(ja(i,r,e,n))}}}Oe(e,$s,n)})}],["cut",Or],["copy",Or],["dragstart",Or],["dragover",Or],["dragend",Or],["paste",Or],["focus",Or],["blur",Or],["drop",Or]];fa&&Uc.push(["beforeinput",(n,e)=>function(t,r){const i=t.inputType,s=fh(t);i==="deleteCompositionText"||Kr&&Jf(r)||i!=="insertCompositionText"&&Rn(r,()=>{const o=he();if(i==="deleteContentBackward"){if(o===null){const m=ti();if(!de(m))return;Nt(m.clone())}if(de(o)){const m=o.anchor.key===o.focus.key;if(a=t.timeStamp,oh==="MediaLast"&&a<oo+Bc&&r.isComposing()&&m){if(nn(null),oo=0,setTimeout(()=>{Rn(r,()=>{nn(null)})},Bc),de(o)){const y=o.anchor.getNode();y.markDirty(),o.format=y.getFormat(),me(y)||Me(142),o.style=y.getStyle()}}else{nn(null),t.preventDefault();const y=o.anchor.getNode().getTextContent(),b=o.anchor.offset===0&&o.focus.offset===y.length;X_&&m&&!b||Oe(r,qr,!0)}return}}var a;if(!de(o))return;const l=t.data;ss!==null&&Ec(!1,r,ss),o.dirty&&ss===null||!o.isCollapsed()||dn(o.anchor.getNode())||s===null||o.applyDOMRange(s),ss=null;const u=o.anchor,g=o.focus,d=u.getNode(),f=g.getNode();if(i!=="insertText"&&i!=="insertTranspose")switch(t.preventDefault(),i){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Oe(r,vi,t);break;case"insertFromComposition":nn(null),Oe(r,vi,t);break;case"insertLineBreak":nn(null),Oe(r,Ji,!1);break;case"insertParagraph":nn(null),ao&&!ha?(ao=!1,Oe(r,Ji,!1)):Oe(r,Ys,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Oe(r,oa,t);break;case"deleteByComposition":(function(m,y){return m!==y||ie(m)||ie(y)||!m.isToken()||!y.isToken()})(d,f)&&Oe(r,nc,t);break;case"deleteByDrag":case"deleteByCut":Oe(r,nc,t);break;case"deleteContent":Oe(r,qr,!1);break;case"deleteWordBackward":Oe(r,Zi,!0);break;case"deleteWordForward":Oe(r,Zi,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Oe(r,xi,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Oe(r,xi,!1);break;case"formatStrikeThrough":Oe(r,mn,"strikethrough");break;case"formatBold":Oe(r,mn,"bold");break;case"formatItalic":Oe(r,mn,"italic");break;case"formatUnderline":Oe(r,mn,"underline");break;case"historyUndo":Oe(r,aa,void 0);break;case"historyRedo":Oe(r,la,void 0)}else{if(l===`
32
+ `)t.preventDefault(),Oe(r,Ji,!1);else if(l===Ir)t.preventDefault(),Oe(r,Ys,void 0);else if(l==null&&t.dataTransfer){const m=t.dataTransfer.getData("text/plain");t.preventDefault(),o.insertRawText(m)}else l!=null&&ch(o,s,l,t.timeStamp,!0)?(t.preventDefault(),Oe(r,vi,l)):ss=l;ah=t.timeStamp}})}(n,e)]);let oo=0,oh=null,ah=0,ss=null;const Aa=new WeakMap;let Hc=!1,Wc=!1,ao=!1,lo=!1,lh=[0,"",0,"root",0];function ch(n,e,t,r,i){const s=n.anchor,o=n.focus,a=s.getNode(),l=Ut(),u=fr(l._window),g=u!==null?u.anchorNode:null,d=s.key,f=l.getElementByKey(d),m=t.length;return d!==o.key||!me(a)||(!i&&(!fa||ah<r+50)||a.isDirty()&&m<2||Wf(t))&&s.offset!==o.offset&&!a.isComposing()||ns(a)||a.isDirty()&&m>1||(i||!fa)&&f!==null&&!a.isComposing()&&g!==_a(f)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||a.getFormat()!==n.format||a.getStyle()!==n.style||y0(n,a)}function uh(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===Gr&&e!==0&&e!==n.nodeValue.length}function dh(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=n;Hc&&(Hc=!1,uh(r,i)&&uh(s,o))||Rn(e,()=>{if(!t)return void Nt(null);if(!Xs(e,r,s))return;const a=he();if(de(a)){const l=a.anchor,u=l.getNode();if(a.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(a.dirty=!0);const g=Sa(e).event,d=g?g.timeStamp:performance.now(),[f,m,y,b,C]=lh,S=dt(),A=e.isComposing()===!1&&S.getTextContent()==="";if(d<C+200&&l.offset===y&&l.key===b)a.format=f,a.style=m;else if(l.type==="text")me(u)||Me(141),a.format=u.getFormat(),a.style=u.getStyle();else if(l.type==="element"&&!A){const v=l.getNode();v instanceof cs&&v.getChildrenSize()===0?a.format=v.getTextFormat():a.format=0,a.style=""}}else{const g=l.key,d=a.focus.key,f=a.getNodes(),m=f.length,y=a.isBackward(),b=y?o:i,C=y?i:o,S=y?d:g,A=y?g:d;let v=e0,k=!1;for(let T=0;T<m;T++){const N=f[T],h=N.getTextContentSize();if(me(N)&&h!==0&&!(T===0&&N.__key===S&&b===h||T===m-1&&N.__key===A&&C===0)&&(k=!0,v&=N.getFormat(),v===0))break}a.format=k?v:0}}Oe(e,Hn,void 0)})}function fh(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function $c(n,e){const t=n._compositionKey;if(nn(null),t!==null&&e!=null){if(e===""){const r=tt(t),i=_a(n.getElementByKey(t));return void(i!==null&&i.nodeValue!==null&&me(r)&&kc(r,i.nodeValue,null,null,!0))}if(e[e.length-1]===`
33
+ `){const r=he();if(de(r)){const i=r.focus;return r.anchor.set(i.key,i.offset,i.type),void Oe(n,Ci,null)}}}Ec(!0,n,e)}function hh(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const os=new Map;function gh(n){const e=n.target,t=fr(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const r=jf(t.anchorNode);if(r===null)return;Wc&&(Wc=!1,Rn(r,()=>{const u=ti(),g=t.anchorNode;if(g===null)return;const d=g.nodeType;d!==Gs&&d!==Gr||Nt(ja(u,t,r,n))}));const i=Tc(r),s=i[i.length-1],o=s._key,a=os.get(o),l=a||s;l!==r&&dh(t,l,!1),dh(t,r,!0),r!==s?os.set(o,r):a&&os.delete(o)}function ph(n){n._lexicalHandled=!0}function mh(n){return n._lexicalHandled===!0}function M0(n){const e=n.ownerDocument,t=Aa.get(e);t===void 0&&Me(162);const r=t-1;r>=0||Me(164),Aa.set(e,r),r===0&&e.removeEventListener("selectionchange",gh);const i=n.__lexicalEditor;i!=null&&(function(o){if(o._parentEditor!==null){const a=Tc(o),l=a[a.length-1]._key;os.get(l)===o&&os.delete(l)}else os.delete(o._key)}(i),n.__lexicalEditor=null);const s=hh(n);for(let o=0;o<s.length;o++)s[o]();n.__lexicalEventHandles=[]}function Yc(n,e,t){Sn();const r=n.__key,i=n.getParent();if(i===null)return;const s=function(a){const l=he();if(!de(l)||!ie(a))return l;const{anchor:u,focus:g}=l,d=u.getNode(),f=g.getNode();return Ca(d,a)&&u.set(a.__key,0,"element"),Ca(f,a)&&g.set(a.__key,0,"element"),l}(n);let o=!1;if(de(s)&&e){const a=s.anchor,l=s.focus;a.key===r&&(Fa(a,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0),l.key===r&&(Fa(l,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0)}else Dt(s)&&e&&n.isSelected()&&n.selectPrevious();if(de(s)&&e&&!o){const a=n.getIndexWithinParent();Ti(n),Pa(s,i,a,-1)}else Ti(n);t||un(i)||i.canBeEmpty()||!i.isEmpty()||Yc(i,e),e&&dn(i)&&i.isEmpty()&&i.selectEnd()}class Ia{static getType(){Me(64,this.name)}static clone(e){Me(65,this.name)}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Pf(this,e)}getType(){return this.__type}isInline(){Me(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=tt(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||he();if(t==null)return!1;const r=t.getNodes().some(i=>i.__key===this.__key);return(me(this)||!de(t)||t.anchor.type!=="element"||t.focus.type!=="element"||t.anchor.key!==t.focus.key||t.anchor.offset!==t.focus.offset)&&r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),r=0;for(;t!==null;){if(this.is(t))return r;r++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:tt(e)}getParentOrThrow(){const e=this.getParent();return e===null&&Me(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(un(t))return ie(e)||Me(138),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&Me(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:tt(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let r=t.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:tt(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),r=e.getParents();ie(this)&&t.unshift(this),ie(e)&&r.unshift(e);const i=t.length,s=r.length;if(i===0||s===0||t[i-1]!==r[s-1])return null;const o=new Set(r);for(let a=0;a<i;a++){const l=t[a];if(o.has(l))return l}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let r=0,i=0,s=this;for(;;){const o=s.getParentOrThrow();if(o===t){r=s.getIndexWithinParent();break}s=o}for(s=e;;){const o=s.getParentOrThrow();if(o===t){i=s.getIndexWithinParent();break}s=o}return r<i}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let r=e;for(;r!==null;){if(r.__key===t)return!0;r=r.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),r=[],i=new Set;let s=this;for(;s!==null;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const a=ie(s)?t?s.getFirstChild():s.getLastChild():null;if(a!==null){s=a;continue}const l=t?s.getNextSibling():s.getPreviousSibling();if(l!==null){s=l;continue}const u=s.getParentOrThrow();if(i.has(u.__key)||r.push(u),u===e)break;let g=null,d=u;do{if(d===null&&Me(68),g=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;g!==null||i.has(d.__key)||r.push(d)}while(g===null);s=g}return t||r.reverse(),r}isDirty(){const e=Ut()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=tt(this.__key);return e===null&&Me(113),e}getWritable(){Sn();const e=gr(),t=Ut(),r=e._nodeMap,i=this.__key,s=this.getLatest(),o=s.__parent,a=t._cloneNotNeeded,l=he();if(l!==null&&l.setCachedNodes(null),a.has(i))return ba(s),s;const u=s.constructor.clone(s);return u.__parent=o,u.__next=s.__next,u.__prev=s.__prev,ie(s)&&ie(u)?(us(s)&&us(u)&&(u.__textFormat=s.__textFormat),u.__first=s.__first,u.__last=s.__last,u.__size=s.__size,u.__indent=s.__indent,u.__format=s.__format,u.__dir=s.__dir):me(s)&&me(u)&&(u.__format=s.__format,u.__style=s.__style,u.__mode=s.__mode,u.__detail=s.__detail),a.add(i),u.__key=i,ba(u),r.set(i,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){Me(70)}updateDOM(e,t,r){Me(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){Me(72)}static importJSON(e){Me(18,this.name)}static transform(){return null}remove(e){Yc(this,!0,e)}replace(e,t){Sn();let r=he();r!==null&&(r=r.clone()),Mc(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,a=e.getWritable(),l=this.getParentOrThrow().getWritable(),u=l.__size;Ti(a);const g=i.getPreviousSibling(),d=i.getNextSibling(),f=i.__prev,m=i.__next,y=i.__parent;if(Yc(i,!1,!0),g===null?l.__first=o:g.getWritable().__next=o,a.__prev=f,d===null?l.__last=o:d.getWritable().__prev=o,a.__next=m,a.__parent=y,l.__size=u,t&&(ie(this)&&ie(a)||Me(139),this.getChildren().forEach(b=>{a.append(b)})),de(r)){Nt(r);const b=r.anchor,C=r.focus;b.key===s&&Ch(b,a),C.key===s&&Ch(C,a)}return Xr()===s&&nn(o),a}insertAfter(e,t=!0){Sn(),Mc(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.getParent(),o=he();let a=!1,l=!1;if(s!==null){const m=e.getIndexWithinParent();if(Ti(i),de(o)){const y=s.__key,b=o.anchor,C=o.focus;a=b.type==="element"&&b.key===y&&b.offset===m+1,l=C.type==="element"&&C.key===y&&C.offset===m+1}}const u=this.getNextSibling(),g=this.getParentOrThrow().getWritable(),d=i.__key,f=r.__next;if(u===null?g.__last=d:u.getWritable().__prev=d,g.__size++,r.__next=d,i.__next=f,i.__prev=r.__key,i.__parent=r.__parent,t&&de(o)){const m=this.getIndexWithinParent();Pa(o,g,m+1);const y=g.__key;a&&o.anchor.set(y,m+2,"element"),l&&o.focus.set(y,m+2,"element")}return e}insertBefore(e,t=!0){Sn(),Mc(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.__key;Ti(i);const o=this.getPreviousSibling(),a=this.getParentOrThrow().getWritable(),l=r.__prev,u=this.getIndexWithinParent();o===null?a.__first=s:o.getWritable().__next=s,a.__size++,r.__prev=s,i.__prev=l,i.__next=r.__key,i.__parent=r.__parent;const g=he();return t&&de(g)&&Pa(g,this.getParentOrThrow(),u),e}isParentRequired(){return!1}createParentElementNode(){return _t()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Sn();const r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(ie(r))return r.select();if(!me(r)){const s=r.getIndexWithinParent()+1;return i.select(s,s)}return r.select(e,t)}selectNext(e,t){Sn();const r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(ie(r))return r.select(0,0);if(!me(r)){const s=r.getIndexWithinParent();return i.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}}class co extends Ia{static getType(){return"linebreak"}static clone(e){return new co(e.__key)}constructor(e){super(e)}getTextContent(){return`
34
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null){const i=r.firstChild;if(i===t||i.nextSibling===t&&yh(i)){const s=r.lastChild;if(s===t||s.previousSibling===t&&yh(s))return!0}}return!1}(e)?null:{conversion:D0,priority:0}}}static importJSON(e){return as()}exportJSON(){return{type:"linebreak",version:1}}}function D0(n){return{node:as()}}function as(){return dr(new co)}function hr(n){return n instanceof co}function yh(n){return n.nodeType===Gr&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function Vc(n,e){return 16&e?"code":e&fc?"mark":32&e?"sub":64&e?"sup":null}function qc(n,e){return 1&e?"strong":2&e?"em":"span"}function _h(n,e,t,r,i){const s=r.classList;let o=eo(i,"base");o!==void 0&&s.add(...o),o=eo(i,"underlineStrikethrough");let a=!1;const l=e&pa&&e&ga;o!==void 0&&(t&pa&&t&ga?(a=!0,l||s.add(...o)):l&&s.remove(...o));for(const u in Rr){const g=Rr[u];if(o=eo(i,u),o!==void 0)if(t&g){if(a&&(u==="underline"||u==="strikethrough")){e&g&&s.remove(...o);continue}e&g&&(!l||u!=="underline")&&u!=="strikethrough"||s.add(...o)}else e&g&&s.remove(...o)}}function bh(n,e,t){const r=e.firstChild,i=t.isComposing(),s=n+(i?ma:"");if(r==null)e.textContent=s;else{const o=r.nodeValue;if(o!==s)if(i||Kr){const[a,l,u]=function(g,d){const f=g.length,m=d.length;let y=0,b=0;for(;y<f&&y<m&&g[y]===d[y];)y++;for(;b+y<f&&b+y<m&&g[f-b-1]===d[m-b-1];)b++;return[y,f-y-b,d.slice(y,m-b)]}(o,s);l!==0&&r.deleteData(a,l),r.insertData(a,u)}else r.nodeValue=s}}function wh(n,e,t,r,i,s){bh(i,n,e);const o=s.theme.text;o!==void 0&&_h(0,0,r,n,o)}function Ra(n,e){const t=document.createElement(e);return t.appendChild(n),t}class Ni extends Ia{static getType(){return"text"}static clone(e){return new Ni(e.__text,e.__key)}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return a0[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Xr()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Rr[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Sc(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,i=Vc(0,r),s=qc(0,r),o=i===null?s:i,a=document.createElement(o);let l=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),i!==null&&(l=document.createElement(s),a.appendChild(l)),wh(l,this,0,r,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,t,r){const i=this.__text,s=e.__format,o=this.__format,a=Vc(0,s),l=Vc(0,o),u=qc(0,s),g=qc(0,o);if((a===null?u:a)!==(l===null?g:l))return!0;if(a===l&&u!==g){const b=t.firstChild;b==null&&Me(48);const C=document.createElement(g);return wh(C,this,0,o,i,r),t.replaceChild(C,b),!1}let d=t;l!==null&&a!==null&&(d=t.firstChild,d==null&&Me(49)),bh(i,d,this);const f=r.theme.text;f!==void 0&&s!==o&&_h(0,s,o,d,f);const m=e.__style,y=this.__style;return m!==y&&(t.style.cssText=y),!1}static importDOM(){return{"#text":()=>({conversion:L0,priority:0}),b:()=>({conversion:I0,priority:0}),code:()=>({conversion:Zr,priority:0}),em:()=>({conversion:Zr,priority:0}),i:()=>({conversion:Zr,priority:0}),s:()=>({conversion:Zr,priority:0}),span:()=>({conversion:A0,priority:0}),strong:()=>({conversion:Zr,priority:0}),sub:()=>({conversion:Zr,priority:0}),sup:()=>({conversion:Zr,priority:0}),u:()=>({conversion:Zr,priority:0})}}static importJSON(e){const t=Bt(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&no(t)||Me(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Ra(t,"b")),this.hasFormat("italic")&&(t=Ra(t,"i")),this.hasFormat("strikethrough")&&(t=Ra(t,"s")),this.hasFormat("underline")&&(t=Ra(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Rr[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?i0[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Sc(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=o0[e];if(this.__mode===t)return this;const r=this.getWritable();return r.__mode=t,r}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){Sn();let r=e,i=t;const s=he(),o=this.getTextContent(),a=this.__key;if(typeof o=="string"){const l=o.length;r===void 0&&(r=l),i===void 0&&(i=l)}else r=0,i=0;if(!de(s))return Dh(a,r,a,i,"text","text");{const l=Xr();l!==s.anchor.key&&l!==s.focus.key||nn(a),s.setTextNodeRange(this,r,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,i){const s=this.getWritable(),o=s.__text,a=r.length;let l=e;l<0&&(l=a+l,l<0&&(l=0));const u=he();if(i&&de(u)){const d=e+a;u.setTextNodeRange(s,d,s,d)}const g=o.slice(0,l)+r+o.slice(l+t);return s.__text=g,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Sn();const t=this.getLatest(),r=t.getTextContent(),i=t.__key,s=Xr(),o=new Set(e),a=[],l=r.length;let u="";for(let h=0;h<l;h++)u!==""&&o.has(h)&&(a.push(u),u=""),u+=r[h];u!==""&&a.push(u);const g=a.length;if(g===0)return[];if(a[0]===r)return[t];const d=a[0],f=t.getParentOrThrow();let m;const y=t.getFormat(),b=t.getStyle(),C=t.__detail;let S=!1;t.isSegmented()?(m=Bt(d),m.__format=y,m.__style=b,m.__detail=C,S=!0):(m=t.getWritable(),m.__text=d);const A=he(),v=[m];let k=d.length;for(let h=1;h<g;h++){const I=a[h],O=I.length,j=Bt(I).getWritable();j.__format=y,j.__style=b,j.__detail=C;const P=j.__key,q=k+O;if(de(A)){const G=A.anchor,ee=A.focus;G.key===i&&G.type==="text"&&G.offset>k&&G.offset<=q&&(G.key=P,G.offset-=k,A.dirty=!0),ee.key===i&&ee.type==="text"&&ee.offset>k&&ee.offset<=q&&(ee.key=P,ee.offset-=k,A.dirty=!0)}s===i&&nn(P),k=q,v.push(j)}(function(h){const I=h.getPreviousSibling(),O=h.getNextSibling();I!==null&&ba(I),O!==null&&ba(O)})(this);const T=f.getWritable(),N=this.getIndexWithinParent();return S?(T.splice(N,0,v),this.remove()):T.splice(N,1,v),de(A)&&Pa(A,f,N,g-1),v}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||Me(50);const r=this.__key,i=e.__key,s=this.__text,o=s.length;Xr()===i&&nn(r);const a=he();if(de(a)){const d=a.anchor,f=a.focus;d!==null&&d.key===i&&(Ih(d,t,r,e,o),a.dirty=!0),f!==null&&f.key===i&&(Ih(f,t,r,e,o),a.dirty=!0)}const l=e.__text,u=t?l+s:s+l;this.setTextContent(u);const g=this.getWritable();return e.remove(),g}isTextEntity(){return!1}}function A0(n){return{forChild:Kc(n.style),node:null}}function I0(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:Kc(e.style,t?void 0:"bold"),node:null}}const vh=new WeakMap;function R0(n){return n.nodeName==="PRE"||n.nodeType===Gs&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function L0(n){const e=n;n.parentElement===null&&Me(129);let t=e.textContent||"";if(function(r){let i,s=r.parentNode;const o=[r];for(;s!==null&&(i=vh.get(s))===void 0&&!R0(s);)o.push(s),s=s.parentNode;const a=i===void 0?s:i;for(let l=0;l<o.length;l++)vh.set(o[l],a);return a}(e)!==null){const r=t.split(/(\r?\n|\t)/),i=[],s=r.length;for(let o=0;o<s;o++){const a=r[o];a===`
35
35
  `||a===`\r
36
- `?i.push(as()):a===" "?i.push(fo()):a!==""&&i.push(Bt(a))}return{node:i}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let r=e,i=!0;for(;r!==null&&(r=xh(r,!1))!==null;){const s=r.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(t=t.slice(1)),i=!1;break}}i&&(t=t.slice(1))}if(t[t.length-1]===" "){let r=e,i=!0;for(;r!==null&&(r=xh(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){i=!1;break}i&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Bt(t)}}function xh(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=r,t.nodeType===Gs){const s=t.style.display;if(s===""&&!S0(t)||s!==""&&!s.startsWith("inline"))return null}let i=t;for(;(i=e?t.firstChild:t.lastChild)!==null;)t=i;if(t.nodeType===Gr)return t;if(t.nodeName==="BR")return null}}const O0={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Zr(n){const e=O0[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Kc(n.style,e),node:null}}function Bt(n=""){return dr(new Ni(n))}function me(n){return n instanceof Ni}function Kc(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),i=t==="700"||t==="bold",s=r.includes("line-through"),o=n.fontStyle==="italic",a=r.includes("underline"),l=n.verticalAlign;return u=>(me(u)&&(i&&!u.hasFormat("bold")&&u.toggleFormat("bold"),s&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),o&&!u.hasFormat("italic")&&u.toggleFormat("italic"),a&&!u.hasFormat("underline")&&u.toggleFormat("underline"),l!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),l!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class uo extends Ni{static getType(){return"tab"}static clone(e){const t=new uo(e.__key);return t.__text=e.__text,t.__format=e.__format,t.__style=e.__style,t}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=fo();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){De(126)}setDetail(e){De(127)}setMode(e){De(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function fo(){return dr(new uo)}function j0(n){return n instanceof uo}class P0{constructor(e,t,r){this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),r=e.getNode();const i=this.offset,s=e.offset;if(ie(t)){const o=t.getDescendantByIndex(i);t=o??t}if(ie(r)){const o=r.getDescendantByIndex(s);r=o??r}return t===r?i<s:t.isBefore(r)}getNode(){const e=tt(this.key);return e===null&&De(20),e}set(e,t,r){const i=this._selection,s=this.key;this.key=e,this.offset=t,this.type=r,ls()||(Xr()===s&&nn(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0))}}function Wn(n,e,t){return new P0(n,e,t)}function Gc(n,e){let t=e.__key,r=n.offset,i="element";if(me(e)){i="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!ie(e)){const s=e.getNextSibling();if(me(s))t=s.__key,r=0,i="text";else{const o=e.getParent();o&&(t=o.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,i)}function Ch(n,e){if(ie(e)){const t=e.getLastDescendant();ie(t)||me(t)?Gc(n,t):Gc(n,e)}else Gc(n,e)}function Qr(n,e,t,r){n.key=e,n.offset=t,n.type=r}class La{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Dt(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(i=>r.has(i))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new La(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),r=t.length,i=t[r-1];let s;if(me(i))s=i.select();else{const o=i.getIndexWithinParent()+1;s=i.getParentOrThrow().select(o,o)}s.insertNodes(e);for(let o=0;o<r;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const i of t){const s=tt(i);s!==null&&r.push(s)}return ls()||(this._cachedNodes=r),r}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}}function he(n){return n instanceof ei}class ei{constructor(e,t,r,i){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=r,this.style=i,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!he(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,r=this.focus,i=t.isBefore(r),s=i?t:r,o=i?r:t;let a=s.getNode(),l=o.getNode();const u=s.offset,g=o.offset;if(ie(a)){const f=a.getDescendantByIndex(u);a=f??a}if(ie(l)){let f=l.getDescendantByIndex(g);f!==null&&f!==a&&l.getChildAtIndex(g)===f&&(f=f.getPreviousSibling()),l=f??l}let d;return d=a.is(l)?ie(a)&&a.getChildrenSize()>0?[]:[a]:a.getNodesBetween(l),ls()||(this._cachedNodes=d),d}setTextNodeRange(e,t,r,i){Qr(this.anchor,e.__key,t,"text"),Qr(this.focus,r.__key,i,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],i=this.anchor,s=this.focus,o=i.isBefore(s),[a,l]=Xc(this);let u="",g=!0;for(let d=0;d<e.length;d++){const f=e[d];if(ie(f)&&!f.isInline())g||(u+=`
36
+ `?i.push(as()):a===" "?i.push(fo()):a!==""&&i.push(Bt(a))}return{node:i}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let r=e,i=!0;for(;r!==null&&(r=xh(r,!1))!==null;){const s=r.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(t=t.slice(1)),i=!1;break}}i&&(t=t.slice(1))}if(t[t.length-1]===" "){let r=e,i=!0;for(;r!==null&&(r=xh(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){i=!1;break}i&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Bt(t)}}function xh(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=r,t.nodeType===Gs){const s=t.style.display;if(s===""&&!S0(t)||s!==""&&!s.startsWith("inline"))return null}let i=t;for(;(i=e?t.firstChild:t.lastChild)!==null;)t=i;if(t.nodeType===Gr)return t;if(t.nodeName==="BR")return null}}const O0={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Zr(n){const e=O0[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Kc(n.style,e),node:null}}function Bt(n=""){return dr(new Ni(n))}function me(n){return n instanceof Ni}function Kc(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),i=t==="700"||t==="bold",s=r.includes("line-through"),o=n.fontStyle==="italic",a=r.includes("underline"),l=n.verticalAlign;return u=>(me(u)&&(i&&!u.hasFormat("bold")&&u.toggleFormat("bold"),s&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),o&&!u.hasFormat("italic")&&u.toggleFormat("italic"),a&&!u.hasFormat("underline")&&u.toggleFormat("underline"),l!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),l!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class uo extends Ni{static getType(){return"tab"}static clone(e){const t=new uo(e.__key);return t.__text=e.__text,t.__format=e.__format,t.__style=e.__style,t}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=fo();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){Me(126)}setDetail(e){Me(127)}setMode(e){Me(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function fo(){return dr(new uo)}function j0(n){return n instanceof uo}class P0{constructor(e,t,r){this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),r=e.getNode();const i=this.offset,s=e.offset;if(ie(t)){const o=t.getDescendantByIndex(i);t=o??t}if(ie(r)){const o=r.getDescendantByIndex(s);r=o??r}return t===r?i<s:t.isBefore(r)}getNode(){const e=tt(this.key);return e===null&&Me(20),e}set(e,t,r){const i=this._selection,s=this.key;this.key=e,this.offset=t,this.type=r,ls()||(Xr()===s&&nn(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0))}}function Wn(n,e,t){return new P0(n,e,t)}function Gc(n,e){let t=e.__key,r=n.offset,i="element";if(me(e)){i="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!ie(e)){const s=e.getNextSibling();if(me(s))t=s.__key,r=0,i="text";else{const o=e.getParent();o&&(t=o.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,i)}function Ch(n,e){if(ie(e)){const t=e.getLastDescendant();ie(t)||me(t)?Gc(n,t):Gc(n,e)}else Gc(n,e)}function Qr(n,e,t,r){n.key=e,n.offset=t,n.type=r}class La{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Dt(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(i=>r.has(i))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new La(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),r=t.length,i=t[r-1];let s;if(me(i))s=i.select();else{const o=i.getIndexWithinParent()+1;s=i.getParentOrThrow().select(o,o)}s.insertNodes(e);for(let o=0;o<r;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const i of t){const s=tt(i);s!==null&&r.push(s)}return ls()||(this._cachedNodes=r),r}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}}function de(n){return n instanceof ei}class ei{constructor(e,t,r,i){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=r,this.style=i,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!de(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,r=this.focus,i=t.isBefore(r),s=i?t:r,o=i?r:t;let a=s.getNode(),l=o.getNode();const u=s.offset,g=o.offset;if(ie(a)){const f=a.getDescendantByIndex(u);a=f??a}if(ie(l)){let f=l.getDescendantByIndex(g);f!==null&&f!==a&&l.getChildAtIndex(g)===f&&(f=f.getPreviousSibling()),l=f??l}let d;return d=a.is(l)?ie(a)&&a.getChildrenSize()>0?[]:[a]:a.getNodesBetween(l),ls()||(this._cachedNodes=d),d}setTextNodeRange(e,t,r,i){Qr(this.anchor,e.__key,t,"text"),Qr(this.focus,r.__key,i,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],i=this.anchor,s=this.focus,o=i.isBefore(s),[a,l]=Xc(this);let u="",g=!0;for(let d=0;d<e.length;d++){const f=e[d];if(ie(f)&&!f.isInline())g||(u+=`
37
37
  `),g=!f.isEmpty();else if(g=!1,me(f)){let m=f.getTextContent();f===t?f===r?i.type==="element"&&s.type==="element"&&s.offset!==i.offset||(m=a<l?m.slice(a,l):m.slice(l,a)):m=o?m.slice(a):m.slice(l):f===r&&(m=o?m.slice(0,l):m.slice(0,a)),u+=m}else!gt(f)&&!hr(f)||f===r&&this.isCollapsed()||(u+=f.getTextContent())}return u}applyDOMRange(e){const t=Ut(),r=t.getEditorState()._selection,i=Mh(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(i===null)return;const[s,o]=i;Qr(this.anchor,s.key,s.offset,s.type),Qr(this.focus,o.key,o.offset,o.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new ei(Wn(e.key,e.offset,e.type),Wn(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Sc(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Rr[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),r=[],i=t.length;for(let s=0;s<i;s++){const o=t[s];o===`
38
38
  `||o===`\r
39
- `?r.push(as()):o===" "?r.push(fo()):r.push(Bt(o))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,i=this.format,s=this.style;let o=t,a=r;!this.isCollapsed()&&r.isBefore(t)&&(o=r,a=t),o.type==="element"&&function(C,S,A,v){const k=C.getNode(),T=k.getChildAtIndex(C.offset),N=Bt(),h=dn(k)?_t().append(N):N;N.setFormat(A),N.setStyle(v),T===null?k.append(h):T.insertBefore(h),C.is(S)&&S.set(N.__key,0,"text"),C.set(N.__key,0,"text")}(o,a,i,s);const l=o.offset;let u=a.offset;const g=this.getNodes(),d=g.length;let f=g[0];me(f)||De(26);const m=f.getTextContent().length,y=f.getParentOrThrow();let b=g[d-1];if(d===1&&a.type==="element"&&(u=m,a.set(o.key,u,"text")),this.isCollapsed()&&l===m&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!y.canInsertTextAfter()&&f.getNextSibling()===null)){let C=f.getNextSibling();if(me(C)&&C.canInsertTextBefore()&&!ns(C)||(C=Bt(),C.setFormat(i),C.setStyle(s),y.canInsertTextAfter()?f.insertAfter(C):y.insertAfter(C)),C.select(0,0),f=C,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!y.canInsertTextBefore()&&f.getPreviousSibling()===null)){let C=f.getPreviousSibling();if(me(C)&&!ns(C)||(C=Bt(),C.setFormat(i),y.canInsertTextBefore()?f.insertBefore(C):y.insertBefore(C)),C.select(),f=C,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&l!==m){const C=Bt(f.getTextContent());C.setFormat(i),f.replace(C),f=C}else if(!this.isCollapsed()&&e!==""){const C=b.getParent();if(!y.canInsertTextBefore()||!y.canInsertTextAfter()||ie(C)&&(!C.canInsertTextBefore()||!C.canInsertTextAfter()))return this.insertText(""),Nh(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const v=Bt(e);return v.select(),void f.replace(v)}const C=f.getFormat(),S=f.getStyle();if(l!==u||C===i&&S===s){if(j0(f)){const v=Bt(e);return v.setFormat(i),v.setStyle(s),v.select(),void f.replace(v)}}else{if(f.getTextContent()!==""){const v=Bt(e);if(v.setFormat(i),v.setStyle(s),v.select(),l===0)f.insertBefore(v,!1);else{const[k]=f.splitText(l);k.insertAfter(v,!1)}return void(v.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(i),f.setStyle(s)}const A=u-l;f=f.spliceText(l,A,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=C,this.style=S))}else{const C=new Set([...f.getParentKeys(),...b.getParentKeys()]),S=ie(f)?f:f.getParentOrThrow();let A=ie(b)?b:b.getParentOrThrow(),v=b;if(!S.is(A)&&A.isInline())do v=A,A=A.getParentOrThrow();while(A.isInline());if(a.type==="text"&&(u!==0||b.getTextContent()==="")||a.type==="element"&&b.getIndexWithinParent()<u)if(me(b)&&!b.isToken()&&u!==b.getTextContentSize()){if(b.isSegmented()){const I=Bt(b.getTextContent());b.replace(I),b=I}dn(a.getNode())||a.type!=="text"||(b=b.spliceText(0,u,"")),C.add(b.__key)}else{const I=b.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?b.remove():I.remove()}else C.add(b.__key);const k=A.getChildren(),T=new Set(g),N=S.is(A),h=S.isInline()&&f.getNextSibling()===null?S:f;for(let I=k.length-1;I>=0;I--){const O=k[I];if(O.is(f)||ie(O)&&O.isParentOf(f))break;O.isAttached()&&(!T.has(O)||O.is(v)?N||h.insertAfter(O,!1):O.remove())}if(!N){let I=A,O=null;for(;I!==null;){const j=I.getChildren(),P=j.length;(P===0||j[P-1].is(O))&&(C.delete(I.__key),O=I),I=I.getParent()}}if(f.isToken())if(l===m)f.select();else{const I=Bt(e);I.select(),f.replace(I)}else f=f.spliceText(l,m-l,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let I=1;I<d;I++){const O=g[I],j=O.__key;C.has(j)||O.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void nn(null);const t=this.getNodes(),r=[];for(const A of t)me(A)&&r.push(A);const i=r.length;if(i===0)return this.toggleFormat(e),void nn(null);const s=this.anchor,o=this.focus,a=this.isBackward(),l=a?o:s,u=a?s:o;let g=0,d=r[0],f=l.type==="element"?0:l.offset;if(l.type==="text"&&f===d.getTextContentSize()&&(g=1,d=r[1],f=0),d==null)return;const m=d.getFormatFlags(e,null),y=i-1;let b=r[y];const C=u.type==="text"?u.offset:b.getTextContentSize();if(d.is(b)){if(f===C)return;if(ns(d)||f===0&&C===d.getTextContentSize())d.setFormat(m);else{const A=d.splitText(f,C),v=f===0?A[0]:A[1];v.setFormat(m),l.type==="text"&&l.set(v.__key,0,"text"),u.type==="text"&&u.set(v.__key,C-f,"text")}return void(this.format=m)}f===0||ns(d)||([,d]=d.splitText(f),f=0),d.setFormat(m);const S=b.getFormatFlags(e,m);C>0&&(C===b.getTextContentSize()||ns(b)||([b]=b.splitText(C)),b.setFormat(S));for(let A=g+1;A<y;A++){const v=r[A],k=v.getFormatFlags(e,S);v.setFormat(k)}l.type==="text"&&l.set(d.__key,f,"text"),u.type==="text"&&u.set(b.__key,C,"text"),this.format=m|S}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const y=ge();return he(y)||De(134),y.insertNodes(e)}const t=Ic((this.isBackward()?this.focus:this.anchor).getNode(),is),r=e[e.length-1];if("__language"in t&&ie(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const y=Qc(this);t.splice(y,0,e),r.selectEnd()}return}if(!e.some(y=>(ie(y)||gt(y))&&!y.isInline())){ie(t)||De(135);const y=Qc(this);return t.splice(y,0,e),void r.selectEnd()}const i=function(y){const b=_t();let C=null;for(let S=0;S<y.length;S++){const A=y[S],v=hr(A);if(v||gt(A)&&A.isInline()||ie(A)&&A.isInline()||me(A)||A.isParentRequired()){if(C===null&&(C=A.createParentElementNode(),b.append(C),v))continue;C!==null&&C.append(A)}else b.append(A),C=null}return b}(e),s=i.getLastDescendant(),o=i.getChildren(),a=y=>"__value"in y&&"__checked"in y,l=!ie(t)||!t.isEmpty()?this.insertParagraph():null,u=o[o.length-1];let g=o[0];var d;ie(d=g)&&is(d)&&!d.isEmpty()&&ie(t)&&(!t.isEmpty()||a(t))&&(ie(t)||De(135),t.append(...g.getChildren()),g=o[1]),g&&function(y,b,C){const S=b.getParentOrThrow().getLastChild();let A=b;const v=[b];for(;A!==S;)A.getNextSibling()||De(140),A=A.getNextSibling(),v.push(A);let k=y;for(const T of v)k=k.insertAfter(T)}(t,g);const f=Ic(s,is);l&&ie(f)&&(a(l)||is(u))&&(f.append(...l.getChildren()),l.remove()),ie(t)&&t.isEmpty()&&t.remove(),s.selectEnd();const m=ie(t)?t.getLastChild():null;hr(m)&&f!==t&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=_t();return dt().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Qc(this),t=Ic(this.anchor.getNode(),is);ie(t)||De(136);const r=t.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const t=as();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),i=t.getIndexWithinParent();r.select(i,i)}}extract(){const e=this.getNodes(),t=e.length,r=t-1,i=this.anchor,s=this.focus;let o=e[0],a=e[r];const[l,u]=Xc(this);if(t===0)return[];if(t===1){if(me(o)&&!this.isCollapsed()){const d=l>u?u:l,f=l>u?l:u,m=o.splitText(d,f),y=d===0?m[0]:m[1];return y!=null?[y]:[]}return[o]}const g=i.isBefore(s);if(me(o)){const d=g?l:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(me(a)){const d=a.getTextContent().length,f=g?u:l;f===0?e.pop():f!==d&&([a]=a.splitText(f),e[r]=a)}return e}modify(e,t,r){const i=this.focus,s=this.anchor,o=e==="move",a=to(i,t);if(gt(a)&&!a.isIsolated()){if(o&&a.isKeyboardSelectable()){const m=Zc();return m.add(a.__key),void Nt(m)}const f=t?a.getPreviousSibling():a.getNextSibling();if(me(f)){const m=f.__key,y=t?f.getTextContent().length:0;return i.set(m,y,"text"),void(o&&s.set(m,y,"text"))}{const m=a.getParentOrThrow();let y,b;return ie(f)?(b=f.__key,y=t?f.getChildrenSize():0):(y=a.getIndexWithinParent(),b=m.__key,t||y++),i.set(b,y,"element"),void(o&&s.set(b,y,"element"))}}const l=Ut(),u=fr(l._window);if(!u)return;const g=l._blockCursorElement,d=l._rootElement;if(d===null||g===null||!ie(a)||a.isInline()||a.canBeEmpty()||Ac(g,l,d),function(f,m,y,b){f.modify(m,y,b)}(u,e,t?"backward":"forward",r),u.rangeCount>0){const f=u.getRangeAt(0),m=this.anchor.getNode(),y=dn(m)?m:w0(m);if(this.applyDOMRange(f),this.dirty=!0,!o){const b=this.getNodes(),C=[];let S=!1;for(let A=0;A<b.length;A++){const v=b[A];Ca(v,y)?C.push(v):S=!0}if(S&&C.length>0)if(t){const A=C[0];ie(A)?A.selectStart():A.getParentOrThrow().selectStart()}else{const A=C[C.length-1];ie(A)?A.selectEnd():A.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(A){const v=A.focus,k=A.anchor,T=k.key,N=k.offset,h=k.type;Qr(k,v.key,v.offset,v.type),Qr(v,T,N,h),A._cachedNodes=null}(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&ie(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const i=t.getParent(),s=t.getNextSibling()||(i===null?null:i.getNextSibling());if(ie(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let i=r.getNode();if(this.forwardDeletion(r,i,e))return;const s=this.focus,o=to(s,e);if(gt(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&ie(i)&&i.getChildrenSize()===0){i.remove();const a=Zc();a.add(o.__key),Nt(a)}else o.remove(),Ut().dispatchCommand(Hn,void 0);return}if(!e&&ie(o)&&ie(i)&&i.isEmpty())return i.remove(),void o.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&(r.type==="element"?r.getNode():r.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const a=s.type==="text"?s.getNode():null;if(i=r.type==="text"?r.getNode():null,a!==null&&a.isSegmented()){const l=s.offset,u=a.getTextContentSize();if(a.is(i)||e&&l!==u||!e&&l!==0)return void Th(a,e,l)}else if(i!==null&&i.isSegmented()){const l=r.offset,u=i.getTextContentSize();if(i.is(a)||e&&l!==0||!e&&l!==u)return void Th(i,e,l)}(function(l,u){const g=l.anchor,d=l.focus,f=g.getNode(),m=d.getNode();if(f===m&&g.type==="text"&&d.type==="text"){const y=g.offset,b=d.offset,C=y<b,S=C?y:b,A=C?b:y,v=A-1;S!==v&&(Wf(f.getTextContent().slice(S,A))||(u?d.offset=v:g.offset=v))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&dn(r.getParent())&&r.getIndexWithinParent()===0&&r.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){const r=e?this.anchor:this.focus;r.set(r.key,r.offset+1,r.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Dt(n){return n instanceof La}function Sh(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function Xc(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[Sh(t),Sh(r)]}function Th(n,e,t){const r=n,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,a=0;for(let u=0;u<s;u++){const g=u===s-1;if(a=o,o+=i[u].length,e&&o===t||o>t||g){i.splice(u,1),g&&(a=void 0);break}}const l=i.join("").trim();l===""?r.remove():(r.setTextContent(l),r.select(a,a))}function Eh(n,e,t,r){let i,s=e;if(n.nodeType===Gs){let o=!1;const a=n.childNodes,l=a.length,u=r._blockCursorElement;s===l&&(o=!0,s=l-1);let g=a[s],d=!1;if(g===u)g=a[s+1],d=!0;else if(u!==null){const f=u.parentNode;n===f&&e>Array.prototype.indexOf.call(f.children,u)&&s--}if(i=rs(g),me(i))s=Hf(i,o);else{let f=rs(n);if(f===null)return null;if(ie(f)){s=Math.min(f.getChildrenSize(),s);let m=f.getChildAtIndex(s);if(ie(m)&&function(y,b,C){const S=y.getParent();return C===null||S===null||!S.canBeEmpty()||S!==C.getNode()}(m,0,t)){const y=o?m.getLastDescendant():m.getFirstDescendant();y===null?f=m:(m=y,f=ie(m)?m:m.getParentOrThrow()),s=0}me(m)?(i=m,f=null,s=Hf(m,o)):m!==f&&o&&!d&&s++}else{const m=f.getIndexWithinParent();s=e===0&&gt(f)&&rs(n)===f?m:m+1,f=f.getParentOrThrow()}if(ie(f))return Wn(f.__key,s,"element")}}else i=rs(n);return me(i)?Wn(i.__key,s,"text"):null}function kh(n,e,t){const r=n.offset,i=n.getNode();if(r===0){const s=i.getPreviousSibling(),o=i.getParent();if(e){if((t||!e)&&s===null&&ie(o)&&o.isInline()){const a=o.getPreviousSibling();me(a)&&(n.key=a.__key,n.offset=a.getTextContent().length)}}else ie(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):me(s)&&(n.key=s.__key,n.offset=s.getTextContent().length)}else if(r===i.getTextContent().length){const s=i.getNextSibling(),o=i.getParent();if(e&&ie(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&ie(o)&&o.isInline()&&!o.canInsertTextAfter()){const a=o.getNextSibling();me(a)&&(n.key=a.__key,n.offset=0)}}}function Nh(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),i=n.is(e);kh(n,r,i),kh(e,!r,i),i&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=Ut();if(s.isComposing()&&s._compositionKey!==n.key&&he(t)){const o=t.anchor,a=t.focus;Qr(n,o.key,o.offset,o.type),Qr(e,a.key,a.offset,a.type)}}}function Mh(n,e,t,r,i,s){if(n===null||t===null||!Xs(i,n,t))return null;const o=Eh(n,e,he(s)?s.anchor:null,i);if(o===null)return null;const a=Eh(t,r,he(s)?s.focus:null,i);if(a===null)return null;if(o.type==="element"&&a.type==="element"){const l=rs(n),u=rs(t);if(gt(l)&&gt(u))return null}return Nh(o,a,s),[o,a]}function Jc(n){return ie(n)&&!n.isInline()}function Dh(n,e,t,r,i,s){const o=gr(),a=new ei(Wn(n,e,i),Wn(t,r,s),0,"");return a.dirty=!0,o._selection=a,a}function Oa(){const n=Wn("root",0,"element"),e=Wn("root",0,"element");return new ei(n,e,0,"")}function Zc(){return new La(new Set)}function F0(n,e){return ja(null,n,e,null)}function ja(n,e,t,r){const i=t._window;if(i===null)return null;const s=r||i.event,o=s?s.type:void 0,a=o==="selectionchange",l=!bc&&(a||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&s&&s.detail===3||o==="drop"||o===void 0);let u,g,d,f;if(he(n)&&!l)return n.clone();if(e===null)return null;if(u=e.anchorNode,g=e.focusNode,d=e.anchorOffset,f=e.focusOffset,a&&he(n)&&!Xs(t,u,g))return n.clone();const m=Mh(u,d,g,f,t,n);if(m===null)return null;const[y,b]=m;return new ei(y,b,he(n)?n.format:0,he(n)?n.style:"")}function ge(){return gr()._selection}function ti(){return Ut()._editorState._selection}function Pa(n,e,t,r=1){const i=n.anchor,s=n.focus,o=i.getNode(),a=s.getNode();if(!e.is(o)&&!e.is(a))return;const l=e.__key;if(n.isCollapsed()){const u=i.offset;if(t<=u&&r>0||t<u&&r<0){const g=Math.max(0,u+r);i.set(l,g,"element"),s.set(l,g,"element"),Ah(n)}}else{const u=n.isBackward(),g=u?s:i,d=g.getNode(),f=u?i:s,m=f.getNode();if(e.is(d)){const y=g.offset;(t<=y&&r>0||t<y&&r<0)&&g.set(l,Math.max(0,y+r),"element")}if(e.is(m)){const y=f.offset;(t<=y&&r>0||t<y&&r<0)&&f.set(l,Math.max(0,y+r),"element")}}Ah(n)}function Ah(n){const e=n.anchor,t=e.offset,r=n.focus,i=r.offset,s=e.getNode(),o=r.getNode();if(n.isCollapsed()){if(!ie(s))return;const a=s.getChildrenSize(),l=t>=a,u=l?s.getChildAtIndex(a-1):s.getChildAtIndex(t);if(me(u)){let g=0;l&&(g=u.getTextContentSize()),e.set(u.__key,g,"text"),r.set(u.__key,g,"text")}}else{if(ie(s)){const a=s.getChildrenSize(),l=t>=a,u=l?s.getChildAtIndex(a-1):s.getChildAtIndex(t);if(me(u)){let g=0;l&&(g=u.getTextContentSize()),e.set(u.__key,g,"text")}}if(ie(o)){const a=o.getChildrenSize(),l=i>=a,u=l?o.getChildAtIndex(a-1):o.getChildAtIndex(i);if(me(u)){let g=0;l&&(g=u.getTextContentSize()),r.set(u.__key,g,"text")}}}}function Fa(n,e,t,r,i){let s=null,o=0,a=null;r!==null?(s=r.__key,me(r)?(o=r.getTextContentSize(),a="text"):ie(r)&&(o=r.getChildrenSize(),a="element")):i!==null&&(s=i.__key,me(i)?a="text":ie(i)&&(a="element")),s!==null&&a!==null?n.set(s,o,a):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),n.set(t.__key,o,"element"))}function Ih(n,e,t,r,i){n.type==="text"?(n.key=t,e||(n.offset+=i)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function z0(n,e,t,r,i,s,o){const a=r.anchorNode,l=r.focusNode,u=r.anchorOffset,g=r.focusOffset,d=document.activeElement;if(i.has("collaboration")&&d!==s||d!==null&&Cc(d))return;if(!he(e))return void(n!==null&&Xs(t,a,l)&&r.removeAllRanges());const f=e.anchor,m=e.focus,y=f.key,b=m.key,C=va(t,y),S=va(t,b),A=f.offset,v=m.offset,k=e.format,T=e.style,N=e.isCollapsed();let h=C,I=S,O=!1;if(f.type==="text"){h=_a(C);const oe=f.getNode();O=oe.getFormat()!==k||oe.getStyle()!==T}else he(n)&&n.anchor.type==="text"&&(O=!0);var j,P,q,G,ne;if(m.type==="text"&&(I=_a(S)),h!==null&&I!==null&&(N&&(n===null||O||he(n)&&(n.format!==k||n.style!==T))&&(j=k,P=T,q=A,G=y,ne=performance.now(),lh=[j,P,q,G,ne]),u!==A||g!==v||a!==h||l!==I||r.type==="Range"&&N||(d!==null&&s.contains(d)||s.focus({preventScroll:!0}),f.type==="element"))){try{r.setBaseAndExtent(h,A,I,v)}catch{}if(!i.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const oe=e instanceof ei&&e.anchor.type==="element"?h.childNodes[A]||null:r.rangeCount>0?r.getRangeAt(0):null;if(oe!==null){let ue;if(oe instanceof Text){const fe=document.createRange();fe.selectNode(oe),ue=fe.getBoundingClientRect()}else ue=oe.getBoundingClientRect();(function(fe,Ee,be){const ae=be.ownerDocument,de=ae.defaultView;if(de===null)return;let{top:xe,bottom:Te}=Ee,ve=0,Fe=0,Ae=be;for(;Ae!==null;){const Ne=Ae===ae.body;if(Ne)ve=0,Fe=Sa(fe).innerHeight;else{const Ce=Ae.getBoundingClientRect();ve=Ce.top,Fe=Ce.bottom}let ze=0;if(xe<ve?ze=-(ve-xe):Te>Fe&&(ze=Te-Fe),ze!==0)if(Ne)de.scrollBy(0,ze);else{const Ce=Ae.scrollTop;Ae.scrollTop+=ze;const Pe=Ae.scrollTop-Ce;xe-=Pe,Te-=Pe}if(Ne)break;Ae=xa(Ae)}})(t,ue,s)}}Hc=!0}}function za(n){let e=ge()||ti();e===null&&(e=dt().selectEnd()),e.insertNodes(n)}function Qc(n){let e=n;n.isCollapsed()||e.removeText();const t=ge();he(t)&&(e=t),he(e)||De(161);const r=e.anchor;let i=r.getNode(),s=r.offset;for(;!is(i);)[i,s]=B0(i,s);return s}function B0(n,e){const t=n.getParent();if(!t){const i=_t();return dt().append(i),i.select(),[dt(),0]}if(me(n)){const i=n.splitText(e);if(i.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,i[0].getIndexWithinParent()+s]}if(!ie(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const i=new ei(Wn(n.__key,e,"element"),Wn(n.__key,e,"element"),0,""),s=n.insertNewAfter(i);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let Zt=null,Qt=null,Cn=!1,eu=!1,Ba=0;const Rh={characterData:!0,childList:!0,subtree:!0};function ls(){return Cn||Zt!==null&&Zt._readOnly}function Sn(){Cn&&De(13)}function Lh(){Ba>99&&De(14)}function gr(){return Zt===null&&De(15),Zt}function Ut(){return Qt===null&&De(16),Qt}function U0(){return Qt}function Oh(n,e,t){const r=e.__type,i=function(a,l){const u=a._nodes.get(l);return u===void 0&&De(30,l),u}(n,r);let s=t.get(r);s===void 0&&(s=Array.from(i.transforms),t.set(r,s));const o=s.length;for(let a=0;a<o&&(s[a](e),e.isAttached());a++);}function jh(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function H0(n){return tu(n,Ut()._nodes)}function tu(n,e){const t=n.type,r=e.get(t);r===void 0&&De(17,t);const i=r.klass;n.type!==i.getType()&&De(18,i.name);const s=i.importJSON(n),o=n.children;if(ie(s)&&Array.isArray(o))for(let a=0;a<o.length;a++){const l=tu(o[a],e);s.append(l)}return s}function Ph(n,e){const t=Zt,r=Cn,i=Qt;Zt=n,Cn=!0,Qt=null;try{return e()}finally{Zt=t,Cn=r,Qt=i}}function Mi(n,e){const t=n._pendingEditorState,r=n._rootElement,i=n._headless||r===null;if(t===null)return;const s=n._editorState,o=s._selection,a=t._selection,l=n._dirtyType!==Si,u=Zt,g=Cn,d=Qt,f=n._updating,m=n._observer;let y=null;if(n._pendingEditorState=null,n._editorState=t,!i&&l&&m!==null){Qt=n,Zt=t,Cn=!1,n._updating=!0;try{const N=n._dirtyType,h=n._dirtyElements,I=n._dirtyLeaves;m.disconnect(),y=N0(s,t,n,N,h,I)}catch(N){if(N instanceof Error&&n._onError(N),eu)throw N;return Wh(n,null,r,t),Af(n),n._dirtyType=ts,eu=!0,Mi(n,s),void(eu=!1)}finally{m.observe(r,Rh),n._updating=f,Zt=u,Cn=g,Qt=d}}t._readOnly||(t._readOnly=!0);const b=n._dirtyLeaves,C=n._dirtyElements,S=n._normalizedNodes,A=n._updateTags,v=n._deferred;l&&(n._dirtyType=Si,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(N,h){const I=N._decorators;let O=N._pendingDecorators||I;const j=h._nodeMap;let P;for(P in O)j.has(P)||(O===I&&(O=zf(N)),delete O[P])}(n,t);const k=i?null:fr(n._window);if(n._editable&&k!==null&&(l||a===null||a.dirty)){Qt=n,Zt=t;try{if(m!==null&&m.disconnect(),l||a===null||a.dirty){const N=n._blockCursorElement;N!==null&&Ac(N,n,r),z0(o,a,n,k,A,r)}x0(n,r,a),m!==null&&m.observe(r,Rh)}finally{Qt=d,Zt=u}}y!==null&&function(N,h,I,O,j){const P=Array.from(N._listeners.mutation),q=P.length;for(let G=0;G<q;G++){const[ne,oe]=P[G],ue=h.get(oe);ue!==void 0&&ne(ue,{dirtyLeaves:O,prevEditorState:j,updateTags:I})}}(n,y,A,b,s),he(a)||a===null||o!==null&&o.is(a)||n.dispatchCommand(Hn,void 0);const T=n._pendingDecorators;T!==null&&(n._decorators=T,n._pendingDecorators=null,ho("decorator",n,!0,T)),function(N,h,I){const O=Bf(h),j=Bf(I);O!==j&&ho("textcontent",N,!0,j)}(n,e||s,t),ho("update",n,!0,{dirtyElements:C,dirtyLeaves:b,editorState:t,normalizedNodes:S,prevEditorState:e||s,tags:A}),function(N,h){if(N._deferred=[],h.length!==0){const I=N._updating;N._updating=!0;try{for(let O=0;O<h.length;O++)h[O]()}finally{N._updating=I}}}(n,v),function(N){const h=N._updates;if(h.length!==0){const I=h.shift();if(I){const[O,j]=I;Bh(N,O,j)}}}(n)}function ho(n,e,t,...r){const i=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let o=0;o<s.length;o++)s[o].apply(null,r)}finally{e._updating=i}}function Fh(n,e,t){if(n._updating===!1||Qt!==n){let i=!1;return n.update(()=>{i=Fh(n,e,t)}),i}const r=Tc(n);for(let i=4;i>=0;i--)for(let s=0;s<r.length;s++){const o=r[s]._commands.get(e);if(o!==void 0){const a=o[i];if(a!==void 0){const l=Array.from(a),u=l.length;for(let g=0;g<u;g++)if(l[g](t,n)===!0)return!0}}}return!1}function zh(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const i=t.shift();if(i){const[s,o]=i;let a,l;o!==void 0&&(a=o.onUpdate,l=o.tag,o.skipTransforms&&(r=!0),a&&n._deferred.push(a),l&&n._updateTags.add(l)),s()}}return r}function Bh(n,e,t){const r=n._updateTags;let i,s,o=!1,a=!1;t!==void 0&&(i=t.onUpdate,s=t.tag,s!=null&&r.add(s),o=t.skipTransforms||!1,a=t.discrete||!1),i&&n._deferred.push(i);const l=n._editorState;let u=n._pendingEditorState,g=!1;(u===null||u._readOnly)&&(u=n._pendingEditorState=new Ua(new Map((u||l)._nodeMap)),g=!0),u._flushSync=a;const d=Zt,f=Cn,m=Qt,y=n._updating;Zt=u,Cn=!1,n._updating=!0,Qt=n;try{g&&(n._headless?l._selection!==null&&(u._selection=l._selection.clone()):u._selection=function(A){const v=A.getEditorState()._selection,k=fr(A._window);return he(v)||v==null?ja(v,k,A,null):v.clone()}(n));const C=n._compositionKey;e(),o=zh(n,o),function(A,v){const k=v.getEditorState()._selection,T=A._selection;if(he(T)){const N=T.anchor,h=T.focus;let I;if(N.type==="text"&&(I=N.getNode(),I.selectionTransform(k,T)),h.type==="text"){const O=h.getNode();I!==O&&O.selectionTransform(k,T)}}}(u,n),n._dirtyType!==Si&&(o?function(A,v){const k=v._dirtyLeaves,T=A._nodeMap;for(const N of k){const h=T.get(N);me(h)&&h.isAttached()&&h.isSimpleText()&&!h.isUnmergeable()&&Lf(h)}}(u,n):function(A,v){const k=v._dirtyLeaves,T=v._dirtyElements,N=A._nodeMap,h=Xr(),I=new Map;let O=k,j=O.size,P=T,q=P.size;for(;j>0||q>0;){if(j>0){v._dirtyLeaves=new Set;for(const G of O){const ne=N.get(G);me(ne)&&ne.isAttached()&&ne.isSimpleText()&&!ne.isUnmergeable()&&Lf(ne),ne!==void 0&&jh(ne,h)&&Oh(v,ne,I),k.add(G)}if(O=v._dirtyLeaves,j=O.size,j>0){Ba++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const G of P){const ne=G[0],oe=G[1];if(ne!=="root"&&!oe)continue;const ue=N.get(ne);ue!==void 0&&jh(ue,h)&&Oh(v,ue,I),T.set(ne,oe)}O=v._dirtyLeaves,j=O.size,P=v._dirtyElements,q=P.size,Ba++}v._dirtyLeaves=k,v._dirtyElements=T}(u,n),zh(n),function(A,v,k,T){const N=A._nodeMap,h=v._nodeMap,I=[];for(const[O]of T){const j=h.get(O);j!==void 0&&(j.isAttached()||(ie(j)&&Zf(j,O,N,h,I,T),N.has(O)||T.delete(O),I.push(O)))}for(const O of I)h.delete(O);for(const O of k){const j=h.get(O);j===void 0||j.isAttached()||(N.has(O)||k.delete(O),h.delete(O))}}(l,u,n._dirtyLeaves,n._dirtyElements)),C!==n._compositionKey&&(u._flushSync=!0);const S=u._selection;if(he(S)){const A=u._nodeMap,v=S.anchor.key,k=S.focus.key;A.get(v)!==void 0&&A.get(k)!==void 0||De(19)}else Dt(S)&&S._nodes.size===0&&(u._selection=null)}catch(C){return C instanceof Error&&n._onError(C),n._pendingEditorState=l,n._dirtyType=ts,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Mi(n)}finally{Zt=d,Cn=f,Qt=m,n._updating=y,Ba=0}n._dirtyType!==Si||function(C,S){const A=S.getEditorState()._selection,v=C._selection;if(v!==null){if(v.dirty||!v.is(A))return!0}else if(A!==null)return!0;return!1}(u,n)?u._flushSync?(u._flushSync=!1,Mi(n)):g&&g0(()=>{Mi(n)}):(u._flushSync=!1,g&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Rn(n,e,t){n._updating?n._updates.push([e,t]):Bh(n,e,t)}class ni extends Ia{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__indent=0,this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return s0[e]||""}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Ut()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(me(t)&&e.push(t),ie(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;ie(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;ie(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return ie(s)&&s.getLastDescendant()||s||null}const i=t[e];return ie(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:tt(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&De(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:tt(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&De(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,i;if(e<t/2){for(r=this.getFirstChild(),i=0;r!==null&&i<=e;){if(i===e)return r;r=r.getNextSibling(),i++}return null}for(r=this.getLastChild(),i=t-1;r!==null&&i>=e;){if(i===e)return r;r=r.getPreviousSibling(),i--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContent(),ie(s)&&i!==r-1&&!s.isInline()&&(e+=Ir)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContentSize(),ie(s)&&i!==r-1&&!s.isInline()&&(e+=Ir.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Nf[e];return!!(this.getFormat()&t)}return!1}select(e,t){Sn();const r=ge();let i=e,s=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(me(l)||ie(l))return l.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const l=this.getLastChild();if(me(l)||ie(l))return l.select()}}i===void 0&&(i=o),s===void 0&&(s=o);const a=this.__key;return he(r)?(r.anchor.set(a,i,"element"),r.focus.set(a,s,"element"),r.dirty=!0,r):Dh(a,i,a,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Nf[e]:0,this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){const i=r.length,s=this.getChildrenSize(),o=this.getWritable(),a=o.__key,l=[],u=[],g=this.getChildAtIndex(e+t);let d=null,f=s-t+i;if(e!==0)if(e===s)d=this.getLastChild();else{const y=this.getChildAtIndex(e);y!==null&&(d=y.getPreviousSibling())}if(t>0){let y=d===null?this.getFirstChild():d.getNextSibling();for(let b=0;b<t;b++){y===null&&De(100);const C=y.getNextSibling(),S=y.__key;Ti(y.getWritable()),u.push(S),y=C}}let m=d;for(let y=0;y<i;y++){const b=r[y];m!==null&&b.is(m)&&(d=m=m.getPreviousSibling());const C=b.getWritable();C.__parent===a&&f--,Ti(C);const S=b.__key;if(m===null)o.__first=S,C.__prev=null;else{const A=m.getWritable();A.__next=S,C.__prev=A.__key}b.__key===a&&De(76),C.__parent=a,l.push(S),m=b}if(e+t===s)m!==null&&(m.getWritable().__next=null,o.__last=m.__key);else if(g!==null){const y=g.getWritable();if(m!==null){const b=m.getWritable();y.__prev=m.__key,b.__next=g.__key}else y.__prev=null}if(o.__size=f,u.length){const y=ge();if(he(y)){const b=new Set(u),C=new Set(l),{anchor:S,focus:A}=y;Uh(S,b,C)&&Fa(S,S.getNode(),this,d,g),Uh(A,b,C)&&Fa(A,A.getNode(),this,d,g),f!==0||this.canBeEmpty()||un(this)||this.remove()}}return o}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}}function ie(n){return n instanceof ni}function Uh(n,e,t){let r=n.getNode();for(;r;){const i=r.__key;if(e.has(i)&&!t.has(i))return!0;r=r.getParent()}return!1}class nu extends Ia{constructor(e){super(e)}decorate(e,t){De(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function gt(n){return n instanceof nu}class go extends ni{static getType(){return"root"}static clone(){return new go}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){De(51)}getTextContent(){const e=this.__cachedText;return!ls()&&Ut()._dirtyType!==Si||e===null?super.getTextContent():e}remove(){De(52)}replace(e){De(53)}insertBefore(e){De(54)}insertAfter(e){De(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const r=e[t];ie(r)||gt(r)||De(56)}return super.append(...e)}static importJSON(e){const t=dt();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function dn(n){return n instanceof go}function ru(){return new Ua(new Map([["root",new go]]))}function Hh(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&De(130,t.name),ie(n)){const r=e.children;Array.isArray(r)||De(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const o=Hh(i[s]);r.push(o)}}return e}class Ua{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e){return Ph(this,e)}clone(e){const t=new Ua(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Ph(this,()=>({root:Hh(dt())}))}}class iu extends ni{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class cs extends ni{constructor(e){super(e),this.__textFormat=0}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Rr[e];return!!(this.getTextFormat()&t)}static clone(e){return new cs(e.__key)}createDOM(e){const t=document.createElement("p"),r=eo(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:W0,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&no(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const i=this.getDirection();i&&(t.dir=i);const s=this.getIndent();s>0&&(t.style.textIndent=20*s+"px")}return{element:t}}static importJSON(e){const t=_t();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),type:"paragraph",version:1}}insertNewAfter(e,t){const r=_t();r.setTextFormat(e.format);const i=this.getDirection();return r.setDirection(i),r.setFormat(this.getFormatType()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||me(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function W0(n){const e=_t();if(n.style){e.setFormat(n.style.textAlign);const t=parseInt(n.style.textIndent,10)/20;t>0&&e.setIndent(t)}return{node:e}}function _t(){return dr(new cs)}function us(n){return n instanceof cs}const ot=0,rn=1,$n=3,rr=4;function Wh(n,e,t,r){const i=n._keyToDOMMap;i.clear(),n._editorState=ru(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=Si,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",i.set("root",t))}function Ha(n){const e=n||{},t=U0(),r=e.theme||{},i=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,o=ru(),a=e.namespace||(i!==null?i._config.namespace:$f()),l=e.editorState,u=[go,Ni,co,uo,cs,iu,...e.nodes||[]],{onError:g,html:d}=e,f=e.editable===void 0||e.editable;let m;if(n===void 0&&t!==null)m=t._nodes;else{m=new Map;for(let b=0;b<u.length;b++){let C=u[b],S=null,A=null;if(typeof C!="function"){const N=C;C=N.replace,S=N.with,A=N.withKlass||null}const v=C.getType(),k=C.transform(),T=new Set;k!==null&&T.add(k),m.set(v,{exportDOM:d&&d.export?d.export.get(C):void 0,klass:C,replace:S,replaceWithKlass:A,transforms:T})}}const y=new $0(o,i,m,{disableEvents:s,namespace:a,theme:r},g||console.error,function(b,C){const S=new Map,A=new Set,v=k=>{Object.keys(k).forEach(T=>{let N=S.get(T);N===void 0&&(N=[],S.set(T,N)),N.push(k[T])})};return b.forEach(k=>{const T=k.klass.importDOM;if(T==null||A.has(T))return;A.add(T);const N=T.call(k.klass);N!==null&&v(N)}),C&&v(C),S}(m,d?d.import:void 0),f);return l!==void 0&&(y._pendingEditorState=l,y._dirtyType=ts),y}class $0{constructor(e,t,r,i,s,o,a){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=Si,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=$f(),this._onError=s,this._htmlConversions=o,this._editable=a,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){r===void 0&&De(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);s===void 0&&De(36,String(e));const o=s[r];return o.add(t),()=>{o.delete(t),s.every(a=>a.size===0)&&i.delete(e)}}registerMutationListener(e,t){let r=this._nodes.get(e.getType());r===void 0&&De(37,e.name);let i=e,s=null;for(;s=r.replaceWithKlass;)i=s,r=this._nodes.get(s.getType()),r===void 0&&De(37,s.name);const o=this._listeners.mutation;return o.set(t,i),()=>{o.delete(t)}}registerNodeTransformToKlass(e,t){const r=e.getType(),i=this._nodes.get(r);return i===void 0&&De(37,e.name),i.transforms.add(t),i}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),i=[r],s=r.replaceWithKlass;if(s!=null){const l=this.registerNodeTransformToKlass(s,t);i.push(l)}var o,a;return o=this,a=e.getType(),Rn(o,()=>{const l=gr();if(l.isEmpty())return;if(a==="root")return void dt().markDirty();const u=l._nodeMap;for(const[,g]of u)g.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{i.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return Oe(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=eo(this._config.theme,"root"),i=this._pendingEditorState||this._editorState;if(this._rootElement=e,Wh(this,t,e,i),t!==null&&(this._config.disableEvents||M0(t),r!=null&&t.classList.remove(...r)),e!==null){const s=function(a){const l=a.ownerDocument;return l&&l.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=ts,Af(this),this._updateTags.add("history-merge"),Mi(this),this._config.disableEvents||function(a,l){const u=a.ownerDocument,g=Aa.get(u);(g===void 0||g<1)&&u.addEventListener("selectionchange",gh),Aa.set(u,(g||0)+1),a.__lexicalEditor=l;const d=hh(a);for(let f=0;f<Uc.length;f++){const[m,y]=Uc[f],b=typeof y=="function"?C=>{mh(C)||(ph(C),(l.isEditable()||m==="click")&&y(C,l))}:C=>{if(mh(C))return;ph(C);const S=l.isEditable();switch(m){case"cut":return S&&Oe(l,ac,C);case"copy":return Oe(l,da,C);case"paste":return S&&Oe(l,oa,C);case"dragstart":return S&&Oe(l,es,C);case"dragover":return S&&Oe(l,ua,C);case"dragend":return S&&Oe(l,V_,C);case"focus":return S&&Oe(l,cc,C);case"blur":return S&&Oe(l,Cf,C);case"drop":return S&&Oe(l,ca,C)}};a.addEventListener(m,b),d.push(()=>{a.removeEventListener(m,b)})}}(e,this),r!=null&&e.classList.add(...r)}else this._editorState=i,this._pendingEditorState=null,this._window=null;ho("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&De(38),Df(this);const r=this._pendingEditorState,i=this._updateTags,s=t!==void 0?t.tag:null;r===null||r.isEmpty()||(s!=null&&i.add(s),Mi(this)),this._pendingEditorState=e,this._dirtyType=ts,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),Mi(this)}parseEditorState(e,t){return function(r,i,s){const o=ru(),a=Zt,l=Cn,u=Qt,g=i._dirtyElements,d=i._dirtyLeaves,f=i._cloneNotNeeded,m=i._dirtyType;i._dirtyElements=new Map,i._dirtyLeaves=new Set,i._cloneNotNeeded=new Set,i._dirtyType=0,Zt=o,Cn=!1,Qt=i;try{const y=i._nodes;tu(r.root,y),s&&s(),o._readOnly=!0}catch(y){y instanceof Error&&i._onError(y)}finally{i._dirtyElements=g,i._dirtyLeaves=d,i._cloneNotNeeded=f,i._dirtyType=m,Zt=a,Cn=l,Qt=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}update(e,t){Rn(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Rn(this,()=>{const i=ge(),s=dt();i!==null?i.dirty=!0:s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=fr(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ho("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}const Tn=()=>new Map,su=n=>{const e=Tn();return n.forEach((t,r)=>{e.set(r,t)}),e},Ln=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},Y0=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},V0=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},ri=()=>new Set,ou=n=>n[n.length-1],q0=(n,e)=>{for(let t=0;t<e.length;t++)n.push(e[t])},jr=Array.from,K0=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},au=Array.isArray;class lu{constructor(){this._observers=Tn()}on(e,t){return Ln(this._observers,e,ri).add(t),t}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return jr((this._observers.get(e)||Tn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Tn()}}class cu{constructor(){this._observers=Tn()}on(e,t){Ln(this._observers,e,ri).add(t)}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return jr((this._observers.get(e)||Tn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Tn()}}const pr=Math.floor,Wa=Math.abs,G0=Math.log10,$a=(n,e)=>n<e?n:e,Di=(n,e)=>n>e?n:e,X0=Math.pow,$h=n=>n!==0?n<0:1/n<0,Yh=1,Vh=2,uu=4,du=8,po=32,Pr=64,On=128,Ya=31,fu=63,Ai=127,J0=2147483647,qh=Number.MAX_SAFE_INTEGER,Z0=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&pr(n)===n),Q0=String.fromCharCode,eb=n=>n.toLowerCase(),tb=/^\s*/g,nb=n=>n.replace(tb,""),rb=/([A-Z])/g,Kh=(n,e)=>nb(n.replace(rb,t=>`${e}${eb(t)}`)),ib=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e.codePointAt(i);return r},mo=typeof TextEncoder<"u"?new TextEncoder:null,hu=mo?n=>mo.encode(n):ib;let yo=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});yo&&yo.decode(new Uint8Array).length===1&&(yo=null);class _o{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const bt=()=>new _o,gu=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},at=n=>{const e=new Uint8Array(gu(n));let t=0;for(let r=0;r<n.bufs.length;r++){const i=n.bufs[r];e.set(i,t),t+=i.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},sb=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(Di(t,e)*2),n.cpos=0)},en=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},bo=en,je=(n,e)=>{for(;e>Ai;)en(n,On|Ai&e),e=pr(e/128);en(n,Ai&e)},pu=(n,e)=>{const t=$h(e);for(t&&(e=-e),en(n,(e>fu?On:0)|(t?Pr:0)|fu&e),e=pr(e/64);e>0;)en(n,(e>Ai?On:0)|Ai&e),e=pr(e/128)},mu=new Uint8Array(3e4),ob=mu.length/3,ab=(n,e)=>{if(e.length<ob){const t=mo.encodeInto(e,mu).written||0;je(n,t);for(let r=0;r<t;r++)en(n,mu[r])}else St(n,hu(e))},lb=(n,e)=>{const t=unescape(encodeURIComponent(e)),r=t.length;je(n,r);for(let i=0;i<r;i++)en(n,t.codePointAt(i))},mr=mo&&mo.encodeInto?ab:lb,Va=(n,e)=>{const t=n.cbuf.length,r=n.cpos,i=$a(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(Di(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},St=(n,e)=>{je(n,e.byteLength),Va(n,e)},yu=(n,e)=>{sb(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},cb=(n,e)=>yu(n,4).setFloat32(0,e,!1),ub=(n,e)=>yu(n,8).setFloat64(0,e,!1),db=(n,e)=>yu(n,8).setBigInt64(0,e,!1),Gh=new DataView(new ArrayBuffer(4)),fb=n=>(Gh.setFloat32(0,n),Gh.getFloat32(0)===n),ds=(n,e)=>{switch(typeof e){case"string":en(n,119),mr(n,e);break;case"number":Z0(e)&&Wa(e)<=J0?(en(n,125),pu(n,e)):fb(e)?(en(n,124),cb(n,e)):(en(n,123),ub(n,e));break;case"bigint":en(n,122),db(n,e);break;case"object":if(e===null)en(n,126);else if(au(e)){en(n,117),je(n,e.length);for(let t=0;t<e.length;t++)ds(n,e[t])}else if(e instanceof Uint8Array)en(n,116),St(n,e);else{en(n,118);const t=Object.keys(e);je(n,t.length);for(let r=0;r<t.length;r++){const i=t[r];mr(n,i),ds(n,e[i])}}break;case"boolean":en(n,e?120:121);break;default:en(n,127)}};class Xh extends _o{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&je(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Jh=n=>{n.count>0&&(pu(n.encoder,n.count===1?n.s:-n.s),n.count>1&&je(n.encoder,n.count-2))};class qa{constructor(){this.encoder=new _o,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Jh(this),this.count=1,this.s=e)}toUint8Array(){return Jh(this),at(this.encoder)}}const Zh=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);pu(n.encoder,e),n.count>1&&je(n.encoder,n.count-2)}};class _u{constructor(){this.encoder=new _o,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Zh(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Zh(this),at(this.encoder)}}class hb{constructor(){this.sarr=[],this.s="",this.lensE=new qa}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new _o;return this.sarr.push(this.s),this.s="",mr(e,this.sarr.join("")),Va(e,this.lensE.toUint8Array()),at(e)}}const yr=n=>new Error(n),_r=()=>{throw yr("Method unimplemented")},ir=()=>{throw yr("Unexpected case")},Qh=yr("Unexpected end of array"),eg=yr("Integer out of Range");class Ka{constructor(e){this.arr=e,this.pos=0}}const sr=n=>new Ka(n),gb=n=>n.pos!==n.arr.length,pb=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},Gt=n=>pb(n,Ve(n)),Ii=n=>n.arr[n.pos++],Ve=n=>{let e=0,t=1;const r=n.arr.length;for(;n.pos<r;){const i=n.arr[n.pos++];if(e=e+(i&Ai)*t,t*=128,i<On)return e;if(e>qh)throw eg}throw Qh},bu=n=>{let e=n.arr[n.pos++],t=e&fu,r=64;const i=(e&Pr)>0?-1:1;if(!(e&On))return i*t;const s=n.arr.length;for(;n.pos<s;){if(e=n.arr[n.pos++],t=t+(e&Ai)*r,r*=128,e<On)return i*t;if(t>qh)throw eg}throw Qh},br=yo?n=>yo.decode(Gt(n)):n=>{let e=Ve(n);if(e===0)return"";{let t=String.fromCodePoint(Ii(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(Ii(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},wu=(n,e)=>{const t=new DataView(n.arr.buffer,n.arr.byteOffset+n.pos,e);return n.pos+=e,t},mb=[n=>{},n=>null,bu,n=>wu(n,4).getFloat32(0,!1),n=>wu(n,8).getFloat64(0,!1),n=>wu(n,8).getBigInt64(0,!1),n=>!1,n=>!0,br,n=>{const e=Ve(n),t={};for(let r=0;r<e;r++){const i=br(n);t[i]=fs(n)}return t},n=>{const e=Ve(n),t=[];for(let r=0;r<e;r++)t.push(fs(n));return t},Gt],fs=n=>mb[127-Ii(n)](n);class tg extends Ka{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),gb(this)?this.count=Ve(this)+1:this.count=-1),this.count--,this.s}}class Ga extends Ka{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=bu(this);const e=$h(this.s);this.count=1,e&&(this.s=-this.s,this.count=Ve(this)+2)}return this.count--,this.s}}class vu extends Ka{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=bu(this),t=e&1;this.diff=pr(e/2),this.count=1,t&&(this.count=Ve(this)+2)}return this.s+=this.diff,this.count--,this.s}}class yb{constructor(e){this.decoder=new Ga(e),this.str=br(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const _b=crypto.getRandomValues.bind(crypto),bb=Math.random,ng=()=>_b(new Uint32Array(1))[0],wb=[1e7]+-1e3+-4e3+-8e3+-1e11,rg=()=>wb.replace(/[018]/g,n=>(n^ng()&15>>n/4).toString(16)),jn=Date.now,ig=n=>new Promise(n);Promise.all.bind(Promise);const vb=n=>Promise.reject(n),xu=n=>Promise.resolve(n),sg=n=>n===void 0?null:n;class xb{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let og=new xb,Cu=!0;try{typeof localStorage<"u"&&localStorage&&(og=localStorage,Cu=!1)}catch{}const ag=og,Cb=n=>Cu||addEventListener("storage",n),Sb=n=>Cu||removeEventListener("storage",n),Tb=Object.assign,lg=Object.keys,Eb=(n,e)=>{for(const t in n)e(n[t],t)},kb=(n,e)=>{const t=[];for(const r in n)t.push(e(n[r],r));return t},cg=n=>lg(n).length,ug=n=>lg(n).length,Nb=n=>{for(const e in n)return!1;return!0},Mb=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},dg=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),Db=(n,e)=>n===e||ug(n)===ug(e)&&Mb(n,(t,r)=>(t!==void 0||dg(e,r))&&e[r]===t),Ab=Object.freeze,fg=n=>{for(const e in n){const t=n[e];(typeof t=="object"||typeof t=="function")&&fg(n[e])}return Ab(n)},Su=(n,e,t=0)=>{try{for(;t<n.length;t++)n[t](...e)}finally{t<n.length&&Su(n,e,t+1)}},Ib=()=>{},Rb=n=>n,Lb=(n,e)=>n===e,wo=(n,e)=>{if(n==null||e==null)return Lb(n,e);if(n.constructor!==e.constructor)return!1;if(n===e)return!0;switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!wo(n.get(t),e.get(t)))return!1;break}case Object:if(cg(n)!==cg(e))return!1;for(const t in n)if(!dg(n,t)||!wo(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!wo(n[t],e[t]))return!1;break;default:return!1}return!0},Ob=(n,e)=>e.includes(n),ii=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",hg=typeof window<"u"&&typeof document<"u"&&!ii;let wr;const jb=()=>{if(wr===void 0)if(ii){wr=Tn();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const r=n[t];r[0]==="-"?(e!==null&&wr.set(e,""),e=r):e!==null&&(wr.set(e,r),e=null)}e!==null&&wr.set(e,"")}else typeof location=="object"?(wr=Tn(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");wr.set(`--${Kh(e,"-")}`,t),wr.set(`-${Kh(e,"-")}`,t)}})):wr=Tn();return wr},Tu=n=>jb().has(n),vo=n=>sg(ii?process.env[n.toUpperCase().replaceAll("-","_")]:ag.getItem(n)),gg=n=>Tu("--"+n)||vo(n)!==null;gg("production");const Pb=ii&&Ob(process.env.FORCE_COLOR,["true","1","2"])||!Tu("--no-colors")&&!gg("no-color")&&(!ii||process.stdout.isTTY)&&(!ii||Tu("--color")||vo("COLORTERM")!==null||(vo("TERM")||"").includes("color")),pg=n=>new Uint8Array(n),Fb=(n,e,t)=>new Uint8Array(n,e,t),zb=n=>new Uint8Array(n),Bb=n=>{let e="";for(let t=0;t<n.byteLength;t++)e+=Q0(n[t]);return btoa(e)},Ub=n=>Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),Hb=n=>{const e=atob(n),t=pg(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t},Wb=n=>{const e=Buffer.from(n,"base64");return Fb(e.buffer,e.byteOffset,e.byteLength)},mg=hg?Bb:Ub,yg=hg?Hb:Wb,$b=n=>{const e=pg(n.byteLength);return e.set(n),e};class Yb{constructor(e,t){this.left=e,this.right=t}}const Fr=(n,e)=>new Yb(n,e);typeof DOMParser<"u"&&new DOMParser;const Vb=n=>Y0(n,(e,t)=>`${t}:${e};`).join(""),qb=JSON.stringify,zr=Symbol,Yn=zr(),Ri=zr(),_g=zr(),Eu=zr(),bg=zr(),wg=zr(),vg=zr(),Xa=zr(),Ja=zr(),Kb=n=>{var i;n.length===1&&((i=n[0])==null?void 0:i.constructor)===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const s=n[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const s=n[r];s instanceof Symbol||t.push(s)}return t},xg=[bg,vg,Xa,_g];let ku=0,Cg=jn();const Gb=(n,e)=>{const t=xg[ku],r=vo("log"),i=r!==null&&(r==="*"||r==="true"||new RegExp(r,"gi").test(e));return ku=(ku+1)%xg.length,e+=": ",i?(...s)=>{var l;s.length===1&&((l=s[0])==null?void 0:l.constructor)===Function&&(s=s[0]());const o=jn(),a=o-Cg;Cg=o,n(t,e,Ja,...s.map(u=>{switch(u!=null&&u.constructor===Uint8Array&&(u=Array.from(u)),typeof u){case"string":case"symbol":return u;default:return qb(u)}}),t," +"+a+"ms")}:Ib},Xb={[Yn]:Fr("font-weight","bold"),[Ri]:Fr("font-weight","normal"),[_g]:Fr("color","blue"),[bg]:Fr("color","green"),[Eu]:Fr("color","grey"),[wg]:Fr("color","red"),[vg]:Fr("color","purple"),[Xa]:Fr("color","orange"),[Ja]:Fr("color","black")},Sg=Pb?n=>{var o;n.length===1&&((o=n[0])==null?void 0:o.constructor)===Function&&(n=n[0]());const e=[],t=[],r=Tn();let i=[],s=0;for(;s<n.length;s++){const a=n[s],l=Xb[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const u=Vb(r);s>0||u.length>0?(e.push("%c"+a),t.push(u)):e.push(a)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s<n.length;s++){const a=n[s];a instanceof Symbol||i.push(a)}return i}:Kb,Tg=(...n)=>{console.log(...Sg(n)),kg.forEach(e=>e.print(n))},Eg=(...n)=>{console.warn(...Sg(n)),n.unshift(Xa),kg.forEach(e=>e.print(n))},kg=ri(),Jb=n=>Gb(Tg,n),Ng=n=>({[Symbol.iterator](){return this},next:n}),Zb=(n,e)=>Ng(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),Nu=(n,e)=>Ng(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Mu{constructor(e,t){this.clock=e,this.len=t}}class hs{constructor(){this.clients=new Map}}const gs=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);for(let o=0;o<r.length;o++){const a=r[o];Vg(n,s,a.clock,a.len,t)}}),Qb=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=pr((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;t=i+1}else r=i-1}return null},xo=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&Qb(t,e.clock)!==null},Du=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],s=e[t];i.clock+i.len>=s.clock?i.len=Di(i.len,s.clock+s.len-i.clock):(r<t&&(e[r]=s),r++)}e.length=r})},Au=n=>{const e=new hs;for(let t=0;t<n.length;t++)n[t].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=t+1;o<n.length;o++)q0(s,n[o].clients.get(i)||[]);e.clients.set(i,s)}});return Du(e),e},Co=(n,e,t,r)=>{Ln(n.clients,e,()=>[]).push(new Mu(t,r))},ew=()=>new hs,tw=n=>{const e=ew();return n.clients.forEach((t,r)=>{const i=[];for(let s=0;s<t.length;s++){const o=t[s];if(o.deleted){const a=o.id.clock;let l=o.length;if(s+1<t.length)for(let u=t[s+1];s+1<t.length&&u.deleted;u=t[++s+1])l+=u.length;i.push(new Mu(a,l))}}i.length>0&&e.clients.set(r,i)}),e},ps=(n,e)=>{je(n.restEncoder,e.clients.size),jr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),je(n.restEncoder,t);const i=r.length;je(n.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];n.writeDsClock(o.clock),n.writeDsLen(o.len)}})},Iu=n=>{const e=new hs,t=Ve(n.restDecoder);for(let r=0;r<t;r++){n.resetDsCurVal();const i=Ve(n.restDecoder),s=Ve(n.restDecoder);if(s>0){const o=Ln(e.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new Mu(n.readDsClock(),n.readDsLen()))}}return e},Mg=(n,e,t)=>{const r=new hs,i=Ve(n.restDecoder);for(let s=0;s<i;s++){n.resetDsCurVal();const o=Ve(n.restDecoder),a=Ve(n.restDecoder),l=t.clients.get(o)||[],u=Ht(t,o);for(let g=0;g<a;g++){const d=n.readDsClock(),f=d+n.readDsLen();if(d<u){u<f&&Co(r,o,u,f-u);let m=vr(l,d),y=l[m];for(!y.deleted&&y.id.clock<d&&(l.splice(m+1,0,fl(e,y,d-y.id.clock)),m++);m<l.length&&(y=l[m++],y.id.clock<f);)y.deleted||(f<y.id.clock+y.length&&l.splice(m,0,fl(e,y,f-y.id.clock)),y.delete(e))}else Co(r,o,d,f-d)}}if(r.clients.size>0){const s=new Li;return je(s.restEncoder,0),ps(s,r),s.toUint8Array()}return null},Dg=ng;class Br extends lu{constructor({guid:e=rg(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=Dg(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Wg,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=ig(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>ig(u=>{const g=d=>{(d===void 0||d===!0)&&(this.off("sync",g),u())};this.on("sync",g)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Tt(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(jr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Tt(this,e,t)}get(e,t=sn){const r=Ln(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==sn&&i!==t)if(i===sn){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,vs)}getText(e=""){return this.get(e,Cs)}getMap(e=""){return this.get(e,Pn)}getXmlElement(e=""){return this.get(e,ai)}getXmlFragment(e=""){return this.get(e,Oi)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,jr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Br({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,Tt(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ag{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Ve(this.restDecoder)}readDsLen(){return Ve(this.restDecoder)}}class Ig extends Ag{readLeftID(){return Xe(Ve(this.restDecoder),Ve(this.restDecoder))}readRightID(){return Xe(Ve(this.restDecoder),Ve(this.restDecoder))}readClient(){return Ve(this.restDecoder)}readInfo(){return Ii(this.restDecoder)}readString(){return br(this.restDecoder)}readParentInfo(){return Ve(this.restDecoder)===1}readTypeRef(){return Ve(this.restDecoder)}readLen(){return Ve(this.restDecoder)}readAny(){return fs(this.restDecoder)}readBuf(){return $b(Gt(this.restDecoder))}readJSON(){return JSON.parse(br(this.restDecoder))}readKey(){return br(this.restDecoder)}}class nw{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Ve(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Ve(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class ms extends nw{constructor(e){super(e),this.keys=[],Ve(e),this.keyClockDecoder=new vu(Gt(e)),this.clientDecoder=new Ga(Gt(e)),this.leftClockDecoder=new vu(Gt(e)),this.rightClockDecoder=new vu(Gt(e)),this.infoDecoder=new tg(Gt(e),Ii),this.stringDecoder=new yb(Gt(e)),this.parentInfoDecoder=new tg(Gt(e),Ii),this.typeRefDecoder=new Ga(Gt(e)),this.lenDecoder=new Ga(Gt(e))}readLeftID(){return new ys(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ys(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return fs(this.restDecoder)}readBuf(){return Gt(this.restDecoder)}readJSON(){return fs(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const t=this.stringDecoder.read();return this.keys.push(t),t}}}class Rg{constructor(){this.restEncoder=bt()}toUint8Array(){return at(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){je(this.restEncoder,e)}writeDsLen(e){je(this.restEncoder,e)}}class So extends Rg{writeLeftID(e){je(this.restEncoder,e.client),je(this.restEncoder,e.clock)}writeRightID(e){je(this.restEncoder,e.client),je(this.restEncoder,e.clock)}writeClient(e){je(this.restEncoder,e)}writeInfo(e){bo(this.restEncoder,e)}writeString(e){mr(this.restEncoder,e)}writeParentInfo(e){je(this.restEncoder,e?1:0)}writeTypeRef(e){je(this.restEncoder,e)}writeLen(e){je(this.restEncoder,e)}writeAny(e){ds(this.restEncoder,e)}writeBuf(e){St(this.restEncoder,e)}writeJSON(e){mr(this.restEncoder,JSON.stringify(e))}writeKey(e){mr(this.restEncoder,e)}}class Lg{constructor(){this.restEncoder=bt(),this.dsCurrVal=0}toUint8Array(){return at(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,je(this.restEncoder,t)}writeDsLen(e){e===0&&ir(),je(this.restEncoder,e-1),this.dsCurrVal+=e}}class Li extends Lg{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new _u,this.clientEncoder=new qa,this.leftClockEncoder=new _u,this.rightClockEncoder=new _u,this.infoEncoder=new Xh(bo),this.stringEncoder=new hb,this.parentInfoEncoder=new Xh(bo),this.typeRefEncoder=new qa,this.lenEncoder=new qa}toUint8Array(){const e=bt();return je(e,0),St(e,this.keyClockEncoder.toUint8Array()),St(e,this.clientEncoder.toUint8Array()),St(e,this.leftClockEncoder.toUint8Array()),St(e,this.rightClockEncoder.toUint8Array()),St(e,at(this.infoEncoder)),St(e,this.stringEncoder.toUint8Array()),St(e,at(this.parentInfoEncoder)),St(e,this.typeRefEncoder.toUint8Array()),St(e,this.lenEncoder.toUint8Array()),Va(e,at(this.restEncoder)),at(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){ds(this.restEncoder,e)}writeBuf(e){St(this.restEncoder,e)}writeJSON(e){ds(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const rw=(n,e,t,r)=>{r=Di(r,e[0].id.clock);const i=vr(e,r);je(n.restEncoder,e.length-i),n.writeClient(t),je(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(n,0)},Ru=(n,e,t)=>{const r=new Map;t.forEach((i,s)=>{Ht(e,s)>i&&r.set(s,i)}),el(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),je(n.restEncoder,r.size),jr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{rw(n,e.clients.get(i),i,s)})},iw=(n,e)=>{const t=Tn(),r=Ve(n.restDecoder);for(let i=0;i<r;i++){const s=Ve(n.restDecoder),o=new Array(s),a=n.readClient();let l=Ve(n.restDecoder);t.set(a,{i:0,refs:o});for(let u=0;u<s;u++){const g=n.readInfo();switch(Ya&g){case 0:{const d=n.readLen();o[u]=new Vn(Xe(a,l),d),l+=d;break}case 10:{const d=Ve(n.restDecoder);o[u]=new qn(Xe(a,l),d),l+=d;break}default:{const d=(g&(Pr|On))===0,f=new Et(Xe(a,l),null,(g&On)===On?n.readLeftID():null,null,(g&Pr)===Pr?n.readRightID():null,d?n.readParentInfo()?e.get(n.readString()):n.readLeftID():null,d&&(g&po)===po?n.readString():null,Tp(n,g));o[u]=f,l+=f.length}}}}return t},sw=(n,e,t)=>{const r=[];let i=jr(t.keys()).sort((m,y)=>m-y);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let m=t.get(i[i.length-1]);for(;m.refs.length===m.i;)if(i.pop(),i.length>0)m=t.get(i[i.length-1]);else return null;return m};let o=s();if(o===null)return null;const a=new Wg,l=new Map,u=(m,y)=>{const b=l.get(m);(b==null||b>y)&&l.set(m,y)};let g=o.refs[o.i++];const d=new Map,f=()=>{for(const m of r){const y=m.id.client,b=t.get(y);b?(b.i--,a.clients.set(y,b.refs.slice(b.i)),t.delete(y),b.i=0,b.refs=[]):a.clients.set(y,[m]),i=i.filter(C=>C!==y)}r.length=0};for(;;){if(g.constructor!==qn){const y=Ln(d,g.id.client,()=>Ht(e,g.id.client))-g.id.clock;if(y<0)r.push(g),u(g.id.client,g.id.clock-1),f();else{const b=g.getMissing(n,e);if(b!==null){r.push(g);const C=t.get(b)||{refs:[],i:0};if(C.refs.length===C.i)u(b,Ht(e,b)),f();else{g=C.refs[C.i++];continue}}else(y===0||y<g.length)&&(g.integrate(n,y),d.set(g.id.client,g.id.clock+g.length))}}if(r.length>0)g=r.pop();else if(o!==null&&o.i<o.refs.length)g=o.refs[o.i++];else{if(o=s(),o===null)break;g=o.refs[o.i++]}}if(a.clients.size>0){const m=new Li;return Ru(m,a,new Map),je(m.restEncoder,0),{missing:l,update:m.toUint8Array()}}return null},ow=(n,e)=>Ru(n,e.doc.store,e.beforeState),aw=(n,e,t,r=new ms(n))=>Tt(e,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,l=iw(r,o),u=sw(i,a,l),g=a.pendingStructs;if(g){for(const[f,m]of g.missing)if(m<Ht(a,f)){s=!0;break}if(u){for(const[f,m]of u.missing){const y=g.missing.get(f);(y==null||y>m)&&g.missing.set(f,m)}g.update=nl([g.update,u.update])}}else a.pendingStructs=u;const d=Mg(r,i,a);if(a.pendingDs){const f=new ms(sr(a.pendingDs));Ve(f.restDecoder);const m=Mg(f,i,a);d&&m?a.pendingDs=nl([d,m]):a.pendingDs=d||m}else a.pendingDs=d;if(s){const f=a.pendingStructs.update;a.pendingStructs=null,Og(i.doc,f)}},t,!1),Og=(n,e,t,r=ms)=>{const i=sr(e);aw(i,n,t,new r(i))},lw=(n,e,t)=>Og(n,e,t,Ig),cw=(n,e,t=new Map)=>{Ru(n,e.store,t),ps(n,tw(e.store))},uw=(n,e=new Uint8Array([0]),t=new Li)=>{const r=jg(e);cw(t,n,r);const i=[t.toUint8Array()];if(n.store.pendingDs&&i.push(n.store.pendingDs),n.store.pendingStructs&&i.push(Aw(n.store.pendingStructs.update,e)),i.length>1){if(t.constructor===So)return Mw(i.map((s,o)=>o===0?s:Rw(s)));if(t.constructor===Li)return nl(i)}return i[0]},dw=(n,e)=>uw(n,e,new So),fw=n=>{const e=new Map,t=Ve(n.restDecoder);for(let r=0;r<t;r++){const i=Ve(n.restDecoder),s=Ve(n.restDecoder);e.set(i,s)}return e},jg=n=>fw(new Ag(sr(n))),Pg=(n,e)=>(je(n.restEncoder,e.size),jr(e.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{je(n.restEncoder,t),je(n.restEncoder,r)}),n),hw=(n,e)=>Pg(n,el(e.store)),gw=(n,e=new Lg)=>(n instanceof Map?Pg(e,n):hw(e,n),e.toUint8Array()),pw=n=>gw(n,new Rg);class mw{constructor(){this.l=[]}}const Fg=()=>new mw,zg=(n,e)=>n.l.push(e),Bg=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Ug=(n,e,t)=>Su(n.l,[e,t]);class ys{constructor(e,t){this.client=e,this.clock=t}}const _s=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,Xe=(n,e)=>new ys(n,e),Hg=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw ir()},Za=(n,e)=>{for(;e!==null;){if(e.parent===n)return!0;e=e.parent._item}return!1};class yw{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}class _w{constructor(e,t,r=0){this.type=e,this.index=t,this.assoc=r}}const bw=(n,e,t=0)=>new _w(n,e,t),Qa=(n,e,t)=>{let r=null,i=null;return n._item===null?i=Hg(n):r=Xe(n._item.id.client,n._item.id.clock),new yw(r,i,e,t)},ww=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return Qa(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Qa(n,Xe(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return Qa(n,r.lastId,t);r=r.right}return Qa(n,null,t)},vw=(n,e,t=!0)=>{const r=e.store,i=n.item,s=n.type,o=n.tname,a=n.assoc;let l=null,u=0;if(i!==null){if(Ht(r,i.client)<=i.clock)return null;const g=t?Vu(r,i):{item:ws(r,i),diff:0},d=g.item;if(!(d instanceof Et))return null;if(l=d.parent,l._item===null||!l._item.deleted){u=d.deleted||!d.countable?0:g.diff+(a>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(u+=f.length),f=f.left}}else{if(o!==null)l=e.get(o);else if(s!==null){if(Ht(r,s.client)<=s.clock)return null;const{item:g}=t?Vu(r,s):{item:ws(r,s)};if(g instanceof Et&&g.content instanceof Cr)l=g.content.type;else return null}else throw ir();a>=0?u=l._length:u=0}return bw(l,u,n.assoc)},xw=(n,e)=>n===e||n!==null&&e!==null&&n.tname===e.tname&&_s(n.item,e.item)&&_s(n.type,e.type)&&n.assoc===e.assoc,bs=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!xo(e.ds,n.id),Lu=(n,e)=>{const t=Ln(n.meta,Lu,ri),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i<Ht(r,s)&&En(n,Xe(s,i))}),gs(n,e.ds,i=>{}),t.add(e))};class Wg{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const el=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},Ht=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},$g=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw ir()}t.push(e)},vr=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=pr(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;t=o+1}else r=o-1;o=pr((t+r)/2)}throw ir()},ws=(n,e)=>{const t=n.clients.get(e.client);return t[vr(t,e.clock)]},Ou=(n,e,t)=>{const r=vr(e,t),i=e[r];return i.id.clock<t&&i instanceof Et?(e.splice(r+1,0,fl(n,i,t-i.id.clock)),r+1):r},En=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[Ou(n,t,e.clock)]},Yg=(n,e,t)=>{const r=e.clients.get(t.client),i=vr(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==Vn&&r.splice(i+1,0,fl(n,s,t.clock-s.id.clock+1)),s},Cw=(n,e,t)=>{const r=n.clients.get(e.id.client);r[vr(r,e.id.clock)]=t},Vg=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=Ou(n,e,t),a;do a=e[o++],s<a.id.clock+a.length&&Ou(n,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};class Sw{constructor(e,t,r){this.doc=e,this.deleteSet=new hs,this.beforeState=el(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const qg=(n,e)=>e.deleteSet.clients.size===0&&!V0(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Du(e.deleteSet),ow(n,e),ps(n,e.deleteSet),!0),Kg=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ln(n.changed,e,ri).add(t)},tl=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Et&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},Tw=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let u=vr(s,a.clock),g=s[u];u<s.length&&g.id.clock<l;g=s[++u]){const d=s[u];if(a.clock+a.len<=d.id.clock)break;d instanceof Et&&d.deleted&&!d.keep&&t(d)&&d.gc(e,!1)}}}},Ew=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],a=$a(i.length-1,1+vr(i,o.clock+o.len-1));for(let l=a,u=i[l];l>0&&u.id.clock>=o.clock;u=i[l])l-=1+tl(i,l)}})},Gg=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,s=t.deleteSet,o=t._mergeStructs;try{Du(s),t.afterState=el(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const a=[];t.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(t,l)})),a.push(()=>{t.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(g=>g.target._item===null||!g.target._item.deleted),l.forEach(g=>{g.currentTarget=u,g._path=null}),l.sort((g,d)=>g.path.length-d.path.length),Ug(u._dEH,l,t))})}),a.push(()=>r.emit("afterTransaction",[t,r])),Su(a,[]),t._needFormattingCleanup&&Vw(t)}finally{r.gc&&Tw(s,i,r.gcFilter),Ew(s,i),t.afterState.forEach((g,d)=>{const f=t.beforeState.get(d)||0;if(f!==g){const m=i.clients.get(d),y=Di(vr(m,f),1);for(let b=m.length-1;b>=y;)b-=1+tl(m,b)}});for(let g=o.length-1;g>=0;g--){const{client:d,clock:f}=o[g].id,m=i.clients.get(d),y=vr(m,f);y+1<m.length&&tl(m,y+1)>1||y>0&&tl(m,y)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Tg(Xa,Yn,"[yjs] ",Ri,wg,"Changed the client-id because another client seems to be using it."),r.clientID=Dg()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const g=new So;qg(g,t)&&r.emit("update",[g.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const g=new Li;qg(g,t)&&r.emit("updateV2",[g.toUint8Array(),t.origin,r,t])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=t;(a.size>0||u.size>0||l.size>0)&&(a.forEach(g=>{g.clientID=r.clientID,g.collectionid==null&&(g.collectionid=r.collectionid),r.subdocs.add(g)}),u.forEach(g=>r.subdocs.delete(g)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,t]),u.forEach(g=>g.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):Gg(n,e+1)}}},Tt=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new Sw(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const a=n._transaction===i[0];n._transaction=null,a&&Gg(i,0)}}return o};class kw{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}const Xg=(n,e,t)=>{gs(n,t.deletions,r=>{r instanceof Et&&e.scope.some(i=>Za(i,r))&&qu(r,!1)})},Jg=(n,e,t)=>{let r=null;const i=n.doc,s=n.scope;Tt(i,a=>{for(;e.length>0&&n.currStackItem===null;){const l=i.store,u=e.pop(),g=new Set,d=[];let f=!1;gs(a,u.insertions,m=>{if(m instanceof Et){if(m.redone!==null){let{item:y,diff:b}=Vu(l,m.id);b>0&&(y=En(a,Xe(y.id.client,y.id.clock+b))),m=y}!m.deleted&&s.some(y=>Za(y,m))&&d.push(m)}}),gs(a,u.deletions,m=>{m instanceof Et&&s.some(y=>Za(y,m))&&!xo(u.insertions,m.id)&&g.add(m)}),g.forEach(m=>{f=Sp(a,m,g,u.insertions,n.ignoreRemoteMapChanges,n)!==null||f});for(let m=d.length-1;m>=0;m--){const y=d[m];n.deleteFilter(y)&&(y.delete(a),f=!0)}n.currStackItem=f?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},n);const o=n.currStackItem;if(o!=null){const a=r.changedParentTypes;n.emit("stack-item-popped",[{stackItem:o,type:t,changedParentTypes:a,origin:n},n]),n.currStackItem=null}return o};class Zg extends lu{constructor(e,{captureTimeout:t=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=au(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=t,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(C=>l.changedParentTypes.has(C))||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,g=this.redoing,d=u?this.redoStack:this.undoStack;u?this.stopCapturing():g||this.clear(!1,!0);const f=new hs;l.afterState.forEach((C,S)=>{const A=l.beforeState.get(S)||0,v=C-A;v>0&&Co(f,S,A,v)});const m=jn();let y=!1;if(this.lastChange>0&&m-this.lastChange<this.captureTimeout&&d.length>0&&!u&&!g){const C=d[d.length-1];C.deletions=Au([C.deletions,l.deleteSet]),C.insertions=Au([C.insertions,f])}else d.push(new kw(l.deleteSet,f)),y=!0;!u&&!g&&(this.lastChange=m),gs(l,l.deleteSet,C=>{C instanceof Et&&this.scope.some(S=>Za(S,C))&&qu(C,!0)});const b=[{stackItem:d[d.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];y?this.emit("stack-item-added",b):this.emit("stack-item-updated",b)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=au(e)?e:[e],e.forEach(t=>{this.scope.every(r=>r!==t)&&(t.doc!==this.doc&&Eg("[yjs#509] Not same Y.Doc"),this.scope.push(t))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>Xg(r,this,i)),this.undoStack=[]),t&&(this.redoStack.forEach(i=>Xg(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Jg(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Jg(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*Nw(n){const e=Ve(n.restDecoder);for(let t=0;t<e;t++){const r=Ve(n.restDecoder),i=n.readClient();let s=Ve(n.restDecoder);for(let o=0;o<r;o++){const a=n.readInfo();if(a===10){const l=Ve(n.restDecoder);yield new qn(Xe(i,s),l),s+=l}else if(Ya&a){const l=(a&(Pr|On))===0,u=new Et(Xe(i,s),null,(a&On)===On?n.readLeftID():null,null,(a&Pr)===Pr?n.readRightID():null,l?n.readParentInfo()?n.readString():n.readLeftID():null,l&&(a&po)===po?n.readString():null,Tp(n,a));yield u,s+=u.length}else{const l=n.readLen();yield new Vn(Xe(i,s),l),s+=l}}}}class ju{constructor(e,t){this.gen=Nw(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===qn);return this.curr}}class Pu{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const Mw=n=>nl(n,Ig,So),Dw=(n,e)=>{if(n.constructor===Vn){const{client:t,clock:r}=n.id;return new Vn(Xe(t,r+e),n.length-e)}else if(n.constructor===qn){const{client:t,clock:r}=n.id;return new qn(Xe(t,r+e),n.length-e)}else{const t=n,{client:r,clock:i}=t.id;return new Et(Xe(r,i+e),null,Xe(r,i+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},nl=(n,e=ms,t=Li)=>{if(n.length===1)return n[0];const r=n.map(g=>new e(sr(g)));let i=r.map(g=>new ju(g,!0)),s=null;const o=new t,a=new Pu(o);for(;i=i.filter(f=>f.curr!==null),i.sort((f,m)=>{if(f.curr.id.client===m.curr.id.client){const y=f.curr.id.clock-m.curr.id.clock;return y===0?f.curr.constructor===m.curr.constructor?0:f.curr.constructor===qn?1:-1:y}else return m.curr.id.client-f.curr.id.client}),i.length!==0;){const g=i[0],d=g.curr.id.client;if(s!==null){let f=g.curr,m=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=g.next(),m=!0;if(f===null||f.id.client!==d||m&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)si(a,s.struct,s.offset),s={struct:f,offset:0},g.next();else if(s.struct.id.clock+s.struct.length<f.id.clock)if(s.struct.constructor===qn)s.struct.length=f.id.clock+f.length-s.struct.id.clock;else{si(a,s.struct,s.offset);const y=f.id.clock-s.struct.id.clock-s.struct.length;s={struct:new qn(Xe(d,s.struct.id.clock+s.struct.length),y),offset:0}}else{const y=s.struct.id.clock+s.struct.length-f.id.clock;y>0&&(s.struct.constructor===qn?s.struct.length-=y:f=Dw(f,y)),s.struct.mergeWith(f)||(si(a,s.struct,s.offset),s={struct:f,offset:0},g.next())}}else s={struct:g.curr,offset:0},g.next();for(let f=g.curr;f!==null&&f.id.client===d&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==qn;f=g.next())si(a,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(si(a,s.struct,s.offset),s=null),Fu(a);const l=r.map(g=>Iu(g)),u=Au(l);return ps(o,u),o.toUint8Array()},Aw=(n,e,t=ms,r=Li)=>{const i=jg(e),s=new r,o=new Pu(s),a=new t(sr(n)),l=new ju(a,!1);for(;l.curr;){const g=l.curr,d=g.id.client,f=i.get(d)||0;if(l.curr.constructor===qn){l.next();continue}if(g.id.clock+g.length>f)for(si(o,g,Di(f-g.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)si(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=f;)l.next()}Fu(o);const u=Iu(a);return ps(s,u),s.toUint8Array()},Qg=n=>{n.written>0&&(n.clientStructs.push({written:n.written,restEncoder:at(n.encoder.restEncoder)}),n.encoder.restEncoder=bt(),n.written=0)},si=(n,e,t)=>{n.written>0&&n.currClient!==e.id.client&&Qg(n),n.written===0&&(n.currClient=e.id.client,n.encoder.writeClient(e.id.client),je(n.encoder.restEncoder,e.id.clock+t)),e.write(n.encoder,t),n.written++},Fu=n=>{Qg(n);const e=n.encoder.restEncoder;je(e,n.clientStructs.length);for(let t=0;t<n.clientStructs.length;t++){const r=n.clientStructs[t];je(e,r.written),Va(e,r.restEncoder)}},Iw=(n,e,t,r)=>{const i=new t(sr(n)),s=new ju(i,!1),o=new r,a=new Pu(o);for(let u=s.curr;u!==null;u=s.next())si(a,e(u),0);Fu(a);const l=Iu(i);return ps(o,l),o.toUint8Array()},Rw=n=>Iw(n,Rb,ms,So),ep="You must not compute changes after the event-handler fired.";class rl{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Lw(this.currentTarget,this.target))}deletes(e){return xo(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw yr(ep);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=ou(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=ou(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=ou(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw yr(ep);const t=this.target,r=ri(),i=ri(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let u=t._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,i.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const Lw=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},fn=()=>{Eg("Invalid access: Add Yjs type to a document before reading data.")},tp=80;let zu=0;class Ow{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=zu++}}const jw=n=>{n.timestamp=zu++},np=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=zu++},Pw=(n,e,t)=>{if(n.length>=tp){const r=n.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return np(r,e,t),r}else{const r=new Ow(e,t);return n.push(r),r}},il=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>Wa(e-s.index)<Wa(e-o.index)?s:o);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,jw(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&Wa(t.index-i)<r.parent.length/tp?(np(t,r,i),t):Pw(n._searchMarker,r,i)},To=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=Di(e,i.index+t))}},sl=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Ln(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;Ug(r._eH,t,e)};class sn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Fg(),this._dEH=Fg(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw _r()}clone(){throw _r()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){zg(this._eH,e)}observeDeep(e){zg(this._dEH,e)}unobserve(e){Bg(this._eH,e)}unobserveDeep(e){Bg(this._dEH,e)}toJSON(){}}const rp=(n,e,t)=>{n.doc??fn(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},ip=n=>{n.doc??fn();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},Eo=(n,e)=>{let t=0,r=n._start;for(n.doc??fn();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],t++,n)}r=r.right}},sp=(n,e)=>{const t=[];return Eo(n,(r,i)=>{t.push(e(r,i,n))}),t},Fw=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},op=(n,e)=>{n.doc??fn();const t=il(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},ol=(n,e,t,r)=>{let i=t;const s=n.doc,o=s.clientID,a=s.store,l=t===null?e._start:t.right;let u=[];const g=()=>{u.length>0&&(i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Fi(u)),i.integrate(n,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(g(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new ko(new Uint8Array(d))),i.integrate(n,0);break;case Br:i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Mo(d)),i.integrate(n,0);break;default:if(d instanceof sn)i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Cr(d)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),g()},ap=()=>yr("Length exceeded!"),lp=(n,e,t,r)=>{if(t>e._length)throw ap();if(t===0)return e._searchMarker&&To(e._searchMarker,t,r.length),ol(n,e,null,r);const i=t,s=il(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&En(n,Xe(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&To(e._searchMarker,i,r.length),ol(n,e,o,r)},zw=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return ol(n,e,i,t)},cp=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=il(e,t);let a=e._start;for(o!==null&&(a=o.p,t-=o.index);a!==null&&t>0;a=a.right)!a.deleted&&a.countable&&(t<a.length&&En(n,Xe(a.id.client,a.id.clock+t)),t-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&En(n,Xe(a.id.client,a.id.clock+r)),a.delete(n),r-=a.length),a=a.right;if(r>0)throw ap();e._searchMarker&&To(e._searchMarker,i,-s+r)},al=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Bu=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let a;if(r==null)a=new Fi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:a=new Fi([r]);break;case Uint8Array:a=new ko(r);break;case Br:a=new Mo(r);break;default:if(r instanceof sn)a=new Cr(r);else throw new Error("Unexpected content type")}new Et(Xe(o,Ht(s.store,o)),i,i&&i.lastId,null,null,e,t,a).integrate(n,0)},Uu=(n,e)=>{n.doc??fn();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},up=n=>{const e={};return n.doc??fn(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},dp=(n,e)=>{n.doc??fn();const t=n._map.get(e);return t!==void 0&&!t.deleted},Bw=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&bs(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},ll=n=>(n.doc??fn(),Zb(n._map.entries(),e=>!e[1].deleted));class Uw extends rl{}class vs extends sn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new vs;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new vs}clone(){const e=new vs;return e.insert(0,this.toArray().map(t=>t instanceof sn?t.clone():t)),e}get length(){return this.doc??fn(),this._length}_callObserver(e,t){super._callObserver(e,t),sl(this,e,new Uw(this,e))}insert(e,t){this.doc!==null?Tt(this.doc,r=>{lp(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Tt(this.doc,t=>{zw(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Tt(this.doc,r=>{cp(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return op(this,e)}toArray(){return ip(this)}slice(e=0,t=this.length){return rp(this,e,t)}toJSON(){return this.map(e=>e instanceof sn?e.toJSON():e)}map(e){return sp(this,e)}forEach(e){Eo(this,e)}[Symbol.iterator](){return Fw(this)}_write(e){e.writeTypeRef(cv)}}const Hw=n=>new vs;class fp extends rl{constructor(e,t,r){super(e,t),this.keysChanged=r}}class Pn extends sn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new Pn}clone(){const e=new Pn;return this.forEach((t,r)=>{e.set(r,t instanceof sn?t.clone():t)}),e}_callObserver(e,t){sl(this,e,new fp(this,e,t))}toJSON(){this.doc??fn();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof sn?i.toJSON():i}}),e}get size(){return[...ll(this)].length}keys(){return Nu(ll(this),e=>e[0])}values(){return Nu(ll(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Nu(ll(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??fn(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Tt(this.doc,t=>{al(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Tt(this.doc,r=>{Bu(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Uu(this,e)}has(e){return dp(this,e)}clear(){this.doc!==null?Tt(this.doc,e=>{this.forEach(function(t,r,i){al(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(uv)}}const Ww=n=>new Pn,oi=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&Db(n,e);class Hu{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&ir(),this.right.content.constructor){case Xt:this.right.deleted||xs(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const hp=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case Xt:e.right.deleted||xs(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t<e.right.length&&En(n,Xe(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},cl=(n,e,t,r)=>{const i=new Map,s=r?il(e,t):null;if(s){const o=new Hu(s.p.left,s.p,s.index,i);return hp(n,o,t-s.index)}else{const o=new Hu(null,e._start,0,i);return hp(n,o,t)}},gp=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===Xt&&oi(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,a)=>{const l=t.left,u=t.right,g=new Et(Xe(s,Ht(i.store,s)),l,l&&l.lastId,u,u&&u.id,e,null,new Xt(a,o));g.integrate(n,0),t.right=g,t.forward()})},xs=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},pp=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===Xt&&oi(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},mp=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],u=t.currentAttributes.get(a)??null;if(!oi(u,l)){o.set(a,u);const{left:g,right:d}=t;t.right=new Et(Xe(s,Ht(i.store,s)),g,g&&g.lastId,d,d&&d.id,e,null,new Xt(a,l)),t.right.integrate(n,0),t.forward()}}return o},Wu=(n,e,t,r,i)=>{t.currentAttributes.forEach((f,m)=>{i[m]===void 0&&(i[m]=null)});const s=n.doc,o=s.clientID;pp(t,i);const a=mp(n,e,t,i),l=r.constructor===String?new xr(r):r instanceof sn?new Cr(r):new Pi(r);let{left:u,right:g,index:d}=t;e._searchMarker&&To(e._searchMarker,t.index,l.getLength()),g=new Et(Xe(o,Ht(s.store,o)),u,u&&u.lastId,g,g&&g.id,e,null,l),g.integrate(n,0),t.right=g,t.index=d,t.forward(),gp(n,e,t,a)},yp=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;pp(t,i);const a=mp(n,e,t,i);e:for(;t.right!==null&&(r>0||a.size>0&&(t.right.deleted||t.right.content.constructor===Xt));){if(!t.right.deleted)switch(t.right.content.constructor){case Xt:{const{key:l,value:u}=t.right.content,g=i[l];if(g!==void 0){if(oi(g,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}t.right.delete(n)}else t.currentAttributes.set(l,u);break}default:r<t.right.length&&En(n,Xe(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
39
+ `?r.push(as()):o===" "?r.push(fo()):r.push(Bt(o))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,i=this.format,s=this.style;let o=t,a=r;!this.isCollapsed()&&r.isBefore(t)&&(o=r,a=t),o.type==="element"&&function(C,S,A,v){const k=C.getNode(),T=k.getChildAtIndex(C.offset),N=Bt(),h=dn(k)?_t().append(N):N;N.setFormat(A),N.setStyle(v),T===null?k.append(h):T.insertBefore(h),C.is(S)&&S.set(N.__key,0,"text"),C.set(N.__key,0,"text")}(o,a,i,s);const l=o.offset;let u=a.offset;const g=this.getNodes(),d=g.length;let f=g[0];me(f)||Me(26);const m=f.getTextContent().length,y=f.getParentOrThrow();let b=g[d-1];if(d===1&&a.type==="element"&&(u=m,a.set(o.key,u,"text")),this.isCollapsed()&&l===m&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!y.canInsertTextAfter()&&f.getNextSibling()===null)){let C=f.getNextSibling();if(me(C)&&C.canInsertTextBefore()&&!ns(C)||(C=Bt(),C.setFormat(i),C.setStyle(s),y.canInsertTextAfter()?f.insertAfter(C):y.insertAfter(C)),C.select(0,0),f=C,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&l===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!y.canInsertTextBefore()&&f.getPreviousSibling()===null)){let C=f.getPreviousSibling();if(me(C)&&!ns(C)||(C=Bt(),C.setFormat(i),y.canInsertTextBefore()?f.insertBefore(C):y.insertBefore(C)),C.select(),f=C,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&l!==m){const C=Bt(f.getTextContent());C.setFormat(i),f.replace(C),f=C}else if(!this.isCollapsed()&&e!==""){const C=b.getParent();if(!y.canInsertTextBefore()||!y.canInsertTextAfter()||ie(C)&&(!C.canInsertTextBefore()||!C.canInsertTextAfter()))return this.insertText(""),Nh(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const v=Bt(e);return v.select(),void f.replace(v)}const C=f.getFormat(),S=f.getStyle();if(l!==u||C===i&&S===s){if(j0(f)){const v=Bt(e);return v.setFormat(i),v.setStyle(s),v.select(),void f.replace(v)}}else{if(f.getTextContent()!==""){const v=Bt(e);if(v.setFormat(i),v.setStyle(s),v.select(),l===0)f.insertBefore(v,!1);else{const[k]=f.splitText(l);k.insertAfter(v,!1)}return void(v.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(i),f.setStyle(s)}const A=u-l;f=f.spliceText(l,A,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=C,this.style=S))}else{const C=new Set([...f.getParentKeys(),...b.getParentKeys()]),S=ie(f)?f:f.getParentOrThrow();let A=ie(b)?b:b.getParentOrThrow(),v=b;if(!S.is(A)&&A.isInline())do v=A,A=A.getParentOrThrow();while(A.isInline());if(a.type==="text"&&(u!==0||b.getTextContent()==="")||a.type==="element"&&b.getIndexWithinParent()<u)if(me(b)&&!b.isToken()&&u!==b.getTextContentSize()){if(b.isSegmented()){const I=Bt(b.getTextContent());b.replace(I),b=I}dn(a.getNode())||a.type!=="text"||(b=b.spliceText(0,u,"")),C.add(b.__key)}else{const I=b.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?b.remove():I.remove()}else C.add(b.__key);const k=A.getChildren(),T=new Set(g),N=S.is(A),h=S.isInline()&&f.getNextSibling()===null?S:f;for(let I=k.length-1;I>=0;I--){const O=k[I];if(O.is(f)||ie(O)&&O.isParentOf(f))break;O.isAttached()&&(!T.has(O)||O.is(v)?N||h.insertAfter(O,!1):O.remove())}if(!N){let I=A,O=null;for(;I!==null;){const j=I.getChildren(),P=j.length;(P===0||j[P-1].is(O))&&(C.delete(I.__key),O=I),I=I.getParent()}}if(f.isToken())if(l===m)f.select();else{const I=Bt(e);I.select(),f.replace(I)}else f=f.spliceText(l,m-l,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let I=1;I<d;I++){const O=g[I],j=O.__key;C.has(j)||O.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void nn(null);const t=this.getNodes(),r=[];for(const A of t)me(A)&&r.push(A);const i=r.length;if(i===0)return this.toggleFormat(e),void nn(null);const s=this.anchor,o=this.focus,a=this.isBackward(),l=a?o:s,u=a?s:o;let g=0,d=r[0],f=l.type==="element"?0:l.offset;if(l.type==="text"&&f===d.getTextContentSize()&&(g=1,d=r[1],f=0),d==null)return;const m=d.getFormatFlags(e,null),y=i-1;let b=r[y];const C=u.type==="text"?u.offset:b.getTextContentSize();if(d.is(b)){if(f===C)return;if(ns(d)||f===0&&C===d.getTextContentSize())d.setFormat(m);else{const A=d.splitText(f,C),v=f===0?A[0]:A[1];v.setFormat(m),l.type==="text"&&l.set(v.__key,0,"text"),u.type==="text"&&u.set(v.__key,C-f,"text")}return void(this.format=m)}f===0||ns(d)||([,d]=d.splitText(f),f=0),d.setFormat(m);const S=b.getFormatFlags(e,m);C>0&&(C===b.getTextContentSize()||ns(b)||([b]=b.splitText(C)),b.setFormat(S));for(let A=g+1;A<y;A++){const v=r[A],k=v.getFormatFlags(e,S);v.setFormat(k)}l.type==="text"&&l.set(d.__key,f,"text"),u.type==="text"&&u.set(b.__key,C,"text"),this.format=m|S}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const y=he();return de(y)||Me(134),y.insertNodes(e)}const t=Ic((this.isBackward()?this.focus:this.anchor).getNode(),is),r=e[e.length-1];if("__language"in t&&ie(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const y=Qc(this);t.splice(y,0,e),r.selectEnd()}return}if(!e.some(y=>(ie(y)||gt(y))&&!y.isInline())){ie(t)||Me(135);const y=Qc(this);return t.splice(y,0,e),void r.selectEnd()}const i=function(y){const b=_t();let C=null;for(let S=0;S<y.length;S++){const A=y[S],v=hr(A);if(v||gt(A)&&A.isInline()||ie(A)&&A.isInline()||me(A)||A.isParentRequired()){if(C===null&&(C=A.createParentElementNode(),b.append(C),v))continue;C!==null&&C.append(A)}else b.append(A),C=null}return b}(e),s=i.getLastDescendant(),o=i.getChildren(),a=y=>"__value"in y&&"__checked"in y,l=!ie(t)||!t.isEmpty()?this.insertParagraph():null,u=o[o.length-1];let g=o[0];var d;ie(d=g)&&is(d)&&!d.isEmpty()&&ie(t)&&(!t.isEmpty()||a(t))&&(ie(t)||Me(135),t.append(...g.getChildren()),g=o[1]),g&&function(y,b,C){const S=b.getParentOrThrow().getLastChild();let A=b;const v=[b];for(;A!==S;)A.getNextSibling()||Me(140),A=A.getNextSibling(),v.push(A);let k=y;for(const T of v)k=k.insertAfter(T)}(t,g);const f=Ic(s,is);l&&ie(f)&&(a(l)||is(u))&&(f.append(...l.getChildren()),l.remove()),ie(t)&&t.isEmpty()&&t.remove(),s.selectEnd();const m=ie(t)?t.getLastChild():null;hr(m)&&f!==t&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=_t();return dt().splice(this.anchor.offset,0,[o]),o.select(),o}const e=Qc(this),t=Ic(this.anchor.getNode(),is);ie(t)||Me(136);const r=t.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const t=as();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),i=t.getIndexWithinParent();r.select(i,i)}}extract(){const e=this.getNodes(),t=e.length,r=t-1,i=this.anchor,s=this.focus;let o=e[0],a=e[r];const[l,u]=Xc(this);if(t===0)return[];if(t===1){if(me(o)&&!this.isCollapsed()){const d=l>u?u:l,f=l>u?l:u,m=o.splitText(d,f),y=d===0?m[0]:m[1];return y!=null?[y]:[]}return[o]}const g=i.isBefore(s);if(me(o)){const d=g?l:u;d===o.getTextContentSize()?e.shift():d!==0&&([,o]=o.splitText(d),e[0]=o)}if(me(a)){const d=a.getTextContent().length,f=g?u:l;f===0?e.pop():f!==d&&([a]=a.splitText(f),e[r]=a)}return e}modify(e,t,r){const i=this.focus,s=this.anchor,o=e==="move",a=to(i,t);if(gt(a)&&!a.isIsolated()){if(o&&a.isKeyboardSelectable()){const m=Zc();return m.add(a.__key),void Nt(m)}const f=t?a.getPreviousSibling():a.getNextSibling();if(me(f)){const m=f.__key,y=t?f.getTextContent().length:0;return i.set(m,y,"text"),void(o&&s.set(m,y,"text"))}{const m=a.getParentOrThrow();let y,b;return ie(f)?(b=f.__key,y=t?f.getChildrenSize():0):(y=a.getIndexWithinParent(),b=m.__key,t||y++),i.set(b,y,"element"),void(o&&s.set(b,y,"element"))}}const l=Ut(),u=fr(l._window);if(!u)return;const g=l._blockCursorElement,d=l._rootElement;if(d===null||g===null||!ie(a)||a.isInline()||a.canBeEmpty()||Ac(g,l,d),function(f,m,y,b){f.modify(m,y,b)}(u,e,t?"backward":"forward",r),u.rangeCount>0){const f=u.getRangeAt(0),m=this.anchor.getNode(),y=dn(m)?m:w0(m);if(this.applyDOMRange(f),this.dirty=!0,!o){const b=this.getNodes(),C=[];let S=!1;for(let A=0;A<b.length;A++){const v=b[A];Ca(v,y)?C.push(v):S=!0}if(S&&C.length>0)if(t){const A=C[0];ie(A)?A.selectStart():A.getParentOrThrow().selectStart()}else{const A=C[C.length-1];ie(A)?A.selectEnd():A.getParentOrThrow().selectEnd()}u.anchorNode===f.startContainer&&u.anchorOffset===f.startOffset||function(A){const v=A.focus,k=A.anchor,T=k.key,N=k.offset,h=k.type;Qr(k,v.key,v.offset,v.type),Qr(v,T,N,h),A._cachedNodes=null}(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&ie(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const i=t.getParent(),s=t.getNextSibling()||(i===null?null:i.getNextSibling());if(ie(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let i=r.getNode();if(this.forwardDeletion(r,i,e))return;const s=this.focus,o=to(s,e);if(gt(o)&&!o.isIsolated()){if(o.isKeyboardSelectable()&&ie(i)&&i.getChildrenSize()===0){i.remove();const a=Zc();a.add(o.__key),Nt(a)}else o.remove(),Ut().dispatchCommand(Hn,void 0);return}if(!e&&ie(o)&&ie(i)&&i.isEmpty())return i.remove(),void o.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&(r.type==="element"?r.getNode():r.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const a=s.type==="text"?s.getNode():null;if(i=r.type==="text"?r.getNode():null,a!==null&&a.isSegmented()){const l=s.offset,u=a.getTextContentSize();if(a.is(i)||e&&l!==u||!e&&l!==0)return void Th(a,e,l)}else if(i!==null&&i.isSegmented()){const l=r.offset,u=i.getTextContentSize();if(i.is(a)||e&&l!==0||!e&&l!==u)return void Th(i,e,l)}(function(l,u){const g=l.anchor,d=l.focus,f=g.getNode(),m=d.getNode();if(f===m&&g.type==="text"&&d.type==="text"){const y=g.offset,b=d.offset,C=y<b,S=C?y:b,A=C?b:y,v=A-1;S!==v&&(Wf(f.getTextContent().slice(S,A))||(u?d.offset=v:g.offset=v))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&dn(r.getParent())&&r.getIndexWithinParent()===0&&r.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){const r=e?this.anchor:this.focus;r.set(r.key,r.offset+1,r.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Dt(n){return n instanceof La}function Sh(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function Xc(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[Sh(t),Sh(r)]}function Th(n,e,t){const r=n,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,a=0;for(let u=0;u<s;u++){const g=u===s-1;if(a=o,o+=i[u].length,e&&o===t||o>t||g){i.splice(u,1),g&&(a=void 0);break}}const l=i.join("").trim();l===""?r.remove():(r.setTextContent(l),r.select(a,a))}function Eh(n,e,t,r){let i,s=e;if(n.nodeType===Gs){let o=!1;const a=n.childNodes,l=a.length,u=r._blockCursorElement;s===l&&(o=!0,s=l-1);let g=a[s],d=!1;if(g===u)g=a[s+1],d=!0;else if(u!==null){const f=u.parentNode;n===f&&e>Array.prototype.indexOf.call(f.children,u)&&s--}if(i=rs(g),me(i))s=Hf(i,o);else{let f=rs(n);if(f===null)return null;if(ie(f)){s=Math.min(f.getChildrenSize(),s);let m=f.getChildAtIndex(s);if(ie(m)&&function(y,b,C){const S=y.getParent();return C===null||S===null||!S.canBeEmpty()||S!==C.getNode()}(m,0,t)){const y=o?m.getLastDescendant():m.getFirstDescendant();y===null?f=m:(m=y,f=ie(m)?m:m.getParentOrThrow()),s=0}me(m)?(i=m,f=null,s=Hf(m,o)):m!==f&&o&&!d&&s++}else{const m=f.getIndexWithinParent();s=e===0&&gt(f)&&rs(n)===f?m:m+1,f=f.getParentOrThrow()}if(ie(f))return Wn(f.__key,s,"element")}}else i=rs(n);return me(i)?Wn(i.__key,s,"text"):null}function kh(n,e,t){const r=n.offset,i=n.getNode();if(r===0){const s=i.getPreviousSibling(),o=i.getParent();if(e){if((t||!e)&&s===null&&ie(o)&&o.isInline()){const a=o.getPreviousSibling();me(a)&&(n.key=a.__key,n.offset=a.getTextContent().length)}}else ie(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):me(s)&&(n.key=s.__key,n.offset=s.getTextContent().length)}else if(r===i.getTextContent().length){const s=i.getNextSibling(),o=i.getParent();if(e&&ie(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&ie(o)&&o.isInline()&&!o.canInsertTextAfter()){const a=o.getNextSibling();me(a)&&(n.key=a.__key,n.offset=0)}}}function Nh(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),i=n.is(e);kh(n,r,i),kh(e,!r,i),i&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=Ut();if(s.isComposing()&&s._compositionKey!==n.key&&de(t)){const o=t.anchor,a=t.focus;Qr(n,o.key,o.offset,o.type),Qr(e,a.key,a.offset,a.type)}}}function Mh(n,e,t,r,i,s){if(n===null||t===null||!Xs(i,n,t))return null;const o=Eh(n,e,de(s)?s.anchor:null,i);if(o===null)return null;const a=Eh(t,r,de(s)?s.focus:null,i);if(a===null)return null;if(o.type==="element"&&a.type==="element"){const l=rs(n),u=rs(t);if(gt(l)&&gt(u))return null}return Nh(o,a,s),[o,a]}function Jc(n){return ie(n)&&!n.isInline()}function Dh(n,e,t,r,i,s){const o=gr(),a=new ei(Wn(n,e,i),Wn(t,r,s),0,"");return a.dirty=!0,o._selection=a,a}function Oa(){const n=Wn("root",0,"element"),e=Wn("root",0,"element");return new ei(n,e,0,"")}function Zc(){return new La(new Set)}function F0(n,e){return ja(null,n,e,null)}function ja(n,e,t,r){const i=t._window;if(i===null)return null;const s=r||i.event,o=s?s.type:void 0,a=o==="selectionchange",l=!bc&&(a||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&s&&s.detail===3||o==="drop"||o===void 0);let u,g,d,f;if(de(n)&&!l)return n.clone();if(e===null)return null;if(u=e.anchorNode,g=e.focusNode,d=e.anchorOffset,f=e.focusOffset,a&&de(n)&&!Xs(t,u,g))return n.clone();const m=Mh(u,d,g,f,t,n);if(m===null)return null;const[y,b]=m;return new ei(y,b,de(n)?n.format:0,de(n)?n.style:"")}function he(){return gr()._selection}function ti(){return Ut()._editorState._selection}function Pa(n,e,t,r=1){const i=n.anchor,s=n.focus,o=i.getNode(),a=s.getNode();if(!e.is(o)&&!e.is(a))return;const l=e.__key;if(n.isCollapsed()){const u=i.offset;if(t<=u&&r>0||t<u&&r<0){const g=Math.max(0,u+r);i.set(l,g,"element"),s.set(l,g,"element"),Ah(n)}}else{const u=n.isBackward(),g=u?s:i,d=g.getNode(),f=u?i:s,m=f.getNode();if(e.is(d)){const y=g.offset;(t<=y&&r>0||t<y&&r<0)&&g.set(l,Math.max(0,y+r),"element")}if(e.is(m)){const y=f.offset;(t<=y&&r>0||t<y&&r<0)&&f.set(l,Math.max(0,y+r),"element")}}Ah(n)}function Ah(n){const e=n.anchor,t=e.offset,r=n.focus,i=r.offset,s=e.getNode(),o=r.getNode();if(n.isCollapsed()){if(!ie(s))return;const a=s.getChildrenSize(),l=t>=a,u=l?s.getChildAtIndex(a-1):s.getChildAtIndex(t);if(me(u)){let g=0;l&&(g=u.getTextContentSize()),e.set(u.__key,g,"text"),r.set(u.__key,g,"text")}}else{if(ie(s)){const a=s.getChildrenSize(),l=t>=a,u=l?s.getChildAtIndex(a-1):s.getChildAtIndex(t);if(me(u)){let g=0;l&&(g=u.getTextContentSize()),e.set(u.__key,g,"text")}}if(ie(o)){const a=o.getChildrenSize(),l=i>=a,u=l?o.getChildAtIndex(a-1):o.getChildAtIndex(i);if(me(u)){let g=0;l&&(g=u.getTextContentSize()),r.set(u.__key,g,"text")}}}}function Fa(n,e,t,r,i){let s=null,o=0,a=null;r!==null?(s=r.__key,me(r)?(o=r.getTextContentSize(),a="text"):ie(r)&&(o=r.getChildrenSize(),a="element")):i!==null&&(s=i.__key,me(i)?a="text":ie(i)&&(a="element")),s!==null&&a!==null?n.set(s,o,a):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),n.set(t.__key,o,"element"))}function Ih(n,e,t,r,i){n.type==="text"?(n.key=t,e||(n.offset+=i)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function z0(n,e,t,r,i,s,o){const a=r.anchorNode,l=r.focusNode,u=r.anchorOffset,g=r.focusOffset,d=document.activeElement;if(i.has("collaboration")&&d!==s||d!==null&&Cc(d))return;if(!de(e))return void(n!==null&&Xs(t,a,l)&&r.removeAllRanges());const f=e.anchor,m=e.focus,y=f.key,b=m.key,C=va(t,y),S=va(t,b),A=f.offset,v=m.offset,k=e.format,T=e.style,N=e.isCollapsed();let h=C,I=S,O=!1;if(f.type==="text"){h=_a(C);const ue=f.getNode();O=ue.getFormat()!==k||ue.getStyle()!==T}else de(n)&&n.anchor.type==="text"&&(O=!0);var j,P,q,G,ee;if(m.type==="text"&&(I=_a(S)),h!==null&&I!==null&&(N&&(n===null||O||de(n)&&(n.format!==k||n.style!==T))&&(j=k,P=T,q=A,G=y,ee=performance.now(),lh=[j,P,q,G,ee]),u!==A||g!==v||a!==h||l!==I||r.type==="Range"&&N||(d!==null&&s.contains(d)||s.focus({preventScroll:!0}),f.type==="element"))){try{r.setBaseAndExtent(h,A,I,v)}catch{}if(!i.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const ue=e instanceof ei&&e.anchor.type==="element"?h.childNodes[A]||null:r.rangeCount>0?r.getRangeAt(0):null;if(ue!==null){let ae;if(ue instanceof Text){const ge=document.createRange();ge.selectNode(ue),ae=ge.getBoundingClientRect()}else ae=ue.getBoundingClientRect();(function(ge,Le,be){const oe=be.ownerDocument,fe=oe.defaultView;if(fe===null)return;let{top:Ce,bottom:Te}=Le,ve=0,Fe=0,De=be;for(;De!==null;){const ke=De===oe.body;if(ke)ve=0,Fe=Sa(ge).innerHeight;else{const xe=De.getBoundingClientRect();ve=xe.top,Fe=xe.bottom}let ze=0;if(Ce<ve?ze=-(ve-Ce):Te>Fe&&(ze=Te-Fe),ze!==0)if(ke)fe.scrollBy(0,ze);else{const xe=De.scrollTop;De.scrollTop+=ze;const Pe=De.scrollTop-xe;Ce-=Pe,Te-=Pe}if(ke)break;De=xa(De)}})(t,ae,s)}}Hc=!0}}function za(n){let e=he()||ti();e===null&&(e=dt().selectEnd()),e.insertNodes(n)}function Qc(n){let e=n;n.isCollapsed()||e.removeText();const t=he();de(t)&&(e=t),de(e)||Me(161);const r=e.anchor;let i=r.getNode(),s=r.offset;for(;!is(i);)[i,s]=B0(i,s);return s}function B0(n,e){const t=n.getParent();if(!t){const i=_t();return dt().append(i),i.select(),[dt(),0]}if(me(n)){const i=n.splitText(e);if(i.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,i[0].getIndexWithinParent()+s]}if(!ie(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const i=new ei(Wn(n.__key,e,"element"),Wn(n.__key,e,"element"),0,""),s=n.insertNewAfter(i);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let Zt=null,Qt=null,Cn=!1,eu=!1,Ba=0;const Rh={characterData:!0,childList:!0,subtree:!0};function ls(){return Cn||Zt!==null&&Zt._readOnly}function Sn(){Cn&&Me(13)}function Lh(){Ba>99&&Me(14)}function gr(){return Zt===null&&Me(15),Zt}function Ut(){return Qt===null&&Me(16),Qt}function U0(){return Qt}function Oh(n,e,t){const r=e.__type,i=function(a,l){const u=a._nodes.get(l);return u===void 0&&Me(30,l),u}(n,r);let s=t.get(r);s===void 0&&(s=Array.from(i.transforms),t.set(r,s));const o=s.length;for(let a=0;a<o&&(s[a](e),e.isAttached());a++);}function jh(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function H0(n){return tu(n,Ut()._nodes)}function tu(n,e){const t=n.type,r=e.get(t);r===void 0&&Me(17,t);const i=r.klass;n.type!==i.getType()&&Me(18,i.name);const s=i.importJSON(n),o=n.children;if(ie(s)&&Array.isArray(o))for(let a=0;a<o.length;a++){const l=tu(o[a],e);s.append(l)}return s}function Ph(n,e){const t=Zt,r=Cn,i=Qt;Zt=n,Cn=!0,Qt=null;try{return e()}finally{Zt=t,Cn=r,Qt=i}}function Mi(n,e){const t=n._pendingEditorState,r=n._rootElement,i=n._headless||r===null;if(t===null)return;const s=n._editorState,o=s._selection,a=t._selection,l=n._dirtyType!==Si,u=Zt,g=Cn,d=Qt,f=n._updating,m=n._observer;let y=null;if(n._pendingEditorState=null,n._editorState=t,!i&&l&&m!==null){Qt=n,Zt=t,Cn=!1,n._updating=!0;try{const N=n._dirtyType,h=n._dirtyElements,I=n._dirtyLeaves;m.disconnect(),y=N0(s,t,n,N,h,I)}catch(N){if(N instanceof Error&&n._onError(N),eu)throw N;return Wh(n,null,r,t),Af(n),n._dirtyType=ts,eu=!0,Mi(n,s),void(eu=!1)}finally{m.observe(r,Rh),n._updating=f,Zt=u,Cn=g,Qt=d}}t._readOnly||(t._readOnly=!0);const b=n._dirtyLeaves,C=n._dirtyElements,S=n._normalizedNodes,A=n._updateTags,v=n._deferred;l&&(n._dirtyType=Si,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(N,h){const I=N._decorators;let O=N._pendingDecorators||I;const j=h._nodeMap;let P;for(P in O)j.has(P)||(O===I&&(O=zf(N)),delete O[P])}(n,t);const k=i?null:fr(n._window);if(n._editable&&k!==null&&(l||a===null||a.dirty)){Qt=n,Zt=t;try{if(m!==null&&m.disconnect(),l||a===null||a.dirty){const N=n._blockCursorElement;N!==null&&Ac(N,n,r),z0(o,a,n,k,A,r)}x0(n,r,a),m!==null&&m.observe(r,Rh)}finally{Qt=d,Zt=u}}y!==null&&function(N,h,I,O,j){const P=Array.from(N._listeners.mutation),q=P.length;for(let G=0;G<q;G++){const[ee,ue]=P[G],ae=h.get(ue);ae!==void 0&&ee(ae,{dirtyLeaves:O,prevEditorState:j,updateTags:I})}}(n,y,A,b,s),de(a)||a===null||o!==null&&o.is(a)||n.dispatchCommand(Hn,void 0);const T=n._pendingDecorators;T!==null&&(n._decorators=T,n._pendingDecorators=null,ho("decorator",n,!0,T)),function(N,h,I){const O=Bf(h),j=Bf(I);O!==j&&ho("textcontent",N,!0,j)}(n,e||s,t),ho("update",n,!0,{dirtyElements:C,dirtyLeaves:b,editorState:t,normalizedNodes:S,prevEditorState:e||s,tags:A}),function(N,h){if(N._deferred=[],h.length!==0){const I=N._updating;N._updating=!0;try{for(let O=0;O<h.length;O++)h[O]()}finally{N._updating=I}}}(n,v),function(N){const h=N._updates;if(h.length!==0){const I=h.shift();if(I){const[O,j]=I;Bh(N,O,j)}}}(n)}function ho(n,e,t,...r){const i=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let o=0;o<s.length;o++)s[o].apply(null,r)}finally{e._updating=i}}function Fh(n,e,t){if(n._updating===!1||Qt!==n){let i=!1;return n.update(()=>{i=Fh(n,e,t)}),i}const r=Tc(n);for(let i=4;i>=0;i--)for(let s=0;s<r.length;s++){const o=r[s]._commands.get(e);if(o!==void 0){const a=o[i];if(a!==void 0){const l=Array.from(a),u=l.length;for(let g=0;g<u;g++)if(l[g](t,n)===!0)return!0}}}return!1}function zh(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const i=t.shift();if(i){const[s,o]=i;let a,l;o!==void 0&&(a=o.onUpdate,l=o.tag,o.skipTransforms&&(r=!0),a&&n._deferred.push(a),l&&n._updateTags.add(l)),s()}}return r}function Bh(n,e,t){const r=n._updateTags;let i,s,o=!1,a=!1;t!==void 0&&(i=t.onUpdate,s=t.tag,s!=null&&r.add(s),o=t.skipTransforms||!1,a=t.discrete||!1),i&&n._deferred.push(i);const l=n._editorState;let u=n._pendingEditorState,g=!1;(u===null||u._readOnly)&&(u=n._pendingEditorState=new Ua(new Map((u||l)._nodeMap)),g=!0),u._flushSync=a;const d=Zt,f=Cn,m=Qt,y=n._updating;Zt=u,Cn=!1,n._updating=!0,Qt=n;try{g&&(n._headless?l._selection!==null&&(u._selection=l._selection.clone()):u._selection=function(A){const v=A.getEditorState()._selection,k=fr(A._window);return de(v)||v==null?ja(v,k,A,null):v.clone()}(n));const C=n._compositionKey;e(),o=zh(n,o),function(A,v){const k=v.getEditorState()._selection,T=A._selection;if(de(T)){const N=T.anchor,h=T.focus;let I;if(N.type==="text"&&(I=N.getNode(),I.selectionTransform(k,T)),h.type==="text"){const O=h.getNode();I!==O&&O.selectionTransform(k,T)}}}(u,n),n._dirtyType!==Si&&(o?function(A,v){const k=v._dirtyLeaves,T=A._nodeMap;for(const N of k){const h=T.get(N);me(h)&&h.isAttached()&&h.isSimpleText()&&!h.isUnmergeable()&&Lf(h)}}(u,n):function(A,v){const k=v._dirtyLeaves,T=v._dirtyElements,N=A._nodeMap,h=Xr(),I=new Map;let O=k,j=O.size,P=T,q=P.size;for(;j>0||q>0;){if(j>0){v._dirtyLeaves=new Set;for(const G of O){const ee=N.get(G);me(ee)&&ee.isAttached()&&ee.isSimpleText()&&!ee.isUnmergeable()&&Lf(ee),ee!==void 0&&jh(ee,h)&&Oh(v,ee,I),k.add(G)}if(O=v._dirtyLeaves,j=O.size,j>0){Ba++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const G of P){const ee=G[0],ue=G[1];if(ee!=="root"&&!ue)continue;const ae=N.get(ee);ae!==void 0&&jh(ae,h)&&Oh(v,ae,I),T.set(ee,ue)}O=v._dirtyLeaves,j=O.size,P=v._dirtyElements,q=P.size,Ba++}v._dirtyLeaves=k,v._dirtyElements=T}(u,n),zh(n),function(A,v,k,T){const N=A._nodeMap,h=v._nodeMap,I=[];for(const[O]of T){const j=h.get(O);j!==void 0&&(j.isAttached()||(ie(j)&&Zf(j,O,N,h,I,T),N.has(O)||T.delete(O),I.push(O)))}for(const O of I)h.delete(O);for(const O of k){const j=h.get(O);j===void 0||j.isAttached()||(N.has(O)||k.delete(O),h.delete(O))}}(l,u,n._dirtyLeaves,n._dirtyElements)),C!==n._compositionKey&&(u._flushSync=!0);const S=u._selection;if(de(S)){const A=u._nodeMap,v=S.anchor.key,k=S.focus.key;A.get(v)!==void 0&&A.get(k)!==void 0||Me(19)}else Dt(S)&&S._nodes.size===0&&(u._selection=null)}catch(C){return C instanceof Error&&n._onError(C),n._pendingEditorState=l,n._dirtyType=ts,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Mi(n)}finally{Zt=d,Cn=f,Qt=m,n._updating=y,Ba=0}n._dirtyType!==Si||function(C,S){const A=S.getEditorState()._selection,v=C._selection;if(v!==null){if(v.dirty||!v.is(A))return!0}else if(A!==null)return!0;return!1}(u,n)?u._flushSync?(u._flushSync=!1,Mi(n)):g&&g0(()=>{Mi(n)}):(u._flushSync=!1,g&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Rn(n,e,t){n._updating?n._updates.push([e,t]):Bh(n,e,t)}class ni extends Ia{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__indent=0,this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return s0[e]||""}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Ut()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(me(t)&&e.push(t),ie(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;ie(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;ie(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return ie(s)&&s.getLastDescendant()||s||null}const i=t[e];return ie(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:tt(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&Me(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:tt(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&Me(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,i;if(e<t/2){for(r=this.getFirstChild(),i=0;r!==null&&i<=e;){if(i===e)return r;r=r.getNextSibling(),i++}return null}for(r=this.getLastChild(),i=t-1;r!==null&&i>=e;){if(i===e)return r;r=r.getPreviousSibling(),i--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContent(),ie(s)&&i!==r-1&&!s.isInline()&&(e+=Ir)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContentSize(),ie(s)&&i!==r-1&&!s.isInline()&&(e+=Ir.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Nf[e];return!!(this.getFormat()&t)}return!1}select(e,t){Sn();const r=he();let i=e,s=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const l=this.getFirstChild();if(me(l)||ie(l))return l.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const l=this.getLastChild();if(me(l)||ie(l))return l.select()}}i===void 0&&(i=o),s===void 0&&(s=o);const a=this.__key;return de(r)?(r.anchor.set(a,i,"element"),r.focus.set(a,s,"element"),r.dirty=!0,r):Dh(a,i,a,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Nf[e]:0,this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){const i=r.length,s=this.getChildrenSize(),o=this.getWritable(),a=o.__key,l=[],u=[],g=this.getChildAtIndex(e+t);let d=null,f=s-t+i;if(e!==0)if(e===s)d=this.getLastChild();else{const y=this.getChildAtIndex(e);y!==null&&(d=y.getPreviousSibling())}if(t>0){let y=d===null?this.getFirstChild():d.getNextSibling();for(let b=0;b<t;b++){y===null&&Me(100);const C=y.getNextSibling(),S=y.__key;Ti(y.getWritable()),u.push(S),y=C}}let m=d;for(let y=0;y<i;y++){const b=r[y];m!==null&&b.is(m)&&(d=m=m.getPreviousSibling());const C=b.getWritable();C.__parent===a&&f--,Ti(C);const S=b.__key;if(m===null)o.__first=S,C.__prev=null;else{const A=m.getWritable();A.__next=S,C.__prev=A.__key}b.__key===a&&Me(76),C.__parent=a,l.push(S),m=b}if(e+t===s)m!==null&&(m.getWritable().__next=null,o.__last=m.__key);else if(g!==null){const y=g.getWritable();if(m!==null){const b=m.getWritable();y.__prev=m.__key,b.__next=g.__key}else y.__prev=null}if(o.__size=f,u.length){const y=he();if(de(y)){const b=new Set(u),C=new Set(l),{anchor:S,focus:A}=y;Uh(S,b,C)&&Fa(S,S.getNode(),this,d,g),Uh(A,b,C)&&Fa(A,A.getNode(),this,d,g),f!==0||this.canBeEmpty()||un(this)||this.remove()}}return o}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}}function ie(n){return n instanceof ni}function Uh(n,e,t){let r=n.getNode();for(;r;){const i=r.__key;if(e.has(i)&&!t.has(i))return!0;r=r.getParent()}return!1}class nu extends Ia{constructor(e){super(e)}decorate(e,t){Me(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function gt(n){return n instanceof nu}class go extends ni{static getType(){return"root"}static clone(){return new go}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Me(51)}getTextContent(){const e=this.__cachedText;return!ls()&&Ut()._dirtyType!==Si||e===null?super.getTextContent():e}remove(){Me(52)}replace(e){Me(53)}insertBefore(e){Me(54)}insertAfter(e){Me(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const r=e[t];ie(r)||gt(r)||Me(56)}return super.append(...e)}static importJSON(e){const t=dt();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function dn(n){return n instanceof go}function ru(){return new Ua(new Map([["root",new go]]))}function Hh(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&Me(130,t.name),ie(n)){const r=e.children;Array.isArray(r)||Me(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const o=Hh(i[s]);r.push(o)}}return e}class Ua{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e){return Ph(this,e)}clone(e){const t=new Ua(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Ph(this,()=>({root:Hh(dt())}))}}class iu extends ni{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class cs extends ni{constructor(e){super(e),this.__textFormat=0}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Rr[e];return!!(this.getTextFormat()&t)}static clone(e){return new cs(e.__key)}createDOM(e){const t=document.createElement("p"),r=eo(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:W0,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&no(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const i=this.getDirection();i&&(t.dir=i);const s=this.getIndent();s>0&&(t.style.textIndent=20*s+"px")}return{element:t}}static importJSON(e){const t=_t();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),type:"paragraph",version:1}}insertNewAfter(e,t){const r=_t();r.setTextFormat(e.format);const i=this.getDirection();return r.setDirection(i),r.setFormat(this.getFormatType()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||me(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function W0(n){const e=_t();if(n.style){e.setFormat(n.style.textAlign);const t=parseInt(n.style.textIndent,10)/20;t>0&&e.setIndent(t)}return{node:e}}function _t(){return dr(new cs)}function us(n){return n instanceof cs}const ot=0,rn=1,$n=3,rr=4;function Wh(n,e,t,r){const i=n._keyToDOMMap;i.clear(),n._editorState=ru(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=Si,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",i.set("root",t))}function Ha(n){const e=n||{},t=U0(),r=e.theme||{},i=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,o=ru(),a=e.namespace||(i!==null?i._config.namespace:$f()),l=e.editorState,u=[go,Ni,co,uo,cs,iu,...e.nodes||[]],{onError:g,html:d}=e,f=e.editable===void 0||e.editable;let m;if(n===void 0&&t!==null)m=t._nodes;else{m=new Map;for(let b=0;b<u.length;b++){let C=u[b],S=null,A=null;if(typeof C!="function"){const N=C;C=N.replace,S=N.with,A=N.withKlass||null}const v=C.getType(),k=C.transform(),T=new Set;k!==null&&T.add(k),m.set(v,{exportDOM:d&&d.export?d.export.get(C):void 0,klass:C,replace:S,replaceWithKlass:A,transforms:T})}}const y=new $0(o,i,m,{disableEvents:s,namespace:a,theme:r},g||console.error,function(b,C){const S=new Map,A=new Set,v=k=>{Object.keys(k).forEach(T=>{let N=S.get(T);N===void 0&&(N=[],S.set(T,N)),N.push(k[T])})};return b.forEach(k=>{const T=k.klass.importDOM;if(T==null||A.has(T))return;A.add(T);const N=T.call(k.klass);N!==null&&v(N)}),C&&v(C),S}(m,d?d.import:void 0),f);return l!==void 0&&(y._pendingEditorState=l,y._dirtyType=ts),y}class $0{constructor(e,t,r,i,s,o,a){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=Si,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=$f(),this._onError=s,this._htmlConversions=o,this._editable=a,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){r===void 0&&Me(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);s===void 0&&Me(36,String(e));const o=s[r];return o.add(t),()=>{o.delete(t),s.every(a=>a.size===0)&&i.delete(e)}}registerMutationListener(e,t){let r=this._nodes.get(e.getType());r===void 0&&Me(37,e.name);let i=e,s=null;for(;s=r.replaceWithKlass;)i=s,r=this._nodes.get(s.getType()),r===void 0&&Me(37,s.name);const o=this._listeners.mutation;return o.set(t,i),()=>{o.delete(t)}}registerNodeTransformToKlass(e,t){const r=e.getType(),i=this._nodes.get(r);return i===void 0&&Me(37,e.name),i.transforms.add(t),i}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),i=[r],s=r.replaceWithKlass;if(s!=null){const l=this.registerNodeTransformToKlass(s,t);i.push(l)}var o,a;return o=this,a=e.getType(),Rn(o,()=>{const l=gr();if(l.isEmpty())return;if(a==="root")return void dt().markDirty();const u=l._nodeMap;for(const[,g]of u)g.markDirty()},o._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{i.forEach(l=>l.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return Oe(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=eo(this._config.theme,"root"),i=this._pendingEditorState||this._editorState;if(this._rootElement=e,Wh(this,t,e,i),t!==null&&(this._config.disableEvents||M0(t),r!=null&&t.classList.remove(...r)),e!==null){const s=function(a){const l=a.ownerDocument;return l&&l.defaultView||null}(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=ts,Af(this),this._updateTags.add("history-merge"),Mi(this),this._config.disableEvents||function(a,l){const u=a.ownerDocument,g=Aa.get(u);(g===void 0||g<1)&&u.addEventListener("selectionchange",gh),Aa.set(u,(g||0)+1),a.__lexicalEditor=l;const d=hh(a);for(let f=0;f<Uc.length;f++){const[m,y]=Uc[f],b=typeof y=="function"?C=>{mh(C)||(ph(C),(l.isEditable()||m==="click")&&y(C,l))}:C=>{if(mh(C))return;ph(C);const S=l.isEditable();switch(m){case"cut":return S&&Oe(l,ac,C);case"copy":return Oe(l,da,C);case"paste":return S&&Oe(l,oa,C);case"dragstart":return S&&Oe(l,es,C);case"dragover":return S&&Oe(l,ua,C);case"dragend":return S&&Oe(l,V_,C);case"focus":return S&&Oe(l,cc,C);case"blur":return S&&Oe(l,Cf,C);case"drop":return S&&Oe(l,ca,C)}};a.addEventListener(m,b),d.push(()=>{a.removeEventListener(m,b)})}}(e,this),r!=null&&e.classList.add(...r)}else this._editorState=i,this._pendingEditorState=null,this._window=null;ho("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&Me(38),Df(this);const r=this._pendingEditorState,i=this._updateTags,s=t!==void 0?t.tag:null;r===null||r.isEmpty()||(s!=null&&i.add(s),Mi(this)),this._pendingEditorState=e,this._dirtyType=ts,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&i.add(s),Mi(this)}parseEditorState(e,t){return function(r,i,s){const o=ru(),a=Zt,l=Cn,u=Qt,g=i._dirtyElements,d=i._dirtyLeaves,f=i._cloneNotNeeded,m=i._dirtyType;i._dirtyElements=new Map,i._dirtyLeaves=new Set,i._cloneNotNeeded=new Set,i._dirtyType=0,Zt=o,Cn=!1,Qt=i;try{const y=i._nodes;tu(r.root,y),s&&s(),o._readOnly=!0}catch(y){y instanceof Error&&i._onError(y)}finally{i._dirtyElements=g,i._dirtyLeaves=d,i._cloneNotNeeded=f,i._dirtyType=m,Zt=a,Cn=l,Qt=u}return o}(typeof e=="string"?JSON.parse(e):e,this,t)}update(e,t){Rn(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Rn(this,()=>{const i=he(),s=dt();i!==null?i.dirty=!0:s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=fr(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ho("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}const Tn=()=>new Map,su=n=>{const e=Tn();return n.forEach((t,r)=>{e.set(r,t)}),e},Ln=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},Y0=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},V0=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},ri=()=>new Set,ou=n=>n[n.length-1],q0=(n,e)=>{for(let t=0;t<e.length;t++)n.push(e[t])},jr=Array.from,K0=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},au=Array.isArray;class lu{constructor(){this._observers=Tn()}on(e,t){return Ln(this._observers,e,ri).add(t),t}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return jr((this._observers.get(e)||Tn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Tn()}}class cu{constructor(){this._observers=Tn()}on(e,t){Ln(this._observers,e,ri).add(t)}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return jr((this._observers.get(e)||Tn()).values()).forEach(r=>r(...t))}destroy(){this._observers=Tn()}}const pr=Math.floor,Wa=Math.abs,G0=Math.log10,$a=(n,e)=>n<e?n:e,Di=(n,e)=>n>e?n:e,X0=Math.pow,$h=n=>n!==0?n<0:1/n<0,Yh=1,Vh=2,uu=4,du=8,po=32,Pr=64,On=128,Ya=31,fu=63,Ai=127,J0=2147483647,qh=Number.MAX_SAFE_INTEGER,Z0=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&pr(n)===n),Q0=String.fromCharCode,eb=n=>n.toLowerCase(),tb=/^\s*/g,nb=n=>n.replace(tb,""),rb=/([A-Z])/g,Kh=(n,e)=>nb(n.replace(rb,t=>`${e}${eb(t)}`)),ib=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e.codePointAt(i);return r},mo=typeof TextEncoder<"u"?new TextEncoder:null,hu=mo?n=>mo.encode(n):ib;let yo=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});yo&&yo.decode(new Uint8Array).length===1&&(yo=null);class _o{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const bt=()=>new _o,gu=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},at=n=>{const e=new Uint8Array(gu(n));let t=0;for(let r=0;r<n.bufs.length;r++){const i=n.bufs[r];e.set(i,t),t+=i.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},sb=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(Di(t,e)*2),n.cpos=0)},en=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},bo=en,je=(n,e)=>{for(;e>Ai;)en(n,On|Ai&e),e=pr(e/128);en(n,Ai&e)},pu=(n,e)=>{const t=$h(e);for(t&&(e=-e),en(n,(e>fu?On:0)|(t?Pr:0)|fu&e),e=pr(e/64);e>0;)en(n,(e>Ai?On:0)|Ai&e),e=pr(e/128)},mu=new Uint8Array(3e4),ob=mu.length/3,ab=(n,e)=>{if(e.length<ob){const t=mo.encodeInto(e,mu).written||0;je(n,t);for(let r=0;r<t;r++)en(n,mu[r])}else St(n,hu(e))},lb=(n,e)=>{const t=unescape(encodeURIComponent(e)),r=t.length;je(n,r);for(let i=0;i<r;i++)en(n,t.codePointAt(i))},mr=mo&&mo.encodeInto?ab:lb,Va=(n,e)=>{const t=n.cbuf.length,r=n.cpos,i=$a(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(Di(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},St=(n,e)=>{je(n,e.byteLength),Va(n,e)},yu=(n,e)=>{sb(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},cb=(n,e)=>yu(n,4).setFloat32(0,e,!1),ub=(n,e)=>yu(n,8).setFloat64(0,e,!1),db=(n,e)=>yu(n,8).setBigInt64(0,e,!1),Gh=new DataView(new ArrayBuffer(4)),fb=n=>(Gh.setFloat32(0,n),Gh.getFloat32(0)===n),ds=(n,e)=>{switch(typeof e){case"string":en(n,119),mr(n,e);break;case"number":Z0(e)&&Wa(e)<=J0?(en(n,125),pu(n,e)):fb(e)?(en(n,124),cb(n,e)):(en(n,123),ub(n,e));break;case"bigint":en(n,122),db(n,e);break;case"object":if(e===null)en(n,126);else if(au(e)){en(n,117),je(n,e.length);for(let t=0;t<e.length;t++)ds(n,e[t])}else if(e instanceof Uint8Array)en(n,116),St(n,e);else{en(n,118);const t=Object.keys(e);je(n,t.length);for(let r=0;r<t.length;r++){const i=t[r];mr(n,i),ds(n,e[i])}}break;case"boolean":en(n,e?120:121);break;default:en(n,127)}};class Xh extends _o{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&je(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const Jh=n=>{n.count>0&&(pu(n.encoder,n.count===1?n.s:-n.s),n.count>1&&je(n.encoder,n.count-2))};class qa{constructor(){this.encoder=new _o,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Jh(this),this.count=1,this.s=e)}toUint8Array(){return Jh(this),at(this.encoder)}}const Zh=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);pu(n.encoder,e),n.count>1&&je(n.encoder,n.count-2)}};class _u{constructor(){this.encoder=new _o,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Zh(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Zh(this),at(this.encoder)}}class hb{constructor(){this.sarr=[],this.s="",this.lensE=new qa}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new _o;return this.sarr.push(this.s),this.s="",mr(e,this.sarr.join("")),Va(e,this.lensE.toUint8Array()),at(e)}}const yr=n=>new Error(n),_r=()=>{throw yr("Method unimplemented")},ir=()=>{throw yr("Unexpected case")},Qh=yr("Unexpected end of array"),eg=yr("Integer out of Range");class Ka{constructor(e){this.arr=e,this.pos=0}}const sr=n=>new Ka(n),gb=n=>n.pos!==n.arr.length,pb=(n,e)=>{const t=new Uint8Array(n.arr.buffer,n.pos+n.arr.byteOffset,e);return n.pos+=e,t},Gt=n=>pb(n,Ve(n)),Ii=n=>n.arr[n.pos++],Ve=n=>{let e=0,t=1;const r=n.arr.length;for(;n.pos<r;){const i=n.arr[n.pos++];if(e=e+(i&Ai)*t,t*=128,i<On)return e;if(e>qh)throw eg}throw Qh},bu=n=>{let e=n.arr[n.pos++],t=e&fu,r=64;const i=(e&Pr)>0?-1:1;if(!(e&On))return i*t;const s=n.arr.length;for(;n.pos<s;){if(e=n.arr[n.pos++],t=t+(e&Ai)*r,r*=128,e<On)return i*t;if(t>qh)throw eg}throw Qh},br=yo?n=>yo.decode(Gt(n)):n=>{let e=Ve(n);if(e===0)return"";{let t=String.fromCodePoint(Ii(n));if(--e<100)for(;e--;)t+=String.fromCodePoint(Ii(n));else for(;e>0;){const r=e<1e4?e:1e4,i=n.arr.subarray(n.pos,n.pos+r);n.pos+=r,t+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(t))}},wu=(n,e)=>{const t=new DataView(n.arr.buffer,n.arr.byteOffset+n.pos,e);return n.pos+=e,t},mb=[n=>{},n=>null,bu,n=>wu(n,4).getFloat32(0,!1),n=>wu(n,8).getFloat64(0,!1),n=>wu(n,8).getBigInt64(0,!1),n=>!1,n=>!0,br,n=>{const e=Ve(n),t={};for(let r=0;r<e;r++){const i=br(n);t[i]=fs(n)}return t},n=>{const e=Ve(n),t=[];for(let r=0;r<e;r++)t.push(fs(n));return t},Gt],fs=n=>mb[127-Ii(n)](n);class tg extends Ka{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),gb(this)?this.count=Ve(this)+1:this.count=-1),this.count--,this.s}}class Ga extends Ka{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=bu(this);const e=$h(this.s);this.count=1,e&&(this.s=-this.s,this.count=Ve(this)+2)}return this.count--,this.s}}class vu extends Ka{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=bu(this),t=e&1;this.diff=pr(e/2),this.count=1,t&&(this.count=Ve(this)+2)}return this.s+=this.diff,this.count--,this.s}}class yb{constructor(e){this.decoder=new Ga(e),this.str=br(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}}const _b=crypto.getRandomValues.bind(crypto),bb=Math.random,ng=()=>_b(new Uint32Array(1))[0],wb=[1e7]+-1e3+-4e3+-8e3+-1e11,rg=()=>wb.replace(/[018]/g,n=>(n^ng()&15>>n/4).toString(16)),jn=Date.now,ig=n=>new Promise(n);Promise.all.bind(Promise);const vb=n=>Promise.reject(n),xu=n=>Promise.resolve(n),sg=n=>n===void 0?null:n;class xb{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let og=new xb,Cu=!0;try{typeof localStorage<"u"&&localStorage&&(og=localStorage,Cu=!1)}catch{}const ag=og,Cb=n=>Cu||addEventListener("storage",n),Sb=n=>Cu||removeEventListener("storage",n),Tb=Object.assign,lg=Object.keys,Eb=(n,e)=>{for(const t in n)e(n[t],t)},kb=(n,e)=>{const t=[];for(const r in n)t.push(e(n[r],r));return t},cg=n=>lg(n).length,ug=n=>lg(n).length,Nb=n=>{for(const e in n)return!1;return!0},Mb=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},dg=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),Db=(n,e)=>n===e||ug(n)===ug(e)&&Mb(n,(t,r)=>(t!==void 0||dg(e,r))&&e[r]===t),Ab=Object.freeze,fg=n=>{for(const e in n){const t=n[e];(typeof t=="object"||typeof t=="function")&&fg(n[e])}return Ab(n)},Su=(n,e,t=0)=>{try{for(;t<n.length;t++)n[t](...e)}finally{t<n.length&&Su(n,e,t+1)}},Ib=()=>{},Rb=n=>n,Lb=(n,e)=>n===e,wo=(n,e)=>{if(n==null||e==null)return Lb(n,e);if(n.constructor!==e.constructor)return!1;if(n===e)return!0;switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!wo(n.get(t),e.get(t)))return!1;break}case Object:if(cg(n)!==cg(e))return!1;for(const t in n)if(!dg(n,t)||!wo(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!wo(n[t],e[t]))return!1;break;default:return!1}return!0},Ob=(n,e)=>e.includes(n),ii=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",hg=typeof window<"u"&&typeof document<"u"&&!ii;let wr;const jb=()=>{if(wr===void 0)if(ii){wr=Tn();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const r=n[t];r[0]==="-"?(e!==null&&wr.set(e,""),e=r):e!==null&&(wr.set(e,r),e=null)}e!==null&&wr.set(e,"")}else typeof location=="object"?(wr=Tn(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");wr.set(`--${Kh(e,"-")}`,t),wr.set(`-${Kh(e,"-")}`,t)}})):wr=Tn();return wr},Tu=n=>jb().has(n),vo=n=>sg(ii?process.env[n.toUpperCase().replaceAll("-","_")]:ag.getItem(n)),gg=n=>Tu("--"+n)||vo(n)!==null;gg("production");const Pb=ii&&Ob(process.env.FORCE_COLOR,["true","1","2"])||!Tu("--no-colors")&&!gg("no-color")&&(!ii||process.stdout.isTTY)&&(!ii||Tu("--color")||vo("COLORTERM")!==null||(vo("TERM")||"").includes("color")),pg=n=>new Uint8Array(n),Fb=(n,e,t)=>new Uint8Array(n,e,t),zb=n=>new Uint8Array(n),Bb=n=>{let e="";for(let t=0;t<n.byteLength;t++)e+=Q0(n[t]);return btoa(e)},Ub=n=>Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),Hb=n=>{const e=atob(n),t=pg(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t},Wb=n=>{const e=Buffer.from(n,"base64");return Fb(e.buffer,e.byteOffset,e.byteLength)},mg=hg?Bb:Ub,yg=hg?Hb:Wb,$b=n=>{const e=pg(n.byteLength);return e.set(n),e};class Yb{constructor(e,t){this.left=e,this.right=t}}const Fr=(n,e)=>new Yb(n,e);typeof DOMParser<"u"&&new DOMParser;const Vb=n=>Y0(n,(e,t)=>`${t}:${e};`).join(""),qb=JSON.stringify,zr=Symbol,Yn=zr(),Ri=zr(),_g=zr(),Eu=zr(),bg=zr(),wg=zr(),vg=zr(),Xa=zr(),Ja=zr(),Kb=n=>{var i;n.length===1&&((i=n[0])==null?void 0:i.constructor)===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const s=n[r];if(s===void 0)break;if(s.constructor===String||s.constructor===Number)e.push(s);else if(s.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const s=n[r];s instanceof Symbol||t.push(s)}return t},xg=[bg,vg,Xa,_g];let ku=0,Cg=jn();const Gb=(n,e)=>{const t=xg[ku],r=vo("log"),i=r!==null&&(r==="*"||r==="true"||new RegExp(r,"gi").test(e));return ku=(ku+1)%xg.length,e+=": ",i?(...s)=>{var l;s.length===1&&((l=s[0])==null?void 0:l.constructor)===Function&&(s=s[0]());const o=jn(),a=o-Cg;Cg=o,n(t,e,Ja,...s.map(u=>{switch(u!=null&&u.constructor===Uint8Array&&(u=Array.from(u)),typeof u){case"string":case"symbol":return u;default:return qb(u)}}),t," +"+a+"ms")}:Ib},Xb={[Yn]:Fr("font-weight","bold"),[Ri]:Fr("font-weight","normal"),[_g]:Fr("color","blue"),[bg]:Fr("color","green"),[Eu]:Fr("color","grey"),[wg]:Fr("color","red"),[vg]:Fr("color","purple"),[Xa]:Fr("color","orange"),[Ja]:Fr("color","black")},Sg=Pb?n=>{var o;n.length===1&&((o=n[0])==null?void 0:o.constructor)===Function&&(n=n[0]());const e=[],t=[],r=Tn();let i=[],s=0;for(;s<n.length;s++){const a=n[s],l=Xb[a];if(l!==void 0)r.set(l.left,l.right);else{if(a===void 0)break;if(a.constructor===String||a.constructor===Number){const u=Vb(r);s>0||u.length>0?(e.push("%c"+a),t.push(u)):e.push(a)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s<n.length;s++){const a=n[s];a instanceof Symbol||i.push(a)}return i}:Kb,Tg=(...n)=>{console.log(...Sg(n)),kg.forEach(e=>e.print(n))},Eg=(...n)=>{console.warn(...Sg(n)),n.unshift(Xa),kg.forEach(e=>e.print(n))},kg=ri(),Jb=n=>Gb(Tg,n),Ng=n=>({[Symbol.iterator](){return this},next:n}),Zb=(n,e)=>Ng(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),Nu=(n,e)=>Ng(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Mu{constructor(e,t){this.clock=e,this.len=t}}class hs{constructor(){this.clients=new Map}}const gs=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);for(let o=0;o<r.length;o++){const a=r[o];Vg(n,s,a.clock,a.len,t)}}),Qb=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=pr((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;t=i+1}else r=i-1}return null},xo=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&Qb(t,e.clock)!==null},Du=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],s=e[t];i.clock+i.len>=s.clock?i.len=Di(i.len,s.clock+s.len-i.clock):(r<t&&(e[r]=s),r++)}e.length=r})},Au=n=>{const e=new hs;for(let t=0;t<n.length;t++)n[t].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=t+1;o<n.length;o++)q0(s,n[o].clients.get(i)||[]);e.clients.set(i,s)}});return Du(e),e},Co=(n,e,t,r)=>{Ln(n.clients,e,()=>[]).push(new Mu(t,r))},ew=()=>new hs,tw=n=>{const e=ew();return n.clients.forEach((t,r)=>{const i=[];for(let s=0;s<t.length;s++){const o=t[s];if(o.deleted){const a=o.id.clock;let l=o.length;if(s+1<t.length)for(let u=t[s+1];s+1<t.length&&u.deleted;u=t[++s+1])l+=u.length;i.push(new Mu(a,l))}}i.length>0&&e.clients.set(r,i)}),e},ps=(n,e)=>{je(n.restEncoder,e.clients.size),jr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),je(n.restEncoder,t);const i=r.length;je(n.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];n.writeDsClock(o.clock),n.writeDsLen(o.len)}})},Iu=n=>{const e=new hs,t=Ve(n.restDecoder);for(let r=0;r<t;r++){n.resetDsCurVal();const i=Ve(n.restDecoder),s=Ve(n.restDecoder);if(s>0){const o=Ln(e.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new Mu(n.readDsClock(),n.readDsLen()))}}return e},Mg=(n,e,t)=>{const r=new hs,i=Ve(n.restDecoder);for(let s=0;s<i;s++){n.resetDsCurVal();const o=Ve(n.restDecoder),a=Ve(n.restDecoder),l=t.clients.get(o)||[],u=Ht(t,o);for(let g=0;g<a;g++){const d=n.readDsClock(),f=d+n.readDsLen();if(d<u){u<f&&Co(r,o,u,f-u);let m=vr(l,d),y=l[m];for(!y.deleted&&y.id.clock<d&&(l.splice(m+1,0,fl(e,y,d-y.id.clock)),m++);m<l.length&&(y=l[m++],y.id.clock<f);)y.deleted||(f<y.id.clock+y.length&&l.splice(m,0,fl(e,y,f-y.id.clock)),y.delete(e))}else Co(r,o,d,f-d)}}if(r.clients.size>0){const s=new Li;return je(s.restEncoder,0),ps(s,r),s.toUint8Array()}return null},Dg=ng;class Br extends lu{constructor({guid:e=rg(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=Dg(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Wg,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=ig(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>ig(u=>{const g=d=>{(d===void 0||d===!0)&&(this.off("sync",g),u())};this.on("sync",g)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Tt(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(jr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return Tt(this,e,t)}get(e,t=sn){const r=Ln(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==sn&&i!==t)if(i===sn){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,vs)}getText(e=""){return this.get(e,Cs)}getMap(e=""){return this.get(e,Pn)}getXmlElement(e=""){return this.get(e,ai)}getXmlFragment(e=""){return this.get(e,Oi)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,jr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Br({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,Tt(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ag{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Ve(this.restDecoder)}readDsLen(){return Ve(this.restDecoder)}}class Ig extends Ag{readLeftID(){return Xe(Ve(this.restDecoder),Ve(this.restDecoder))}readRightID(){return Xe(Ve(this.restDecoder),Ve(this.restDecoder))}readClient(){return Ve(this.restDecoder)}readInfo(){return Ii(this.restDecoder)}readString(){return br(this.restDecoder)}readParentInfo(){return Ve(this.restDecoder)===1}readTypeRef(){return Ve(this.restDecoder)}readLen(){return Ve(this.restDecoder)}readAny(){return fs(this.restDecoder)}readBuf(){return $b(Gt(this.restDecoder))}readJSON(){return JSON.parse(br(this.restDecoder))}readKey(){return br(this.restDecoder)}}class nw{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Ve(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Ve(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class ms extends nw{constructor(e){super(e),this.keys=[],Ve(e),this.keyClockDecoder=new vu(Gt(e)),this.clientDecoder=new Ga(Gt(e)),this.leftClockDecoder=new vu(Gt(e)),this.rightClockDecoder=new vu(Gt(e)),this.infoDecoder=new tg(Gt(e),Ii),this.stringDecoder=new yb(Gt(e)),this.parentInfoDecoder=new tg(Gt(e),Ii),this.typeRefDecoder=new Ga(Gt(e)),this.lenDecoder=new Ga(Gt(e))}readLeftID(){return new ys(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new ys(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return fs(this.restDecoder)}readBuf(){return Gt(this.restDecoder)}readJSON(){return fs(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const t=this.stringDecoder.read();return this.keys.push(t),t}}}class Rg{constructor(){this.restEncoder=bt()}toUint8Array(){return at(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){je(this.restEncoder,e)}writeDsLen(e){je(this.restEncoder,e)}}class So extends Rg{writeLeftID(e){je(this.restEncoder,e.client),je(this.restEncoder,e.clock)}writeRightID(e){je(this.restEncoder,e.client),je(this.restEncoder,e.clock)}writeClient(e){je(this.restEncoder,e)}writeInfo(e){bo(this.restEncoder,e)}writeString(e){mr(this.restEncoder,e)}writeParentInfo(e){je(this.restEncoder,e?1:0)}writeTypeRef(e){je(this.restEncoder,e)}writeLen(e){je(this.restEncoder,e)}writeAny(e){ds(this.restEncoder,e)}writeBuf(e){St(this.restEncoder,e)}writeJSON(e){mr(this.restEncoder,JSON.stringify(e))}writeKey(e){mr(this.restEncoder,e)}}class Lg{constructor(){this.restEncoder=bt(),this.dsCurrVal=0}toUint8Array(){return at(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,je(this.restEncoder,t)}writeDsLen(e){e===0&&ir(),je(this.restEncoder,e-1),this.dsCurrVal+=e}}class Li extends Lg{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new _u,this.clientEncoder=new qa,this.leftClockEncoder=new _u,this.rightClockEncoder=new _u,this.infoEncoder=new Xh(bo),this.stringEncoder=new hb,this.parentInfoEncoder=new Xh(bo),this.typeRefEncoder=new qa,this.lenEncoder=new qa}toUint8Array(){const e=bt();return je(e,0),St(e,this.keyClockEncoder.toUint8Array()),St(e,this.clientEncoder.toUint8Array()),St(e,this.leftClockEncoder.toUint8Array()),St(e,this.rightClockEncoder.toUint8Array()),St(e,at(this.infoEncoder)),St(e,this.stringEncoder.toUint8Array()),St(e,at(this.parentInfoEncoder)),St(e,this.typeRefEncoder.toUint8Array()),St(e,this.lenEncoder.toUint8Array()),Va(e,at(this.restEncoder)),at(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){ds(this.restEncoder,e)}writeBuf(e){St(this.restEncoder,e)}writeJSON(e){ds(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const rw=(n,e,t,r)=>{r=Di(r,e[0].id.clock);const i=vr(e,r);je(n.restEncoder,e.length-i),n.writeClient(t),je(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(n,0)},Ru=(n,e,t)=>{const r=new Map;t.forEach((i,s)=>{Ht(e,s)>i&&r.set(s,i)}),el(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),je(n.restEncoder,r.size),jr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{rw(n,e.clients.get(i),i,s)})},iw=(n,e)=>{const t=Tn(),r=Ve(n.restDecoder);for(let i=0;i<r;i++){const s=Ve(n.restDecoder),o=new Array(s),a=n.readClient();let l=Ve(n.restDecoder);t.set(a,{i:0,refs:o});for(let u=0;u<s;u++){const g=n.readInfo();switch(Ya&g){case 0:{const d=n.readLen();o[u]=new Vn(Xe(a,l),d),l+=d;break}case 10:{const d=Ve(n.restDecoder);o[u]=new qn(Xe(a,l),d),l+=d;break}default:{const d=(g&(Pr|On))===0,f=new Et(Xe(a,l),null,(g&On)===On?n.readLeftID():null,null,(g&Pr)===Pr?n.readRightID():null,d?n.readParentInfo()?e.get(n.readString()):n.readLeftID():null,d&&(g&po)===po?n.readString():null,Tp(n,g));o[u]=f,l+=f.length}}}}return t},sw=(n,e,t)=>{const r=[];let i=jr(t.keys()).sort((m,y)=>m-y);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let m=t.get(i[i.length-1]);for(;m.refs.length===m.i;)if(i.pop(),i.length>0)m=t.get(i[i.length-1]);else return null;return m};let o=s();if(o===null)return null;const a=new Wg,l=new Map,u=(m,y)=>{const b=l.get(m);(b==null||b>y)&&l.set(m,y)};let g=o.refs[o.i++];const d=new Map,f=()=>{for(const m of r){const y=m.id.client,b=t.get(y);b?(b.i--,a.clients.set(y,b.refs.slice(b.i)),t.delete(y),b.i=0,b.refs=[]):a.clients.set(y,[m]),i=i.filter(C=>C!==y)}r.length=0};for(;;){if(g.constructor!==qn){const y=Ln(d,g.id.client,()=>Ht(e,g.id.client))-g.id.clock;if(y<0)r.push(g),u(g.id.client,g.id.clock-1),f();else{const b=g.getMissing(n,e);if(b!==null){r.push(g);const C=t.get(b)||{refs:[],i:0};if(C.refs.length===C.i)u(b,Ht(e,b)),f();else{g=C.refs[C.i++];continue}}else(y===0||y<g.length)&&(g.integrate(n,y),d.set(g.id.client,g.id.clock+g.length))}}if(r.length>0)g=r.pop();else if(o!==null&&o.i<o.refs.length)g=o.refs[o.i++];else{if(o=s(),o===null)break;g=o.refs[o.i++]}}if(a.clients.size>0){const m=new Li;return Ru(m,a,new Map),je(m.restEncoder,0),{missing:l,update:m.toUint8Array()}}return null},ow=(n,e)=>Ru(n,e.doc.store,e.beforeState),aw=(n,e,t,r=new ms(n))=>Tt(e,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,l=iw(r,o),u=sw(i,a,l),g=a.pendingStructs;if(g){for(const[f,m]of g.missing)if(m<Ht(a,f)){s=!0;break}if(u){for(const[f,m]of u.missing){const y=g.missing.get(f);(y==null||y>m)&&g.missing.set(f,m)}g.update=nl([g.update,u.update])}}else a.pendingStructs=u;const d=Mg(r,i,a);if(a.pendingDs){const f=new ms(sr(a.pendingDs));Ve(f.restDecoder);const m=Mg(f,i,a);d&&m?a.pendingDs=nl([d,m]):a.pendingDs=d||m}else a.pendingDs=d;if(s){const f=a.pendingStructs.update;a.pendingStructs=null,Og(i.doc,f)}},t,!1),Og=(n,e,t,r=ms)=>{const i=sr(e);aw(i,n,t,new r(i))},lw=(n,e,t)=>Og(n,e,t,Ig),cw=(n,e,t=new Map)=>{Ru(n,e.store,t),ps(n,tw(e.store))},uw=(n,e=new Uint8Array([0]),t=new Li)=>{const r=jg(e);cw(t,n,r);const i=[t.toUint8Array()];if(n.store.pendingDs&&i.push(n.store.pendingDs),n.store.pendingStructs&&i.push(Aw(n.store.pendingStructs.update,e)),i.length>1){if(t.constructor===So)return Mw(i.map((s,o)=>o===0?s:Rw(s)));if(t.constructor===Li)return nl(i)}return i[0]},dw=(n,e)=>uw(n,e,new So),fw=n=>{const e=new Map,t=Ve(n.restDecoder);for(let r=0;r<t;r++){const i=Ve(n.restDecoder),s=Ve(n.restDecoder);e.set(i,s)}return e},jg=n=>fw(new Ag(sr(n))),Pg=(n,e)=>(je(n.restEncoder,e.size),jr(e.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{je(n.restEncoder,t),je(n.restEncoder,r)}),n),hw=(n,e)=>Pg(n,el(e.store)),gw=(n,e=new Lg)=>(n instanceof Map?Pg(e,n):hw(e,n),e.toUint8Array()),pw=n=>gw(n,new Rg);class mw{constructor(){this.l=[]}}const Fg=()=>new mw,zg=(n,e)=>n.l.push(e),Bg=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Ug=(n,e,t)=>Su(n.l,[e,t]);class ys{constructor(e,t){this.client=e,this.clock=t}}const _s=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,Xe=(n,e)=>new ys(n,e),Hg=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw ir()},Za=(n,e)=>{for(;e!==null;){if(e.parent===n)return!0;e=e.parent._item}return!1};class yw{constructor(e,t,r,i=0){this.type=e,this.tname=t,this.item=r,this.assoc=i}}class _w{constructor(e,t,r=0){this.type=e,this.index=t,this.assoc=r}}const bw=(n,e,t=0)=>new _w(n,e,t),Qa=(n,e,t)=>{let r=null,i=null;return n._item===null?i=Hg(n):r=Xe(n._item.id.client,n._item.id.clock),new yw(r,i,e,t)},ww=(n,e,t=0)=>{let r=n._start;if(t<0){if(e===0)return Qa(n,null,t);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Qa(n,Xe(r.id.client,r.id.clock+e),t);e-=r.length}if(r.right===null&&t<0)return Qa(n,r.lastId,t);r=r.right}return Qa(n,null,t)},vw=(n,e,t=!0)=>{const r=e.store,i=n.item,s=n.type,o=n.tname,a=n.assoc;let l=null,u=0;if(i!==null){if(Ht(r,i.client)<=i.clock)return null;const g=t?Vu(r,i):{item:ws(r,i),diff:0},d=g.item;if(!(d instanceof Et))return null;if(l=d.parent,l._item===null||!l._item.deleted){u=d.deleted||!d.countable?0:g.diff+(a>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(u+=f.length),f=f.left}}else{if(o!==null)l=e.get(o);else if(s!==null){if(Ht(r,s.client)<=s.clock)return null;const{item:g}=t?Vu(r,s):{item:ws(r,s)};if(g instanceof Et&&g.content instanceof Cr)l=g.content.type;else return null}else throw ir();a>=0?u=l._length:u=0}return bw(l,u,n.assoc)},xw=(n,e)=>n===e||n!==null&&e!==null&&n.tname===e.tname&&_s(n.item,e.item)&&_s(n.type,e.type)&&n.assoc===e.assoc,bs=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!xo(e.ds,n.id),Lu=(n,e)=>{const t=Ln(n.meta,Lu,ri),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i<Ht(r,s)&&En(n,Xe(s,i))}),gs(n,e.ds,i=>{}),t.add(e))};class Wg{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const el=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},Ht=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},$g=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw ir()}t.push(e)},vr=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=pr(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;t=o+1}else r=o-1;o=pr((t+r)/2)}throw ir()},ws=(n,e)=>{const t=n.clients.get(e.client);return t[vr(t,e.clock)]},Ou=(n,e,t)=>{const r=vr(e,t),i=e[r];return i.id.clock<t&&i instanceof Et?(e.splice(r+1,0,fl(n,i,t-i.id.clock)),r+1):r},En=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[Ou(n,t,e.clock)]},Yg=(n,e,t)=>{const r=e.clients.get(t.client),i=vr(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==Vn&&r.splice(i+1,0,fl(n,s,t.clock-s.id.clock+1)),s},Cw=(n,e,t)=>{const r=n.clients.get(e.id.client);r[vr(r,e.id.clock)]=t},Vg=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=Ou(n,e,t),a;do a=e[o++],s<a.id.clock+a.length&&Ou(n,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};class Sw{constructor(e,t,r){this.doc=e,this.deleteSet=new hs,this.beforeState=el(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const qg=(n,e)=>e.deleteSet.clients.size===0&&!V0(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Du(e.deleteSet),ow(n,e),ps(n,e.deleteSet),!0),Kg=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ln(n.changed,e,ri).add(t)},tl=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Et&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},Tw=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let u=vr(s,a.clock),g=s[u];u<s.length&&g.id.clock<l;g=s[++u]){const d=s[u];if(a.clock+a.len<=d.id.clock)break;d instanceof Et&&d.deleted&&!d.keep&&t(d)&&d.gc(e,!1)}}}},Ew=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],a=$a(i.length-1,1+vr(i,o.clock+o.len-1));for(let l=a,u=i[l];l>0&&u.id.clock>=o.clock;u=i[l])l-=1+tl(i,l)}})},Gg=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,s=t.deleteSet,o=t._mergeStructs;try{Du(s),t.afterState=el(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const a=[];t.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(t,l)})),a.push(()=>{t.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(g=>g.target._item===null||!g.target._item.deleted),l.forEach(g=>{g.currentTarget=u,g._path=null}),l.sort((g,d)=>g.path.length-d.path.length),Ug(u._dEH,l,t))})}),a.push(()=>r.emit("afterTransaction",[t,r])),Su(a,[]),t._needFormattingCleanup&&Vw(t)}finally{r.gc&&Tw(s,i,r.gcFilter),Ew(s,i),t.afterState.forEach((g,d)=>{const f=t.beforeState.get(d)||0;if(f!==g){const m=i.clients.get(d),y=Di(vr(m,f),1);for(let b=m.length-1;b>=y;)b-=1+tl(m,b)}});for(let g=o.length-1;g>=0;g--){const{client:d,clock:f}=o[g].id,m=i.clients.get(d),y=vr(m,f);y+1<m.length&&tl(m,y+1)>1||y>0&&tl(m,y)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Tg(Xa,Yn,"[yjs] ",Ri,wg,"Changed the client-id because another client seems to be using it."),r.clientID=Dg()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const g=new So;qg(g,t)&&r.emit("update",[g.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const g=new Li;qg(g,t)&&r.emit("updateV2",[g.toUint8Array(),t.origin,r,t])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=t;(a.size>0||u.size>0||l.size>0)&&(a.forEach(g=>{g.clientID=r.clientID,g.collectionid==null&&(g.collectionid=r.collectionid),r.subdocs.add(g)}),u.forEach(g=>r.subdocs.delete(g)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,t]),u.forEach(g=>g.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):Gg(n,e+1)}}},Tt=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new Sw(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const a=n._transaction===i[0];n._transaction=null,a&&Gg(i,0)}}return o};class kw{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}}const Xg=(n,e,t)=>{gs(n,t.deletions,r=>{r instanceof Et&&e.scope.some(i=>Za(i,r))&&qu(r,!1)})},Jg=(n,e,t)=>{let r=null;const i=n.doc,s=n.scope;Tt(i,a=>{for(;e.length>0&&n.currStackItem===null;){const l=i.store,u=e.pop(),g=new Set,d=[];let f=!1;gs(a,u.insertions,m=>{if(m instanceof Et){if(m.redone!==null){let{item:y,diff:b}=Vu(l,m.id);b>0&&(y=En(a,Xe(y.id.client,y.id.clock+b))),m=y}!m.deleted&&s.some(y=>Za(y,m))&&d.push(m)}}),gs(a,u.deletions,m=>{m instanceof Et&&s.some(y=>Za(y,m))&&!xo(u.insertions,m.id)&&g.add(m)}),g.forEach(m=>{f=Sp(a,m,g,u.insertions,n.ignoreRemoteMapChanges,n)!==null||f});for(let m=d.length-1;m>=0;m--){const y=d[m];n.deleteFilter(y)&&(y.delete(a),f=!0)}n.currStackItem=f?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},n);const o=n.currStackItem;if(o!=null){const a=r.changedParentTypes;n.emit("stack-item-popped",[{stackItem:o,type:t,changedParentTypes:a,origin:n},n]),n.currStackItem=null}return o};class Zg extends lu{constructor(e,{captureTimeout:t=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=au(e)?e[0].doc:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=t,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(C=>l.changedParentTypes.has(C))||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,g=this.redoing,d=u?this.redoStack:this.undoStack;u?this.stopCapturing():g||this.clear(!1,!0);const f=new hs;l.afterState.forEach((C,S)=>{const A=l.beforeState.get(S)||0,v=C-A;v>0&&Co(f,S,A,v)});const m=jn();let y=!1;if(this.lastChange>0&&m-this.lastChange<this.captureTimeout&&d.length>0&&!u&&!g){const C=d[d.length-1];C.deletions=Au([C.deletions,l.deleteSet]),C.insertions=Au([C.insertions,f])}else d.push(new kw(l.deleteSet,f)),y=!0;!u&&!g&&(this.lastChange=m),gs(l,l.deleteSet,C=>{C instanceof Et&&this.scope.some(S=>Za(S,C))&&qu(C,!0)});const b=[{stackItem:d[d.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];y?this.emit("stack-item-added",b):this.emit("stack-item-updated",b)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){e=au(e)?e:[e],e.forEach(t=>{this.scope.every(r=>r!==t)&&(t.doc!==this.doc&&Eg("[yjs#509] Not same Y.Doc"),this.scope.push(t))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>Xg(r,this,i)),this.undoStack=[]),t&&(this.redoStack.forEach(i=>Xg(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=Jg(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=Jg(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*Nw(n){const e=Ve(n.restDecoder);for(let t=0;t<e;t++){const r=Ve(n.restDecoder),i=n.readClient();let s=Ve(n.restDecoder);for(let o=0;o<r;o++){const a=n.readInfo();if(a===10){const l=Ve(n.restDecoder);yield new qn(Xe(i,s),l),s+=l}else if(Ya&a){const l=(a&(Pr|On))===0,u=new Et(Xe(i,s),null,(a&On)===On?n.readLeftID():null,null,(a&Pr)===Pr?n.readRightID():null,l?n.readParentInfo()?n.readString():n.readLeftID():null,l&&(a&po)===po?n.readString():null,Tp(n,a));yield u,s+=u.length}else{const l=n.readLen();yield new Vn(Xe(i,s),l),s+=l}}}}class ju{constructor(e,t){this.gen=Nw(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===qn);return this.curr}}class Pu{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const Mw=n=>nl(n,Ig,So),Dw=(n,e)=>{if(n.constructor===Vn){const{client:t,clock:r}=n.id;return new Vn(Xe(t,r+e),n.length-e)}else if(n.constructor===qn){const{client:t,clock:r}=n.id;return new qn(Xe(t,r+e),n.length-e)}else{const t=n,{client:r,clock:i}=t.id;return new Et(Xe(r,i+e),null,Xe(r,i+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},nl=(n,e=ms,t=Li)=>{if(n.length===1)return n[0];const r=n.map(g=>new e(sr(g)));let i=r.map(g=>new ju(g,!0)),s=null;const o=new t,a=new Pu(o);for(;i=i.filter(f=>f.curr!==null),i.sort((f,m)=>{if(f.curr.id.client===m.curr.id.client){const y=f.curr.id.clock-m.curr.id.clock;return y===0?f.curr.constructor===m.curr.constructor?0:f.curr.constructor===qn?1:-1:y}else return m.curr.id.client-f.curr.id.client}),i.length!==0;){const g=i[0],d=g.curr.id.client;if(s!==null){let f=g.curr,m=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=g.next(),m=!0;if(f===null||f.id.client!==d||m&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)si(a,s.struct,s.offset),s={struct:f,offset:0},g.next();else if(s.struct.id.clock+s.struct.length<f.id.clock)if(s.struct.constructor===qn)s.struct.length=f.id.clock+f.length-s.struct.id.clock;else{si(a,s.struct,s.offset);const y=f.id.clock-s.struct.id.clock-s.struct.length;s={struct:new qn(Xe(d,s.struct.id.clock+s.struct.length),y),offset:0}}else{const y=s.struct.id.clock+s.struct.length-f.id.clock;y>0&&(s.struct.constructor===qn?s.struct.length-=y:f=Dw(f,y)),s.struct.mergeWith(f)||(si(a,s.struct,s.offset),s={struct:f,offset:0},g.next())}}else s={struct:g.curr,offset:0},g.next();for(let f=g.curr;f!==null&&f.id.client===d&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==qn;f=g.next())si(a,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(si(a,s.struct,s.offset),s=null),Fu(a);const l=r.map(g=>Iu(g)),u=Au(l);return ps(o,u),o.toUint8Array()},Aw=(n,e,t=ms,r=Li)=>{const i=jg(e),s=new r,o=new Pu(s),a=new t(sr(n)),l=new ju(a,!1);for(;l.curr;){const g=l.curr,d=g.id.client,f=i.get(d)||0;if(l.curr.constructor===qn){l.next();continue}if(g.id.clock+g.length>f)for(si(o,g,Di(f-g.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)si(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=f;)l.next()}Fu(o);const u=Iu(a);return ps(s,u),s.toUint8Array()},Qg=n=>{n.written>0&&(n.clientStructs.push({written:n.written,restEncoder:at(n.encoder.restEncoder)}),n.encoder.restEncoder=bt(),n.written=0)},si=(n,e,t)=>{n.written>0&&n.currClient!==e.id.client&&Qg(n),n.written===0&&(n.currClient=e.id.client,n.encoder.writeClient(e.id.client),je(n.encoder.restEncoder,e.id.clock+t)),e.write(n.encoder,t),n.written++},Fu=n=>{Qg(n);const e=n.encoder.restEncoder;je(e,n.clientStructs.length);for(let t=0;t<n.clientStructs.length;t++){const r=n.clientStructs[t];je(e,r.written),Va(e,r.restEncoder)}},Iw=(n,e,t,r)=>{const i=new t(sr(n)),s=new ju(i,!1),o=new r,a=new Pu(o);for(let u=s.curr;u!==null;u=s.next())si(a,e(u),0);Fu(a);const l=Iu(i);return ps(o,l),o.toUint8Array()},Rw=n=>Iw(n,Rb,ms,So),ep="You must not compute changes after the event-handler fired.";class rl{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Lw(this.currentTarget,this.target))}deletes(e){return xo(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw yr(ep);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=ou(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=ou(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=ou(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw yr(ep);const t=this.target,r=ri(),i=ri(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let u=t._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,i.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const Lw=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},fn=()=>{Eg("Invalid access: Add Yjs type to a document before reading data.")},tp=80;let zu=0;class Ow{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=zu++}}const jw=n=>{n.timestamp=zu++},np=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=zu++},Pw=(n,e,t)=>{if(n.length>=tp){const r=n.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return np(r,e,t),r}else{const r=new Ow(e,t);return n.push(r),r}},il=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>Wa(e-s.index)<Wa(e-o.index)?s:o);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,jw(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&Wa(t.index-i)<r.parent.length/tp?(np(t,r,i),t):Pw(n._searchMarker,r,i)},To=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=Di(e,i.index+t))}},sl=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;Ln(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;Ug(r._eH,t,e)};class sn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Fg(),this._dEH=Fg(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw _r()}clone(){throw _r()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){zg(this._eH,e)}observeDeep(e){zg(this._dEH,e)}unobserve(e){Bg(this._eH,e)}unobserveDeep(e){Bg(this._dEH,e)}toJSON(){}}const rp=(n,e,t)=>{n.doc??fn(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},ip=n=>{n.doc??fn();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},Eo=(n,e)=>{let t=0,r=n._start;for(n.doc??fn();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],t++,n)}r=r.right}},sp=(n,e)=>{const t=[];return Eo(n,(r,i)=>{t.push(e(r,i,n))}),t},Fw=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},op=(n,e)=>{n.doc??fn();const t=il(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},ol=(n,e,t,r)=>{let i=t;const s=n.doc,o=s.clientID,a=s.store,l=t===null?e._start:t.right;let u=[];const g=()=>{u.length>0&&(i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Fi(u)),i.integrate(n,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(g(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new ko(new Uint8Array(d))),i.integrate(n,0);break;case Br:i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Mo(d)),i.integrate(n,0);break;default:if(d instanceof sn)i=new Et(Xe(o,Ht(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Cr(d)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),g()},ap=()=>yr("Length exceeded!"),lp=(n,e,t,r)=>{if(t>e._length)throw ap();if(t===0)return e._searchMarker&&To(e._searchMarker,t,r.length),ol(n,e,null,r);const i=t,s=il(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&En(n,Xe(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&To(e._searchMarker,i,r.length),ol(n,e,o,r)},zw=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return ol(n,e,i,t)},cp=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=il(e,t);let a=e._start;for(o!==null&&(a=o.p,t-=o.index);a!==null&&t>0;a=a.right)!a.deleted&&a.countable&&(t<a.length&&En(n,Xe(a.id.client,a.id.clock+t)),t-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&En(n,Xe(a.id.client,a.id.clock+r)),a.delete(n),r-=a.length),a=a.right;if(r>0)throw ap();e._searchMarker&&To(e._searchMarker,i,-s+r)},al=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Bu=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let a;if(r==null)a=new Fi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:a=new Fi([r]);break;case Uint8Array:a=new ko(r);break;case Br:a=new Mo(r);break;default:if(r instanceof sn)a=new Cr(r);else throw new Error("Unexpected content type")}new Et(Xe(o,Ht(s.store,o)),i,i&&i.lastId,null,null,e,t,a).integrate(n,0)},Uu=(n,e)=>{n.doc??fn();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},up=n=>{const e={};return n.doc??fn(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},dp=(n,e)=>{n.doc??fn();const t=n._map.get(e);return t!==void 0&&!t.deleted},Bw=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&bs(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},ll=n=>(n.doc??fn(),Zb(n._map.entries(),e=>!e[1].deleted));class Uw extends rl{}class vs extends sn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new vs;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new vs}clone(){const e=new vs;return e.insert(0,this.toArray().map(t=>t instanceof sn?t.clone():t)),e}get length(){return this.doc??fn(),this._length}_callObserver(e,t){super._callObserver(e,t),sl(this,e,new Uw(this,e))}insert(e,t){this.doc!==null?Tt(this.doc,r=>{lp(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?Tt(this.doc,t=>{zw(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?Tt(this.doc,r=>{cp(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return op(this,e)}toArray(){return ip(this)}slice(e=0,t=this.length){return rp(this,e,t)}toJSON(){return this.map(e=>e instanceof sn?e.toJSON():e)}map(e){return sp(this,e)}forEach(e){Eo(this,e)}[Symbol.iterator](){return Fw(this)}_write(e){e.writeTypeRef(cv)}}const Hw=n=>new vs;class fp extends rl{constructor(e,t,r){super(e,t),this.keysChanged=r}}class Pn extends sn{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new Pn}clone(){const e=new Pn;return this.forEach((t,r)=>{e.set(r,t instanceof sn?t.clone():t)}),e}_callObserver(e,t){sl(this,e,new fp(this,e,t))}toJSON(){this.doc??fn();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof sn?i.toJSON():i}}),e}get size(){return[...ll(this)].length}keys(){return Nu(ll(this),e=>e[0])}values(){return Nu(ll(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Nu(ll(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??fn(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Tt(this.doc,t=>{al(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?Tt(this.doc,r=>{Bu(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Uu(this,e)}has(e){return dp(this,e)}clear(){this.doc!==null?Tt(this.doc,e=>{this.forEach(function(t,r,i){al(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(uv)}}const Ww=n=>new Pn,oi=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&Db(n,e);class Hu{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&ir(),this.right.content.constructor){case Xt:this.right.deleted||xs(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const hp=(n,e,t)=>{for(;e.right!==null&&t>0;){switch(e.right.content.constructor){case Xt:e.right.deleted||xs(e.currentAttributes,e.right.content);break;default:e.right.deleted||(t<e.right.length&&En(n,Xe(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length);break}e.left=e.right,e.right=e.right.right}return e},cl=(n,e,t,r)=>{const i=new Map,s=r?il(e,t):null;if(s){const o=new Hu(s.p.left,s.p,s.index,i);return hp(n,o,t-s.index)}else{const o=new Hu(null,e._start,0,i);return hp(n,o,t)}},gp=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===Xt&&oi(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,a)=>{const l=t.left,u=t.right,g=new Et(Xe(s,Ht(i.store,s)),l,l&&l.lastId,u,u&&u.id,e,null,new Xt(a,o));g.integrate(n,0),t.right=g,t.forward()})},xs=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},pp=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===Xt&&oi(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},mp=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],u=t.currentAttributes.get(a)??null;if(!oi(u,l)){o.set(a,u);const{left:g,right:d}=t;t.right=new Et(Xe(s,Ht(i.store,s)),g,g&&g.lastId,d,d&&d.id,e,null,new Xt(a,l)),t.right.integrate(n,0),t.forward()}}return o},Wu=(n,e,t,r,i)=>{t.currentAttributes.forEach((f,m)=>{i[m]===void 0&&(i[m]=null)});const s=n.doc,o=s.clientID;pp(t,i);const a=mp(n,e,t,i),l=r.constructor===String?new xr(r):r instanceof sn?new Cr(r):new Pi(r);let{left:u,right:g,index:d}=t;e._searchMarker&&To(e._searchMarker,t.index,l.getLength()),g=new Et(Xe(o,Ht(s.store,o)),u,u&&u.lastId,g,g&&g.id,e,null,l),g.integrate(n,0),t.right=g,t.index=d,t.forward(),gp(n,e,t,a)},yp=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;pp(t,i);const a=mp(n,e,t,i);e:for(;t.right!==null&&(r>0||a.size>0&&(t.right.deleted||t.right.content.constructor===Xt));){if(!t.right.deleted)switch(t.right.content.constructor){case Xt:{const{key:l,value:u}=t.right.content,g=i[l];if(g!==void 0){if(oi(g,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}t.right.delete(n)}else t.currentAttributes.set(l,u);break}default:r<t.right.length&&En(n,Xe(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
40
40
  `;t.right=new Et(Xe(o,Ht(s.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new xr(l)),t.right.integrate(n,0),t.forward()}gp(n,e,t,a)},_p=(n,e,t,r,i)=>{let s=e;const o=Tn();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Xt){const u=s.content;o.set(u.key,u)}s=s.right}let a=0,l=!1;for(;e!==s;){if(t===e&&(l=!0),!e.deleted){const u=e.content;switch(u.constructor){case Xt:{const{key:g,value:d}=u,f=r.get(g)??null;(o.get(g)!==u||f===d)&&(e.delete(n),a++,!l&&(i.get(g)??null)===d&&f!==d&&(f===null?i.delete(g):i.set(g,f))),!l&&!e.deleted&&xs(i,u);break}}}e=e.right}return a},$w=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Xt){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},Yw=n=>{let e=0;return Tt(n.doc,t=>{let r=n._start,i=n._start,s=Tn();const o=su(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case Xt:xs(o,i.content);break;default:e+=_p(t,r,i,s,o),s=su(o),r=i;break}i=i.right}}),e},Vw=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const s=n.beforeState.get(r)||0;i!==s&&Vg(n,t.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===Xt&&o.constructor!==Vn&&e.add(o.parent)})}Tt(t,r=>{gs(n,n.deleteSet,i=>{if(i instanceof Vn||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Xt?e.add(s):$w(r,i)});for(const i of e)Yw(i)})},bp=(n,e,t)=>{const r=t,i=su(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Cr:case Pi:case xr:t<e.right.length&&En(n,Xe(e.right.id.client,e.right.id.clock+t)),t-=e.right.length,e.right.delete(n);break}e.forward()}s&&_p(n,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&To(o._searchMarker,e.index,-r+t),e};class wp extends rl{constructor(e,t,r){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];Tt(e,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const l={};let u="",g=0,d=0;const f=()=>{if(a!==null){let m=null;switch(a){case"delete":d>0&&(m={delete:d}),d=0;break;case"insert":(typeof u=="object"||u.length>0)&&(m={insert:u},i.size>0&&(m.attributes={},i.forEach((y,b)=>{y!==null&&(m.attributes[b]=y)}))),u="";break;case"retain":g>0&&(m={retain:g},Nb(l)||(m.attributes=Tb({},l))),g=0;break}m&&t.push(m),a=null}};for(;o!==null;){switch(o.content.constructor){case Cr:case Pi:this.adds(o)?this.deletes(o)||(f(),a="insert",u=o.content.getContent()[0],f()):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),d+=1):o.deleted||(a!=="retain"&&(f(),a="retain"),g+=1);break;case xr:this.adds(o)?this.deletes(o)||(a!=="insert"&&(f(),a="insert"),u+=o.content.str):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),d+=o.length):o.deleted||(a!=="retain"&&(f(),a="retain"),g+=o.length);break;case Xt:{const{key:m,value:y}=o.content;if(this.adds(o)){if(!this.deletes(o)){const b=i.get(m)??null;oi(b,y)?y!==null&&o.delete(r):(a==="retain"&&f(),oi(y,s.get(m)??null)?delete l[m]:l[m]=y)}}else if(this.deletes(o)){s.set(m,y);const b=i.get(m)??null;oi(b,y)||(a==="retain"&&f(),l[m]=b)}else if(!o.deleted){s.set(m,y);const b=l[m];b!==void 0&&(oi(b,y)?b!==null&&o.delete(r):(a==="retain"&&f(),y===null?delete l[m]:l[m]=y))}o.deleted||(a==="insert"&&f(),xs(i,o.content));break}}o=o.right}for(f();t.length>0;){const m=t[t.length-1];if(m.retain!==void 0&&m.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class Cs extends sn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??fn(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Cs}clone(){const e=new Cs;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new wp(this,e,t);sl(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??fn();let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===xr&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?Tt(this.doc,r=>{const i=new Hu(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const a=!t&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
41
- `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&Wu(r,this,i,a,o.attributes||{})}else o.retain!==void 0?yp(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&bp(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??fn();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function u(){if(a.length>0){const d={};let f=!1;s.forEach((y,b)=>{f=!0,d[b]=y});const m={insert:a};f&&(m.attributes=d),i.push(m),a=""}}const g=()=>{for(;l!==null;){if(bs(l,e)||t!==void 0&&bs(l,t))switch(l.content.constructor){case xr:{const d=s.get("ychange");e!==void 0&&!bs(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(u(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):t!==void 0&&!bs(l,t)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(u(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(u(),s.delete("ychange")),a+=l.content.str;break}case Cr:case Pi:{u();const d={insert:l.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((m,y)=>{f[y]=m})}i.push(d);break}case Xt:bs(l,e)&&(u(),xs(s,l.content));break}l=l.right}u()};return e||t?Tt(o,d=>{e&&Lu(d,e),t&&Lu(d,t),g()},"cleanup"):g(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?Tt(i,s=>{const o=cl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),Wu(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?Tt(i,s=>{const o=cl(s,this,e,!r);Wu(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?Tt(r,i=>{bp(i,cl(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?Tt(i,s=>{const o=cl(s,this,e,!1);o.right!==null&&yp(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?Tt(this.doc,t=>{al(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Tt(this.doc,r=>{Bu(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Uu(this,e)}getAttributes(){return up(this)}_write(e){e.writeTypeRef(dv)}}const qw=n=>new Cs;class $u{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??fn()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===ai||t.constructor===Oi)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Oi extends sn{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Oi}clone(){const e=new Oi;return e.insert(0,this.toArray().map(t=>t instanceof sn?t.clone():t)),e}get length(){return this.doc??fn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new $u(this,e)}querySelector(e){e=e.toUpperCase();const r=new $u(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),jr(new $u(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){sl(this,e,new vp(this,t,e))}toString(){return sp(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Eo(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?Tt(this.doc,r=>{lp(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)Tt(this.doc,r=>{const i=e&&e instanceof sn?e._item:e;ol(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw yr("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?Tt(this.doc,r=>{cp(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return ip(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return op(this,e)}slice(e=0,t=this.length){return rp(this,e,t)}forEach(e){Eo(this,e)}_write(e){e.writeTypeRef(hv)}}const Kw=n=>new Oi;class ai extends Oi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new ai(this.nodeName)}clone(){const e=new ai(this.nodeName),t=this.getAttributes();return Eb(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof sn?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];t.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Tt(this.doc,t=>{al(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Tt(this.doc,r=>{Bu(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Uu(this,e)}hasAttribute(e){return dp(this,e)}getAttributes(e){return e?Bw(this,e):up(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Eo(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(fv),e.writeKey(this.nodeName)}}const Gw=n=>new ai(n.readKey());class vp extends rl{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class ul extends Pn{constructor(e){super(),this.hookName=e}_copy(){return new ul(this.hookName)}clone(){const e=new ul(this.hookName);return this.forEach((t,r)=>{e.set(r,t)}),e}toDOM(e=document,t={},r){const i=t[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(gv),e.writeKey(this.hookName)}}const Xw=n=>new ul(n.readKey());class ji extends Cs{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new ji}clone(){const e=new ji;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),t.push({nodeName:i,attrs:s})}t.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const s=t[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(pv)}}const Jw=n=>new ji;class Yu{constructor(e,t){this.id=e,this.length=t}get deleted(){throw _r()}mergeWith(e){return!1}write(e,t,r){throw _r()}integrate(e,t){throw _r()}}const Zw=0;class Vn extends Yu{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),$g(e.doc.store,this)}write(e,t){e.writeInfo(Zw),e.writeLen(this.length-t)}getMissing(e,t){return null}}class ko{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ko(this.content)}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const Qw=n=>new ko(n.readBuf());class No{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new No(this.len)}splice(e){const t=new No(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Co(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const ev=n=>new No(n.readLen()),xp=(n,e)=>new Br({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Mo{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Mo(xp(this.doc.guid,this.opts))}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const tv=n=>new Mo(xp(n.readString(),n.readAny()));class Pi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Pi(this.embed)}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const nv=n=>new Pi(n.readJSON());class Xt{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Xt(this.key,this.value)}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const rv=n=>new Xt(n.readKey(),n.readJSON());class dl{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new dl(this.arr)}splice(e){const t=new dl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const iv=n=>{const e=n.readLen(),t=[];for(let r=0;r<e;r++){const i=n.readString();i==="undefined"?t.push(void 0):t.push(JSON.parse(i))}return new dl(t)},sv=vo("node_env")==="development";class Fi{constructor(e){this.arr=e,sv&&fg(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Fi(this.arr)}splice(e){const t=new Fi(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const ov=n=>{const e=n.readLen(),t=[];for(let r=0;r<e;r++)t.push(n.readAny());return new Fi(t)};class xr{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new xr(this.str)}splice(e){const t=new xr(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const av=n=>new xr(n.readString()),lv=[Hw,Ww,qw,Gw,Kw,Xw,Jw],cv=0,uv=1,dv=2,fv=3,hv=4,gv=5,pv=6;class Cr{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Cr(this.type._copy())}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const mv=n=>new Cr(lv[n.readTypeRef()](n)),Vu=(n,e)=>{let t=e,r=0,i;do r>0&&(t=Xe(t.client,t.clock+r)),i=ws(n,t),r=t.clock-i.id.clock,t=i.redone;while(t!==null&&i instanceof Et);return{item:i,diff:r}},qu=(n,e)=>{for(;n!==null&&n.keep!==e;)n.keep=e,n=n.parent._item},fl=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Et(Xe(r,i+t),e,Xe(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=Xe(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s},Cp=(n,e)=>K0(n,t=>xo(t.deletions,e)),Sp=(n,e,t,r,i,s)=>{const o=n.doc,a=o.store,l=o.clientID,u=e.redone;if(u!==null)return En(n,u);let g=e.parent._item,d=null,f;if(g!==null&&g.deleted===!0){if(g.redone===null&&(!t.has(g)||Sp(n,g,t,r,i,s)===null))return null;for(;g.redone!==null;)g=En(n,g.redone)}const m=g===null?e.parent:g.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let S=d;for(;S!==null&&S.parent._item!==g;)S=S.redone===null?null:En(n,S.redone);if(S!==null&&S.parent._item===g){d=S;break}d=d.left}for(;f!==null;){let S=f;for(;S!==null&&S.parent._item!==g;)S=S.redone===null?null:En(n,S.redone);if(S!==null&&S.parent._item===g){f=S;break}f=f.right}}else if(f=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||xo(r,d.right.id)||Cp(s.undoStack,d.right.id)||Cp(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=En(n,d.redone);if(d&&d.right!==null)return null}else d=m._map.get(e.parentSub)||null;const y=Ht(a,l),b=Xe(l,y),C=new Et(b,d,d&&d.lastId,f,f&&f.id,m,e.parentSub,e.content.copy());return e.redone=b,qu(C,!0),C.integrate(n,0),C};class Et extends Yu{constructor(e,t,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?Vh:0}set marker(e){(this.info&du)>0!==e&&(this.info^=du)}get marker(){return(this.info&du)>0}get keep(){return(this.info&Yh)>0}set keep(e){this.keep!==e&&(this.info^=Yh)}get countable(){return(this.info&Vh)>0}get deleted(){return(this.info&uu)>0}set deleted(e){this.deleted!==e&&(this.info^=uu)}markDeleted(){this.info|=uu}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ht(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ht(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ys&&this.id.client!==this.parent.client&&this.parent.clock>=Ht(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Yg(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=En(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Vn||this.right&&this.right.constructor===Vn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Et&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Et&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ys){const r=ws(t,this.parent);r.constructor===Vn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Yg(e,e.doc.store,Xe(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),_s(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(_s(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(ws(e.doc.store,i.origin)))s.has(ws(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),$g(e.doc.store,this),this.content.integrate(e,this),Kg(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Vn(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Xe(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&_s(e.origin,this.lastId)&&this.right===e&&_s(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Co(e.deleteSet,this.id.client,this.id.clock,this.length),Kg(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw ir();this.content.gc(e),t?Cw(e,this,new Vn(this.id,this.length)):this.content=new No(this.length)}write(e,t){const r=t>0?Xe(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Ya|(r===null?0:On)|(i===null?0:Pr)|(s===null?0:po);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=Hg(a);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===ys?(e.writeParentInfo(!1),e.writeLeftID(a)):ir();s!==null&&e.writeString(s)}this.content.write(e,t)}}const Tp=(n,e)=>yv[e&Ya](n),yv=[()=>{ir()},ev,iv,Qw,av,nv,rv,mv,ov,tv,()=>{ir()}],_v=10;class qn extends Yu{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){ir()}write(e,t){e.writeInfo(_v),je(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const Ep=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},kp="__ $YJS$ __";Ep[kp]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Ep[kp]=!0;function bv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var wv=bv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Ku(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e===null?tt(r):e.get(r);i==null&&wv(174),t.push(r),r=i.__next}return t}function vv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xv=vv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const hl=new Map;function Np(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function Mp(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function Cv(n,e,t,r,i){const s=e.getKey(),o=r.getKey(),a=document.createRange();let l=n.getElementByKey(s),u=n.getElementByKey(o),g=t,d=i;if(me(e)&&(l=Np(l)),me(r)&&(u=Np(u)),e===void 0||r===void 0||l===null||u===null)return null;l.nodeName==="BR"&&([l,g]=Mp(l)),u.nodeName==="BR"&&([u,d]=Mp(u));const f=l.firstChild;l===u&&f!=null&&f.nodeName==="BR"&&g===0&&d===0&&(d=1);try{a.setStart(l,g),a.setEnd(u,d)}catch{return null}return!a.collapsed||g===d&&s===o||(a.setStart(u,d),a.setEnd(l,g)),a}function Sv(n,e){const t=n.getRootElement();if(t===null)return[];const r=t.getBoundingClientRect(),i=getComputedStyle(t),s=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),o=Array.from(e.getClientRects());let a,l=o.length;o.sort((u,g)=>{const d=u.top-g.top;return Math.abs(d)<=3?u.left-g.left:d});for(let u=0;u<l;u++){const g=o[u],d=a&&a.top<=g.top&&a.top+a.height>g.top&&a.left+a.width>g.left,f=g.width+s===r.width;d||f?(o.splice(u--,1),l--):a=g}return o}function Dp(n){const e={},t=n.split(";");for(const r of t)if(r!==""){const[i,s]=r.split(/:([^]+)/);i&&s&&(e[i.trim()]=s.trim())}return e}function Tv(n){let e=hl.get(n);return e===void 0&&(e=Dp(n),hl.set(n,e)),e}function Ap(n){const e=n.constructor.clone(n);return e.__parent=n.__parent,e.__next=n.__next,e.__prev=n.__prev,ie(n)&&ie(e)?(r=n,(t=e).__first=r.__first,t.__last=r.__last,t.__size=r.__size,t.__format=r.__format,t.__indent=r.__indent,t.__dir=r.__dir,t):me(n)&&me(e)?function(i,s){return i.__format=s.__format,i.__style=s.__style,i.__mode=s.__mode,i.__detail=s.__detail,i}(e,n):us(n)&&us(e)?function(i,s){return i.__textFormat=s.__textFormat,i}(e,n):e;var t,r}function Ip(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[r,i]=t,s=n.isBackward(),o=r.getNode(),a=i.getNode(),l=e.is(o),u=e.is(a);if(l||u){const[g,d]=Xc(n),f=o.is(a),m=e.is(s?a:o),y=e.is(s?o:a);let b,C=0;return f?(C=g>d?d:g,b=g>d?g:d):m?(C=s?d:g,b=void 0):y&&(C=0,b=s?g:d),e.__text=e.__text.slice(C,b),e}}return e}function Ev(n){const e=n.getStyle(),t=Dp(e);hl.set(e,t)}function Ss(n,e){const t=Tv("getStyle"in n?n.getStyle():n.style),r=Object.entries(e).reduce((s,[o,a])=>(a instanceof Function?s[o]=a(t[o]):a===null?delete s[o]:s[o]=a,s),{...t}),i=function(s){let o="";for(const a in s)a&&(o+=`${a}: ${s[a]};`);return o}(r);n.setStyle(i),hl.set(i,r)}function kv(n,e){const t=n.getNodes(),r=t.length,i=n.getStartEndPoints();if(i===null)return;const[s,o]=i,a=r-1;let l=t[0],u=t[a];if(n.isCollapsed()&&he(n))return void Ss(n,e);const g=l.getTextContent().length,d=o.offset;let f=s.offset;const m=s.isBefore(o);let y=m?f:d,b=m?d:f;const C=m?s.type:o.type,S=m?o.type:s.type,A=m?o.key:s.key;if(me(l)&&y===g){const v=l.getNextSibling();me(v)&&(f=0,y=0,l=v)}if(t.length===1){if(me(l)&&l.canHaveFormat()){if(y=C==="element"?0:f>d?d:f,b=S==="element"?g:f>d?f:d,y===b)return;if(y===0&&b===g)Ss(l,e),l.select(y,b);else{const v=l.splitText(y,b),k=y===0?v[0]:v[1];Ss(k,e),k.select(0,b-y)}}}else{if(me(l)&&y<l.getTextContentSize()&&l.canHaveFormat()&&(y!==0&&(l=l.splitText(y)[1],y=0,m?s.set(l.getKey(),y,"text"):o.set(l.getKey(),y,"text")),Ss(l,e)),me(u)&&u.canHaveFormat()){const v=u.getTextContent().length;u.__key!==A&&b!==0&&(b=v),b!==v&&([u]=u.splitText(b)),b===0&&S!=="element"||Ss(u,e)}for(let v=1;v<a;v++){const k=t[v],T=k.getKey();me(k)&&k.canHaveFormat()&&T!==l.getKey()&&T!==u.getKey()&&!k.isToken()&&Ss(k,e)}}}function Rp(n){return n.getNode().isAttached()}function Nv(n){let e=n;for(;e!==null&&!un(e);){const t=e.getLatest(),r=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=r}}function Mv(n,e,t=null){const r=n.getStartEndPoints(),i=r?r[0]:null,s=n.getNodes(),o=s.length;if(i!==null&&(o===0||o===1&&i.type==="element"&&i.getNode().getChildrenSize()===0)){const u=i.type==="text"?i.getNode().getParentOrThrow():i.getNode(),g=u.getChildren();let d=e();return d.setFormat(u.getFormatType()),d.setIndent(u.getIndent()),g.forEach(f=>d.append(f)),t&&(d=t.append(d)),void u.replace(d)}let a=null,l=[];for(let u=0;u<o;u++){const g=s[u];un(g)?(Gu(n,l,l.length,e,t),l=[],a=g):a===null||a!==null&&Ca(g,a)?l.push(g):(Gu(n,l,l.length,e,t),l=[g])}Gu(n,l,l.length,e,t)}function Gu(n,e,t,r,i=null){if(e.length===0)return;const s=e[0],o=new Map,a=[];let l=ie(s)?s:s.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let u=!1;for(;l!==null;){const y=l.getPreviousSibling();if(y!==null){l=y,u=!0;break}if(l=l.getParentOrThrow(),un(l))break}const g=new Set;for(let y=0;y<t;y++){const b=e[y];ie(b)&&b.getChildrenSize()===0&&g.add(b.getKey())}const d=new Set;for(let y=0;y<t;y++){const b=e[y];let C=b.getParent();if(C!==null&&C.isInline()&&(C=C.getParent()),C!==null&&m0(b)&&!d.has(b.getKey())){const S=C.getKey();if(o.get(S)===void 0){const A=r();A.setFormat(C.getFormatType()),A.setIndent(C.getIndent()),a.push(A),o.set(S,A),C.getChildren().forEach(v=>{A.append(v),d.add(v.getKey()),ie(v)&&v.getChildrenKeys().forEach(k=>d.add(k))}),Nv(C)}}else if(g.has(b.getKey())){ie(b)||xv(179);const S=r();S.setFormat(b.getFormatType()),S.setIndent(b.getIndent()),a.push(S),b.remove(!0)}}if(i!==null)for(let y=0;y<a.length;y++){const b=a[y];i.append(b)}let f=null;if(un(l))if(u)if(i!==null)l.insertAfter(i);else for(let y=a.length-1;y>=0;y--){const b=a[y];l.insertAfter(b)}else{const y=l.getFirstChild();if(ie(y)&&(l=y),y===null)if(i)l.append(i);else for(let b=0;b<a.length;b++){const C=a[b];l.append(C),f=C}else if(i!==null)y.insertBefore(i);else for(let b=0;b<a.length;b++){const C=a[b];y.insertBefore(C),f=C}}else if(i)l.insertAfter(i);else for(let y=a.length-1;y>=0;y--){const b=a[y];l.insertAfter(b),f=b}const m=ti();he(m)&&Rp(m.anchor)&&Rp(m.focus)?Nt(m.clone()):f!==null?f.selectEnd():n.dirty=!0}function Lp(n,e){const t=to(n.focus,e);return gt(t)&&!t.isIsolated()||ie(t)&&!t.isInline()&&!t.canBeEmpty()}function Dv(n,e,t,r){n.modify(e?"extend":"move",t,r)}function Av(n){const e=n.anchor.getNode();return(dn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Op(n,e,t){const r=Av(n);Dv(n,e,t?!r:r,"character")}function Iv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var on=Iv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});let Do=class{constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){const e=tt(this._key);return hr(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){e.collabNodeMap.delete(this._key)}};function jp(n,e){const t=new Do(n,e);return n._collabNode=t,t}let kn=class{constructor(e,t,r,i){this._key="",this._map=e,this._parent=r,this._text=t,this._type=i,this._normalized=!1}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return me(t)?t:null}getNode(){const e=tt(this._key);return me(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,r){const i=this._parent._xmlText,s=this.getOffset()+1+e;t!==0&&i.delete(s,t),r!==""&&i.insert(s,r)}syncPropertiesAndTextFromLexical(e,t,r){const i=this.getPrevNode(r),s=t.__text;if(Zu(e,this._map,i,t),i!==null){const o=i.__text;o!==s&&(function(a,l,u,g){const d=ge();let f=g.length;if(he(d)&&d.isCollapsed()){const y=d.anchor;y.key===l&&(f=y.offset)}const m=function(y,b,C){const S=y.length,A=b.length;let v=0,k=0;for(;v<S&&v<A&&y[v]===b[v]&&v<C;)v++;for(;k+v<S&&k+v<A&&y[S-k-1]===b[A-k-1];)k++;for(;k+v<S&&k+v<A&&y[v]===b[v];)v++;return{index:v,insert:b.slice(v,A-k),remove:S-v-k}}(u,g,f);a.spliceText(m.index,m.remove,m.insert)}(this,t.__key,o,s),this._text=s)}}syncPropertiesAndTextFromYjs(e,t){const r=this.getNode();r===null&&on(84),Ju(e,this._map,r,t);const i=this._text;r.__text!==i&&(r.getWritable().__text=i)}destroy(e){e.collabNodeMap.delete(this._key)}};function Pp(n,e,t,r){const i=new kn(n,e,t,r);return n._collabNode=i,i}const Rv=new Set(["__key","__parent","__next","__prev"]),Lv=new Set(["__first","__last","__size"]),Ov=new Set(["__cachedText"]),jv=new Set(["__text"]);function Fp(n,e,t){if(Rv.has(n))return!0;if(me(e)){if(jv.has(n))return!0}else if(ie(e)&&(Lv.has(n)||dn(e)&&Ov.has(n)))return!0;const r=e.constructor,i=t.excludedProperties.get(r);return i!=null&&i.has(n)}function Ao(n){const e=tt(n);return e===null&&on(85),e}function zp(n,e,t){const r=e.__type;let i;if(ie(e))i=Qu(new ji,t,r),i.syncPropertiesFromLexical(n,e,null),i.syncChildrenFromLexical(n,e,null,null,null);else if(me(e))i=Pp(new Pn,e.__text,t,r),i.syncPropertiesAndTextFromLexical(n,e,null);else if(hr(e)){const s=new Pn;s.set("__type","linebreak"),i=jp(s,t)}else gt(e)?(i=$p(new ai,t,r),i.syncPropertiesFromLexical(n,e,null)):on(86);return i._key=e.__key,i}function Xu(n,e,t){const r=e._collabNode;if(r===void 0){const i=n.editor._nodes,s=function(l){const u=l instanceof Pn?l.get("__type"):l.getAttribute("__type");return u==null&&on(87),u}(e);i.get(s)===void 0&&on(88,s);const o=e.parent,a=t===void 0&&o!==null?Xu(n,o):t||null;if(a instanceof Ts||on(89),e instanceof ji)return Qu(e,a,s);if(e instanceof Pn)return s==="linebreak"?jp(e,a):Pp(e,"",a,s);if(e instanceof ai)return $p(e,a,s)}return r}function Pv(n,e,t){const r=e.getType(),i=n.editor._nodes.get(r);i===void 0&&on(88,r);const s=new i.klass;if(s.__parent=t,e._key=s.__key,e instanceof Ts){const o=e._xmlText;e.syncPropertiesFromYjs(n,null),e.applyChildrenYjsDelta(n,o.toDelta()),e.syncChildrenFromYjs(n)}else e instanceof kn?e.syncPropertiesAndTextFromYjs(n,null):e instanceof li&&e.syncPropertiesFromYjs(n,null);return n.collabNodeMap.set(s.__key,e),s}function Ju(n,e,t,r){const i=r===null?e instanceof Pn?Array.from(e.keys()):Object.keys(e.getAttributes()):Array.from(r);let s;for(let o=0;o<i.length;o++){const a=i[o];if(Fp(a,t,n))continue;const l=t[a];let u=e instanceof Pn?e.get(a):e.getAttribute(a);if(l!==u){if(u instanceof Br){const g=n.docMap;l instanceof Br&&g.delete(l.guid);const d=Ha(),f=u.guid;d._key=f,g.set(f,u),u=d}s===void 0&&(s=t.getWritable()),s[a]=u}}}function Zu(n,e,t,r){const i=r.__type,s=n.nodeProperties;let o=s.get(i);o===void 0&&(o=Object.keys(r).filter(l=>!Fp(l,r,n)),s.set(i,o));const a=n.editor.constructor;for(let l=0;l<o.length;l++){const u=o[l],g=t===null?void 0:t[u];let d=r[u];if(g!==d){if(d instanceof a){const f=n.docMap;let m;if(g instanceof a){const C=g._key;m=f.get(C),f.delete(C)}const y=m||new Br,b=y.guid;d._key=b,f.set(b,y),d=y,n.editor.update(()=>{r.markDirty()})}e instanceof Pn?e.set(u,d):e.setAttribute(u,d)}}}function Bp(n,e,t,r){return n.slice(0,e)+r+n.slice(e+t)}function gl(n,e,t){let r=0,i=0;const s=n._children,o=s.length;for(;i<o;i++){const a=s[i],l=r;if(r+=a.getSize(),(t?r>=e:r>e)&&a instanceof kn){let u=e-l-1;return u<0&&(u=0),{length:r-e,node:a,nodeIndex:i,offset:u}}if(r>e)return{length:0,node:a,nodeIndex:i,offset:l};if(i===o-1)return{length:0,node:null,nodeIndex:i+1,offset:l+1}}return{length:0,node:null,nodeIndex:0,offset:0}}function Up(n){const e=n.anchor,t=n.focus;let r=!1;try{const i=e.getNode(),s=t.getNode();(!i.isAttached()||!s.isAttached()||me(i)&&e.offset>i.getTextContentSize()||me(s)&&t.offset>s.getTextContentSize())&&(r=!0)}catch{r=!0}return r}function Hp(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling();if(i===null)if(s!==null){const o=s.getWritable();r.__first=s.__key,o.__prev=null}else r.__first=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(s===null)if(i!==null){const o=i.getWritable();r.__last=i.__key,o.__next=null}else r.__last=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function Wp(n,e){const t=e._nodeMap.get(n);if(!t)return void dt().selectStart();const r=t.__prev;let i=null;r&&(i=tt(r)),i===null&&t.__parent!==null&&(i=tt(t.__parent)),i!==null?i!==null&&i.isAttached()?i.selectEnd():Wp(i.__key,e):dt().selectStart()}class li{constructor(e,t,r){this._key="",this._xmlElem=e,this._parent=t,this._type=r}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return gt(t)?t:null}getNode(){const e=tt(this._key);return gt(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,r){const i=this.getPrevNode(r);Zu(e,this._xmlElem,i,t)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&on(83),Ju(e,this._xmlElem,r,t)}destroy(e){e.collabNodeMap.delete(this._key)}}function $p(n,e,t){const r=new li(n,e,t);return n._collabNode=r,r}let Ts=class Ws{constructor(e,t,r){this._key="",this._children=[],this._xmlText=e,this._type=r,this._parent=t}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return ie(t)?t:null}getNode(){const e=tt(this._key);return ie(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&on(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&on(91),Ju(e,this._xmlText,r,t)}applyChildrenYjsDelta(e,t){const r=this._children;let i=0;for(let s=0;s<t.length;s++){const o=t[s],a=o.insert,l=o.delete;if(o.retain!=null)i+=o.retain;else if(typeof l=="number"){let u=l;for(;u>0;){const{node:g,nodeIndex:d,offset:f,length:m}=gl(this,i,!1);if(g instanceof Ws||g instanceof Do||g instanceof li)r.splice(d,1),u-=1;else{if(!(g instanceof kn))break;{const y=Math.min(u,m),b=d!==0?r[d-1]:null,C=g.getSize();f===0&&y===1&&d>0&&b instanceof kn&&m===C&&Array.from(g._map.keys()).length===0?(b._text+=g._text,r.splice(d,1)):f===0&&y===C?r.splice(d,1):g._text=Bp(g._text,f,y,""),u-=y}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:u,offset:g}=gl(this,i,!0);u instanceof kn?u._text=Bp(u._text,g,0,a):this._xmlText.delete(g,a.length),i+=a.length}else{const u=a,{nodeIndex:g}=gl(this,i,!1),d=Xu(e,u,this);r.splice(g,0,d),i+=1}}}}syncChildrenFromYjs(e){const t=this.getNode();t===null&&on(92);const r=t.__key,i=Ku(t,null),s=i.length,o=this._children,a=o.length,l=e.collabNodeMap,u=new Set;let g,d,f=0,m=null;a!==s&&(d=t.getWritable());for(let y=0;y<a;y++){const b=i[f],C=o[y],S=C.getNode(),A=C._key;if(S!==null&&b===A){const v=me(S);if(u.add(b),v)if(C._key=b,C instanceof Ws){const k=C._xmlText;C.syncPropertiesFromYjs(e,null),C.applyChildrenYjsDelta(e,k.toDelta()),C.syncChildrenFromYjs(e)}else C instanceof kn?C.syncPropertiesAndTextFromYjs(e,null):C instanceof li?C.syncPropertiesFromYjs(e,null):C instanceof Do||on(93);m=S,f++}else{if(g===void 0){g=new Set;for(let T=0;T<a;T++){const N=o[T]._key;N!==""&&g.add(N)}}if(S!==null&&b!==void 0&&!g.has(b)){Hp(Ao(b)),y--,f++;continue}d=t.getWritable();const v=Pv(e,C,r),k=v.__key;if(l.set(k,C),m===null){const T=d.getFirstChild();if(d.__first=k,T!==null){const N=T.getWritable();N.__prev=k,v.__next=N.__key}}else{const T=m.getWritable(),N=m.getNextSibling();if(T.__next=k,v.__prev=m.__key,N!==null){const h=N.getWritable();h.__prev=k,v.__next=h.__key}}y===a-1&&(d.__last=k),d.__size++,m=v}}for(let y=0;y<s;y++){const b=i[y];if(!u.has(b)){const C=Ao(b),S=e.collabNodeMap.get(b);S!==void 0&&S.destroy(e),Hp(C)}}}syncPropertiesFromLexical(e,t,r){Zu(e,this._xmlText,this.getPrevNode(r),t)}_syncChildFromLexical(e,t,r,i,s,o){const a=this._children[t],l=Ao(r);a instanceof Ws&&ie(l)?(a.syncPropertiesFromLexical(e,l,i),a.syncChildrenFromLexical(e,l,i,s,o)):a instanceof kn&&me(l)?a.syncPropertiesAndTextFromLexical(e,l,i):a instanceof li&&gt(l)&&a.syncPropertiesFromLexical(e,l,i)}syncChildrenFromLexical(e,t,r,i,s){const o=this.getPrevNode(r),a=o===null?[]:Ku(o,r),l=Ku(t,null),u=a.length-1,g=l.length-1,d=e.collabNodeMap;let f,m,y=0,b=0;for(;y<=u&&b<=g;){const A=a[y],v=l[b];if(A===v)this._syncChildFromLexical(e,b,v,r,i,s),y++,b++;else{f===void 0&&(f=new Set(a)),m===void 0&&(m=new Set(l));const k=m.has(A),T=f.has(v);if(k){const N=zp(e,Ao(v),this);d.set(v,N),T?(this.splice(e,b,1,N),y++,b++):(this.splice(e,b,0,N),b++)}else this.splice(e,b,1),y++}}const C=y>u,S=b>g;if(C&&!S)for(;b<=g;++b){const A=l[b],v=zp(e,Ao(A),this);this.append(v),d.set(A,v)}else if(S&&!C)for(let A=this._children.length-1;A>=b;A--)this.splice(e,A,1)}append(e){const t=this._xmlText,r=this._children,i=r[r.length-1],s=i!==void 0?i.getOffset()+i.getSize():0;if(e instanceof Ws)t.insertEmbed(s,e._xmlText);else if(e instanceof kn){const o=e._map;o.parent===null&&t.insertEmbed(s,o),t.insert(s+1,e._text)}else e instanceof Do?t.insertEmbed(s,e._map):e instanceof li&&t.insertEmbed(s,e._xmlElem);this._children.push(e)}splice(e,t,r,i){const s=this._children,o=s[t];if(o===void 0)return i===void 0&&on(94),void this.append(i);const a=o.getOffset();a===-1&&on(95);const l=this._xmlText;if(r!==0&&l.delete(a,o.getSize()),i instanceof Ws)l.insertEmbed(a,i._xmlText);else if(i instanceof kn){const u=i._map;u.parent===null&&l.insertEmbed(a,u),l.insert(a+1,i._text)}else i instanceof Do?l.insertEmbed(a,i._map):i instanceof li&&l.insertEmbed(a,i._xmlElem);if(r!==0){const u=s.slice(t,t+r);for(let g=0;g<u.length;g++)u[g].destroy(e)}i!==void 0?s.splice(t,r,i):s.splice(t,r)}getChildOffset(e){let t=0;const r=this._children;for(let i=0;i<r.length;i++){const s=r[i];if(s===e)return t;t+=s.getSize()}return-1}destroy(e){const t=e.collabNodeMap,r=this._children;for(let i=0;i<r.length;i++)r[i].destroy(e);t.delete(this._key)}};function Qu(n,e,t){const r=new Ts(n,e,t);return n._collabNode=r,r}function Fv(n,e,t,r,i,s){r==null&&on(81);const o=Qu(r.get("root",ji),null,"root");return o._key="root",{clientID:r.clientID,collabNodeMap:new Map,cursors:new Map,cursorsContainer:null,doc:r,docMap:i,editor:n,excludedProperties:s||new Map,id:t,nodeProperties:new Map,root:o}}function Yp(n,e){const t=e.collabNodeMap.get(n.key);if(t===void 0)return null;let r=n.offset,i=t.getSharedType();if(t instanceof kn){i=t._parent._xmlText;const s=t.getOffset();if(s===-1)return null;r=s+1+r}else if(t instanceof Ts&&n.type==="element"){const s=n.getNode();ie(s)||on(184);let o=0,a=0,l=s.getFirstChild();for(;l!==null&&a++<r;)me(l)?o+=l.getTextContentSize()+1:o++,l=l.getNextSibling();r=o}return ww(i,r)}function pl(n,e){return vw(n,e.doc)}function Vp(n,e){if(n==null){if(e!=null)return!0}else if(e==null||!xw(n,e))return!0;return!1}function zv(n,e){return{color:e,name:n,selection:null}}function qp(n,e){const t=n.cursorsContainer;if(t!==null){const r=e.selections,i=r.length;for(let s=0;s<i;s++)t.removeChild(r[s])}}function Bv(n,e){const t=e.selection;t!==null&&qp(n,t)}function Uv(n,e,t,r,i){const s=n.color,o=document.createElement("span");o.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:${s};z-index:10;`;const a=document.createElement("span");return a.textContent=n.name,a.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:${s};color:#fff;line-height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`,o.appendChild(a),{anchor:{key:e,offset:t},caret:o,color:s,focus:{key:r,offset:i},name:a,selections:[]}}function Hv(n,e,t,r){const i=n.editor,s=i.getRootElement(),o=n.cursorsContainer;if(o===null||s===null)return;const a=o.offsetParent;if(a===null)return;const l=a.getBoundingClientRect(),u=e.selection;if(t===null)return u===null?void 0:(e.selection=null,void qp(n,u));e.selection=t;const g=t.caret,d=t.color,f=t.selections,m=t.anchor,y=t.focus,b=m.key,C=y.key,S=r.get(b),A=r.get(C);if(S==null||A==null)return;let v;if(S===A&&hr(S))v=[i.getElementByKey(b).getBoundingClientRect()];else{const N=Cv(i,S,m.offset,A,y.offset);if(N===null)return;v=Sv(i,N)}const k=f.length,T=v.length;for(let N=0;N<T;N++){const h=v[N];let I=f[N];if(I===void 0){I=document.createElement("span"),f[N]=I;const j=document.createElement("span");I.appendChild(j),o.appendChild(I)}const O=`position:absolute;top:${h.top-l.top}px;left:${h.left-l.left}px;height:${h.height}px;width:${h.width}px;pointer-events:none;z-index:5;`;I.style.cssText=O,I.firstChild.style.cssText=`${O}left:0;top:0;background-color:${d};opacity:0.3;`,N===T-1&&g.parentNode!==I&&I.appendChild(g)}for(let N=k-1;N>=T;N--){const h=f[N];o.removeChild(h),f.pop()}}function Kp(n,e){const t=e.awareness.getLocalState();if(t===null)return;const r=t.anchorPos,i=t.focusPos;if(r!==null&&i!==null){const s=pl(r,n),o=pl(i,n);if(s!==null&&o!==null){const[a,l]=ml(s.type,s.index),[u,g]=ml(o.type,o.index);if(a!==null&&u!==null){const d=a.getKey(),f=u.getKey(),m=ge();if(!he(m))return;const y=m.anchor,b=m.focus;Gp(y,d,l),Gp(b,f,g)}}}}function Gp(n,e,t){if(n.key!==e||n.offset!==t){let r=tt(e);if(r!==null&&!ie(r)&&!me(r)){const i=r.getParentOrThrow();e=i.getKey(),t=r.getIndexWithinParent(),r=i}n.set(e,t,ie(r)?"element":"text")}}function ml(n,e){const t=n._collabNode;if(t===void 0)return[null,0];if(t instanceof Ts){const{node:r,offset:i}=gl(t,e,!0);return r===null?[t,0]:[r,i]}return[null,0]}function Xp(n,e){const t=Array.from(e.awareness.getStates()),r=n.clientID,i=n.cursors,s=n.editor._editorState._nodeMap,o=new Set;for(let l=0;l<t.length;l++){const u=t[l],[g,d]=u;if(g!==r){o.add(g);const{anchorPos:f,focusPos:m,name:y,color:b,focusing:C}=d;let S=null,A=i.get(g);if(A===void 0&&(A=zv(y,b),i.set(g,A)),f!==null&&m!==null&&C){const v=pl(f,n),k=pl(m,n);if(v!==null&&k!==null){const[T,N]=ml(v.type,v.index),[h,I]=ml(k.type,k.index);if(T!==null&&h!==null){const O=T.getKey(),j=h.getKey();if(S=A.selection,S===null)S=Uv(A,O,N,j,I);else{const P=S.anchor,q=S.focus;P.key=O,P.offset=N,q.key=j,q.offset=I}}}}Hv(n,A,S,s)}}const a=Array.from(i.keys());for(let l=0;l<a.length;l++){const u=a[l];if(!o.has(u)){const g=i.get(u);g!==void 0&&(Bv(n,g),i.delete(u))}}}function Jp(n,e,t,r){const i=e.awareness,s=i.getLocalState();if(s===null)return;const{anchorPos:o,focusPos:a,name:l,color:u,focusing:g,awarenessData:d}=s;let f=null,m=null;(r!==null&&(o===null||r.is(t))||t!==null)&&(he(r)&&(f=Yp(r.anchor,n),m=Yp(r.focus,n)),(Vp(o,f)||Vp(a,m))&&i.setLocalState({anchorPos:f,awarenessData:d,color:u,focusPos:m,focusing:g,name:l}))}function Wv(n,e){const{target:t}=e,r=Xu(n,t);if(r instanceof Ts&&e instanceof wp){const{keysChanged:i,childListChanged:s,delta:o}=e;i.size>0&&r.syncPropertiesFromYjs(n,i),s&&(r.applyChildrenYjsDelta(n,o),r.syncChildrenFromYjs(n))}else if(r instanceof kn&&e instanceof fp){const{keysChanged:i}=e;i.size>0&&r.syncPropertiesAndTextFromYjs(n,i)}else if(r instanceof li&&e instanceof vp){const{attributesChanged:i}=e;i.size>0&&r.syncPropertiesFromYjs(n,i)}else on(82)}function $v(n,e,t,r){const i=n.editor,s=i._editorState;t.forEach(o=>o.delta),i.update(()=>{for(let a=0;a<t.length;a++){const l=t[a];Wv(n,l)}dt().getChildrenSize()===0&&dt().append(_t());const o=ge();if(he(o))if(Up(o)){const a=s._selection;he(a)&&(Kp(n,e),Up(o))&&Wp(o.anchor.key,s),Jp(n,e,a,ge())}else Kp(n,e)},{onUpdate:()=>{Xp(n,e)},skipTransforms:!0,tag:r?"historic":"collaboration"})}function Yv(n,e,t,r,i,s,o,a){(function(l,u){l.doc.transact(u,l)})(n,()=>{r.read(()=>{if(a.has("collaboration")||a.has("historic"))return void(o.size>0&&function(g,d){const f=Array.from(d),m=g.collabNodeMap,y=[];for(let b=0;b<f.length;b++){const C=f[b],S=tt(C),A=m.get(C);if(A instanceof kn)if(me(S))y.push([A,S.__text]);else{const v=A.getOffset();if(v===-1)continue;const k=A._parent;A._normalized=!0,k._xmlText.delete(v,1),m.delete(C);const T=k._children,N=T.indexOf(A);T.splice(N,1)}}for(let b=0;b<y.length;b++){const[C,S]=y[b];C instanceof kn&&typeof S=="string"&&(C._text=S)}}(n,o));if(i.has("root")){const g=t._nodeMap,d=dt(),f=n.root;f.syncPropertiesFromLexical(n,d,g),f.syncChildrenFromLexical(n,d,g,i,s)}const l=ge(),u=t._selection;Jp(n,e,u,l)})})}const Vv=wi(),qv=wi();function Kv(n,e){return new Zg(e,{trackedOrigins:new Set([n,null])})}function Gv(n,e,t,r,i){n.awareness.setLocalState({anchorPos:null,awarenessData:i,color:t,focusPos:null,focusing:r,name:e})}function Zp(n,e,t,r,i){const{awareness:s}=n;let o=s.getLocalState();o===null&&(o={anchorPos:null,awarenessData:i,color:t,focusPos:null,focusing:r,name:e}),o.focusing=r,s.setLocalState(o)}function Xv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jv=Xv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const ed=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Zv=ed&&"documentMode"in document?document.documentMode:null;!(!ed||!("InputEvent"in window)||Zv)&&"getTargetRanges"in new window.InputEvent("input");function Qp(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function Kn(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}const em=ed;function Io(n,...e){const t=Qp(...e);t.length>0&&n.classList.add(...t)}function Qv(n,...e){const t=Qp(...e);t.length>0&&n.classList.remove(...t)}function ex(n){const e=it(n,t=>ie(t)&&!t.isInline());return ie(e)||Jv(4,n.__key),e}const it=(n,e)=>{let t=n;for(;t!==dt()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function tm(n){const e=ge()||ti();if(he(e)){const{focus:t}=e,r=t.getNode(),i=t.offset;if(un(r)){const s=r.getChildAtIndex(i);s==null?r.append(n):s.insertBefore(n),n.selectNext()}else{let s,o;me(r)?(s=r.getParentOrThrow(),o=r.getIndexWithinParent(),i>0&&(o+=1,r.splitText(i))):(s=r,o=i);const[,a]=C0(s,o);a.insertBefore(n),a.selectStart()}}else{if(e!=null){const r=e.getNodes();r[r.length-1].getTopLevelElementOrThrow().insertAfter(n)}else dt().append(n);const t=_t();n.insertAfter(t),t.select()}return n.getLatest()}function nm(n,e){const t=e();return n.replace(t),t.append(n),t}function zi(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function rm(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function tx(n,e,t,r,i,s,o,a,l,u,g,d){const f=U.useRef(!1),m=U.useCallback(()=>{t.connect()},[t]),y=U.useCallback(()=>{try{t.disconnect()}catch{}},[t]);U.useEffect(()=>{const{root:C}=a,{awareness:S}=t,A=({status:I})=>{n.dispatchCommand(Vv,I==="connected")},v=I=>{o&&I&&C.isEmpty()&&C._xmlText._length===0&&f.current===!1&&function(O,j){O.update(()=>{const P=dt();if(P.isEmpty())if(j)switch(typeof j){case"string":{const q=O.parseEditorState(j);O.setEditorState(q,{tag:"history-merge"});break}case"object":O.setEditorState(j,{tag:"history-merge"});break;case"function":O.update(()=>{dt().isEmpty()&&j(O)},{tag:"history-merge"})}else{const q=_t();P.append(q);const{activeElement:G}=document;(ge()!==null||G!==null&&G===O.getRootElement())&&q.select()}},{tag:"history-merge"})}(n,g),f.current=!1},k=()=>{Xp(a,t)},T=(I,O)=>{const j=O.origin;j!==a&&$v(a,t,I,j instanceof Zg)};Gv(t,i,s,document.activeElement===n.getRootElement(),d||{});const N=I=>{(function(O,j){if(O.update(()=>{const ne=dt();ne.clear(),ne.select()},{tag:"skip-collab"}),j.cursors==null)return;const P=j.cursors;if(P==null)return;const q=j.cursorsContainer;if(q==null)return;const G=Array.from(P.values());for(let ne=0;ne<G.length;ne++){const oe=G[ne].selection;if(oe&&oe.selections!=null){const ue=oe.selections;for(let fe=0;fe<ue.length;fe++)q.removeChild(ue[ne])}}})(n,a),l(I),r.set(e,I),f.current=!0};t.on("reload",N),t.on("status",A),t.on("sync",v),S.on("update",k),C.getSharedType().observeDeep(T);const h=n.registerUpdateListener(({prevEditorState:I,editorState:O,dirtyLeaves:j,dirtyElements:P,normalizedNodes:q,tags:G})=>{G.has("skip-collab")===!1&&Yv(a,t,I,O,P,j,q,G)});return m(),()=>{f.current===!1&&y(),t.off("sync",v),t.off("status",A),t.off("reload",N),S.off("update",k),C.getSharedType().unobserveDeep(T),r.delete(e),h()}},[a,s,m,y,r,n,e,g,i,t,o,d,l]);const b=U.useMemo(()=>In.createPortal(F.jsx("div",{ref:C=>{a.cursorsContainer=C}}),u&&u.current||document.body),[a,u]);return U.useEffect(()=>n.registerCommand(qv,C=>(m!==void 0&&y!==void 0&&(C?(console.log("Collaboration connected!"),m()):(console.log("Collaboration disconnected!"),y())),!0),ot),[m,y,n]),b}function nx(n,e){const t=U.useMemo(()=>Kv(e,e.root.getSharedType()),[e]);U.useEffect(()=>Kn(n.registerCommand(aa,()=>(t.undo(),!0),ot),n.registerCommand(la,()=>(t.redo(),!0),ot)));const r=U.useCallback(()=>{t.clear()},[t]);return tn.useEffect(()=>{const i=()=>{n.dispatchCommand(xf,t.undoStack.length>0),n.dispatchCommand(vf,t.redoStack.length>0)};return t.on("stack-item-added",i),t.on("stack-item-popped",i),t.on("stack-cleared",i),()=>{t.off("stack-item-added",i),t.off("stack-item-popped",i),t.off("stack-cleared",i)}},[n,t]),r}function rx({id:n,providerFactory:e,shouldBootstrap:t,username:r,cursorColor:i,cursorsContainerRef:s,initialEditorState:o,excludedProperties:a,awarenessData:l}){const u=U.useRef(!1),g=U.useRef(!1),d=mf(r,i),{yjsDocMap:f,name:m,color:y}=d,[b]=$t();U.useEffect(()=>(d.isCollabActive=!0,()=>{b._parentEditor==null&&(d.isCollabActive=!1)}),[d,b]);const[C,S]=U.useState();U.useEffect(()=>{if(g.current)return;g.current=!0;const N=e(n,f);return S(N),()=>{N.disconnect()}},[n,e,f]);const[A,v]=U.useState(f.get(n)),[k,T]=U.useState();return U.useEffect(()=>{if(!C||u.current)return;u.current=!0;const N=Fv(b,C,n,A||f.get(n),f,a);return T(N),()=>{N.root.destroy(N)}},[b,C,n,f,A,a]),C&&k?F.jsx(ix,{awarenessData:l,binding:k,collabContext:d,color:y,cursorsContainerRef:s,editor:b,id:n,initialEditorState:o,name:m,provider:C,setDoc:v,shouldBootstrap:t,yjsDocMap:f}):F.jsx(F.Fragment,{})}function ix({editor:n,id:e,provider:t,yjsDocMap:r,name:i,color:s,shouldBootstrap:o,cursorsContainerRef:a,initialEditorState:l,awarenessData:u,collabContext:g,binding:d,setDoc:f}){const m=tx(n,e,t,r,i,s,o,d,f,a,l,u);return g.clientID=d.clientID,nx(n,d),function(y,b,C,S,A){U.useEffect(()=>Kn(y.registerCommand(cc,()=>(Zp(b,C,S,!0,A||{}),!1),ot),y.registerCommand(Cf,()=>(Zp(b,C,S,!1,A||{}),!1),ot)),[S,y,C,b,A])}(n,t,i,s,u),m}const im=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,sx=im?U.useLayoutEffect:U.useEffect,yl={tag:"history-merge"};function ox({initialConfig:n,children:e}){const t=U.useMemo(()=>{const{theme:r,namespace:i,editor__DEPRECATED:s,nodes:o,onError:a,editorState:l,html:u}=n,g=yf(null,r);let d=s||null;if(d===null){const f=Ha({editable:n.editable,html:u,namespace:i,nodes:o,onError:m=>a(m,f),theme:r});(function(m,y){if(y!==null){if(y===void 0)m.update(()=>{const b=dt();if(b.isEmpty()){const C=_t();b.append(C);const S=im?document.activeElement:null;(ge()!==null||S!==null&&S===m.getRootElement())&&C.select()}},yl);else if(y!==null)switch(typeof y){case"string":{const b=m.parseEditorState(y);m.setEditorState(b,yl);break}case"object":m.setEditorState(y,yl);break;case"function":m.update(()=>{dt().isEmpty()&&y(m)},yl)}}})(f,l),d=f}return[d,g]},[]);return sx(()=>{const r=n.editable,[i]=t;i.setEditable(r===void 0||r)},[]),F.jsx(sa.Provider,{value:t,children:e})}const n1="",ax={autocomplete:"PlaygroundEditorTheme__autocomplete",blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5"},hr:"PlaygroundEditorTheme__hr",image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableRowStriping:"PlaygroundEditorTheme__tableRowStriping",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}},sm=[["Arabian","#7d0000"],["Appaloosa","#640000"],["Friesian","#990000"],["Thoroughbred","#bf0000"],["Warmblood","#bf4000"],["Saddlebred","#004000"],["Mustang","#007f00"],["Trakehner","#407f00"],["Quarter Horse","#7f7f00"],["Clydesdale","#000099"],["Paint","#0000bf"],["Icelandic","#0000ff"],["Andalusian","#004040"],["Tennessee Walker","#404040"],["Ukrainian Riding Horse","#7f0040"],["Percheron","#bf0040"]];function lx({userObj:n}){return{color:sm[Math.floor(Math.random()*sm.length)][1],name:n?n.name:""}}const cx=1200,ux=2500,_l=3e4,td=n=>{if(n.shouldConnect&&n.ws===null){const e=new WebSocket(n.url),t=n.binaryType;let r=null;t&&(e.binaryType=t),n.ws=e,n.connecting=!0,n.connected=!1,e.onmessage=o=>{n.lastMessageReceived=jn();const a=o.data,l=typeof a=="string"?JSON.parse(a):a;l&&l.type==="pong"&&(clearTimeout(r),r=setTimeout(s,_l/2)),n.emit("message",[l,n])};const i=o=>{n.ws!==null&&(n.ws=null,n.connecting=!1,n.connected?(n.connected=!1,n.emit("disconnect",[{type:"disconnect",error:o},n])):n.unsuccessfulReconnects++,setTimeout(td,$a(G0(n.unsuccessfulReconnects+1)*cx,ux),n)),clearTimeout(r)},s=()=>{n.ws===e&&n.send({type:"ping"})};e.onclose=()=>i(null),e.onerror=o=>i(o),e.onopen=()=>{n.lastMessageReceived=jn(),n.connecting=!1,n.connected=!0,n.unsuccessfulReconnects=0,n.emit("connect",[{type:"connect"},n]),r=setTimeout(s,_l/2)}}};class dx extends cu{constructor(e,{binaryType:t}={}){super(),this.url=e,this.ws=null,this.binaryType=t||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&_l<jn()-this.lastMessageReceived&&this.ws.close()},_l/2),td(this)}send(e){this.ws&&this.ws.send(JSON.stringify(e))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.connected&&this.ws===null&&td(this)}}const om=new Map;class fx{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:yg(t.newValue||"")}),Cb(this._onChange)}postMessage(e){ag.setItem(this.room,mg(zb(e)))}close(){Sb(this._onChange)}}const hx=typeof BroadcastChannel>"u"?fx:BroadcastChannel,nd=n=>Ln(om,n,()=>{const e=ri(),t=new hx(n);return t.onmessage=r=>e.forEach(i=>i(r.data,"broadcastchannel")),{bc:t,subs:e}}),am=(n,e)=>(nd(n).subs.add(e),e),lm=(n,e)=>{const t=nd(n),r=t.subs.delete(e);return r&&t.subs.size===0&&(t.bc.close(),om.delete(n)),r},Bi=(n,e,t=null)=>{const r=nd(n);r.bc.postMessage(e),r.subs.forEach(i=>i(e,t))},gx=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}};function bl(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var cm={exports:{}};(function(n,e){(function(t){n.exports=t()})(function(){var t=Math.floor,r=Math.abs,i=Math.pow;return function(){function s(o,a,l){function u(f,m){if(!a[f]){if(!o[f]){var y=typeof bl=="function"&&bl;if(!m&&y)return y(f,!0);if(g)return g(f,!0);var b=new Error("Cannot find module '"+f+"'");throw b.code="MODULE_NOT_FOUND",b}var C=a[f]={exports:{}};o[f][0].call(C.exports,function(S){var A=o[f][1][S];return u(A||S)},C,C.exports,s,o,a,l)}return a[f].exports}for(var g=typeof bl=="function"&&bl,d=0;d<l.length;d++)u(l[d]);return u}return s}()({1:[function(s,o,a){function l(k){var T=k.length;if(0<T%4)throw new Error("Invalid string. Length must be a multiple of 4");var N=k.indexOf("=");N===-1&&(N=T);var h=N===T?0:4-N%4;return[N,h]}function u(k,T,N){return 3*(T+N)/4-N}function g(k){var T,N,h=l(k),I=h[0],O=h[1],j=new C(u(k,I,O)),P=0,q=0<O?I-4:I;for(N=0;N<q;N+=4)T=b[k.charCodeAt(N)]<<18|b[k.charCodeAt(N+1)]<<12|b[k.charCodeAt(N+2)]<<6|b[k.charCodeAt(N+3)],j[P++]=255&T>>16,j[P++]=255&T>>8,j[P++]=255&T;return O===2&&(T=b[k.charCodeAt(N)]<<2|b[k.charCodeAt(N+1)]>>4,j[P++]=255&T),O===1&&(T=b[k.charCodeAt(N)]<<10|b[k.charCodeAt(N+1)]<<4|b[k.charCodeAt(N+2)]>>2,j[P++]=255&T>>8,j[P++]=255&T),j}function d(k){return y[63&k>>18]+y[63&k>>12]+y[63&k>>6]+y[63&k]}function f(k,T,N){for(var h,I=[],O=T;O<N;O+=3)h=(16711680&k[O]<<16)+(65280&k[O+1]<<8)+(255&k[O+2]),I.push(d(h));return I.join("")}function m(k){for(var T,N=k.length,h=N%3,I=[],O=16383,j=0,P=N-h;j<P;j+=O)I.push(f(k,j,j+O>P?P:j+O));return h===1?(T=k[N-1],I.push(y[T>>2]+y[63&T<<4]+"==")):h===2&&(T=(k[N-2]<<8)+k[N-1],I.push(y[T>>10]+y[63&T>>4]+y[63&T<<2]+"=")),I.join("")}a.byteLength=function(k){var T=l(k),N=T[0],h=T[1];return 3*(N+h)/4-h},a.toByteArray=g,a.fromByteArray=m;for(var y=[],b=[],C=typeof Uint8Array>"u"?Array:Uint8Array,S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A=0,v=S.length;A<v;++A)y[A]=S[A],b[S.charCodeAt(A)]=A;b[45]=62,b[95]=63},{}],2:[function(){},{}],3:[function(s,o,a){(function(){(function(){var l=String.fromCharCode,u=Math.min;function g(_){if(2147483647<_)throw new RangeError('The value "'+_+'" is invalid for option "size"');var E=new Uint8Array(_);return E.__proto__=d.prototype,E}function d(_,E,R){if(typeof _=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(_)}return f(_,E,R)}function f(_,E,R){if(typeof _=="string")return C(_,E);if(ArrayBuffer.isView(_))return S(_);if(_==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _);if(Z(_,ArrayBuffer)||_&&Z(_.buffer,ArrayBuffer))return A(_,E,R);if(typeof _=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var Y=_.valueOf&&_.valueOf();if(Y!=null&&Y!==_)return d.from(Y,E,R);var J=v(_);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof _[Symbol.toPrimitive]=="function")return d.from(_[Symbol.toPrimitive]("string"),E,R);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _)}function m(_){if(typeof _!="number")throw new TypeError('"size" argument must be of type number');if(0>_)throw new RangeError('The value "'+_+'" is invalid for option "size"')}function y(_,E,R){return m(_),0>=_||E===void 0?g(_):typeof R=="string"?g(_).fill(E,R):g(_).fill(E)}function b(_){return m(_),g(0>_?0:0|k(_))}function C(_,E){if((typeof E!="string"||E==="")&&(E="utf8"),!d.isEncoding(E))throw new TypeError("Unknown encoding: "+E);var R=0|T(_,E),Y=g(R),J=Y.write(_,E);return J!==R&&(Y=Y.slice(0,J)),Y}function S(_){for(var E=0>_.length?0:0|k(_.length),R=g(E),Y=0;Y<E;Y+=1)R[Y]=255&_[Y];return R}function A(_,E,R){if(0>E||_.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(_.byteLength<E+(R||0))throw new RangeError('"length" is outside of buffer bounds');var Y;return Y=E===void 0&&R===void 0?new Uint8Array(_):R===void 0?new Uint8Array(_,E):new Uint8Array(_,E,R),Y.__proto__=d.prototype,Y}function v(_){if(d.isBuffer(_)){var E=0|k(_.length),R=g(E);return R.length===0||_.copy(R,0,0,E),R}return _.length===void 0?_.type==="Buffer"&&Array.isArray(_.data)?S(_.data):void 0:typeof _.length!="number"||re(_.length)?g(0):S(_)}function k(_){if(_>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|_}function T(_,E){if(d.isBuffer(_))return _.length;if(ArrayBuffer.isView(_)||Z(_,ArrayBuffer))return _.byteLength;if(typeof _!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof _);var R=_.length,Y=2<arguments.length&&arguments[2]===!0;if(!Y&&R===0)return 0;for(var J=!1;;)switch(E){case"ascii":case"latin1":case"binary":return R;case"utf8":case"utf-8":return Pe(_).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*R;case"hex":return R>>>1;case"base64":return yt(_).length;default:if(J)return Y?-1:Pe(_).length;E=(""+E).toLowerCase(),J=!0}}function N(_,E,R){var Y=!1;if((E===void 0||0>E)&&(E=0),E>this.length||((R===void 0||R>this.length)&&(R=this.length),0>=R)||(R>>>=0,E>>>=0,R<=E))return"";for(_||(_="utf8");;)switch(_){case"hex":return de(this,E,R);case"utf8":case"utf-8":return fe(this,E,R);case"ascii":return be(this,E,R);case"latin1":case"binary":return ae(this,E,R);case"base64":return ue(this,E,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xe(this,E,R);default:if(Y)throw new TypeError("Unknown encoding: "+_);_=(_+"").toLowerCase(),Y=!0}}function h(_,E,R){var Y=_[E];_[E]=_[R],_[R]=Y}function I(_,E,R,Y,J){if(_.length===0)return-1;if(typeof R=="string"?(Y=R,R=0):2147483647<R?R=2147483647:-2147483648>R&&(R=-2147483648),R=+R,re(R)&&(R=J?0:_.length-1),0>R&&(R=_.length+R),R>=_.length){if(J)return-1;R=_.length-1}else if(0>R)if(J)R=0;else return-1;if(typeof E=="string"&&(E=d.from(E,Y)),d.isBuffer(E))return E.length===0?-1:O(_,E,R,Y,J);if(typeof E=="number")return E&=255,typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(_,E,R):Uint8Array.prototype.lastIndexOf.call(_,E,R):O(_,[E],R,Y,J);throw new TypeError("val must be string, number or Buffer")}function O(_,E,R,Y,J){function K(Vt,hn){return ke===1?Vt[hn]:Vt.readUInt16BE(hn*ke)}var ke=1,Je=_.length,Ct=E.length;if(Y!==void 0&&(Y=(Y+"").toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le")){if(2>_.length||2>E.length)return-1;ke=2,Je/=2,Ct/=2,R/=2}var Ze;if(J){var Ge=-1;for(Ze=R;Ze<Je;Ze++)if(K(_,Ze)!==K(E,Ge===-1?0:Ze-Ge))Ge!==-1&&(Ze-=Ze-Ge),Ge=-1;else if(Ge===-1&&(Ge=Ze),Ze-Ge+1===Ct)return Ge*ke}else for(R+Ct>Je&&(R=Je-Ct),Ze=R;0<=Ze;Ze--){for(var Ft=!0,wn=0;wn<Ct;wn++)if(K(_,Ze+wn)!==K(E,wn)){Ft=!1;break}if(Ft)return Ze}return-1}function j(_,E,R,Y){R=+R||0;var J=_.length-R;Y?(Y=+Y,Y>J&&(Y=J)):Y=J;var K=E.length;Y>K/2&&(Y=K/2);for(var ke,Je=0;Je<Y;++Je){if(ke=parseInt(E.substr(2*Je,2),16),re(ke))return Je;_[R+Je]=ke}return Je}function P(_,E,R,Y){return Wt(Pe(E,_.length-R),_,R,Y)}function q(_,E,R,Y){return Wt(ft(E),_,R,Y)}function G(_,E,R,Y){return q(_,E,R,Y)}function ne(_,E,R,Y){return Wt(yt(E),_,R,Y)}function oe(_,E,R,Y){return Wt(we(E,_.length-R),_,R,Y)}function ue(_,E,R){return E===0&&R===_.length?ye.fromByteArray(_):ye.fromByteArray(_.slice(E,R))}function fe(_,E,R){R=u(_.length,R);for(var Y=[],J=E;J<R;){var K=_[J],ke=null,Je=239<K?4:223<K?3:191<K?2:1;if(J+Je<=R){var Ct,Ze,Ge,Ft;Je===1?128>K&&(ke=K):Je===2?(Ct=_[J+1],(192&Ct)==128&&(Ft=(31&K)<<6|63&Ct,127<Ft&&(ke=Ft))):Je===3?(Ct=_[J+1],Ze=_[J+2],(192&Ct)==128&&(192&Ze)==128&&(Ft=(15&K)<<12|(63&Ct)<<6|63&Ze,2047<Ft&&(55296>Ft||57343<Ft)&&(ke=Ft))):Je===4&&(Ct=_[J+1],Ze=_[J+2],Ge=_[J+3],(192&Ct)==128&&(192&Ze)==128&&(192&Ge)==128&&(Ft=(15&K)<<18|(63&Ct)<<12|(63&Ze)<<6|63&Ge,65535<Ft&&1114112>Ft&&(ke=Ft)))}ke===null?(ke=65533,Je=1):65535<ke&&(ke-=65536,Y.push(55296|1023&ke>>>10),ke=56320|1023&ke),Y.push(ke),J+=Je}return Ee(Y)}function Ee(_){var E=_.length;if(E<=4096)return l.apply(String,_);for(var R="",Y=0;Y<E;)R+=l.apply(String,_.slice(Y,Y+=4096));return R}function be(_,E,R){var Y="";R=u(_.length,R);for(var J=E;J<R;++J)Y+=l(127&_[J]);return Y}function ae(_,E,R){var Y="";R=u(_.length,R);for(var J=E;J<R;++J)Y+=l(_[J]);return Y}function de(_,E,R){var Y=_.length;(!E||0>E)&&(E=0),(!R||0>R||R>Y)&&(R=Y);for(var J="",K=E;K<R;++K)J+=Ce(_[K]);return J}function xe(_,E,R){for(var Y=_.slice(E,R),J="",K=0;K<Y.length;K+=2)J+=l(Y[K]+256*Y[K+1]);return J}function Te(_,E,R){if(_%1!=0||0>_)throw new RangeError("offset is not uint");if(_+E>R)throw new RangeError("Trying to access beyond buffer length")}function ve(_,E,R,Y,J,K){if(!d.isBuffer(_))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>J||E<K)throw new RangeError('"value" argument is out of bounds');if(R+Y>_.length)throw new RangeError("Index out of range")}function Fe(_,E,R,Y){if(R+Y>_.length)throw new RangeError("Index out of range");if(0>R)throw new RangeError("Index out of range")}function Ae(_,E,R,Y,J){return E=+E,R>>>=0,J||Fe(_,E,R,4),Ie.write(_,E,R,Y,23,4),R+4}function Ne(_,E,R,Y,J){return E=+E,R>>>=0,J||Fe(_,E,R,8),Ie.write(_,E,R,Y,52,8),R+8}function ze(_){if(_=_.split("=")[0],_=_.trim().replace(B,""),2>_.length)return"";for(;_.length%4!=0;)_+="=";return _}function Ce(_){return 16>_?"0"+_.toString(16):_.toString(16)}function Pe(_,E){E=E||1/0;for(var R,Y=_.length,J=null,K=[],ke=0;ke<Y;++ke){if(R=_.charCodeAt(ke),55295<R&&57344>R){if(!J){if(56319<R){-1<(E-=3)&&K.push(239,191,189);continue}else if(ke+1===Y){-1<(E-=3)&&K.push(239,191,189);continue}J=R;continue}if(56320>R){-1<(E-=3)&&K.push(239,191,189),J=R;continue}R=(J-55296<<10|R-56320)+65536}else J&&-1<(E-=3)&&K.push(239,191,189);if(J=null,128>R){if(0>(E-=1))break;K.push(R)}else if(2048>R){if(0>(E-=2))break;K.push(192|R>>6,128|63&R)}else if(65536>R){if(0>(E-=3))break;K.push(224|R>>12,128|63&R>>6,128|63&R)}else if(1114112>R){if(0>(E-=4))break;K.push(240|R>>18,128|63&R>>12,128|63&R>>6,128|63&R)}else throw new Error("Invalid code point")}return K}function ft(_){for(var E=[],R=0;R<_.length;++R)E.push(255&_.charCodeAt(R));return E}function we(_,E){for(var R,Y,J,K=[],ke=0;ke<_.length&&!(0>(E-=2));++ke)R=_.charCodeAt(ke),Y=R>>8,J=R%256,K.push(J),K.push(Y);return K}function yt(_){return ye.toByteArray(ze(_))}function Wt(_,E,R,Y){for(var J=0;J<Y&&!(J+R>=E.length||J>=_.length);++J)E[J+R]=_[J];return J}function Z(_,E){return _ instanceof E||_!=null&&_.constructor!=null&&_.constructor.name!=null&&_.constructor.name===E.name}function re(_){return _!==_}var ye=s("base64-js"),Ie=s("ieee754");a.Buffer=d,a.SlowBuffer=function(_){return+_!=_&&(_=0),d.alloc(+_)},a.INSPECT_MAX_BYTES=50,a.kMaxLength=2147483647,d.TYPED_ARRAY_SUPPORT=function(){try{var _=new Uint8Array(1);return _.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},_.foo()===42}catch{return!1}}(),d.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){return d.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){return d.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(_,E,R){return f(_,E,R)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(_,E,R){return y(_,E,R)},d.allocUnsafe=function(_){return b(_)},d.allocUnsafeSlow=function(_){return b(_)},d.isBuffer=function(_){return _!=null&&_._isBuffer===!0&&_!==d.prototype},d.compare=function(_,E){if(Z(_,Uint8Array)&&(_=d.from(_,_.offset,_.byteLength)),Z(E,Uint8Array)&&(E=d.from(E,E.offset,E.byteLength)),!d.isBuffer(_)||!d.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(_===E)return 0;for(var R=_.length,Y=E.length,J=0,K=u(R,Y);J<K;++J)if(_[J]!==E[J]){R=_[J],Y=E[J];break}return R<Y?-1:Y<R?1:0},d.isEncoding=function(_){switch((_+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(_,E){if(!Array.isArray(_))throw new TypeError('"list" argument must be an Array of Buffers');if(_.length===0)return d.alloc(0);var R;if(E===void 0)for(E=0,R=0;R<_.length;++R)E+=_[R].length;var Y=d.allocUnsafe(E),J=0;for(R=0;R<_.length;++R){var K=_[R];if(Z(K,Uint8Array)&&(K=d.from(K)),!d.isBuffer(K))throw new TypeError('"list" argument must be an Array of Buffers');K.copy(Y,J),J+=K.length}return Y},d.byteLength=T,d.prototype._isBuffer=!0,d.prototype.swap16=function(){var _=this.length;if(_%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<_;E+=2)h(this,E,E+1);return this},d.prototype.swap32=function(){var _=this.length;if(_%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<_;E+=4)h(this,E,E+3),h(this,E+1,E+2);return this},d.prototype.swap64=function(){var _=this.length;if(_%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<_;E+=8)h(this,E,E+7),h(this,E+1,E+6),h(this,E+2,E+5),h(this,E+3,E+4);return this},d.prototype.toString=function(){var _=this.length;return _===0?"":arguments.length===0?fe(this,0,_):N.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(_){if(!d.isBuffer(_))throw new TypeError("Argument must be a Buffer");return this===_||d.compare(this,_)===0},d.prototype.inspect=function(){var _="",E=a.INSPECT_MAX_BYTES;return _=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(_+=" ... "),"<Buffer "+_+">"},d.prototype.compare=function(_,E,R,Y,J){if(Z(_,Uint8Array)&&(_=d.from(_,_.offset,_.byteLength)),!d.isBuffer(_))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof _);if(E===void 0&&(E=0),R===void 0&&(R=_?_.length:0),Y===void 0&&(Y=0),J===void 0&&(J=this.length),0>E||R>_.length||0>Y||J>this.length)throw new RangeError("out of range index");if(Y>=J&&E>=R)return 0;if(Y>=J)return-1;if(E>=R)return 1;if(E>>>=0,R>>>=0,Y>>>=0,J>>>=0,this===_)return 0;for(var K=J-Y,ke=R-E,Je=u(K,ke),Ct=this.slice(Y,J),Ze=_.slice(E,R),Ge=0;Ge<Je;++Ge)if(Ct[Ge]!==Ze[Ge]){K=Ct[Ge],ke=Ze[Ge];break}return K<ke?-1:ke<K?1:0},d.prototype.includes=function(_,E,R){return this.indexOf(_,E,R)!==-1},d.prototype.indexOf=function(_,E,R){return I(this,_,E,R,!0)},d.prototype.lastIndexOf=function(_,E,R){return I(this,_,E,R,!1)},d.prototype.write=function(_,E,R,Y){if(E===void 0)Y="utf8",R=this.length,E=0;else if(R===void 0&&typeof E=="string")Y=E,R=this.length,E=0;else if(isFinite(E))E>>>=0,isFinite(R)?(R>>>=0,Y===void 0&&(Y="utf8")):(Y=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var J=this.length-E;if((R===void 0||R>J)&&(R=J),0<_.length&&(0>R||0>E)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");Y||(Y="utf8");for(var K=!1;;)switch(Y){case"hex":return j(this,_,E,R);case"utf8":case"utf-8":return P(this,_,E,R);case"ascii":return q(this,_,E,R);case"latin1":case"binary":return G(this,_,E,R);case"base64":return ne(this,_,E,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oe(this,_,E,R);default:if(K)throw new TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.slice=function(_,E){var R=this.length;_=~~_,E=E===void 0?R:~~E,0>_?(_+=R,0>_&&(_=0)):_>R&&(_=R),0>E?(E+=R,0>E&&(E=0)):E>R&&(E=R),E<_&&(E=_);var Y=this.subarray(_,E);return Y.__proto__=d.prototype,Y},d.prototype.readUIntLE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=this[_],J=1,K=0;++K<E&&(J*=256);)Y+=this[_+K]*J;return Y},d.prototype.readUIntBE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=this[_+--E],J=1;0<E&&(J*=256);)Y+=this[_+--E]*J;return Y},d.prototype.readUInt8=function(_,E){return _>>>=0,E||Te(_,1,this.length),this[_]},d.prototype.readUInt16LE=function(_,E){return _>>>=0,E||Te(_,2,this.length),this[_]|this[_+1]<<8},d.prototype.readUInt16BE=function(_,E){return _>>>=0,E||Te(_,2,this.length),this[_]<<8|this[_+1]},d.prototype.readUInt32LE=function(_,E){return _>>>=0,E||Te(_,4,this.length),(this[_]|this[_+1]<<8|this[_+2]<<16)+16777216*this[_+3]},d.prototype.readUInt32BE=function(_,E){return _>>>=0,E||Te(_,4,this.length),16777216*this[_]+(this[_+1]<<16|this[_+2]<<8|this[_+3])},d.prototype.readIntLE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=this[_],J=1,K=0;++K<E&&(J*=256);)Y+=this[_+K]*J;return J*=128,Y>=J&&(Y-=i(2,8*E)),Y},d.prototype.readIntBE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=E,J=1,K=this[_+--Y];0<Y&&(J*=256);)K+=this[_+--Y]*J;return J*=128,K>=J&&(K-=i(2,8*E)),K},d.prototype.readInt8=function(_,E){return _>>>=0,E||Te(_,1,this.length),128&this[_]?-1*(255-this[_]+1):this[_]},d.prototype.readInt16LE=function(_,E){_>>>=0,E||Te(_,2,this.length);var R=this[_]|this[_+1]<<8;return 32768&R?4294901760|R:R},d.prototype.readInt16BE=function(_,E){_>>>=0,E||Te(_,2,this.length);var R=this[_+1]|this[_]<<8;return 32768&R?4294901760|R:R},d.prototype.readInt32LE=function(_,E){return _>>>=0,E||Te(_,4,this.length),this[_]|this[_+1]<<8|this[_+2]<<16|this[_+3]<<24},d.prototype.readInt32BE=function(_,E){return _>>>=0,E||Te(_,4,this.length),this[_]<<24|this[_+1]<<16|this[_+2]<<8|this[_+3]},d.prototype.readFloatLE=function(_,E){return _>>>=0,E||Te(_,4,this.length),Ie.read(this,_,!0,23,4)},d.prototype.readFloatBE=function(_,E){return _>>>=0,E||Te(_,4,this.length),Ie.read(this,_,!1,23,4)},d.prototype.readDoubleLE=function(_,E){return _>>>=0,E||Te(_,8,this.length),Ie.read(this,_,!0,52,8)},d.prototype.readDoubleBE=function(_,E){return _>>>=0,E||Te(_,8,this.length),Ie.read(this,_,!1,52,8)},d.prototype.writeUIntLE=function(_,E,R,Y){if(_=+_,E>>>=0,R>>>=0,!Y){var J=i(2,8*R)-1;ve(this,_,E,R,J,0)}var K=1,ke=0;for(this[E]=255&_;++ke<R&&(K*=256);)this[E+ke]=255&_/K;return E+R},d.prototype.writeUIntBE=function(_,E,R,Y){if(_=+_,E>>>=0,R>>>=0,!Y){var J=i(2,8*R)-1;ve(this,_,E,R,J,0)}var K=R-1,ke=1;for(this[E+K]=255&_;0<=--K&&(ke*=256);)this[E+K]=255&_/ke;return E+R},d.prototype.writeUInt8=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,1,255,0),this[E]=255&_,E+1},d.prototype.writeUInt16LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,65535,0),this[E]=255&_,this[E+1]=_>>>8,E+2},d.prototype.writeUInt16BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,65535,0),this[E]=_>>>8,this[E+1]=255&_,E+2},d.prototype.writeUInt32LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,4294967295,0),this[E+3]=_>>>24,this[E+2]=_>>>16,this[E+1]=_>>>8,this[E]=255&_,E+4},d.prototype.writeUInt32BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,4294967295,0),this[E]=_>>>24,this[E+1]=_>>>16,this[E+2]=_>>>8,this[E+3]=255&_,E+4},d.prototype.writeIntLE=function(_,E,R,Y){if(_=+_,E>>>=0,!Y){var J=i(2,8*R-1);ve(this,_,E,R,J-1,-J)}var K=0,ke=1,Je=0;for(this[E]=255&_;++K<R&&(ke*=256);)0>_&&Je===0&&this[E+K-1]!==0&&(Je=1),this[E+K]=255&(_/ke>>0)-Je;return E+R},d.prototype.writeIntBE=function(_,E,R,Y){if(_=+_,E>>>=0,!Y){var J=i(2,8*R-1);ve(this,_,E,R,J-1,-J)}var K=R-1,ke=1,Je=0;for(this[E+K]=255&_;0<=--K&&(ke*=256);)0>_&&Je===0&&this[E+K+1]!==0&&(Je=1),this[E+K]=255&(_/ke>>0)-Je;return E+R},d.prototype.writeInt8=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,1,127,-128),0>_&&(_=255+_+1),this[E]=255&_,E+1},d.prototype.writeInt16LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,32767,-32768),this[E]=255&_,this[E+1]=_>>>8,E+2},d.prototype.writeInt16BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,32767,-32768),this[E]=_>>>8,this[E+1]=255&_,E+2},d.prototype.writeInt32LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,2147483647,-2147483648),this[E]=255&_,this[E+1]=_>>>8,this[E+2]=_>>>16,this[E+3]=_>>>24,E+4},d.prototype.writeInt32BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,2147483647,-2147483648),0>_&&(_=4294967295+_+1),this[E]=_>>>24,this[E+1]=_>>>16,this[E+2]=_>>>8,this[E+3]=255&_,E+4},d.prototype.writeFloatLE=function(_,E,R){return Ae(this,_,E,!0,R)},d.prototype.writeFloatBE=function(_,E,R){return Ae(this,_,E,!1,R)},d.prototype.writeDoubleLE=function(_,E,R){return Ne(this,_,E,!0,R)},d.prototype.writeDoubleBE=function(_,E,R){return Ne(this,_,E,!1,R)},d.prototype.copy=function(_,E,R,Y){if(!d.isBuffer(_))throw new TypeError("argument should be a Buffer");if(R||(R=0),Y||Y===0||(Y=this.length),E>=_.length&&(E=_.length),E||(E=0),0<Y&&Y<R&&(Y=R),Y===R||_.length===0||this.length===0)return 0;if(0>E)throw new RangeError("targetStart out of bounds");if(0>R||R>=this.length)throw new RangeError("Index out of range");if(0>Y)throw new RangeError("sourceEnd out of bounds");Y>this.length&&(Y=this.length),_.length-E<Y-R&&(Y=_.length-E+R);var J=Y-R;if(this===_&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(E,R,Y);else if(this===_&&R<E&&E<Y)for(var K=J-1;0<=K;--K)_[K+E]=this[K+R];else Uint8Array.prototype.set.call(_,this.subarray(R,Y),E);return J},d.prototype.fill=function(_,E,R,Y){if(typeof _=="string"){if(typeof E=="string"?(Y=E,E=0,R=this.length):typeof R=="string"&&(Y=R,R=this.length),Y!==void 0&&typeof Y!="string")throw new TypeError("encoding must be a string");if(typeof Y=="string"&&!d.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);if(_.length===1){var J=_.charCodeAt(0);(Y==="utf8"&&128>J||Y==="latin1")&&(_=J)}}else typeof _=="number"&&(_&=255);if(0>E||this.length<E||this.length<R)throw new RangeError("Out of range index");if(R<=E)return this;E>>>=0,R=R===void 0?this.length:R>>>0,_||(_=0);var K;if(typeof _=="number")for(K=E;K<R;++K)this[K]=_;else{var ke=d.isBuffer(_)?_:d.from(_,Y),Je=ke.length;if(Je===0)throw new TypeError('The value "'+_+'" is invalid for argument "value"');for(K=0;K<R-E;++K)this[K+E]=ke[K%Je]}return this};var B=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,s("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(s,o,a){(function(l){(function(){function u(){let d;try{d=a.storage.getItem("debug")}catch{}return!d&&typeof l<"u"&&"env"in l&&(d=l.env.DEBUG),d}a.formatArgs=function(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;d.splice(1,0,f,"color: inherit");let m=0,y=0;d[0].replace(/%[a-zA-Z%]/g,b=>{b==="%%"||(m++,b==="%c"&&(y=m))}),d.splice(y,0,f)},a.save=function(d){try{d?a.storage.setItem("debug",d):a.storage.removeItem("debug")}catch{}},a.load=u,a.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},a.storage=function(){try{return localStorage}catch{}}(),a.destroy=(()=>{let d=!1;return()=>{d||(d=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],a.log=console.debug||console.log||(()=>{}),o.exports=s("./common")(a);const{formatters:g}=o.exports;g.j=function(d){try{return JSON.stringify(d)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}}).call(this)}).call(this,s("_process"))},{"./common":5,_process:12}],5:[function(s,o){o.exports=function(a){function l(d){function f(...b){if(!f.enabled)return;const C=f,S=+new Date,A=S-(m||S);C.diff=A,C.prev=m,C.curr=S,m=S,b[0]=l.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let v=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(T,N)=>{if(T==="%%")return"%";v++;const h=l.formatters[N];if(typeof h=="function"){const I=b[v];T=h.call(C,I),b.splice(v,1),v--}return T}),l.formatArgs.call(C,b),(C.log||l.log).apply(C,b)}let m,y=null;return f.namespace=d,f.useColors=l.useColors(),f.color=l.selectColor(d),f.extend=u,f.destroy=l.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>y===null?l.enabled(d):y,set:b=>{y=b}}),typeof l.init=="function"&&l.init(f),f}function u(d,f){const m=l(this.namespace+(typeof f>"u"?":":f)+d);return m.log=this.log,m}function g(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}return l.debug=l,l.default=l,l.coerce=function(d){return d instanceof Error?d.stack||d.message:d},l.disable=function(){const d=[...l.names.map(g),...l.skips.map(g).map(f=>"-"+f)].join(",");return l.enable(""),d},l.enable=function(d){l.save(d),l.names=[],l.skips=[];let f;const m=(typeof d=="string"?d:"").split(/[\s,]+/),y=m.length;for(f=0;f<y;f++)m[f]&&(d=m[f].replace(/\*/g,".*?"),d[0]==="-"?l.skips.push(new RegExp("^"+d.substr(1)+"$")):l.names.push(new RegExp("^"+d+"$")))},l.enabled=function(d){if(d[d.length-1]==="*")return!0;let f,m;for(f=0,m=l.skips.length;f<m;f++)if(l.skips[f].test(d))return!1;for(f=0,m=l.names.length;f<m;f++)if(l.names[f].test(d))return!0;return!1},l.humanize=s("ms"),l.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(a).forEach(d=>{l[d]=a[d]}),l.names=[],l.skips=[],l.formatters={},l.selectColor=function(d){let f=0;for(let m=0;m<d.length;m++)f=(f<<5)-f+d.charCodeAt(m),f|=0;return l.colors[r(f)%l.colors.length]},l.enable(l.load()),l}},{ms:11}],6:[function(s,o){function a(l,u){for(const g in u)Object.defineProperty(l,g,{value:u[g],enumerable:!0,configurable:!0});return l}o.exports=function(l,u,g){if(!l||typeof l=="string")throw new TypeError("Please pass an Error to err-code");g||(g={}),typeof u=="object"&&(g=u,u=""),u&&(g.code=u);try{return a(l,g)}catch{g.message=l.message,g.stack=l.stack;const f=function(){};return f.prototype=Object.create(Object.getPrototypeOf(l)),a(new f,g)}}},{}],7:[function(s,o){function a(j){console&&console.warn&&console.warn(j)}function l(){l.init.call(this)}function u(j){if(typeof j!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof j)}function g(j){return j._maxListeners===void 0?l.defaultMaxListeners:j._maxListeners}function d(j,P,q,G){var ne,oe,ue;if(u(q),oe=j._events,oe===void 0?(oe=j._events=Object.create(null),j._eventsCount=0):(oe.newListener!==void 0&&(j.emit("newListener",P,q.listener?q.listener:q),oe=j._events),ue=oe[P]),ue===void 0)ue=oe[P]=q,++j._eventsCount;else if(typeof ue=="function"?ue=oe[P]=G?[q,ue]:[ue,q]:G?ue.unshift(q):ue.push(q),ne=g(j),0<ne&&ue.length>ne&&!ue.warned){ue.warned=!0;var fe=new Error("Possible EventEmitter memory leak detected. "+ue.length+" "+(P+" listeners added. Use emitter.setMaxListeners() to increase limit"));fe.name="MaxListenersExceededWarning",fe.emitter=j,fe.type=P,fe.count=ue.length,a(fe)}return j}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(j,P,q){var G={fired:!1,wrapFn:void 0,target:j,type:P,listener:q},ne=f.bind(G);return ne.listener=q,G.wrapFn=ne,ne}function y(j,P,q){var G=j._events;if(G===void 0)return[];var ne=G[P];return ne===void 0?[]:typeof ne=="function"?q?[ne.listener||ne]:[ne]:q?A(ne):C(ne,ne.length)}function b(j){var P=this._events;if(P!==void 0){var q=P[j];if(typeof q=="function")return 1;if(q!==void 0)return q.length}return 0}function C(j,P){for(var q=Array(P),G=0;G<P;++G)q[G]=j[G];return q}function S(j,P){for(;P+1<j.length;P++)j[P]=j[P+1];j.pop()}function A(j){for(var P=Array(j.length),q=0;q<P.length;++q)P[q]=j[q].listener||j[q];return P}function v(j,P,q){typeof j.on=="function"&&k(j,"error",P,q)}function k(j,P,q,G){if(typeof j.on=="function")G.once?j.once(P,q):j.on(P,q);else if(typeof j.addEventListener=="function")j.addEventListener(P,function ne(oe){G.once&&j.removeEventListener(P,ne),q(oe)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof j)}var T,N=typeof Reflect=="object"?Reflect:null,h=N&&typeof N.apply=="function"?N.apply:function(j,P,q){return Function.prototype.apply.call(j,P,q)};T=N&&typeof N.ownKeys=="function"?N.ownKeys:Object.getOwnPropertySymbols?function(j){return Object.getOwnPropertyNames(j).concat(Object.getOwnPropertySymbols(j))}:function(j){return Object.getOwnPropertyNames(j)};var I=Number.isNaN||function(j){return j!==j};o.exports=l,o.exports.once=function(j,P){return new Promise(function(q,G){function ne(ue){j.removeListener(P,oe),G(ue)}function oe(){typeof j.removeListener=="function"&&j.removeListener("error",ne),q([].slice.call(arguments))}k(j,P,oe,{once:!0}),P!=="error"&&v(j,ne,{once:!0})})},l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var O=10;Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return O},set:function(j){if(typeof j!="number"||0>j||I(j))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+j+".");O=j}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(j){if(typeof j!="number"||0>j||I(j))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+j+".");return this._maxListeners=j,this},l.prototype.getMaxListeners=function(){return g(this)},l.prototype.emit=function(j){for(var P=[],q=1;q<arguments.length;q++)P.push(arguments[q]);var G=j==="error",ne=this._events;if(ne!==void 0)G=G&&ne.error===void 0;else if(!G)return!1;if(G){var oe;if(0<P.length&&(oe=P[0]),oe instanceof Error)throw oe;var ue=new Error("Unhandled error."+(oe?" ("+oe.message+")":""));throw ue.context=oe,ue}var fe=ne[j];if(fe===void 0)return!1;if(typeof fe=="function")h(fe,this,P);else for(var Ee=fe.length,be=C(fe,Ee),q=0;q<Ee;++q)h(be[q],this,P);return!0},l.prototype.addListener=function(j,P){return d(this,j,P,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(j,P){return d(this,j,P,!0)},l.prototype.once=function(j,P){return u(P),this.on(j,m(this,j,P)),this},l.prototype.prependOnceListener=function(j,P){return u(P),this.prependListener(j,m(this,j,P)),this},l.prototype.removeListener=function(j,P){var q,G,ne,oe,ue;if(u(P),G=this._events,G===void 0)return this;if(q=G[j],q===void 0)return this;if(q===P||q.listener===P)--this._eventsCount==0?this._events=Object.create(null):(delete G[j],G.removeListener&&this.emit("removeListener",j,q.listener||P));else if(typeof q!="function"){for(ne=-1,oe=q.length-1;0<=oe;oe--)if(q[oe]===P||q[oe].listener===P){ue=q[oe].listener,ne=oe;break}if(0>ne)return this;ne===0?q.shift():S(q,ne),q.length===1&&(G[j]=q[0]),G.removeListener!==void 0&&this.emit("removeListener",j,ue||P)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(j){var P,q,G;if(q=this._events,q===void 0)return this;if(q.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):q[j]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete q[j]),this;if(arguments.length===0){var ne,oe=Object.keys(q);for(G=0;G<oe.length;++G)ne=oe[G],ne!=="removeListener"&&this.removeAllListeners(ne);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(P=q[j],typeof P=="function")this.removeListener(j,P);else if(P!==void 0)for(G=P.length-1;0<=G;G--)this.removeListener(j,P[G]);return this},l.prototype.listeners=function(j){return y(this,j,!0)},l.prototype.rawListeners=function(j){return y(this,j,!1)},l.listenerCount=function(j,P){return typeof j.listenerCount=="function"?j.listenerCount(P):b.call(j,P)},l.prototype.listenerCount=b,l.prototype.eventNames=function(){return 0<this._eventsCount?T(this._events):[]}},{}],8:[function(s,o){o.exports=function(){if(typeof globalThis>"u")return null;var a={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return a.RTCPeerConnection?a:null}},{}],9:[function(s,o,a){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a.read=function(l,u,g,d,f){var m,y,b=8*f-d-1,C=(1<<b)-1,S=C>>1,A=-7,v=g?f-1:0,k=g?-1:1,T=l[u+v];for(v+=k,m=T&(1<<-A)-1,T>>=-A,A+=b;0<A;m=256*m+l[u+v],v+=k,A-=8);for(y=m&(1<<-A)-1,m>>=-A,A+=d;0<A;y=256*y+l[u+v],v+=k,A-=8);if(m===0)m=1-S;else{if(m===C)return y?NaN:(T?-1:1)*(1/0);y+=i(2,d),m-=S}return(T?-1:1)*y*i(2,m-d)},a.write=function(l,u,g,d,f,m){var y,b,C,S=Math.LN2,A=Math.log,v=8*m-f-1,k=(1<<v)-1,T=k>>1,N=f===23?i(2,-24)-i(2,-77):0,h=d?0:m-1,I=d?1:-1,O=0>u||u===0&&0>1/u?1:0;for(u=r(u),isNaN(u)||u===1/0?(b=isNaN(u)?1:0,y=k):(y=t(A(u)/S),1>u*(C=i(2,-y))&&(y--,C*=2),u+=1<=y+T?N/C:N*i(2,1-T),2<=u*C&&(y++,C/=2),y+T>=k?(b=0,y=k):1<=y+T?(b=(u*C-1)*i(2,f),y+=T):(b=u*i(2,T-1)*i(2,f),y=0));8<=f;l[g+h]=255&b,h+=I,b/=256,f-=8);for(y=y<<f|b,v+=f;0<v;l[g+h]=255&y,h+=I,y/=256,v-=8);l[g+h-I]|=128*O}},{}],10:[function(s,o){o.exports=typeof Object.create=="function"?function(a,l){l&&(a.super_=l,a.prototype=Object.create(l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:function(a,l){if(l){a.super_=l;var u=function(){};u.prototype=l.prototype,a.prototype=new u,a.prototype.constructor=a}}},{}],11:[function(s,o){var a=Math.round;function l(f){if(f+="",!(100<f.length)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(m){var y=parseFloat(m[1]),b=(m[2]||"ms").toLowerCase();return b==="years"||b==="year"||b==="yrs"||b==="yr"||b==="y"?315576e5*y:b==="weeks"||b==="week"||b==="w"?6048e5*y:b==="days"||b==="day"||b==="d"?864e5*y:b==="hours"||b==="hour"||b==="hrs"||b==="hr"||b==="h"?36e5*y:b==="minutes"||b==="minute"||b==="mins"||b==="min"||b==="m"?6e4*y:b==="seconds"||b==="second"||b==="secs"||b==="sec"||b==="s"?1e3*y:b==="milliseconds"||b==="millisecond"||b==="msecs"||b==="msec"||b==="ms"?y:void 0}}}function u(f){var m=r(f);return 864e5<=m?a(f/864e5)+"d":36e5<=m?a(f/36e5)+"h":6e4<=m?a(f/6e4)+"m":1e3<=m?a(f/1e3)+"s":f+"ms"}function g(f){var m=r(f);return 864e5<=m?d(f,m,864e5,"day"):36e5<=m?d(f,m,36e5,"hour"):6e4<=m?d(f,m,6e4,"minute"):1e3<=m?d(f,m,1e3,"second"):f+" ms"}function d(f,m,y,b){return a(f/y)+" "+b+(m>=1.5*y?"s":"")}o.exports=function(f,m){m=m||{};var y=typeof f;if(y=="string"&&0<f.length)return l(f);if(y==="number"&&isFinite(f))return m.long?g(f):u(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))}},{}],12:[function(s,o){function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function u(N){if(b===setTimeout)return setTimeout(N,0);if((b===a||!b)&&setTimeout)return b=setTimeout,setTimeout(N,0);try{return b(N,0)}catch{try{return b.call(null,N,0)}catch{return b.call(this,N,0)}}}function g(N){if(C===clearTimeout)return clearTimeout(N);if((C===l||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(N);try{return C(N)}catch{try{return C.call(null,N)}catch{return C.call(this,N)}}}function d(){k&&A&&(k=!1,A.length?v=A.concat(v):T=-1,v.length&&f())}function f(){if(!k){var N=u(d);k=!0;for(var h=v.length;h;){for(A=v,v=[];++T<h;)A&&A[T].run();T=-1,h=v.length}A=null,k=!1,g(N)}}function m(N,h){this.fun=N,this.array=h}function y(){}var b,C,S=o.exports={};(function(){try{b=typeof setTimeout=="function"?setTimeout:a}catch{b=a}try{C=typeof clearTimeout=="function"?clearTimeout:l}catch{C=l}})();var A,v=[],k=!1,T=-1;S.nextTick=function(N){var h=Array(arguments.length-1);if(1<arguments.length)for(var I=1;I<arguments.length;I++)h[I-1]=arguments[I];v.push(new m(N,h)),v.length!==1||k||u(f)},m.prototype.run=function(){this.fun.apply(null,this.array)},S.title="browser",S.browser=!0,S.env={},S.argv=[],S.version="",S.versions={},S.on=y,S.addListener=y,S.once=y,S.off=y,S.removeListener=y,S.removeAllListeners=y,S.emit=y,S.prependListener=y,S.prependOnceListener=y,S.listeners=function(){return[]},S.binding=function(){throw new Error("process.binding is not supported")},S.cwd=function(){return"/"},S.chdir=function(){throw new Error("process.chdir is not supported")},S.umask=function(){return 0}},{}],13:[function(s,o){(function(a){(function(){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */let l;o.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?a:window):u=>(l||(l=Promise.resolve())).then(u).catch(g=>setTimeout(()=>{throw g},0))}).call(this)}).call(this,typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{}],14:[function(s,o){(function(a,l){(function(){var u=s("safe-buffer").Buffer,g=l.crypto||l.msCrypto;o.exports=g&&g.getRandomValues?function(d,f){if(d>4294967295)throw new RangeError("requested too many random bytes");var m=u.allocUnsafe(d);if(0<d)if(65536<d)for(var y=0;y<d;y+=65536)g.getRandomValues(m.slice(y,y+65536));else g.getRandomValues(m);return typeof f=="function"?a.nextTick(function(){f(null,m)}):m}:function(){throw new Error(`Secure random number generation is not supported by this browser.
42
- Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,s("_process"),typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{_process:12,"safe-buffer":30}],15:[function(s,o){function a(y,b){y.prototype=Object.create(b.prototype),y.prototype.constructor=y,y.__proto__=b}function l(y,b,C){function S(v,k,T){return typeof b=="string"?b:b(v,k,T)}C||(C=Error);var A=function(v){function k(T,N,h){return v.call(this,S(T,N,h))||this}return a(k,v),k}(C);A.prototype.name=C.name,A.prototype.code=y,m[y]=A}function u(y,b){if(Array.isArray(y)){var C=y.length;return y=y.map(function(S){return S+""}),2<C?"one of ".concat(b," ").concat(y.slice(0,C-1).join(", "),", or ")+y[C-1]:C===2?"one of ".concat(b," ").concat(y[0]," or ").concat(y[1]):"of ".concat(b," ").concat(y[0])}return"of ".concat(b," ").concat(y+"")}function g(y,b,C){return y.substr(!C||0>C?0:+C,b.length)===b}function d(y,b,C){return(C===void 0||C>y.length)&&(C=y.length),y.substring(C-b.length,C)===b}function f(y,b,C){return typeof C!="number"&&(C=0),!(C+b.length>y.length)&&y.indexOf(b,C)!==-1}var m={};l("ERR_INVALID_OPT_VALUE",function(y,b){return'The value "'+b+'" is invalid for option "'+y+'"'},TypeError),l("ERR_INVALID_ARG_TYPE",function(y,b,C){var S;typeof b=="string"&&g(b,"not ")?(S="must not be",b=b.replace(/^not /,"")):S="must be";var A;if(d(y," argument"))A="The ".concat(y," ").concat(S," ").concat(u(b,"type"));else{var v=f(y,".")?"property":"argument";A='The "'.concat(y,'" ').concat(v," ").concat(S," ").concat(u(b,"type"))}return A+=". Received type ".concat(typeof C),A},TypeError),l("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),l("ERR_METHOD_NOT_IMPLEMENTED",function(y){return"The "+y+" method is not implemented"}),l("ERR_STREAM_PREMATURE_CLOSE","Premature close"),l("ERR_STREAM_DESTROYED",function(y){return"Cannot call "+y+" after a stream was destroyed"}),l("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),l("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),l("ERR_STREAM_WRITE_AFTER_END","write after end"),l("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),l("ERR_UNKNOWN_ENCODING",function(y){return"Unknown encoding: "+y},TypeError),l("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=m},{}],16:[function(s,o){(function(a){(function(){function l(S){return this instanceof l?(f.call(this,S),m.call(this,S),this.allowHalfOpen=!0,void(S&&(S.readable===!1&&(this.readable=!1),S.writable===!1&&(this.writable=!1),S.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u))))):new l(S)}function u(){this._writableState.ended||a.nextTick(g,this)}function g(S){S.end()}var d=Object.keys||function(S){var A=[];for(var v in S)A.push(v);return A};o.exports=l;var f=s("./_stream_readable"),m=s("./_stream_writable");s("inherits")(l,f);for(var y,b=d(m.prototype),C=0;C<b.length;C++)y=b[C],l.prototype[y]||(l.prototype[y]=m.prototype[y]);Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this)}).call(this,s("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(s,o){function a(u){return this instanceof a?void l.call(this,u):new a(u)}o.exports=a;var l=s("./_stream_transform");s("inherits")(a,l),a.prototype._transform=function(u,g,d){d(null,u)}},{"./_stream_transform":19,inherits:10}],18:[function(s,o){(function(a,l){(function(){function u(B){return xe.from(B)}function g(B){return xe.isBuffer(B)||B instanceof Te}function d(B,_,E){return typeof B.prependListener=="function"?B.prependListener(_,E):void(B._events&&B._events[_]?Array.isArray(B._events[_])?B._events[_].unshift(E):B._events[_]=[E,B._events[_]]:B.on(_,E))}function f(B,_,E){Ee=Ee||s("./_stream_duplex"),B=B||{},typeof E!="boolean"&&(E=_ instanceof Ee),this.objectMode=!!B.objectMode,E&&(this.objectMode=this.objectMode||!!B.readableObjectMode),this.highWaterMark=ft(this,B,"readableHighWaterMark",E),this.buffer=new ze,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=B.emitClose!==!1,this.autoDestroy=!!B.autoDestroy,this.destroyed=!1,this.defaultEncoding=B.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,B.encoding&&(!Fe&&(Fe=s("string_decoder/").StringDecoder),this.decoder=new Fe(B.encoding),this.encoding=B.encoding)}function m(B){if(Ee=Ee||s("./_stream_duplex"),!(this instanceof m))return new m(B);var _=this instanceof Ee;this._readableState=new f(B,this,_),this.readable=!0,B&&(typeof B.read=="function"&&(this._read=B.read),typeof B.destroy=="function"&&(this._destroy=B.destroy)),de.call(this)}function y(B,_,E,R,Y){be("readableAddChunk",_);var J=B._readableState;if(_===null)J.reading=!1,v(B,J);else{var K;if(Y||(K=C(J,_)),K)ye(B,K);else if(!(J.objectMode||_&&0<_.length))R||(J.reading=!1,N(B,J));else if(typeof _=="string"||J.objectMode||Object.getPrototypeOf(_)===xe.prototype||(_=u(_)),R)J.endEmitted?ye(B,new re):b(B,J,_,!0);else if(J.ended)ye(B,new Wt);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!E?(_=J.decoder.write(_),J.objectMode||_.length!==0?b(B,J,_,!1):N(B,J)):b(B,J,_,!1)}}return!J.ended&&(J.length<J.highWaterMark||J.length===0)}function b(B,_,E,R){_.flowing&&_.length===0&&!_.sync?(_.awaitDrain=0,B.emit("data",E)):(_.length+=_.objectMode?1:E.length,R?_.buffer.unshift(E):_.buffer.push(E),_.needReadable&&k(B)),N(B,_)}function C(B,_){var E;return g(_)||typeof _=="string"||_===void 0||B.objectMode||(E=new yt("chunk",["string","Buffer","Uint8Array"],_)),E}function S(B){return 1073741824<=B?B=1073741824:(B--,B|=B>>>1,B|=B>>>2,B|=B>>>4,B|=B>>>8,B|=B>>>16,B++),B}function A(B,_){return 0>=B||_.length===0&&_.ended?0:_.objectMode?1:B===B?(B>_.highWaterMark&&(_.highWaterMark=S(B)),B<=_.length?B:_.ended?_.length:(_.needReadable=!0,0)):_.flowing&&_.length?_.buffer.head.data.length:_.length}function v(B,_){if(be("onEofChunk"),!_.ended){if(_.decoder){var E=_.decoder.end();E&&E.length&&(_.buffer.push(E),_.length+=_.objectMode?1:E.length)}_.ended=!0,_.sync?k(B):(_.needReadable=!1,!_.emittedReadable&&(_.emittedReadable=!0,T(B)))}}function k(B){var _=B._readableState;be("emitReadable",_.needReadable,_.emittedReadable),_.needReadable=!1,_.emittedReadable||(be("emitReadable",_.flowing),_.emittedReadable=!0,a.nextTick(T,B))}function T(B){var _=B._readableState;be("emitReadable_",_.destroyed,_.length,_.ended),!_.destroyed&&(_.length||_.ended)&&(B.emit("readable"),_.emittedReadable=!1),_.needReadable=!_.flowing&&!_.ended&&_.length<=_.highWaterMark,G(B)}function N(B,_){_.readingMore||(_.readingMore=!0,a.nextTick(h,B,_))}function h(B,_){for(;!_.reading&&!_.ended&&(_.length<_.highWaterMark||_.flowing&&_.length===0);){var E=_.length;if(be("maybeReadMore read 0"),B.read(0),E===_.length)break}_.readingMore=!1}function I(B){return function(){var _=B._readableState;be("pipeOnDrain",_.awaitDrain),_.awaitDrain&&_.awaitDrain--,_.awaitDrain===0&&ae(B,"data")&&(_.flowing=!0,G(B))}}function O(B){var _=B._readableState;_.readableListening=0<B.listenerCount("readable"),_.resumeScheduled&&!_.paused?_.flowing=!0:0<B.listenerCount("data")&&B.resume()}function j(B){be("readable nexttick read 0"),B.read(0)}function P(B,_){_.resumeScheduled||(_.resumeScheduled=!0,a.nextTick(q,B,_))}function q(B,_){be("resume",_.reading),_.reading||B.read(0),_.resumeScheduled=!1,B.emit("resume"),G(B),_.flowing&&!_.reading&&B.read(0)}function G(B){var _=B._readableState;for(be("flow",_.flowing);_.flowing&&B.read()!==null;);}function ne(B,_){if(_.length===0)return null;var E;return _.objectMode?E=_.buffer.shift():!B||B>=_.length?(E=_.decoder?_.buffer.join(""):_.buffer.length===1?_.buffer.first():_.buffer.concat(_.length),_.buffer.clear()):E=_.buffer.consume(B,_.decoder),E}function oe(B){var _=B._readableState;be("endReadable",_.endEmitted),_.endEmitted||(_.ended=!0,a.nextTick(ue,_,B))}function ue(B,_){if(be("endReadableNT",B.endEmitted,B.length),!B.endEmitted&&B.length===0&&(B.endEmitted=!0,_.readable=!1,_.emit("end"),B.autoDestroy)){var E=_._writableState;(!E||E.autoDestroy&&E.finished)&&_.destroy()}}function fe(B,_){for(var E=0,R=B.length;E<R;E++)if(B[E]===_)return E;return-1}o.exports=m;var Ee;m.ReadableState=f;var be;s("events").EventEmitter;var ae=function(B,_){return B.listeners(_).length},de=s("./internal/streams/stream"),xe=s("buffer").Buffer,Te=l.Uint8Array||function(){},ve=s("util");be=ve&&ve.debuglog?ve.debuglog("stream"):function(){};var Fe,Ae,Ne,ze=s("./internal/streams/buffer_list"),Ce=s("./internal/streams/destroy"),Pe=s("./internal/streams/state"),ft=Pe.getHighWaterMark,we=s("../errors").codes,yt=we.ERR_INVALID_ARG_TYPE,Wt=we.ERR_STREAM_PUSH_AFTER_EOF,Z=we.ERR_METHOD_NOT_IMPLEMENTED,re=we.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;s("inherits")(m,de);var ye=Ce.errorOrDestroy,Ie=["error","close","destroy","pause","resume"];Object.defineProperty(m.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(B){this._readableState&&(this._readableState.destroyed=B)}}),m.prototype.destroy=Ce.destroy,m.prototype._undestroy=Ce.undestroy,m.prototype._destroy=function(B,_){_(B)},m.prototype.push=function(B,_){var E,R=this._readableState;return R.objectMode?E=!0:typeof B=="string"&&(_=_||R.defaultEncoding,_!==R.encoding&&(B=xe.from(B,_),_=""),E=!0),y(this,B,_,!1,E)},m.prototype.unshift=function(B){return y(this,B,null,!0,!1)},m.prototype.isPaused=function(){return this._readableState.flowing===!1},m.prototype.setEncoding=function(B){Fe||(Fe=s("string_decoder/").StringDecoder);var _=new Fe(B);this._readableState.decoder=_,this._readableState.encoding=this._readableState.decoder.encoding;for(var E=this._readableState.buffer.head,R="";E!==null;)R+=_.write(E.data),E=E.next;return this._readableState.buffer.clear(),R!==""&&this._readableState.buffer.push(R),this._readableState.length=R.length,this},m.prototype.read=function(B){be("read",B),B=parseInt(B,10);var _=this._readableState,E=B;if(B!==0&&(_.emittedReadable=!1),B===0&&_.needReadable&&((_.highWaterMark===0?0<_.length:_.length>=_.highWaterMark)||_.ended))return be("read: emitReadable",_.length,_.ended),_.length===0&&_.ended?oe(this):k(this),null;if(B=A(B,_),B===0&&_.ended)return _.length===0&&oe(this),null;var R=_.needReadable;be("need readable",R),(_.length===0||_.length-B<_.highWaterMark)&&(R=!0,be("length less than watermark",R)),_.ended||_.reading?(R=!1,be("reading or ended",R)):R&&(be("do read"),_.reading=!0,_.sync=!0,_.length===0&&(_.needReadable=!0),this._read(_.highWaterMark),_.sync=!1,!_.reading&&(B=A(E,_)));var Y;return Y=0<B?ne(B,_):null,Y===null?(_.needReadable=_.length<=_.highWaterMark,B=0):(_.length-=B,_.awaitDrain=0),_.length===0&&(!_.ended&&(_.needReadable=!0),E!==B&&_.ended&&oe(this)),Y!==null&&this.emit("data",Y),Y},m.prototype._read=function(){ye(this,new Z("_read()"))},m.prototype.pipe=function(B,_){function E(qt,Gn){be("onunpipe"),qt===Ze&&Gn&&Gn.hasUnpiped===!1&&(Gn.hasUnpiped=!0,Y())}function R(){be("onend"),B.end()}function Y(){be("cleanup"),B.removeListener("close",ke),B.removeListener("finish",Je),B.removeListener("drain",Vt),B.removeListener("error",K),B.removeListener("unpipe",E),Ze.removeListener("end",R),Ze.removeListener("end",Ct),Ze.removeListener("data",J),hn=!0,Ge.awaitDrain&&(!B._writableState||B._writableState.needDrain)&&Vt()}function J(qt){be("ondata");var Gn=B.write(qt);be("dest.write",Gn),Gn===!1&&((Ge.pipesCount===1&&Ge.pipes===B||1<Ge.pipesCount&&fe(Ge.pipes,B)!==-1)&&!hn&&(be("false write response, pause",Ge.awaitDrain),Ge.awaitDrain++),Ze.pause())}function K(qt){be("onerror",qt),Ct(),B.removeListener("error",K),ae(B,"error")===0&&ye(B,qt)}function ke(){B.removeListener("finish",Je),Ct()}function Je(){be("onfinish"),B.removeListener("close",ke),Ct()}function Ct(){be("unpipe"),Ze.unpipe(B)}var Ze=this,Ge=this._readableState;switch(Ge.pipesCount){case 0:Ge.pipes=B;break;case 1:Ge.pipes=[Ge.pipes,B];break;default:Ge.pipes.push(B)}Ge.pipesCount+=1,be("pipe count=%d opts=%j",Ge.pipesCount,_);var Ft=(!_||_.end!==!1)&&B!==a.stdout&&B!==a.stderr,wn=Ft?R:Ct;Ge.endEmitted?a.nextTick(wn):Ze.once("end",wn),B.on("unpipe",E);var Vt=I(Ze);B.on("drain",Vt);var hn=!1;return Ze.on("data",J),d(B,"error",K),B.once("close",ke),B.once("finish",Je),B.emit("pipe",Ze),Ge.flowing||(be("pipe resume"),Ze.resume()),B},m.prototype.unpipe=function(B){var _=this._readableState,E={hasUnpiped:!1};if(_.pipesCount===0)return this;if(_.pipesCount===1)return B&&B!==_.pipes?this:(B||(B=_.pipes),_.pipes=null,_.pipesCount=0,_.flowing=!1,B&&B.emit("unpipe",this,E),this);if(!B){var R=_.pipes,Y=_.pipesCount;_.pipes=null,_.pipesCount=0,_.flowing=!1;for(var J=0;J<Y;J++)R[J].emit("unpipe",this,{hasUnpiped:!1});return this}var K=fe(_.pipes,B);return K===-1?this:(_.pipes.splice(K,1),_.pipesCount-=1,_.pipesCount===1&&(_.pipes=_.pipes[0]),B.emit("unpipe",this,E),this)},m.prototype.on=function(B,_){var E=de.prototype.on.call(this,B,_),R=this._readableState;return B==="data"?(R.readableListening=0<this.listenerCount("readable"),R.flowing!==!1&&this.resume()):B=="readable"&&!R.endEmitted&&!R.readableListening&&(R.readableListening=R.needReadable=!0,R.flowing=!1,R.emittedReadable=!1,be("on readable",R.length,R.reading),R.length?k(this):!R.reading&&a.nextTick(j,this)),E},m.prototype.addListener=m.prototype.on,m.prototype.removeListener=function(B,_){var E=de.prototype.removeListener.call(this,B,_);return B==="readable"&&a.nextTick(O,this),E},m.prototype.removeAllListeners=function(B){var _=de.prototype.removeAllListeners.apply(this,arguments);return(B==="readable"||B===void 0)&&a.nextTick(O,this),_},m.prototype.resume=function(){var B=this._readableState;return B.flowing||(be("resume"),B.flowing=!B.readableListening,P(this,B)),B.paused=!1,this},m.prototype.pause=function(){return be("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(be("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},m.prototype.wrap=function(B){var _=this,E=this._readableState,R=!1;for(var Y in B.on("end",function(){if(be("wrapped end"),E.decoder&&!E.ended){var K=E.decoder.end();K&&K.length&&_.push(K)}_.push(null)}),B.on("data",function(K){if(be("wrapped data"),E.decoder&&(K=E.decoder.write(K)),!(E.objectMode&&K==null)&&(E.objectMode||K&&K.length)){var ke=_.push(K);ke||(R=!0,B.pause())}}),B)this[Y]===void 0&&typeof B[Y]=="function"&&(this[Y]=function(K){return function(){return B[K].apply(B,arguments)}}(Y));for(var J=0;J<Ie.length;J++)B.on(Ie[J],this.emit.bind(this,Ie[J]));return this._read=function(K){be("wrapped _read",K),R&&(R=!1,B.resume())},this},typeof Symbol=="function"&&(m.prototype[Symbol.asyncIterator]=function(){return Ae===void 0&&(Ae=s("./internal/streams/async_iterator")),Ae(this)}),Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(m.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(m.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(B){this._readableState&&(this._readableState.flowing=B)}}),m._fromList=ne,Object.defineProperty(m.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(m.from=function(B,_){return Ne===void 0&&(Ne=s("./internal/streams/from")),Ne(m,B,_)})}).call(this)}).call(this,s("_process"),typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(s,o){function a(S,A){var v=this._transformState;v.transforming=!1;var k=v.writecb;if(k===null)return this.emit("error",new m);v.writechunk=null,v.writecb=null,A!=null&&this.push(A),k(S);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function l(S){return this instanceof l?(C.call(this,S),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,S&&(typeof S.transform=="function"&&(this._transform=S.transform),typeof S.flush=="function"&&(this._flush=S.flush)),void this.on("prefinish",u)):new l(S)}function u(){var S=this;typeof this._flush!="function"||this._readableState.destroyed?g(this,null,null):this._flush(function(A,v){g(S,A,v)})}function g(S,A,v){if(A)return S.emit("error",A);if(v!=null&&S.push(v),S._writableState.length)throw new b;if(S._transformState.transforming)throw new y;return S.push(null)}o.exports=l;var d=s("../errors").codes,f=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_TRANSFORM_ALREADY_TRANSFORMING,b=d.ERR_TRANSFORM_WITH_LENGTH_0,C=s("./_stream_duplex");s("inherits")(l,C),l.prototype.push=function(S,A){return this._transformState.needTransform=!1,C.prototype.push.call(this,S,A)},l.prototype._transform=function(S,A,v){v(new f("_transform()"))},l.prototype._write=function(S,A,v){var k=this._transformState;if(k.writecb=v,k.writechunk=S,k.writeencoding=A,!k.transforming){var T=this._readableState;(k.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},l.prototype._read=function(){var S=this._transformState;S.writechunk===null||S.transforming?S.needTransform=!0:(S.transforming=!0,this._transform(S.writechunk,S.writeencoding,S.afterTransform))},l.prototype._destroy=function(S,A){C.prototype._destroy.call(this,S,function(v){A(v)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(s,o){(function(a,l){(function(){function u(Z){var re=this;this.next=null,this.entry=null,this.finish=function(){oe(re,Z)}}function g(Z){return be.from(Z)}function d(Z){return be.isBuffer(Z)||Z instanceof ae}function f(){}function m(Z,re,ye){ue=ue||s("./_stream_duplex"),Z=Z||{},typeof ye!="boolean"&&(ye=re instanceof ue),this.objectMode=!!Z.objectMode,ye&&(this.objectMode=this.objectMode||!!Z.writableObjectMode),this.highWaterMark=Te(this,Z,"writableHighWaterMark",ye),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ie=Z.decodeStrings===!1;this.decodeStrings=!Ie,this.defaultEncoding=Z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(B){N(re,B)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Z.emitClose!==!1,this.autoDestroy=!!Z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new u(this)}function y(Z){ue=ue||s("./_stream_duplex");var re=this instanceof ue;return re||Wt.call(y,this)?(this._writableState=new m(Z,this,re),this.writable=!0,Z&&(typeof Z.write=="function"&&(this._write=Z.write),typeof Z.writev=="function"&&(this._writev=Z.writev),typeof Z.destroy=="function"&&(this._destroy=Z.destroy),typeof Z.final=="function"&&(this._final=Z.final)),void Ee.call(this)):new y(Z)}function b(Z,re){var ye=new ft;yt(Z,ye),a.nextTick(re,ye)}function C(Z,re,ye,Ie){var B;return ye===null?B=new Pe:typeof ye!="string"&&!re.objectMode&&(B=new Fe("chunk",["string","Buffer"],ye)),!B||(yt(Z,B),a.nextTick(Ie,B),!1)}function S(Z,re,ye){return Z.objectMode||Z.decodeStrings===!1||typeof re!="string"||(re=be.from(re,ye)),re}function A(Z,re,ye,Ie,B,_){if(!ye){var E=S(re,Ie,B);Ie!==E&&(ye=!0,B="buffer",Ie=E)}var R=re.objectMode?1:Ie.length;re.length+=R;var Y=re.length<re.highWaterMark;if(Y||(re.needDrain=!0),re.writing||re.corked){var J=re.lastBufferedRequest;re.lastBufferedRequest={chunk:Ie,encoding:B,isBuf:ye,callback:_,next:null},J?J.next=re.lastBufferedRequest:re.bufferedRequest=re.lastBufferedRequest,re.bufferedRequestCount+=1}else v(Z,re,!1,R,Ie,B,_);return Y}function v(Z,re,ye,Ie,B,_,E){re.writelen=Ie,re.writecb=E,re.writing=!0,re.sync=!0,re.destroyed?re.onwrite(new Ce("write")):ye?Z._writev(B,re.onwrite):Z._write(B,_,re.onwrite),re.sync=!1}function k(Z,re,ye,Ie,B){--re.pendingcb,ye?(a.nextTick(B,Ie),a.nextTick(G,Z,re),Z._writableState.errorEmitted=!0,yt(Z,Ie)):(B(Ie),Z._writableState.errorEmitted=!0,yt(Z,Ie),G(Z,re))}function T(Z){Z.writing=!1,Z.writecb=null,Z.length-=Z.writelen,Z.writelen=0}function N(Z,re){var ye=Z._writableState,Ie=ye.sync,B=ye.writecb;if(typeof B!="function")throw new Ne;if(T(ye),re)k(Z,ye,Ie,re,B);else{var _=j(ye)||Z.destroyed;_||ye.corked||ye.bufferProcessing||!ye.bufferedRequest||O(Z,ye),Ie?a.nextTick(h,Z,ye,_,B):h(Z,ye,_,B)}}function h(Z,re,ye,Ie){ye||I(Z,re),re.pendingcb--,Ie(),G(Z,re)}function I(Z,re){re.length===0&&re.needDrain&&(re.needDrain=!1,Z.emit("drain"))}function O(Z,re){re.bufferProcessing=!0;var ye=re.bufferedRequest;if(Z._writev&&ye&&ye.next){var Ie=re.bufferedRequestCount,B=Array(Ie),_=re.corkedRequestsFree;_.entry=ye;for(var E=0,R=!0;ye;)B[E]=ye,ye.isBuf||(R=!1),ye=ye.next,E+=1;B.allBuffers=R,v(Z,re,!0,re.length,B,"",_.finish),re.pendingcb++,re.lastBufferedRequest=null,_.next?(re.corkedRequestsFree=_.next,_.next=null):re.corkedRequestsFree=new u(re),re.bufferedRequestCount=0}else{for(;ye;){var Y=ye.chunk,J=ye.encoding,K=ye.callback,ke=re.objectMode?1:Y.length;if(v(Z,re,!1,ke,Y,J,K),ye=ye.next,re.bufferedRequestCount--,re.writing)break}ye===null&&(re.lastBufferedRequest=null)}re.bufferedRequest=ye,re.bufferProcessing=!1}function j(Z){return Z.ending&&Z.length===0&&Z.bufferedRequest===null&&!Z.finished&&!Z.writing}function P(Z,re){Z._final(function(ye){re.pendingcb--,ye&&yt(Z,ye),re.prefinished=!0,Z.emit("prefinish"),G(Z,re)})}function q(Z,re){re.prefinished||re.finalCalled||(typeof Z._final!="function"||re.destroyed?(re.prefinished=!0,Z.emit("prefinish")):(re.pendingcb++,re.finalCalled=!0,a.nextTick(P,Z,re)))}function G(Z,re){var ye=j(re);if(ye&&(q(Z,re),re.pendingcb===0&&(re.finished=!0,Z.emit("finish"),re.autoDestroy))){var Ie=Z._readableState;(!Ie||Ie.autoDestroy&&Ie.endEmitted)&&Z.destroy()}return ye}function ne(Z,re,ye){re.ending=!0,G(Z,re),ye&&(re.finished?a.nextTick(ye):Z.once("finish",ye)),re.ended=!0,Z.writable=!1}function oe(Z,re,ye){var Ie=Z.entry;for(Z.entry=null;Ie;){var B=Ie.callback;re.pendingcb--,B(ye),Ie=Ie.next}re.corkedRequestsFree.next=Z}o.exports=y;var ue;y.WritableState=m;var fe={deprecate:s("util-deprecate")},Ee=s("./internal/streams/stream"),be=s("buffer").Buffer,ae=l.Uint8Array||function(){},de=s("./internal/streams/destroy"),xe=s("./internal/streams/state"),Te=xe.getHighWaterMark,ve=s("../errors").codes,Fe=ve.ERR_INVALID_ARG_TYPE,Ae=ve.ERR_METHOD_NOT_IMPLEMENTED,Ne=ve.ERR_MULTIPLE_CALLBACK,ze=ve.ERR_STREAM_CANNOT_PIPE,Ce=ve.ERR_STREAM_DESTROYED,Pe=ve.ERR_STREAM_NULL_VALUES,ft=ve.ERR_STREAM_WRITE_AFTER_END,we=ve.ERR_UNKNOWN_ENCODING,yt=de.errorOrDestroy;s("inherits")(y,Ee),m.prototype.getBuffer=function(){for(var Z=this.bufferedRequest,re=[];Z;)re.push(Z),Z=Z.next;return re},function(){try{Object.defineProperty(m.prototype,"buffer",{get:fe.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var Wt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Wt=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(Z){return!!Wt.call(this,Z)||this===y&&Z&&Z._writableState instanceof m}})):Wt=function(Z){return Z instanceof this},y.prototype.pipe=function(){yt(this,new ze)},y.prototype.write=function(Z,re,ye){var Ie=this._writableState,B=!1,_=!Ie.objectMode&&d(Z);return _&&!be.isBuffer(Z)&&(Z=g(Z)),typeof re=="function"&&(ye=re,re=null),_?re="buffer":!re&&(re=Ie.defaultEncoding),typeof ye!="function"&&(ye=f),Ie.ending?b(this,ye):(_||C(this,Ie,Z,ye))&&(Ie.pendingcb++,B=A(this,Ie,_,Z,re,ye)),B},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var Z=this._writableState;Z.corked&&(Z.corked--,!Z.writing&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&O(this,Z))},y.prototype.setDefaultEncoding=function(Z){if(typeof Z=="string"&&(Z=Z.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Z+"").toLowerCase())))throw new we(Z);return this._writableState.defaultEncoding=Z,this},Object.defineProperty(y.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(Z,re,ye){ye(new Ae("_write()"))},y.prototype._writev=null,y.prototype.end=function(Z,re,ye){var Ie=this._writableState;return typeof Z=="function"?(ye=Z,Z=null,re=null):typeof re=="function"&&(ye=re,re=null),Z!=null&&this.write(Z,re),Ie.corked&&(Ie.corked=1,this.uncork()),Ie.ending||ne(this,Ie,ye),this},Object.defineProperty(y.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(y.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(Z){this._writableState&&(this._writableState.destroyed=Z)}}),y.prototype.destroy=de.destroy,y.prototype._undestroy=de.undestroy,y.prototype._destroy=function(Z,re){re(Z)}}).call(this)}).call(this,s("_process"),typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(s,o){(function(a){(function(){function l(I,O,j){return O in I?Object.defineProperty(I,O,{value:j,enumerable:!0,configurable:!0,writable:!0}):I[O]=j,I}function u(I,O){return{value:I,done:O}}function g(I){var O=I[b];if(O!==null){var j=I[T].read();j!==null&&(I[v]=null,I[b]=null,I[C]=null,O(u(j,!1)))}}function d(I){a.nextTick(g,I)}function f(I,O){return function(j,P){I.then(function(){return O[A]?void j(u(void 0,!0)):void O[k](j,P)},P)}}var m,y=s("./end-of-stream"),b=Symbol("lastResolve"),C=Symbol("lastReject"),S=Symbol("error"),A=Symbol("ended"),v=Symbol("lastPromise"),k=Symbol("handlePromise"),T=Symbol("stream"),N=Object.getPrototypeOf(function(){}),h=Object.setPrototypeOf((m={get stream(){return this[T]},next:function(){var I=this,O=this[S];if(O!==null)return Promise.reject(O);if(this[A])return Promise.resolve(u(void 0,!0));if(this[T].destroyed)return new Promise(function(G,ne){a.nextTick(function(){I[S]?ne(I[S]):G(u(void 0,!0))})});var j,P=this[v];if(P)j=new Promise(f(P,this));else{var q=this[T].read();if(q!==null)return Promise.resolve(u(q,!1));j=new Promise(this[k])}return this[v]=j,j}},l(m,Symbol.asyncIterator,function(){return this}),l(m,"return",function(){var I=this;return new Promise(function(O,j){I[T].destroy(null,function(P){return P?void j(P):void O(u(void 0,!0))})})}),m),N);o.exports=function(I){var O,j=Object.create(h,(O={},l(O,T,{value:I,writable:!0}),l(O,b,{value:null,writable:!0}),l(O,C,{value:null,writable:!0}),l(O,S,{value:null,writable:!0}),l(O,A,{value:I._readableState.endEmitted,writable:!0}),l(O,k,{value:function(P,q){var G=j[T].read();G?(j[v]=null,j[b]=null,j[C]=null,P(u(G,!1))):(j[b]=P,j[C]=q)},writable:!0}),O));return j[v]=null,y(I,function(P){if(P&&P.code!=="ERR_STREAM_PREMATURE_CLOSE"){var q=j[C];return q!==null&&(j[v]=null,j[b]=null,j[C]=null,q(P)),void(j[S]=P)}var G=j[b];G!==null&&(j[v]=null,j[b]=null,j[C]=null,G(u(void 0,!0))),j[A]=!0}),I.on("readable",d.bind(null,j)),j}}).call(this)}).call(this,s("_process"))},{"./end-of-stream":24,_process:12}],22:[function(s,o){function a(v,k){var T=Object.keys(v);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(v);k&&(N=N.filter(function(h){return Object.getOwnPropertyDescriptor(v,h).enumerable})),T.push.apply(T,N)}return T}function l(v){for(var k,T=1;T<arguments.length;T++)k=arguments[T]==null?{}:arguments[T],T%2?a(Object(k),!0).forEach(function(N){u(v,N,k[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(k)):a(Object(k)).forEach(function(N){Object.defineProperty(v,N,Object.getOwnPropertyDescriptor(k,N))});return v}function u(v,k,T){return k in v?Object.defineProperty(v,k,{value:T,enumerable:!0,configurable:!0,writable:!0}):v[k]=T,v}function g(v,k){if(!(v instanceof k))throw new TypeError("Cannot call a class as a function")}function d(v,k){for(var T,N=0;N<k.length;N++)T=k[N],T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,T.key,T)}function f(v,k,T){return k&&d(v.prototype,k),T&&d(v,T),v}function m(v,k,T){b.prototype.copy.call(v,k,T)}var y=s("buffer"),b=y.Buffer,C=s("util"),S=C.inspect,A=S&&S.custom||"inspect";o.exports=function(){function v(){g(this,v),this.head=null,this.tail=null,this.length=0}return f(v,[{key:"push",value:function(k){var T={data:k,next:null};0<this.length?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(k){var T={data:k,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var k=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,k}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(k){if(this.length===0)return"";for(var T=this.head,N=""+T.data;T=T.next;)N+=k+T.data;return N}},{key:"concat",value:function(k){if(this.length===0)return b.alloc(0);for(var T=b.allocUnsafe(k>>>0),N=this.head,h=0;N;)m(N.data,T,h),h+=N.data.length,N=N.next;return T}},{key:"consume",value:function(k,T){var N;return k<this.head.data.length?(N=this.head.data.slice(0,k),this.head.data=this.head.data.slice(k)):k===this.head.data.length?N=this.shift():N=T?this._getString(k):this._getBuffer(k),N}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(k){var T=this.head,N=1,h=T.data;for(k-=h.length;T=T.next;){var I=T.data,O=k>I.length?I.length:k;if(h+=O===I.length?I:I.slice(0,k),k-=O,k===0){O===I.length?(++N,this.head=T.next?T.next:this.tail=null):(this.head=T,T.data=I.slice(O));break}++N}return this.length-=N,h}},{key:"_getBuffer",value:function(k){var T=b.allocUnsafe(k),N=this.head,h=1;for(N.data.copy(T),k-=N.data.length;N=N.next;){var I=N.data,O=k>I.length?I.length:k;if(I.copy(T,T.length-k,0,O),k-=O,k===0){O===I.length?(++h,this.head=N.next?N.next:this.tail=null):(this.head=N,N.data=I.slice(O));break}++h}return this.length-=h,T}},{key:A,value:function(k,T){return S(this,l({},T,{depth:0,customInspect:!1}))}}]),v}()},{buffer:3,util:2}],23:[function(s,o){(function(a){(function(){function l(d,f){g(d,f),u(d)}function u(d){d._writableState&&!d._writableState.emitClose||d._readableState&&!d._readableState.emitClose||d.emit("close")}function g(d,f){d.emit("error",f)}o.exports={destroy:function(d,f){var m=this,y=this._readableState&&this._readableState.destroyed,b=this._writableState&&this._writableState.destroyed;return y||b?(f?f(d):d&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,a.nextTick(g,this,d)):a.nextTick(g,this,d)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(d||null,function(C){!f&&C?m._writableState?m._writableState.errorEmitted?a.nextTick(u,m):(m._writableState.errorEmitted=!0,a.nextTick(l,m,C)):a.nextTick(l,m,C):f?(a.nextTick(u,m),f(C)):a.nextTick(u,m)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(d,f){var m=d._readableState,y=d._writableState;m&&m.autoDestroy||y&&y.autoDestroy?d.destroy(f):d.emit("error",f)}}}).call(this)}).call(this,s("_process"))},{_process:12}],24:[function(s,o){function a(f){var m=!1;return function(){if(!m){m=!0;for(var y=arguments.length,b=Array(y),C=0;C<y;C++)b[C]=arguments[C];f.apply(this,b)}}}function l(){}function u(f){return f.setHeader&&typeof f.abort=="function"}function g(f,m,y){if(typeof m=="function")return g(f,null,m);m||(m={}),y=a(y||l);var b=m.readable||m.readable!==!1&&f.readable,C=m.writable||m.writable!==!1&&f.writable,S=function(){f.writable||v()},A=f._writableState&&f._writableState.finished,v=function(){C=!1,A=!0,b||y.call(f)},k=f._readableState&&f._readableState.endEmitted,T=function(){b=!1,k=!0,C||y.call(f)},N=function(O){y.call(f,O)},h=function(){var O;return b&&!k?(f._readableState&&f._readableState.ended||(O=new d),y.call(f,O)):C&&!A?(f._writableState&&f._writableState.ended||(O=new d),y.call(f,O)):void 0},I=function(){f.req.on("finish",v)};return u(f)?(f.on("complete",v),f.on("abort",h),f.req?I():f.on("request",I)):C&&!f._writableState&&(f.on("end",S),f.on("close",S)),f.on("end",T),f.on("finish",v),m.error!==!1&&f.on("error",N),f.on("close",h),function(){f.removeListener("complete",v),f.removeListener("abort",h),f.removeListener("request",I),f.req&&f.req.removeListener("finish",v),f.removeListener("end",S),f.removeListener("close",S),f.removeListener("finish",v),f.removeListener("end",T),f.removeListener("error",N),f.removeListener("close",h)}}var d=s("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;o.exports=g},{"../../../errors":15}],25:[function(s,o){o.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(s,o){function a(A){var v=!1;return function(){v||(v=!0,A.apply(void 0,arguments))}}function l(A){if(A)throw A}function u(A){return A.setHeader&&typeof A.abort=="function"}function g(A,v,k,T){T=a(T);var N=!1;A.on("close",function(){N=!0}),y===void 0&&(y=s("./end-of-stream")),y(A,{readable:v,writable:k},function(I){return I?T(I):(N=!0,void T())});var h=!1;return function(I){if(!N)return h?void 0:(h=!0,u(A)?A.abort():typeof A.destroy=="function"?A.destroy():void T(I||new S("pipe")))}}function d(A){A()}function f(A,v){return A.pipe(v)}function m(A){return A.length&&typeof A[A.length-1]=="function"?A.pop():l}var y,b=s("../../../errors").codes,C=b.ERR_MISSING_ARGS,S=b.ERR_STREAM_DESTROYED;o.exports=function(){for(var A=arguments.length,v=Array(A),k=0;k<A;k++)v[k]=arguments[k];var T=m(v);if(Array.isArray(v[0])&&(v=v[0]),2>v.length)throw new C("streams");var N,h=v.map(function(I,O){var j=O<v.length-1;return g(I,j,0<O,function(P){N||(N=P),P&&h.forEach(d),j||(h.forEach(d),T(N))})});return v.reduce(f)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(s,o){function a(u,g,d){return u.highWaterMark==null?g?u[d]:null:u.highWaterMark}var l=s("../../../errors").codes.ERR_INVALID_OPT_VALUE;o.exports={getHighWaterMark:function(u,g,d,f){var m=a(g,f,d);if(m!=null){if(!(isFinite(m)&&t(m)===m)||0>m){var y=f?d:"highWaterMark";throw new l(y,m)}return t(m)}return u.objectMode?16:16384}}},{"../../../errors":15}],28:[function(s,o){o.exports=s("events").EventEmitter},{events:7}],29:[function(s,o,a){a=o.exports=s("./lib/_stream_readable.js"),a.Stream=a,a.Readable=a,a.Writable=s("./lib/_stream_writable.js"),a.Duplex=s("./lib/_stream_duplex.js"),a.Transform=s("./lib/_stream_transform.js"),a.PassThrough=s("./lib/_stream_passthrough.js"),a.finished=s("./lib/internal/streams/end-of-stream.js"),a.pipeline=s("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(s,o,a){function l(f,m){for(var y in f)m[y]=f[y]}function u(f,m,y){return d(f,m,y)}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var g=s("buffer"),d=g.Buffer;d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?o.exports=g:(l(g,a),a.Buffer=u),u.prototype=Object.create(d.prototype),l(d,u),u.from=function(f,m,y){if(typeof f=="number")throw new TypeError("Argument must not be a number");return d(f,m,y)},u.alloc=function(f,m,y){if(typeof f!="number")throw new TypeError("Argument must be a number");var b=d(f);return m===void 0?b.fill(0):typeof y=="string"?b.fill(m,y):b.fill(m),b},u.allocUnsafe=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return d(f)},u.allocUnsafeSlow=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return g.SlowBuffer(f)}},{buffer:3}],31:[function(s,o,a){function l(h){if(!h)return"utf8";for(var I;;)switch(h){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return h;default:if(I)return;h=(""+h).toLowerCase(),I=!0}}function u(h){var I=l(h);if(typeof I!="string"&&(T.isEncoding===N||!N(h)))throw new Error("Unknown encoding: "+h);return I||h}function g(h){this.encoding=u(h);var I;switch(this.encoding){case"utf16le":this.text=b,this.end=C,I=4;break;case"utf8":this.fillLast=y,I=4;break;case"base64":this.text=S,this.end=A,I=3;break;default:return this.write=v,void(this.end=k)}this.lastNeed=0,this.lastTotal=0,this.lastChar=T.allocUnsafe(I)}function d(h){return 127>=h?0:h>>5==6?2:h>>4==14?3:h>>3==30?4:h>>6==2?-1:-2}function f(h,I,O){var j=I.length-1;if(j<O)return 0;var P=d(I[j]);return 0<=P?(0<P&&(h.lastNeed=P-1),P):--j<O||P===-2?0:(P=d(I[j]),0<=P?(0<P&&(h.lastNeed=P-2),P):--j<O||P===-2?0:(P=d(I[j]),0<=P?(0<P&&(P===2?P=0:h.lastNeed=P-3),P):0))}function m(h,I){if((192&I[0])!=128)return h.lastNeed=0,"�";if(1<h.lastNeed&&1<I.length){if((192&I[1])!=128)return h.lastNeed=1,"�";if(2<h.lastNeed&&2<I.length&&(192&I[2])!=128)return h.lastNeed=2,"�"}}function y(h){var I=this.lastTotal-this.lastNeed,O=m(this,h);return O===void 0?this.lastNeed<=h.length?(h.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,I,0,h.length),void(this.lastNeed-=h.length)):O}function b(h,I){if((h.length-I)%2==0){var O=h.toString("utf16le",I);if(O){var j=O.charCodeAt(O.length-1);if(55296<=j&&56319>=j)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1],O.slice(0,-1)}return O}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=h[h.length-1],h.toString("utf16le",I,h.length-1)}function C(h){var I=h&&h.length?this.write(h):"";if(this.lastNeed){var O=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,O)}return I}function S(h,I){var O=(h.length-I)%3;return O==0?h.toString("base64",I):(this.lastNeed=3-O,this.lastTotal=3,O==1?this.lastChar[0]=h[h.length-1]:(this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1]),h.toString("base64",I,h.length-O))}function A(h){var I=h&&h.length?this.write(h):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function v(h){return h.toString(this.encoding)}function k(h){return h&&h.length?this.write(h):""}var T=s("safe-buffer").Buffer,N=T.isEncoding||function(h){switch(h=""+h,h&&h.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};a.StringDecoder=g,g.prototype.write=function(h){if(h.length===0)return"";var I,O;if(this.lastNeed){if(I=this.fillLast(h),I===void 0)return"";O=this.lastNeed,this.lastNeed=0}else O=0;return O<h.length?I?I+this.text(h,O):this.text(h,O):I||""},g.prototype.end=function(h){var I=h&&h.length?this.write(h):"";return this.lastNeed?I+"�":I},g.prototype.text=function(h,I){var O=f(this,h,I);if(!this.lastNeed)return h.toString("utf8",I);this.lastTotal=O;var j=h.length-(O-this.lastNeed);return h.copy(this.lastChar,0,j),h.toString("utf8",I,j)},g.prototype.fillLast=function(h){return this.lastNeed<=h.length?(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,h.length),void(this.lastNeed-=h.length))}},{"safe-buffer":30}],32:[function(s,o){(function(a){(function(){function l(u){try{if(!a.localStorage)return!1}catch{return!1}var g=a.localStorage[u];return g!=null&&(g+"").toLowerCase()==="true"}o.exports=function(u,g){function d(){if(!f){if(l("throwDeprecation"))throw new Error(g);l("traceDeprecation")?console.trace(g):console.warn(g),f=!0}return u.apply(this,arguments)}if(l("noDeprecation"))return u;var f=!1;return d}}).call(this)}).call(this,typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{}],"/":[function(s,o){function a(A){return A.replace(/a=ice-options:trickle\s\n/g,"")}function l(A){console.warn(A)}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */const u=s("debug")("simple-peer"),g=s("get-browser-rtc"),d=s("randombytes"),f=s("readable-stream"),m=s("queue-microtask"),y=s("err-code"),{Buffer:b}=s("buffer"),C=65536;class S extends f.Duplex{constructor(v){if(v=Object.assign({allowHalfOpen:!1},v),super(v),this._id=d(4).toString("hex").slice(0,7),this._debug("new peer %o",v),this.channelName=v.initiator?v.channelName||d(20).toString("hex"):null,this.initiator=v.initiator||!1,this.channelConfig=v.channelConfig||S.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},S.config,v.config),this.offerOptions=v.offerOptions||{},this.answerOptions=v.answerOptions||{},this.sdpTransform=v.sdpTransform||(k=>k),this.streams=v.streams||(v.stream?[v.stream]:[]),this.trickle=v.trickle===void 0||v.trickle,this.allowHalfTrickle=v.allowHalfTrickle!==void 0&&v.allowHalfTrickle,this.iceCompleteTimeout=v.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=v.wrtc&&typeof v.wrtc=="object"?v.wrtc:g(),!this._wrtc)throw y(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(k){return void this.destroy(y(k,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=k=>{this._onIceCandidate(k)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(k=>{this.destroy(y(k,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=k=>{this._setupData(k)},this.streams&&this.streams.forEach(k=>{this.addStream(k)}),this._pc.ontrack=k=>{this._onTrack(k)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof v=="string")try{v=JSON.parse(v)}catch{v={}}this._debug("signal()"),v.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),v.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(v.transceiverRequest.kind,v.transceiverRequest.init)),v.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(v.candidate):this._pendingCandidates.push(v.candidate)),v.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(v)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(k=>{this._addIceCandidate(k)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(k=>{this.destroy(y(k,"ERR_SET_REMOTE_DESCRIPTION"))}),v.sdp||v.candidate||v.renegotiate||v.transceiverRequest||this.destroy(y(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(v){const k=new this._wrtc.RTCIceCandidate(v);this._pc.addIceCandidate(k).catch(T=>{!k.address||k.address.endsWith(".local")?l("Ignoring unsupported ICE candidate."):this.destroy(y(T,"ERR_ADD_ICE_CANDIDATE"))})}send(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(v)}}addTransceiver(v,k){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(v,k),this._needsNegotiation()}catch(T){this.destroy(y(T,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:v,init:k}})}}addStream(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),v.getTracks().forEach(k=>{this.addTrack(k,v)})}}addTrack(v,k){if(this.destroying)return;if(this.destroyed)throw y(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const T=this._senderMap.get(v)||new Map;let N=T.get(k);if(!N)N=this._pc.addTrack(v,k),T.set(k,N),this._senderMap.set(v,T),this._needsNegotiation();else throw N.removed?y(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):y(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(v,k,T){if(this.destroying)return;if(this.destroyed)throw y(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const N=this._senderMap.get(v),h=N?N.get(T):null;if(!h)throw y(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");k&&this._senderMap.set(k,N),h.replaceTrack==null?this.destroy(y(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):h.replaceTrack(k)}removeTrack(v,k){if(this.destroying)return;if(this.destroyed)throw y(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const T=this._senderMap.get(v),N=T?T.get(k):null;if(!N)throw y(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{N.removed=!0,this._pc.removeTrack(N)}catch(h){h.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(N):this.destroy(y(h,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),v.getTracks().forEach(k=>{this.removeTrack(k,v)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,m(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(v){this._destroy(v,()=>{})}_destroy(v,k){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",v&&(v.message||v)),m(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",v&&(v.message||v)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,v&&this.emit("error",v),this.emit("close"),k()}))}_setupData(v){if(!v.channel)return this.destroy(y(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=v.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=C),this.channelName=this._channel.label,this._channel.onmessage=T=>{this._onChannelMessage(T)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=T=>{const N=T.error instanceof Error?T.error:new Error(`Datachannel error: ${T.message} ${T.filename}:${T.lineno}:${T.colno}`);this.destroy(y(N,"ERR_DATA_CHANNEL"))};let k=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(k&&this._onChannelClose(),k=!0):k=!1},5e3)}_read(){}_write(v,k,T){if(this.destroyed)return T(y(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(v)}catch(N){return this.destroy(y(N,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>C?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=T):T(null)}else this._debug("write before connect"),this._chunk=v,this._cb=T}_onFinish(){if(!this.destroyed){const v=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?v():this.once("connect",v)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(v=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(v.sdp=a(v.sdp)),v.sdp=this.sdpTransform(v.sdp);const k=()=>{if(!this.destroyed){const T=this._pc.localDescription||v;this._debug("signal"),this.emit("signal",{type:T.type,sdp:T.sdp})}};this._pc.setLocalDescription(v).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?k():this.once("_iceComplete",k))}).catch(T=>{this.destroy(y(T,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(v=>{this.destroy(y(v,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(v=>{v.mid||!v.sender.track||v.requested||(v.requested=!0,this.addTransceiver(v.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(v=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(v.sdp=a(v.sdp)),v.sdp=this.sdpTransform(v.sdp);const k=()=>{if(!this.destroyed){const T=this._pc.localDescription||v;this._debug("signal"),this.emit("signal",{type:T.type,sdp:T.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(v).then(()=>{this.destroyed||(this.trickle||this._iceComplete?k():this.once("_iceComplete",k))}).catch(T=>{this.destroy(y(T,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(v=>{this.destroy(y(v,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(y(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const v=this._pc.iceConnectionState,k=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",v,k),this.emit("iceStateChange",v,k),(v==="connected"||v==="completed")&&(this._pcReady=!0,this._maybeReady()),v==="failed"&&this.destroy(y(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),v==="closed"&&this.destroy(y(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(v){const k=T=>(Object.prototype.toString.call(T.values)==="[object Array]"&&T.values.forEach(N=>{Object.assign(T,N)}),T);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(T=>{const N=[];T.forEach(h=>{N.push(k(h))}),v(null,N)},T=>v(T)):0<this._pc.getStats.length?this._pc.getStats(T=>{if(this.destroyed)return;const N=[];T.result().forEach(h=>{const I={};h.names().forEach(O=>{I[O]=h.stat(O)}),I.id=h.id,I.type=h.type,I.timestamp=h.timestamp,N.push(k(I))}),v(null,N)},T=>v(T)):v(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const v=()=>{this.destroyed||this.getStats((k,T)=>{if(this.destroyed)return;k&&(T=[]);const N={},h={},I={};let O=!1;T.forEach(P=>{(P.type==="remotecandidate"||P.type==="remote-candidate")&&(N[P.id]=P),(P.type==="localcandidate"||P.type==="local-candidate")&&(h[P.id]=P),(P.type==="candidatepair"||P.type==="candidate-pair")&&(I[P.id]=P)});const j=P=>{O=!0;let q=h[P.localCandidateId];q&&(q.ip||q.address)?(this.localAddress=q.ip||q.address,this.localPort=+q.port):q&&q.ipAddress?(this.localAddress=q.ipAddress,this.localPort=+q.portNumber):typeof P.googLocalAddress=="string"&&(q=P.googLocalAddress.split(":"),this.localAddress=q[0],this.localPort=+q[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let G=N[P.remoteCandidateId];G&&(G.ip||G.address)?(this.remoteAddress=G.ip||G.address,this.remotePort=+G.port):G&&G.ipAddress?(this.remoteAddress=G.ipAddress,this.remotePort=+G.portNumber):typeof P.googRemoteAddress=="string"&&(G=P.googRemoteAddress.split(":"),this.remoteAddress=G[0],this.remotePort=+G[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(T.forEach(P=>{P.type==="transport"&&P.selectedCandidatePairId&&j(I[P.selectedCandidatePairId]),(P.type==="googCandidatePair"&&P.googActiveConnection==="true"||(P.type==="candidatepair"||P.type==="candidate-pair")&&P.selected)&&j(P)}),!O&&(!Object.keys(I).length||Object.keys(h).length))return void setTimeout(v,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(q){return this.destroy(y(q,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const P=this._cb;this._cb=null,P(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};v()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>C)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(v=>{this._pc.removeTrack(v),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(v){this.destroyed||(v.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:v.candidate.candidate,sdpMLineIndex:v.candidate.sdpMLineIndex,sdpMid:v.candidate.sdpMid}}):!v.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),v.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(v){if(this.destroyed)return;let k=v.data;k instanceof ArrayBuffer&&(k=b.from(k)),this.push(k)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const v=this._cb;this._cb=null,v(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(v){this.destroyed||v.streams.forEach(k=>{this._debug("on track"),this.emit("track",v.track,k),this._remoteTracks.push({track:v.track,stream:k}),this._remoteStreams.some(T=>T.id===k.id)||(this._remoteStreams.push(k),m(()=>{this._debug("on stream"),this.emit("stream",k)}))})}_debug(){const v=[].slice.call(arguments);v[0]="["+this._id+"] "+v[0],u.apply(null,v)}}S.WEBRTC_SUPPORT=!!g(),S.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},S.channelConfig={},o.exports=S},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})})(cm);var px=cm.exports;const mx=Gi(px),rd=0,wl=1,um=2,Ro=(n,e)=>{je(n,rd);const t=pw(e);St(n,t)},id=(n,e,t)=>{je(n,wl),St(n,dw(e,t))},yx=(n,e,t)=>id(e,t,Gt(n)),dm=(n,e,t)=>{try{lw(e,Gt(n),t)}catch(r){console.error("Caught error while handling a Yjs update",r)}},fm=(n,e)=>{je(n,um),St(n,e)},_x=dm,hm=(n,e,t,r)=>{const i=Ve(n);switch(i){case rd:yx(n,e,t);break;case wl:dm(n,t,r);break;case um:_x(n,t,r);break;default:throw new Error("Unknown message type")}return i},sd=3e4;class gm extends cu{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=jn();this.getLocalState()!==null&&sd/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&sd<=t-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Lo(this,r,"timeout")},pr(sd/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,r=this.meta.get(t),i=r===void 0?0:r.clock+1,s=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:jn()});const o=[],a=[],l=[],u=[];e===null?u.push(t):s==null?e!=null&&o.push(t):(a.push(t),wo(s,e)||l.push(t)),(o.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:o,updated:l,removed:u},"local"]),this.emit("update",[{added:o,updated:a,removed:u},"local"])}setLocalStateField(e,t){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:t})}getStates(){return this.states}}const Lo=(n,e,t)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(n.states.has(s)){if(n.states.delete(s),s===n.clientID){const o=n.meta.get(s);n.meta.set(s,{clock:o.clock+1,lastUpdated:jn()})}r.push(s)}}r.length>0&&(n.emit("change",[{added:[],updated:[],removed:r},t]),n.emit("update",[{added:[],updated:[],removed:r},t]))},Ur=(n,e,t=n.states)=>{const r=e.length,i=bt();je(i,r);for(let s=0;s<r;s++){const o=e[s],a=t.get(o)||null,l=n.meta.get(o).clock;je(i,o),je(i,l),mr(i,JSON.stringify(a))}return at(i)},pm=(n,e,t)=>{const r=sr(e),i=jn(),s=[],o=[],a=[],l=[],u=Ve(r);for(let g=0;g<u;g++){const d=Ve(r);let f=Ve(r);const m=JSON.parse(br(r)),y=n.meta.get(d),b=n.states.get(d),C=y===void 0?0:y.clock;(C<f||C===f&&m===null&&n.states.has(d))&&(m===null?d===n.clientID&&n.getLocalState()!=null?f++:n.states.delete(d):n.states.set(d,m),n.meta.set(d,{clock:f,lastUpdated:i}),y===void 0&&m!==null?s.push(d):y!==void 0&&m===null?l.push(d):m!==null&&(wo(m,b)||a.push(d),o.push(d)))}(s.length>0||a.length>0||l.length>0)&&n.emit("change",[{added:s,updated:a,removed:l},t]),(s.length>0||o.length>0||l.length>0)&&n.emit("update",[{added:s,updated:o,removed:l},t])},bx=(n,e)=>{const t=hu(n).buffer,r=hu(e).buffer;return crypto.subtle.importKey("raw",t,"PBKDF2",!1,["deriveKey"]).then(i=>crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]))},mm=(n,e)=>{if(!e)return xu(n);const t=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:t},e,n).then(r=>{const i=bt();return mr(i,"AES-GCM"),St(i,t),St(i,new Uint8Array(r)),at(i)})},wx=(n,e)=>{const t=bt();return ds(t,n),mm(at(t),e)},ym=(n,e)=>{if(!e)return xu(n);const t=sr(n);br(t)!=="AES-GCM"&&vb(yr("Unknown encryption algorithm"));const i=Gt(t),s=Gt(t);return crypto.subtle.decrypt({name:"AES-GCM",iv:i},e,s).then(o=>new Uint8Array(o))},vx=(n,e)=>ym(n,e).then(t=>fs(sr(new Uint8Array(t)))),Fn=Jb("y-webrtc"),Es=0,_m=3,Oo=1,od=4,vl=new Map,Ui=new Map,bm=n=>{let e=!0;n.webrtcConns.forEach(t=>{t.synced||(e=!1)}),(!e&&n.synced||e&&!n.synced)&&(n.synced=e,n.provider.emit("synced",[{synced:e}]),Fn("synced ",Yn,n.name,Ri," with all peers"))},wm=(n,e,t)=>{const r=sr(e),i=bt(),s=Ve(r);if(n===void 0)return null;const o=n.awareness,a=n.doc;let l=!1;switch(s){case Es:{je(i,Es);const u=hm(r,i,a,n);u===wl&&!n.synced&&t(),u===rd&&(l=!0);break}case _m:je(i,Oo),St(i,Ur(o,Array.from(o.getStates().keys()))),l=!0;break;case Oo:pm(o,Gt(r),n);break;case od:{const u=Ii(r)===1,g=br(r);if(g!==n.peerId&&(n.bcConns.has(g)&&!u||!n.bcConns.has(g)&&u)){const d=[],f=[];u?(n.bcConns.add(g),f.push(g)):(n.bcConns.delete(g),d.push(g)),n.provider.emit("peers",[{added:f,removed:d,webrtcPeers:Array.from(n.webrtcConns.keys()),bcPeers:Array.from(n.bcConns)}]),Cm(n)}break}default:return console.error("Unable to compute message"),i}return l?i:null},xx=(n,e)=>{const t=n.room;return Fn("received message from ",Yn,n.remotePeerId,Eu," (",t.name,")",Ri,Ja),wm(t,e,()=>{n.synced=!0,Fn("synced ",Yn,t.name,Ri," with ",Yn,n.remotePeerId),bm(t)})},ad=(n,e)=>{Fn("send message to ",Yn,n.remotePeerId,Ri,Eu," (",n.room.name,")",Ja);try{n.peer.send(at(e))}catch{}},Cx=(n,e)=>{Fn("broadcast message in ",Yn,n.name,Ri),n.webrtcConns.forEach(t=>{try{t.peer.send(e)}catch{}})};class vm{constructor(e,t,r,i){Fn("establishing connection to ",Yn,r),this.room=i,this.remotePeerId=r,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new mx({initiator:t,...i.provider.peerOpts}),this.peer.on("signal",s=>{this.glareToken===void 0&&(this.glareToken=Date.now()+Math.random()),cd(e,i,{to:r,from:i.peerId,type:"signal",token:this.glareToken,signal:s})}),this.peer.on("connect",()=>{Fn("connected to ",Yn,r),this.connected=!0;const o=i.provider.doc,a=i.awareness,l=bt();je(l,Es),Ro(l,o),ad(this,l);const u=a.getStates();if(u.size>0){const g=bt();je(g,Oo),St(g,Ur(a,Array.from(u.keys()))),ad(this,g)}}),this.peer.on("close",()=>{this.connected=!1,this.closed=!0,i.webrtcConns.has(this.remotePeerId)&&(i.webrtcConns.delete(this.remotePeerId),i.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(i.webrtcConns.keys()),bcPeers:Array.from(i.bcConns)}])),bm(i),this.peer.destroy(),Fn("closed connection to ",Yn,r),ld(i)}),this.peer.on("error",s=>{Fn("Error in connection to ",Yn,r,": ",s),ld(i)}),this.peer.on("data",s=>{const o=xx(this,s);o!==null&&ad(this,o)})}destroy(){this.peer.destroy()}}const ci=(n,e)=>mm(e,n.key).then(t=>n.mux(()=>Bi(n.name,t))),xm=(n,e)=>{n.bcconnected&&ci(n,e),Cx(n,e)},ld=n=>{vl.forEach(e=>{e.connected&&(e.send({type:"subscribe",topics:[n.name]}),n.webrtcConns.size<n.provider.maxConns&&cd(e,n,{type:"announce",from:n.peerId}))})},Cm=n=>{if(n.provider.filterBcConns){const e=bt();je(e,od),bo(e,1),mr(e,n.peerId),ci(n,at(e))}};class Sx{constructor(e,t,r,i){this.peerId=rg(),this.doc=e,this.awareness=t.awareness,this.provider=t,this.synced=!1,this.name=r,this.key=i,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=gx(),this.bcconnected=!1,this._bcSubscriber=s=>ym(new Uint8Array(s),i).then(o=>this.mux(()=>{const a=wm(this,o,()=>{});a&&ci(this,at(a))})),this._docUpdateHandler=(s,o)=>{const a=bt();je(a,Es),fm(a,s),xm(this,at(a))},this._awarenessUpdateHandler=({added:s,updated:o,removed:a},l)=>{const u=s.concat(o).concat(a),g=bt();je(g,Oo),St(g,Ur(this.awareness,u)),xm(this,at(g))},this._beforeUnloadHandler=()=>{Lo(this.awareness,[e.clientID],"window unload"),Ui.forEach(s=>{s.disconnect()})},typeof window<"u"?window.addEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.on("exit",this._beforeUnloadHandler)}connect(){this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),ld(this);const e=this.name;am(e,this._bcSubscriber),this.bcconnected=!0,Cm(this);const t=bt();je(t,Es),Ro(t,this.doc),ci(this,at(t));const r=bt();je(r,Es),id(r,this.doc),ci(this,at(r));const i=bt();je(i,_m),ci(this,at(i));const s=bt();je(s,Oo),St(s,Ur(this.awareness,[this.doc.clientID])),ci(this,at(s))}disconnect(){vl.forEach(t=>{t.connected&&t.send({type:"unsubscribe",topics:[this.name]})}),Lo(this.awareness,[this.doc.clientID],"disconnect");const e=bt();je(e,od),bo(e,0),mr(e,this.peerId),ci(this,at(e)),lm(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach(t=>t.destroy())}destroy(){this.disconnect(),typeof window<"u"?window.removeEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.off("exit",this._beforeUnloadHandler)}}const Tx=(n,e,t,r)=>{if(Ui.has(t))throw yr(`A Yjs Doc connected to room "${t}" already exists!`);const i=new Sx(n,e,t,r);return Ui.set(t,i),i},cd=(n,e,t)=>{e.key?wx(t,e.key).then(r=>{n.send({type:"publish",topic:e.name,data:mg(r)})}):n.send({type:"publish",topic:e.name,data:t})};class Ex extends dx{constructor(e){super(e),this.providers=new Set,this.on("connect",()=>{Fn(`connected (${e})`);const t=Array.from(Ui.keys());this.send({type:"subscribe",topics:t}),Ui.forEach(r=>cd(this,r,{type:"announce",from:r.peerId}))}),this.on("message",t=>{switch(t.type){case"publish":{const r=t.topic,i=Ui.get(r);if(i==null||typeof r!="string")return;const s=o=>{const a=i.webrtcConns,l=i.peerId;if(o==null||o.from===l||o.to!==void 0&&o.to!==l||i.bcConns.has(o.from))return;const u=a.has(o.from)?()=>{}:()=>i.provider.emit("peers",[{removed:[],added:[o.from],webrtcPeers:Array.from(i.webrtcConns.keys()),bcPeers:Array.from(i.bcConns)}]);switch(o.type){case"announce":a.size<i.provider.maxConns&&(Ln(a,o.from,()=>new vm(this,!0,o.from,i)),u());break;case"signal":if(o.signal.type==="offer"){const g=a.get(o.from);if(g){const d=o.token,f=g.glareToken;if(f&&f>d){Fn("offer rejected: ",o.from);return}g.glareToken=void 0}}if(o.signal.type==="answer"){Fn("offer answered by: ",o.from);const g=a.get(o.from);g.glareToken=void 0}o.to===l&&(Ln(a,o.from,()=>new vm(this,!1,o.from,i)).peer.signal(o.signal),u());break}};i.key?typeof t.data=="string"&&vx(yg(t.data),i.key).then(s):s(t.data)}}}),this.on("disconnect",()=>Fn(`disconnect (${e})`))}}const ud=n=>{n.emit("status",[{connected:n.connected}])};class kx extends lu{constructor(e,t,{signaling:r=["wss://y-webrtc-eu.fly.dev"],password:i=null,awareness:s=new gm(t),maxConns:o=20+pr(bb()*15),filterBcConns:a=!0,peerOpts:l={}}={}){super(),this.roomName=e,this.doc=t,this.filterBcConns=a,this.awareness=s,this.shouldConnect=!1,this.signalingUrls=r,this.signalingConns=[],this.maxConns=o,this.peerOpts=l,this.key=i?bx(i,e):xu(null),this.room=null,this.key.then(u=>{this.room=Tx(t,this,e,u),this.shouldConnect?this.room.connect():this.room.disconnect(),ud(this)}),this.connect(),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}get connected(){return this.room!==null&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach(e=>{const t=Ln(vl,e,()=>new Ex(e));this.signalingConns.push(t),t.providers.add(this)}),this.room&&(this.room.connect(),ud(this))}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach(e=>{e.providers.delete(this),e.providers.size===0&&(e.destroy(),vl.delete(e.url))}),this.room&&(this.room.disconnect(),ud(this))}destroy(){this.doc.off("destroy",this.destroy),this.key.then(()=>{this.room.destroy(),Ui.delete(this.roomName)}),super.destroy()}}const Nx=0,Mx=(n,e,t)=>{switch(Ve(n)){case Nx:t(e,br(n))}},Dx=n=>kb(n,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"),Hi=0,Sm=3,ks=1,Ax=2,jo=[];jo[Hi]=(n,e,t,r,i)=>{je(n,Hi);const s=hm(e,n,t.doc,t);r&&s===wl&&!t.synced&&(t.synced=!0)},jo[Sm]=(n,e,t,r,i)=>{je(n,ks),St(n,Ur(t.awareness,Array.from(t.awareness.getStates().keys())))},jo[ks]=(n,e,t,r,i)=>{pm(t.awareness,Gt(e),t)},jo[Ax]=(n,e,t,r,i)=>{Mx(e,t.doc,(s,o)=>Ix(t,o))};const Tm=3e4,Ix=(n,e)=>console.warn(`Permission denied to access ${n.url}.
41
+ `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&Wu(r,this,i,a,o.attributes||{})}else o.retain!==void 0?yp(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&bp(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??fn();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function u(){if(a.length>0){const d={};let f=!1;s.forEach((y,b)=>{f=!0,d[b]=y});const m={insert:a};f&&(m.attributes=d),i.push(m),a=""}}const g=()=>{for(;l!==null;){if(bs(l,e)||t!==void 0&&bs(l,t))switch(l.content.constructor){case xr:{const d=s.get("ychange");e!==void 0&&!bs(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(u(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):t!==void 0&&!bs(l,t)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(u(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(u(),s.delete("ychange")),a+=l.content.str;break}case Cr:case Pi:{u();const d={insert:l.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((m,y)=>{f[y]=m})}i.push(d);break}case Xt:bs(l,e)&&(u(),xs(s,l.content));break}l=l.right}u()};return e||t?Tt(o,d=>{e&&Lu(d,e),t&&Lu(d,t),g()},"cleanup"):g(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?Tt(i,s=>{const o=cl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),Wu(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?Tt(i,s=>{const o=cl(s,this,e,!r);Wu(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?Tt(r,i=>{bp(i,cl(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?Tt(i,s=>{const o=cl(s,this,e,!1);o.right!==null&&yp(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?Tt(this.doc,t=>{al(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?Tt(this.doc,r=>{Bu(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Uu(this,e)}getAttributes(){return up(this)}_write(e){e.writeTypeRef(dv)}}const qw=n=>new Cs;class $u{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??fn()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===ai||t.constructor===Oi)&&t._start!==null)e=t._start;else for(;e!==null;)if(e.right!==null){e=e.right;break}else e.parent===this._root?e=null:e=e.parent._item;while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Oi extends sn{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Oi}clone(){const e=new Oi;return e.insert(0,this.toArray().map(t=>t instanceof sn?t.clone():t)),e}get length(){return this.doc??fn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new $u(this,e)}querySelector(e){e=e.toUpperCase();const r=new $u(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),jr(new $u(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){sl(this,e,new vp(this,t,e))}toString(){return sp(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Eo(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?Tt(this.doc,r=>{lp(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)Tt(this.doc,r=>{const i=e&&e instanceof sn?e._item:e;ol(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw yr("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?Tt(this.doc,r=>{cp(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return ip(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return op(this,e)}slice(e=0,t=this.length){return rp(this,e,t)}forEach(e){Eo(this,e)}_write(e){e.writeTypeRef(hv)}}const Kw=n=>new Oi;class ai extends Oi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new ai(this.nodeName)}clone(){const e=new ai(this.nodeName),t=this.getAttributes();return Eb(t,(r,i)=>{typeof r=="string"&&e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof sn?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];t.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Tt(this.doc,t=>{al(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?Tt(this.doc,r=>{Bu(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Uu(this,e)}hasAttribute(e){return dp(this,e)}getAttributes(e){return e?Bw(this,e):up(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Eo(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(fv),e.writeKey(this.nodeName)}}const Gw=n=>new ai(n.readKey());class vp extends rl{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class ul extends Pn{constructor(e){super(),this.hookName=e}_copy(){return new ul(this.hookName)}clone(){const e=new ul(this.hookName);return this.forEach((t,r)=>{e.set(r,t)}),e}toDOM(e=document,t={},r){const i=t[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(gv),e.writeKey(this.hookName)}}const Xw=n=>new ul(n.readKey());class ji extends Cs{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new ji}clone(){const e=new ji;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),t.push({nodeName:i,attrs:s})}t.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const s=t[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(pv)}}const Jw=n=>new ji;class Yu{constructor(e,t){this.id=e,this.length=t}get deleted(){throw _r()}mergeWith(e){return!1}write(e,t,r){throw _r()}integrate(e,t){throw _r()}}const Zw=0;class Vn extends Yu{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),$g(e.doc.store,this)}write(e,t){e.writeInfo(Zw),e.writeLen(this.length-t)}getMissing(e,t){return null}}class ko{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ko(this.content)}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}const Qw=n=>new ko(n.readBuf());class No{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new No(this.len)}splice(e){const t=new No(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Co(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const ev=n=>new No(n.readLen()),xp=(n,e)=>new Br({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Mo{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Mo(xp(this.doc.guid,this.opts))}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const tv=n=>new Mo(xp(n.readString(),n.readAny()));class Pi{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Pi(this.embed)}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}const nv=n=>new Pi(n.readJSON());class Xt{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Xt(this.key,this.value)}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const rv=n=>new Xt(n.readKey(),n.readJSON());class dl{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new dl(this.arr)}splice(e){const t=new dl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const iv=n=>{const e=n.readLen(),t=[];for(let r=0;r<e;r++){const i=n.readString();i==="undefined"?t.push(void 0):t.push(JSON.parse(i))}return new dl(t)},sv=vo("node_env")==="development";class Fi{constructor(e){this.arr=e,sv&&fg(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Fi(this.arr)}splice(e){const t=new Fi(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const ov=n=>{const e=n.readLen(),t=[];for(let r=0;r<e;r++)t.push(n.readAny());return new Fi(t)};class xr{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new xr(this.str)}splice(e){const t=new xr(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const av=n=>new xr(n.readString()),lv=[Hw,Ww,qw,Gw,Kw,Xw,Jw],cv=0,uv=1,dv=2,fv=3,hv=4,gv=5,pv=6;class Cr{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Cr(this.type._copy())}splice(e){throw _r()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const mv=n=>new Cr(lv[n.readTypeRef()](n)),Vu=(n,e)=>{let t=e,r=0,i;do r>0&&(t=Xe(t.client,t.clock+r)),i=ws(n,t),r=t.clock-i.id.clock,t=i.redone;while(t!==null&&i instanceof Et);return{item:i,diff:r}},qu=(n,e)=>{for(;n!==null&&n.keep!==e;)n.keep=e,n=n.parent._item},fl=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Et(Xe(r,i+t),e,Xe(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=Xe(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s},Cp=(n,e)=>K0(n,t=>xo(t.deletions,e)),Sp=(n,e,t,r,i,s)=>{const o=n.doc,a=o.store,l=o.clientID,u=e.redone;if(u!==null)return En(n,u);let g=e.parent._item,d=null,f;if(g!==null&&g.deleted===!0){if(g.redone===null&&(!t.has(g)||Sp(n,g,t,r,i,s)===null))return null;for(;g.redone!==null;)g=En(n,g.redone)}const m=g===null?e.parent:g.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let S=d;for(;S!==null&&S.parent._item!==g;)S=S.redone===null?null:En(n,S.redone);if(S!==null&&S.parent._item===g){d=S;break}d=d.left}for(;f!==null;){let S=f;for(;S!==null&&S.parent._item!==g;)S=S.redone===null?null:En(n,S.redone);if(S!==null&&S.parent._item===g){f=S;break}f=f.right}}else if(f=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||xo(r,d.right.id)||Cp(s.undoStack,d.right.id)||Cp(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=En(n,d.redone);if(d&&d.right!==null)return null}else d=m._map.get(e.parentSub)||null;const y=Ht(a,l),b=Xe(l,y),C=new Et(b,d,d&&d.lastId,f,f&&f.id,m,e.parentSub,e.content.copy());return e.redone=b,qu(C,!0),C.integrate(n,0),C};class Et extends Yu{constructor(e,t,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?Vh:0}set marker(e){(this.info&du)>0!==e&&(this.info^=du)}get marker(){return(this.info&du)>0}get keep(){return(this.info&Yh)>0}set keep(e){this.keep!==e&&(this.info^=Yh)}get countable(){return(this.info&Vh)>0}get deleted(){return(this.info&uu)>0}set deleted(e){this.deleted!==e&&(this.info^=uu)}markDeleted(){this.info|=uu}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Ht(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Ht(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===ys&&this.id.client!==this.parent.client&&this.parent.clock>=Ht(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Yg(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=En(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Vn||this.right&&this.right.constructor===Vn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Et&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===Et&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===ys){const r=ws(t,this.parent);r.constructor===Vn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Yg(e,e.doc.store,Xe(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),_s(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(_s(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(ws(e.doc.store,i.origin)))s.has(ws(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),$g(e.doc.store,this),this.content.integrate(e,this),Kg(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Vn(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Xe(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&_s(e.origin,this.lastId)&&this.right===e&&_s(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Co(e.deleteSet,this.id.client,this.id.clock,this.length),Kg(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw ir();this.content.gc(e),t?Cw(e,this,new Vn(this.id,this.length)):this.content=new No(this.length)}write(e,t){const r=t>0?Xe(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Ya|(r===null?0:On)|(i===null?0:Pr)|(s===null?0:po);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=Hg(a);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===ys?(e.writeParentInfo(!1),e.writeLeftID(a)):ir();s!==null&&e.writeString(s)}this.content.write(e,t)}}const Tp=(n,e)=>yv[e&Ya](n),yv=[()=>{ir()},ev,iv,Qw,av,nv,rv,mv,ov,tv,()=>{ir()}],_v=10;class qn extends Yu{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){ir()}write(e,t){e.writeInfo(_v),je(e.restEncoder,this.length-t)}getMissing(e,t){return null}}const Ep=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},kp="__ $YJS$ __";Ep[kp]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Ep[kp]=!0;function bv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var wv=bv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Ku(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e===null?tt(r):e.get(r);i==null&&wv(174),t.push(r),r=i.__next}return t}function vv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xv=vv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const hl=new Map;function Np(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function Mp(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function Cv(n,e,t,r,i){const s=e.getKey(),o=r.getKey(),a=document.createRange();let l=n.getElementByKey(s),u=n.getElementByKey(o),g=t,d=i;if(me(e)&&(l=Np(l)),me(r)&&(u=Np(u)),e===void 0||r===void 0||l===null||u===null)return null;l.nodeName==="BR"&&([l,g]=Mp(l)),u.nodeName==="BR"&&([u,d]=Mp(u));const f=l.firstChild;l===u&&f!=null&&f.nodeName==="BR"&&g===0&&d===0&&(d=1);try{a.setStart(l,g),a.setEnd(u,d)}catch{return null}return!a.collapsed||g===d&&s===o||(a.setStart(u,d),a.setEnd(l,g)),a}function Sv(n,e){const t=n.getRootElement();if(t===null)return[];const r=t.getBoundingClientRect(),i=getComputedStyle(t),s=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),o=Array.from(e.getClientRects());let a,l=o.length;o.sort((u,g)=>{const d=u.top-g.top;return Math.abs(d)<=3?u.left-g.left:d});for(let u=0;u<l;u++){const g=o[u],d=a&&a.top<=g.top&&a.top+a.height>g.top&&a.left+a.width>g.left,f=g.width+s===r.width;d||f?(o.splice(u--,1),l--):a=g}return o}function Dp(n){const e={},t=n.split(";");for(const r of t)if(r!==""){const[i,s]=r.split(/:([^]+)/);i&&s&&(e[i.trim()]=s.trim())}return e}function Tv(n){let e=hl.get(n);return e===void 0&&(e=Dp(n),hl.set(n,e)),e}function Ap(n){const e=n.constructor.clone(n);return e.__parent=n.__parent,e.__next=n.__next,e.__prev=n.__prev,ie(n)&&ie(e)?(r=n,(t=e).__first=r.__first,t.__last=r.__last,t.__size=r.__size,t.__format=r.__format,t.__indent=r.__indent,t.__dir=r.__dir,t):me(n)&&me(e)?function(i,s){return i.__format=s.__format,i.__style=s.__style,i.__mode=s.__mode,i.__detail=s.__detail,i}(e,n):us(n)&&us(e)?function(i,s){return i.__textFormat=s.__textFormat,i}(e,n):e;var t,r}function Ip(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[r,i]=t,s=n.isBackward(),o=r.getNode(),a=i.getNode(),l=e.is(o),u=e.is(a);if(l||u){const[g,d]=Xc(n),f=o.is(a),m=e.is(s?a:o),y=e.is(s?o:a);let b,C=0;return f?(C=g>d?d:g,b=g>d?g:d):m?(C=s?d:g,b=void 0):y&&(C=0,b=s?g:d),e.__text=e.__text.slice(C,b),e}}return e}function Ev(n){const e=n.getStyle(),t=Dp(e);hl.set(e,t)}function Ss(n,e){const t=Tv("getStyle"in n?n.getStyle():n.style),r=Object.entries(e).reduce((s,[o,a])=>(a instanceof Function?s[o]=a(t[o]):a===null?delete s[o]:s[o]=a,s),{...t}),i=function(s){let o="";for(const a in s)a&&(o+=`${a}: ${s[a]};`);return o}(r);n.setStyle(i),hl.set(i,r)}function kv(n,e){const t=n.getNodes(),r=t.length,i=n.getStartEndPoints();if(i===null)return;const[s,o]=i,a=r-1;let l=t[0],u=t[a];if(n.isCollapsed()&&de(n))return void Ss(n,e);const g=l.getTextContent().length,d=o.offset;let f=s.offset;const m=s.isBefore(o);let y=m?f:d,b=m?d:f;const C=m?s.type:o.type,S=m?o.type:s.type,A=m?o.key:s.key;if(me(l)&&y===g){const v=l.getNextSibling();me(v)&&(f=0,y=0,l=v)}if(t.length===1){if(me(l)&&l.canHaveFormat()){if(y=C==="element"?0:f>d?d:f,b=S==="element"?g:f>d?f:d,y===b)return;if(y===0&&b===g)Ss(l,e),l.select(y,b);else{const v=l.splitText(y,b),k=y===0?v[0]:v[1];Ss(k,e),k.select(0,b-y)}}}else{if(me(l)&&y<l.getTextContentSize()&&l.canHaveFormat()&&(y!==0&&(l=l.splitText(y)[1],y=0,m?s.set(l.getKey(),y,"text"):o.set(l.getKey(),y,"text")),Ss(l,e)),me(u)&&u.canHaveFormat()){const v=u.getTextContent().length;u.__key!==A&&b!==0&&(b=v),b!==v&&([u]=u.splitText(b)),b===0&&S!=="element"||Ss(u,e)}for(let v=1;v<a;v++){const k=t[v],T=k.getKey();me(k)&&k.canHaveFormat()&&T!==l.getKey()&&T!==u.getKey()&&!k.isToken()&&Ss(k,e)}}}function Rp(n){return n.getNode().isAttached()}function Nv(n){let e=n;for(;e!==null&&!un(e);){const t=e.getLatest(),r=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=r}}function Mv(n,e,t=null){const r=n.getStartEndPoints(),i=r?r[0]:null,s=n.getNodes(),o=s.length;if(i!==null&&(o===0||o===1&&i.type==="element"&&i.getNode().getChildrenSize()===0)){const u=i.type==="text"?i.getNode().getParentOrThrow():i.getNode(),g=u.getChildren();let d=e();return d.setFormat(u.getFormatType()),d.setIndent(u.getIndent()),g.forEach(f=>d.append(f)),t&&(d=t.append(d)),void u.replace(d)}let a=null,l=[];for(let u=0;u<o;u++){const g=s[u];un(g)?(Gu(n,l,l.length,e,t),l=[],a=g):a===null||a!==null&&Ca(g,a)?l.push(g):(Gu(n,l,l.length,e,t),l=[g])}Gu(n,l,l.length,e,t)}function Gu(n,e,t,r,i=null){if(e.length===0)return;const s=e[0],o=new Map,a=[];let l=ie(s)?s:s.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let u=!1;for(;l!==null;){const y=l.getPreviousSibling();if(y!==null){l=y,u=!0;break}if(l=l.getParentOrThrow(),un(l))break}const g=new Set;for(let y=0;y<t;y++){const b=e[y];ie(b)&&b.getChildrenSize()===0&&g.add(b.getKey())}const d=new Set;for(let y=0;y<t;y++){const b=e[y];let C=b.getParent();if(C!==null&&C.isInline()&&(C=C.getParent()),C!==null&&m0(b)&&!d.has(b.getKey())){const S=C.getKey();if(o.get(S)===void 0){const A=r();A.setFormat(C.getFormatType()),A.setIndent(C.getIndent()),a.push(A),o.set(S,A),C.getChildren().forEach(v=>{A.append(v),d.add(v.getKey()),ie(v)&&v.getChildrenKeys().forEach(k=>d.add(k))}),Nv(C)}}else if(g.has(b.getKey())){ie(b)||xv(179);const S=r();S.setFormat(b.getFormatType()),S.setIndent(b.getIndent()),a.push(S),b.remove(!0)}}if(i!==null)for(let y=0;y<a.length;y++){const b=a[y];i.append(b)}let f=null;if(un(l))if(u)if(i!==null)l.insertAfter(i);else for(let y=a.length-1;y>=0;y--){const b=a[y];l.insertAfter(b)}else{const y=l.getFirstChild();if(ie(y)&&(l=y),y===null)if(i)l.append(i);else for(let b=0;b<a.length;b++){const C=a[b];l.append(C),f=C}else if(i!==null)y.insertBefore(i);else for(let b=0;b<a.length;b++){const C=a[b];y.insertBefore(C),f=C}}else if(i)l.insertAfter(i);else for(let y=a.length-1;y>=0;y--){const b=a[y];l.insertAfter(b),f=b}const m=ti();de(m)&&Rp(m.anchor)&&Rp(m.focus)?Nt(m.clone()):f!==null?f.selectEnd():n.dirty=!0}function Lp(n,e){const t=to(n.focus,e);return gt(t)&&!t.isIsolated()||ie(t)&&!t.isInline()&&!t.canBeEmpty()}function Dv(n,e,t,r){n.modify(e?"extend":"move",t,r)}function Av(n){const e=n.anchor.getNode();return(dn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Op(n,e,t){const r=Av(n);Dv(n,e,t?!r:r,"character")}function Iv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var on=Iv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});let Do=class{constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){const e=tt(this._key);return hr(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){e.collabNodeMap.delete(this._key)}};function jp(n,e){const t=new Do(n,e);return n._collabNode=t,t}let kn=class{constructor(e,t,r,i){this._key="",this._map=e,this._parent=r,this._text=t,this._type=i,this._normalized=!1}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return me(t)?t:null}getNode(){const e=tt(this._key);return me(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,r){const i=this._parent._xmlText,s=this.getOffset()+1+e;t!==0&&i.delete(s,t),r!==""&&i.insert(s,r)}syncPropertiesAndTextFromLexical(e,t,r){const i=this.getPrevNode(r),s=t.__text;if(Zu(e,this._map,i,t),i!==null){const o=i.__text;o!==s&&(function(a,l,u,g){const d=he();let f=g.length;if(de(d)&&d.isCollapsed()){const y=d.anchor;y.key===l&&(f=y.offset)}const m=function(y,b,C){const S=y.length,A=b.length;let v=0,k=0;for(;v<S&&v<A&&y[v]===b[v]&&v<C;)v++;for(;k+v<S&&k+v<A&&y[S-k-1]===b[A-k-1];)k++;for(;k+v<S&&k+v<A&&y[v]===b[v];)v++;return{index:v,insert:b.slice(v,A-k),remove:S-v-k}}(u,g,f);a.spliceText(m.index,m.remove,m.insert)}(this,t.__key,o,s),this._text=s)}}syncPropertiesAndTextFromYjs(e,t){const r=this.getNode();r===null&&on(84),Ju(e,this._map,r,t);const i=this._text;r.__text!==i&&(r.getWritable().__text=i)}destroy(e){e.collabNodeMap.delete(this._key)}};function Pp(n,e,t,r){const i=new kn(n,e,t,r);return n._collabNode=i,i}const Rv=new Set(["__key","__parent","__next","__prev"]),Lv=new Set(["__first","__last","__size"]),Ov=new Set(["__cachedText"]),jv=new Set(["__text"]);function Fp(n,e,t){if(Rv.has(n))return!0;if(me(e)){if(jv.has(n))return!0}else if(ie(e)&&(Lv.has(n)||dn(e)&&Ov.has(n)))return!0;const r=e.constructor,i=t.excludedProperties.get(r);return i!=null&&i.has(n)}function Ao(n){const e=tt(n);return e===null&&on(85),e}function zp(n,e,t){const r=e.__type;let i;if(ie(e))i=Qu(new ji,t,r),i.syncPropertiesFromLexical(n,e,null),i.syncChildrenFromLexical(n,e,null,null,null);else if(me(e))i=Pp(new Pn,e.__text,t,r),i.syncPropertiesAndTextFromLexical(n,e,null);else if(hr(e)){const s=new Pn;s.set("__type","linebreak"),i=jp(s,t)}else gt(e)?(i=$p(new ai,t,r),i.syncPropertiesFromLexical(n,e,null)):on(86);return i._key=e.__key,i}function Xu(n,e,t){const r=e._collabNode;if(r===void 0){const i=n.editor._nodes,s=function(l){const u=l instanceof Pn?l.get("__type"):l.getAttribute("__type");return u==null&&on(87),u}(e);i.get(s)===void 0&&on(88,s);const o=e.parent,a=t===void 0&&o!==null?Xu(n,o):t||null;if(a instanceof Ts||on(89),e instanceof ji)return Qu(e,a,s);if(e instanceof Pn)return s==="linebreak"?jp(e,a):Pp(e,"",a,s);if(e instanceof ai)return $p(e,a,s)}return r}function Pv(n,e,t){const r=e.getType(),i=n.editor._nodes.get(r);i===void 0&&on(88,r);const s=new i.klass;if(s.__parent=t,e._key=s.__key,e instanceof Ts){const o=e._xmlText;e.syncPropertiesFromYjs(n,null),e.applyChildrenYjsDelta(n,o.toDelta()),e.syncChildrenFromYjs(n)}else e instanceof kn?e.syncPropertiesAndTextFromYjs(n,null):e instanceof li&&e.syncPropertiesFromYjs(n,null);return n.collabNodeMap.set(s.__key,e),s}function Ju(n,e,t,r){const i=r===null?e instanceof Pn?Array.from(e.keys()):Object.keys(e.getAttributes()):Array.from(r);let s;for(let o=0;o<i.length;o++){const a=i[o];if(Fp(a,t,n))continue;const l=t[a];let u=e instanceof Pn?e.get(a):e.getAttribute(a);if(l!==u){if(u instanceof Br){const g=n.docMap;l instanceof Br&&g.delete(l.guid);const d=Ha(),f=u.guid;d._key=f,g.set(f,u),u=d}s===void 0&&(s=t.getWritable()),s[a]=u}}}function Zu(n,e,t,r){const i=r.__type,s=n.nodeProperties;let o=s.get(i);o===void 0&&(o=Object.keys(r).filter(l=>!Fp(l,r,n)),s.set(i,o));const a=n.editor.constructor;for(let l=0;l<o.length;l++){const u=o[l],g=t===null?void 0:t[u];let d=r[u];if(g!==d){if(d instanceof a){const f=n.docMap;let m;if(g instanceof a){const C=g._key;m=f.get(C),f.delete(C)}const y=m||new Br,b=y.guid;d._key=b,f.set(b,y),d=y,n.editor.update(()=>{r.markDirty()})}e instanceof Pn?e.set(u,d):e.setAttribute(u,d)}}}function Bp(n,e,t,r){return n.slice(0,e)+r+n.slice(e+t)}function gl(n,e,t){let r=0,i=0;const s=n._children,o=s.length;for(;i<o;i++){const a=s[i],l=r;if(r+=a.getSize(),(t?r>=e:r>e)&&a instanceof kn){let u=e-l-1;return u<0&&(u=0),{length:r-e,node:a,nodeIndex:i,offset:u}}if(r>e)return{length:0,node:a,nodeIndex:i,offset:l};if(i===o-1)return{length:0,node:null,nodeIndex:i+1,offset:l+1}}return{length:0,node:null,nodeIndex:0,offset:0}}function Up(n){const e=n.anchor,t=n.focus;let r=!1;try{const i=e.getNode(),s=t.getNode();(!i.isAttached()||!s.isAttached()||me(i)&&e.offset>i.getTextContentSize()||me(s)&&t.offset>s.getTextContentSize())&&(r=!0)}catch{r=!0}return r}function Hp(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling();if(i===null)if(s!==null){const o=s.getWritable();r.__first=s.__key,o.__prev=null}else r.__first=null;else{const o=i.getWritable();if(s!==null){const a=s.getWritable();a.__prev=o.__key,o.__next=a.__key}else o.__next=null;t.__prev=null}if(s===null)if(i!==null){const o=i.getWritable();r.__last=i.__key,o.__next=null}else r.__last=null;else{const o=s.getWritable();if(i!==null){const a=i.getWritable();a.__next=o.__key,o.__prev=a.__key}else o.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function Wp(n,e){const t=e._nodeMap.get(n);if(!t)return void dt().selectStart();const r=t.__prev;let i=null;r&&(i=tt(r)),i===null&&t.__parent!==null&&(i=tt(t.__parent)),i!==null?i!==null&&i.isAttached()?i.selectEnd():Wp(i.__key,e):dt().selectStart()}class li{constructor(e,t,r){this._key="",this._xmlElem=e,this._parent=t,this._type=r}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return gt(t)?t:null}getNode(){const e=tt(this._key);return gt(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,r){const i=this.getPrevNode(r);Zu(e,this._xmlElem,i,t)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&on(83),Ju(e,this._xmlElem,r,t)}destroy(e){e.collabNodeMap.delete(this._key)}}function $p(n,e,t){const r=new li(n,e,t);return n._collabNode=r,r}let Ts=class Ws{constructor(e,t,r){this._key="",this._children=[],this._xmlText=e,this._type=r,this._parent=t}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return ie(t)?t:null}getNode(){const e=tt(this._key);return ie(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&on(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&on(91),Ju(e,this._xmlText,r,t)}applyChildrenYjsDelta(e,t){const r=this._children;let i=0;for(let s=0;s<t.length;s++){const o=t[s],a=o.insert,l=o.delete;if(o.retain!=null)i+=o.retain;else if(typeof l=="number"){let u=l;for(;u>0;){const{node:g,nodeIndex:d,offset:f,length:m}=gl(this,i,!1);if(g instanceof Ws||g instanceof Do||g instanceof li)r.splice(d,1),u-=1;else{if(!(g instanceof kn))break;{const y=Math.min(u,m),b=d!==0?r[d-1]:null,C=g.getSize();f===0&&y===1&&d>0&&b instanceof kn&&m===C&&Array.from(g._map.keys()).length===0?(b._text+=g._text,r.splice(d,1)):f===0&&y===C?r.splice(d,1):g._text=Bp(g._text,f,y,""),u-=y}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:u,offset:g}=gl(this,i,!0);u instanceof kn?u._text=Bp(u._text,g,0,a):this._xmlText.delete(g,a.length),i+=a.length}else{const u=a,{nodeIndex:g}=gl(this,i,!1),d=Xu(e,u,this);r.splice(g,0,d),i+=1}}}}syncChildrenFromYjs(e){const t=this.getNode();t===null&&on(92);const r=t.__key,i=Ku(t,null),s=i.length,o=this._children,a=o.length,l=e.collabNodeMap,u=new Set;let g,d,f=0,m=null;a!==s&&(d=t.getWritable());for(let y=0;y<a;y++){const b=i[f],C=o[y],S=C.getNode(),A=C._key;if(S!==null&&b===A){const v=me(S);if(u.add(b),v)if(C._key=b,C instanceof Ws){const k=C._xmlText;C.syncPropertiesFromYjs(e,null),C.applyChildrenYjsDelta(e,k.toDelta()),C.syncChildrenFromYjs(e)}else C instanceof kn?C.syncPropertiesAndTextFromYjs(e,null):C instanceof li?C.syncPropertiesFromYjs(e,null):C instanceof Do||on(93);m=S,f++}else{if(g===void 0){g=new Set;for(let T=0;T<a;T++){const N=o[T]._key;N!==""&&g.add(N)}}if(S!==null&&b!==void 0&&!g.has(b)){Hp(Ao(b)),y--,f++;continue}d=t.getWritable();const v=Pv(e,C,r),k=v.__key;if(l.set(k,C),m===null){const T=d.getFirstChild();if(d.__first=k,T!==null){const N=T.getWritable();N.__prev=k,v.__next=N.__key}}else{const T=m.getWritable(),N=m.getNextSibling();if(T.__next=k,v.__prev=m.__key,N!==null){const h=N.getWritable();h.__prev=k,v.__next=h.__key}}y===a-1&&(d.__last=k),d.__size++,m=v}}for(let y=0;y<s;y++){const b=i[y];if(!u.has(b)){const C=Ao(b),S=e.collabNodeMap.get(b);S!==void 0&&S.destroy(e),Hp(C)}}}syncPropertiesFromLexical(e,t,r){Zu(e,this._xmlText,this.getPrevNode(r),t)}_syncChildFromLexical(e,t,r,i,s,o){const a=this._children[t],l=Ao(r);a instanceof Ws&&ie(l)?(a.syncPropertiesFromLexical(e,l,i),a.syncChildrenFromLexical(e,l,i,s,o)):a instanceof kn&&me(l)?a.syncPropertiesAndTextFromLexical(e,l,i):a instanceof li&&gt(l)&&a.syncPropertiesFromLexical(e,l,i)}syncChildrenFromLexical(e,t,r,i,s){const o=this.getPrevNode(r),a=o===null?[]:Ku(o,r),l=Ku(t,null),u=a.length-1,g=l.length-1,d=e.collabNodeMap;let f,m,y=0,b=0;for(;y<=u&&b<=g;){const A=a[y],v=l[b];if(A===v)this._syncChildFromLexical(e,b,v,r,i,s),y++,b++;else{f===void 0&&(f=new Set(a)),m===void 0&&(m=new Set(l));const k=m.has(A),T=f.has(v);if(k){const N=zp(e,Ao(v),this);d.set(v,N),T?(this.splice(e,b,1,N),y++,b++):(this.splice(e,b,0,N),b++)}else this.splice(e,b,1),y++}}const C=y>u,S=b>g;if(C&&!S)for(;b<=g;++b){const A=l[b],v=zp(e,Ao(A),this);this.append(v),d.set(A,v)}else if(S&&!C)for(let A=this._children.length-1;A>=b;A--)this.splice(e,A,1)}append(e){const t=this._xmlText,r=this._children,i=r[r.length-1],s=i!==void 0?i.getOffset()+i.getSize():0;if(e instanceof Ws)t.insertEmbed(s,e._xmlText);else if(e instanceof kn){const o=e._map;o.parent===null&&t.insertEmbed(s,o),t.insert(s+1,e._text)}else e instanceof Do?t.insertEmbed(s,e._map):e instanceof li&&t.insertEmbed(s,e._xmlElem);this._children.push(e)}splice(e,t,r,i){const s=this._children,o=s[t];if(o===void 0)return i===void 0&&on(94),void this.append(i);const a=o.getOffset();a===-1&&on(95);const l=this._xmlText;if(r!==0&&l.delete(a,o.getSize()),i instanceof Ws)l.insertEmbed(a,i._xmlText);else if(i instanceof kn){const u=i._map;u.parent===null&&l.insertEmbed(a,u),l.insert(a+1,i._text)}else i instanceof Do?l.insertEmbed(a,i._map):i instanceof li&&l.insertEmbed(a,i._xmlElem);if(r!==0){const u=s.slice(t,t+r);for(let g=0;g<u.length;g++)u[g].destroy(e)}i!==void 0?s.splice(t,r,i):s.splice(t,r)}getChildOffset(e){let t=0;const r=this._children;for(let i=0;i<r.length;i++){const s=r[i];if(s===e)return t;t+=s.getSize()}return-1}destroy(e){const t=e.collabNodeMap,r=this._children;for(let i=0;i<r.length;i++)r[i].destroy(e);t.delete(this._key)}};function Qu(n,e,t){const r=new Ts(n,e,t);return n._collabNode=r,r}function Fv(n,e,t,r,i,s){r==null&&on(81);const o=Qu(r.get("root",ji),null,"root");return o._key="root",{clientID:r.clientID,collabNodeMap:new Map,cursors:new Map,cursorsContainer:null,doc:r,docMap:i,editor:n,excludedProperties:s||new Map,id:t,nodeProperties:new Map,root:o}}function Yp(n,e){const t=e.collabNodeMap.get(n.key);if(t===void 0)return null;let r=n.offset,i=t.getSharedType();if(t instanceof kn){i=t._parent._xmlText;const s=t.getOffset();if(s===-1)return null;r=s+1+r}else if(t instanceof Ts&&n.type==="element"){const s=n.getNode();ie(s)||on(184);let o=0,a=0,l=s.getFirstChild();for(;l!==null&&a++<r;)me(l)?o+=l.getTextContentSize()+1:o++,l=l.getNextSibling();r=o}return ww(i,r)}function pl(n,e){return vw(n,e.doc)}function Vp(n,e){if(n==null){if(e!=null)return!0}else if(e==null||!xw(n,e))return!0;return!1}function zv(n,e){return{color:e,name:n,selection:null}}function qp(n,e){const t=n.cursorsContainer;if(t!==null){const r=e.selections,i=r.length;for(let s=0;s<i;s++)t.removeChild(r[s])}}function Bv(n,e){const t=e.selection;t!==null&&qp(n,t)}function Uv(n,e,t,r,i){const s=n.color,o=document.createElement("span");o.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:${s};z-index:10;`;const a=document.createElement("span");return a.textContent=n.name,a.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:${s};color:#fff;line-height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`,o.appendChild(a),{anchor:{key:e,offset:t},caret:o,color:s,focus:{key:r,offset:i},name:a,selections:[]}}function Hv(n,e,t,r){const i=n.editor,s=i.getRootElement(),o=n.cursorsContainer;if(o===null||s===null)return;const a=o.offsetParent;if(a===null)return;const l=a.getBoundingClientRect(),u=e.selection;if(t===null)return u===null?void 0:(e.selection=null,void qp(n,u));e.selection=t;const g=t.caret,d=t.color,f=t.selections,m=t.anchor,y=t.focus,b=m.key,C=y.key,S=r.get(b),A=r.get(C);if(S==null||A==null)return;let v;if(S===A&&hr(S))v=[i.getElementByKey(b).getBoundingClientRect()];else{const N=Cv(i,S,m.offset,A,y.offset);if(N===null)return;v=Sv(i,N)}const k=f.length,T=v.length;for(let N=0;N<T;N++){const h=v[N];let I=f[N];if(I===void 0){I=document.createElement("span"),f[N]=I;const j=document.createElement("span");I.appendChild(j),o.appendChild(I)}const O=`position:absolute;top:${h.top-l.top}px;left:${h.left-l.left}px;height:${h.height}px;width:${h.width}px;pointer-events:none;z-index:5;`;I.style.cssText=O,I.firstChild.style.cssText=`${O}left:0;top:0;background-color:${d};opacity:0.3;`,N===T-1&&g.parentNode!==I&&I.appendChild(g)}for(let N=k-1;N>=T;N--){const h=f[N];o.removeChild(h),f.pop()}}function Kp(n,e){const t=e.awareness.getLocalState();if(t===null)return;const r=t.anchorPos,i=t.focusPos;if(r!==null&&i!==null){const s=pl(r,n),o=pl(i,n);if(s!==null&&o!==null){const[a,l]=ml(s.type,s.index),[u,g]=ml(o.type,o.index);if(a!==null&&u!==null){const d=a.getKey(),f=u.getKey(),m=he();if(!de(m))return;const y=m.anchor,b=m.focus;Gp(y,d,l),Gp(b,f,g)}}}}function Gp(n,e,t){if(n.key!==e||n.offset!==t){let r=tt(e);if(r!==null&&!ie(r)&&!me(r)){const i=r.getParentOrThrow();e=i.getKey(),t=r.getIndexWithinParent(),r=i}n.set(e,t,ie(r)?"element":"text")}}function ml(n,e){const t=n._collabNode;if(t===void 0)return[null,0];if(t instanceof Ts){const{node:r,offset:i}=gl(t,e,!0);return r===null?[t,0]:[r,i]}return[null,0]}function Xp(n,e){const t=Array.from(e.awareness.getStates()),r=n.clientID,i=n.cursors,s=n.editor._editorState._nodeMap,o=new Set;for(let l=0;l<t.length;l++){const u=t[l],[g,d]=u;if(g!==r){o.add(g);const{anchorPos:f,focusPos:m,name:y,color:b,focusing:C}=d;let S=null,A=i.get(g);if(A===void 0&&(A=zv(y,b),i.set(g,A)),f!==null&&m!==null&&C){const v=pl(f,n),k=pl(m,n);if(v!==null&&k!==null){const[T,N]=ml(v.type,v.index),[h,I]=ml(k.type,k.index);if(T!==null&&h!==null){const O=T.getKey(),j=h.getKey();if(S=A.selection,S===null)S=Uv(A,O,N,j,I);else{const P=S.anchor,q=S.focus;P.key=O,P.offset=N,q.key=j,q.offset=I}}}}Hv(n,A,S,s)}}const a=Array.from(i.keys());for(let l=0;l<a.length;l++){const u=a[l];if(!o.has(u)){const g=i.get(u);g!==void 0&&(Bv(n,g),i.delete(u))}}}function Jp(n,e,t,r){const i=e.awareness,s=i.getLocalState();if(s===null)return;const{anchorPos:o,focusPos:a,name:l,color:u,focusing:g,awarenessData:d}=s;let f=null,m=null;(r!==null&&(o===null||r.is(t))||t!==null)&&(de(r)&&(f=Yp(r.anchor,n),m=Yp(r.focus,n)),(Vp(o,f)||Vp(a,m))&&i.setLocalState({anchorPos:f,awarenessData:d,color:u,focusPos:m,focusing:g,name:l}))}function Wv(n,e){const{target:t}=e,r=Xu(n,t);if(r instanceof Ts&&e instanceof wp){const{keysChanged:i,childListChanged:s,delta:o}=e;i.size>0&&r.syncPropertiesFromYjs(n,i),s&&(r.applyChildrenYjsDelta(n,o),r.syncChildrenFromYjs(n))}else if(r instanceof kn&&e instanceof fp){const{keysChanged:i}=e;i.size>0&&r.syncPropertiesAndTextFromYjs(n,i)}else if(r instanceof li&&e instanceof vp){const{attributesChanged:i}=e;i.size>0&&r.syncPropertiesFromYjs(n,i)}else on(82)}function $v(n,e,t,r){const i=n.editor,s=i._editorState;t.forEach(o=>o.delta),i.update(()=>{for(let a=0;a<t.length;a++){const l=t[a];Wv(n,l)}dt().getChildrenSize()===0&&dt().append(_t());const o=he();if(de(o))if(Up(o)){const a=s._selection;de(a)&&(Kp(n,e),Up(o))&&Wp(o.anchor.key,s),Jp(n,e,a,he())}else Kp(n,e)},{onUpdate:()=>{Xp(n,e)},skipTransforms:!0,tag:r?"historic":"collaboration"})}function Yv(n,e,t,r,i,s,o,a){(function(l,u){l.doc.transact(u,l)})(n,()=>{r.read(()=>{if(a.has("collaboration")||a.has("historic"))return void(o.size>0&&function(g,d){const f=Array.from(d),m=g.collabNodeMap,y=[];for(let b=0;b<f.length;b++){const C=f[b],S=tt(C),A=m.get(C);if(A instanceof kn)if(me(S))y.push([A,S.__text]);else{const v=A.getOffset();if(v===-1)continue;const k=A._parent;A._normalized=!0,k._xmlText.delete(v,1),m.delete(C);const T=k._children,N=T.indexOf(A);T.splice(N,1)}}for(let b=0;b<y.length;b++){const[C,S]=y[b];C instanceof kn&&typeof S=="string"&&(C._text=S)}}(n,o));if(i.has("root")){const g=t._nodeMap,d=dt(),f=n.root;f.syncPropertiesFromLexical(n,d,g),f.syncChildrenFromLexical(n,d,g,i,s)}const l=he(),u=t._selection;Jp(n,e,u,l)})})}const Vv=wi(),qv=wi();function Kv(n,e){return new Zg(e,{trackedOrigins:new Set([n,null])})}function Gv(n,e,t,r,i){n.awareness.setLocalState({anchorPos:null,awarenessData:i,color:t,focusPos:null,focusing:r,name:e})}function Zp(n,e,t,r,i){const{awareness:s}=n;let o=s.getLocalState();o===null&&(o={anchorPos:null,awarenessData:i,color:t,focusPos:null,focusing:r,name:e}),o.focusing=r,s.setLocalState(o)}function Xv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jv=Xv(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const ed=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Zv=ed&&"documentMode"in document?document.documentMode:null;!(!ed||!("InputEvent"in window)||Zv)&&"getTargetRanges"in new window.InputEvent("input");function Qp(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function Kn(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}const em=ed;function Io(n,...e){const t=Qp(...e);t.length>0&&n.classList.add(...t)}function Qv(n,...e){const t=Qp(...e);t.length>0&&n.classList.remove(...t)}function ex(n){const e=it(n,t=>ie(t)&&!t.isInline());return ie(e)||Jv(4,n.__key),e}const it=(n,e)=>{let t=n;for(;t!==dt()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function tm(n){const e=he()||ti();if(de(e)){const{focus:t}=e,r=t.getNode(),i=t.offset;if(un(r)){const s=r.getChildAtIndex(i);s==null?r.append(n):s.insertBefore(n),n.selectNext()}else{let s,o;me(r)?(s=r.getParentOrThrow(),o=r.getIndexWithinParent(),i>0&&(o+=1,r.splitText(i))):(s=r,o=i);const[,a]=C0(s,o);a.insertBefore(n),a.selectStart()}}else{if(e!=null){const r=e.getNodes();r[r.length-1].getTopLevelElementOrThrow().insertAfter(n)}else dt().append(n);const t=_t();n.insertAfter(t),t.select()}return n.getLatest()}function nm(n,e){const t=e();return n.replace(t),t.append(n),t}function zi(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function rm(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function tx(n,e,t,r,i,s,o,a,l,u,g,d){const f=U.useRef(!1),m=U.useCallback(()=>{t.connect()},[t]),y=U.useCallback(()=>{try{t.disconnect()}catch{}},[t]);U.useEffect(()=>{const{root:C}=a,{awareness:S}=t,A=({status:I})=>{n.dispatchCommand(Vv,I==="connected")},v=I=>{o&&I&&C.isEmpty()&&C._xmlText._length===0&&f.current===!1&&function(O,j){O.update(()=>{const P=dt();if(P.isEmpty())if(j)switch(typeof j){case"string":{const q=O.parseEditorState(j);O.setEditorState(q,{tag:"history-merge"});break}case"object":O.setEditorState(j,{tag:"history-merge"});break;case"function":O.update(()=>{dt().isEmpty()&&j(O)},{tag:"history-merge"})}else{const q=_t();P.append(q);const{activeElement:G}=document;(he()!==null||G!==null&&G===O.getRootElement())&&q.select()}},{tag:"history-merge"})}(n,g),f.current=!1},k=()=>{Xp(a,t)},T=(I,O)=>{const j=O.origin;j!==a&&$v(a,t,I,j instanceof Zg)};Gv(t,i,s,document.activeElement===n.getRootElement(),d||{});const N=I=>{(function(O,j){if(O.update(()=>{const ee=dt();ee.clear(),ee.select()},{tag:"skip-collab"}),j.cursors==null)return;const P=j.cursors;if(P==null)return;const q=j.cursorsContainer;if(q==null)return;const G=Array.from(P.values());for(let ee=0;ee<G.length;ee++){const ue=G[ee].selection;if(ue&&ue.selections!=null){const ae=ue.selections;for(let ge=0;ge<ae.length;ge++)q.removeChild(ae[ee])}}})(n,a),l(I),r.set(e,I),f.current=!0};t.on("reload",N),t.on("status",A),t.on("sync",v),S.on("update",k),C.getSharedType().observeDeep(T);const h=n.registerUpdateListener(({prevEditorState:I,editorState:O,dirtyLeaves:j,dirtyElements:P,normalizedNodes:q,tags:G})=>{G.has("skip-collab")===!1&&Yv(a,t,I,O,P,j,q,G)});return m(),()=>{f.current===!1&&y(),t.off("sync",v),t.off("status",A),t.off("reload",N),S.off("update",k),C.getSharedType().unobserveDeep(T),r.delete(e),h()}},[a,s,m,y,r,n,e,g,i,t,o,d,l]);const b=U.useMemo(()=>In.createPortal(F.jsx("div",{ref:C=>{a.cursorsContainer=C}}),u&&u.current||document.body),[a,u]);return U.useEffect(()=>n.registerCommand(qv,C=>(m!==void 0&&y!==void 0&&(C?(console.log("Collaboration connected!"),m()):(console.log("Collaboration disconnected!"),y())),!0),ot),[m,y,n]),b}function nx(n,e){const t=U.useMemo(()=>Kv(e,e.root.getSharedType()),[e]);U.useEffect(()=>Kn(n.registerCommand(aa,()=>(t.undo(),!0),ot),n.registerCommand(la,()=>(t.redo(),!0),ot)));const r=U.useCallback(()=>{t.clear()},[t]);return tn.useEffect(()=>{const i=()=>{n.dispatchCommand(xf,t.undoStack.length>0),n.dispatchCommand(vf,t.redoStack.length>0)};return t.on("stack-item-added",i),t.on("stack-item-popped",i),t.on("stack-cleared",i),()=>{t.off("stack-item-added",i),t.off("stack-item-popped",i),t.off("stack-cleared",i)}},[n,t]),r}function rx({id:n,providerFactory:e,shouldBootstrap:t,username:r,cursorColor:i,cursorsContainerRef:s,initialEditorState:o,excludedProperties:a,awarenessData:l}){const u=U.useRef(!1),g=U.useRef(!1),d=mf(r,i),{yjsDocMap:f,name:m,color:y}=d,[b]=$t();U.useEffect(()=>(d.isCollabActive=!0,()=>{b._parentEditor==null&&(d.isCollabActive=!1)}),[d,b]);const[C,S]=U.useState();U.useEffect(()=>{if(g.current)return;g.current=!0;const N=e(n,f);return S(N),()=>{N.disconnect()}},[n,e,f]);const[A,v]=U.useState(f.get(n)),[k,T]=U.useState();return U.useEffect(()=>{if(!C||u.current)return;u.current=!0;const N=Fv(b,C,n,A||f.get(n),f,a);return T(N),()=>{N.root.destroy(N)}},[b,C,n,f,A,a]),C&&k?F.jsx(ix,{awarenessData:l,binding:k,collabContext:d,color:y,cursorsContainerRef:s,editor:b,id:n,initialEditorState:o,name:m,provider:C,setDoc:v,shouldBootstrap:t,yjsDocMap:f}):F.jsx(F.Fragment,{})}function ix({editor:n,id:e,provider:t,yjsDocMap:r,name:i,color:s,shouldBootstrap:o,cursorsContainerRef:a,initialEditorState:l,awarenessData:u,collabContext:g,binding:d,setDoc:f}){const m=tx(n,e,t,r,i,s,o,d,f,a,l,u);return g.clientID=d.clientID,nx(n,d),function(y,b,C,S,A){U.useEffect(()=>Kn(y.registerCommand(cc,()=>(Zp(b,C,S,!0,A||{}),!1),ot),y.registerCommand(Cf,()=>(Zp(b,C,S,!1,A||{}),!1),ot)),[S,y,C,b,A])}(n,t,i,s,u),m}const im=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,sx=im?U.useLayoutEffect:U.useEffect,yl={tag:"history-merge"};function ox({initialConfig:n,children:e}){const t=U.useMemo(()=>{const{theme:r,namespace:i,editor__DEPRECATED:s,nodes:o,onError:a,editorState:l,html:u}=n,g=yf(null,r);let d=s||null;if(d===null){const f=Ha({editable:n.editable,html:u,namespace:i,nodes:o,onError:m=>a(m,f),theme:r});(function(m,y){if(y!==null){if(y===void 0)m.update(()=>{const b=dt();if(b.isEmpty()){const C=_t();b.append(C);const S=im?document.activeElement:null;(he()!==null||S!==null&&S===m.getRootElement())&&C.select()}},yl);else if(y!==null)switch(typeof y){case"string":{const b=m.parseEditorState(y);m.setEditorState(b,yl);break}case"object":m.setEditorState(y,yl);break;case"function":m.update(()=>{dt().isEmpty()&&y(m)},yl)}}})(f,l),d=f}return[d,g]},[]);return sx(()=>{const r=n.editable,[i]=t;i.setEditable(r===void 0||r)},[]),F.jsx(sa.Provider,{value:t,children:e})}const n1="",ax={autocomplete:"PlaygroundEditorTheme__autocomplete",blockCursor:"PlaygroundEditorTheme__blockCursor",characterLimit:"PlaygroundEditorTheme__characterLimit",code:"PlaygroundEditorTheme__code",codeHighlight:{atrule:"PlaygroundEditorTheme__tokenAttr",attr:"PlaygroundEditorTheme__tokenAttr",boolean:"PlaygroundEditorTheme__tokenProperty",builtin:"PlaygroundEditorTheme__tokenSelector",cdata:"PlaygroundEditorTheme__tokenComment",char:"PlaygroundEditorTheme__tokenSelector",class:"PlaygroundEditorTheme__tokenFunction","class-name":"PlaygroundEditorTheme__tokenFunction",comment:"PlaygroundEditorTheme__tokenComment",constant:"PlaygroundEditorTheme__tokenProperty",deleted:"PlaygroundEditorTheme__tokenProperty",doctype:"PlaygroundEditorTheme__tokenComment",entity:"PlaygroundEditorTheme__tokenOperator",function:"PlaygroundEditorTheme__tokenFunction",important:"PlaygroundEditorTheme__tokenVariable",inserted:"PlaygroundEditorTheme__tokenSelector",keyword:"PlaygroundEditorTheme__tokenAttr",namespace:"PlaygroundEditorTheme__tokenVariable",number:"PlaygroundEditorTheme__tokenProperty",operator:"PlaygroundEditorTheme__tokenOperator",prolog:"PlaygroundEditorTheme__tokenComment",property:"PlaygroundEditorTheme__tokenProperty",punctuation:"PlaygroundEditorTheme__tokenPunctuation",regex:"PlaygroundEditorTheme__tokenVariable",selector:"PlaygroundEditorTheme__tokenSelector",string:"PlaygroundEditorTheme__tokenSelector",symbol:"PlaygroundEditorTheme__tokenProperty",tag:"PlaygroundEditorTheme__tokenProperty",url:"PlaygroundEditorTheme__tokenOperator",variable:"PlaygroundEditorTheme__tokenVariable"},embedBlock:{base:"PlaygroundEditorTheme__embedBlock",focus:"PlaygroundEditorTheme__embedBlockFocus"},hashtag:"PlaygroundEditorTheme__hashtag",heading:{h1:"PlaygroundEditorTheme__h1",h2:"PlaygroundEditorTheme__h2",h3:"PlaygroundEditorTheme__h3",h4:"PlaygroundEditorTheme__h4",h5:"PlaygroundEditorTheme__h5"},hr:"PlaygroundEditorTheme__hr",image:"editor-image",indent:"PlaygroundEditorTheme__indent",inlineImage:"inline-editor-image",layoutContainer:"PlaygroundEditorTheme__layoutContainer",layoutItem:"PlaygroundEditorTheme__layoutItem",link:"PlaygroundEditorTheme__link",list:{checklist:"PlaygroundEditorTheme__checklist",listitem:"PlaygroundEditorTheme__listItem",listitemChecked:"PlaygroundEditorTheme__listItemChecked",listitemUnchecked:"PlaygroundEditorTheme__listItemUnchecked",nested:{listitem:"PlaygroundEditorTheme__nestedListItem"},olDepth:["PlaygroundEditorTheme__ol1","PlaygroundEditorTheme__ol2","PlaygroundEditorTheme__ol3","PlaygroundEditorTheme__ol4","PlaygroundEditorTheme__ol5"],ul:"PlaygroundEditorTheme__ul"},ltr:"PlaygroundEditorTheme__ltr",mark:"PlaygroundEditorTheme__mark",markOverlap:"PlaygroundEditorTheme__markOverlap",quote:"PlaygroundEditorTheme__quote",rtl:"PlaygroundEditorTheme__rtl",table:"PlaygroundEditorTheme__table",tableCell:"PlaygroundEditorTheme__tableCell",tableCellActionButton:"PlaygroundEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"PlaygroundEditorTheme__tableCellActionButtonContainer",tableCellEditing:"PlaygroundEditorTheme__tableCellEditing",tableCellHeader:"PlaygroundEditorTheme__tableCellHeader",tableCellPrimarySelected:"PlaygroundEditorTheme__tableCellPrimarySelected",tableCellResizer:"PlaygroundEditorTheme__tableCellResizer",tableCellSelected:"PlaygroundEditorTheme__tableCellSelected",tableCellSortedIndicator:"PlaygroundEditorTheme__tableCellSortedIndicator",tableResizeRuler:"PlaygroundEditorTheme__tableCellResizeRuler",tableRowStriping:"PlaygroundEditorTheme__tableRowStriping",tableSelected:"PlaygroundEditorTheme__tableSelected",tableSelection:"PlaygroundEditorTheme__tableSelection",text:{bold:"PlaygroundEditorTheme__textBold",code:"PlaygroundEditorTheme__textCode",italic:"PlaygroundEditorTheme__textItalic",strikethrough:"PlaygroundEditorTheme__textStrikethrough",subscript:"PlaygroundEditorTheme__textSubscript",superscript:"PlaygroundEditorTheme__textSuperscript",underline:"PlaygroundEditorTheme__textUnderline",underlineStrikethrough:"PlaygroundEditorTheme__textUnderlineStrikethrough"}},sm=[["Arabian","#7d0000"],["Appaloosa","#640000"],["Friesian","#990000"],["Thoroughbred","#bf0000"],["Warmblood","#bf4000"],["Saddlebred","#004000"],["Mustang","#007f00"],["Trakehner","#407f00"],["Quarter Horse","#7f7f00"],["Clydesdale","#000099"],["Paint","#0000bf"],["Icelandic","#0000ff"],["Andalusian","#004040"],["Tennessee Walker","#404040"],["Ukrainian Riding Horse","#7f0040"],["Percheron","#bf0040"]];function lx({userObj:n}){return{color:sm[Math.floor(Math.random()*sm.length)][1],name:n?n.name:""}}const cx=1200,ux=2500,_l=3e4,td=n=>{if(n.shouldConnect&&n.ws===null){const e=new WebSocket(n.url),t=n.binaryType;let r=null;t&&(e.binaryType=t),n.ws=e,n.connecting=!0,n.connected=!1,e.onmessage=o=>{n.lastMessageReceived=jn();const a=o.data,l=typeof a=="string"?JSON.parse(a):a;l&&l.type==="pong"&&(clearTimeout(r),r=setTimeout(s,_l/2)),n.emit("message",[l,n])};const i=o=>{n.ws!==null&&(n.ws=null,n.connecting=!1,n.connected?(n.connected=!1,n.emit("disconnect",[{type:"disconnect",error:o},n])):n.unsuccessfulReconnects++,setTimeout(td,$a(G0(n.unsuccessfulReconnects+1)*cx,ux),n)),clearTimeout(r)},s=()=>{n.ws===e&&n.send({type:"ping"})};e.onclose=()=>i(null),e.onerror=o=>i(o),e.onopen=()=>{n.lastMessageReceived=jn(),n.connecting=!1,n.connected=!0,n.unsuccessfulReconnects=0,n.emit("connect",[{type:"connect"},n]),r=setTimeout(s,_l/2)}}};class dx extends cu{constructor(e,{binaryType:t}={}){super(),this.url=e,this.ws=null,this.binaryType=t||null,this.connected=!1,this.connecting=!1,this.unsuccessfulReconnects=0,this.lastMessageReceived=0,this.shouldConnect=!0,this._checkInterval=setInterval(()=>{this.connected&&_l<jn()-this.lastMessageReceived&&this.ws.close()},_l/2),td(this)}send(e){this.ws&&this.ws.send(JSON.stringify(e))}destroy(){clearInterval(this._checkInterval),this.disconnect(),super.destroy()}disconnect(){this.shouldConnect=!1,this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.connected&&this.ws===null&&td(this)}}const om=new Map;class fx{constructor(e){this.room=e,this.onmessage=null,this._onChange=t=>t.key===e&&this.onmessage!==null&&this.onmessage({data:yg(t.newValue||"")}),Cb(this._onChange)}postMessage(e){ag.setItem(this.room,mg(zb(e)))}close(){Sb(this._onChange)}}const hx=typeof BroadcastChannel>"u"?fx:BroadcastChannel,nd=n=>Ln(om,n,()=>{const e=ri(),t=new hx(n);return t.onmessage=r=>e.forEach(i=>i(r.data,"broadcastchannel")),{bc:t,subs:e}}),am=(n,e)=>(nd(n).subs.add(e),e),lm=(n,e)=>{const t=nd(n),r=t.subs.delete(e);return r&&t.subs.size===0&&(t.bc.close(),om.delete(n)),r},Bi=(n,e,t=null)=>{const r=nd(n);r.bc.postMessage(e),r.subs.forEach(i=>i(e,t))},gx=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}};function bl(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var cm={exports:{}};(function(n,e){(function(t){n.exports=t()})(function(){var t=Math.floor,r=Math.abs,i=Math.pow;return function(){function s(o,a,l){function u(f,m){if(!a[f]){if(!o[f]){var y=typeof bl=="function"&&bl;if(!m&&y)return y(f,!0);if(g)return g(f,!0);var b=new Error("Cannot find module '"+f+"'");throw b.code="MODULE_NOT_FOUND",b}var C=a[f]={exports:{}};o[f][0].call(C.exports,function(S){var A=o[f][1][S];return u(A||S)},C,C.exports,s,o,a,l)}return a[f].exports}for(var g=typeof bl=="function"&&bl,d=0;d<l.length;d++)u(l[d]);return u}return s}()({1:[function(s,o,a){function l(k){var T=k.length;if(0<T%4)throw new Error("Invalid string. Length must be a multiple of 4");var N=k.indexOf("=");N===-1&&(N=T);var h=N===T?0:4-N%4;return[N,h]}function u(k,T,N){return 3*(T+N)/4-N}function g(k){var T,N,h=l(k),I=h[0],O=h[1],j=new C(u(k,I,O)),P=0,q=0<O?I-4:I;for(N=0;N<q;N+=4)T=b[k.charCodeAt(N)]<<18|b[k.charCodeAt(N+1)]<<12|b[k.charCodeAt(N+2)]<<6|b[k.charCodeAt(N+3)],j[P++]=255&T>>16,j[P++]=255&T>>8,j[P++]=255&T;return O===2&&(T=b[k.charCodeAt(N)]<<2|b[k.charCodeAt(N+1)]>>4,j[P++]=255&T),O===1&&(T=b[k.charCodeAt(N)]<<10|b[k.charCodeAt(N+1)]<<4|b[k.charCodeAt(N+2)]>>2,j[P++]=255&T>>8,j[P++]=255&T),j}function d(k){return y[63&k>>18]+y[63&k>>12]+y[63&k>>6]+y[63&k]}function f(k,T,N){for(var h,I=[],O=T;O<N;O+=3)h=(16711680&k[O]<<16)+(65280&k[O+1]<<8)+(255&k[O+2]),I.push(d(h));return I.join("")}function m(k){for(var T,N=k.length,h=N%3,I=[],O=16383,j=0,P=N-h;j<P;j+=O)I.push(f(k,j,j+O>P?P:j+O));return h===1?(T=k[N-1],I.push(y[T>>2]+y[63&T<<4]+"==")):h===2&&(T=(k[N-2]<<8)+k[N-1],I.push(y[T>>10]+y[63&T>>4]+y[63&T<<2]+"=")),I.join("")}a.byteLength=function(k){var T=l(k),N=T[0],h=T[1];return 3*(N+h)/4-h},a.toByteArray=g,a.fromByteArray=m;for(var y=[],b=[],C=typeof Uint8Array>"u"?Array:Uint8Array,S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A=0,v=S.length;A<v;++A)y[A]=S[A],b[S.charCodeAt(A)]=A;b[45]=62,b[95]=63},{}],2:[function(){},{}],3:[function(s,o,a){(function(){(function(){var l=String.fromCharCode,u=Math.min;function g(_){if(2147483647<_)throw new RangeError('The value "'+_+'" is invalid for option "size"');var E=new Uint8Array(_);return E.__proto__=d.prototype,E}function d(_,E,R){if(typeof _=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(_)}return f(_,E,R)}function f(_,E,R){if(typeof _=="string")return C(_,E);if(ArrayBuffer.isView(_))return S(_);if(_==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _);if(Z(_,ArrayBuffer)||_&&Z(_.buffer,ArrayBuffer))return A(_,E,R);if(typeof _=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var Y=_.valueOf&&_.valueOf();if(Y!=null&&Y!==_)return d.from(Y,E,R);var J=v(_);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof _[Symbol.toPrimitive]=="function")return d.from(_[Symbol.toPrimitive]("string"),E,R);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof _)}function m(_){if(typeof _!="number")throw new TypeError('"size" argument must be of type number');if(0>_)throw new RangeError('The value "'+_+'" is invalid for option "size"')}function y(_,E,R){return m(_),0>=_||E===void 0?g(_):typeof R=="string"?g(_).fill(E,R):g(_).fill(E)}function b(_){return m(_),g(0>_?0:0|k(_))}function C(_,E){if((typeof E!="string"||E==="")&&(E="utf8"),!d.isEncoding(E))throw new TypeError("Unknown encoding: "+E);var R=0|T(_,E),Y=g(R),J=Y.write(_,E);return J!==R&&(Y=Y.slice(0,J)),Y}function S(_){for(var E=0>_.length?0:0|k(_.length),R=g(E),Y=0;Y<E;Y+=1)R[Y]=255&_[Y];return R}function A(_,E,R){if(0>E||_.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(_.byteLength<E+(R||0))throw new RangeError('"length" is outside of buffer bounds');var Y;return Y=E===void 0&&R===void 0?new Uint8Array(_):R===void 0?new Uint8Array(_,E):new Uint8Array(_,E,R),Y.__proto__=d.prototype,Y}function v(_){if(d.isBuffer(_)){var E=0|k(_.length),R=g(E);return R.length===0||_.copy(R,0,0,E),R}return _.length===void 0?_.type==="Buffer"&&Array.isArray(_.data)?S(_.data):void 0:typeof _.length!="number"||re(_.length)?g(0):S(_)}function k(_){if(_>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|_}function T(_,E){if(d.isBuffer(_))return _.length;if(ArrayBuffer.isView(_)||Z(_,ArrayBuffer))return _.byteLength;if(typeof _!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof _);var R=_.length,Y=2<arguments.length&&arguments[2]===!0;if(!Y&&R===0)return 0;for(var J=!1;;)switch(E){case"ascii":case"latin1":case"binary":return R;case"utf8":case"utf-8":return Pe(_).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*R;case"hex":return R>>>1;case"base64":return yt(_).length;default:if(J)return Y?-1:Pe(_).length;E=(""+E).toLowerCase(),J=!0}}function N(_,E,R){var Y=!1;if((E===void 0||0>E)&&(E=0),E>this.length||((R===void 0||R>this.length)&&(R=this.length),0>=R)||(R>>>=0,E>>>=0,R<=E))return"";for(_||(_="utf8");;)switch(_){case"hex":return fe(this,E,R);case"utf8":case"utf-8":return ge(this,E,R);case"ascii":return be(this,E,R);case"latin1":case"binary":return oe(this,E,R);case"base64":return ae(this,E,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,E,R);default:if(Y)throw new TypeError("Unknown encoding: "+_);_=(_+"").toLowerCase(),Y=!0}}function h(_,E,R){var Y=_[E];_[E]=_[R],_[R]=Y}function I(_,E,R,Y,J){if(_.length===0)return-1;if(typeof R=="string"?(Y=R,R=0):2147483647<R?R=2147483647:-2147483648>R&&(R=-2147483648),R=+R,re(R)&&(R=J?0:_.length-1),0>R&&(R=_.length+R),R>=_.length){if(J)return-1;R=_.length-1}else if(0>R)if(J)R=0;else return-1;if(typeof E=="string"&&(E=d.from(E,Y)),d.isBuffer(E))return E.length===0?-1:O(_,E,R,Y,J);if(typeof E=="number")return E&=255,typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(_,E,R):Uint8Array.prototype.lastIndexOf.call(_,E,R):O(_,[E],R,Y,J);throw new TypeError("val must be string, number or Buffer")}function O(_,E,R,Y,J){function K(Vt,hn){return Ee===1?Vt[hn]:Vt.readUInt16BE(hn*Ee)}var Ee=1,Je=_.length,Ct=E.length;if(Y!==void 0&&(Y=(Y+"").toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le")){if(2>_.length||2>E.length)return-1;Ee=2,Je/=2,Ct/=2,R/=2}var Ze;if(J){var Ge=-1;for(Ze=R;Ze<Je;Ze++)if(K(_,Ze)!==K(E,Ge===-1?0:Ze-Ge))Ge!==-1&&(Ze-=Ze-Ge),Ge=-1;else if(Ge===-1&&(Ge=Ze),Ze-Ge+1===Ct)return Ge*Ee}else for(R+Ct>Je&&(R=Je-Ct),Ze=R;0<=Ze;Ze--){for(var Ft=!0,wn=0;wn<Ct;wn++)if(K(_,Ze+wn)!==K(E,wn)){Ft=!1;break}if(Ft)return Ze}return-1}function j(_,E,R,Y){R=+R||0;var J=_.length-R;Y?(Y=+Y,Y>J&&(Y=J)):Y=J;var K=E.length;Y>K/2&&(Y=K/2);for(var Ee,Je=0;Je<Y;++Je){if(Ee=parseInt(E.substr(2*Je,2),16),re(Ee))return Je;_[R+Je]=Ee}return Je}function P(_,E,R,Y){return Wt(Pe(E,_.length-R),_,R,Y)}function q(_,E,R,Y){return Wt(ft(E),_,R,Y)}function G(_,E,R,Y){return q(_,E,R,Y)}function ee(_,E,R,Y){return Wt(yt(E),_,R,Y)}function ue(_,E,R,Y){return Wt(we(E,_.length-R),_,R,Y)}function ae(_,E,R){return E===0&&R===_.length?ye.fromByteArray(_):ye.fromByteArray(_.slice(E,R))}function ge(_,E,R){R=u(_.length,R);for(var Y=[],J=E;J<R;){var K=_[J],Ee=null,Je=239<K?4:223<K?3:191<K?2:1;if(J+Je<=R){var Ct,Ze,Ge,Ft;Je===1?128>K&&(Ee=K):Je===2?(Ct=_[J+1],(192&Ct)==128&&(Ft=(31&K)<<6|63&Ct,127<Ft&&(Ee=Ft))):Je===3?(Ct=_[J+1],Ze=_[J+2],(192&Ct)==128&&(192&Ze)==128&&(Ft=(15&K)<<12|(63&Ct)<<6|63&Ze,2047<Ft&&(55296>Ft||57343<Ft)&&(Ee=Ft))):Je===4&&(Ct=_[J+1],Ze=_[J+2],Ge=_[J+3],(192&Ct)==128&&(192&Ze)==128&&(192&Ge)==128&&(Ft=(15&K)<<18|(63&Ct)<<12|(63&Ze)<<6|63&Ge,65535<Ft&&1114112>Ft&&(Ee=Ft)))}Ee===null?(Ee=65533,Je=1):65535<Ee&&(Ee-=65536,Y.push(55296|1023&Ee>>>10),Ee=56320|1023&Ee),Y.push(Ee),J+=Je}return Le(Y)}function Le(_){var E=_.length;if(E<=4096)return l.apply(String,_);for(var R="",Y=0;Y<E;)R+=l.apply(String,_.slice(Y,Y+=4096));return R}function be(_,E,R){var Y="";R=u(_.length,R);for(var J=E;J<R;++J)Y+=l(127&_[J]);return Y}function oe(_,E,R){var Y="";R=u(_.length,R);for(var J=E;J<R;++J)Y+=l(_[J]);return Y}function fe(_,E,R){var Y=_.length;(!E||0>E)&&(E=0),(!R||0>R||R>Y)&&(R=Y);for(var J="",K=E;K<R;++K)J+=xe(_[K]);return J}function Ce(_,E,R){for(var Y=_.slice(E,R),J="",K=0;K<Y.length;K+=2)J+=l(Y[K]+256*Y[K+1]);return J}function Te(_,E,R){if(_%1!=0||0>_)throw new RangeError("offset is not uint");if(_+E>R)throw new RangeError("Trying to access beyond buffer length")}function ve(_,E,R,Y,J,K){if(!d.isBuffer(_))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>J||E<K)throw new RangeError('"value" argument is out of bounds');if(R+Y>_.length)throw new RangeError("Index out of range")}function Fe(_,E,R,Y){if(R+Y>_.length)throw new RangeError("Index out of range");if(0>R)throw new RangeError("Index out of range")}function De(_,E,R,Y,J){return E=+E,R>>>=0,J||Fe(_,E,R,4),Ae.write(_,E,R,Y,23,4),R+4}function ke(_,E,R,Y,J){return E=+E,R>>>=0,J||Fe(_,E,R,8),Ae.write(_,E,R,Y,52,8),R+8}function ze(_){if(_=_.split("=")[0],_=_.trim().replace(B,""),2>_.length)return"";for(;_.length%4!=0;)_+="=";return _}function xe(_){return 16>_?"0"+_.toString(16):_.toString(16)}function Pe(_,E){E=E||1/0;for(var R,Y=_.length,J=null,K=[],Ee=0;Ee<Y;++Ee){if(R=_.charCodeAt(Ee),55295<R&&57344>R){if(!J){if(56319<R){-1<(E-=3)&&K.push(239,191,189);continue}else if(Ee+1===Y){-1<(E-=3)&&K.push(239,191,189);continue}J=R;continue}if(56320>R){-1<(E-=3)&&K.push(239,191,189),J=R;continue}R=(J-55296<<10|R-56320)+65536}else J&&-1<(E-=3)&&K.push(239,191,189);if(J=null,128>R){if(0>(E-=1))break;K.push(R)}else if(2048>R){if(0>(E-=2))break;K.push(192|R>>6,128|63&R)}else if(65536>R){if(0>(E-=3))break;K.push(224|R>>12,128|63&R>>6,128|63&R)}else if(1114112>R){if(0>(E-=4))break;K.push(240|R>>18,128|63&R>>12,128|63&R>>6,128|63&R)}else throw new Error("Invalid code point")}return K}function ft(_){for(var E=[],R=0;R<_.length;++R)E.push(255&_.charCodeAt(R));return E}function we(_,E){for(var R,Y,J,K=[],Ee=0;Ee<_.length&&!(0>(E-=2));++Ee)R=_.charCodeAt(Ee),Y=R>>8,J=R%256,K.push(J),K.push(Y);return K}function yt(_){return ye.toByteArray(ze(_))}function Wt(_,E,R,Y){for(var J=0;J<Y&&!(J+R>=E.length||J>=_.length);++J)E[J+R]=_[J];return J}function Z(_,E){return _ instanceof E||_!=null&&_.constructor!=null&&_.constructor.name!=null&&_.constructor.name===E.name}function re(_){return _!==_}var ye=s("base64-js"),Ae=s("ieee754");a.Buffer=d,a.SlowBuffer=function(_){return+_!=_&&(_=0),d.alloc(+_)},a.INSPECT_MAX_BYTES=50,a.kMaxLength=2147483647,d.TYPED_ARRAY_SUPPORT=function(){try{var _=new Uint8Array(1);return _.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},_.foo()===42}catch{return!1}}(),d.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){return d.isBuffer(this)?this.buffer:void 0}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){return d.isBuffer(this)?this.byteOffset:void 0}}),typeof Symbol<"u"&&Symbol.species!=null&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(_,E,R){return f(_,E,R)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(_,E,R){return y(_,E,R)},d.allocUnsafe=function(_){return b(_)},d.allocUnsafeSlow=function(_){return b(_)},d.isBuffer=function(_){return _!=null&&_._isBuffer===!0&&_!==d.prototype},d.compare=function(_,E){if(Z(_,Uint8Array)&&(_=d.from(_,_.offset,_.byteLength)),Z(E,Uint8Array)&&(E=d.from(E,E.offset,E.byteLength)),!d.isBuffer(_)||!d.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(_===E)return 0;for(var R=_.length,Y=E.length,J=0,K=u(R,Y);J<K;++J)if(_[J]!==E[J]){R=_[J],Y=E[J];break}return R<Y?-1:Y<R?1:0},d.isEncoding=function(_){switch((_+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(_,E){if(!Array.isArray(_))throw new TypeError('"list" argument must be an Array of Buffers');if(_.length===0)return d.alloc(0);var R;if(E===void 0)for(E=0,R=0;R<_.length;++R)E+=_[R].length;var Y=d.allocUnsafe(E),J=0;for(R=0;R<_.length;++R){var K=_[R];if(Z(K,Uint8Array)&&(K=d.from(K)),!d.isBuffer(K))throw new TypeError('"list" argument must be an Array of Buffers');K.copy(Y,J),J+=K.length}return Y},d.byteLength=T,d.prototype._isBuffer=!0,d.prototype.swap16=function(){var _=this.length;if(_%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<_;E+=2)h(this,E,E+1);return this},d.prototype.swap32=function(){var _=this.length;if(_%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<_;E+=4)h(this,E,E+3),h(this,E+1,E+2);return this},d.prototype.swap64=function(){var _=this.length;if(_%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<_;E+=8)h(this,E,E+7),h(this,E+1,E+6),h(this,E+2,E+5),h(this,E+3,E+4);return this},d.prototype.toString=function(){var _=this.length;return _===0?"":arguments.length===0?ge(this,0,_):N.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(_){if(!d.isBuffer(_))throw new TypeError("Argument must be a Buffer");return this===_||d.compare(this,_)===0},d.prototype.inspect=function(){var _="",E=a.INSPECT_MAX_BYTES;return _=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(_+=" ... "),"<Buffer "+_+">"},d.prototype.compare=function(_,E,R,Y,J){if(Z(_,Uint8Array)&&(_=d.from(_,_.offset,_.byteLength)),!d.isBuffer(_))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof _);if(E===void 0&&(E=0),R===void 0&&(R=_?_.length:0),Y===void 0&&(Y=0),J===void 0&&(J=this.length),0>E||R>_.length||0>Y||J>this.length)throw new RangeError("out of range index");if(Y>=J&&E>=R)return 0;if(Y>=J)return-1;if(E>=R)return 1;if(E>>>=0,R>>>=0,Y>>>=0,J>>>=0,this===_)return 0;for(var K=J-Y,Ee=R-E,Je=u(K,Ee),Ct=this.slice(Y,J),Ze=_.slice(E,R),Ge=0;Ge<Je;++Ge)if(Ct[Ge]!==Ze[Ge]){K=Ct[Ge],Ee=Ze[Ge];break}return K<Ee?-1:Ee<K?1:0},d.prototype.includes=function(_,E,R){return this.indexOf(_,E,R)!==-1},d.prototype.indexOf=function(_,E,R){return I(this,_,E,R,!0)},d.prototype.lastIndexOf=function(_,E,R){return I(this,_,E,R,!1)},d.prototype.write=function(_,E,R,Y){if(E===void 0)Y="utf8",R=this.length,E=0;else if(R===void 0&&typeof E=="string")Y=E,R=this.length,E=0;else if(isFinite(E))E>>>=0,isFinite(R)?(R>>>=0,Y===void 0&&(Y="utf8")):(Y=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var J=this.length-E;if((R===void 0||R>J)&&(R=J),0<_.length&&(0>R||0>E)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");Y||(Y="utf8");for(var K=!1;;)switch(Y){case"hex":return j(this,_,E,R);case"utf8":case"utf-8":return P(this,_,E,R);case"ascii":return q(this,_,E,R);case"latin1":case"binary":return G(this,_,E,R);case"base64":return ee(this,_,E,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,_,E,R);default:if(K)throw new TypeError("Unknown encoding: "+Y);Y=(""+Y).toLowerCase(),K=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},d.prototype.slice=function(_,E){var R=this.length;_=~~_,E=E===void 0?R:~~E,0>_?(_+=R,0>_&&(_=0)):_>R&&(_=R),0>E?(E+=R,0>E&&(E=0)):E>R&&(E=R),E<_&&(E=_);var Y=this.subarray(_,E);return Y.__proto__=d.prototype,Y},d.prototype.readUIntLE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=this[_],J=1,K=0;++K<E&&(J*=256);)Y+=this[_+K]*J;return Y},d.prototype.readUIntBE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=this[_+--E],J=1;0<E&&(J*=256);)Y+=this[_+--E]*J;return Y},d.prototype.readUInt8=function(_,E){return _>>>=0,E||Te(_,1,this.length),this[_]},d.prototype.readUInt16LE=function(_,E){return _>>>=0,E||Te(_,2,this.length),this[_]|this[_+1]<<8},d.prototype.readUInt16BE=function(_,E){return _>>>=0,E||Te(_,2,this.length),this[_]<<8|this[_+1]},d.prototype.readUInt32LE=function(_,E){return _>>>=0,E||Te(_,4,this.length),(this[_]|this[_+1]<<8|this[_+2]<<16)+16777216*this[_+3]},d.prototype.readUInt32BE=function(_,E){return _>>>=0,E||Te(_,4,this.length),16777216*this[_]+(this[_+1]<<16|this[_+2]<<8|this[_+3])},d.prototype.readIntLE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=this[_],J=1,K=0;++K<E&&(J*=256);)Y+=this[_+K]*J;return J*=128,Y>=J&&(Y-=i(2,8*E)),Y},d.prototype.readIntBE=function(_,E,R){_>>>=0,E>>>=0,R||Te(_,E,this.length);for(var Y=E,J=1,K=this[_+--Y];0<Y&&(J*=256);)K+=this[_+--Y]*J;return J*=128,K>=J&&(K-=i(2,8*E)),K},d.prototype.readInt8=function(_,E){return _>>>=0,E||Te(_,1,this.length),128&this[_]?-1*(255-this[_]+1):this[_]},d.prototype.readInt16LE=function(_,E){_>>>=0,E||Te(_,2,this.length);var R=this[_]|this[_+1]<<8;return 32768&R?4294901760|R:R},d.prototype.readInt16BE=function(_,E){_>>>=0,E||Te(_,2,this.length);var R=this[_+1]|this[_]<<8;return 32768&R?4294901760|R:R},d.prototype.readInt32LE=function(_,E){return _>>>=0,E||Te(_,4,this.length),this[_]|this[_+1]<<8|this[_+2]<<16|this[_+3]<<24},d.prototype.readInt32BE=function(_,E){return _>>>=0,E||Te(_,4,this.length),this[_]<<24|this[_+1]<<16|this[_+2]<<8|this[_+3]},d.prototype.readFloatLE=function(_,E){return _>>>=0,E||Te(_,4,this.length),Ae.read(this,_,!0,23,4)},d.prototype.readFloatBE=function(_,E){return _>>>=0,E||Te(_,4,this.length),Ae.read(this,_,!1,23,4)},d.prototype.readDoubleLE=function(_,E){return _>>>=0,E||Te(_,8,this.length),Ae.read(this,_,!0,52,8)},d.prototype.readDoubleBE=function(_,E){return _>>>=0,E||Te(_,8,this.length),Ae.read(this,_,!1,52,8)},d.prototype.writeUIntLE=function(_,E,R,Y){if(_=+_,E>>>=0,R>>>=0,!Y){var J=i(2,8*R)-1;ve(this,_,E,R,J,0)}var K=1,Ee=0;for(this[E]=255&_;++Ee<R&&(K*=256);)this[E+Ee]=255&_/K;return E+R},d.prototype.writeUIntBE=function(_,E,R,Y){if(_=+_,E>>>=0,R>>>=0,!Y){var J=i(2,8*R)-1;ve(this,_,E,R,J,0)}var K=R-1,Ee=1;for(this[E+K]=255&_;0<=--K&&(Ee*=256);)this[E+K]=255&_/Ee;return E+R},d.prototype.writeUInt8=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,1,255,0),this[E]=255&_,E+1},d.prototype.writeUInt16LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,65535,0),this[E]=255&_,this[E+1]=_>>>8,E+2},d.prototype.writeUInt16BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,65535,0),this[E]=_>>>8,this[E+1]=255&_,E+2},d.prototype.writeUInt32LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,4294967295,0),this[E+3]=_>>>24,this[E+2]=_>>>16,this[E+1]=_>>>8,this[E]=255&_,E+4},d.prototype.writeUInt32BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,4294967295,0),this[E]=_>>>24,this[E+1]=_>>>16,this[E+2]=_>>>8,this[E+3]=255&_,E+4},d.prototype.writeIntLE=function(_,E,R,Y){if(_=+_,E>>>=0,!Y){var J=i(2,8*R-1);ve(this,_,E,R,J-1,-J)}var K=0,Ee=1,Je=0;for(this[E]=255&_;++K<R&&(Ee*=256);)0>_&&Je===0&&this[E+K-1]!==0&&(Je=1),this[E+K]=255&(_/Ee>>0)-Je;return E+R},d.prototype.writeIntBE=function(_,E,R,Y){if(_=+_,E>>>=0,!Y){var J=i(2,8*R-1);ve(this,_,E,R,J-1,-J)}var K=R-1,Ee=1,Je=0;for(this[E+K]=255&_;0<=--K&&(Ee*=256);)0>_&&Je===0&&this[E+K+1]!==0&&(Je=1),this[E+K]=255&(_/Ee>>0)-Je;return E+R},d.prototype.writeInt8=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,1,127,-128),0>_&&(_=255+_+1),this[E]=255&_,E+1},d.prototype.writeInt16LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,32767,-32768),this[E]=255&_,this[E+1]=_>>>8,E+2},d.prototype.writeInt16BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,2,32767,-32768),this[E]=_>>>8,this[E+1]=255&_,E+2},d.prototype.writeInt32LE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,2147483647,-2147483648),this[E]=255&_,this[E+1]=_>>>8,this[E+2]=_>>>16,this[E+3]=_>>>24,E+4},d.prototype.writeInt32BE=function(_,E,R){return _=+_,E>>>=0,R||ve(this,_,E,4,2147483647,-2147483648),0>_&&(_=4294967295+_+1),this[E]=_>>>24,this[E+1]=_>>>16,this[E+2]=_>>>8,this[E+3]=255&_,E+4},d.prototype.writeFloatLE=function(_,E,R){return De(this,_,E,!0,R)},d.prototype.writeFloatBE=function(_,E,R){return De(this,_,E,!1,R)},d.prototype.writeDoubleLE=function(_,E,R){return ke(this,_,E,!0,R)},d.prototype.writeDoubleBE=function(_,E,R){return ke(this,_,E,!1,R)},d.prototype.copy=function(_,E,R,Y){if(!d.isBuffer(_))throw new TypeError("argument should be a Buffer");if(R||(R=0),Y||Y===0||(Y=this.length),E>=_.length&&(E=_.length),E||(E=0),0<Y&&Y<R&&(Y=R),Y===R||_.length===0||this.length===0)return 0;if(0>E)throw new RangeError("targetStart out of bounds");if(0>R||R>=this.length)throw new RangeError("Index out of range");if(0>Y)throw new RangeError("sourceEnd out of bounds");Y>this.length&&(Y=this.length),_.length-E<Y-R&&(Y=_.length-E+R);var J=Y-R;if(this===_&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(E,R,Y);else if(this===_&&R<E&&E<Y)for(var K=J-1;0<=K;--K)_[K+E]=this[K+R];else Uint8Array.prototype.set.call(_,this.subarray(R,Y),E);return J},d.prototype.fill=function(_,E,R,Y){if(typeof _=="string"){if(typeof E=="string"?(Y=E,E=0,R=this.length):typeof R=="string"&&(Y=R,R=this.length),Y!==void 0&&typeof Y!="string")throw new TypeError("encoding must be a string");if(typeof Y=="string"&&!d.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);if(_.length===1){var J=_.charCodeAt(0);(Y==="utf8"&&128>J||Y==="latin1")&&(_=J)}}else typeof _=="number"&&(_&=255);if(0>E||this.length<E||this.length<R)throw new RangeError("Out of range index");if(R<=E)return this;E>>>=0,R=R===void 0?this.length:R>>>0,_||(_=0);var K;if(typeof _=="number")for(K=E;K<R;++K)this[K]=_;else{var Ee=d.isBuffer(_)?_:d.from(_,Y),Je=Ee.length;if(Je===0)throw new TypeError('The value "'+_+'" is invalid for argument "value"');for(K=0;K<R-E;++K)this[K+E]=Ee[K%Je]}return this};var B=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,s("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:9}],4:[function(s,o,a){(function(l){(function(){function u(){let d;try{d=a.storage.getItem("debug")}catch{}return!d&&typeof l<"u"&&"env"in l&&(d=l.env.DEBUG),d}a.formatArgs=function(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;d.splice(1,0,f,"color: inherit");let m=0,y=0;d[0].replace(/%[a-zA-Z%]/g,b=>{b==="%%"||(m++,b==="%c"&&(y=m))}),d.splice(y,0,f)},a.save=function(d){try{d?a.storage.setItem("debug",d):a.storage.removeItem("debug")}catch{}},a.load=u,a.useColors=function(){return!!(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},a.storage=function(){try{return localStorage}catch{}}(),a.destroy=(()=>{let d=!1;return()=>{d||(d=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),a.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],a.log=console.debug||console.log||(()=>{}),o.exports=s("./common")(a);const{formatters:g}=o.exports;g.j=function(d){try{return JSON.stringify(d)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}}).call(this)}).call(this,s("_process"))},{"./common":5,_process:12}],5:[function(s,o){o.exports=function(a){function l(d){function f(...b){if(!f.enabled)return;const C=f,S=+new Date,A=S-(m||S);C.diff=A,C.prev=m,C.curr=S,m=S,b[0]=l.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let v=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(T,N)=>{if(T==="%%")return"%";v++;const h=l.formatters[N];if(typeof h=="function"){const I=b[v];T=h.call(C,I),b.splice(v,1),v--}return T}),l.formatArgs.call(C,b),(C.log||l.log).apply(C,b)}let m,y=null;return f.namespace=d,f.useColors=l.useColors(),f.color=l.selectColor(d),f.extend=u,f.destroy=l.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>y===null?l.enabled(d):y,set:b=>{y=b}}),typeof l.init=="function"&&l.init(f),f}function u(d,f){const m=l(this.namespace+(typeof f>"u"?":":f)+d);return m.log=this.log,m}function g(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}return l.debug=l,l.default=l,l.coerce=function(d){return d instanceof Error?d.stack||d.message:d},l.disable=function(){const d=[...l.names.map(g),...l.skips.map(g).map(f=>"-"+f)].join(",");return l.enable(""),d},l.enable=function(d){l.save(d),l.names=[],l.skips=[];let f;const m=(typeof d=="string"?d:"").split(/[\s,]+/),y=m.length;for(f=0;f<y;f++)m[f]&&(d=m[f].replace(/\*/g,".*?"),d[0]==="-"?l.skips.push(new RegExp("^"+d.substr(1)+"$")):l.names.push(new RegExp("^"+d+"$")))},l.enabled=function(d){if(d[d.length-1]==="*")return!0;let f,m;for(f=0,m=l.skips.length;f<m;f++)if(l.skips[f].test(d))return!1;for(f=0,m=l.names.length;f<m;f++)if(l.names[f].test(d))return!0;return!1},l.humanize=s("ms"),l.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(a).forEach(d=>{l[d]=a[d]}),l.names=[],l.skips=[],l.formatters={},l.selectColor=function(d){let f=0;for(let m=0;m<d.length;m++)f=(f<<5)-f+d.charCodeAt(m),f|=0;return l.colors[r(f)%l.colors.length]},l.enable(l.load()),l}},{ms:11}],6:[function(s,o){function a(l,u){for(const g in u)Object.defineProperty(l,g,{value:u[g],enumerable:!0,configurable:!0});return l}o.exports=function(l,u,g){if(!l||typeof l=="string")throw new TypeError("Please pass an Error to err-code");g||(g={}),typeof u=="object"&&(g=u,u=""),u&&(g.code=u);try{return a(l,g)}catch{g.message=l.message,g.stack=l.stack;const f=function(){};return f.prototype=Object.create(Object.getPrototypeOf(l)),a(new f,g)}}},{}],7:[function(s,o){function a(j){console&&console.warn&&console.warn(j)}function l(){l.init.call(this)}function u(j){if(typeof j!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof j)}function g(j){return j._maxListeners===void 0?l.defaultMaxListeners:j._maxListeners}function d(j,P,q,G){var ee,ue,ae;if(u(q),ue=j._events,ue===void 0?(ue=j._events=Object.create(null),j._eventsCount=0):(ue.newListener!==void 0&&(j.emit("newListener",P,q.listener?q.listener:q),ue=j._events),ae=ue[P]),ae===void 0)ae=ue[P]=q,++j._eventsCount;else if(typeof ae=="function"?ae=ue[P]=G?[q,ae]:[ae,q]:G?ae.unshift(q):ae.push(q),ee=g(j),0<ee&&ae.length>ee&&!ae.warned){ae.warned=!0;var ge=new Error("Possible EventEmitter memory leak detected. "+ae.length+" "+(P+" listeners added. Use emitter.setMaxListeners() to increase limit"));ge.name="MaxListenersExceededWarning",ge.emitter=j,ge.type=P,ge.count=ae.length,a(ge)}return j}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(j,P,q){var G={fired:!1,wrapFn:void 0,target:j,type:P,listener:q},ee=f.bind(G);return ee.listener=q,G.wrapFn=ee,ee}function y(j,P,q){var G=j._events;if(G===void 0)return[];var ee=G[P];return ee===void 0?[]:typeof ee=="function"?q?[ee.listener||ee]:[ee]:q?A(ee):C(ee,ee.length)}function b(j){var P=this._events;if(P!==void 0){var q=P[j];if(typeof q=="function")return 1;if(q!==void 0)return q.length}return 0}function C(j,P){for(var q=Array(P),G=0;G<P;++G)q[G]=j[G];return q}function S(j,P){for(;P+1<j.length;P++)j[P]=j[P+1];j.pop()}function A(j){for(var P=Array(j.length),q=0;q<P.length;++q)P[q]=j[q].listener||j[q];return P}function v(j,P,q){typeof j.on=="function"&&k(j,"error",P,q)}function k(j,P,q,G){if(typeof j.on=="function")G.once?j.once(P,q):j.on(P,q);else if(typeof j.addEventListener=="function")j.addEventListener(P,function ee(ue){G.once&&j.removeEventListener(P,ee),q(ue)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof j)}var T,N=typeof Reflect=="object"?Reflect:null,h=N&&typeof N.apply=="function"?N.apply:function(j,P,q){return Function.prototype.apply.call(j,P,q)};T=N&&typeof N.ownKeys=="function"?N.ownKeys:Object.getOwnPropertySymbols?function(j){return Object.getOwnPropertyNames(j).concat(Object.getOwnPropertySymbols(j))}:function(j){return Object.getOwnPropertyNames(j)};var I=Number.isNaN||function(j){return j!==j};o.exports=l,o.exports.once=function(j,P){return new Promise(function(q,G){function ee(ae){j.removeListener(P,ue),G(ae)}function ue(){typeof j.removeListener=="function"&&j.removeListener("error",ee),q([].slice.call(arguments))}k(j,P,ue,{once:!0}),P!=="error"&&v(j,ee,{once:!0})})},l.EventEmitter=l,l.prototype._events=void 0,l.prototype._eventsCount=0,l.prototype._maxListeners=void 0;var O=10;Object.defineProperty(l,"defaultMaxListeners",{enumerable:!0,get:function(){return O},set:function(j){if(typeof j!="number"||0>j||I(j))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+j+".");O=j}}),l.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(j){if(typeof j!="number"||0>j||I(j))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+j+".");return this._maxListeners=j,this},l.prototype.getMaxListeners=function(){return g(this)},l.prototype.emit=function(j){for(var P=[],q=1;q<arguments.length;q++)P.push(arguments[q]);var G=j==="error",ee=this._events;if(ee!==void 0)G=G&&ee.error===void 0;else if(!G)return!1;if(G){var ue;if(0<P.length&&(ue=P[0]),ue instanceof Error)throw ue;var ae=new Error("Unhandled error."+(ue?" ("+ue.message+")":""));throw ae.context=ue,ae}var ge=ee[j];if(ge===void 0)return!1;if(typeof ge=="function")h(ge,this,P);else for(var Le=ge.length,be=C(ge,Le),q=0;q<Le;++q)h(be[q],this,P);return!0},l.prototype.addListener=function(j,P){return d(this,j,P,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(j,P){return d(this,j,P,!0)},l.prototype.once=function(j,P){return u(P),this.on(j,m(this,j,P)),this},l.prototype.prependOnceListener=function(j,P){return u(P),this.prependListener(j,m(this,j,P)),this},l.prototype.removeListener=function(j,P){var q,G,ee,ue,ae;if(u(P),G=this._events,G===void 0)return this;if(q=G[j],q===void 0)return this;if(q===P||q.listener===P)--this._eventsCount==0?this._events=Object.create(null):(delete G[j],G.removeListener&&this.emit("removeListener",j,q.listener||P));else if(typeof q!="function"){for(ee=-1,ue=q.length-1;0<=ue;ue--)if(q[ue]===P||q[ue].listener===P){ae=q[ue].listener,ee=ue;break}if(0>ee)return this;ee===0?q.shift():S(q,ee),q.length===1&&(G[j]=q[0]),G.removeListener!==void 0&&this.emit("removeListener",j,ae||P)}return this},l.prototype.off=l.prototype.removeListener,l.prototype.removeAllListeners=function(j){var P,q,G;if(q=this._events,q===void 0)return this;if(q.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):q[j]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete q[j]),this;if(arguments.length===0){var ee,ue=Object.keys(q);for(G=0;G<ue.length;++G)ee=ue[G],ee!=="removeListener"&&this.removeAllListeners(ee);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(P=q[j],typeof P=="function")this.removeListener(j,P);else if(P!==void 0)for(G=P.length-1;0<=G;G--)this.removeListener(j,P[G]);return this},l.prototype.listeners=function(j){return y(this,j,!0)},l.prototype.rawListeners=function(j){return y(this,j,!1)},l.listenerCount=function(j,P){return typeof j.listenerCount=="function"?j.listenerCount(P):b.call(j,P)},l.prototype.listenerCount=b,l.prototype.eventNames=function(){return 0<this._eventsCount?T(this._events):[]}},{}],8:[function(s,o){o.exports=function(){if(typeof globalThis>"u")return null;var a={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return a.RTCPeerConnection?a:null}},{}],9:[function(s,o,a){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a.read=function(l,u,g,d,f){var m,y,b=8*f-d-1,C=(1<<b)-1,S=C>>1,A=-7,v=g?f-1:0,k=g?-1:1,T=l[u+v];for(v+=k,m=T&(1<<-A)-1,T>>=-A,A+=b;0<A;m=256*m+l[u+v],v+=k,A-=8);for(y=m&(1<<-A)-1,m>>=-A,A+=d;0<A;y=256*y+l[u+v],v+=k,A-=8);if(m===0)m=1-S;else{if(m===C)return y?NaN:(T?-1:1)*(1/0);y+=i(2,d),m-=S}return(T?-1:1)*y*i(2,m-d)},a.write=function(l,u,g,d,f,m){var y,b,C,S=Math.LN2,A=Math.log,v=8*m-f-1,k=(1<<v)-1,T=k>>1,N=f===23?i(2,-24)-i(2,-77):0,h=d?0:m-1,I=d?1:-1,O=0>u||u===0&&0>1/u?1:0;for(u=r(u),isNaN(u)||u===1/0?(b=isNaN(u)?1:0,y=k):(y=t(A(u)/S),1>u*(C=i(2,-y))&&(y--,C*=2),u+=1<=y+T?N/C:N*i(2,1-T),2<=u*C&&(y++,C/=2),y+T>=k?(b=0,y=k):1<=y+T?(b=(u*C-1)*i(2,f),y+=T):(b=u*i(2,T-1)*i(2,f),y=0));8<=f;l[g+h]=255&b,h+=I,b/=256,f-=8);for(y=y<<f|b,v+=f;0<v;l[g+h]=255&y,h+=I,y/=256,v-=8);l[g+h-I]|=128*O}},{}],10:[function(s,o){o.exports=typeof Object.create=="function"?function(a,l){l&&(a.super_=l,a.prototype=Object.create(l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:function(a,l){if(l){a.super_=l;var u=function(){};u.prototype=l.prototype,a.prototype=new u,a.prototype.constructor=a}}},{}],11:[function(s,o){var a=Math.round;function l(f){if(f+="",!(100<f.length)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(m){var y=parseFloat(m[1]),b=(m[2]||"ms").toLowerCase();return b==="years"||b==="year"||b==="yrs"||b==="yr"||b==="y"?315576e5*y:b==="weeks"||b==="week"||b==="w"?6048e5*y:b==="days"||b==="day"||b==="d"?864e5*y:b==="hours"||b==="hour"||b==="hrs"||b==="hr"||b==="h"?36e5*y:b==="minutes"||b==="minute"||b==="mins"||b==="min"||b==="m"?6e4*y:b==="seconds"||b==="second"||b==="secs"||b==="sec"||b==="s"?1e3*y:b==="milliseconds"||b==="millisecond"||b==="msecs"||b==="msec"||b==="ms"?y:void 0}}}function u(f){var m=r(f);return 864e5<=m?a(f/864e5)+"d":36e5<=m?a(f/36e5)+"h":6e4<=m?a(f/6e4)+"m":1e3<=m?a(f/1e3)+"s":f+"ms"}function g(f){var m=r(f);return 864e5<=m?d(f,m,864e5,"day"):36e5<=m?d(f,m,36e5,"hour"):6e4<=m?d(f,m,6e4,"minute"):1e3<=m?d(f,m,1e3,"second"):f+" ms"}function d(f,m,y,b){return a(f/y)+" "+b+(m>=1.5*y?"s":"")}o.exports=function(f,m){m=m||{};var y=typeof f;if(y=="string"&&0<f.length)return l(f);if(y==="number"&&isFinite(f))return m.long?g(f):u(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))}},{}],12:[function(s,o){function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function u(N){if(b===setTimeout)return setTimeout(N,0);if((b===a||!b)&&setTimeout)return b=setTimeout,setTimeout(N,0);try{return b(N,0)}catch{try{return b.call(null,N,0)}catch{return b.call(this,N,0)}}}function g(N){if(C===clearTimeout)return clearTimeout(N);if((C===l||!C)&&clearTimeout)return C=clearTimeout,clearTimeout(N);try{return C(N)}catch{try{return C.call(null,N)}catch{return C.call(this,N)}}}function d(){k&&A&&(k=!1,A.length?v=A.concat(v):T=-1,v.length&&f())}function f(){if(!k){var N=u(d);k=!0;for(var h=v.length;h;){for(A=v,v=[];++T<h;)A&&A[T].run();T=-1,h=v.length}A=null,k=!1,g(N)}}function m(N,h){this.fun=N,this.array=h}function y(){}var b,C,S=o.exports={};(function(){try{b=typeof setTimeout=="function"?setTimeout:a}catch{b=a}try{C=typeof clearTimeout=="function"?clearTimeout:l}catch{C=l}})();var A,v=[],k=!1,T=-1;S.nextTick=function(N){var h=Array(arguments.length-1);if(1<arguments.length)for(var I=1;I<arguments.length;I++)h[I-1]=arguments[I];v.push(new m(N,h)),v.length!==1||k||u(f)},m.prototype.run=function(){this.fun.apply(null,this.array)},S.title="browser",S.browser=!0,S.env={},S.argv=[],S.version="",S.versions={},S.on=y,S.addListener=y,S.once=y,S.off=y,S.removeListener=y,S.removeAllListeners=y,S.emit=y,S.prependListener=y,S.prependOnceListener=y,S.listeners=function(){return[]},S.binding=function(){throw new Error("process.binding is not supported")},S.cwd=function(){return"/"},S.chdir=function(){throw new Error("process.chdir is not supported")},S.umask=function(){return 0}},{}],13:[function(s,o){(function(a){(function(){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */let l;o.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window>"u"?a:window):u=>(l||(l=Promise.resolve())).then(u).catch(g=>setTimeout(()=>{throw g},0))}).call(this)}).call(this,typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{}],14:[function(s,o){(function(a,l){(function(){var u=s("safe-buffer").Buffer,g=l.crypto||l.msCrypto;o.exports=g&&g.getRandomValues?function(d,f){if(d>4294967295)throw new RangeError("requested too many random bytes");var m=u.allocUnsafe(d);if(0<d)if(65536<d)for(var y=0;y<d;y+=65536)g.getRandomValues(m.slice(y,y+65536));else g.getRandomValues(m);return typeof f=="function"?a.nextTick(function(){f(null,m)}):m}:function(){throw new Error(`Secure random number generation is not supported by this browser.
42
+ Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,s("_process"),typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{_process:12,"safe-buffer":30}],15:[function(s,o){function a(y,b){y.prototype=Object.create(b.prototype),y.prototype.constructor=y,y.__proto__=b}function l(y,b,C){function S(v,k,T){return typeof b=="string"?b:b(v,k,T)}C||(C=Error);var A=function(v){function k(T,N,h){return v.call(this,S(T,N,h))||this}return a(k,v),k}(C);A.prototype.name=C.name,A.prototype.code=y,m[y]=A}function u(y,b){if(Array.isArray(y)){var C=y.length;return y=y.map(function(S){return S+""}),2<C?"one of ".concat(b," ").concat(y.slice(0,C-1).join(", "),", or ")+y[C-1]:C===2?"one of ".concat(b," ").concat(y[0]," or ").concat(y[1]):"of ".concat(b," ").concat(y[0])}return"of ".concat(b," ").concat(y+"")}function g(y,b,C){return y.substr(!C||0>C?0:+C,b.length)===b}function d(y,b,C){return(C===void 0||C>y.length)&&(C=y.length),y.substring(C-b.length,C)===b}function f(y,b,C){return typeof C!="number"&&(C=0),!(C+b.length>y.length)&&y.indexOf(b,C)!==-1}var m={};l("ERR_INVALID_OPT_VALUE",function(y,b){return'The value "'+b+'" is invalid for option "'+y+'"'},TypeError),l("ERR_INVALID_ARG_TYPE",function(y,b,C){var S;typeof b=="string"&&g(b,"not ")?(S="must not be",b=b.replace(/^not /,"")):S="must be";var A;if(d(y," argument"))A="The ".concat(y," ").concat(S," ").concat(u(b,"type"));else{var v=f(y,".")?"property":"argument";A='The "'.concat(y,'" ').concat(v," ").concat(S," ").concat(u(b,"type"))}return A+=". Received type ".concat(typeof C),A},TypeError),l("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),l("ERR_METHOD_NOT_IMPLEMENTED",function(y){return"The "+y+" method is not implemented"}),l("ERR_STREAM_PREMATURE_CLOSE","Premature close"),l("ERR_STREAM_DESTROYED",function(y){return"Cannot call "+y+" after a stream was destroyed"}),l("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),l("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),l("ERR_STREAM_WRITE_AFTER_END","write after end"),l("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),l("ERR_UNKNOWN_ENCODING",function(y){return"Unknown encoding: "+y},TypeError),l("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=m},{}],16:[function(s,o){(function(a){(function(){function l(S){return this instanceof l?(f.call(this,S),m.call(this,S),this.allowHalfOpen=!0,void(S&&(S.readable===!1&&(this.readable=!1),S.writable===!1&&(this.writable=!1),S.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u))))):new l(S)}function u(){this._writableState.ended||a.nextTick(g,this)}function g(S){S.end()}var d=Object.keys||function(S){var A=[];for(var v in S)A.push(v);return A};o.exports=l;var f=s("./_stream_readable"),m=s("./_stream_writable");s("inherits")(l,f);for(var y,b=d(m.prototype),C=0;C<b.length;C++)y=b[C],l.prototype[y]||(l.prototype[y]=m.prototype[y]);Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this)}).call(this,s("_process"))},{"./_stream_readable":18,"./_stream_writable":20,_process:12,inherits:10}],17:[function(s,o){function a(u){return this instanceof a?void l.call(this,u):new a(u)}o.exports=a;var l=s("./_stream_transform");s("inherits")(a,l),a.prototype._transform=function(u,g,d){d(null,u)}},{"./_stream_transform":19,inherits:10}],18:[function(s,o){(function(a,l){(function(){function u(B){return Ce.from(B)}function g(B){return Ce.isBuffer(B)||B instanceof Te}function d(B,_,E){return typeof B.prependListener=="function"?B.prependListener(_,E):void(B._events&&B._events[_]?Array.isArray(B._events[_])?B._events[_].unshift(E):B._events[_]=[E,B._events[_]]:B.on(_,E))}function f(B,_,E){Le=Le||s("./_stream_duplex"),B=B||{},typeof E!="boolean"&&(E=_ instanceof Le),this.objectMode=!!B.objectMode,E&&(this.objectMode=this.objectMode||!!B.readableObjectMode),this.highWaterMark=ft(this,B,"readableHighWaterMark",E),this.buffer=new ze,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=B.emitClose!==!1,this.autoDestroy=!!B.autoDestroy,this.destroyed=!1,this.defaultEncoding=B.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,B.encoding&&(!Fe&&(Fe=s("string_decoder/").StringDecoder),this.decoder=new Fe(B.encoding),this.encoding=B.encoding)}function m(B){if(Le=Le||s("./_stream_duplex"),!(this instanceof m))return new m(B);var _=this instanceof Le;this._readableState=new f(B,this,_),this.readable=!0,B&&(typeof B.read=="function"&&(this._read=B.read),typeof B.destroy=="function"&&(this._destroy=B.destroy)),fe.call(this)}function y(B,_,E,R,Y){be("readableAddChunk",_);var J=B._readableState;if(_===null)J.reading=!1,v(B,J);else{var K;if(Y||(K=C(J,_)),K)ye(B,K);else if(!(J.objectMode||_&&0<_.length))R||(J.reading=!1,N(B,J));else if(typeof _=="string"||J.objectMode||Object.getPrototypeOf(_)===Ce.prototype||(_=u(_)),R)J.endEmitted?ye(B,new re):b(B,J,_,!0);else if(J.ended)ye(B,new Wt);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!E?(_=J.decoder.write(_),J.objectMode||_.length!==0?b(B,J,_,!1):N(B,J)):b(B,J,_,!1)}}return!J.ended&&(J.length<J.highWaterMark||J.length===0)}function b(B,_,E,R){_.flowing&&_.length===0&&!_.sync?(_.awaitDrain=0,B.emit("data",E)):(_.length+=_.objectMode?1:E.length,R?_.buffer.unshift(E):_.buffer.push(E),_.needReadable&&k(B)),N(B,_)}function C(B,_){var E;return g(_)||typeof _=="string"||_===void 0||B.objectMode||(E=new yt("chunk",["string","Buffer","Uint8Array"],_)),E}function S(B){return 1073741824<=B?B=1073741824:(B--,B|=B>>>1,B|=B>>>2,B|=B>>>4,B|=B>>>8,B|=B>>>16,B++),B}function A(B,_){return 0>=B||_.length===0&&_.ended?0:_.objectMode?1:B===B?(B>_.highWaterMark&&(_.highWaterMark=S(B)),B<=_.length?B:_.ended?_.length:(_.needReadable=!0,0)):_.flowing&&_.length?_.buffer.head.data.length:_.length}function v(B,_){if(be("onEofChunk"),!_.ended){if(_.decoder){var E=_.decoder.end();E&&E.length&&(_.buffer.push(E),_.length+=_.objectMode?1:E.length)}_.ended=!0,_.sync?k(B):(_.needReadable=!1,!_.emittedReadable&&(_.emittedReadable=!0,T(B)))}}function k(B){var _=B._readableState;be("emitReadable",_.needReadable,_.emittedReadable),_.needReadable=!1,_.emittedReadable||(be("emitReadable",_.flowing),_.emittedReadable=!0,a.nextTick(T,B))}function T(B){var _=B._readableState;be("emitReadable_",_.destroyed,_.length,_.ended),!_.destroyed&&(_.length||_.ended)&&(B.emit("readable"),_.emittedReadable=!1),_.needReadable=!_.flowing&&!_.ended&&_.length<=_.highWaterMark,G(B)}function N(B,_){_.readingMore||(_.readingMore=!0,a.nextTick(h,B,_))}function h(B,_){for(;!_.reading&&!_.ended&&(_.length<_.highWaterMark||_.flowing&&_.length===0);){var E=_.length;if(be("maybeReadMore read 0"),B.read(0),E===_.length)break}_.readingMore=!1}function I(B){return function(){var _=B._readableState;be("pipeOnDrain",_.awaitDrain),_.awaitDrain&&_.awaitDrain--,_.awaitDrain===0&&oe(B,"data")&&(_.flowing=!0,G(B))}}function O(B){var _=B._readableState;_.readableListening=0<B.listenerCount("readable"),_.resumeScheduled&&!_.paused?_.flowing=!0:0<B.listenerCount("data")&&B.resume()}function j(B){be("readable nexttick read 0"),B.read(0)}function P(B,_){_.resumeScheduled||(_.resumeScheduled=!0,a.nextTick(q,B,_))}function q(B,_){be("resume",_.reading),_.reading||B.read(0),_.resumeScheduled=!1,B.emit("resume"),G(B),_.flowing&&!_.reading&&B.read(0)}function G(B){var _=B._readableState;for(be("flow",_.flowing);_.flowing&&B.read()!==null;);}function ee(B,_){if(_.length===0)return null;var E;return _.objectMode?E=_.buffer.shift():!B||B>=_.length?(E=_.decoder?_.buffer.join(""):_.buffer.length===1?_.buffer.first():_.buffer.concat(_.length),_.buffer.clear()):E=_.buffer.consume(B,_.decoder),E}function ue(B){var _=B._readableState;be("endReadable",_.endEmitted),_.endEmitted||(_.ended=!0,a.nextTick(ae,_,B))}function ae(B,_){if(be("endReadableNT",B.endEmitted,B.length),!B.endEmitted&&B.length===0&&(B.endEmitted=!0,_.readable=!1,_.emit("end"),B.autoDestroy)){var E=_._writableState;(!E||E.autoDestroy&&E.finished)&&_.destroy()}}function ge(B,_){for(var E=0,R=B.length;E<R;E++)if(B[E]===_)return E;return-1}o.exports=m;var Le;m.ReadableState=f;var be;s("events").EventEmitter;var oe=function(B,_){return B.listeners(_).length},fe=s("./internal/streams/stream"),Ce=s("buffer").Buffer,Te=l.Uint8Array||function(){},ve=s("util");be=ve&&ve.debuglog?ve.debuglog("stream"):function(){};var Fe,De,ke,ze=s("./internal/streams/buffer_list"),xe=s("./internal/streams/destroy"),Pe=s("./internal/streams/state"),ft=Pe.getHighWaterMark,we=s("../errors").codes,yt=we.ERR_INVALID_ARG_TYPE,Wt=we.ERR_STREAM_PUSH_AFTER_EOF,Z=we.ERR_METHOD_NOT_IMPLEMENTED,re=we.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;s("inherits")(m,fe);var ye=xe.errorOrDestroy,Ae=["error","close","destroy","pause","resume"];Object.defineProperty(m.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(B){this._readableState&&(this._readableState.destroyed=B)}}),m.prototype.destroy=xe.destroy,m.prototype._undestroy=xe.undestroy,m.prototype._destroy=function(B,_){_(B)},m.prototype.push=function(B,_){var E,R=this._readableState;return R.objectMode?E=!0:typeof B=="string"&&(_=_||R.defaultEncoding,_!==R.encoding&&(B=Ce.from(B,_),_=""),E=!0),y(this,B,_,!1,E)},m.prototype.unshift=function(B){return y(this,B,null,!0,!1)},m.prototype.isPaused=function(){return this._readableState.flowing===!1},m.prototype.setEncoding=function(B){Fe||(Fe=s("string_decoder/").StringDecoder);var _=new Fe(B);this._readableState.decoder=_,this._readableState.encoding=this._readableState.decoder.encoding;for(var E=this._readableState.buffer.head,R="";E!==null;)R+=_.write(E.data),E=E.next;return this._readableState.buffer.clear(),R!==""&&this._readableState.buffer.push(R),this._readableState.length=R.length,this},m.prototype.read=function(B){be("read",B),B=parseInt(B,10);var _=this._readableState,E=B;if(B!==0&&(_.emittedReadable=!1),B===0&&_.needReadable&&((_.highWaterMark===0?0<_.length:_.length>=_.highWaterMark)||_.ended))return be("read: emitReadable",_.length,_.ended),_.length===0&&_.ended?ue(this):k(this),null;if(B=A(B,_),B===0&&_.ended)return _.length===0&&ue(this),null;var R=_.needReadable;be("need readable",R),(_.length===0||_.length-B<_.highWaterMark)&&(R=!0,be("length less than watermark",R)),_.ended||_.reading?(R=!1,be("reading or ended",R)):R&&(be("do read"),_.reading=!0,_.sync=!0,_.length===0&&(_.needReadable=!0),this._read(_.highWaterMark),_.sync=!1,!_.reading&&(B=A(E,_)));var Y;return Y=0<B?ee(B,_):null,Y===null?(_.needReadable=_.length<=_.highWaterMark,B=0):(_.length-=B,_.awaitDrain=0),_.length===0&&(!_.ended&&(_.needReadable=!0),E!==B&&_.ended&&ue(this)),Y!==null&&this.emit("data",Y),Y},m.prototype._read=function(){ye(this,new Z("_read()"))},m.prototype.pipe=function(B,_){function E(qt,Gn){be("onunpipe"),qt===Ze&&Gn&&Gn.hasUnpiped===!1&&(Gn.hasUnpiped=!0,Y())}function R(){be("onend"),B.end()}function Y(){be("cleanup"),B.removeListener("close",Ee),B.removeListener("finish",Je),B.removeListener("drain",Vt),B.removeListener("error",K),B.removeListener("unpipe",E),Ze.removeListener("end",R),Ze.removeListener("end",Ct),Ze.removeListener("data",J),hn=!0,Ge.awaitDrain&&(!B._writableState||B._writableState.needDrain)&&Vt()}function J(qt){be("ondata");var Gn=B.write(qt);be("dest.write",Gn),Gn===!1&&((Ge.pipesCount===1&&Ge.pipes===B||1<Ge.pipesCount&&ge(Ge.pipes,B)!==-1)&&!hn&&(be("false write response, pause",Ge.awaitDrain),Ge.awaitDrain++),Ze.pause())}function K(qt){be("onerror",qt),Ct(),B.removeListener("error",K),oe(B,"error")===0&&ye(B,qt)}function Ee(){B.removeListener("finish",Je),Ct()}function Je(){be("onfinish"),B.removeListener("close",Ee),Ct()}function Ct(){be("unpipe"),Ze.unpipe(B)}var Ze=this,Ge=this._readableState;switch(Ge.pipesCount){case 0:Ge.pipes=B;break;case 1:Ge.pipes=[Ge.pipes,B];break;default:Ge.pipes.push(B)}Ge.pipesCount+=1,be("pipe count=%d opts=%j",Ge.pipesCount,_);var Ft=(!_||_.end!==!1)&&B!==a.stdout&&B!==a.stderr,wn=Ft?R:Ct;Ge.endEmitted?a.nextTick(wn):Ze.once("end",wn),B.on("unpipe",E);var Vt=I(Ze);B.on("drain",Vt);var hn=!1;return Ze.on("data",J),d(B,"error",K),B.once("close",Ee),B.once("finish",Je),B.emit("pipe",Ze),Ge.flowing||(be("pipe resume"),Ze.resume()),B},m.prototype.unpipe=function(B){var _=this._readableState,E={hasUnpiped:!1};if(_.pipesCount===0)return this;if(_.pipesCount===1)return B&&B!==_.pipes?this:(B||(B=_.pipes),_.pipes=null,_.pipesCount=0,_.flowing=!1,B&&B.emit("unpipe",this,E),this);if(!B){var R=_.pipes,Y=_.pipesCount;_.pipes=null,_.pipesCount=0,_.flowing=!1;for(var J=0;J<Y;J++)R[J].emit("unpipe",this,{hasUnpiped:!1});return this}var K=ge(_.pipes,B);return K===-1?this:(_.pipes.splice(K,1),_.pipesCount-=1,_.pipesCount===1&&(_.pipes=_.pipes[0]),B.emit("unpipe",this,E),this)},m.prototype.on=function(B,_){var E=fe.prototype.on.call(this,B,_),R=this._readableState;return B==="data"?(R.readableListening=0<this.listenerCount("readable"),R.flowing!==!1&&this.resume()):B=="readable"&&!R.endEmitted&&!R.readableListening&&(R.readableListening=R.needReadable=!0,R.flowing=!1,R.emittedReadable=!1,be("on readable",R.length,R.reading),R.length?k(this):!R.reading&&a.nextTick(j,this)),E},m.prototype.addListener=m.prototype.on,m.prototype.removeListener=function(B,_){var E=fe.prototype.removeListener.call(this,B,_);return B==="readable"&&a.nextTick(O,this),E},m.prototype.removeAllListeners=function(B){var _=fe.prototype.removeAllListeners.apply(this,arguments);return(B==="readable"||B===void 0)&&a.nextTick(O,this),_},m.prototype.resume=function(){var B=this._readableState;return B.flowing||(be("resume"),B.flowing=!B.readableListening,P(this,B)),B.paused=!1,this},m.prototype.pause=function(){return be("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(be("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},m.prototype.wrap=function(B){var _=this,E=this._readableState,R=!1;for(var Y in B.on("end",function(){if(be("wrapped end"),E.decoder&&!E.ended){var K=E.decoder.end();K&&K.length&&_.push(K)}_.push(null)}),B.on("data",function(K){if(be("wrapped data"),E.decoder&&(K=E.decoder.write(K)),!(E.objectMode&&K==null)&&(E.objectMode||K&&K.length)){var Ee=_.push(K);Ee||(R=!0,B.pause())}}),B)this[Y]===void 0&&typeof B[Y]=="function"&&(this[Y]=function(K){return function(){return B[K].apply(B,arguments)}}(Y));for(var J=0;J<Ae.length;J++)B.on(Ae[J],this.emit.bind(this,Ae[J]));return this._read=function(K){be("wrapped _read",K),R&&(R=!1,B.resume())},this},typeof Symbol=="function"&&(m.prototype[Symbol.asyncIterator]=function(){return De===void 0&&(De=s("./internal/streams/async_iterator")),De(this)}),Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(m.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(m.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(B){this._readableState&&(this._readableState.flowing=B)}}),m._fromList=ee,Object.defineProperty(m.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(m.from=function(B,_){return ke===void 0&&(ke=s("./internal/streams/from")),ke(m,B,_)})}).call(this)}).call(this,s("_process"),typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/async_iterator":21,"./internal/streams/buffer_list":22,"./internal/streams/destroy":23,"./internal/streams/from":25,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,events:7,inherits:10,"string_decoder/":31,util:2}],19:[function(s,o){function a(S,A){var v=this._transformState;v.transforming=!1;var k=v.writecb;if(k===null)return this.emit("error",new m);v.writechunk=null,v.writecb=null,A!=null&&this.push(A),k(S);var T=this._readableState;T.reading=!1,(T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}function l(S){return this instanceof l?(C.call(this,S),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,S&&(typeof S.transform=="function"&&(this._transform=S.transform),typeof S.flush=="function"&&(this._flush=S.flush)),void this.on("prefinish",u)):new l(S)}function u(){var S=this;typeof this._flush!="function"||this._readableState.destroyed?g(this,null,null):this._flush(function(A,v){g(S,A,v)})}function g(S,A,v){if(A)return S.emit("error",A);if(v!=null&&S.push(v),S._writableState.length)throw new b;if(S._transformState.transforming)throw new y;return S.push(null)}o.exports=l;var d=s("../errors").codes,f=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_TRANSFORM_ALREADY_TRANSFORMING,b=d.ERR_TRANSFORM_WITH_LENGTH_0,C=s("./_stream_duplex");s("inherits")(l,C),l.prototype.push=function(S,A){return this._transformState.needTransform=!1,C.prototype.push.call(this,S,A)},l.prototype._transform=function(S,A,v){v(new f("_transform()"))},l.prototype._write=function(S,A,v){var k=this._transformState;if(k.writecb=v,k.writechunk=S,k.writeencoding=A,!k.transforming){var T=this._readableState;(k.needTransform||T.needReadable||T.length<T.highWaterMark)&&this._read(T.highWaterMark)}},l.prototype._read=function(){var S=this._transformState;S.writechunk===null||S.transforming?S.needTransform=!0:(S.transforming=!0,this._transform(S.writechunk,S.writeencoding,S.afterTransform))},l.prototype._destroy=function(S,A){C.prototype._destroy.call(this,S,function(v){A(v)})}},{"../errors":15,"./_stream_duplex":16,inherits:10}],20:[function(s,o){(function(a,l){(function(){function u(Z){var re=this;this.next=null,this.entry=null,this.finish=function(){ue(re,Z)}}function g(Z){return be.from(Z)}function d(Z){return be.isBuffer(Z)||Z instanceof oe}function f(){}function m(Z,re,ye){ae=ae||s("./_stream_duplex"),Z=Z||{},typeof ye!="boolean"&&(ye=re instanceof ae),this.objectMode=!!Z.objectMode,ye&&(this.objectMode=this.objectMode||!!Z.writableObjectMode),this.highWaterMark=Te(this,Z,"writableHighWaterMark",ye),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Ae=Z.decodeStrings===!1;this.decodeStrings=!Ae,this.defaultEncoding=Z.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(B){N(re,B)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Z.emitClose!==!1,this.autoDestroy=!!Z.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new u(this)}function y(Z){ae=ae||s("./_stream_duplex");var re=this instanceof ae;return re||Wt.call(y,this)?(this._writableState=new m(Z,this,re),this.writable=!0,Z&&(typeof Z.write=="function"&&(this._write=Z.write),typeof Z.writev=="function"&&(this._writev=Z.writev),typeof Z.destroy=="function"&&(this._destroy=Z.destroy),typeof Z.final=="function"&&(this._final=Z.final)),void Le.call(this)):new y(Z)}function b(Z,re){var ye=new ft;yt(Z,ye),a.nextTick(re,ye)}function C(Z,re,ye,Ae){var B;return ye===null?B=new Pe:typeof ye!="string"&&!re.objectMode&&(B=new Fe("chunk",["string","Buffer"],ye)),!B||(yt(Z,B),a.nextTick(Ae,B),!1)}function S(Z,re,ye){return Z.objectMode||Z.decodeStrings===!1||typeof re!="string"||(re=be.from(re,ye)),re}function A(Z,re,ye,Ae,B,_){if(!ye){var E=S(re,Ae,B);Ae!==E&&(ye=!0,B="buffer",Ae=E)}var R=re.objectMode?1:Ae.length;re.length+=R;var Y=re.length<re.highWaterMark;if(Y||(re.needDrain=!0),re.writing||re.corked){var J=re.lastBufferedRequest;re.lastBufferedRequest={chunk:Ae,encoding:B,isBuf:ye,callback:_,next:null},J?J.next=re.lastBufferedRequest:re.bufferedRequest=re.lastBufferedRequest,re.bufferedRequestCount+=1}else v(Z,re,!1,R,Ae,B,_);return Y}function v(Z,re,ye,Ae,B,_,E){re.writelen=Ae,re.writecb=E,re.writing=!0,re.sync=!0,re.destroyed?re.onwrite(new xe("write")):ye?Z._writev(B,re.onwrite):Z._write(B,_,re.onwrite),re.sync=!1}function k(Z,re,ye,Ae,B){--re.pendingcb,ye?(a.nextTick(B,Ae),a.nextTick(G,Z,re),Z._writableState.errorEmitted=!0,yt(Z,Ae)):(B(Ae),Z._writableState.errorEmitted=!0,yt(Z,Ae),G(Z,re))}function T(Z){Z.writing=!1,Z.writecb=null,Z.length-=Z.writelen,Z.writelen=0}function N(Z,re){var ye=Z._writableState,Ae=ye.sync,B=ye.writecb;if(typeof B!="function")throw new ke;if(T(ye),re)k(Z,ye,Ae,re,B);else{var _=j(ye)||Z.destroyed;_||ye.corked||ye.bufferProcessing||!ye.bufferedRequest||O(Z,ye),Ae?a.nextTick(h,Z,ye,_,B):h(Z,ye,_,B)}}function h(Z,re,ye,Ae){ye||I(Z,re),re.pendingcb--,Ae(),G(Z,re)}function I(Z,re){re.length===0&&re.needDrain&&(re.needDrain=!1,Z.emit("drain"))}function O(Z,re){re.bufferProcessing=!0;var ye=re.bufferedRequest;if(Z._writev&&ye&&ye.next){var Ae=re.bufferedRequestCount,B=Array(Ae),_=re.corkedRequestsFree;_.entry=ye;for(var E=0,R=!0;ye;)B[E]=ye,ye.isBuf||(R=!1),ye=ye.next,E+=1;B.allBuffers=R,v(Z,re,!0,re.length,B,"",_.finish),re.pendingcb++,re.lastBufferedRequest=null,_.next?(re.corkedRequestsFree=_.next,_.next=null):re.corkedRequestsFree=new u(re),re.bufferedRequestCount=0}else{for(;ye;){var Y=ye.chunk,J=ye.encoding,K=ye.callback,Ee=re.objectMode?1:Y.length;if(v(Z,re,!1,Ee,Y,J,K),ye=ye.next,re.bufferedRequestCount--,re.writing)break}ye===null&&(re.lastBufferedRequest=null)}re.bufferedRequest=ye,re.bufferProcessing=!1}function j(Z){return Z.ending&&Z.length===0&&Z.bufferedRequest===null&&!Z.finished&&!Z.writing}function P(Z,re){Z._final(function(ye){re.pendingcb--,ye&&yt(Z,ye),re.prefinished=!0,Z.emit("prefinish"),G(Z,re)})}function q(Z,re){re.prefinished||re.finalCalled||(typeof Z._final!="function"||re.destroyed?(re.prefinished=!0,Z.emit("prefinish")):(re.pendingcb++,re.finalCalled=!0,a.nextTick(P,Z,re)))}function G(Z,re){var ye=j(re);if(ye&&(q(Z,re),re.pendingcb===0&&(re.finished=!0,Z.emit("finish"),re.autoDestroy))){var Ae=Z._readableState;(!Ae||Ae.autoDestroy&&Ae.endEmitted)&&Z.destroy()}return ye}function ee(Z,re,ye){re.ending=!0,G(Z,re),ye&&(re.finished?a.nextTick(ye):Z.once("finish",ye)),re.ended=!0,Z.writable=!1}function ue(Z,re,ye){var Ae=Z.entry;for(Z.entry=null;Ae;){var B=Ae.callback;re.pendingcb--,B(ye),Ae=Ae.next}re.corkedRequestsFree.next=Z}o.exports=y;var ae;y.WritableState=m;var ge={deprecate:s("util-deprecate")},Le=s("./internal/streams/stream"),be=s("buffer").Buffer,oe=l.Uint8Array||function(){},fe=s("./internal/streams/destroy"),Ce=s("./internal/streams/state"),Te=Ce.getHighWaterMark,ve=s("../errors").codes,Fe=ve.ERR_INVALID_ARG_TYPE,De=ve.ERR_METHOD_NOT_IMPLEMENTED,ke=ve.ERR_MULTIPLE_CALLBACK,ze=ve.ERR_STREAM_CANNOT_PIPE,xe=ve.ERR_STREAM_DESTROYED,Pe=ve.ERR_STREAM_NULL_VALUES,ft=ve.ERR_STREAM_WRITE_AFTER_END,we=ve.ERR_UNKNOWN_ENCODING,yt=fe.errorOrDestroy;s("inherits")(y,Le),m.prototype.getBuffer=function(){for(var Z=this.bufferedRequest,re=[];Z;)re.push(Z),Z=Z.next;return re},function(){try{Object.defineProperty(m.prototype,"buffer",{get:ge.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var Wt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Wt=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(Z){return!!Wt.call(this,Z)||this===y&&Z&&Z._writableState instanceof m}})):Wt=function(Z){return Z instanceof this},y.prototype.pipe=function(){yt(this,new ze)},y.prototype.write=function(Z,re,ye){var Ae=this._writableState,B=!1,_=!Ae.objectMode&&d(Z);return _&&!be.isBuffer(Z)&&(Z=g(Z)),typeof re=="function"&&(ye=re,re=null),_?re="buffer":!re&&(re=Ae.defaultEncoding),typeof ye!="function"&&(ye=f),Ae.ending?b(this,ye):(_||C(this,Ae,Z,ye))&&(Ae.pendingcb++,B=A(this,Ae,_,Z,re,ye)),B},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var Z=this._writableState;Z.corked&&(Z.corked--,!Z.writing&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&O(this,Z))},y.prototype.setDefaultEncoding=function(Z){if(typeof Z=="string"&&(Z=Z.toLowerCase()),!(-1<["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Z+"").toLowerCase())))throw new we(Z);return this._writableState.defaultEncoding=Z,this},Object.defineProperty(y.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(Z,re,ye){ye(new De("_write()"))},y.prototype._writev=null,y.prototype.end=function(Z,re,ye){var Ae=this._writableState;return typeof Z=="function"?(ye=Z,Z=null,re=null):typeof re=="function"&&(ye=re,re=null),Z!=null&&this.write(Z,re),Ae.corked&&(Ae.corked=1,this.uncork()),Ae.ending||ee(this,Ae,ye),this},Object.defineProperty(y.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(y.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(Z){this._writableState&&(this._writableState.destroyed=Z)}}),y.prototype.destroy=fe.destroy,y.prototype._undestroy=fe.undestroy,y.prototype._destroy=function(Z,re){re(Z)}}).call(this)}).call(this,s("_process"),typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{"../errors":15,"./_stream_duplex":16,"./internal/streams/destroy":23,"./internal/streams/state":27,"./internal/streams/stream":28,_process:12,buffer:3,inherits:10,"util-deprecate":32}],21:[function(s,o){(function(a){(function(){function l(I,O,j){return O in I?Object.defineProperty(I,O,{value:j,enumerable:!0,configurable:!0,writable:!0}):I[O]=j,I}function u(I,O){return{value:I,done:O}}function g(I){var O=I[b];if(O!==null){var j=I[T].read();j!==null&&(I[v]=null,I[b]=null,I[C]=null,O(u(j,!1)))}}function d(I){a.nextTick(g,I)}function f(I,O){return function(j,P){I.then(function(){return O[A]?void j(u(void 0,!0)):void O[k](j,P)},P)}}var m,y=s("./end-of-stream"),b=Symbol("lastResolve"),C=Symbol("lastReject"),S=Symbol("error"),A=Symbol("ended"),v=Symbol("lastPromise"),k=Symbol("handlePromise"),T=Symbol("stream"),N=Object.getPrototypeOf(function(){}),h=Object.setPrototypeOf((m={get stream(){return this[T]},next:function(){var I=this,O=this[S];if(O!==null)return Promise.reject(O);if(this[A])return Promise.resolve(u(void 0,!0));if(this[T].destroyed)return new Promise(function(G,ee){a.nextTick(function(){I[S]?ee(I[S]):G(u(void 0,!0))})});var j,P=this[v];if(P)j=new Promise(f(P,this));else{var q=this[T].read();if(q!==null)return Promise.resolve(u(q,!1));j=new Promise(this[k])}return this[v]=j,j}},l(m,Symbol.asyncIterator,function(){return this}),l(m,"return",function(){var I=this;return new Promise(function(O,j){I[T].destroy(null,function(P){return P?void j(P):void O(u(void 0,!0))})})}),m),N);o.exports=function(I){var O,j=Object.create(h,(O={},l(O,T,{value:I,writable:!0}),l(O,b,{value:null,writable:!0}),l(O,C,{value:null,writable:!0}),l(O,S,{value:null,writable:!0}),l(O,A,{value:I._readableState.endEmitted,writable:!0}),l(O,k,{value:function(P,q){var G=j[T].read();G?(j[v]=null,j[b]=null,j[C]=null,P(u(G,!1))):(j[b]=P,j[C]=q)},writable:!0}),O));return j[v]=null,y(I,function(P){if(P&&P.code!=="ERR_STREAM_PREMATURE_CLOSE"){var q=j[C];return q!==null&&(j[v]=null,j[b]=null,j[C]=null,q(P)),void(j[S]=P)}var G=j[b];G!==null&&(j[v]=null,j[b]=null,j[C]=null,G(u(void 0,!0))),j[A]=!0}),I.on("readable",d.bind(null,j)),j}}).call(this)}).call(this,s("_process"))},{"./end-of-stream":24,_process:12}],22:[function(s,o){function a(v,k){var T=Object.keys(v);if(Object.getOwnPropertySymbols){var N=Object.getOwnPropertySymbols(v);k&&(N=N.filter(function(h){return Object.getOwnPropertyDescriptor(v,h).enumerable})),T.push.apply(T,N)}return T}function l(v){for(var k,T=1;T<arguments.length;T++)k=arguments[T]==null?{}:arguments[T],T%2?a(Object(k),!0).forEach(function(N){u(v,N,k[N])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(k)):a(Object(k)).forEach(function(N){Object.defineProperty(v,N,Object.getOwnPropertyDescriptor(k,N))});return v}function u(v,k,T){return k in v?Object.defineProperty(v,k,{value:T,enumerable:!0,configurable:!0,writable:!0}):v[k]=T,v}function g(v,k){if(!(v instanceof k))throw new TypeError("Cannot call a class as a function")}function d(v,k){for(var T,N=0;N<k.length;N++)T=k[N],T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,T.key,T)}function f(v,k,T){return k&&d(v.prototype,k),T&&d(v,T),v}function m(v,k,T){b.prototype.copy.call(v,k,T)}var y=s("buffer"),b=y.Buffer,C=s("util"),S=C.inspect,A=S&&S.custom||"inspect";o.exports=function(){function v(){g(this,v),this.head=null,this.tail=null,this.length=0}return f(v,[{key:"push",value:function(k){var T={data:k,next:null};0<this.length?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(k){var T={data:k,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var k=this.head.data;return this.head=this.length===1?this.tail=null:this.head.next,--this.length,k}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(k){if(this.length===0)return"";for(var T=this.head,N=""+T.data;T=T.next;)N+=k+T.data;return N}},{key:"concat",value:function(k){if(this.length===0)return b.alloc(0);for(var T=b.allocUnsafe(k>>>0),N=this.head,h=0;N;)m(N.data,T,h),h+=N.data.length,N=N.next;return T}},{key:"consume",value:function(k,T){var N;return k<this.head.data.length?(N=this.head.data.slice(0,k),this.head.data=this.head.data.slice(k)):k===this.head.data.length?N=this.shift():N=T?this._getString(k):this._getBuffer(k),N}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(k){var T=this.head,N=1,h=T.data;for(k-=h.length;T=T.next;){var I=T.data,O=k>I.length?I.length:k;if(h+=O===I.length?I:I.slice(0,k),k-=O,k===0){O===I.length?(++N,this.head=T.next?T.next:this.tail=null):(this.head=T,T.data=I.slice(O));break}++N}return this.length-=N,h}},{key:"_getBuffer",value:function(k){var T=b.allocUnsafe(k),N=this.head,h=1;for(N.data.copy(T),k-=N.data.length;N=N.next;){var I=N.data,O=k>I.length?I.length:k;if(I.copy(T,T.length-k,0,O),k-=O,k===0){O===I.length?(++h,this.head=N.next?N.next:this.tail=null):(this.head=N,N.data=I.slice(O));break}++h}return this.length-=h,T}},{key:A,value:function(k,T){return S(this,l({},T,{depth:0,customInspect:!1}))}}]),v}()},{buffer:3,util:2}],23:[function(s,o){(function(a){(function(){function l(d,f){g(d,f),u(d)}function u(d){d._writableState&&!d._writableState.emitClose||d._readableState&&!d._readableState.emitClose||d.emit("close")}function g(d,f){d.emit("error",f)}o.exports={destroy:function(d,f){var m=this,y=this._readableState&&this._readableState.destroyed,b=this._writableState&&this._writableState.destroyed;return y||b?(f?f(d):d&&(this._writableState?!this._writableState.errorEmitted&&(this._writableState.errorEmitted=!0,a.nextTick(g,this,d)):a.nextTick(g,this,d)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(d||null,function(C){!f&&C?m._writableState?m._writableState.errorEmitted?a.nextTick(u,m):(m._writableState.errorEmitted=!0,a.nextTick(l,m,C)):a.nextTick(l,m,C):f?(a.nextTick(u,m),f(C)):a.nextTick(u,m)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(d,f){var m=d._readableState,y=d._writableState;m&&m.autoDestroy||y&&y.autoDestroy?d.destroy(f):d.emit("error",f)}}}).call(this)}).call(this,s("_process"))},{_process:12}],24:[function(s,o){function a(f){var m=!1;return function(){if(!m){m=!0;for(var y=arguments.length,b=Array(y),C=0;C<y;C++)b[C]=arguments[C];f.apply(this,b)}}}function l(){}function u(f){return f.setHeader&&typeof f.abort=="function"}function g(f,m,y){if(typeof m=="function")return g(f,null,m);m||(m={}),y=a(y||l);var b=m.readable||m.readable!==!1&&f.readable,C=m.writable||m.writable!==!1&&f.writable,S=function(){f.writable||v()},A=f._writableState&&f._writableState.finished,v=function(){C=!1,A=!0,b||y.call(f)},k=f._readableState&&f._readableState.endEmitted,T=function(){b=!1,k=!0,C||y.call(f)},N=function(O){y.call(f,O)},h=function(){var O;return b&&!k?(f._readableState&&f._readableState.ended||(O=new d),y.call(f,O)):C&&!A?(f._writableState&&f._writableState.ended||(O=new d),y.call(f,O)):void 0},I=function(){f.req.on("finish",v)};return u(f)?(f.on("complete",v),f.on("abort",h),f.req?I():f.on("request",I)):C&&!f._writableState&&(f.on("end",S),f.on("close",S)),f.on("end",T),f.on("finish",v),m.error!==!1&&f.on("error",N),f.on("close",h),function(){f.removeListener("complete",v),f.removeListener("abort",h),f.removeListener("request",I),f.req&&f.req.removeListener("finish",v),f.removeListener("end",S),f.removeListener("close",S),f.removeListener("finish",v),f.removeListener("end",T),f.removeListener("error",N),f.removeListener("close",h)}}var d=s("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;o.exports=g},{"../../../errors":15}],25:[function(s,o){o.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],26:[function(s,o){function a(A){var v=!1;return function(){v||(v=!0,A.apply(void 0,arguments))}}function l(A){if(A)throw A}function u(A){return A.setHeader&&typeof A.abort=="function"}function g(A,v,k,T){T=a(T);var N=!1;A.on("close",function(){N=!0}),y===void 0&&(y=s("./end-of-stream")),y(A,{readable:v,writable:k},function(I){return I?T(I):(N=!0,void T())});var h=!1;return function(I){if(!N)return h?void 0:(h=!0,u(A)?A.abort():typeof A.destroy=="function"?A.destroy():void T(I||new S("pipe")))}}function d(A){A()}function f(A,v){return A.pipe(v)}function m(A){return A.length&&typeof A[A.length-1]=="function"?A.pop():l}var y,b=s("../../../errors").codes,C=b.ERR_MISSING_ARGS,S=b.ERR_STREAM_DESTROYED;o.exports=function(){for(var A=arguments.length,v=Array(A),k=0;k<A;k++)v[k]=arguments[k];var T=m(v);if(Array.isArray(v[0])&&(v=v[0]),2>v.length)throw new C("streams");var N,h=v.map(function(I,O){var j=O<v.length-1;return g(I,j,0<O,function(P){N||(N=P),P&&h.forEach(d),j||(h.forEach(d),T(N))})});return v.reduce(f)}},{"../../../errors":15,"./end-of-stream":24}],27:[function(s,o){function a(u,g,d){return u.highWaterMark==null?g?u[d]:null:u.highWaterMark}var l=s("../../../errors").codes.ERR_INVALID_OPT_VALUE;o.exports={getHighWaterMark:function(u,g,d,f){var m=a(g,f,d);if(m!=null){if(!(isFinite(m)&&t(m)===m)||0>m){var y=f?d:"highWaterMark";throw new l(y,m)}return t(m)}return u.objectMode?16:16384}}},{"../../../errors":15}],28:[function(s,o){o.exports=s("events").EventEmitter},{events:7}],29:[function(s,o,a){a=o.exports=s("./lib/_stream_readable.js"),a.Stream=a,a.Readable=a,a.Writable=s("./lib/_stream_writable.js"),a.Duplex=s("./lib/_stream_duplex.js"),a.Transform=s("./lib/_stream_transform.js"),a.PassThrough=s("./lib/_stream_passthrough.js"),a.finished=s("./lib/internal/streams/end-of-stream.js"),a.pipeline=s("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"./lib/internal/streams/end-of-stream.js":24,"./lib/internal/streams/pipeline.js":26}],30:[function(s,o,a){function l(f,m){for(var y in f)m[y]=f[y]}function u(f,m,y){return d(f,m,y)}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var g=s("buffer"),d=g.Buffer;d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?o.exports=g:(l(g,a),a.Buffer=u),u.prototype=Object.create(d.prototype),l(d,u),u.from=function(f,m,y){if(typeof f=="number")throw new TypeError("Argument must not be a number");return d(f,m,y)},u.alloc=function(f,m,y){if(typeof f!="number")throw new TypeError("Argument must be a number");var b=d(f);return m===void 0?b.fill(0):typeof y=="string"?b.fill(m,y):b.fill(m),b},u.allocUnsafe=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return d(f)},u.allocUnsafeSlow=function(f){if(typeof f!="number")throw new TypeError("Argument must be a number");return g.SlowBuffer(f)}},{buffer:3}],31:[function(s,o,a){function l(h){if(!h)return"utf8";for(var I;;)switch(h){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return h;default:if(I)return;h=(""+h).toLowerCase(),I=!0}}function u(h){var I=l(h);if(typeof I!="string"&&(T.isEncoding===N||!N(h)))throw new Error("Unknown encoding: "+h);return I||h}function g(h){this.encoding=u(h);var I;switch(this.encoding){case"utf16le":this.text=b,this.end=C,I=4;break;case"utf8":this.fillLast=y,I=4;break;case"base64":this.text=S,this.end=A,I=3;break;default:return this.write=v,void(this.end=k)}this.lastNeed=0,this.lastTotal=0,this.lastChar=T.allocUnsafe(I)}function d(h){return 127>=h?0:h>>5==6?2:h>>4==14?3:h>>3==30?4:h>>6==2?-1:-2}function f(h,I,O){var j=I.length-1;if(j<O)return 0;var P=d(I[j]);return 0<=P?(0<P&&(h.lastNeed=P-1),P):--j<O||P===-2?0:(P=d(I[j]),0<=P?(0<P&&(h.lastNeed=P-2),P):--j<O||P===-2?0:(P=d(I[j]),0<=P?(0<P&&(P===2?P=0:h.lastNeed=P-3),P):0))}function m(h,I){if((192&I[0])!=128)return h.lastNeed=0,"�";if(1<h.lastNeed&&1<I.length){if((192&I[1])!=128)return h.lastNeed=1,"�";if(2<h.lastNeed&&2<I.length&&(192&I[2])!=128)return h.lastNeed=2,"�"}}function y(h){var I=this.lastTotal-this.lastNeed,O=m(this,h);return O===void 0?this.lastNeed<=h.length?(h.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,I,0,h.length),void(this.lastNeed-=h.length)):O}function b(h,I){if((h.length-I)%2==0){var O=h.toString("utf16le",I);if(O){var j=O.charCodeAt(O.length-1);if(55296<=j&&56319>=j)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1],O.slice(0,-1)}return O}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=h[h.length-1],h.toString("utf16le",I,h.length-1)}function C(h){var I=h&&h.length?this.write(h):"";if(this.lastNeed){var O=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,O)}return I}function S(h,I){var O=(h.length-I)%3;return O==0?h.toString("base64",I):(this.lastNeed=3-O,this.lastTotal=3,O==1?this.lastChar[0]=h[h.length-1]:(this.lastChar[0]=h[h.length-2],this.lastChar[1]=h[h.length-1]),h.toString("base64",I,h.length-O))}function A(h){var I=h&&h.length?this.write(h):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function v(h){return h.toString(this.encoding)}function k(h){return h&&h.length?this.write(h):""}var T=s("safe-buffer").Buffer,N=T.isEncoding||function(h){switch(h=""+h,h&&h.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};a.StringDecoder=g,g.prototype.write=function(h){if(h.length===0)return"";var I,O;if(this.lastNeed){if(I=this.fillLast(h),I===void 0)return"";O=this.lastNeed,this.lastNeed=0}else O=0;return O<h.length?I?I+this.text(h,O):this.text(h,O):I||""},g.prototype.end=function(h){var I=h&&h.length?this.write(h):"";return this.lastNeed?I+"�":I},g.prototype.text=function(h,I){var O=f(this,h,I);if(!this.lastNeed)return h.toString("utf8",I);this.lastTotal=O;var j=h.length-(O-this.lastNeed);return h.copy(this.lastChar,0,j),h.toString("utf8",I,j)},g.prototype.fillLast=function(h){return this.lastNeed<=h.length?(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(h.copy(this.lastChar,this.lastTotal-this.lastNeed,0,h.length),void(this.lastNeed-=h.length))}},{"safe-buffer":30}],32:[function(s,o){(function(a){(function(){function l(u){try{if(!a.localStorage)return!1}catch{return!1}var g=a.localStorage[u];return g!=null&&(g+"").toLowerCase()==="true"}o.exports=function(u,g){function d(){if(!f){if(l("throwDeprecation"))throw new Error(g);l("traceDeprecation")?console.trace(g):console.warn(g),f=!0}return u.apply(this,arguments)}if(l("noDeprecation"))return u;var f=!1;return d}}).call(this)}).call(this,typeof Zn>"u"?typeof self>"u"?typeof window>"u"?{}:window:self:Zn)},{}],"/":[function(s,o){function a(A){return A.replace(/a=ice-options:trickle\s\n/g,"")}function l(A){console.warn(A)}/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */const u=s("debug")("simple-peer"),g=s("get-browser-rtc"),d=s("randombytes"),f=s("readable-stream"),m=s("queue-microtask"),y=s("err-code"),{Buffer:b}=s("buffer"),C=65536;class S extends f.Duplex{constructor(v){if(v=Object.assign({allowHalfOpen:!1},v),super(v),this._id=d(4).toString("hex").slice(0,7),this._debug("new peer %o",v),this.channelName=v.initiator?v.channelName||d(20).toString("hex"):null,this.initiator=v.initiator||!1,this.channelConfig=v.channelConfig||S.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},S.config,v.config),this.offerOptions=v.offerOptions||{},this.answerOptions=v.answerOptions||{},this.sdpTransform=v.sdpTransform||(k=>k),this.streams=v.streams||(v.stream?[v.stream]:[]),this.trickle=v.trickle===void 0||v.trickle,this.allowHalfTrickle=v.allowHalfTrickle!==void 0&&v.allowHalfTrickle,this.iceCompleteTimeout=v.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=v.wrtc&&typeof v.wrtc=="object"?v.wrtc:g(),!this._wrtc)throw y(typeof window>"u"?new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"):new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(k){return void this.destroy(y(k,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=k=>{this._onIceCandidate(k)},typeof this._pc.peerIdentity=="object"&&this._pc.peerIdentity.catch(k=>{this.destroy(y(k,"ERR_PC_PEER_IDENTITY"))}),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=k=>{this._setupData(k)},this.streams&&this.streams.forEach(k=>{this.addStream(k)}),this._pc.ontrack=k=>{this._onTrack(k)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if(typeof v=="string")try{v=JSON.parse(v)}catch{v={}}this._debug("signal()"),v.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),v.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(v.transceiverRequest.kind,v.transceiverRequest.init)),v.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(v.candidate):this._pendingCandidates.push(v.candidate)),v.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(v)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(k=>{this._addIceCandidate(k)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(k=>{this.destroy(y(k,"ERR_SET_REMOTE_DESCRIPTION"))}),v.sdp||v.candidate||v.renegotiate||v.transceiverRequest||this.destroy(y(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(v){const k=new this._wrtc.RTCIceCandidate(v);this._pc.addIceCandidate(k).catch(T=>{!k.address||k.address.endsWith(".local")?l("Ignoring unsupported ICE candidate."):this.destroy(y(T,"ERR_ADD_ICE_CANDIDATE"))})}send(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(v)}}addTransceiver(v,k){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(v,k),this._needsNegotiation()}catch(T){this.destroy(y(T,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:v,init:k}})}}addStream(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),v.getTracks().forEach(k=>{this.addTrack(k,v)})}}addTrack(v,k){if(this.destroying)return;if(this.destroyed)throw y(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");const T=this._senderMap.get(v)||new Map;let N=T.get(k);if(!N)N=this._pc.addTrack(v,k),T.set(k,N),this._senderMap.set(v,T),this._needsNegotiation();else throw N.removed?y(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):y(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(v,k,T){if(this.destroying)return;if(this.destroyed)throw y(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");const N=this._senderMap.get(v),h=N?N.get(T):null;if(!h)throw y(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");k&&this._senderMap.set(k,N),h.replaceTrack==null?this.destroy(y(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK")):h.replaceTrack(k)}removeTrack(v,k){if(this.destroying)return;if(this.destroyed)throw y(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");const T=this._senderMap.get(v),N=T?T.get(k):null;if(!N)throw y(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{N.removed=!0,this._pc.removeTrack(N)}catch(h){h.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(N):this.destroy(y(h,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(v){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),v.getTracks().forEach(k=>{this.removeTrack(k,v)})}}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,m(()=>{this._batchedNegotiation=!1,this.initiator||!this._firstNegotiation?(this._debug("starting batched negotiation"),this.negotiate()):this._debug("non-initiator initial negotiation request discarded"),this._firstNegotiation=!1}))}negotiate(){if(!this.destroying){if(this.destroyed)throw y(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}destroy(v){this._destroy(v,()=>{})}_destroy(v,k){this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",v&&(v.message||v)),m(()=>{if(this.destroyed=!0,this.destroying=!1,this._debug("destroy (error: %s)",v&&(v.message||v)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch{}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch{}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,v&&this.emit("error",v),this.emit("close"),k()}))}_setupData(v){if(!v.channel)return this.destroy(y(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=v.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=C),this.channelName=this._channel.label,this._channel.onmessage=T=>{this._onChannelMessage(T)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=T=>{const N=T.error instanceof Error?T.error:new Error(`Datachannel error: ${T.message} ${T.filename}:${T.lineno}:${T.colno}`);this.destroy(y(N,"ERR_DATA_CHANNEL"))};let k=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(k&&this._onChannelClose(),k=!0):k=!1},5e3)}_read(){}_write(v,k,T){if(this.destroyed)return T(y(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(v)}catch(N){return this.destroy(y(N,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>C?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=T):T(null)}else this._debug("write before connect"),this._chunk=v,this._cb=T}_onFinish(){if(!this.destroyed){const v=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?v():this.once("connect",v)}}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(v=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(v.sdp=a(v.sdp)),v.sdp=this.sdpTransform(v.sdp);const k=()=>{if(!this.destroyed){const T=this._pc.localDescription||v;this._debug("signal"),this.emit("signal",{type:T.type,sdp:T.sdp})}};this._pc.setLocalDescription(v).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?k():this.once("_iceComplete",k))}).catch(T=>{this.destroy(y(T,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(v=>{this.destroy(y(v,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(v=>{v.mid||!v.sender.track||v.requested||(v.requested=!0,this.addTransceiver(v.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(v=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(v.sdp=a(v.sdp)),v.sdp=this.sdpTransform(v.sdp);const k=()=>{if(!this.destroyed){const T=this._pc.localDescription||v;this._debug("signal"),this.emit("signal",{type:T.type,sdp:T.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(v).then(()=>{this.destroyed||(this.trickle||this._iceComplete?k():this.once("_iceComplete",k))}).catch(T=>{this.destroy(y(T,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(v=>{this.destroy(y(v,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(y(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(this.destroyed)return;const v=this._pc.iceConnectionState,k=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",v,k),this.emit("iceStateChange",v,k),(v==="connected"||v==="completed")&&(this._pcReady=!0,this._maybeReady()),v==="failed"&&this.destroy(y(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),v==="closed"&&this.destroy(y(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}getStats(v){const k=T=>(Object.prototype.toString.call(T.values)==="[object Array]"&&T.values.forEach(N=>{Object.assign(T,N)}),T);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(T=>{const N=[];T.forEach(h=>{N.push(k(h))}),v(null,N)},T=>v(T)):0<this._pc.getStats.length?this._pc.getStats(T=>{if(this.destroyed)return;const N=[];T.result().forEach(h=>{const I={};h.names().forEach(O=>{I[O]=h.stat(O)}),I.id=h.id,I.type=h.type,I.timestamp=h.timestamp,N.push(k(I))}),v(null,N)},T=>v(T)):v(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const v=()=>{this.destroyed||this.getStats((k,T)=>{if(this.destroyed)return;k&&(T=[]);const N={},h={},I={};let O=!1;T.forEach(P=>{(P.type==="remotecandidate"||P.type==="remote-candidate")&&(N[P.id]=P),(P.type==="localcandidate"||P.type==="local-candidate")&&(h[P.id]=P),(P.type==="candidatepair"||P.type==="candidate-pair")&&(I[P.id]=P)});const j=P=>{O=!0;let q=h[P.localCandidateId];q&&(q.ip||q.address)?(this.localAddress=q.ip||q.address,this.localPort=+q.port):q&&q.ipAddress?(this.localAddress=q.ipAddress,this.localPort=+q.portNumber):typeof P.googLocalAddress=="string"&&(q=P.googLocalAddress.split(":"),this.localAddress=q[0],this.localPort=+q[1]),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");let G=N[P.remoteCandidateId];G&&(G.ip||G.address)?(this.remoteAddress=G.ip||G.address,this.remotePort=+G.port):G&&G.ipAddress?(this.remoteAddress=G.ipAddress,this.remotePort=+G.portNumber):typeof P.googRemoteAddress=="string"&&(G=P.googRemoteAddress.split(":"),this.remoteAddress=G[0],this.remotePort=+G[1]),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(T.forEach(P=>{P.type==="transport"&&P.selectedCandidatePairId&&j(I[P.selectedCandidatePairId]),(P.type==="googCandidatePair"&&P.googActiveConnection==="true"||(P.type==="candidatepair"||P.type==="candidate-pair")&&P.selected)&&j(P)}),!O&&(!Object.keys(I).length||Object.keys(h).length))return void setTimeout(v,100);if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(q){return this.destroy(y(q,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');const P=this._cb;this._cb=null,P(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};v()}_onInterval(){this._cb&&this._channel&&!(this._channel.bufferedAmount>C)&&this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(v=>{this._pc.removeTrack(v),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(v){this.destroyed||(v.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:v.candidate.candidate,sdpMLineIndex:v.candidate.sdpMLineIndex,sdpMid:v.candidate.sdpMid}}):!v.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),v.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(v){if(this.destroyed)return;let k=v.data;k instanceof ArrayBuffer&&(k=b.from(k)),this.push(k)}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);const v=this._cb;this._cb=null,v(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(v){this.destroyed||v.streams.forEach(k=>{this._debug("on track"),this.emit("track",v.track,k),this._remoteTracks.push({track:v.track,stream:k}),this._remoteStreams.some(T=>T.id===k.id)||(this._remoteStreams.push(k),m(()=>{this._debug("on stream"),this.emit("stream",k)}))})}_debug(){const v=[].slice.call(arguments);v[0]="["+this._id+"] "+v[0],u.apply(null,v)}}S.WEBRTC_SUPPORT=!!g(),S.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},S.channelConfig={},o.exports=S},{buffer:3,debug:4,"err-code":6,"get-browser-rtc":8,"queue-microtask":13,randombytes:14,"readable-stream":29}]},{},[])("/")})})(cm);var px=cm.exports;const mx=Gi(px),rd=0,wl=1,um=2,Ro=(n,e)=>{je(n,rd);const t=pw(e);St(n,t)},id=(n,e,t)=>{je(n,wl),St(n,dw(e,t))},yx=(n,e,t)=>id(e,t,Gt(n)),dm=(n,e,t)=>{try{lw(e,Gt(n),t)}catch(r){console.error("Caught error while handling a Yjs update",r)}},fm=(n,e)=>{je(n,um),St(n,e)},_x=dm,hm=(n,e,t,r)=>{const i=Ve(n);switch(i){case rd:yx(n,e,t);break;case wl:dm(n,t,r);break;case um:_x(n,t,r);break;default:throw new Error("Unknown message type")}return i},sd=3e4;class gm extends cu{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const t=jn();this.getLocalState()!==null&&sd/2<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&sd<=t-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Lo(this,r,"timeout")},pr(sd/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const t=this.clientID,r=this.meta.get(t),i=r===void 0?0:r.clock+1,s=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:i,lastUpdated:jn()});const o=[],a=[],l=[],u=[];e===null?u.push(t):s==null?e!=null&&o.push(t):(a.push(t),wo(s,e)||l.push(t)),(o.length>0||l.length>0||u.length>0)&&this.emit("change",[{added:o,updated:l,removed:u},"local"]),this.emit("update",[{added:o,updated:a,removed:u},"local"])}setLocalStateField(e,t){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:t})}getStates(){return this.states}}const Lo=(n,e,t)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(n.states.has(s)){if(n.states.delete(s),s===n.clientID){const o=n.meta.get(s);n.meta.set(s,{clock:o.clock+1,lastUpdated:jn()})}r.push(s)}}r.length>0&&(n.emit("change",[{added:[],updated:[],removed:r},t]),n.emit("update",[{added:[],updated:[],removed:r},t]))},Ur=(n,e,t=n.states)=>{const r=e.length,i=bt();je(i,r);for(let s=0;s<r;s++){const o=e[s],a=t.get(o)||null,l=n.meta.get(o).clock;je(i,o),je(i,l),mr(i,JSON.stringify(a))}return at(i)},pm=(n,e,t)=>{const r=sr(e),i=jn(),s=[],o=[],a=[],l=[],u=Ve(r);for(let g=0;g<u;g++){const d=Ve(r);let f=Ve(r);const m=JSON.parse(br(r)),y=n.meta.get(d),b=n.states.get(d),C=y===void 0?0:y.clock;(C<f||C===f&&m===null&&n.states.has(d))&&(m===null?d===n.clientID&&n.getLocalState()!=null?f++:n.states.delete(d):n.states.set(d,m),n.meta.set(d,{clock:f,lastUpdated:i}),y===void 0&&m!==null?s.push(d):y!==void 0&&m===null?l.push(d):m!==null&&(wo(m,b)||a.push(d),o.push(d)))}(s.length>0||a.length>0||l.length>0)&&n.emit("change",[{added:s,updated:a,removed:l},t]),(s.length>0||o.length>0||l.length>0)&&n.emit("update",[{added:s,updated:o,removed:l},t])},bx=(n,e)=>{const t=hu(n).buffer,r=hu(e).buffer;return crypto.subtle.importKey("raw",t,"PBKDF2",!1,["deriveKey"]).then(i=>crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]))},mm=(n,e)=>{if(!e)return xu(n);const t=crypto.getRandomValues(new Uint8Array(12));return crypto.subtle.encrypt({name:"AES-GCM",iv:t},e,n).then(r=>{const i=bt();return mr(i,"AES-GCM"),St(i,t),St(i,new Uint8Array(r)),at(i)})},wx=(n,e)=>{const t=bt();return ds(t,n),mm(at(t),e)},ym=(n,e)=>{if(!e)return xu(n);const t=sr(n);br(t)!=="AES-GCM"&&vb(yr("Unknown encryption algorithm"));const i=Gt(t),s=Gt(t);return crypto.subtle.decrypt({name:"AES-GCM",iv:i},e,s).then(o=>new Uint8Array(o))},vx=(n,e)=>ym(n,e).then(t=>fs(sr(new Uint8Array(t)))),Fn=Jb("y-webrtc"),Es=0,_m=3,Oo=1,od=4,vl=new Map,Ui=new Map,bm=n=>{let e=!0;n.webrtcConns.forEach(t=>{t.synced||(e=!1)}),(!e&&n.synced||e&&!n.synced)&&(n.synced=e,n.provider.emit("synced",[{synced:e}]),Fn("synced ",Yn,n.name,Ri," with all peers"))},wm=(n,e,t)=>{const r=sr(e),i=bt(),s=Ve(r);if(n===void 0)return null;const o=n.awareness,a=n.doc;let l=!1;switch(s){case Es:{je(i,Es);const u=hm(r,i,a,n);u===wl&&!n.synced&&t(),u===rd&&(l=!0);break}case _m:je(i,Oo),St(i,Ur(o,Array.from(o.getStates().keys()))),l=!0;break;case Oo:pm(o,Gt(r),n);break;case od:{const u=Ii(r)===1,g=br(r);if(g!==n.peerId&&(n.bcConns.has(g)&&!u||!n.bcConns.has(g)&&u)){const d=[],f=[];u?(n.bcConns.add(g),f.push(g)):(n.bcConns.delete(g),d.push(g)),n.provider.emit("peers",[{added:f,removed:d,webrtcPeers:Array.from(n.webrtcConns.keys()),bcPeers:Array.from(n.bcConns)}]),Cm(n)}break}default:return console.error("Unable to compute message"),i}return l?i:null},xx=(n,e)=>{const t=n.room;return Fn("received message from ",Yn,n.remotePeerId,Eu," (",t.name,")",Ri,Ja),wm(t,e,()=>{n.synced=!0,Fn("synced ",Yn,t.name,Ri," with ",Yn,n.remotePeerId),bm(t)})},ad=(n,e)=>{Fn("send message to ",Yn,n.remotePeerId,Ri,Eu," (",n.room.name,")",Ja);try{n.peer.send(at(e))}catch{}},Cx=(n,e)=>{Fn("broadcast message in ",Yn,n.name,Ri),n.webrtcConns.forEach(t=>{try{t.peer.send(e)}catch{}})};class vm{constructor(e,t,r,i){Fn("establishing connection to ",Yn,r),this.room=i,this.remotePeerId=r,this.glareToken=void 0,this.closed=!1,this.connected=!1,this.synced=!1,this.peer=new mx({initiator:t,...i.provider.peerOpts}),this.peer.on("signal",s=>{this.glareToken===void 0&&(this.glareToken=Date.now()+Math.random()),cd(e,i,{to:r,from:i.peerId,type:"signal",token:this.glareToken,signal:s})}),this.peer.on("connect",()=>{Fn("connected to ",Yn,r),this.connected=!0;const o=i.provider.doc,a=i.awareness,l=bt();je(l,Es),Ro(l,o),ad(this,l);const u=a.getStates();if(u.size>0){const g=bt();je(g,Oo),St(g,Ur(a,Array.from(u.keys()))),ad(this,g)}}),this.peer.on("close",()=>{this.connected=!1,this.closed=!0,i.webrtcConns.has(this.remotePeerId)&&(i.webrtcConns.delete(this.remotePeerId),i.provider.emit("peers",[{removed:[this.remotePeerId],added:[],webrtcPeers:Array.from(i.webrtcConns.keys()),bcPeers:Array.from(i.bcConns)}])),bm(i),this.peer.destroy(),Fn("closed connection to ",Yn,r),ld(i)}),this.peer.on("error",s=>{Fn("Error in connection to ",Yn,r,": ",s),ld(i)}),this.peer.on("data",s=>{const o=xx(this,s);o!==null&&ad(this,o)})}destroy(){this.peer.destroy()}}const ci=(n,e)=>mm(e,n.key).then(t=>n.mux(()=>Bi(n.name,t))),xm=(n,e)=>{n.bcconnected&&ci(n,e),Cx(n,e)},ld=n=>{vl.forEach(e=>{e.connected&&(e.send({type:"subscribe",topics:[n.name]}),n.webrtcConns.size<n.provider.maxConns&&cd(e,n,{type:"announce",from:n.peerId}))})},Cm=n=>{if(n.provider.filterBcConns){const e=bt();je(e,od),bo(e,1),mr(e,n.peerId),ci(n,at(e))}};class Sx{constructor(e,t,r,i){this.peerId=rg(),this.doc=e,this.awareness=t.awareness,this.provider=t,this.synced=!1,this.name=r,this.key=i,this.webrtcConns=new Map,this.bcConns=new Set,this.mux=gx(),this.bcconnected=!1,this._bcSubscriber=s=>ym(new Uint8Array(s),i).then(o=>this.mux(()=>{const a=wm(this,o,()=>{});a&&ci(this,at(a))})),this._docUpdateHandler=(s,o)=>{const a=bt();je(a,Es),fm(a,s),xm(this,at(a))},this._awarenessUpdateHandler=({added:s,updated:o,removed:a},l)=>{const u=s.concat(o).concat(a),g=bt();je(g,Oo),St(g,Ur(this.awareness,u)),xm(this,at(g))},this._beforeUnloadHandler=()=>{Lo(this.awareness,[e.clientID],"window unload"),Ui.forEach(s=>{s.disconnect()})},typeof window<"u"?window.addEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.on("exit",this._beforeUnloadHandler)}connect(){this.doc.on("update",this._docUpdateHandler),this.awareness.on("update",this._awarenessUpdateHandler),ld(this);const e=this.name;am(e,this._bcSubscriber),this.bcconnected=!0,Cm(this);const t=bt();je(t,Es),Ro(t,this.doc),ci(this,at(t));const r=bt();je(r,Es),id(r,this.doc),ci(this,at(r));const i=bt();je(i,_m),ci(this,at(i));const s=bt();je(s,Oo),St(s,Ur(this.awareness,[this.doc.clientID])),ci(this,at(s))}disconnect(){vl.forEach(t=>{t.connected&&t.send({type:"unsubscribe",topics:[this.name]})}),Lo(this.awareness,[this.doc.clientID],"disconnect");const e=bt();je(e,od),bo(e,0),mr(e,this.peerId),ci(this,at(e)),lm(this.name,this._bcSubscriber),this.bcconnected=!1,this.doc.off("update",this._docUpdateHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.webrtcConns.forEach(t=>t.destroy())}destroy(){this.disconnect(),typeof window<"u"?window.removeEventListener("beforeunload",this._beforeUnloadHandler):typeof process<"u"&&process.off("exit",this._beforeUnloadHandler)}}const Tx=(n,e,t,r)=>{if(Ui.has(t))throw yr(`A Yjs Doc connected to room "${t}" already exists!`);const i=new Sx(n,e,t,r);return Ui.set(t,i),i},cd=(n,e,t)=>{e.key?wx(t,e.key).then(r=>{n.send({type:"publish",topic:e.name,data:mg(r)})}):n.send({type:"publish",topic:e.name,data:t})};class Ex extends dx{constructor(e){super(e),this.providers=new Set,this.on("connect",()=>{Fn(`connected (${e})`);const t=Array.from(Ui.keys());this.send({type:"subscribe",topics:t}),Ui.forEach(r=>cd(this,r,{type:"announce",from:r.peerId}))}),this.on("message",t=>{switch(t.type){case"publish":{const r=t.topic,i=Ui.get(r);if(i==null||typeof r!="string")return;const s=o=>{const a=i.webrtcConns,l=i.peerId;if(o==null||o.from===l||o.to!==void 0&&o.to!==l||i.bcConns.has(o.from))return;const u=a.has(o.from)?()=>{}:()=>i.provider.emit("peers",[{removed:[],added:[o.from],webrtcPeers:Array.from(i.webrtcConns.keys()),bcPeers:Array.from(i.bcConns)}]);switch(o.type){case"announce":a.size<i.provider.maxConns&&(Ln(a,o.from,()=>new vm(this,!0,o.from,i)),u());break;case"signal":if(o.signal.type==="offer"){const g=a.get(o.from);if(g){const d=o.token,f=g.glareToken;if(f&&f>d){Fn("offer rejected: ",o.from);return}g.glareToken=void 0}}if(o.signal.type==="answer"){Fn("offer answered by: ",o.from);const g=a.get(o.from);g.glareToken=void 0}o.to===l&&(Ln(a,o.from,()=>new vm(this,!1,o.from,i)).peer.signal(o.signal),u());break}};i.key?typeof t.data=="string"&&vx(yg(t.data),i.key).then(s):s(t.data)}}}),this.on("disconnect",()=>Fn(`disconnect (${e})`))}}const ud=n=>{n.emit("status",[{connected:n.connected}])};class kx extends lu{constructor(e,t,{signaling:r=["wss://y-webrtc-eu.fly.dev"],password:i=null,awareness:s=new gm(t),maxConns:o=20+pr(bb()*15),filterBcConns:a=!0,peerOpts:l={}}={}){super(),this.roomName=e,this.doc=t,this.filterBcConns=a,this.awareness=s,this.shouldConnect=!1,this.signalingUrls=r,this.signalingConns=[],this.maxConns=o,this.peerOpts=l,this.key=i?bx(i,e):xu(null),this.room=null,this.key.then(u=>{this.room=Tx(t,this,e,u),this.shouldConnect?this.room.connect():this.room.disconnect(),ud(this)}),this.connect(),this.destroy=this.destroy.bind(this),t.on("destroy",this.destroy)}get connected(){return this.room!==null&&this.shouldConnect}connect(){this.shouldConnect=!0,this.signalingUrls.forEach(e=>{const t=Ln(vl,e,()=>new Ex(e));this.signalingConns.push(t),t.providers.add(this)}),this.room&&(this.room.connect(),ud(this))}disconnect(){this.shouldConnect=!1,this.signalingConns.forEach(e=>{e.providers.delete(this),e.providers.size===0&&(e.destroy(),vl.delete(e.url))}),this.room&&(this.room.disconnect(),ud(this))}destroy(){this.doc.off("destroy",this.destroy),this.key.then(()=>{this.room.destroy(),Ui.delete(this.roomName)}),super.destroy()}}const Nx=0,Mx=(n,e,t)=>{switch(Ve(n)){case Nx:t(e,br(n))}},Dx=n=>kb(n,(e,t)=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"),Hi=0,Sm=3,ks=1,Ax=2,jo=[];jo[Hi]=(n,e,t,r,i)=>{je(n,Hi);const s=hm(e,n,t.doc,t);r&&s===wl&&!t.synced&&(t.synced=!0)},jo[Sm]=(n,e,t,r,i)=>{je(n,ks),St(n,Ur(t.awareness,Array.from(t.awareness.getStates().keys())))},jo[ks]=(n,e,t,r,i)=>{pm(t.awareness,Gt(e),t)},jo[Ax]=(n,e,t,r,i)=>{Mx(e,t.doc,(s,o)=>Ix(t,o))};const Tm=3e4,Ix=(n,e)=>console.warn(`Permission denied to access ${n.url}.
43
43
  ${e}`),Em=(n,e,t)=>{const r=sr(e),i=bt(),s=Ve(r),o=n.messageHandlers[s];return o?o(i,r,n,t,s):console.error("Unable to compute message"),i},km=n=>{if(n.shouldConnect&&n.ws===null){const e=new n._WS(n.url,n.protocols);e.binaryType="arraybuffer",n.ws=e,n.wsconnecting=!0,n.wsconnected=!1,n.synced=!1,e.onmessage=t=>{n.wsLastMessageReceived=jn();const r=Em(n,new Uint8Array(t.data),!0);gu(r)>1&&e.send(at(r))},e.onerror=t=>{n.emit("connection-error",[t,n])},e.onclose=t=>{n.emit("connection-close",[t,n]),n.ws=null,n.wsconnecting=!1,n.wsconnected?(n.wsconnected=!1,n.synced=!1,Lo(n.awareness,Array.from(n.awareness.getStates().keys()).filter(r=>r!==n.doc.clientID),n),n.emit("status",[{status:"disconnected"}])):n.wsUnsuccessfulReconnects++,setTimeout(km,$a(X0(2,n.wsUnsuccessfulReconnects)*100,n.maxBackoffTime),n)},e.onopen=()=>{n.wsLastMessageReceived=jn(),n.wsconnecting=!1,n.wsconnected=!0,n.wsUnsuccessfulReconnects=0,n.emit("status",[{status:"connected"}]);const t=bt();if(je(t,Hi),Ro(t,n.doc),e.send(at(t)),n.awareness.getLocalState()!==null){const r=bt();je(r,ks),St(r,Ur(n.awareness,[n.doc.clientID])),e.send(at(r))}},n.emit("status",[{status:"connecting"}])}},dd=(n,e)=>{const t=n.ws;n.wsconnected&&t&&t.readyState===t.OPEN&&t.send(e),n.bcconnected&&Bi(n.bcChannel,e,n)};class Rx extends cu{constructor(e,t,r,{connect:i=!0,awareness:s=new gm(r),params:o={},protocols:a=[],WebSocketPolyfill:l=WebSocket,resyncInterval:u=-1,maxBackoffTime:g=2500,disableBc:d=!1}={}){for(super();e[e.length-1]==="/";)e=e.slice(0,e.length-1);this.serverUrl=e,this.bcChannel=e+"/"+t,this.maxBackoffTime=g,this.params=o,this.protocols=a,this.roomname=t,this.doc=r,this._WS=l,this.awareness=s,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=d,this.wsUnsuccessfulReconnects=0,this.messageHandlers=jo.slice(),this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=i,this._resyncInterval=0,u>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const f=bt();je(f,Hi),Ro(f,r),this.ws.send(at(f))}},u)),this._bcSubscriber=(f,m)=>{if(m!==this){const y=Em(this,new Uint8Array(f),!1);gu(y)>1&&Bi(this.bcChannel,at(y),this)}},this._updateHandler=(f,m)=>{if(m!==this){const y=bt();je(y,Hi),fm(y,f),dd(this,at(y))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:f,updated:m,removed:y},b)=>{const C=f.concat(m).concat(y),S=bt();je(S,ks),St(S,Ur(s,C)),dd(this,at(S))},this._exitHandler=()=>{Lo(this.awareness,[r.clientID],"app closed")},ii&&typeof process<"u"&&process.on("exit",this._exitHandler),s.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Tm<jn()-this.wsLastMessageReceived&&this.ws.close()},Tm/10),i&&this.connect()}get url(){const e=Dx(this.params);return this.serverUrl+"/"+this.roomname+(e.length===0?"":"?"+e)}get synced(){return this._synced}set synced(e){this._synced!==e&&(this._synced=e,this.emit("synced",[e]),this.emit("sync",[e]))}destroy(){this._resyncInterval!==0&&clearInterval(this._resyncInterval),clearInterval(this._checkInterval),this.disconnect(),ii&&typeof process<"u"&&process.off("exit",this._exitHandler),this.awareness.off("update",this._awarenessUpdateHandler),this.doc.off("update",this._updateHandler),super.destroy()}connectBc(){if(this.disableBc)return;this.bcconnected||(am(this.bcChannel,this._bcSubscriber),this.bcconnected=!0);const e=bt();je(e,Hi),Ro(e,this.doc),Bi(this.bcChannel,at(e),this);const t=bt();je(t,Hi),id(t,this.doc),Bi(this.bcChannel,at(t),this);const r=bt();je(r,Sm),Bi(this.bcChannel,at(r),this);const i=bt();je(i,ks),St(i,Ur(this.awareness,[this.doc.clientID])),Bi(this.bcChannel,at(i),this)}disconnectBc(){const e=bt();je(e,ks),St(e,Ur(this.awareness,[this.doc.clientID],new Map)),dd(this,at(e)),this.bcconnected&&(lm(this.bcChannel,this._bcSubscriber),this.bcconnected=!1)}disconnect(){this.shouldConnect=!1,this.disconnectBc(),this.ws!==null&&this.ws.close()}connect(){this.shouldConnect=!0,!this.wsconnected&&this.ws===null&&(km(this),this.connectBc())}}let Lx=0;function Ox(n,e){const t=Nm(n,e);return console.log("passed doc id for collab is",n),new kx(`${n}/${Lx++}`,t,{peerOpts:{reconnectTimer:100},signaling:window.location.hostname==="localhost"?["ws://localhost:5173"]:["wss://spincrm.sharepoint.com/"]})}function jx(n,e){const t=Nm(n,e);console.log("id",n);const r=new Rx(`${window.location.hostname==="localhost"?"ws://localhost:5173":"wss://spincrm.sharepoint.com/"}`,n,t,{connect:!1});return r.on("status",i=>{i==="connecting"?console.log("WebSocket is trying to connect..."):i==="open"?console.log("WebSocket connection established"):i==="closed"?console.error("WebSocket connection closed"):i==="error"&&console.error("WebSocket error: connection failed")}),r}function Nm(n,e){let t=e.get(n);return t===void 0?(t=new Br,e.set(n,t)):t.load(),t}const Mm=/^(\d+(?:\.\d+)?)px$/,bn={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Hr extends ni{static getType(){return"tablecell"}static clone(e){const t=new Hr(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:Dm,priority:0}),th:e=>({conversion:Dm,priority:0})}}static importJSON(e){const t=e.colSpan||1,r=e.rowSpan||1,i=ui(e.headerState,t,e.width||void 0);return i.__rowSpan=r,i.__backgroundColor=e.backgroundColor||null,i}constructor(e=bn.NO_STATUS,t=1,r,i){super(i),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),Io(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const r=t;r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign="top",r.style.textAlign="start";const i=this.getBackgroundColor();i!==null?r.style.backgroundColor=i:this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){return this.getWritable().__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){return this.getWritable().__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==bn.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Dm(n){const e=n,t=n.nodeName.toLowerCase();let r;Mm.test(e.style.width)&&(r=parseFloat(e.style.width));const i=ui(t==="th"?bn.ROW:bn.NO_STATUS,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const o=e.style,a=o.textDecoration.split(" "),l=o.fontWeight==="700"||o.fontWeight==="bold",u=a.includes("line-through"),g=o.fontStyle==="italic",d=a.includes("underline");return{after:f=>(f.length===0&&f.push(_t()),f),forChild:(f,m)=>{if(Ue(m)&&!ie(f)){const y=_t();return hr(f)&&f.getTextContent()===`
44
- `?null:(me(f)&&(l&&f.toggleFormat("bold"),u&&f.toggleFormat("strikethrough"),g&&f.toggleFormat("italic"),d&&f.toggleFormat("underline")),y.append(f),y)}return f},node:i}}function ui(n,e=1,t){return dr(new Hr(n,e,t))}function Ue(n){return n instanceof Hr}const Px=wi();class Ns extends ni{static getType(){return"tablerow"}static clone(e){return new Ns(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:Fx,priority:0})}}static importJSON(e){return Po(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Io(t,e.theme.tableRow),t}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function Fx(n){const e=n;let t;return Mm.test(e.style.height)&&(t=parseFloat(e.style.height)),{node:Po(t)}}function Po(n){return dr(new Ns(n))}function Yt(n){return n instanceof Ns}function zx(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lt=zx(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Bx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0;function Am(n,e,t=!0){const r=_d();for(let i=0;i<n;i++){const s=Po();for(let o=0;o<e;o++){let a=bn.NO_STATUS;typeof t=="object"?(i===0&&t.rows&&(a|=bn.ROW),o===0&&t.columns&&(a|=bn.COLUMN)):t&&(i===0&&(a|=bn.ROW),o===0&&(a|=bn.COLUMN));const l=ui(a),u=_t();u.append(Bt()),l.append(u),s.append(l)}r.append(s)}return r}function Im(n){const e=it(n,t=>Yt(t));if(Yt(e))return e;throw new Error("Expected table cell to be inside of table row.")}function xl(n){const e=it(n,t=>At(t));if(At(e))return e;throw new Error("Expected table cell to be inside of table.")}function Rm(n){const e=Im(n);return xl(e).getChildren().findIndex(t=>t.is(e))}function Lm(n){return Im(n).getChildren().findIndex(e=>e.is(n))}const fd=(n,e)=>n===bn.BOTH||n===e?e:bn.NO_STATUS;function Ux(n=!0){const e=ge();he(e)||It(e)||lt(118);const t=e.focus.getNode(),[r,,i]=zn(t),[s,o]=Sr(i,r,r),a=s[0].length,{startRow:l}=o;if(n){const u=l+r.__rowSpan-1,g=s[u],d=Po();for(let m=0;m<a;m++){const{cell:y,startRow:b}=g[m];if(b+y.__rowSpan-1<=u){const C=g[m].cell.__headerState,S=fd(C,bn.COLUMN);d.append(ui(S).append(_t()))}else y.setRowSpan(y.__rowSpan+1)}const f=i.getChildAtIndex(u);Yt(f)||lt(145),f.insertAfter(d)}else{const u=s[l],g=Po();for(let f=0;f<a;f++){const{cell:m,startRow:y}=u[f];if(y===l){const b=u[f].cell.__headerState,C=fd(b,bn.COLUMN);g.append(ui(C).append(_t()))}else m.setRowSpan(m.__rowSpan+1)}const d=i.getChildAtIndex(l);Yt(d)||lt(145),d.insertBefore(g)}}function Hx(n=!0){const e=ge();he(e)||It(e)||lt(118);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=zn(t),[s,,o]=zn(r),[a,l,u]=Sr(o,s,i),g=a.length,d=n?Math.max(l.startColumn,u.startColumn):Math.min(l.startColumn,u.startColumn),f=n?d+s.__colSpan-1:d-1,m=o.getFirstChild();Yt(m)||lt(120);let y=null;function b(S=bn.NO_STATUS){const A=ui(S).append(_t());return y===null&&(y=A),A}let C=m;e:for(let S=0;S<g;S++){if(S!==0){const I=C.getNextSibling();Yt(I)||lt(121),C=I}const A=a[S],v=A[f<0?0:f].cell.__headerState,k=fd(v,bn.ROW);if(f<0){Om(C,b(k));continue}const{cell:T,startColumn:N,startRow:h}=A[f];if(N+T.__colSpan-1<=f){let I=T,O=h,j=f;for(;O!==S&&I.__rowSpan>1;){if(j-=T.__colSpan,!(j>=0)){C.append(b(k));continue e}{const{cell:P,startRow:q}=A[j];I=P,O=q}}I.insertAfter(b(k))}else T.setColSpan(T.__colSpan+1)}y!==null&&Fo(y)}function Wx(){const n=ge();he(n)||It(n)||lt(118);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=zn(e),[s]=zn(t),[o,a,l]=Sr(i,r,s),{startRow:u}=a,{startRow:g}=l,d=g+s.__rowSpan-1;if(o.length===d-u+1)return void i.remove();const f=o[0].length,m=o[d+1],y=i.getChildAtIndex(d+1);for(let b=d;b>=u;b--){for(let S=f-1;S>=0;S--){const{cell:A,startRow:v,startColumn:k}=o[b][S];if(k===S&&(b===u&&v<u&&A.setRowSpan(A.__rowSpan-(v-u)),v>=u&&v+A.__rowSpan-1>d))if(A.setRowSpan(A.__rowSpan-(d-v+1)),y===null&&lt(122),S===0)Om(y,A);else{const{cell:T}=m[S-1];T.insertAfter(A)}}const C=i.getChildAtIndex(b);Yt(C)||lt(123,String(b)),C.remove()}if(m!==void 0){const{cell:b}=m[0];Fo(b)}else{const b=o[u-1],{cell:C}=b[0];Fo(C)}}function $x(){const n=ge();he(n)||It(n)||lt(118);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=zn(e),[s]=zn(t),[o,a,l]=Sr(i,r,s),{startColumn:u}=a,{startRow:g,startColumn:d}=l,f=Math.min(u,d),m=Math.max(u+r.__colSpan-1,d+s.__colSpan-1),y=m-f+1;if(o[0].length===m-f+1)return i.selectPrevious(),void i.remove();const b=o.length;for(let A=0;A<b;A++)for(let v=f;v<=m;v++){const{cell:k,startColumn:T}=o[A][v];if(T<f){if(v===f){const N=f-T;k.setColSpan(k.__colSpan-Math.min(y,k.__colSpan-N))}}else if(T+k.__colSpan-1>m){if(v===m){const N=m-T+1;k.setColSpan(k.__colSpan-N)}}else k.remove()}const C=o[g],S=u>d?C[u+r.__colSpan]:C[d+s.__colSpan];if(S!==void 0){const{cell:A}=S;Fo(A)}else{const A=d<u?C[d-1]:C[u-1],{cell:v}=A;Fo(v)}}function Fo(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function Om(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function Sr(n,e,t){const[r,i,s]=jm(n,e,t);return i===null&&lt(110),s===null&&lt(111),[r,i,s]}function jm(n,e,t){const r=[];let i=null,s=null;function o(u,g,d){const f={cell:d,startColumn:g,startRow:u},m=d.__rowSpan,y=d.__colSpan;for(let b=0;b<m;b++){r[u+b]===void 0&&(r[u+b]=[]);for(let C=0;C<y;C++)r[u+b][g+C]=f}e!==null&&e.is(d)&&(i=f),t!==null&&t.is(d)&&(s=f)}function a(u,g){return r[u]===void 0||r[u][g]===void 0}const l=n.getChildren();for(let u=0;u<l.length;u++){const g=l[u];Yt(g)||lt(146);const d=g.getChildren();let f=0;for(const m of d){for(Ue(m)||lt(147);!a(u,f);)f++;o(u,f,m),f+=m.__colSpan}}return[r,i,s]}function zn(n){let e;if(n instanceof Hr)e=n;else if("__type"in n){const i=it(n,Ue);Ue(i)||lt(148),e=i}else{const i=it(n.getNode(),Ue);Ue(i)||lt(148),e=i}const t=e.getParent();Yt(t)||lt(149);const r=t.getParent();return At(r)||lt(150),[e,t,r]}function Pm(n){const[e,,t]=zn(n),r=t.getChildren(),i=r.length,s=r[0].getChildren().length,o=new Array(i);for(let a=0;a<i;a++)o[a]=new Array(s);for(let a=0;a<i;a++){const l=r[a].getChildren();let u=0;for(let g=0;g<l.length;g++){for(;o[a][u];)u++;const d=l[g],f=d.__rowSpan||1,m=d.__colSpan||1;for(let y=0;y<f;y++)for(let b=0;b<m;b++)o[a+y][u+b]=d;if(e===d)return{colSpan:m,columnIndex:u,rowIndex:a,rowSpan:f};u+=m}}return null}class Cl{constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!It(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new Cl(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();ie(t)||lt(151),xc(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=tt(this.anchor.key);Ue(e)||lt(152);const t=Pm(e);t===null&&lt(153);const r=tt(this.focus.key);Ue(r)||lt(154);const i=Pm(r);i===null&&lt(155);const s=Math.min(t.columnIndex,i.columnIndex),o=Math.max(t.columnIndex,i.columnIndex),a=Math.min(t.rowIndex,i.rowIndex),l=Math.max(t.rowIndex,i.rowIndex);return{fromX:Math.min(s,o),fromY:Math.min(a,l),toX:Math.max(s,o),toY:Math.max(a,l)}}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor.getNode(),r=this.focus.getNode(),i=it(t,Ue),s=it(r,Ue);Ue(i)||lt(152),Ue(s)||lt(154);const o=i.getParent();Yt(o)||lt(156);const a=o.getParent();At(a)||lt(157);const l=s.getParents()[1];if(l!==a){if(a.isParentOf(s)){const h=l.getParent();h==null&&lt(159),this.set(this.tableKey,s.getKey(),h.getKey())}else{const h=a.getParent();h==null&&lt(158),this.set(this.tableKey,h.getKey(),s.getKey())}return this.getNodes()}const[u,g,d]=Sr(a,i,s);let f=Math.min(g.startColumn,d.startColumn),m=Math.min(g.startRow,d.startRow),y=Math.max(g.startColumn+g.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),b=Math.max(g.startRow+g.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),C=f,S=m,A=f,v=m;function k(h){const{cell:I,startColumn:O,startRow:j}=h;f=Math.min(f,O),m=Math.min(m,j),y=Math.max(y,O+I.__colSpan-1),b=Math.max(b,j+I.__rowSpan-1)}for(;f<C||m<S||y>A||b>v;){if(f<C){const h=v-S,I=C-1;for(let O=0;O<=h;O++)k(u[S+O][I]);C=I}if(m<S){const h=A-C,I=S-1;for(let O=0;O<=h;O++)k(u[I][C+O]);S=I}if(y>A){const h=v-S,I=A+1;for(let O=0;O<=h;O++)k(u[S+O][I]);A=I}if(b>v){const h=A-C,I=v+1;for(let O=0;O<=h;O++)k(u[I][C+O]);v=I}}const T=[a];let N=null;for(let h=m;h<=b;h++)for(let I=f;I<=y;I++){const{cell:O}=u[h][I],j=O.getParent();Yt(j)||lt(160),j!==N&&T.push(j),T.push(O,...Yx(O)),N=j}return ls()||(this._cachedNodes=T),T}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}}function It(n){return n instanceof Cl}function hd(){const n=Wn("root",0,"element"),e=Wn("root",0,"element");return new Cl("root",n,e)}function Yx(n){const e=[],t=[n];for(;t.length>0;){const r=t.pop();r===void 0&&lt(112),ie(r)&&t.unshift(...r.getChildren()),r!==n&&e.push(r)}return e}class Vx{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){const e=new MutationObserver(t=>{this.editor.update(()=>{let r=!1;for(let s=0;s<t.length;s++){const o=t[s].target.nodeName;if(o==="TABLE"||o==="TBODY"||o==="THEAD"||o==="TR"){r=!0;break}}if(!r)return;const i=this.editor.getElementByKey(this.tableNodeKey);if(!i)throw new Error("Expected to find TableElement in DOM");this.table=zo(i)})});this.editor.update(()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=zo(t),e.observe(t,{childList:!0,subtree:!0})})}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{if(!At(tt(this.tableNodeKey)))throw new Error("Expected TableNode.");const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");const r=zo(t);Sl(e,r,null),Nt(null),e.dispatchCommand(Hn,void 0)})}enableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Qv(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Io(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),Sl(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const r=this.editor;r.update(()=>{const i=tt(this.tableNodeKey);if(!At(i))throw new Error("Expected TableNode.");if(!r.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const s=e.x,o=e.y;if(this.focusCell=e,this.anchorCell!==null){const a=Fm(r._window);a&&a.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===s&&this.anchorY===o&&!t){if(s===this.focusX&&o===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=s,this.focusY=o,this.isHighlightingCells){const a=Pt(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&Ue(a)&&i.is(Ms(a))){const l=a.getKey();this.tableSelection=this.tableSelection.clone()||hd(),this.focusCellNodeKey=l,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Nt(this.tableSelection),r.dispatchCommand(Hn,void 0),Sl(r,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{const t=Pt(e.elem);if(Ue(t)){const r=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():hd(),this.anchorCellNodeKey=r}})}formatCells(e){this.editor.update(()=>{const t=ge();It(t)||lt(11);const r=Oa(),i=r.anchor,s=r.focus;t.getNodes().forEach(o=>{Ue(o)&&o.getTextContentSize()!==0&&(i.set(o.getKey(),0,"element"),s.set(o.getKey(),o.getChildrenSize(),"element"),r.formatText(e))}),Nt(t),this.editor.dispatchCommand(Hn,void 0)})}clearText(){const e=this.editor;e.update(()=>{const t=tt(this.tableNodeKey);if(!At(t))throw new Error("Expected TableNode.");const r=ge();It(r)||lt(11);const i=r.getNodes().filter(Ue);i.length!==this.table.columns*this.table.rows?(i.forEach(s=>{if(ie(s)){const o=_t(),a=Bt();o.append(a),s.append(o),s.getChildren().forEach(l=>{l!==o&&l.remove()})}}),Sl(e,this.table,null),Nt(null),e.dispatchCommand(Hn,void 0)):(t.selectPrevious(),t.remove(),dt().selectStart())})}}const qx="__lexicalTableSelection",Fm=n=>Bx?(n||window).getSelection():null;function Kx(n,e,t,r){const i=t.getRootElement();if(i===null)throw new Error("No root element.");const s=new Vx(t,n.getKey()),o=t._window||window;(function(d,f){d[qx]=f})(e,s);const a=()=>{const d=()=>{s.isSelecting=!1,o.removeEventListener("mouseup",d),o.removeEventListener("mousemove",f)},f=m=>{setTimeout(()=>{if(1&~m.buttons&&s.isSelecting)return s.isSelecting=!1,o.removeEventListener("mouseup",d),void o.removeEventListener("mousemove",f);const y=gd(m.target);y===null||s.anchorX===y.x&&s.anchorY===y.y||(m.preventDefault(),s.setFocusCellForSelection(y))},0)};return{onMouseMove:f,onMouseUp:d}};e.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button!==0||!o)return;const f=gd(d.target);f!==null&&(Wi(d),s.setAnchorCellForSelection(f));const{onMouseUp:m,onMouseMove:y}=a();s.isSelecting=!0,o.addEventListener("mouseup",m),o.addEventListener("mousemove",y)},0)});const l=d=>{d.button===0&&t.update(()=>{const f=ge(),m=d.target;It(f)&&f.tableKey===s.tableNodeKey&&i.contains(m)&&s.clearHighlight()})};o.addEventListener("mousedown",l),s.listenersToRemove.add(()=>o.removeEventListener("mousedown",l)),s.listenersToRemove.add(t.registerCommand(oc,d=>Bo(t,d,"down",n,s),$n)),s.listenersToRemove.add(t.registerCommand(sc,d=>Bo(t,d,"up",n,s),$n)),s.listenersToRemove.add(t.registerCommand(ic,d=>Bo(t,d,"backward",n,s),$n)),s.listenersToRemove.add(t.registerCommand(rc,d=>Bo(t,d,"forward",n,s),$n)),s.listenersToRemove.add(t.registerCommand(qs,d=>{const f=ge();if(It(f)){const m=it(f.focus.getNode(),Ue);if(Ue(m))return Wi(d),m.selectEnd(),!0}return!1},$n)),[Zi,xi,qr].forEach(d=>{s.listenersToRemove.add(t.registerCommand(d,(f=>()=>{const m=ge();if(!di(m,n))return!1;if(It(m))return s.clearText(),!0;if(he(m)){const y=it(m.anchor.getNode(),T=>Ue(T));if(!Ue(y))return!1;const b=m.anchor.getNode(),C=m.focus.getNode(),S=n.isParentOf(b),A=n.isParentOf(C);if(S&&!A||A&&!S)return s.clearText(),!0;const v=it(m.anchor.getNode(),T=>ie(T)),k=v&&it(v,T=>ie(T)&&Ue(T.getParent()));if(!ie(k)||!ie(v))return!1;if(f===xi&&k.getPreviousSibling()===null)return!0}return!1})(d),rr))});const u=d=>{const f=ge();if(!di(f,n)){const m=f?f.getNodes():null;if(m){const y=m.find(b=>At(b)&&b.getKey()===s.tableNodeKey);if(At(y)){const b=y.getParent();if(!b)return!1;const C=y.getNextSibling()||y.getPreviousSibling();y.remove(),C?C.selectStart():b.selectStart()}}return!0}if(It(f))return d.preventDefault(),d.stopPropagation(),s.clearText(),!0;if(he(f)){const m=it(f.anchor.getNode(),y=>Ue(y));if(!Ue(m))return!1}return!1};function g(d){const f=n.getCordsFromCellNode(d,s.table);return n.getDOMCellFromCordsOrThrow(f.x,f.y,s.table)}return s.listenersToRemove.add(t.registerCommand(Vs,u,rr)),s.listenersToRemove.add(t.registerCommand(Ks,u,rr)),s.listenersToRemove.add(t.registerCommand(mn,d=>{const f=ge();if(!di(f,n))return!1;if(It(f))return s.formatCells(d),!0;if(he(f)){const m=it(f.anchor.getNode(),y=>Ue(y));if(!Ue(m))return!1}return!1},rr)),s.listenersToRemove.add(t.registerCommand(Qi,d=>{const f=ge();if(!It(f)||!di(f,n))return!1;const m=f.anchor.getNode(),y=f.focus.getNode();if(!Ue(m)||!Ue(y))return!1;const[b,C,S]=Sr(n,m,y),A=Math.max(C.startRow,S.startRow),v=Math.max(C.startColumn,S.startColumn),k=Math.min(C.startRow,S.startRow),T=Math.min(C.startColumn,S.startColumn);for(let N=k;N<=A;N++)for(let h=T;h<=v;h++){const I=b[N][h].cell;I.setFormat(d);const O=I.getChildren();for(let j=0;j<O.length;j++){const P=O[j];ie(P)&&!P.isInline()&&P.setFormat(d)}}return!0},rr)),s.listenersToRemove.add(t.registerCommand(vi,d=>{const f=ge();if(!di(f,n))return!1;if(It(f))return s.clearHighlight(),!1;if(he(f)){const m=it(f.anchor.getNode(),y=>Ue(y));if(!Ue(m))return!1;if(typeof d=="string"){const y=$m(t,f,n);if(y)return Wm(y,n,[Bt(d)]),!0}}return!1},rr)),r&&s.listenersToRemove.add(t.registerCommand(bf,d=>{const f=ge();if(!he(f)||!f.isCollapsed()||!di(f,n))return!1;const m=yd(f.anchor.getNode());if(m===null)return!1;Wi(d);const y=n.getCordsFromCellNode(m,s.table);return Bm(s,n,y.x,y.y,d.shiftKey?"backward":"forward"),!0},rr)),s.listenersToRemove.add(t.registerCommand(cc,d=>n.isSelected(),$n)),s.listenersToRemove.add(t.registerCommand(_f,d=>{const{nodes:f,selection:m}=d,y=m.getStartEndPoints(),b=It(m),C=he(m)&&it(m.anchor.getNode(),de=>Ue(de))!==null&&it(m.focus.getNode(),de=>Ue(de))!==null||b;if(f.length!==1||!At(f[0])||!C||y===null)return!1;const[S]=y,A=f[0],v=A.getChildren(),k=A.getFirstChildOrThrow().getChildrenSize(),T=A.getChildrenSize(),N=it(S.getNode(),de=>Ue(de)),h=N&&it(N,de=>Yt(de)),I=h&&it(h,de=>At(de));if(!Ue(N)||!Yt(h)||!At(I))return!1;const O=h.getIndexWithinParent(),j=Math.min(I.getChildrenSize()-1,O+T-1),P=N.getIndexWithinParent(),q=Math.min(h.getChildrenSize()-1,P+k-1),G=Math.min(P,q),ne=Math.min(O,j),oe=Math.max(P,q),ue=Math.max(O,j),fe=I.getChildren();let Ee,be,ae=0;for(let de=ne;de<=ue;de++){const xe=fe[de];if(!Yt(xe))return!1;const Te=v[ae];if(!Yt(Te))return!1;const ve=xe.getChildren(),Fe=Te.getChildren();let Ae=0;for(let Ne=G;Ne<=oe;Ne++){const ze=ve[Ne];if(!Ue(ze))return!1;const Ce=Fe[Ae];if(!Ue(Ce))return!1;de===ne&&Ne===G?Ee=ze.getKey():de===ue&&Ne===oe&&(be=ze.getKey());const Pe=ze.getChildren();Ce.getChildren().forEach(ft=>{me(ft)&&_t().append(ft),ze.append(ft)}),Pe.forEach(ft=>ft.remove()),Ae++}ae++}if(Ee&&be){const de=hd();de.set(f[0].getKey(),Ee,be),Nt(de)}return!0},rr)),s.listenersToRemove.add(t.registerCommand(Hn,()=>{const d=ge(),f=ti();if(he(d)){const{anchor:m,focus:y}=d,b=m.getNode(),C=y.getNode(),S=yd(b),A=yd(C),v=!(!S||!n.is(Ms(S))),k=!(!A||!n.is(Ms(A))),T=v!==k,N=v&&k,h=d.isBackward();if(T){const I=d.clone();if(k){const[O]=Sr(n,A,A),j=O[0][0].cell,P=O[O.length-1].at(-1).cell;I.focus.set(h?j.getKey():P.getKey(),h?j.getChildrenSize():P.getChildrenSize(),"element")}else I.anchor.set(n.getParentOrThrow().getKey(),h?n.getIndexWithinParent()+1:n.getIndexWithinParent(),"element");Nt(I),zm(t,s)}else N&&(S.is(A)||(s.setAnchorCellForSelection(g(S)),s.setFocusCellForSelection(g(A),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:I,onMouseMove:O}=a();s.isSelecting=!0,o.addEventListener("mouseup",I),o.addEventListener("mousemove",O)},0)))}else if(d&&It(d)&&d.is(f)&&d.tableKey===n.getKey()){const m=Fm(t._window);if(m&&m.anchorNode&&m.focusNode){const y=Pt(m.focusNode),b=y&&!n.is(Ms(y)),C=Pt(m.anchorNode),S=C&&n.is(Ms(C));if(b&&S&&m.rangeCount>0){const A=F0(m,t);A&&(A.anchor.set(n.getKey(),d.isBackward()?n.getChildrenSize():0,"element"),m.removeAllRanges(),Nt(A))}}}return d&&!d.is(f)&&(It(d)||It(f))&&s.tableSelection&&!s.tableSelection.is(f)?(It(d)&&d.tableKey===s.tableNodeKey?s.updateTableTableSelection(d):!It(d)&&It(f)&&f.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?function(m,y){y.enableHighlightStyle(),pd(y.table,b=>{const C=b.elem;b.highlighted=!1,Hm(m,b),C.getAttribute("style")||C.removeAttribute("style")})}(t,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&zm(t,s),!1)},rr)),s.listenersToRemove.add(t.registerCommand(Ys,()=>{const d=ge();if(!he(d)||!d.isCollapsed()||!di(d,n))return!1;const f=$m(t,d,n);return!!f&&(Wm(f,n),!0)},rr)),s}function gd(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function zo(n){const e=[],t={columns:0,domRows:e,rows:0};let r=n.firstChild,i=0,s=0;for(e.length=0;r!=null;){const o=r.nodeName;if(o==="TD"||o==="TH"){const u={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:i,y:s};r._cell=u;let g=e[s];g===void 0&&(g=e[s]=[]),g[i]=u}else{const u=r.firstChild;if(u!=null){r=u;continue}}const a=r.nextSibling;if(a!=null){i++,r=a;continue}const l=r.parentNode;if(l!=null){const u=l.nextSibling;if(u==null)break;s++,i=0,r=u}}return t.columns=i+1,t.rows=s+1,t}function Sl(n,e,t){const r=new Set(t?t.getNodes():[]);pd(e,(i,s)=>{const o=i.elem;r.has(s)?(i.highlighted=!0,Um(n,i)):(i.highlighted=!1,Hm(n,i),o.getAttribute("style")||o.removeAttribute("style"))})}function pd(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const i=t[r];if(i)for(let s=0;s<i.length;s++){const o=i[s];if(!o)continue;const a=Pt(o.elem);a!==null&&e(o,a,{x:s,y:r})}}}function zm(n,e){e.disableHighlightStyle(),pd(e.table,t=>{t.highlighted=!0,Um(n,t)})}const Bm=(n,e,t,r,i)=>{const s=i==="forward";switch(i){case"backward":case"forward":return t!==(s?n.table.columns-1:0)?Tl(e.getCellNodeFromCordsOrThrow(t+(s?1:-1),r,n.table),s):r!==(s?n.table.rows-1:0)?Tl(e.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,r+(s?1:-1),n.table),s):s?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?Tl(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?Tl(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}},Gx=(n,e,t,r,i)=>{const s=i==="forward";switch(i){case"backward":case"forward":return t!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(s?1:-1),r,n.table)),!0;case"up":return r!==0&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r-1,n.table)),!0);case"down":return r!==n.table.rows-1&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r+1,n.table)),!0);default:return!1}};function di(n,e){if(he(n)||It(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function Tl(n,e){e?n.selectStart():n.selectEnd()}const md="172,206,247";function Um(n,e){const t=e.elem,r=Pt(t);Ue(r)||lt(131),r.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${md})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${md},0.85), rgba(${md},0.85))`),t.style.setProperty("caret-color","transparent")}function Hm(n,e){const t=e.elem,r=Pt(t);Ue(r)||lt(131),r.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function yd(n){const e=it(n,Ue);return Ue(e)?e:null}function Ms(n){const e=it(n,At);return At(e)?e:null}function Bo(n,e,t,r,i){if((t==="up"||t==="down")&&function(o){const a=o.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1}(n))return!1;const s=ge();if(!di(s,r)){if(he(s)){if(s.isCollapsed()&&t==="backward"){const o=s.anchor.type,a=s.anchor.offset;if(o!=="element"&&(o!=="text"||a!==0))return!1;const l=s.anchor.getNode();if(!l)return!1;const u=it(l,d=>ie(d)&&!d.isInline());if(!u)return!1;const g=u.getPreviousSibling();return!(!g||!At(g))&&(Wi(e),g.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const o=s.anchor.getNode();if(un(o)){const a=s.getNodes()[0];if(a){const l=it(a,Ue);if(l&&r.isParentOf(l)){const u=r.getFirstDescendant(),g=r.getLastDescendant();if(!u||!g)return!1;const[d]=zn(u),[f]=zn(g),m=r.getCordsFromCellNode(d,i.table),y=r.getCordsFromCellNode(f,i.table),b=r.getDOMCellFromCordsOrThrow(m.x,m.y,i.table),C=r.getDOMCellFromCordsOrThrow(y.x,y.y,i.table);return i.setAnchorCellForSelection(b),i.setFocusCellForSelection(C,!0),!0}}return!1}{const a=it(o,u=>ie(u)&&!u.isInline());if(!a)return!1;const l=t==="down"?a.getNextSibling():a.getPreviousSibling();if(At(l)&&i.tableNodeKey===l.getKey()){const u=l.getFirstDescendant(),g=l.getLastDescendant();if(!u||!g)return!1;const[d]=zn(u),[f]=zn(g),m=s.clone();return m.focus.set((t==="up"?d:f).getKey(),t==="up"?0:f.getChildrenSize(),"element"),Nt(m),!0}}}}return!1}if(he(s)&&s.isCollapsed()){const{anchor:o,focus:a}=s,l=it(o.getNode(),Ue),u=it(a.getNode(),Ue);if(!Ue(l)||!l.is(u))return!1;const g=Ms(l);if(g!==r&&g!=null){const S=n.getElementByKey(g.getKey());if(S!=null)return i.table=zo(S),Bo(n,e,t,g,i)}if(t==="backward"||t==="forward"){const S=o.type,A=o.offset,v=o.getNode();if(!v)return!1;const k=s.getNodes();return(k.length!==1||!gt(k[0]))&&!!function(T,N,h,I){return function(O,j,P){return O==="element"&&(P==="backward"?j.getPreviousSibling()===null:j.getNextSibling()===null)}(T,h,I)||function(O,j,P,q){const G=it(P,oe=>ie(oe)&&!oe.isInline());if(!G)return!1;const ne=q==="backward"?j===0:j===P.getTextContentSize();return O==="text"&&ne&&(q==="backward"?G.getPreviousSibling()===null:G.getNextSibling()===null)}(T,N,h,I)}(S,A,v,t)&&function(T,N,h,I){const O=it(N,Ue);if(!Ue(O))return!1;const[j,P]=Sr(h,O,O);if(!function(G,ne,oe){const ue=G[0][0],fe=G[G.length-1][G[0].length-1],{startColumn:Ee,startRow:be}=ne;return oe==="backward"?Ee===ue.startColumn&&be===ue.startRow:Ee===fe.startColumn&&be===fe.startRow}(j,P,I))return!1;const q=function(G,ne,oe){const ue=it(G,Ee=>ie(Ee)&&!Ee.isInline());if(!ue)return;const fe=ne==="backward"?ue.getPreviousSibling():ue.getNextSibling();return fe&&At(fe)?fe:ne==="backward"?oe.getPreviousSibling():oe.getNextSibling()}(N,I,h);return!q||At(q)?!1:(Wi(T),I==="backward"?q.selectEnd():q.selectStart(),!0)}(e,v,r,t)}const d=n.getElementByKey(l.__key),f=n.getElementByKey(o.key);if(f==null||d==null)return!1;let m;if(o.type==="element")m=f.getBoundingClientRect();else{const S=window.getSelection();if(S===null||S.rangeCount===0)return!1;m=S.getRangeAt(0).getBoundingClientRect()}const y=t==="up"?l.getFirstChild():l.getLastChild();if(y==null)return!1;const b=n.getElementByKey(y.__key);if(b==null)return!1;const C=b.getBoundingClientRect();if(t==="up"?C.top>m.top-m.height:m.bottom+m.height>C.bottom){Wi(e);const S=r.getCordsFromCellNode(l,i.table);if(!e.shiftKey)return Bm(i,r,S.x,S.y,t);{const A=r.getDOMCellFromCordsOrThrow(S.x,S.y,i.table);i.setAnchorCellForSelection(A),i.setFocusCellForSelection(A,!0)}return!0}}else if(It(s)){const{anchor:o,focus:a}=s,l=it(o.getNode(),Ue),u=it(a.getNode(),Ue),[g]=s.getNodes(),d=n.getElementByKey(g.getKey());if(!Ue(l)||!Ue(u)||!At(g)||d==null)return!1;i.updateTableTableSelection(s);const f=zo(d),m=r.getCordsFromCellNode(l,f),y=r.getDOMCellFromCordsOrThrow(m.x,m.y,f);if(i.setAnchorCellForSelection(y),Wi(e),e.shiftKey){const b=r.getCordsFromCellNode(u,f);return Gx(i,g,b.x,b.y,t)}return u.selectEnd(),!0}return!1}function Wi(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function Wm(n,e,t){const r=_t();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function $m(n,e,t){const r=t.getParent();if(!r)return;const i=n.getElementByKey(r.getKey());if(!i)return;const s=window.getSelection();if(!s||s.anchorNode!==i)return;const o=it(e.anchor.getNode(),C=>Ue(C));if(!o)return;const a=it(o,C=>At(C));if(!At(a)||!a.is(t))return;const[l,u]=Sr(t,o,o),g=l[0][0],d=l[l.length-1][l[0].length-1],{startRow:f,startColumn:m}=u,y=f===g.startRow&&m===g.startColumn,b=f===d.startRow&&m===d.startColumn;return y?"first":b?"last":void 0}class Tr extends ni{static getType(){return"table"}static clone(e){return new Tr(e.__key)}static importDOM(){return{table:e=>({conversion:Xx,priority:1})}}static importJSON(e){return _d()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const r=document.createElement("table");return Io(r,e.theme.table),r}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:t=>{if(t){const r=t.cloneNode(),i=document.createElement("colgroup"),s=document.createElement("tbody");no(t)&&s.append(...t.children);const o=this.getFirstChildOrThrow();if(!Yt(o))throw new Error("Expected to find row node.");const a=o.getChildrenSize();for(let l=0;l<a;l++){const u=document.createElement("col");i.append(u)}return r.replaceChildren(i,s),r}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:i}=t;for(let s=0;s<r;s++){const o=i[s];if(o==null)continue;const a=o.findIndex(l=>{if(!l)return;const{elem:u}=l;return Pt(u)===e});if(a!==-1)return{x:a,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:i}=r,s=i[t];if(s==null)return null;const o=s[e];return o??null}getDOMCellFromCordsOrThrow(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(i==null)return null;const s=Pt(i.elem);return Ue(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const i=this.getCellNodeFromCords(e,t,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}canSelectBefore(){return!0}canIndent(){return!1}}function Xx(n){return{node:_d()}}function _d(){return dr(new Tr)}function At(n){return n instanceof Tr}const Jx=tn.lazy(()=>Promise.resolve().then(()=>oE));function Zx(n){const e=n;if(e.src.startsWith("file:///"))return null;const{alt:t,src:r,width:i,height:s}=e;return{node:Uo({altText:t,height:s,src:r,width:i})}}let El=class I_ extends nu{constructor(t,r,i,s,o,a,l,u,g){super(g);pn(this,"__src");pn(this,"__altText");pn(this,"__width");pn(this,"__height");pn(this,"__maxWidth");pn(this,"__showCaption");pn(this,"__caption");pn(this,"__captionsEnabled");this.__src=t,this.__altText=r,this.__maxWidth=i,this.__width=s||"inherit",this.__height=o||"inherit",this.__showCaption=a||!1,this.__caption=l||Ha(),this.__captionsEnabled=u||u===void 0}static getType(){return"image"}static clone(t){return new I_(t.__src,t.__altText,t.__maxWidth,t.__width,t.__height,t.__showCaption,t.__caption,t.__captionsEnabled,t.__key)}static importJSON(t){const{altText:r,height:i,width:s,maxWidth:o,caption:a,src:l,showCaption:u}=t,g=Uo({altText:r,height:i,maxWidth:o,showCaption:u,src:l,width:s}),d=g.__caption,f=d.parseEditorState(a.editorState);return f&&!f.isEmpty()&&d.setEditorState(f),g}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),t.setAttribute("alt",this.__altText),t.setAttribute("width",this.__width.toString()),t.setAttribute("height",this.__height.toString()),{element:t}}static importDOM(){return{img:t=>({conversion:Zx,priority:0})}}exportJSON(){return{altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height==="inherit"?0:this.__height,maxWidth:this.__maxWidth,showCaption:this.__showCaption,src:this.getSrc(),type:"image",version:1,width:this.__width==="inherit"?0:this.__width}}setWidthAndHeight(t,r){const i=this.getWritable();i.__width=t,i.__height=r}setShowCaption(t){const r=this.getWritable();r.__showCaption=t}createDOM(t){const r=document.createElement("span"),s=t.theme.image;return s!==void 0&&(r.className=s),r}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__altText}decorate(){return F.jsx(U.Suspense,{fallback:null,children:F.jsx(Jx,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,maxWidth:this.__maxWidth,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,captionsEnabled:this.__captionsEnabled,resizable:!0})})}};function Uo({altText:n,height:e,maxWidth:t,captionsEnabled:r,src:i,width:s,showCaption:o,caption:a,key:l}){return dr(new El(i,n,t,s,e,o,a,r,l))}function kl(n){return n instanceof El}const Qx=tn.lazy(()=>Promise.resolve().then(()=>uE));function eC(n){if(n instanceof HTMLImageElement){const{alt:e,src:t,width:r,height:i}=n;return{node:bd({altText:e,height:i,src:t,width:r})}}return null}let Nl=class R_ extends nu{constructor(t,r,i,s,o,a,l,u){super(u);pn(this,"__src");pn(this,"__altText");pn(this,"__width");pn(this,"__height");pn(this,"__showCaption");pn(this,"__caption");pn(this,"__position");this.__src=t,this.__altText=r,this.__width=s||"inherit",this.__height=o||"inherit",this.__showCaption=a||!1,this.__caption=l||Ha(),this.__position=i}static getType(){return"inline-image"}static clone(t){return new R_(t.__src,t.__altText,t.__position,t.__width,t.__height,t.__showCaption,t.__caption,t.__key)}static importJSON(t){const{altText:r,height:i,width:s,caption:o,src:a,showCaption:l,position:u}=t,g=bd({altText:r,height:i,position:u,showCaption:l,src:a,width:s}),d=g.__caption,f=d.parseEditorState(o.editorState);return f&&!f.isEmpty()&&d.setEditorState(f),g}static importDOM(){return{img:t=>({conversion:eC,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),t.setAttribute("alt",this.__altText),t.setAttribute("width",this.__width.toString()),t.setAttribute("height",this.__height.toString()),{element:t}}exportJSON(){return{altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height==="inherit"?0:this.__height,position:this.__position,showCaption:this.__showCaption,src:this.getSrc(),type:"inline-image",version:1,width:this.__width==="inherit"?0:this.__width}}getSrc(){return this.__src}getAltText(){return this.__altText}setAltText(t){const r=this.getWritable();r.__altText=t}setWidthAndHeight(t,r){const i=this.getWritable();i.__width=t,i.__height=r}getShowCaption(){return this.__showCaption}setShowCaption(t){const r=this.getWritable();r.__showCaption=t}getPosition(){return this.__position}setPosition(t){const r=this.getWritable();r.__position=t}update(t){const r=this.getWritable(),{altText:i,showCaption:s,position:o}=t;i!==void 0&&(r.__altText=i),s!==void 0&&(r.__showCaption=s),o!==void 0&&(r.__position=o)}createDOM(t){const r=document.createElement("span"),i=`${t.theme.inlineImage} position-${this.__position}`;return i!==void 0&&(r.className=i),r}updateDOM(t,r,i){const s=this.__position;if(s!==t.__position){const o=`${i.theme.inlineImage} position-${s}`;o!==void 0&&(r.className=o)}return!1}decorate(){return F.jsx(U.Suspense,{fallback:null,children:F.jsx(Qx,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,position:this.__position})})}};function bd({altText:n,position:e,height:t,src:r,width:i,showCaption:s,caption:o,key:a}){return dr(new Nl(r,n,e,i,t,s,o,a))}function Ym(n){return n instanceof Nl}function Vm(n,e){const t=e.body?e.body.childNodes:[];let r=[];const i=[];for(let s=0;s<t.length;s++){const o=t[s];if(!Km.has(o.nodeName)){const a=Gm(o,n,i,!1);a!==null&&(r=r.concat(a))}}return function(s){for(const o of s)o.getNextSibling()instanceof iu&&o.insertAfter(as());for(const o of s){const a=o.getChildren();for(const l of a)o.insertBefore(l);o.remove()}}(i),r}function tC(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=dt().getChildren();for(let i=0;i<r.length;i++)qm(n,r[i],t,e);return t.innerHTML}function qm(n,e,t,r=null){let i=r===null||e.isSelected(r);const s=ie(e)&&e.excludeFromCopy("html");let o=e;if(r!==null){let m=Ap(e);m=me(m)&&r!==null?Ip(r,m):m,o=m}const a=ie(o)?o.getChildren():[],l=n._nodes.get(o.getType());let u;u=l&&l.exportDOM!==void 0?l.exportDOM(n,o):o.exportDOM(n);const{element:g,after:d}=u;if(!g)return!1;const f=document.createDocumentFragment();for(let m=0;m<a.length;m++){const y=a[m],b=qm(n,y,f,r);!i&&ie(e)&&b&&e.extractWithChild(y,r,"html")&&(i=!0)}if(i&&!s){if(no(g)&&g.append(f),t.append(g),d){const m=d.call(o,g);m&&g.replaceWith(m)}}else t.append(f);return i}const Km=new Set(["STYLE","SCRIPT"]);function Gm(n,e,t,r,i=new Map,s){let o=[];if(Km.has(n.nodeName))return o;let a=null;const l=function(y,b){const{nodeName:C}=y,S=b._htmlConversions.get(C.toLowerCase());let A=null;if(S!==void 0)for(const v of S){const k=v(y);k!==null&&(A===null||(A.priority||0)<(k.priority||0))&&(A=k)}return A!==null?A.conversion:null}(n,e),u=l?l(n):null;let g=null;if(u!==null){g=u.after;const y=u.node;if(a=Array.isArray(y)?y[y.length-1]:y,a!==null){for(const[,b]of i)if(a=b(a,s),!a)break;a&&o.push(...Array.isArray(y)?y:[a])}u.forChild!=null&&i.set(n.nodeName,u.forChild)}const d=n.childNodes;let f=[];const m=(a==null||!un(a))&&(a!=null&&Jc(a)||r);for(let y=0;y<d.length;y++)f.push(...Gm(d[y],e,t,m,new Map(i),a));return g!=null&&(f=g(f)),T0(n)&&(f=nC(n,f,m?()=>{const y=new iu;return t.push(y),y}:_t)),a==null?o=o.concat(f):ie(a)&&a.append(...f),o}function nC(n,e,t){const r=n.style.textAlign,i=[];let s=[];for(let o=0;o<e.length;o++){const a=e[o];if(Jc(a))r&&!a.getFormat()&&a.setFormat(r),i.push(a);else if(s.push(a),o===e.length-1||o<e.length-1&&Jc(e[o+1])){const l=t();l.setFormat(r),l.append(...s),i.push(l),s=[]}}return i}function rC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ml=rC(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const iC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Xm=n=>iC?(n||window).getSelection():null;function sC(n){const e=ge();return e==null&&Ml(166),he(e)&&e.isCollapsed()||e.getNodes().length===0?"":tC(n,e)}function oC(n){const e=ge();return e==null&&Ml(166),he(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(aC(n,e))}function Jm(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const o=JSON.parse(r);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return Zm(t,lC(o.nodes),e)}catch{}const i=n.getData("text/html");if(i)try{const o=new DOMParser().parseFromString(i,"text/html");return Zm(t,Vm(t,o),e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if(he(e)){const o=s.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const l=ge();if(he(l)){const u=o[a];u===`
44
+ `?null:(me(f)&&(l&&f.toggleFormat("bold"),u&&f.toggleFormat("strikethrough"),g&&f.toggleFormat("italic"),d&&f.toggleFormat("underline")),y.append(f),y)}return f},node:i}}function ui(n,e=1,t){return dr(new Hr(n,e,t))}function Ue(n){return n instanceof Hr}const Px=wi();class Ns extends ni{static getType(){return"tablerow"}static clone(e){return new Ns(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:Fx,priority:0})}}static importJSON(e){return Po(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Io(t,e.theme.tableRow),t}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function Fx(n){const e=n;let t;return Mm.test(e.style.height)&&(t=parseFloat(e.style.height)),{node:Po(t)}}function Po(n){return dr(new Ns(n))}function Yt(n){return n instanceof Ns}function zx(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lt=zx(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Bx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0;function Am(n,e,t=!0){const r=_d();for(let i=0;i<n;i++){const s=Po();for(let o=0;o<e;o++){let a=bn.NO_STATUS;typeof t=="object"?(i===0&&t.rows&&(a|=bn.ROW),o===0&&t.columns&&(a|=bn.COLUMN)):t&&(i===0&&(a|=bn.ROW),o===0&&(a|=bn.COLUMN));const l=ui(a),u=_t();u.append(Bt()),l.append(u),s.append(l)}r.append(s)}return r}function Im(n){const e=it(n,t=>Yt(t));if(Yt(e))return e;throw new Error("Expected table cell to be inside of table row.")}function xl(n){const e=it(n,t=>At(t));if(At(e))return e;throw new Error("Expected table cell to be inside of table.")}function Rm(n){const e=Im(n);return xl(e).getChildren().findIndex(t=>t.is(e))}function Lm(n){return Im(n).getChildren().findIndex(e=>e.is(n))}const fd=(n,e)=>n===bn.BOTH||n===e?e:bn.NO_STATUS;function Ux(n=!0){const e=he();de(e)||It(e)||lt(118);const t=e.focus.getNode(),[r,,i]=zn(t),[s,o]=Sr(i,r,r),a=s[0].length,{startRow:l}=o;if(n){const u=l+r.__rowSpan-1,g=s[u],d=Po();for(let m=0;m<a;m++){const{cell:y,startRow:b}=g[m];if(b+y.__rowSpan-1<=u){const C=g[m].cell.__headerState,S=fd(C,bn.COLUMN);d.append(ui(S).append(_t()))}else y.setRowSpan(y.__rowSpan+1)}const f=i.getChildAtIndex(u);Yt(f)||lt(145),f.insertAfter(d)}else{const u=s[l],g=Po();for(let f=0;f<a;f++){const{cell:m,startRow:y}=u[f];if(y===l){const b=u[f].cell.__headerState,C=fd(b,bn.COLUMN);g.append(ui(C).append(_t()))}else m.setRowSpan(m.__rowSpan+1)}const d=i.getChildAtIndex(l);Yt(d)||lt(145),d.insertBefore(g)}}function Hx(n=!0){const e=he();de(e)||It(e)||lt(118);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=zn(t),[s,,o]=zn(r),[a,l,u]=Sr(o,s,i),g=a.length,d=n?Math.max(l.startColumn,u.startColumn):Math.min(l.startColumn,u.startColumn),f=n?d+s.__colSpan-1:d-1,m=o.getFirstChild();Yt(m)||lt(120);let y=null;function b(S=bn.NO_STATUS){const A=ui(S).append(_t());return y===null&&(y=A),A}let C=m;e:for(let S=0;S<g;S++){if(S!==0){const I=C.getNextSibling();Yt(I)||lt(121),C=I}const A=a[S],v=A[f<0?0:f].cell.__headerState,k=fd(v,bn.ROW);if(f<0){Om(C,b(k));continue}const{cell:T,startColumn:N,startRow:h}=A[f];if(N+T.__colSpan-1<=f){let I=T,O=h,j=f;for(;O!==S&&I.__rowSpan>1;){if(j-=T.__colSpan,!(j>=0)){C.append(b(k));continue e}{const{cell:P,startRow:q}=A[j];I=P,O=q}}I.insertAfter(b(k))}else T.setColSpan(T.__colSpan+1)}y!==null&&Fo(y)}function Wx(){const n=he();de(n)||It(n)||lt(118);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=zn(e),[s]=zn(t),[o,a,l]=Sr(i,r,s),{startRow:u}=a,{startRow:g}=l,d=g+s.__rowSpan-1;if(o.length===d-u+1)return void i.remove();const f=o[0].length,m=o[d+1],y=i.getChildAtIndex(d+1);for(let b=d;b>=u;b--){for(let S=f-1;S>=0;S--){const{cell:A,startRow:v,startColumn:k}=o[b][S];if(k===S&&(b===u&&v<u&&A.setRowSpan(A.__rowSpan-(v-u)),v>=u&&v+A.__rowSpan-1>d))if(A.setRowSpan(A.__rowSpan-(d-v+1)),y===null&&lt(122),S===0)Om(y,A);else{const{cell:T}=m[S-1];T.insertAfter(A)}}const C=i.getChildAtIndex(b);Yt(C)||lt(123,String(b)),C.remove()}if(m!==void 0){const{cell:b}=m[0];Fo(b)}else{const b=o[u-1],{cell:C}=b[0];Fo(C)}}function $x(){const n=he();de(n)||It(n)||lt(118);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=zn(e),[s]=zn(t),[o,a,l]=Sr(i,r,s),{startColumn:u}=a,{startRow:g,startColumn:d}=l,f=Math.min(u,d),m=Math.max(u+r.__colSpan-1,d+s.__colSpan-1),y=m-f+1;if(o[0].length===m-f+1)return i.selectPrevious(),void i.remove();const b=o.length;for(let A=0;A<b;A++)for(let v=f;v<=m;v++){const{cell:k,startColumn:T}=o[A][v];if(T<f){if(v===f){const N=f-T;k.setColSpan(k.__colSpan-Math.min(y,k.__colSpan-N))}}else if(T+k.__colSpan-1>m){if(v===m){const N=m-T+1;k.setColSpan(k.__colSpan-N)}}else k.remove()}const C=o[g],S=u>d?C[u+r.__colSpan]:C[d+s.__colSpan];if(S!==void 0){const{cell:A}=S;Fo(A)}else{const A=d<u?C[d-1]:C[u-1],{cell:v}=A;Fo(v)}}function Fo(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function Om(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function Sr(n,e,t){const[r,i,s]=jm(n,e,t);return i===null&&lt(110),s===null&&lt(111),[r,i,s]}function jm(n,e,t){const r=[];let i=null,s=null;function o(u,g,d){const f={cell:d,startColumn:g,startRow:u},m=d.__rowSpan,y=d.__colSpan;for(let b=0;b<m;b++){r[u+b]===void 0&&(r[u+b]=[]);for(let C=0;C<y;C++)r[u+b][g+C]=f}e!==null&&e.is(d)&&(i=f),t!==null&&t.is(d)&&(s=f)}function a(u,g){return r[u]===void 0||r[u][g]===void 0}const l=n.getChildren();for(let u=0;u<l.length;u++){const g=l[u];Yt(g)||lt(146);const d=g.getChildren();let f=0;for(const m of d){for(Ue(m)||lt(147);!a(u,f);)f++;o(u,f,m),f+=m.__colSpan}}return[r,i,s]}function zn(n){let e;if(n instanceof Hr)e=n;else if("__type"in n){const i=it(n,Ue);Ue(i)||lt(148),e=i}else{const i=it(n.getNode(),Ue);Ue(i)||lt(148),e=i}const t=e.getParent();Yt(t)||lt(149);const r=t.getParent();return At(r)||lt(150),[e,t,r]}function Pm(n){const[e,,t]=zn(n),r=t.getChildren(),i=r.length,s=r[0].getChildren().length,o=new Array(i);for(let a=0;a<i;a++)o[a]=new Array(s);for(let a=0;a<i;a++){const l=r[a].getChildren();let u=0;for(let g=0;g<l.length;g++){for(;o[a][u];)u++;const d=l[g],f=d.__rowSpan||1,m=d.__colSpan||1;for(let y=0;y<f;y++)for(let b=0;b<m;b++)o[a+y][u+b]=d;if(e===d)return{colSpan:m,columnIndex:u,rowIndex:a,rowSpan:f};u+=m}}return null}class Cl{constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!It(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new Cl(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();ie(t)||lt(151),xc(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=tt(this.anchor.key);Ue(e)||lt(152);const t=Pm(e);t===null&&lt(153);const r=tt(this.focus.key);Ue(r)||lt(154);const i=Pm(r);i===null&&lt(155);const s=Math.min(t.columnIndex,i.columnIndex),o=Math.max(t.columnIndex,i.columnIndex),a=Math.min(t.rowIndex,i.rowIndex),l=Math.max(t.rowIndex,i.rowIndex);return{fromX:Math.min(s,o),fromY:Math.min(a,l),toX:Math.max(s,o),toY:Math.max(a,l)}}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor.getNode(),r=this.focus.getNode(),i=it(t,Ue),s=it(r,Ue);Ue(i)||lt(152),Ue(s)||lt(154);const o=i.getParent();Yt(o)||lt(156);const a=o.getParent();At(a)||lt(157);const l=s.getParents()[1];if(l!==a){if(a.isParentOf(s)){const h=l.getParent();h==null&&lt(159),this.set(this.tableKey,s.getKey(),h.getKey())}else{const h=a.getParent();h==null&&lt(158),this.set(this.tableKey,h.getKey(),s.getKey())}return this.getNodes()}const[u,g,d]=Sr(a,i,s);let f=Math.min(g.startColumn,d.startColumn),m=Math.min(g.startRow,d.startRow),y=Math.max(g.startColumn+g.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),b=Math.max(g.startRow+g.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),C=f,S=m,A=f,v=m;function k(h){const{cell:I,startColumn:O,startRow:j}=h;f=Math.min(f,O),m=Math.min(m,j),y=Math.max(y,O+I.__colSpan-1),b=Math.max(b,j+I.__rowSpan-1)}for(;f<C||m<S||y>A||b>v;){if(f<C){const h=v-S,I=C-1;for(let O=0;O<=h;O++)k(u[S+O][I]);C=I}if(m<S){const h=A-C,I=S-1;for(let O=0;O<=h;O++)k(u[I][C+O]);S=I}if(y>A){const h=v-S,I=A+1;for(let O=0;O<=h;O++)k(u[S+O][I]);A=I}if(b>v){const h=A-C,I=v+1;for(let O=0;O<=h;O++)k(u[I][C+O]);v=I}}const T=[a];let N=null;for(let h=m;h<=b;h++)for(let I=f;I<=y;I++){const{cell:O}=u[h][I],j=O.getParent();Yt(j)||lt(160),j!==N&&T.push(j),T.push(O,...Yx(O)),N=j}return ls()||(this._cachedNodes=T),T}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}}function It(n){return n instanceof Cl}function hd(){const n=Wn("root",0,"element"),e=Wn("root",0,"element");return new Cl("root",n,e)}function Yx(n){const e=[],t=[n];for(;t.length>0;){const r=t.pop();r===void 0&&lt(112),ie(r)&&t.unshift(...r.getChildren()),r!==n&&e.push(r)}return e}class Vx{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){const e=new MutationObserver(t=>{this.editor.update(()=>{let r=!1;for(let s=0;s<t.length;s++){const o=t[s].target.nodeName;if(o==="TABLE"||o==="TBODY"||o==="THEAD"||o==="TR"){r=!0;break}}if(!r)return;const i=this.editor.getElementByKey(this.tableNodeKey);if(!i)throw new Error("Expected to find TableElement in DOM");this.table=zo(i)})});this.editor.update(()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=zo(t),e.observe(t,{childList:!0,subtree:!0})})}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{if(!At(tt(this.tableNodeKey)))throw new Error("Expected TableNode.");const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");const r=zo(t);Sl(e,r,null),Nt(null),e.dispatchCommand(Hn,void 0)})}enableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Qv(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Io(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),Sl(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const r=this.editor;r.update(()=>{const i=tt(this.tableNodeKey);if(!At(i))throw new Error("Expected TableNode.");if(!r.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const s=e.x,o=e.y;if(this.focusCell=e,this.anchorCell!==null){const a=Fm(r._window);a&&a.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===s&&this.anchorY===o&&!t){if(s===this.focusX&&o===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=s,this.focusY=o,this.isHighlightingCells){const a=Pt(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&Ue(a)&&i.is(Ms(a))){const l=a.getKey();this.tableSelection=this.tableSelection.clone()||hd(),this.focusCellNodeKey=l,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Nt(this.tableSelection),r.dispatchCommand(Hn,void 0),Sl(r,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{const t=Pt(e.elem);if(Ue(t)){const r=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():hd(),this.anchorCellNodeKey=r}})}formatCells(e){this.editor.update(()=>{const t=he();It(t)||lt(11);const r=Oa(),i=r.anchor,s=r.focus;t.getNodes().forEach(o=>{Ue(o)&&o.getTextContentSize()!==0&&(i.set(o.getKey(),0,"element"),s.set(o.getKey(),o.getChildrenSize(),"element"),r.formatText(e))}),Nt(t),this.editor.dispatchCommand(Hn,void 0)})}clearText(){const e=this.editor;e.update(()=>{const t=tt(this.tableNodeKey);if(!At(t))throw new Error("Expected TableNode.");const r=he();It(r)||lt(11);const i=r.getNodes().filter(Ue);i.length!==this.table.columns*this.table.rows?(i.forEach(s=>{if(ie(s)){const o=_t(),a=Bt();o.append(a),s.append(o),s.getChildren().forEach(l=>{l!==o&&l.remove()})}}),Sl(e,this.table,null),Nt(null),e.dispatchCommand(Hn,void 0)):(t.selectPrevious(),t.remove(),dt().selectStart())})}}const qx="__lexicalTableSelection",Fm=n=>Bx?(n||window).getSelection():null;function Kx(n,e,t,r){const i=t.getRootElement();if(i===null)throw new Error("No root element.");const s=new Vx(t,n.getKey()),o=t._window||window;(function(d,f){d[qx]=f})(e,s);const a=()=>{const d=()=>{s.isSelecting=!1,o.removeEventListener("mouseup",d),o.removeEventListener("mousemove",f)},f=m=>{setTimeout(()=>{if(1&~m.buttons&&s.isSelecting)return s.isSelecting=!1,o.removeEventListener("mouseup",d),void o.removeEventListener("mousemove",f);const y=gd(m.target);y===null||s.anchorX===y.x&&s.anchorY===y.y||(m.preventDefault(),s.setFocusCellForSelection(y))},0)};return{onMouseMove:f,onMouseUp:d}};e.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button!==0||!o)return;const f=gd(d.target);f!==null&&(Wi(d),s.setAnchorCellForSelection(f));const{onMouseUp:m,onMouseMove:y}=a();s.isSelecting=!0,o.addEventListener("mouseup",m),o.addEventListener("mousemove",y)},0)});const l=d=>{d.button===0&&t.update(()=>{const f=he(),m=d.target;It(f)&&f.tableKey===s.tableNodeKey&&i.contains(m)&&s.clearHighlight()})};o.addEventListener("mousedown",l),s.listenersToRemove.add(()=>o.removeEventListener("mousedown",l)),s.listenersToRemove.add(t.registerCommand(oc,d=>Bo(t,d,"down",n,s),$n)),s.listenersToRemove.add(t.registerCommand(sc,d=>Bo(t,d,"up",n,s),$n)),s.listenersToRemove.add(t.registerCommand(ic,d=>Bo(t,d,"backward",n,s),$n)),s.listenersToRemove.add(t.registerCommand(rc,d=>Bo(t,d,"forward",n,s),$n)),s.listenersToRemove.add(t.registerCommand(qs,d=>{const f=he();if(It(f)){const m=it(f.focus.getNode(),Ue);if(Ue(m))return Wi(d),m.selectEnd(),!0}return!1},$n)),[Zi,xi,qr].forEach(d=>{s.listenersToRemove.add(t.registerCommand(d,(f=>()=>{const m=he();if(!di(m,n))return!1;if(It(m))return s.clearText(),!0;if(de(m)){const y=it(m.anchor.getNode(),T=>Ue(T));if(!Ue(y))return!1;const b=m.anchor.getNode(),C=m.focus.getNode(),S=n.isParentOf(b),A=n.isParentOf(C);if(S&&!A||A&&!S)return s.clearText(),!0;const v=it(m.anchor.getNode(),T=>ie(T)),k=v&&it(v,T=>ie(T)&&Ue(T.getParent()));if(!ie(k)||!ie(v))return!1;if(f===xi&&k.getPreviousSibling()===null)return!0}return!1})(d),rr))});const u=d=>{const f=he();if(!di(f,n)){const m=f?f.getNodes():null;if(m){const y=m.find(b=>At(b)&&b.getKey()===s.tableNodeKey);if(At(y)){const b=y.getParent();if(!b)return!1;const C=y.getNextSibling()||y.getPreviousSibling();y.remove(),C?C.selectStart():b.selectStart()}}return!0}if(It(f))return d.preventDefault(),d.stopPropagation(),s.clearText(),!0;if(de(f)){const m=it(f.anchor.getNode(),y=>Ue(y));if(!Ue(m))return!1}return!1};function g(d){const f=n.getCordsFromCellNode(d,s.table);return n.getDOMCellFromCordsOrThrow(f.x,f.y,s.table)}return s.listenersToRemove.add(t.registerCommand(Vs,u,rr)),s.listenersToRemove.add(t.registerCommand(Ks,u,rr)),s.listenersToRemove.add(t.registerCommand(mn,d=>{const f=he();if(!di(f,n))return!1;if(It(f))return s.formatCells(d),!0;if(de(f)){const m=it(f.anchor.getNode(),y=>Ue(y));if(!Ue(m))return!1}return!1},rr)),s.listenersToRemove.add(t.registerCommand(Qi,d=>{const f=he();if(!It(f)||!di(f,n))return!1;const m=f.anchor.getNode(),y=f.focus.getNode();if(!Ue(m)||!Ue(y))return!1;const[b,C,S]=Sr(n,m,y),A=Math.max(C.startRow,S.startRow),v=Math.max(C.startColumn,S.startColumn),k=Math.min(C.startRow,S.startRow),T=Math.min(C.startColumn,S.startColumn);for(let N=k;N<=A;N++)for(let h=T;h<=v;h++){const I=b[N][h].cell;I.setFormat(d);const O=I.getChildren();for(let j=0;j<O.length;j++){const P=O[j];ie(P)&&!P.isInline()&&P.setFormat(d)}}return!0},rr)),s.listenersToRemove.add(t.registerCommand(vi,d=>{const f=he();if(!di(f,n))return!1;if(It(f))return s.clearHighlight(),!1;if(de(f)){const m=it(f.anchor.getNode(),y=>Ue(y));if(!Ue(m))return!1;if(typeof d=="string"){const y=$m(t,f,n);if(y)return Wm(y,n,[Bt(d)]),!0}}return!1},rr)),r&&s.listenersToRemove.add(t.registerCommand(bf,d=>{const f=he();if(!de(f)||!f.isCollapsed()||!di(f,n))return!1;const m=yd(f.anchor.getNode());if(m===null)return!1;Wi(d);const y=n.getCordsFromCellNode(m,s.table);return Bm(s,n,y.x,y.y,d.shiftKey?"backward":"forward"),!0},rr)),s.listenersToRemove.add(t.registerCommand(cc,d=>n.isSelected(),$n)),s.listenersToRemove.add(t.registerCommand(_f,d=>{const{nodes:f,selection:m}=d,y=m.getStartEndPoints(),b=It(m),C=de(m)&&it(m.anchor.getNode(),fe=>Ue(fe))!==null&&it(m.focus.getNode(),fe=>Ue(fe))!==null||b;if(f.length!==1||!At(f[0])||!C||y===null)return!1;const[S]=y,A=f[0],v=A.getChildren(),k=A.getFirstChildOrThrow().getChildrenSize(),T=A.getChildrenSize(),N=it(S.getNode(),fe=>Ue(fe)),h=N&&it(N,fe=>Yt(fe)),I=h&&it(h,fe=>At(fe));if(!Ue(N)||!Yt(h)||!At(I))return!1;const O=h.getIndexWithinParent(),j=Math.min(I.getChildrenSize()-1,O+T-1),P=N.getIndexWithinParent(),q=Math.min(h.getChildrenSize()-1,P+k-1),G=Math.min(P,q),ee=Math.min(O,j),ue=Math.max(P,q),ae=Math.max(O,j),ge=I.getChildren();let Le,be,oe=0;for(let fe=ee;fe<=ae;fe++){const Ce=ge[fe];if(!Yt(Ce))return!1;const Te=v[oe];if(!Yt(Te))return!1;const ve=Ce.getChildren(),Fe=Te.getChildren();let De=0;for(let ke=G;ke<=ue;ke++){const ze=ve[ke];if(!Ue(ze))return!1;const xe=Fe[De];if(!Ue(xe))return!1;fe===ee&&ke===G?Le=ze.getKey():fe===ae&&ke===ue&&(be=ze.getKey());const Pe=ze.getChildren();xe.getChildren().forEach(ft=>{me(ft)&&_t().append(ft),ze.append(ft)}),Pe.forEach(ft=>ft.remove()),De++}oe++}if(Le&&be){const fe=hd();fe.set(f[0].getKey(),Le,be),Nt(fe)}return!0},rr)),s.listenersToRemove.add(t.registerCommand(Hn,()=>{const d=he(),f=ti();if(de(d)){const{anchor:m,focus:y}=d,b=m.getNode(),C=y.getNode(),S=yd(b),A=yd(C),v=!(!S||!n.is(Ms(S))),k=!(!A||!n.is(Ms(A))),T=v!==k,N=v&&k,h=d.isBackward();if(T){const I=d.clone();if(k){const[O]=Sr(n,A,A),j=O[0][0].cell,P=O[O.length-1].at(-1).cell;I.focus.set(h?j.getKey():P.getKey(),h?j.getChildrenSize():P.getChildrenSize(),"element")}else I.anchor.set(n.getParentOrThrow().getKey(),h?n.getIndexWithinParent()+1:n.getIndexWithinParent(),"element");Nt(I),zm(t,s)}else N&&(S.is(A)||(s.setAnchorCellForSelection(g(S)),s.setFocusCellForSelection(g(A),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:I,onMouseMove:O}=a();s.isSelecting=!0,o.addEventListener("mouseup",I),o.addEventListener("mousemove",O)},0)))}else if(d&&It(d)&&d.is(f)&&d.tableKey===n.getKey()){const m=Fm(t._window);if(m&&m.anchorNode&&m.focusNode){const y=Pt(m.focusNode),b=y&&!n.is(Ms(y)),C=Pt(m.anchorNode),S=C&&n.is(Ms(C));if(b&&S&&m.rangeCount>0){const A=F0(m,t);A&&(A.anchor.set(n.getKey(),d.isBackward()?n.getChildrenSize():0,"element"),m.removeAllRanges(),Nt(A))}}}return d&&!d.is(f)&&(It(d)||It(f))&&s.tableSelection&&!s.tableSelection.is(f)?(It(d)&&d.tableKey===s.tableNodeKey?s.updateTableTableSelection(d):!It(d)&&It(f)&&f.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?function(m,y){y.enableHighlightStyle(),pd(y.table,b=>{const C=b.elem;b.highlighted=!1,Hm(m,b),C.getAttribute("style")||C.removeAttribute("style")})}(t,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&zm(t,s),!1)},rr)),s.listenersToRemove.add(t.registerCommand(Ys,()=>{const d=he();if(!de(d)||!d.isCollapsed()||!di(d,n))return!1;const f=$m(t,d,n);return!!f&&(Wm(f,n),!0)},rr)),s}function gd(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function zo(n){const e=[],t={columns:0,domRows:e,rows:0};let r=n.firstChild,i=0,s=0;for(e.length=0;r!=null;){const o=r.nodeName;if(o==="TD"||o==="TH"){const u={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:i,y:s};r._cell=u;let g=e[s];g===void 0&&(g=e[s]=[]),g[i]=u}else{const u=r.firstChild;if(u!=null){r=u;continue}}const a=r.nextSibling;if(a!=null){i++,r=a;continue}const l=r.parentNode;if(l!=null){const u=l.nextSibling;if(u==null)break;s++,i=0,r=u}}return t.columns=i+1,t.rows=s+1,t}function Sl(n,e,t){const r=new Set(t?t.getNodes():[]);pd(e,(i,s)=>{const o=i.elem;r.has(s)?(i.highlighted=!0,Um(n,i)):(i.highlighted=!1,Hm(n,i),o.getAttribute("style")||o.removeAttribute("style"))})}function pd(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const i=t[r];if(i)for(let s=0;s<i.length;s++){const o=i[s];if(!o)continue;const a=Pt(o.elem);a!==null&&e(o,a,{x:s,y:r})}}}function zm(n,e){e.disableHighlightStyle(),pd(e.table,t=>{t.highlighted=!0,Um(n,t)})}const Bm=(n,e,t,r,i)=>{const s=i==="forward";switch(i){case"backward":case"forward":return t!==(s?n.table.columns-1:0)?Tl(e.getCellNodeFromCordsOrThrow(t+(s?1:-1),r,n.table),s):r!==(s?n.table.rows-1:0)?Tl(e.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,r+(s?1:-1),n.table),s):s?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?Tl(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?Tl(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}},Gx=(n,e,t,r,i)=>{const s=i==="forward";switch(i){case"backward":case"forward":return t!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(s?1:-1),r,n.table)),!0;case"up":return r!==0&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r-1,n.table)),!0);case"down":return r!==n.table.rows-1&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r+1,n.table)),!0);default:return!1}};function di(n,e){if(de(n)||It(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function Tl(n,e){e?n.selectStart():n.selectEnd()}const md="172,206,247";function Um(n,e){const t=e.elem,r=Pt(t);Ue(r)||lt(131),r.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${md})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${md},0.85), rgba(${md},0.85))`),t.style.setProperty("caret-color","transparent")}function Hm(n,e){const t=e.elem,r=Pt(t);Ue(r)||lt(131),r.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function yd(n){const e=it(n,Ue);return Ue(e)?e:null}function Ms(n){const e=it(n,At);return At(e)?e:null}function Bo(n,e,t,r,i){if((t==="up"||t==="down")&&function(o){const a=o.getRootElement();return a?a.hasAttribute("aria-controls")&&a.getAttribute("aria-controls")==="typeahead-menu":!1}(n))return!1;const s=he();if(!di(s,r)){if(de(s)){if(s.isCollapsed()&&t==="backward"){const o=s.anchor.type,a=s.anchor.offset;if(o!=="element"&&(o!=="text"||a!==0))return!1;const l=s.anchor.getNode();if(!l)return!1;const u=it(l,d=>ie(d)&&!d.isInline());if(!u)return!1;const g=u.getPreviousSibling();return!(!g||!At(g))&&(Wi(e),g.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const o=s.anchor.getNode();if(un(o)){const a=s.getNodes()[0];if(a){const l=it(a,Ue);if(l&&r.isParentOf(l)){const u=r.getFirstDescendant(),g=r.getLastDescendant();if(!u||!g)return!1;const[d]=zn(u),[f]=zn(g),m=r.getCordsFromCellNode(d,i.table),y=r.getCordsFromCellNode(f,i.table),b=r.getDOMCellFromCordsOrThrow(m.x,m.y,i.table),C=r.getDOMCellFromCordsOrThrow(y.x,y.y,i.table);return i.setAnchorCellForSelection(b),i.setFocusCellForSelection(C,!0),!0}}return!1}{const a=it(o,u=>ie(u)&&!u.isInline());if(!a)return!1;const l=t==="down"?a.getNextSibling():a.getPreviousSibling();if(At(l)&&i.tableNodeKey===l.getKey()){const u=l.getFirstDescendant(),g=l.getLastDescendant();if(!u||!g)return!1;const[d]=zn(u),[f]=zn(g),m=s.clone();return m.focus.set((t==="up"?d:f).getKey(),t==="up"?0:f.getChildrenSize(),"element"),Nt(m),!0}}}}return!1}if(de(s)&&s.isCollapsed()){const{anchor:o,focus:a}=s,l=it(o.getNode(),Ue),u=it(a.getNode(),Ue);if(!Ue(l)||!l.is(u))return!1;const g=Ms(l);if(g!==r&&g!=null){const S=n.getElementByKey(g.getKey());if(S!=null)return i.table=zo(S),Bo(n,e,t,g,i)}if(t==="backward"||t==="forward"){const S=o.type,A=o.offset,v=o.getNode();if(!v)return!1;const k=s.getNodes();return(k.length!==1||!gt(k[0]))&&!!function(T,N,h,I){return function(O,j,P){return O==="element"&&(P==="backward"?j.getPreviousSibling()===null:j.getNextSibling()===null)}(T,h,I)||function(O,j,P,q){const G=it(P,ue=>ie(ue)&&!ue.isInline());if(!G)return!1;const ee=q==="backward"?j===0:j===P.getTextContentSize();return O==="text"&&ee&&(q==="backward"?G.getPreviousSibling()===null:G.getNextSibling()===null)}(T,N,h,I)}(S,A,v,t)&&function(T,N,h,I){const O=it(N,Ue);if(!Ue(O))return!1;const[j,P]=Sr(h,O,O);if(!function(G,ee,ue){const ae=G[0][0],ge=G[G.length-1][G[0].length-1],{startColumn:Le,startRow:be}=ee;return ue==="backward"?Le===ae.startColumn&&be===ae.startRow:Le===ge.startColumn&&be===ge.startRow}(j,P,I))return!1;const q=function(G,ee,ue){const ae=it(G,Le=>ie(Le)&&!Le.isInline());if(!ae)return;const ge=ee==="backward"?ae.getPreviousSibling():ae.getNextSibling();return ge&&At(ge)?ge:ee==="backward"?ue.getPreviousSibling():ue.getNextSibling()}(N,I,h);return!q||At(q)?!1:(Wi(T),I==="backward"?q.selectEnd():q.selectStart(),!0)}(e,v,r,t)}const d=n.getElementByKey(l.__key),f=n.getElementByKey(o.key);if(f==null||d==null)return!1;let m;if(o.type==="element")m=f.getBoundingClientRect();else{const S=window.getSelection();if(S===null||S.rangeCount===0)return!1;m=S.getRangeAt(0).getBoundingClientRect()}const y=t==="up"?l.getFirstChild():l.getLastChild();if(y==null)return!1;const b=n.getElementByKey(y.__key);if(b==null)return!1;const C=b.getBoundingClientRect();if(t==="up"?C.top>m.top-m.height:m.bottom+m.height>C.bottom){Wi(e);const S=r.getCordsFromCellNode(l,i.table);if(!e.shiftKey)return Bm(i,r,S.x,S.y,t);{const A=r.getDOMCellFromCordsOrThrow(S.x,S.y,i.table);i.setAnchorCellForSelection(A),i.setFocusCellForSelection(A,!0)}return!0}}else if(It(s)){const{anchor:o,focus:a}=s,l=it(o.getNode(),Ue),u=it(a.getNode(),Ue),[g]=s.getNodes(),d=n.getElementByKey(g.getKey());if(!Ue(l)||!Ue(u)||!At(g)||d==null)return!1;i.updateTableTableSelection(s);const f=zo(d),m=r.getCordsFromCellNode(l,f),y=r.getDOMCellFromCordsOrThrow(m.x,m.y,f);if(i.setAnchorCellForSelection(y),Wi(e),e.shiftKey){const b=r.getCordsFromCellNode(u,f);return Gx(i,g,b.x,b.y,t)}return u.selectEnd(),!0}return!1}function Wi(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function Wm(n,e,t){const r=_t();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function $m(n,e,t){const r=t.getParent();if(!r)return;const i=n.getElementByKey(r.getKey());if(!i)return;const s=window.getSelection();if(!s||s.anchorNode!==i)return;const o=it(e.anchor.getNode(),C=>Ue(C));if(!o)return;const a=it(o,C=>At(C));if(!At(a)||!a.is(t))return;const[l,u]=Sr(t,o,o),g=l[0][0],d=l[l.length-1][l[0].length-1],{startRow:f,startColumn:m}=u,y=f===g.startRow&&m===g.startColumn,b=f===d.startRow&&m===d.startColumn;return y?"first":b?"last":void 0}class Tr extends ni{static getType(){return"table"}static clone(e){return new Tr(e.__key)}static importDOM(){return{table:e=>({conversion:Xx,priority:1})}}static importJSON(e){return _d()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const r=document.createElement("table");return Io(r,e.theme.table),r}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:t=>{if(t){const r=t.cloneNode(),i=document.createElement("colgroup"),s=document.createElement("tbody");no(t)&&s.append(...t.children);const o=this.getFirstChildOrThrow();if(!Yt(o))throw new Error("Expected to find row node.");const a=o.getChildrenSize();for(let l=0;l<a;l++){const u=document.createElement("col");i.append(u)}return r.replaceChildren(i,s),r}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:i}=t;for(let s=0;s<r;s++){const o=i[s];if(o==null)continue;const a=o.findIndex(l=>{if(!l)return;const{elem:u}=l;return Pt(u)===e});if(a!==-1)return{x:a,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:i}=r,s=i[t];if(s==null)return null;const o=s[e];return o??null}getDOMCellFromCordsOrThrow(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(i==null)return null;const s=Pt(i.elem);return Ue(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const i=this.getCellNodeFromCords(e,t,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}canSelectBefore(){return!0}canIndent(){return!1}}function Xx(n){return{node:_d()}}function _d(){return dr(new Tr)}function At(n){return n instanceof Tr}const Jx=tn.lazy(()=>Promise.resolve().then(()=>oE));function Zx(n){const e=n;if(e.src.startsWith("file:///"))return null;const{alt:t,src:r,width:i,height:s}=e;return{node:Uo({altText:t,height:s,src:r,width:i})}}let El=class I_ extends nu{constructor(t,r,i,s,o,a,l,u,g){super(g);pn(this,"__src");pn(this,"__altText");pn(this,"__width");pn(this,"__height");pn(this,"__maxWidth");pn(this,"__showCaption");pn(this,"__caption");pn(this,"__captionsEnabled");this.__src=t,this.__altText=r,this.__maxWidth=i,this.__width=s||"inherit",this.__height=o||"inherit",this.__showCaption=a||!1,this.__caption=l||Ha(),this.__captionsEnabled=u||u===void 0}static getType(){return"image"}static clone(t){return new I_(t.__src,t.__altText,t.__maxWidth,t.__width,t.__height,t.__showCaption,t.__caption,t.__captionsEnabled,t.__key)}static importJSON(t){const{altText:r,height:i,width:s,maxWidth:o,caption:a,src:l,showCaption:u}=t,g=Uo({altText:r,height:i,maxWidth:o,showCaption:u,src:l,width:s}),d=g.__caption,f=d.parseEditorState(a.editorState);return f&&!f.isEmpty()&&d.setEditorState(f),g}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),t.setAttribute("alt",this.__altText),t.setAttribute("width",this.__width.toString()),t.setAttribute("height",this.__height.toString()),{element:t}}static importDOM(){return{img:t=>({conversion:Zx,priority:0})}}exportJSON(){return{altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height==="inherit"?0:this.__height,maxWidth:this.__maxWidth,showCaption:this.__showCaption,src:this.getSrc(),type:"image",version:1,width:this.__width==="inherit"?0:this.__width}}setWidthAndHeight(t,r){const i=this.getWritable();i.__width=t,i.__height=r}setShowCaption(t){const r=this.getWritable();r.__showCaption=t}createDOM(t){const r=document.createElement("span"),s=t.theme.image;return s!==void 0&&(r.className=s),r}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__altText}decorate(){return F.jsx(U.Suspense,{fallback:null,children:F.jsx(Jx,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,maxWidth:this.__maxWidth,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,captionsEnabled:this.__captionsEnabled,resizable:!0})})}};function Uo({altText:n,height:e,maxWidth:t,captionsEnabled:r,src:i,width:s,showCaption:o,caption:a,key:l}){return dr(new El(i,n,t,s,e,o,a,r,l))}function kl(n){return n instanceof El}const Qx=tn.lazy(()=>Promise.resolve().then(()=>uE));function eC(n){if(n instanceof HTMLImageElement){const{alt:e,src:t,width:r,height:i}=n;return{node:bd({altText:e,height:i,src:t,width:r})}}return null}let Nl=class R_ extends nu{constructor(t,r,i,s,o,a,l,u){super(u);pn(this,"__src");pn(this,"__altText");pn(this,"__width");pn(this,"__height");pn(this,"__showCaption");pn(this,"__caption");pn(this,"__position");this.__src=t,this.__altText=r,this.__width=s||"inherit",this.__height=o||"inherit",this.__showCaption=a||!1,this.__caption=l||Ha(),this.__position=i}static getType(){return"inline-image"}static clone(t){return new R_(t.__src,t.__altText,t.__position,t.__width,t.__height,t.__showCaption,t.__caption,t.__key)}static importJSON(t){const{altText:r,height:i,width:s,caption:o,src:a,showCaption:l,position:u}=t,g=bd({altText:r,height:i,position:u,showCaption:l,src:a,width:s}),d=g.__caption,f=d.parseEditorState(o.editorState);return f&&!f.isEmpty()&&d.setEditorState(f),g}static importDOM(){return{img:t=>({conversion:eC,priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),t.setAttribute("alt",this.__altText),t.setAttribute("width",this.__width.toString()),t.setAttribute("height",this.__height.toString()),{element:t}}exportJSON(){return{altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height==="inherit"?0:this.__height,position:this.__position,showCaption:this.__showCaption,src:this.getSrc(),type:"inline-image",version:1,width:this.__width==="inherit"?0:this.__width}}getSrc(){return this.__src}getAltText(){return this.__altText}setAltText(t){const r=this.getWritable();r.__altText=t}setWidthAndHeight(t,r){const i=this.getWritable();i.__width=t,i.__height=r}getShowCaption(){return this.__showCaption}setShowCaption(t){const r=this.getWritable();r.__showCaption=t}getPosition(){return this.__position}setPosition(t){const r=this.getWritable();r.__position=t}update(t){const r=this.getWritable(),{altText:i,showCaption:s,position:o}=t;i!==void 0&&(r.__altText=i),s!==void 0&&(r.__showCaption=s),o!==void 0&&(r.__position=o)}createDOM(t){const r=document.createElement("span"),i=`${t.theme.inlineImage} position-${this.__position}`;return i!==void 0&&(r.className=i),r}updateDOM(t,r,i){const s=this.__position;if(s!==t.__position){const o=`${i.theme.inlineImage} position-${s}`;o!==void 0&&(r.className=o)}return!1}decorate(){return F.jsx(U.Suspense,{fallback:null,children:F.jsx(Qx,{src:this.__src,altText:this.__altText,width:this.__width,height:this.__height,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,position:this.__position})})}};function bd({altText:n,position:e,height:t,src:r,width:i,showCaption:s,caption:o,key:a}){return dr(new Nl(r,n,e,i,t,s,o,a))}function Ym(n){return n instanceof Nl}function Vm(n,e){const t=e.body?e.body.childNodes:[];let r=[];const i=[];for(let s=0;s<t.length;s++){const o=t[s];if(!Km.has(o.nodeName)){const a=Gm(o,n,i,!1);a!==null&&(r=r.concat(a))}}return function(s){for(const o of s)o.getNextSibling()instanceof iu&&o.insertAfter(as());for(const o of s){const a=o.getChildren();for(const l of a)o.insertBefore(l);o.remove()}}(i),r}function tC(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=dt().getChildren();for(let i=0;i<r.length;i++)qm(n,r[i],t,e);return t.innerHTML}function qm(n,e,t,r=null){let i=r===null||e.isSelected(r);const s=ie(e)&&e.excludeFromCopy("html");let o=e;if(r!==null){let m=Ap(e);m=me(m)&&r!==null?Ip(r,m):m,o=m}const a=ie(o)?o.getChildren():[],l=n._nodes.get(o.getType());let u;u=l&&l.exportDOM!==void 0?l.exportDOM(n,o):o.exportDOM(n);const{element:g,after:d}=u;if(!g)return!1;const f=document.createDocumentFragment();for(let m=0;m<a.length;m++){const y=a[m],b=qm(n,y,f,r);!i&&ie(e)&&b&&e.extractWithChild(y,r,"html")&&(i=!0)}if(i&&!s){if(no(g)&&g.append(f),t.append(g),d){const m=d.call(o,g);m&&g.replaceWith(m)}}else t.append(f);return i}const Km=new Set(["STYLE","SCRIPT"]);function Gm(n,e,t,r,i=new Map,s){let o=[];if(Km.has(n.nodeName))return o;let a=null;const l=function(y,b){const{nodeName:C}=y,S=b._htmlConversions.get(C.toLowerCase());let A=null;if(S!==void 0)for(const v of S){const k=v(y);k!==null&&(A===null||(A.priority||0)<(k.priority||0))&&(A=k)}return A!==null?A.conversion:null}(n,e),u=l?l(n):null;let g=null;if(u!==null){g=u.after;const y=u.node;if(a=Array.isArray(y)?y[y.length-1]:y,a!==null){for(const[,b]of i)if(a=b(a,s),!a)break;a&&o.push(...Array.isArray(y)?y:[a])}u.forChild!=null&&i.set(n.nodeName,u.forChild)}const d=n.childNodes;let f=[];const m=(a==null||!un(a))&&(a!=null&&Jc(a)||r);for(let y=0;y<d.length;y++)f.push(...Gm(d[y],e,t,m,new Map(i),a));return g!=null&&(f=g(f)),T0(n)&&(f=nC(n,f,m?()=>{const y=new iu;return t.push(y),y}:_t)),a==null?o=o.concat(f):ie(a)&&a.append(...f),o}function nC(n,e,t){const r=n.style.textAlign,i=[];let s=[];for(let o=0;o<e.length;o++){const a=e[o];if(Jc(a))r&&!a.getFormat()&&a.setFormat(r),i.push(a);else if(s.push(a),o===e.length-1||o<e.length-1&&Jc(e[o+1])){const l=t();l.setFormat(r),l.append(...s),i.push(l),s=[]}}return i}function rC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ml=rC(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const iC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Xm=n=>iC?(n||window).getSelection():null;function sC(n){const e=he();return e==null&&Ml(166),de(e)&&e.isCollapsed()||e.getNodes().length===0?"":tC(n,e)}function oC(n){const e=he();return e==null&&Ml(166),de(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(aC(n,e))}function Jm(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const o=JSON.parse(r);if(o.namespace===t._config.namespace&&Array.isArray(o.nodes))return Zm(t,lC(o.nodes),e)}catch{}const i=n.getData("text/html");if(i)try{const o=new DOMParser().parseFromString(i,"text/html");return Zm(t,Vm(t,o),e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if(de(e)){const o=s.split(/(\r?\n|\t)/);o[o.length-1]===""&&o.pop();for(let a=0;a<o.length;a++){const l=he();if(de(l)){const u=o[a];u===`
45
45
  `||u===`\r
46
- `?l.insertParagraph():u===" "?l.insertNodes([fo()]):l.insertText(u)}}}else e.insertRawText(s)}function Zm(n,e,t){n.dispatchCommand(_f,{nodes:e,selection:t})||t.insertNodes(e)}function Qm(n,e,t,r=[]){let i=e===null||t.isSelected(e);const s=ie(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Ap(t);u=me(u)&&e!==null?Ip(e,u):u,o=u}const a=ie(o)?o.getChildren():[],l=function(u){const g=u.exportJSON(),d=u.constructor;if(g.type!==d.getType()&&Ml(58,d.name),ie(u)){const f=g.children;Array.isArray(f)||Ml(59,d.name)}return g}(o);if(me(o)){const u=o.__text;u.length>0?l.text=u:i=!1}for(let u=0;u<a.length;u++){const g=a[u],d=Qm(n,e,g,l.children);!i&&ie(t)&&d&&t.extractWithChild(g,e,"clone")&&(i=!0)}if(i&&!s)r.push(l);else if(Array.isArray(l.children))for(let u=0;u<l.children.length;u++){const g=l.children[u];r.push(g)}return i}function aC(n,e){const t=[],r=dt().getChildren();for(let i=0;i<r.length;i++)Qm(n,e,r[i],t);return{namespace:n._config.namespace,nodes:t}}function lC(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],i=H0(r);me(i)&&Ev(i),e.push(i)}return e}let Ds=null;async function ey(n,e){if(Ds!==null)return!1;if(e!==null)return new Promise((a,l)=>{n.update(()=>{a(ty(n,e))})});const t=n.getRootElement(),r=n._window==null?window.document:n._window.document,i=Xm(n._window);if(t===null||i===null)return!1;const s=r.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(r.createTextNode("#")),t.append(s);const o=new Range;return o.setStart(s,0),o.setEnd(s,1),i.removeAllRanges(),i.addRange(o),new Promise((a,l)=>{const u=n.registerCommand(da,g=>(zi(g,ClipboardEvent)&&(u(),Ds!==null&&(window.clearTimeout(Ds),Ds=null),a(ty(n,g))),!0),rr);Ds=window.setTimeout(()=>{u(),Ds=null,a(!1)},50),r.execCommand("copy"),s.remove()})}function ty(n,e){const t=Xm(n._window);if(!t)return!1;const r=t.anchorNode,i=t.focusNode;if(r!==null&&i!==null&&!Xs(n,r,i))return!1;e.preventDefault();const s=e.clipboardData,o=ge();if(s===null||o===null)return!1;const a=sC(n),l=oC(n);let u="";return o!==null&&(u=o.getTextContent()),a!==null&&s.setData("text/html",a),l!==null&&s.setData("application/x-lexical-editor",l),s.setData("text/plain",u),!0}function ny(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const As=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,cC=As&&"documentMode"in document?document.documentMode:null,uC=!(!As||!("InputEvent"in window)||cC)&&"getTargetRanges"in new window.InputEvent("input"),dC=As&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),fC=As&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,hC=As&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gC=As&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!hC,ry=wi();class Dl extends ni{static getType(){return"heading"}static clone(e){return new Dl(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,r=document.createElement(t),i=e.theme.heading;if(i!==void 0){const s=i[t];Io(r,s)}return r}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Is,priority:0}),h2:e=>({conversion:Is,priority:0}),h3:e=>({conversion:Is,priority:0}),h4:e=>({conversion:Is,priority:0}),h5:e=>({conversion:Is,priority:0}),h6:e=>({conversion:Is,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&iy(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>iy(e)?{conversion:t=>({node:Rs("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&no(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){const t=Rs(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,i=r!==this.getTextContentSize()&&e?Rs(this.getTag()):_t(),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,t),r===0&&!this.isEmpty()&&e){const o=_t();o.select(),this.replace(o,!0)}return i}collapseAtStart(){const e=this.isEmpty()?_t():Rs(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function iy(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Is(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Rs(e),n.style!==null&&t.setFormat(n.style.textAlign)),{node:t}}function Rs(n){return dr(new Dl(n))}function Al(n){let e=null;if(zi(n,DragEvent)?e=n.dataTransfer:zi(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),i=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),i]}function sy(n){const e=ge();if(!he(e))return!1;const t=new Set,r=e.getNodes();for(let i=0;i<r.length;i++){const s=r[i],o=s.getKey();if(t.has(o))continue;const a=it(s,u=>ie(u)&&!u.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!t.has(l)&&(t.add(l),n(a))}return t.size>0}function Il(n){const e=Pt(n);return gt(e)}function pC(n){return Kn(n.registerCommand($s,e=>{const t=ge();return!!Dt(t)&&(t.clear(),!0)},0),n.registerCommand(qr,e=>{const t=ge();return!!he(t)&&(t.deleteCharacter(e),!0)},ot),n.registerCommand(Zi,e=>{const t=ge();return!!he(t)&&(t.deleteWord(e),!0)},ot),n.registerCommand(xi,e=>{const t=ge();return!!he(t)&&(t.deleteLine(e),!0)},ot),n.registerCommand(vi,e=>{const t=ge();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)Jm(r,t,n);else if(he(t)){const i=e.data;return i&&t.insertText(i),!0}}return!0},ot),n.registerCommand(nc,()=>{const e=ge();return!!he(e)&&(e.removeText(),!0)},ot),n.registerCommand(mn,e=>{const t=ge();return!!he(t)&&(t.formatText(e),!0)},ot),n.registerCommand(Qi,e=>{const t=ge();if(!he(t)&&!Dt(t))return!1;const r=t.getNodes();for(const i of r){const s=it(i,o=>ie(o)&&!o.isInline());s!==null&&s.setFormat(e)}return!0},ot),n.registerCommand(Ji,e=>{const t=ge();return!!he(t)&&(t.insertLineBreak(e),!0)},ot),n.registerCommand(Ys,()=>{const e=ge();return!!he(e)&&(e.insertParagraph(),!0)},ot),n.registerCommand($_,()=>(za([fo()]),!0),ot),n.registerCommand(Y_,()=>sy(e=>{const t=e.getIndent();e.setIndent(t+1)}),ot),n.registerCommand(wf,()=>sy(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ot),n.registerCommand(sc,e=>{const t=ge();if(Dt(t)&&!Il(e.target)){const r=t.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(he(t)){const r=to(t.focus,!0);if(!e.shiftKey&&gt(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},ot),n.registerCommand(oc,e=>{const t=ge();if(Dt(t)){const r=t.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(he(t)){if(function(i){const s=i.focus;return s.key==="root"&&s.offset===dt().getChildrenSize()}(t))return e.preventDefault(),!0;const r=to(t.focus,!1);if(!e.shiftKey&&gt(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},ot),n.registerCommand(ic,e=>{const t=ge();if(Dt(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}if(!he(t))return!1;if(Lp(t,!0)){const r=e.shiftKey;return e.preventDefault(),Op(t,r,!0),!0}return!1},ot),n.registerCommand(rc,e=>{const t=ge();if(Dt(t)&&!Il(e.target)){const i=t.getNodes();if(i.length>0)return e.preventDefault(),i[0].selectNext(0,0),!0}if(!he(t))return!1;const r=e.shiftKey;return!!Lp(t,!1)&&(e.preventDefault(),Op(t,r,!1),!0)},ot),n.registerCommand(Vs,e=>{if(Il(e.target))return!1;const t=ge();if(!he(t))return!1;e.preventDefault();const{anchor:r}=t,i=r.getNode();return t.isCollapsed()&&r.offset===0&&!dn(i)&&ex(i).getIndent()>0?n.dispatchCommand(wf,void 0):n.dispatchCommand(qr,!0)},ot),n.registerCommand(Ks,e=>{if(Il(e.target))return!1;const t=ge();return!!he(t)&&(e.preventDefault(),n.dispatchCommand(qr,!1))},ot),n.registerCommand(Ci,e=>{const t=ge();if(!he(t))return!1;if(e!==null){if((fC||dC||gC)&&uC)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(Ji,!1)}return n.dispatchCommand(Ys,void 0)},ot),n.registerCommand(qs,()=>{const e=ge();return!!he(e)&&(n.blur(),!0)},ot),n.registerCommand(ca,e=>{const[,t]=Al(e);if(t.length>0){const i=ny(e.clientX,e.clientY);if(i!==null){const{offset:s,node:o}=i,a=Pt(o);if(a!==null){const l=Oa();if(me(a))l.anchor.set(a.getKey(),s,"text"),l.focus.set(a.getKey(),s,"text");else{const g=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;l.anchor.set(g,d,"element"),l.focus.set(g,d,"element")}const u=xc(l);Nt(u)}n.dispatchCommand(ry,t)}return e.preventDefault(),!0}const r=ge();return!!he(r)},ot),n.registerCommand(es,e=>{const[t]=Al(e),r=ge();return!(t&&!he(r))},ot),n.registerCommand(ua,e=>{const[t]=Al(e),r=ge();if(t&&!he(r))return!1;const i=ny(e.clientX,e.clientY);if(i!==null){const s=Pt(i.node);gt(s)&&e.preventDefault()}return!0},ot),n.registerCommand(lc,()=>(_0(),!0),ot),n.registerCommand(da,e=>(ey(n,zi(e,ClipboardEvent)?e:null),!0),ot),n.registerCommand(ac,e=>(async function(t,r){await ey(r,zi(t,ClipboardEvent)?t:null),r.update(()=>{const i=ge();he(i)?i.removeText():Dt(i)&&i.getNodes().forEach(s=>s.remove())})}(e,n),!0),ot),n.registerCommand(oa,e=>{const[,t,r]=Al(e);return t.length>0&&!r?(n.dispatchCommand(ry,t),!0):Cc(e.target)?!1:ge()!==null&&(function(i,s){i.preventDefault(),s.update(()=>{const o=ge(),a=zi(i,InputEvent)||zi(i,KeyboardEvent)?null:i.clipboardData;a!=null&&o!==null&&Jm(a,o,s)},{tag:"paste"})}(e,n),!0)},ot))}function mC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Rl=mC(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function yC({hasCellMerge:n=!0,hasCellBackgroundColor:e=!0,hasTabHandler:t=!0}){const[r]=$t();return U.useEffect(()=>(r.hasNodes([Tr,Hr,Ns])||Rl(10),Kn(r.registerCommand(Px,({columns:i,rows:s,includeHeaders:o})=>{const a=Am(Number(s),Number(i),o);tm(a);const l=a.getFirstDescendant();return me(l)&&l.select(),!0},ot),r.registerNodeTransform(Tr,i=>{const[s]=jm(i,null,null),o=s.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<s.length;++a){const l=s[a].length;if(l===o)continue;const u=s[a][l-1].cell;for(let g=l;g<o;++g){const d=ui(0);d.append(_t()),u!==null?u.insertAfter(d):rm(u,d)}}}))),[r]),U.useEffect(()=>{const i=new Map,s=a=>{const l=a.getKey(),u=r.getElementByKey(l);if(u&&!i.has(l)){const g=Kx(a,u,r,t);i.set(l,g)}};r.getEditorState().read(()=>{const a=b0(Tr);for(const l of a)At(l)&&s(l)});const o=r.registerMutationListener(Tr,a=>{for(const[l,u]of a)if(u==="created")r.getEditorState().read(()=>{const g=tt(l);At(g)&&s(g)});else if(u==="destroyed"){const g=i.get(l);g!==void 0&&(g.removeListeners(),i.delete(l))}});return()=>{o();for(const[,a]of i)a.removeListeners()}},[r,t]),U.useEffect(()=>{if(!n)return r.registerNodeTransform(Hr,i=>{if(i.getColSpan()>1||i.getRowSpan()>1){const[,,s]=zn(i),[o]=Sr(s,i,i),a=o.length,l=o[0].length;let u=s.getFirstChild();Yt(u)||Rl(175);const g=[];for(let d=0;d<a;d++){d!==0&&(u=u.getNextSibling(),Yt(u)||Rl(175));let f=null;for(let m=0;m<l;m++){const y=o[d][m],b=y.cell;if(y.startRow===d&&y.startColumn===m)f=b,g.push(b);else if(b.getColSpan()>1||b.getRowSpan()>1){Ue(b)||Rl(176);const C=ui(b.__headerState);f!==null?f.insertAfter(C):rm(u,C)}}}for(const d of g)d.setColSpan(1),d.setRowSpan(1)}})},[r,n]),U.useEffect(()=>{if(!e)return r.registerNodeTransform(Hr,i=>{i.getBackgroundColor()!==null&&i.setBackgroundColor(null)})},[r,e,n]),null}const r1="";function oy({label:n,value:e,onChange:t,placeholder:r="","data-test-id":i,type:s="text",name:o=""}){return F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("label",{className:"Input__label",children:n}),F.jsx("input",{type:s,className:"Input__input",placeholder:r,value:e,name:o,onChange:a=>{t(a.target.value,a.target.name)},"data-test-id":i})]})}const i1="";function ay({"data-test-id":n,children:e}){return F.jsx("div",{className:"DialogActions","data-test-id":n,children:e})}const s1="";function _C(...n){return n.filter(Boolean).join(" ")}function ly({"data-test-id":n,children:e,className:t,onClick:r,disabled:i,small:s,title:o}){return F.jsx("button",{disabled:i,className:_C("Button__root",i&&"Button__disabled",s&&"Button__small",t),onClick:r,title:o,"aria-label":o,...n&&{"data-test-id":n},children:e})}function bC({accept:n,label:e,onChange:t,"data-test-id":r}){return F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("label",{className:"Input__label",children:e}),F.jsx("input",{type:"file",accept:n,className:"Input__input",onChange:i=>t(i.target.files),"data-test-id":r})]})}const wC=n=>em?(n||window).getSelection():null,wd=wi();function vC({onClick:n}){const[e,t]=U.useState(""),[r,i]=U.useState(""),s=e==="",o=a=>{const l=new FileReader;l.onload=function(){return typeof l.result=="string"&&t(l.result),""},a!==null&&l.readAsDataURL(a[0])};return F.jsxs(F.Fragment,{children:[F.jsx(bC,{label:"Image Upload",onChange:o,accept:"image/*","data-test-id":"image-modal-file-upload"}),F.jsx(oy,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:i,value:r,"data-test-id":"image-modal-alt-text-input"}),F.jsx(ay,{children:F.jsx(ly,{"data-test-id":"image-modal-file-upload-btn",disabled:s,onClick:()=>n({altText:r,src:e}),children:"Confirm"})})]})}function xC({activeEditor:n,onClose:e}){const[t,r]=U.useState("file"),i=U.useRef(!1);U.useEffect(()=>{i.current=!1;const o=a=>{i.current=a.altKey};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[n]);const s=o=>{n.dispatchCommand(wd,o),e()};return F.jsx(F.Fragment,{children:t==="file"&&F.jsx(vC,{onClick:s})})}function CC(n,e){n.preventDefault();const t=n.clipboardData;if(!t)return console.error("No clipboard data available"),!1;const r=t.items;if(!r||r.length===0)return console.error("No items in clipboard"),!1;let i=!1;for(let s=0;s<r.length;s++){const o=r[s];if(o.type.startsWith("image/")){const a=o.getAsFile();if(a){const l=new FileReader;l.onload=()=>{const u=l.result,d={altText:a.name,src:u};e.update(()=>{const f=Uo(d);dt().append(f)}),i=!0},l.readAsDataURL(a)}}}if(!i){const s=t.getData("text/plain");if(s){const o=s.trim();if(SC(o)){const l=Uo({altText:"altText",src:o});e.update(()=>{dt().append(l)})}}}return!1}function SC(n){return n.match(/\.(jpeg|jpg|gif|png|bmp|svg)$/i)}function TC({captionsEnabled:n}){const[e]=$t();return U.useEffect(()=>{if(!e.hasNodes([El]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Kn(e.registerCommand(wd,t=>{const r=Uo(t);return za([r]),un(r.getParentOrThrow())&&nm(r,_t).selectEnd(),!0},ot),e.registerCommand(es,t=>kC(t),$n),e.registerCommand(ua,t=>NC(t),rn),e.registerCommand(ca,t=>MC(t,e),$n),e.registerCommand(oa,t=>CC(t,e),$n))},[n,e]),null}const EC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",cy=document.createElement("img");cy.src=EC;function kC(n){const e=vd();if(!e)return!1;const t=n.dataTransfer;return t?(t.setData("text/plain","_"),t.setDragImage(cy,0,0),t.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.__altText,caption:e.__caption,height:e.__height,key:e.getKey(),maxWidth:e.__maxWidth,showCaption:e.__showCaption,src:e.__src,width:e.__width},type:"image"})),!0):!1}function NC(n){return vd()?(uy(n)||n.preventDefault(),!0):!1}function MC(n,e){const t=vd();if(!t)return!1;const r=DC(n);if(!r)return!1;if(n.preventDefault(),uy(n)){const i=AC(n);t.remove();const s=Oa();i!=null&&s.applyDOMRange(i),Nt(s),e.dispatchCommand(wd,r)}return!0}function vd(){const n=ge();if(!Dt(n))return null;const t=n.getNodes()[0];return kl(t)?t:null}function DC(n){var i;const e=(i=n.dataTransfer)==null?void 0:i.getData("application/x-lexical-drag");if(!e)return null;const{type:t,data:r}=JSON.parse(e);return t!=="image"?null:r}function uy(n){const e=n.target;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.editor-image")&&e.parentElement&&e.parentElement.closest("div.ContentEditable__root"))}function AC(n){let e;const t=n.target,r=t==null?null:t.nodeType===9?t.defaultView:t.ownerDocument.defaultView,i=wC(r);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(n.clientX,n.clientY);else if(n.rangeParent&&i!==null)i.collapse(n.rangeParent,n.rangeOffset||0),e=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}const IC=U.createContext(null),RC=({children:n})=>{const[e,t]=U.useState(!1),[r,i]=U.useState(!1),[s,o]=U.useState(null),[a,l]=U.useState(null),u=U.useRef(null),[g,d]=U.useState(!1),[f,m]=U.useState({aspect:1,x:0,y:0,width:100,height:100}),y=()=>{if(s){const C=u.current;if(!C||!s)return;const S=C.naturalWidth/C.width,A=C.naturalHeight/C.height,v=new OffscreenCanvas(s.width*S,s.height*A),k=v.getContext("2d");if(!k)throw new Error("No 2D context available");k.drawImage(C,s.x*S,s.y*A,s.width*S,s.height*A,0,0,s.width*S,s.height*A),v.convertToBlob({type:"image/png"}).then(T=>{const N=URL.createObjectURL(T);l(N),t(!1)})}},b=()=>{e||(t(C=>(C===!1&&m({aspect:1,x:0,y:0,width:100,height:100}),!C)),d(!1))};return F.jsx(IC.Provider,{value:{handleToggleCrop:b,crop:f,setCrop:m,applyCrop:y,imageRef:u,showCropBtn:r,setShowCropBtn:i,selectCrop:e,setSelectCrop:t,completedCrop:s,setCompletedCrop:o,croppedImage:a,setCroppedImage:l,isResizing:g,setIsResizing:d},children:n})},o1="",a1="";function LC({children:n,label:e,className:t,...r}){return F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("label",{style:{marginTop:"-1em"},className:"Input__label",children:e}),F.jsx("select",{...r,className:t||"select",children:n})]})}const OC=n=>em?(n||window).getSelection():null,dy=wi();function jC(){const[n]=$t();return U.useEffect(()=>{if(!n.hasNodes([Nl]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Kn(n.registerCommand(dy,e=>{const t=bd(e);return za([t]),un(t.getParentOrThrow())&&nm(t,_t).selectEnd(),!0},ot),n.registerCommand(es,e=>FC(e),$n),n.registerCommand(ua,e=>zC(e),rn),n.registerCommand(ca,e=>BC(e,n),$n))},[n]),null}const PC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",fy=document.createElement("img");fy.src=PC;function FC(n){const e=xd();if(!e)return!1;const t=n.dataTransfer;return t?(t.setData("text/plain","_"),t.setDragImage(fy,0,0),t.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.__altText,caption:e.__caption,height:e.__height,key:e.getKey(),showCaption:e.__showCaption,src:e.__src,width:e.__width},type:"image"})),!0):!1}function zC(n){return xd()?(hy(n)||n.preventDefault(),!0):!1}function BC(n,e){const t=xd();if(!t)return!1;const r=UC(n);if(!r)return!1;if(n.preventDefault(),hy(n)){const i=HC(n);t.remove();const s=Oa();i!=null&&s.applyDOMRange(i),Nt(s),e.dispatchCommand(dy,r)}return!0}function xd(){const n=ge();if(!Dt(n))return null;const t=n.getNodes()[0];return Ym(t)?t:null}function UC(n){var i;const e=(i=n.dataTransfer)==null?void 0:i.getData("application/x-lexical-drag");if(!e)return null;const{type:t,data:r}=JSON.parse(e);return t!=="image"?null:r}function hy(n){const e=n.target;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.editor-image")&&e.parentElement&&e.parentElement.closest("div.ContentEditable__root"))}function HC(n){let e;const t=n.target,r=t==null?null:t.nodeType===9?t.defaultView:t.ownerDocument.defaultView,i=OC(r);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(n.clientX,n.clientY);else if(n.rangeParent&&i!==null)i.collapse(n.rangeParent,n.rangeOffset||0),e=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var gy={exports:{}};/*!
46
+ `?l.insertParagraph():u===" "?l.insertNodes([fo()]):l.insertText(u)}}}else e.insertRawText(s)}function Zm(n,e,t){n.dispatchCommand(_f,{nodes:e,selection:t})||t.insertNodes(e)}function Qm(n,e,t,r=[]){let i=e===null||t.isSelected(e);const s=ie(t)&&t.excludeFromCopy("html");let o=t;if(e!==null){let u=Ap(t);u=me(u)&&e!==null?Ip(e,u):u,o=u}const a=ie(o)?o.getChildren():[],l=function(u){const g=u.exportJSON(),d=u.constructor;if(g.type!==d.getType()&&Ml(58,d.name),ie(u)){const f=g.children;Array.isArray(f)||Ml(59,d.name)}return g}(o);if(me(o)){const u=o.__text;u.length>0?l.text=u:i=!1}for(let u=0;u<a.length;u++){const g=a[u],d=Qm(n,e,g,l.children);!i&&ie(t)&&d&&t.extractWithChild(g,e,"clone")&&(i=!0)}if(i&&!s)r.push(l);else if(Array.isArray(l.children))for(let u=0;u<l.children.length;u++){const g=l.children[u];r.push(g)}return i}function aC(n,e){const t=[],r=dt().getChildren();for(let i=0;i<r.length;i++)Qm(n,e,r[i],t);return{namespace:n._config.namespace,nodes:t}}function lC(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],i=H0(r);me(i)&&Ev(i),e.push(i)}return e}let Ds=null;async function ey(n,e){if(Ds!==null)return!1;if(e!==null)return new Promise((a,l)=>{n.update(()=>{a(ty(n,e))})});const t=n.getRootElement(),r=n._window==null?window.document:n._window.document,i=Xm(n._window);if(t===null||i===null)return!1;const s=r.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(r.createTextNode("#")),t.append(s);const o=new Range;return o.setStart(s,0),o.setEnd(s,1),i.removeAllRanges(),i.addRange(o),new Promise((a,l)=>{const u=n.registerCommand(da,g=>(zi(g,ClipboardEvent)&&(u(),Ds!==null&&(window.clearTimeout(Ds),Ds=null),a(ty(n,g))),!0),rr);Ds=window.setTimeout(()=>{u(),Ds=null,a(!1)},50),r.execCommand("copy"),s.remove()})}function ty(n,e){const t=Xm(n._window);if(!t)return!1;const r=t.anchorNode,i=t.focusNode;if(r!==null&&i!==null&&!Xs(n,r,i))return!1;e.preventDefault();const s=e.clipboardData,o=he();if(s===null||o===null)return!1;const a=sC(n),l=oC(n);let u="";return o!==null&&(u=o.getTextContent()),a!==null&&s.setData("text/html",a),l!==null&&s.setData("application/x-lexical-editor",l),s.setData("text/plain",u),!0}function ny(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const As=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,cC=As&&"documentMode"in document?document.documentMode:null,uC=!(!As||!("InputEvent"in window)||cC)&&"getTargetRanges"in new window.InputEvent("input"),dC=As&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),fC=As&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,hC=As&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gC=As&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!hC,ry=wi();class Dl extends ni{static getType(){return"heading"}static clone(e){return new Dl(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,r=document.createElement(t),i=e.theme.heading;if(i!==void 0){const s=i[t];Io(r,s)}return r}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:Is,priority:0}),h2:e=>({conversion:Is,priority:0}),h3:e=>({conversion:Is,priority:0}),h4:e=>({conversion:Is,priority:0}),h5:e=>({conversion:Is,priority:0}),h6:e=>({conversion:Is,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&iy(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>iy(e)?{conversion:t=>({node:Rs("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&no(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){const t=Rs(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,i=r!==this.getTextContentSize()&&e?Rs(this.getTag()):_t(),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,t),r===0&&!this.isEmpty()&&e){const o=_t();o.select(),this.replace(o,!0)}return i}collapseAtStart(){const e=this.isEmpty()?_t():Rs(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function iy(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Is(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Rs(e),n.style!==null&&t.setFormat(n.style.textAlign)),{node:t}}function Rs(n){return dr(new Dl(n))}function Al(n){let e=null;if(zi(n,DragEvent)?e=n.dataTransfer:zi(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),i=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),i]}function sy(n){const e=he();if(!de(e))return!1;const t=new Set,r=e.getNodes();for(let i=0;i<r.length;i++){const s=r[i],o=s.getKey();if(t.has(o))continue;const a=it(s,u=>ie(u)&&!u.isInline());if(a===null)continue;const l=a.getKey();a.canIndent()&&!t.has(l)&&(t.add(l),n(a))}return t.size>0}function Il(n){const e=Pt(n);return gt(e)}function pC(n){return Kn(n.registerCommand($s,e=>{const t=he();return!!Dt(t)&&(t.clear(),!0)},0),n.registerCommand(qr,e=>{const t=he();return!!de(t)&&(t.deleteCharacter(e),!0)},ot),n.registerCommand(Zi,e=>{const t=he();return!!de(t)&&(t.deleteWord(e),!0)},ot),n.registerCommand(xi,e=>{const t=he();return!!de(t)&&(t.deleteLine(e),!0)},ot),n.registerCommand(vi,e=>{const t=he();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)Jm(r,t,n);else if(de(t)){const i=e.data;return i&&t.insertText(i),!0}}return!0},ot),n.registerCommand(nc,()=>{const e=he();return!!de(e)&&(e.removeText(),!0)},ot),n.registerCommand(mn,e=>{const t=he();return!!de(t)&&(t.formatText(e),!0)},ot),n.registerCommand(Qi,e=>{const t=he();if(!de(t)&&!Dt(t))return!1;const r=t.getNodes();for(const i of r){const s=it(i,o=>ie(o)&&!o.isInline());s!==null&&s.setFormat(e)}return!0},ot),n.registerCommand(Ji,e=>{const t=he();return!!de(t)&&(t.insertLineBreak(e),!0)},ot),n.registerCommand(Ys,()=>{const e=he();return!!de(e)&&(e.insertParagraph(),!0)},ot),n.registerCommand($_,()=>(za([fo()]),!0),ot),n.registerCommand(Y_,()=>sy(e=>{const t=e.getIndent();e.setIndent(t+1)}),ot),n.registerCommand(wf,()=>sy(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),ot),n.registerCommand(sc,e=>{const t=he();if(Dt(t)&&!Il(e.target)){const r=t.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(de(t)){const r=to(t.focus,!0);if(!e.shiftKey&&gt(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},ot),n.registerCommand(oc,e=>{const t=he();if(Dt(t)){const r=t.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(de(t)){if(function(i){const s=i.focus;return s.key==="root"&&s.offset===dt().getChildrenSize()}(t))return e.preventDefault(),!0;const r=to(t.focus,!1);if(!e.shiftKey&&gt(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},ot),n.registerCommand(ic,e=>{const t=he();if(Dt(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}if(!de(t))return!1;if(Lp(t,!0)){const r=e.shiftKey;return e.preventDefault(),Op(t,r,!0),!0}return!1},ot),n.registerCommand(rc,e=>{const t=he();if(Dt(t)&&!Il(e.target)){const i=t.getNodes();if(i.length>0)return e.preventDefault(),i[0].selectNext(0,0),!0}if(!de(t))return!1;const r=e.shiftKey;return!!Lp(t,!1)&&(e.preventDefault(),Op(t,r,!1),!0)},ot),n.registerCommand(Vs,e=>{if(Il(e.target))return!1;const t=he();if(!de(t))return!1;e.preventDefault();const{anchor:r}=t,i=r.getNode();return t.isCollapsed()&&r.offset===0&&!dn(i)&&ex(i).getIndent()>0?n.dispatchCommand(wf,void 0):n.dispatchCommand(qr,!0)},ot),n.registerCommand(Ks,e=>{if(Il(e.target))return!1;const t=he();return!!de(t)&&(e.preventDefault(),n.dispatchCommand(qr,!1))},ot),n.registerCommand(Ci,e=>{const t=he();if(!de(t))return!1;if(e!==null){if((fC||dC||gC)&&uC)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(Ji,!1)}return n.dispatchCommand(Ys,void 0)},ot),n.registerCommand(qs,()=>{const e=he();return!!de(e)&&(n.blur(),!0)},ot),n.registerCommand(ca,e=>{const[,t]=Al(e);if(t.length>0){const i=ny(e.clientX,e.clientY);if(i!==null){const{offset:s,node:o}=i,a=Pt(o);if(a!==null){const l=Oa();if(me(a))l.anchor.set(a.getKey(),s,"text"),l.focus.set(a.getKey(),s,"text");else{const g=a.getParentOrThrow().getKey(),d=a.getIndexWithinParent()+1;l.anchor.set(g,d,"element"),l.focus.set(g,d,"element")}const u=xc(l);Nt(u)}n.dispatchCommand(ry,t)}return e.preventDefault(),!0}const r=he();return!!de(r)},ot),n.registerCommand(es,e=>{const[t]=Al(e),r=he();return!(t&&!de(r))},ot),n.registerCommand(ua,e=>{const[t]=Al(e),r=he();if(t&&!de(r))return!1;const i=ny(e.clientX,e.clientY);if(i!==null){const s=Pt(i.node);gt(s)&&e.preventDefault()}return!0},ot),n.registerCommand(lc,()=>(_0(),!0),ot),n.registerCommand(da,e=>(ey(n,zi(e,ClipboardEvent)?e:null),!0),ot),n.registerCommand(ac,e=>(async function(t,r){await ey(r,zi(t,ClipboardEvent)?t:null),r.update(()=>{const i=he();de(i)?i.removeText():Dt(i)&&i.getNodes().forEach(s=>s.remove())})}(e,n),!0),ot),n.registerCommand(oa,e=>{const[,t,r]=Al(e);return t.length>0&&!r?(n.dispatchCommand(ry,t),!0):Cc(e.target)?!1:he()!==null&&(function(i,s){i.preventDefault(),s.update(()=>{const o=he(),a=zi(i,InputEvent)||zi(i,KeyboardEvent)?null:i.clipboardData;a!=null&&o!==null&&Jm(a,o,s)},{tag:"paste"})}(e,n),!0)},ot))}function mC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Rl=mC(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function yC({hasCellMerge:n=!0,hasCellBackgroundColor:e=!0,hasTabHandler:t=!0}){const[r]=$t();return U.useEffect(()=>(r.hasNodes([Tr,Hr,Ns])||Rl(10),Kn(r.registerCommand(Px,({columns:i,rows:s,includeHeaders:o})=>{const a=Am(Number(s),Number(i),o);tm(a);const l=a.getFirstDescendant();return me(l)&&l.select(),!0},ot),r.registerNodeTransform(Tr,i=>{const[s]=jm(i,null,null),o=s.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<s.length;++a){const l=s[a].length;if(l===o)continue;const u=s[a][l-1].cell;for(let g=l;g<o;++g){const d=ui(0);d.append(_t()),u!==null?u.insertAfter(d):rm(u,d)}}}))),[r]),U.useEffect(()=>{const i=new Map,s=a=>{const l=a.getKey(),u=r.getElementByKey(l);if(u&&!i.has(l)){const g=Kx(a,u,r,t);i.set(l,g)}};r.getEditorState().read(()=>{const a=b0(Tr);for(const l of a)At(l)&&s(l)});const o=r.registerMutationListener(Tr,a=>{for(const[l,u]of a)if(u==="created")r.getEditorState().read(()=>{const g=tt(l);At(g)&&s(g)});else if(u==="destroyed"){const g=i.get(l);g!==void 0&&(g.removeListeners(),i.delete(l))}});return()=>{o();for(const[,a]of i)a.removeListeners()}},[r,t]),U.useEffect(()=>{if(!n)return r.registerNodeTransform(Hr,i=>{if(i.getColSpan()>1||i.getRowSpan()>1){const[,,s]=zn(i),[o]=Sr(s,i,i),a=o.length,l=o[0].length;let u=s.getFirstChild();Yt(u)||Rl(175);const g=[];for(let d=0;d<a;d++){d!==0&&(u=u.getNextSibling(),Yt(u)||Rl(175));let f=null;for(let m=0;m<l;m++){const y=o[d][m],b=y.cell;if(y.startRow===d&&y.startColumn===m)f=b,g.push(b);else if(b.getColSpan()>1||b.getRowSpan()>1){Ue(b)||Rl(176);const C=ui(b.__headerState);f!==null?f.insertAfter(C):rm(u,C)}}}for(const d of g)d.setColSpan(1),d.setRowSpan(1)}})},[r,n]),U.useEffect(()=>{if(!e)return r.registerNodeTransform(Hr,i=>{i.getBackgroundColor()!==null&&i.setBackgroundColor(null)})},[r,e,n]),null}const r1="";function oy({label:n,value:e,onChange:t,placeholder:r="","data-test-id":i,type:s="text",name:o=""}){return F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("label",{className:"Input__label",children:n}),F.jsx("input",{type:s,className:"Input__input",placeholder:r,value:e,name:o,onChange:a=>{t(a.target.value,a.target.name)},"data-test-id":i})]})}const i1="";function ay({"data-test-id":n,children:e}){return F.jsx("div",{className:"DialogActions","data-test-id":n,children:e})}const s1="";function _C(...n){return n.filter(Boolean).join(" ")}function ly({"data-test-id":n,children:e,className:t,onClick:r,disabled:i,small:s,title:o}){return F.jsx("button",{disabled:i,className:_C("Button__root",i&&"Button__disabled",s&&"Button__small",t),onClick:r,title:o,"aria-label":o,...n&&{"data-test-id":n},children:e})}function bC({accept:n,label:e,onChange:t,"data-test-id":r}){return F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("label",{className:"Input__label",children:e}),F.jsx("input",{type:"file",accept:n,className:"Input__input",onChange:i=>t(i.target.files),"data-test-id":r})]})}const wC=n=>em?(n||window).getSelection():null,wd=wi();function vC({onClick:n}){const[e,t]=U.useState(""),[r,i]=U.useState(""),s=e==="",o=a=>{const l=new FileReader;l.onload=function(){return typeof l.result=="string"&&t(l.result),""},a!==null&&l.readAsDataURL(a[0])};return F.jsxs(F.Fragment,{children:[F.jsx(bC,{label:"Image Upload",onChange:o,accept:"image/*","data-test-id":"image-modal-file-upload"}),F.jsx(oy,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:i,value:r,"data-test-id":"image-modal-alt-text-input"}),F.jsx(ay,{children:F.jsx(ly,{"data-test-id":"image-modal-file-upload-btn",disabled:s,onClick:()=>n({altText:r,src:e}),children:"Confirm"})})]})}function xC({activeEditor:n,onClose:e}){const[t,r]=U.useState("file"),i=U.useRef(!1);U.useEffect(()=>{i.current=!1;const o=a=>{i.current=a.altKey};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[n]);const s=o=>{n.dispatchCommand(wd,o),e()};return F.jsx(F.Fragment,{children:t==="file"&&F.jsx(vC,{onClick:s})})}function CC(n,e){n.preventDefault();const t=n.clipboardData;if(!t)return console.error("No clipboard data available"),!1;const r=t.items;if(!r||r.length===0)return console.error("No items in clipboard"),!1;let i=!1;for(let s=0;s<r.length;s++){const o=r[s];if(o.type.startsWith("image/")){const a=o.getAsFile();if(a){const l=new FileReader;l.onload=()=>{const u=l.result,d={altText:a.name,src:u};e.update(()=>{const f=Uo(d);dt().append(f)}),i=!0},l.readAsDataURL(a)}}}if(!i){const s=t.getData("text/plain");if(s){const o=s.trim();if(SC(o)){const l=Uo({altText:"altText",src:o});e.update(()=>{dt().append(l)})}}}return!1}function SC(n){return n.match(/\.(jpeg|jpg|gif|png|bmp|svg)$/i)}function TC({captionsEnabled:n}){const[e]=$t();return U.useEffect(()=>{if(!e.hasNodes([El]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Kn(e.registerCommand(wd,t=>{const r=Uo(t);return za([r]),un(r.getParentOrThrow())&&nm(r,_t).selectEnd(),!0},ot),e.registerCommand(es,t=>kC(t),$n),e.registerCommand(ua,t=>NC(t),rn),e.registerCommand(ca,t=>MC(t,e),$n),e.registerCommand(oa,t=>CC(t,e),$n))},[n,e]),null}const EC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",cy=document.createElement("img");cy.src=EC;function kC(n){const e=vd();if(!e)return!1;const t=n.dataTransfer;return t?(t.setData("text/plain","_"),t.setDragImage(cy,0,0),t.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.__altText,caption:e.__caption,height:e.__height,key:e.getKey(),maxWidth:e.__maxWidth,showCaption:e.__showCaption,src:e.__src,width:e.__width},type:"image"})),!0):!1}function NC(n){return vd()?(uy(n)||n.preventDefault(),!0):!1}function MC(n,e){const t=vd();if(!t)return!1;const r=DC(n);if(!r)return!1;if(n.preventDefault(),uy(n)){const i=AC(n);t.remove();const s=Oa();i!=null&&s.applyDOMRange(i),Nt(s),e.dispatchCommand(wd,r)}return!0}function vd(){const n=he();if(!Dt(n))return null;const t=n.getNodes()[0];return kl(t)?t:null}function DC(n){var i;const e=(i=n.dataTransfer)==null?void 0:i.getData("application/x-lexical-drag");if(!e)return null;const{type:t,data:r}=JSON.parse(e);return t!=="image"?null:r}function uy(n){const e=n.target;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.editor-image")&&e.parentElement&&e.parentElement.closest("div.ContentEditable__root"))}function AC(n){let e;const t=n.target,r=t==null?null:t.nodeType===9?t.defaultView:t.ownerDocument.defaultView,i=wC(r);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(n.clientX,n.clientY);else if(n.rangeParent&&i!==null)i.collapse(n.rangeParent,n.rangeOffset||0),e=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}const IC=U.createContext(null),RC=({children:n})=>{const[e,t]=U.useState(!1),[r,i]=U.useState(!1),[s,o]=U.useState(null),[a,l]=U.useState(null),u=U.useRef(null),[g,d]=U.useState(!1),[f,m]=U.useState({aspect:1,x:0,y:0,width:100,height:100}),y=()=>{if(s){const C=u.current;if(!C||!s)return;const S=C.naturalWidth/C.width,A=C.naturalHeight/C.height,v=new OffscreenCanvas(s.width*S,s.height*A),k=v.getContext("2d");if(!k)throw new Error("No 2D context available");k.drawImage(C,s.x*S,s.y*A,s.width*S,s.height*A,0,0,s.width*S,s.height*A),v.convertToBlob({type:"image/png"}).then(T=>{const N=URL.createObjectURL(T);l(N),t(!1)})}},b=()=>{e||(t(C=>(C===!1&&m({aspect:1,x:0,y:0,width:100,height:100}),!C)),d(!1))};return F.jsx(IC.Provider,{value:{handleToggleCrop:b,crop:f,setCrop:m,applyCrop:y,imageRef:u,showCropBtn:r,setShowCropBtn:i,selectCrop:e,setSelectCrop:t,completedCrop:s,setCompletedCrop:o,croppedImage:a,setCroppedImage:l,isResizing:g,setIsResizing:d},children:n})},o1="",a1="";function LC({children:n,label:e,className:t,...r}){return F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("label",{style:{marginTop:"-1em"},className:"Input__label",children:e}),F.jsx("select",{...r,className:t||"select",children:n})]})}const OC=n=>em?(n||window).getSelection():null,dy=wi();function jC(){const[n]=$t();return U.useEffect(()=>{if(!n.hasNodes([Nl]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return Kn(n.registerCommand(dy,e=>{const t=bd(e);return za([t]),un(t.getParentOrThrow())&&nm(t,_t).selectEnd(),!0},ot),n.registerCommand(es,e=>FC(e),$n),n.registerCommand(ua,e=>zC(e),rn),n.registerCommand(ca,e=>BC(e,n),$n))},[n]),null}const PC="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",fy=document.createElement("img");fy.src=PC;function FC(n){const e=xd();if(!e)return!1;const t=n.dataTransfer;return t?(t.setData("text/plain","_"),t.setDragImage(fy,0,0),t.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.__altText,caption:e.__caption,height:e.__height,key:e.getKey(),showCaption:e.__showCaption,src:e.__src,width:e.__width},type:"image"})),!0):!1}function zC(n){return xd()?(hy(n)||n.preventDefault(),!0):!1}function BC(n,e){const t=xd();if(!t)return!1;const r=UC(n);if(!r)return!1;if(n.preventDefault(),hy(n)){const i=HC(n);t.remove();const s=Oa();i!=null&&s.applyDOMRange(i),Nt(s),e.dispatchCommand(dy,r)}return!0}function xd(){const n=he();if(!Dt(n))return null;const t=n.getNodes()[0];return Ym(t)?t:null}function UC(n){var i;const e=(i=n.dataTransfer)==null?void 0:i.getData("application/x-lexical-drag");if(!e)return null;const{type:t,data:r}=JSON.parse(e);return t!=="image"?null:r}function hy(n){const e=n.target;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.editor-image")&&e.parentElement&&e.parentElement.closest("div.ContentEditable__root"))}function HC(n){let e;const t=n.target,r=t==null?null:t.nodeType===9?t.defaultView:t.ownerDocument.defaultView,i=OC(r);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(n.clientX,n.clientY);else if(n.rangeParent&&i!==null)i.collapse(n.rangeParent,n.rangeOffset||0),e=i.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var gy={exports:{}};/*!
47
47
  * jQuery JavaScript Library v3.7.1
48
48
  * https://jquery.com/
49
49
  *
@@ -52,10 +52,10 @@ ${e}`),Em=(n,e,t)=>{const r=sr(e),i=bt(),s=Ve(r),o=n.messageHandlers[s];return o
52
52
  * https://jquery.org/license
53
53
  *
54
54
  * Date: 2023-08-28T13:37Z
55
- */(function(n){(function(e,t){n.exports=e.document?t(e,!0):function(r){if(!r.document)throw new Error("jQuery requires a window with a document");return t(r)}})(typeof window<"u"?window:Zn,function(e,t){var r=[],i=Object.getPrototypeOf,s=r.slice,o=r.flat?function(c){return r.flat.call(c)}:function(c){return r.concat.apply([],c)},a=r.push,l=r.indexOf,u={},g=u.toString,d=u.hasOwnProperty,f=d.toString,m=f.call(Object),y={},b=function(p){return typeof p=="function"&&typeof p.nodeType!="number"&&typeof p.item!="function"},C=function(p){return p!=null&&p===p.window},S=e.document,A={type:!0,src:!0,nonce:!0,noModule:!0};function v(c,p,w){w=w||S;var x,M,D=w.createElement("script");if(D.text=c,p)for(x in A)M=p[x]||p.getAttribute&&p.getAttribute(x),M&&D.setAttribute(x,M);w.head.appendChild(D).parentNode.removeChild(D)}function k(c){return c==null?c+"":typeof c=="object"||typeof c=="function"?u[g.call(c)]||"object":typeof c}var T="3.7.1",N=/HTML$/i,h=function(c,p){return new h.fn.init(c,p)};h.fn=h.prototype={jquery:T,constructor:h,length:0,toArray:function(){return s.call(this)},get:function(c){return c==null?s.call(this):c<0?this[c+this.length]:this[c]},pushStack:function(c){var p=h.merge(this.constructor(),c);return p.prevObject=this,p},each:function(c){return h.each(this,c)},map:function(c){return this.pushStack(h.map(this,function(p,w){return c.call(p,w,p)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(h.grep(this,function(c,p){return(p+1)%2}))},odd:function(){return this.pushStack(h.grep(this,function(c,p){return p%2}))},eq:function(c){var p=this.length,w=+c+(c<0?p:0);return this.pushStack(w>=0&&w<p?[this[w]]:[])},end:function(){return this.prevObject||this.constructor()},push:a,sort:r.sort,splice:r.splice},h.extend=h.fn.extend=function(){var c,p,w,x,M,D,L=arguments[0]||{},W=1,H=arguments.length,X=!1;for(typeof L=="boolean"&&(X=L,L=arguments[W]||{},W++),typeof L!="object"&&!b(L)&&(L={}),W===H&&(L=this,W--);W<H;W++)if((c=arguments[W])!=null)for(p in c)x=c[p],!(p==="__proto__"||L===x)&&(X&&x&&(h.isPlainObject(x)||(M=Array.isArray(x)))?(w=L[p],M&&!Array.isArray(w)?D=[]:!M&&!h.isPlainObject(w)?D={}:D=w,M=!1,L[p]=h.extend(X,D,x)):x!==void 0&&(L[p]=x));return L},h.extend({expando:"jQuery"+(T+Math.random()).replace(/\D/g,""),isReady:!0,error:function(c){throw new Error(c)},noop:function(){},isPlainObject:function(c){var p,w;return!c||g.call(c)!=="[object Object]"?!1:(p=i(c),p?(w=d.call(p,"constructor")&&p.constructor,typeof w=="function"&&f.call(w)===m):!0)},isEmptyObject:function(c){var p;for(p in c)return!1;return!0},globalEval:function(c,p,w){v(c,{nonce:p&&p.nonce},w)},each:function(c,p){var w,x=0;if(I(c))for(w=c.length;x<w&&p.call(c[x],x,c[x])!==!1;x++);else for(x in c)if(p.call(c[x],x,c[x])===!1)break;return c},text:function(c){var p,w="",x=0,M=c.nodeType;if(!M)for(;p=c[x++];)w+=h.text(p);return M===1||M===11?c.textContent:M===9?c.documentElement.textContent:M===3||M===4?c.nodeValue:w},makeArray:function(c,p){var w=p||[];return c!=null&&(I(Object(c))?h.merge(w,typeof c=="string"?[c]:c):a.call(w,c)),w},inArray:function(c,p,w){return p==null?-1:l.call(p,c,w)},isXMLDoc:function(c){var p=c&&c.namespaceURI,w=c&&(c.ownerDocument||c).documentElement;return!N.test(p||w&&w.nodeName||"HTML")},merge:function(c,p){for(var w=+p.length,x=0,M=c.length;x<w;x++)c[M++]=p[x];return c.length=M,c},grep:function(c,p,w){for(var x,M=[],D=0,L=c.length,W=!w;D<L;D++)x=!p(c[D],D),x!==W&&M.push(c[D]);return M},map:function(c,p,w){var x,M,D=0,L=[];if(I(c))for(x=c.length;D<x;D++)M=p(c[D],D,w),M!=null&&L.push(M);else for(D in c)M=p(c[D],D,w),M!=null&&L.push(M);return o(L)},guid:1,support:y}),typeof Symbol=="function"&&(h.fn[Symbol.iterator]=r[Symbol.iterator]),h.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(c,p){u["[object "+p+"]"]=p.toLowerCase()});function I(c){var p=!!c&&"length"in c&&c.length,w=k(c);return b(c)||C(c)?!1:w==="array"||p===0||typeof p=="number"&&p>0&&p-1 in c}function O(c,p){return c.nodeName&&c.nodeName.toLowerCase()===p.toLowerCase()}var j=r.pop,P=r.sort,q=r.splice,G="[\\x20\\t\\r\\n\\f]",ne=new RegExp("^"+G+"+|((?:^|[^\\\\])(?:\\\\.)*)"+G+"+$","g");h.contains=function(c,p){var w=p&&p.parentNode;return c===w||!!(w&&w.nodeType===1&&(c.contains?c.contains(w):c.compareDocumentPosition&&c.compareDocumentPosition(w)&16))};var oe=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function ue(c,p){return p?c==="\0"?"�":c.slice(0,-1)+"\\"+c.charCodeAt(c.length-1).toString(16)+" ":"\\"+c}h.escapeSelector=function(c){return(c+"").replace(oe,ue)};var fe=S,Ee=a;(function(){var c,p,w,x,M,D=Ee,L,W,H,X,se,ce=h.expando,ee=0,_e=0,Ye=Gl(),ut=Gl(),Qe=Gl(),cn=Gl(),Jt=function(z,V){return z===V&&(M=!0),0},kr="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",Nr="(?:\\\\[\\da-fA-F]{1,6}"+G+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",st="\\["+G+"*("+Nr+")(?:"+G+"*([*^$|!~]?=)"+G+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+Nr+"))|)"+G+"*\\]",qi=":("+Nr+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+st+")*)|.*)\\)|)",ht=new RegExp(G+"+","g"),zt=new RegExp("^"+G+"*,"+G+"*"),ta=new RegExp("^"+G+"*([>+~]|"+G+")"+G+"*"),rf=new RegExp(G+"|>"),Mr=new RegExp(qi),na=new RegExp("^"+Nr+"$"),Dr={ID:new RegExp("^#("+Nr+")"),CLASS:new RegExp("^\\.("+Nr+")"),TAG:new RegExp("^("+Nr+"|[*])"),ATTR:new RegExp("^"+st),PSEUDO:new RegExp("^"+qi),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+G+"*(even|odd|(([+-]|)(\\d*)n|)"+G+"*(?:([+-]|)"+G+"*(\\d+)|))"+G+"*\\)|)","i"),bool:new RegExp("^(?:"+kr+")$","i"),needsContext:new RegExp("^"+G+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+G+"*((?:-\\d)?\\d*)"+G+"*\\)|)(?=[^-]|$)","i")},yi=/^(?:input|select|textarea|button)$/i,_i=/^h\d$/i,Xn=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,sf=/[+~]/,Yr=new RegExp("\\\\[\\da-fA-F]{1,6}"+G+"?|\\\\([^\\r\\n\\f])","g"),Vr=function(z,V){var Q="0x"+z.slice(1)-65536;return V||(Q<0?String.fromCharCode(Q+65536):String.fromCharCode(Q>>10|55296,Q&1023|56320))},FE=function(){bi()},zE=Jl(function(z){return z.disabled===!0&&O(z,"fieldset")},{dir:"parentNode",next:"legend"});function BE(){try{return L.activeElement}catch{}}try{D.apply(r=s.call(fe.childNodes),fe.childNodes),r[fe.childNodes.length].nodeType}catch{D={apply:function(V,Q){Ee.apply(V,s.call(Q))},call:function(V){Ee.apply(V,s.call(arguments,1))}}}function xt(z,V,Q,te){var le,Se,Re,Be,Le,nt,$e,qe=V&&V.ownerDocument,rt=V?V.nodeType:9;if(Q=Q||[],typeof z!="string"||!z||rt!==1&&rt!==9&&rt!==11)return Q;if(!te&&(bi(V),V=V||L,H)){if(rt!==11&&(Le=Xn.exec(z)))if(le=Le[1]){if(rt===9)if(Re=V.getElementById(le)){if(Re.id===le)return D.call(Q,Re),Q}else return Q;else if(qe&&(Re=qe.getElementById(le))&&xt.contains(V,Re)&&Re.id===le)return D.call(Q,Re),Q}else{if(Le[2])return D.apply(Q,V.getElementsByTagName(z)),Q;if((le=Le[3])&&V.getElementsByClassName)return D.apply(Q,V.getElementsByClassName(le)),Q}if(!cn[z+" "]&&(!X||!X.test(z))){if($e=z,qe=V,rt===1&&(rf.test(z)||ta.test(z))){for(qe=sf.test(z)&&of(V.parentNode)||V,(qe!=V||!y.scope)&&((Be=V.getAttribute("id"))?Be=h.escapeSelector(Be):V.setAttribute("id",Be=ce)),nt=ra(z),Se=nt.length;Se--;)nt[Se]=(Be?"#"+Be:":scope")+" "+Xl(nt[Se]);$e=nt.join(",")}try{return D.apply(Q,qe.querySelectorAll($e)),Q}catch{cn(z,!0)}finally{Be===ce&&V.removeAttribute("id")}}}return A_(z.replace(ne,"$1"),V,Q,te)}function Gl(){var z=[];function V(Q,te){return z.push(Q+" ")>p.cacheLength&&delete V[z.shift()],V[Q+" "]=te}return V}function cr(z){return z[ce]=!0,z}function Us(z){var V=L.createElement("fieldset");try{return!!z(V)}catch{return!1}finally{V.parentNode&&V.parentNode.removeChild(V),V=null}}function UE(z){return function(V){return O(V,"input")&&V.type===z}}function HE(z){return function(V){return(O(V,"input")||O(V,"button"))&&V.type===z}}function M_(z){return function(V){return"form"in V?V.parentNode&&V.disabled===!1?"label"in V?"label"in V.parentNode?V.parentNode.disabled===z:V.disabled===z:V.isDisabled===z||V.isDisabled!==!z&&zE(V)===z:V.disabled===z:"label"in V?V.disabled===z:!1}}function Ki(z){return cr(function(V){return V=+V,cr(function(Q,te){for(var le,Se=z([],Q.length,V),Re=Se.length;Re--;)Q[le=Se[Re]]&&(Q[le]=!(te[le]=Q[le]))})})}function of(z){return z&&typeof z.getElementsByTagName<"u"&&z}function bi(z){var V,Q=z?z.ownerDocument||z:fe;return Q==L||Q.nodeType!==9||!Q.documentElement||(L=Q,W=L.documentElement,H=!h.isXMLDoc(L),se=W.matches||W.webkitMatchesSelector||W.msMatchesSelector,W.msMatchesSelector&&fe!=L&&(V=L.defaultView)&&V.top!==V&&V.addEventListener("unload",FE),y.getById=Us(function(te){return W.appendChild(te).id=h.expando,!L.getElementsByName||!L.getElementsByName(h.expando).length}),y.disconnectedMatch=Us(function(te){return se.call(te,"*")}),y.scope=Us(function(){return L.querySelectorAll(":scope")}),y.cssHas=Us(function(){try{return L.querySelector(":has(*,:jqfake)"),!1}catch{return!0}}),y.getById?(p.filter.ID=function(te){var le=te.replace(Yr,Vr);return function(Se){return Se.getAttribute("id")===le}},p.find.ID=function(te,le){if(typeof le.getElementById<"u"&&H){var Se=le.getElementById(te);return Se?[Se]:[]}}):(p.filter.ID=function(te){var le=te.replace(Yr,Vr);return function(Se){var Re=typeof Se.getAttributeNode<"u"&&Se.getAttributeNode("id");return Re&&Re.value===le}},p.find.ID=function(te,le){if(typeof le.getElementById<"u"&&H){var Se,Re,Be,Le=le.getElementById(te);if(Le){if(Se=Le.getAttributeNode("id"),Se&&Se.value===te)return[Le];for(Be=le.getElementsByName(te),Re=0;Le=Be[Re++];)if(Se=Le.getAttributeNode("id"),Se&&Se.value===te)return[Le]}return[]}}),p.find.TAG=function(te,le){return typeof le.getElementsByTagName<"u"?le.getElementsByTagName(te):le.querySelectorAll(te)},p.find.CLASS=function(te,le){if(typeof le.getElementsByClassName<"u"&&H)return le.getElementsByClassName(te)},X=[],Us(function(te){var le;W.appendChild(te).innerHTML="<a id='"+ce+"' href='' disabled='disabled'></a><select id='"+ce+"-\r\\' disabled='disabled'><option selected=''></option></select>",te.querySelectorAll("[selected]").length||X.push("\\["+G+"*(?:value|"+kr+")"),te.querySelectorAll("[id~="+ce+"-]").length||X.push("~="),te.querySelectorAll("a#"+ce+"+*").length||X.push(".#.+[+~]"),te.querySelectorAll(":checked").length||X.push(":checked"),le=L.createElement("input"),le.setAttribute("type","hidden"),te.appendChild(le).setAttribute("name","D"),W.appendChild(te).disabled=!0,te.querySelectorAll(":disabled").length!==2&&X.push(":enabled",":disabled"),le=L.createElement("input"),le.setAttribute("name",""),te.appendChild(le),te.querySelectorAll("[name='']").length||X.push("\\["+G+"*name"+G+"*="+G+`*(?:''|"")`)}),y.cssHas||X.push(":has"),X=X.length&&new RegExp(X.join("|")),Jt=function(te,le){if(te===le)return M=!0,0;var Se=!te.compareDocumentPosition-!le.compareDocumentPosition;return Se||(Se=(te.ownerDocument||te)==(le.ownerDocument||le)?te.compareDocumentPosition(le):1,Se&1||!y.sortDetached&&le.compareDocumentPosition(te)===Se?te===L||te.ownerDocument==fe&&xt.contains(fe,te)?-1:le===L||le.ownerDocument==fe&&xt.contains(fe,le)?1:x?l.call(x,te)-l.call(x,le):0:Se&4?-1:1)}),L}xt.matches=function(z,V){return xt(z,null,null,V)},xt.matchesSelector=function(z,V){if(bi(z),H&&!cn[V+" "]&&(!X||!X.test(V)))try{var Q=se.call(z,V);if(Q||y.disconnectedMatch||z.document&&z.document.nodeType!==11)return Q}catch{cn(V,!0)}return xt(V,L,null,[z]).length>0},xt.contains=function(z,V){return(z.ownerDocument||z)!=L&&bi(z),h.contains(z,V)},xt.attr=function(z,V){(z.ownerDocument||z)!=L&&bi(z);var Q=p.attrHandle[V.toLowerCase()],te=Q&&d.call(p.attrHandle,V.toLowerCase())?Q(z,V,!H):void 0;return te!==void 0?te:z.getAttribute(V)},xt.error=function(z){throw new Error("Syntax error, unrecognized expression: "+z)},h.uniqueSort=function(z){var V,Q=[],te=0,le=0;if(M=!y.sortStable,x=!y.sortStable&&s.call(z,0),P.call(z,Jt),M){for(;V=z[le++];)V===z[le]&&(te=Q.push(le));for(;te--;)q.call(z,Q[te],1)}return x=null,z},h.fn.uniqueSort=function(){return this.pushStack(h.uniqueSort(s.apply(this)))},p=h.expr={cacheLength:50,createPseudo:cr,match:Dr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(z){return z[1]=z[1].replace(Yr,Vr),z[3]=(z[3]||z[4]||z[5]||"").replace(Yr,Vr),z[2]==="~="&&(z[3]=" "+z[3]+" "),z.slice(0,4)},CHILD:function(z){return z[1]=z[1].toLowerCase(),z[1].slice(0,3)==="nth"?(z[3]||xt.error(z[0]),z[4]=+(z[4]?z[5]+(z[6]||1):2*(z[3]==="even"||z[3]==="odd")),z[5]=+(z[7]+z[8]||z[3]==="odd")):z[3]&&xt.error(z[0]),z},PSEUDO:function(z){var V,Q=!z[6]&&z[2];return Dr.CHILD.test(z[0])?null:(z[3]?z[2]=z[4]||z[5]||"":Q&&Mr.test(Q)&&(V=ra(Q,!0))&&(V=Q.indexOf(")",Q.length-V)-Q.length)&&(z[0]=z[0].slice(0,V),z[2]=Q.slice(0,V)),z.slice(0,3))}},filter:{TAG:function(z){var V=z.replace(Yr,Vr).toLowerCase();return z==="*"?function(){return!0}:function(Q){return O(Q,V)}},CLASS:function(z){var V=Ye[z+" "];return V||(V=new RegExp("(^|"+G+")"+z+"("+G+"|$)"))&&Ye(z,function(Q){return V.test(typeof Q.className=="string"&&Q.className||typeof Q.getAttribute<"u"&&Q.getAttribute("class")||"")})},ATTR:function(z,V,Q){return function(te){var le=xt.attr(te,z);return le==null?V==="!=":V?(le+="",V==="="?le===Q:V==="!="?le!==Q:V==="^="?Q&&le.indexOf(Q)===0:V==="*="?Q&&le.indexOf(Q)>-1:V==="$="?Q&&le.slice(-Q.length)===Q:V==="~="?(" "+le.replace(ht," ")+" ").indexOf(Q)>-1:V==="|="?le===Q||le.slice(0,Q.length+1)===Q+"-":!1):!0}},CHILD:function(z,V,Q,te,le){var Se=z.slice(0,3)!=="nth",Re=z.slice(-4)!=="last",Be=V==="of-type";return te===1&&le===0?function(Le){return!!Le.parentNode}:function(Le,nt,$e){var qe,rt,He,Mt,An,gn=Se!==Re?"nextSibling":"previousSibling",Jn=Le.parentNode,Ar=Be&&Le.nodeName.toLowerCase(),Hs=!$e&&!Be,vn=!1;if(Jn){if(Se){for(;gn;){for(He=Le;He=He[gn];)if(Be?O(He,Ar):He.nodeType===1)return!1;An=gn=z==="only"&&!An&&"nextSibling"}return!0}if(An=[Re?Jn.firstChild:Jn.lastChild],Re&&Hs){for(rt=Jn[ce]||(Jn[ce]={}),qe=rt[z]||[],Mt=qe[0]===ee&&qe[1],vn=Mt&&qe[2],He=Mt&&Jn.childNodes[Mt];He=++Mt&&He&&He[gn]||(vn=Mt=0)||An.pop();)if(He.nodeType===1&&++vn&&He===Le){rt[z]=[ee,Mt,vn];break}}else if(Hs&&(rt=Le[ce]||(Le[ce]={}),qe=rt[z]||[],Mt=qe[0]===ee&&qe[1],vn=Mt),vn===!1)for(;(He=++Mt&&He&&He[gn]||(vn=Mt=0)||An.pop())&&!((Be?O(He,Ar):He.nodeType===1)&&++vn&&(Hs&&(rt=He[ce]||(He[ce]={}),rt[z]=[ee,vn]),He===Le)););return vn-=le,vn===te||vn%te===0&&vn/te>=0}}},PSEUDO:function(z,V){var Q,te=p.pseudos[z]||p.setFilters[z.toLowerCase()]||xt.error("unsupported pseudo: "+z);return te[ce]?te(V):te.length>1?(Q=[z,z,"",V],p.setFilters.hasOwnProperty(z.toLowerCase())?cr(function(le,Se){for(var Re,Be=te(le,V),Le=Be.length;Le--;)Re=l.call(le,Be[Le]),le[Re]=!(Se[Re]=Be[Le])}):function(le){return te(le,0,Q)}):te}},pseudos:{not:cr(function(z){var V=[],Q=[],te=uf(z.replace(ne,"$1"));return te[ce]?cr(function(le,Se,Re,Be){for(var Le,nt=te(le,null,Be,[]),$e=le.length;$e--;)(Le=nt[$e])&&(le[$e]=!(Se[$e]=Le))}):function(le,Se,Re){return V[0]=le,te(V,null,Re,Q),V[0]=null,!Q.pop()}}),has:cr(function(z){return function(V){return xt(z,V).length>0}}),contains:cr(function(z){return z=z.replace(Yr,Vr),function(V){return(V.textContent||h.text(V)).indexOf(z)>-1}}),lang:cr(function(z){return na.test(z||"")||xt.error("unsupported lang: "+z),z=z.replace(Yr,Vr).toLowerCase(),function(V){var Q;do if(Q=H?V.lang:V.getAttribute("xml:lang")||V.getAttribute("lang"))return Q=Q.toLowerCase(),Q===z||Q.indexOf(z+"-")===0;while((V=V.parentNode)&&V.nodeType===1);return!1}}),target:function(z){var V=e.location&&e.location.hash;return V&&V.slice(1)===z.id},root:function(z){return z===W},focus:function(z){return z===BE()&&L.hasFocus()&&!!(z.type||z.href||~z.tabIndex)},enabled:M_(!1),disabled:M_(!0),checked:function(z){return O(z,"input")&&!!z.checked||O(z,"option")&&!!z.selected},selected:function(z){return z.parentNode&&z.parentNode.selectedIndex,z.selected===!0},empty:function(z){for(z=z.firstChild;z;z=z.nextSibling)if(z.nodeType<6)return!1;return!0},parent:function(z){return!p.pseudos.empty(z)},header:function(z){return _i.test(z.nodeName)},input:function(z){return yi.test(z.nodeName)},button:function(z){return O(z,"input")&&z.type==="button"||O(z,"button")},text:function(z){var V;return O(z,"input")&&z.type==="text"&&((V=z.getAttribute("type"))==null||V.toLowerCase()==="text")},first:Ki(function(){return[0]}),last:Ki(function(z,V){return[V-1]}),eq:Ki(function(z,V,Q){return[Q<0?Q+V:Q]}),even:Ki(function(z,V){for(var Q=0;Q<V;Q+=2)z.push(Q);return z}),odd:Ki(function(z,V){for(var Q=1;Q<V;Q+=2)z.push(Q);return z}),lt:Ki(function(z,V,Q){var te;for(Q<0?te=Q+V:Q>V?te=V:te=Q;--te>=0;)z.push(te);return z}),gt:Ki(function(z,V,Q){for(var te=Q<0?Q+V:Q;++te<V;)z.push(te);return z})}},p.pseudos.nth=p.pseudos.eq;for(c in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})p.pseudos[c]=UE(c);for(c in{submit:!0,reset:!0})p.pseudos[c]=HE(c);function D_(){}D_.prototype=p.filters=p.pseudos,p.setFilters=new D_;function ra(z,V){var Q,te,le,Se,Re,Be,Le,nt=ut[z+" "];if(nt)return V?0:nt.slice(0);for(Re=z,Be=[],Le=p.preFilter;Re;){(!Q||(te=zt.exec(Re)))&&(te&&(Re=Re.slice(te[0].length)||Re),Be.push(le=[])),Q=!1,(te=ta.exec(Re))&&(Q=te.shift(),le.push({value:Q,type:te[0].replace(ne," ")}),Re=Re.slice(Q.length));for(Se in p.filter)(te=Dr[Se].exec(Re))&&(!Le[Se]||(te=Le[Se](te)))&&(Q=te.shift(),le.push({value:Q,type:Se,matches:te}),Re=Re.slice(Q.length));if(!Q)break}return V?Re.length:Re?xt.error(z):ut(z,Be).slice(0)}function Xl(z){for(var V=0,Q=z.length,te="";V<Q;V++)te+=z[V].value;return te}function Jl(z,V,Q){var te=V.dir,le=V.next,Se=le||te,Re=Q&&Se==="parentNode",Be=_e++;return V.first?function(Le,nt,$e){for(;Le=Le[te];)if(Le.nodeType===1||Re)return z(Le,nt,$e);return!1}:function(Le,nt,$e){var qe,rt,He=[ee,Be];if($e){for(;Le=Le[te];)if((Le.nodeType===1||Re)&&z(Le,nt,$e))return!0}else for(;Le=Le[te];)if(Le.nodeType===1||Re)if(rt=Le[ce]||(Le[ce]={}),le&&O(Le,le))Le=Le[te]||Le;else{if((qe=rt[Se])&&qe[0]===ee&&qe[1]===Be)return He[2]=qe[2];if(rt[Se]=He,He[2]=z(Le,nt,$e))return!0}return!1}}function af(z){return z.length>1?function(V,Q,te){for(var le=z.length;le--;)if(!z[le](V,Q,te))return!1;return!0}:z[0]}function WE(z,V,Q){for(var te=0,le=V.length;te<le;te++)xt(z,V[te],Q);return Q}function Zl(z,V,Q,te,le){for(var Se,Re=[],Be=0,Le=z.length,nt=V!=null;Be<Le;Be++)(Se=z[Be])&&(!Q||Q(Se,te,le))&&(Re.push(Se),nt&&V.push(Be));return Re}function lf(z,V,Q,te,le,Se){return te&&!te[ce]&&(te=lf(te)),le&&!le[ce]&&(le=lf(le,Se)),cr(function(Re,Be,Le,nt){var $e,qe,rt,He,Mt=[],An=[],gn=Be.length,Jn=Re||WE(V||"*",Le.nodeType?[Le]:Le,[]),Ar=z&&(Re||!V)?Zl(Jn,Mt,z,Le,nt):Jn;if(Q?(He=le||(Re?z:gn||te)?[]:Be,Q(Ar,He,Le,nt)):He=Ar,te)for($e=Zl(He,An),te($e,[],Le,nt),qe=$e.length;qe--;)(rt=$e[qe])&&(He[An[qe]]=!(Ar[An[qe]]=rt));if(Re){if(le||z){if(le){for($e=[],qe=He.length;qe--;)(rt=He[qe])&&$e.push(Ar[qe]=rt);le(null,He=[],$e,nt)}for(qe=He.length;qe--;)(rt=He[qe])&&($e=le?l.call(Re,rt):Mt[qe])>-1&&(Re[$e]=!(Be[$e]=rt))}}else He=Zl(He===Be?He.splice(gn,He.length):He),le?le(null,Be,He,nt):D.apply(Be,He)})}function cf(z){for(var V,Q,te,le=z.length,Se=p.relative[z[0].type],Re=Se||p.relative[" "],Be=Se?1:0,Le=Jl(function(qe){return qe===V},Re,!0),nt=Jl(function(qe){return l.call(V,qe)>-1},Re,!0),$e=[function(qe,rt,He){var Mt=!Se&&(He||rt!=w)||((V=rt).nodeType?Le(qe,rt,He):nt(qe,rt,He));return V=null,Mt}];Be<le;Be++)if(Q=p.relative[z[Be].type])$e=[Jl(af($e),Q)];else{if(Q=p.filter[z[Be].type].apply(null,z[Be].matches),Q[ce]){for(te=++Be;te<le&&!p.relative[z[te].type];te++);return lf(Be>1&&af($e),Be>1&&Xl(z.slice(0,Be-1).concat({value:z[Be-2].type===" "?"*":""})).replace(ne,"$1"),Q,Be<te&&cf(z.slice(Be,te)),te<le&&cf(z=z.slice(te)),te<le&&Xl(z))}$e.push(Q)}return af($e)}function $E(z,V){var Q=V.length>0,te=z.length>0,le=function(Se,Re,Be,Le,nt){var $e,qe,rt,He=0,Mt="0",An=Se&&[],gn=[],Jn=w,Ar=Se||te&&p.find.TAG("*",nt),Hs=ee+=Jn==null?1:Math.random()||.1,vn=Ar.length;for(nt&&(w=Re==L||Re||nt);Mt!==vn&&($e=Ar[Mt])!=null;Mt++){if(te&&$e){for(qe=0,!Re&&$e.ownerDocument!=L&&(bi($e),Be=!H);rt=z[qe++];)if(rt($e,Re||L,Be)){D.call(Le,$e);break}nt&&(ee=Hs)}Q&&(($e=!rt&&$e)&&He--,Se&&An.push($e))}if(He+=Mt,Q&&Mt!==He){for(qe=0;rt=V[qe++];)rt(An,gn,Re,Be);if(Se){if(He>0)for(;Mt--;)An[Mt]||gn[Mt]||(gn[Mt]=j.call(Le));gn=Zl(gn)}D.apply(Le,gn),nt&&!Se&&gn.length>0&&He+V.length>1&&h.uniqueSort(Le)}return nt&&(ee=Hs,w=Jn),An};return Q?cr(le):le}function uf(z,V){var Q,te=[],le=[],Se=Qe[z+" "];if(!Se){for(V||(V=ra(z)),Q=V.length;Q--;)Se=cf(V[Q]),Se[ce]?te.push(Se):le.push(Se);Se=Qe(z,$E(le,te)),Se.selector=z}return Se}function A_(z,V,Q,te){var le,Se,Re,Be,Le,nt=typeof z=="function"&&z,$e=!te&&ra(z=nt.selector||z);if(Q=Q||[],$e.length===1){if(Se=$e[0]=$e[0].slice(0),Se.length>2&&(Re=Se[0]).type==="ID"&&V.nodeType===9&&H&&p.relative[Se[1].type]){if(V=(p.find.ID(Re.matches[0].replace(Yr,Vr),V)||[])[0],V)nt&&(V=V.parentNode);else return Q;z=z.slice(Se.shift().value.length)}for(le=Dr.needsContext.test(z)?0:Se.length;le--&&(Re=Se[le],!p.relative[Be=Re.type]);)if((Le=p.find[Be])&&(te=Le(Re.matches[0].replace(Yr,Vr),sf.test(Se[0].type)&&of(V.parentNode)||V))){if(Se.splice(le,1),z=te.length&&Xl(Se),!z)return D.apply(Q,te),Q;break}}return(nt||uf(z,$e))(te,V,!H,Q,!V||sf.test(z)&&of(V.parentNode)||V),Q}y.sortStable=ce.split("").sort(Jt).join("")===ce,bi(),y.sortDetached=Us(function(z){return z.compareDocumentPosition(L.createElement("fieldset"))&1}),h.find=xt,h.expr[":"]=h.expr.pseudos,h.unique=h.uniqueSort,xt.compile=uf,xt.select=A_,xt.setDocument=bi,xt.tokenize=ra,xt.escape=h.escapeSelector,xt.getText=h.text,xt.isXML=h.isXMLDoc,xt.selectors=h.expr,xt.support=h.support,xt.uniqueSort=h.uniqueSort})();var be=function(c,p,w){for(var x=[],M=w!==void 0;(c=c[p])&&c.nodeType!==9;)if(c.nodeType===1){if(M&&h(c).is(w))break;x.push(c)}return x},ae=function(c,p){for(var w=[];c;c=c.nextSibling)c.nodeType===1&&c!==p&&w.push(c);return w},de=h.expr.match.needsContext,xe=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Te(c,p,w){return b(p)?h.grep(c,function(x,M){return!!p.call(x,M,x)!==w}):p.nodeType?h.grep(c,function(x){return x===p!==w}):typeof p!="string"?h.grep(c,function(x){return l.call(p,x)>-1!==w}):h.filter(p,c,w)}h.filter=function(c,p,w){var x=p[0];return w&&(c=":not("+c+")"),p.length===1&&x.nodeType===1?h.find.matchesSelector(x,c)?[x]:[]:h.find.matches(c,h.grep(p,function(M){return M.nodeType===1}))},h.fn.extend({find:function(c){var p,w,x=this.length,M=this;if(typeof c!="string")return this.pushStack(h(c).filter(function(){for(p=0;p<x;p++)if(h.contains(M[p],this))return!0}));for(w=this.pushStack([]),p=0;p<x;p++)h.find(c,M[p],w);return x>1?h.uniqueSort(w):w},filter:function(c){return this.pushStack(Te(this,c||[],!1))},not:function(c){return this.pushStack(Te(this,c||[],!0))},is:function(c){return!!Te(this,typeof c=="string"&&de.test(c)?h(c):c||[],!1).length}});var ve,Fe=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,Ae=h.fn.init=function(c,p,w){var x,M;if(!c)return this;if(w=w||ve,typeof c=="string")if(c[0]==="<"&&c[c.length-1]===">"&&c.length>=3?x=[null,c,null]:x=Fe.exec(c),x&&(x[1]||!p))if(x[1]){if(p=p instanceof h?p[0]:p,h.merge(this,h.parseHTML(x[1],p&&p.nodeType?p.ownerDocument||p:S,!0)),xe.test(x[1])&&h.isPlainObject(p))for(x in p)b(this[x])?this[x](p[x]):this.attr(x,p[x]);return this}else return M=S.getElementById(x[2]),M&&(this[0]=M,this.length=1),this;else return!p||p.jquery?(p||w).find(c):this.constructor(p).find(c);else{if(c.nodeType)return this[0]=c,this.length=1,this;if(b(c))return w.ready!==void 0?w.ready(c):c(h)}return h.makeArray(c,this)};Ae.prototype=h.fn,ve=h(S);var Ne=/^(?:parents|prev(?:Until|All))/,ze={children:!0,contents:!0,next:!0,prev:!0};h.fn.extend({has:function(c){var p=h(c,this),w=p.length;return this.filter(function(){for(var x=0;x<w;x++)if(h.contains(this,p[x]))return!0})},closest:function(c,p){var w,x=0,M=this.length,D=[],L=typeof c!="string"&&h(c);if(!de.test(c)){for(;x<M;x++)for(w=this[x];w&&w!==p;w=w.parentNode)if(w.nodeType<11&&(L?L.index(w)>-1:w.nodeType===1&&h.find.matchesSelector(w,c))){D.push(w);break}}return this.pushStack(D.length>1?h.uniqueSort(D):D)},index:function(c){return c?typeof c=="string"?l.call(h(c),this[0]):l.call(this,c.jquery?c[0]:c):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(c,p){return this.pushStack(h.uniqueSort(h.merge(this.get(),h(c,p))))},addBack:function(c){return this.add(c==null?this.prevObject:this.prevObject.filter(c))}});function Ce(c,p){for(;(c=c[p])&&c.nodeType!==1;);return c}h.each({parent:function(c){var p=c.parentNode;return p&&p.nodeType!==11?p:null},parents:function(c){return be(c,"parentNode")},parentsUntil:function(c,p,w){return be(c,"parentNode",w)},next:function(c){return Ce(c,"nextSibling")},prev:function(c){return Ce(c,"previousSibling")},nextAll:function(c){return be(c,"nextSibling")},prevAll:function(c){return be(c,"previousSibling")},nextUntil:function(c,p,w){return be(c,"nextSibling",w)},prevUntil:function(c,p,w){return be(c,"previousSibling",w)},siblings:function(c){return ae((c.parentNode||{}).firstChild,c)},children:function(c){return ae(c.firstChild)},contents:function(c){return c.contentDocument!=null&&i(c.contentDocument)?c.contentDocument:(O(c,"template")&&(c=c.content||c),h.merge([],c.childNodes))}},function(c,p){h.fn[c]=function(w,x){var M=h.map(this,p,w);return c.slice(-5)!=="Until"&&(x=w),x&&typeof x=="string"&&(M=h.filter(x,M)),this.length>1&&(ze[c]||h.uniqueSort(M),Ne.test(c)&&M.reverse()),this.pushStack(M)}});var Pe=/[^\x20\t\r\n\f]+/g;function ft(c){var p={};return h.each(c.match(Pe)||[],function(w,x){p[x]=!0}),p}h.Callbacks=function(c){c=typeof c=="string"?ft(c):h.extend({},c);var p,w,x,M,D=[],L=[],W=-1,H=function(){for(M=M||c.once,x=p=!0;L.length;W=-1)for(w=L.shift();++W<D.length;)D[W].apply(w[0],w[1])===!1&&c.stopOnFalse&&(W=D.length,w=!1);c.memory||(w=!1),p=!1,M&&(w?D=[]:D="")},X={add:function(){return D&&(w&&!p&&(W=D.length-1,L.push(w)),function se(ce){h.each(ce,function(ee,_e){b(_e)?(!c.unique||!X.has(_e))&&D.push(_e):_e&&_e.length&&k(_e)!=="string"&&se(_e)})}(arguments),w&&!p&&H()),this},remove:function(){return h.each(arguments,function(se,ce){for(var ee;(ee=h.inArray(ce,D,ee))>-1;)D.splice(ee,1),ee<=W&&W--}),this},has:function(se){return se?h.inArray(se,D)>-1:D.length>0},empty:function(){return D&&(D=[]),this},disable:function(){return M=L=[],D=w="",this},disabled:function(){return!D},lock:function(){return M=L=[],!w&&!p&&(D=w=""),this},locked:function(){return!!M},fireWith:function(se,ce){return M||(ce=ce||[],ce=[se,ce.slice?ce.slice():ce],L.push(ce),p||H()),this},fire:function(){return X.fireWith(this,arguments),this},fired:function(){return!!x}};return X};function we(c){return c}function yt(c){throw c}function Wt(c,p,w,x){var M;try{c&&b(M=c.promise)?M.call(c).done(p).fail(w):c&&b(M=c.then)?M.call(c,p,w):p.apply(void 0,[c].slice(x))}catch(D){w.apply(void 0,[D])}}h.extend({Deferred:function(c){var p=[["notify","progress",h.Callbacks("memory"),h.Callbacks("memory"),2],["resolve","done",h.Callbacks("once memory"),h.Callbacks("once memory"),0,"resolved"],["reject","fail",h.Callbacks("once memory"),h.Callbacks("once memory"),1,"rejected"]],w="pending",x={state:function(){return w},always:function(){return M.done(arguments).fail(arguments),this},catch:function(D){return x.then(null,D)},pipe:function(){var D=arguments;return h.Deferred(function(L){h.each(p,function(W,H){var X=b(D[H[4]])&&D[H[4]];M[H[1]](function(){var se=X&&X.apply(this,arguments);se&&b(se.promise)?se.promise().progress(L.notify).done(L.resolve).fail(L.reject):L[H[0]+"With"](this,X?[se]:arguments)})}),D=null}).promise()},then:function(D,L,W){var H=0;function X(se,ce,ee,_e){return function(){var Ye=this,ut=arguments,Qe=function(){var Jt,kr;if(!(se<H)){if(Jt=ee.apply(Ye,ut),Jt===ce.promise())throw new TypeError("Thenable self-resolution");kr=Jt&&(typeof Jt=="object"||typeof Jt=="function")&&Jt.then,b(kr)?_e?kr.call(Jt,X(H,ce,we,_e),X(H,ce,yt,_e)):(H++,kr.call(Jt,X(H,ce,we,_e),X(H,ce,yt,_e),X(H,ce,we,ce.notifyWith))):(ee!==we&&(Ye=void 0,ut=[Jt]),(_e||ce.resolveWith)(Ye,ut))}},cn=_e?Qe:function(){try{Qe()}catch(Jt){h.Deferred.exceptionHook&&h.Deferred.exceptionHook(Jt,cn.error),se+1>=H&&(ee!==yt&&(Ye=void 0,ut=[Jt]),ce.rejectWith(Ye,ut))}};se?cn():(h.Deferred.getErrorHook?cn.error=h.Deferred.getErrorHook():h.Deferred.getStackHook&&(cn.error=h.Deferred.getStackHook()),e.setTimeout(cn))}}return h.Deferred(function(se){p[0][3].add(X(0,se,b(W)?W:we,se.notifyWith)),p[1][3].add(X(0,se,b(D)?D:we)),p[2][3].add(X(0,se,b(L)?L:yt))}).promise()},promise:function(D){return D!=null?h.extend(D,x):x}},M={};return h.each(p,function(D,L){var W=L[2],H=L[5];x[L[1]]=W.add,H&&W.add(function(){w=H},p[3-D][2].disable,p[3-D][3].disable,p[0][2].lock,p[0][3].lock),W.add(L[3].fire),M[L[0]]=function(){return M[L[0]+"With"](this===M?void 0:this,arguments),this},M[L[0]+"With"]=W.fireWith}),x.promise(M),c&&c.call(M,M),M},when:function(c){var p=arguments.length,w=p,x=Array(w),M=s.call(arguments),D=h.Deferred(),L=function(W){return function(H){x[W]=this,M[W]=arguments.length>1?s.call(arguments):H,--p||D.resolveWith(x,M)}};if(p<=1&&(Wt(c,D.done(L(w)).resolve,D.reject,!p),D.state()==="pending"||b(M[w]&&M[w].then)))return D.then();for(;w--;)Wt(M[w],L(w),D.reject);return D.promise()}});var Z=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;h.Deferred.exceptionHook=function(c,p){e.console&&e.console.warn&&c&&Z.test(c.name)&&e.console.warn("jQuery.Deferred exception: "+c.message,c.stack,p)},h.readyException=function(c){e.setTimeout(function(){throw c})};var re=h.Deferred();h.fn.ready=function(c){return re.then(c).catch(function(p){h.readyException(p)}),this},h.extend({isReady:!1,readyWait:1,ready:function(c){(c===!0?--h.readyWait:h.isReady)||(h.isReady=!0,!(c!==!0&&--h.readyWait>0)&&re.resolveWith(S,[h]))}}),h.ready.then=re.then;function ye(){S.removeEventListener("DOMContentLoaded",ye),e.removeEventListener("load",ye),h.ready()}S.readyState==="complete"||S.readyState!=="loading"&&!S.documentElement.doScroll?e.setTimeout(h.ready):(S.addEventListener("DOMContentLoaded",ye),e.addEventListener("load",ye));var Ie=function(c,p,w,x,M,D,L){var W=0,H=c.length,X=w==null;if(k(w)==="object"){M=!0;for(W in w)Ie(c,p,W,w[W],!0,D,L)}else if(x!==void 0&&(M=!0,b(x)||(L=!0),X&&(L?(p.call(c,x),p=null):(X=p,p=function(se,ce,ee){return X.call(h(se),ee)})),p))for(;W<H;W++)p(c[W],w,L?x:x.call(c[W],W,p(c[W],w)));return M?c:X?p.call(c):H?p(c[0],w):D},B=/^-ms-/,_=/-([a-z])/g;function E(c,p){return p.toUpperCase()}function R(c){return c.replace(B,"ms-").replace(_,E)}var Y=function(c){return c.nodeType===1||c.nodeType===9||!+c.nodeType};function J(){this.expando=h.expando+J.uid++}J.uid=1,J.prototype={cache:function(c){var p=c[this.expando];return p||(p={},Y(c)&&(c.nodeType?c[this.expando]=p:Object.defineProperty(c,this.expando,{value:p,configurable:!0}))),p},set:function(c,p,w){var x,M=this.cache(c);if(typeof p=="string")M[R(p)]=w;else for(x in p)M[R(x)]=p[x];return M},get:function(c,p){return p===void 0?this.cache(c):c[this.expando]&&c[this.expando][R(p)]},access:function(c,p,w){return p===void 0||p&&typeof p=="string"&&w===void 0?this.get(c,p):(this.set(c,p,w),w!==void 0?w:p)},remove:function(c,p){var w,x=c[this.expando];if(x!==void 0){if(p!==void 0)for(Array.isArray(p)?p=p.map(R):(p=R(p),p=p in x?[p]:p.match(Pe)||[]),w=p.length;w--;)delete x[p[w]];(p===void 0||h.isEmptyObject(x))&&(c.nodeType?c[this.expando]=void 0:delete c[this.expando])}},hasData:function(c){var p=c[this.expando];return p!==void 0&&!h.isEmptyObject(p)}};var K=new J,ke=new J,Je=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Ct=/[A-Z]/g;function Ze(c){return c==="true"?!0:c==="false"?!1:c==="null"?null:c===+c+""?+c:Je.test(c)?JSON.parse(c):c}function Ge(c,p,w){var x;if(w===void 0&&c.nodeType===1)if(x="data-"+p.replace(Ct,"-$&").toLowerCase(),w=c.getAttribute(x),typeof w=="string"){try{w=Ze(w)}catch{}ke.set(c,p,w)}else w=void 0;return w}h.extend({hasData:function(c){return ke.hasData(c)||K.hasData(c)},data:function(c,p,w){return ke.access(c,p,w)},removeData:function(c,p){ke.remove(c,p)},_data:function(c,p,w){return K.access(c,p,w)},_removeData:function(c,p){K.remove(c,p)}}),h.fn.extend({data:function(c,p){var w,x,M,D=this[0],L=D&&D.attributes;if(c===void 0){if(this.length&&(M=ke.get(D),D.nodeType===1&&!K.get(D,"hasDataAttrs"))){for(w=L.length;w--;)L[w]&&(x=L[w].name,x.indexOf("data-")===0&&(x=R(x.slice(5)),Ge(D,x,M[x])));K.set(D,"hasDataAttrs",!0)}return M}return typeof c=="object"?this.each(function(){ke.set(this,c)}):Ie(this,function(W){var H;if(D&&W===void 0)return H=ke.get(D,c),H!==void 0||(H=Ge(D,c),H!==void 0)?H:void 0;this.each(function(){ke.set(this,c,W)})},null,p,arguments.length>1,null,!0)},removeData:function(c){return this.each(function(){ke.remove(this,c)})}}),h.extend({queue:function(c,p,w){var x;if(c)return p=(p||"fx")+"queue",x=K.get(c,p),w&&(!x||Array.isArray(w)?x=K.access(c,p,h.makeArray(w)):x.push(w)),x||[]},dequeue:function(c,p){p=p||"fx";var w=h.queue(c,p),x=w.length,M=w.shift(),D=h._queueHooks(c,p),L=function(){h.dequeue(c,p)};M==="inprogress"&&(M=w.shift(),x--),M&&(p==="fx"&&w.unshift("inprogress"),delete D.stop,M.call(c,L,D)),!x&&D&&D.empty.fire()},_queueHooks:function(c,p){var w=p+"queueHooks";return K.get(c,w)||K.access(c,w,{empty:h.Callbacks("once memory").add(function(){K.remove(c,[p+"queue",w])})})}}),h.fn.extend({queue:function(c,p){var w=2;return typeof c!="string"&&(p=c,c="fx",w--),arguments.length<w?h.queue(this[0],c):p===void 0?this:this.each(function(){var x=h.queue(this,c,p);h._queueHooks(this,c),c==="fx"&&x[0]!=="inprogress"&&h.dequeue(this,c)})},dequeue:function(c){return this.each(function(){h.dequeue(this,c)})},clearQueue:function(c){return this.queue(c||"fx",[])},promise:function(c,p){var w,x=1,M=h.Deferred(),D=this,L=this.length,W=function(){--x||M.resolveWith(D,[D])};for(typeof c!="string"&&(p=c,c=void 0),c=c||"fx";L--;)w=K.get(D[L],c+"queueHooks"),w&&w.empty&&(x++,w.empty.add(W));return W(),M.promise(p)}});var Ft=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,wn=new RegExp("^(?:([+-])=|)("+Ft+")([a-z%]*)$","i"),Vt=["Top","Right","Bottom","Left"],hn=S.documentElement,qt=function(c){return h.contains(c.ownerDocument,c)},Gn={composed:!0};hn.getRootNode&&(qt=function(c){return h.contains(c.ownerDocument,c)||c.getRootNode(Gn)===c.ownerDocument});var gi=function(c,p){return c=p||c,c.style.display==="none"||c.style.display===""&&qt(c)&&h.css(c,"display")==="none"};function qo(c,p,w,x){var M,D,L=20,W=x?function(){return x.cur()}:function(){return h.css(c,p,"")},H=W(),X=w&&w[3]||(h.cssNumber[p]?"":"px"),se=c.nodeType&&(h.cssNumber[p]||X!=="px"&&+H)&&wn.exec(h.css(c,p));if(se&&se[3]!==X){for(H=H/2,X=X||se[3],se=+H||1;L--;)h.style(c,p,se+X),(1-D)*(1-(D=W()/H||.5))<=0&&(L=0),se=se/D;se=se*2,h.style(c,p,se+X),w=w||[]}return w&&(se=+se||+H||0,M=w[1]?se+(w[1]+1)*w[2]:+w[2],x&&(x.unit=X,x.start=se,x.end=M)),M}var Ul={};function Hl(c){var p,w=c.ownerDocument,x=c.nodeName,M=Ul[x];return M||(p=w.body.appendChild(w.createElement(x)),M=h.css(p,"display"),p.parentNode.removeChild(p),M==="none"&&(M="block"),Ul[x]=M,M)}function pi(c,p){for(var w,x,M=[],D=0,L=c.length;D<L;D++)x=c[D],x.style&&(w=x.style.display,p?(w==="none"&&(M[D]=K.get(x,"display")||null,M[D]||(x.style.display="")),x.style.display===""&&gi(x)&&(M[D]=Hl(x))):w!=="none"&&(M[D]="none",K.set(x,"display",w)));for(D=0;D<L;D++)M[D]!=null&&(c[D].style.display=M[D]);return c}h.fn.extend({show:function(){return pi(this,!0)},hide:function(){return pi(this)},toggle:function(c){return typeof c=="boolean"?c?this.show():this.hide():this.each(function(){gi(this)?h(this).show():h(this).hide()})}});var mi=/^(?:checkbox|radio)$/i,Ko=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Wl=/^$|^module$|\/(?:java|ecma)script/i;(function(){var c=S.createDocumentFragment(),p=c.appendChild(S.createElement("div")),w=S.createElement("input");w.setAttribute("type","radio"),w.setAttribute("checked","checked"),w.setAttribute("name","t"),p.appendChild(w),y.checkClone=p.cloneNode(!0).cloneNode(!0).lastChild.checked,p.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!p.cloneNode(!0).lastChild.defaultValue,p.innerHTML="<option></option>",y.option=!!p.lastChild})();var Mn={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Mn.tbody=Mn.tfoot=Mn.colgroup=Mn.caption=Mn.thead,Mn.th=Mn.td,y.option||(Mn.optgroup=Mn.option=[1,"<select multiple='multiple'>","</select>"]);function an(c,p){var w;return typeof c.getElementsByTagName<"u"?w=c.getElementsByTagName(p||"*"):typeof c.querySelectorAll<"u"?w=c.querySelectorAll(p||"*"):w=[],p===void 0||p&&O(c,p)?h.merge([c],w):w}function Go(c,p){for(var w=0,x=c.length;w<x;w++)K.set(c[w],"globalEval",!p||K.get(p[w],"globalEval"))}var Yd=/<|&#?\w+;/;function $l(c,p,w,x,M){for(var D,L,W,H,X,se,ce=p.createDocumentFragment(),ee=[],_e=0,Ye=c.length;_e<Ye;_e++)if(D=c[_e],D||D===0)if(k(D)==="object")h.merge(ee,D.nodeType?[D]:D);else if(!Yd.test(D))ee.push(p.createTextNode(D));else{for(L=L||ce.appendChild(p.createElement("div")),W=(Ko.exec(D)||["",""])[1].toLowerCase(),H=Mn[W]||Mn._default,L.innerHTML=H[1]+h.htmlPrefilter(D)+H[2],se=H[0];se--;)L=L.lastChild;h.merge(ee,L.childNodes),L=ce.firstChild,L.textContent=""}for(ce.textContent="",_e=0;D=ee[_e++];){if(x&&h.inArray(D,x)>-1){M&&M.push(D);continue}if(X=qt(D),L=an(ce.appendChild(D),"script"),X&&Go(L),w)for(se=0;D=L[se++];)Wl.test(D.type||"")&&w.push(D)}return ce}var Yl=/^([^.]*)(?:\.(.+)|)/;function $(){return!0}function pe(){return!1}function Me(c,p,w,x,M,D){var L,W;if(typeof p=="object"){typeof w!="string"&&(x=x||w,w=void 0);for(W in p)Me(c,W,w,x,p[W],D);return c}if(x==null&&M==null?(M=w,x=w=void 0):M==null&&(typeof w=="string"?(M=x,x=void 0):(M=x,x=w,w=void 0)),M===!1)M=pe;else if(!M)return c;return D===1&&(L=M,M=function(H){return h().off(H),L.apply(this,arguments)},M.guid=L.guid||(L.guid=h.guid++)),c.each(function(){h.event.add(this,p,M,x,w)})}h.event={global:{},add:function(c,p,w,x,M){var D,L,W,H,X,se,ce,ee,_e,Ye,ut,Qe=K.get(c);if(Y(c))for(w.handler&&(D=w,w=D.handler,M=D.selector),M&&h.find.matchesSelector(hn,M),w.guid||(w.guid=h.guid++),(H=Qe.events)||(H=Qe.events=Object.create(null)),(L=Qe.handle)||(L=Qe.handle=function(cn){return typeof h<"u"&&h.event.triggered!==cn.type?h.event.dispatch.apply(c,arguments):void 0}),p=(p||"").match(Pe)||[""],X=p.length;X--;)W=Yl.exec(p[X])||[],_e=ut=W[1],Ye=(W[2]||"").split(".").sort(),_e&&(ce=h.event.special[_e]||{},_e=(M?ce.delegateType:ce.bindType)||_e,ce=h.event.special[_e]||{},se=h.extend({type:_e,origType:ut,data:x,handler:w,guid:w.guid,selector:M,needsContext:M&&h.expr.match.needsContext.test(M),namespace:Ye.join(".")},D),(ee=H[_e])||(ee=H[_e]=[],ee.delegateCount=0,(!ce.setup||ce.setup.call(c,x,Ye,L)===!1)&&c.addEventListener&&c.addEventListener(_e,L)),ce.add&&(ce.add.call(c,se),se.handler.guid||(se.handler.guid=w.guid)),M?ee.splice(ee.delegateCount++,0,se):ee.push(se),h.event.global[_e]=!0)},remove:function(c,p,w,x,M){var D,L,W,H,X,se,ce,ee,_e,Ye,ut,Qe=K.hasData(c)&&K.get(c);if(!(!Qe||!(H=Qe.events))){for(p=(p||"").match(Pe)||[""],X=p.length;X--;){if(W=Yl.exec(p[X])||[],_e=ut=W[1],Ye=(W[2]||"").split(".").sort(),!_e){for(_e in H)h.event.remove(c,_e+p[X],w,x,!0);continue}for(ce=h.event.special[_e]||{},_e=(x?ce.delegateType:ce.bindType)||_e,ee=H[_e]||[],W=W[2]&&new RegExp("(^|\\.)"+Ye.join("\\.(?:.*\\.|)")+"(\\.|$)"),L=D=ee.length;D--;)se=ee[D],(M||ut===se.origType)&&(!w||w.guid===se.guid)&&(!W||W.test(se.namespace))&&(!x||x===se.selector||x==="**"&&se.selector)&&(ee.splice(D,1),se.selector&&ee.delegateCount--,ce.remove&&ce.remove.call(c,se));L&&!ee.length&&((!ce.teardown||ce.teardown.call(c,Ye,Qe.handle)===!1)&&h.removeEvent(c,_e,Qe.handle),delete H[_e])}h.isEmptyObject(H)&&K.remove(c,"handle events")}},dispatch:function(c){var p,w,x,M,D,L,W=new Array(arguments.length),H=h.event.fix(c),X=(K.get(this,"events")||Object.create(null))[H.type]||[],se=h.event.special[H.type]||{};for(W[0]=H,p=1;p<arguments.length;p++)W[p]=arguments[p];if(H.delegateTarget=this,!(se.preDispatch&&se.preDispatch.call(this,H)===!1)){for(L=h.event.handlers.call(this,H,X),p=0;(M=L[p++])&&!H.isPropagationStopped();)for(H.currentTarget=M.elem,w=0;(D=M.handlers[w++])&&!H.isImmediatePropagationStopped();)(!H.rnamespace||D.namespace===!1||H.rnamespace.test(D.namespace))&&(H.handleObj=D,H.data=D.data,x=((h.event.special[D.origType]||{}).handle||D.handler).apply(M.elem,W),x!==void 0&&(H.result=x)===!1&&(H.preventDefault(),H.stopPropagation()));return se.postDispatch&&se.postDispatch.call(this,H),H.result}},handlers:function(c,p){var w,x,M,D,L,W=[],H=p.delegateCount,X=c.target;if(H&&X.nodeType&&!(c.type==="click"&&c.button>=1)){for(;X!==this;X=X.parentNode||this)if(X.nodeType===1&&!(c.type==="click"&&X.disabled===!0)){for(D=[],L={},w=0;w<H;w++)x=p[w],M=x.selector+" ",L[M]===void 0&&(L[M]=x.needsContext?h(M,this).index(X)>-1:h.find(M,this,null,[X]).length),L[M]&&D.push(x);D.length&&W.push({elem:X,handlers:D})}}return X=this,H<p.length&&W.push({elem:X,handlers:p.slice(H)}),W},addProp:function(c,p){Object.defineProperty(h.Event.prototype,c,{enumerable:!0,configurable:!0,get:b(p)?function(){if(this.originalEvent)return p(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[c]},set:function(w){Object.defineProperty(this,c,{enumerable:!0,configurable:!0,writable:!0,value:w})}})},fix:function(c){return c[h.expando]?c:new h.Event(c)},special:{load:{noBubble:!0},click:{setup:function(c){var p=this||c;return mi.test(p.type)&&p.click&&O(p,"input")&&We(p,"click",!0),!1},trigger:function(c){var p=this||c;return mi.test(p.type)&&p.click&&O(p,"input")&&We(p,"click"),!0},_default:function(c){var p=c.target;return mi.test(p.type)&&p.click&&O(p,"input")&&K.get(p,"click")||O(p,"a")}},beforeunload:{postDispatch:function(c){c.result!==void 0&&c.originalEvent&&(c.originalEvent.returnValue=c.result)}}}};function We(c,p,w){if(!w){K.get(c,p)===void 0&&h.event.add(c,p,$);return}K.set(c,p,!1),h.event.add(c,p,{namespace:!1,handler:function(x){var M,D=K.get(this,p);if(x.isTrigger&1&&this[p]){if(D)(h.event.special[p]||{}).delegateType&&x.stopPropagation();else if(D=s.call(arguments),K.set(this,p,D),this[p](),M=K.get(this,p),K.set(this,p,!1),D!==M)return x.stopImmediatePropagation(),x.preventDefault(),M}else D&&(K.set(this,p,h.event.trigger(D[0],D.slice(1),this)),x.stopPropagation(),x.isImmediatePropagationStopped=$)}})}h.removeEvent=function(c,p,w){c.removeEventListener&&c.removeEventListener(p,w)},h.Event=function(c,p){if(!(this instanceof h.Event))return new h.Event(c,p);c&&c.type?(this.originalEvent=c,this.type=c.type,this.isDefaultPrevented=c.defaultPrevented||c.defaultPrevented===void 0&&c.returnValue===!1?$:pe,this.target=c.target&&c.target.nodeType===3?c.target.parentNode:c.target,this.currentTarget=c.currentTarget,this.relatedTarget=c.relatedTarget):this.type=c,p&&h.extend(this,p),this.timeStamp=c&&c.timeStamp||Date.now(),this[h.expando]=!0},h.Event.prototype={constructor:h.Event,isDefaultPrevented:pe,isPropagationStopped:pe,isImmediatePropagationStopped:pe,isSimulated:!1,preventDefault:function(){var c=this.originalEvent;this.isDefaultPrevented=$,c&&!this.isSimulated&&c.preventDefault()},stopPropagation:function(){var c=this.originalEvent;this.isPropagationStopped=$,c&&!this.isSimulated&&c.stopPropagation()},stopImmediatePropagation:function(){var c=this.originalEvent;this.isImmediatePropagationStopped=$,c&&!this.isSimulated&&c.stopImmediatePropagation(),this.stopPropagation()}},h.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},h.event.addProp),h.each({focus:"focusin",blur:"focusout"},function(c,p){function w(x){if(S.documentMode){var M=K.get(this,"handle"),D=h.event.fix(x);D.type=x.type==="focusin"?"focus":"blur",D.isSimulated=!0,M(x),D.target===D.currentTarget&&M(D)}else h.event.simulate(p,x.target,h.event.fix(x))}h.event.special[c]={setup:function(){var x;if(We(this,c,!0),S.documentMode)x=K.get(this,p),x||this.addEventListener(p,w),K.set(this,p,(x||0)+1);else return!1},trigger:function(){return We(this,c),!0},teardown:function(){var x;if(S.documentMode)x=K.get(this,p)-1,x?K.set(this,p,x):(this.removeEventListener(p,w),K.remove(this,p));else return!1},_default:function(x){return K.get(x.target,c)},delegateType:p},h.event.special[p]={setup:function(){var x=this.ownerDocument||this.document||this,M=S.documentMode?this:x,D=K.get(M,p);D||(S.documentMode?this.addEventListener(p,w):x.addEventListener(c,w,!0)),K.set(M,p,(D||0)+1)},teardown:function(){var x=this.ownerDocument||this.document||this,M=S.documentMode?this:x,D=K.get(M,p)-1;D?K.set(M,p,D):(S.documentMode?this.removeEventListener(p,w):x.removeEventListener(c,w,!0),K.remove(M,p))}}}),h.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(c,p){h.event.special[c]={delegateType:p,bindType:p,handle:function(w){var x,M=this,D=w.relatedTarget,L=w.handleObj;return(!D||D!==M&&!h.contains(M,D))&&(w.type=L.origType,x=L.handler.apply(this,arguments),w.type=p),x}}}),h.fn.extend({on:function(c,p,w,x){return Me(this,c,p,w,x)},one:function(c,p,w,x){return Me(this,c,p,w,x,1)},off:function(c,p,w){var x,M;if(c&&c.preventDefault&&c.handleObj)return x=c.handleObj,h(c.delegateTarget).off(x.namespace?x.origType+"."+x.namespace:x.origType,x.selector,x.handler),this;if(typeof c=="object"){for(M in c)this.off(M,p,c[M]);return this}return(p===!1||typeof p=="function")&&(w=p,p=void 0),w===!1&&(w=pe),this.each(function(){h.event.remove(this,c,w,p)})}});var wt=/<script|<style|<link/i,vt=/checked\s*(?:[^=]|=\s*.checked.)/i,ct=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function et(c,p){return O(c,"table")&&O(p.nodeType!==11?p:p.firstChild,"tr")&&h(c).children("tbody")[0]||c}function ln(c){return c.type=(c.getAttribute("type")!==null)+"/"+c.type,c}function Ot(c){return(c.type||"").slice(0,5)==="true/"?c.type=c.type.slice(5):c.removeAttribute("type"),c}function jt(c,p){var w,x,M,D,L,W,H;if(p.nodeType===1){if(K.hasData(c)&&(D=K.get(c),H=D.events,H)){K.remove(p,"handle events");for(M in H)for(w=0,x=H[M].length;w<x;w++)h.event.add(p,M,H[M][w])}ke.hasData(c)&&(L=ke.access(c),W=h.extend({},L),ke.set(p,W))}}function ar(c,p){var w=p.nodeName.toLowerCase();w==="input"&&mi.test(c.type)?p.checked=c.checked:(w==="input"||w==="textarea")&&(p.defaultValue=c.defaultValue)}function Bn(c,p,w,x){p=o(p);var M,D,L,W,H,X,se=0,ce=c.length,ee=ce-1,_e=p[0],Ye=b(_e);if(Ye||ce>1&&typeof _e=="string"&&!y.checkClone&&vt.test(_e))return c.each(function(ut){var Qe=c.eq(ut);Ye&&(p[0]=_e.call(this,ut,Qe.html())),Bn(Qe,p,w,x)});if(ce&&(M=$l(p,c[0].ownerDocument,!1,c,x),D=M.firstChild,M.childNodes.length===1&&(M=D),D||x)){for(L=h.map(an(M,"script"),ln),W=L.length;se<ce;se++)H=M,se!==ee&&(H=h.clone(H,!0,!0),W&&h.merge(L,an(H,"script"))),w.call(c[se],H,se);if(W)for(X=L[L.length-1].ownerDocument,h.map(L,Ot),se=0;se<W;se++)H=L[se],Wl.test(H.type||"")&&!K.access(H,"globalEval")&&h.contains(X,H)&&(H.src&&(H.type||"").toLowerCase()!=="module"?h._evalUrl&&!H.noModule&&h._evalUrl(H.src,{nonce:H.nonce||H.getAttribute("nonce")},X):v(H.textContent.replace(ct,""),H,X))}return c}function Xo(c,p,w){for(var x,M=p?h.filter(p,c):c,D=0;(x=M[D])!=null;D++)!w&&x.nodeType===1&&h.cleanData(an(x)),x.parentNode&&(w&&qt(x)&&Go(an(x,"script")),x.parentNode.removeChild(x));return c}h.extend({htmlPrefilter:function(c){return c},clone:function(c,p,w){var x,M,D,L,W=c.cloneNode(!0),H=qt(c);if(!y.noCloneChecked&&(c.nodeType===1||c.nodeType===11)&&!h.isXMLDoc(c))for(L=an(W),D=an(c),x=0,M=D.length;x<M;x++)ar(D[x],L[x]);if(p)if(w)for(D=D||an(c),L=L||an(W),x=0,M=D.length;x<M;x++)jt(D[x],L[x]);else jt(c,W);return L=an(W,"script"),L.length>0&&Go(L,!H&&an(c,"script")),W},cleanData:function(c){for(var p,w,x,M=h.event.special,D=0;(w=c[D])!==void 0;D++)if(Y(w)){if(p=w[K.expando]){if(p.events)for(x in p.events)M[x]?h.event.remove(w,x):h.removeEvent(w,x,p.handle);w[K.expando]=void 0}w[ke.expando]&&(w[ke.expando]=void 0)}}}),h.fn.extend({detach:function(c){return Xo(this,c,!0)},remove:function(c){return Xo(this,c)},text:function(c){return Ie(this,function(p){return p===void 0?h.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=p)})},null,c,arguments.length)},append:function(){return Bn(this,arguments,function(c){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var p=et(this,c);p.appendChild(c)}})},prepend:function(){return Bn(this,arguments,function(c){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var p=et(this,c);p.insertBefore(c,p.firstChild)}})},before:function(){return Bn(this,arguments,function(c){this.parentNode&&this.parentNode.insertBefore(c,this)})},after:function(){return Bn(this,arguments,function(c){this.parentNode&&this.parentNode.insertBefore(c,this.nextSibling)})},empty:function(){for(var c,p=0;(c=this[p])!=null;p++)c.nodeType===1&&(h.cleanData(an(c,!1)),c.textContent="");return this},clone:function(c,p){return c=c??!1,p=p??c,this.map(function(){return h.clone(this,c,p)})},html:function(c){return Ie(this,function(p){var w=this[0]||{},x=0,M=this.length;if(p===void 0&&w.nodeType===1)return w.innerHTML;if(typeof p=="string"&&!wt.test(p)&&!Mn[(Ko.exec(p)||["",""])[1].toLowerCase()]){p=h.htmlPrefilter(p);try{for(;x<M;x++)w=this[x]||{},w.nodeType===1&&(h.cleanData(an(w,!1)),w.innerHTML=p);w=0}catch{}}w&&this.empty().append(p)},null,c,arguments.length)},replaceWith:function(){var c=[];return Bn(this,arguments,function(p){var w=this.parentNode;h.inArray(this,c)<0&&(h.cleanData(an(this)),w&&w.replaceChild(p,this))},c)}}),h.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(c,p){h.fn[c]=function(w){for(var x,M=[],D=h(w),L=D.length-1,W=0;W<=L;W++)x=W===L?this:this.clone(!0),h(D[W])[p](x),a.apply(M,x.get());return this.pushStack(M)}});var Un=new RegExp("^("+Ft+")(?!px)[a-z%]+$","i"),Vd=/^--/,Vl=function(c){var p=c.ownerDocument.defaultView;return(!p||!p.opener)&&(p=e),p.getComputedStyle(c)},c_=function(c,p,w){var x,M,D={};for(M in p)D[M]=c.style[M],c.style[M]=p[M];x=w.call(c);for(M in p)c.style[M]=D[M];return x},dE=new RegExp(Vt.join("|"),"i");(function(){function c(){if(X){H.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",X.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",hn.appendChild(H).appendChild(X);var se=e.getComputedStyle(X);w=se.top!=="1%",W=p(se.marginLeft)===12,X.style.right="60%",D=p(se.right)===36,x=p(se.width)===36,X.style.position="absolute",M=p(X.offsetWidth/3)===12,hn.removeChild(H),X=null}}function p(se){return Math.round(parseFloat(se))}var w,x,M,D,L,W,H=S.createElement("div"),X=S.createElement("div");X.style&&(X.style.backgroundClip="content-box",X.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle=X.style.backgroundClip==="content-box",h.extend(y,{boxSizingReliable:function(){return c(),x},pixelBoxStyles:function(){return c(),D},pixelPosition:function(){return c(),w},reliableMarginLeft:function(){return c(),W},scrollboxSize:function(){return c(),M},reliableTrDimensions:function(){var se,ce,ee,_e;return L==null&&(se=S.createElement("table"),ce=S.createElement("tr"),ee=S.createElement("div"),se.style.cssText="position:absolute;left:-11111px;border-collapse:separate",ce.style.cssText="box-sizing:content-box;border:1px solid",ce.style.height="1px",ee.style.height="9px",ee.style.display="block",hn.appendChild(se).appendChild(ce).appendChild(ee),_e=e.getComputedStyle(ce),L=parseInt(_e.height,10)+parseInt(_e.borderTopWidth,10)+parseInt(_e.borderBottomWidth,10)===ce.offsetHeight,hn.removeChild(se)),L}}))})();function Jo(c,p,w){var x,M,D,L,W=Vd.test(p),H=c.style;return w=w||Vl(c),w&&(L=w.getPropertyValue(p)||w[p],W&&L&&(L=L.replace(ne,"$1")||void 0),L===""&&!qt(c)&&(L=h.style(c,p)),!y.pixelBoxStyles()&&Un.test(L)&&dE.test(p)&&(x=H.width,M=H.minWidth,D=H.maxWidth,H.minWidth=H.maxWidth=H.width=L,L=w.width,H.width=x,H.minWidth=M,H.maxWidth=D)),L!==void 0?L+"":L}function u_(c,p){return{get:function(){if(c()){delete this.get;return}return(this.get=p).apply(this,arguments)}}}var d_=["Webkit","Moz","ms"],f_=S.createElement("div").style,h_={};function fE(c){for(var p=c[0].toUpperCase()+c.slice(1),w=d_.length;w--;)if(c=d_[w]+p,c in f_)return c}function qd(c){var p=h.cssProps[c]||h_[c];return p||(c in f_?c:h_[c]=fE(c)||c)}var hE=/^(none|table(?!-c[ea]).+)/,gE={position:"absolute",visibility:"hidden",display:"block"},g_={letterSpacing:"0",fontWeight:"400"};function p_(c,p,w){var x=wn.exec(p);return x?Math.max(0,x[2]-(w||0))+(x[3]||"px"):p}function Kd(c,p,w,x,M,D){var L=p==="width"?1:0,W=0,H=0,X=0;if(w===(x?"border":"content"))return 0;for(;L<4;L+=2)w==="margin"&&(X+=h.css(c,w+Vt[L],!0,M)),x?(w==="content"&&(H-=h.css(c,"padding"+Vt[L],!0,M)),w!=="margin"&&(H-=h.css(c,"border"+Vt[L]+"Width",!0,M))):(H+=h.css(c,"padding"+Vt[L],!0,M),w!=="padding"?H+=h.css(c,"border"+Vt[L]+"Width",!0,M):W+=h.css(c,"border"+Vt[L]+"Width",!0,M));return!x&&D>=0&&(H+=Math.max(0,Math.ceil(c["offset"+p[0].toUpperCase()+p.slice(1)]-D-H-W-.5))||0),H+X}function m_(c,p,w){var x=Vl(c),M=!y.boxSizingReliable()||w,D=M&&h.css(c,"boxSizing",!1,x)==="border-box",L=D,W=Jo(c,p,x),H="offset"+p[0].toUpperCase()+p.slice(1);if(Un.test(W)){if(!w)return W;W="auto"}return(!y.boxSizingReliable()&&D||!y.reliableTrDimensions()&&O(c,"tr")||W==="auto"||!parseFloat(W)&&h.css(c,"display",!1,x)==="inline")&&c.getClientRects().length&&(D=h.css(c,"boxSizing",!1,x)==="border-box",L=H in c,L&&(W=c[H])),W=parseFloat(W)||0,W+Kd(c,p,w||(D?"border":"content"),L,x,W)+"px"}h.extend({cssHooks:{opacity:{get:function(c,p){if(p){var w=Jo(c,"opacity");return w===""?"1":w}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(c,p,w,x){if(!(!c||c.nodeType===3||c.nodeType===8||!c.style)){var M,D,L,W=R(p),H=Vd.test(p),X=c.style;if(H||(p=qd(W)),L=h.cssHooks[p]||h.cssHooks[W],w!==void 0){if(D=typeof w,D==="string"&&(M=wn.exec(w))&&M[1]&&(w=qo(c,p,M),D="number"),w==null||w!==w)return;D==="number"&&!H&&(w+=M&&M[3]||(h.cssNumber[W]?"":"px")),!y.clearCloneStyle&&w===""&&p.indexOf("background")===0&&(X[p]="inherit"),(!L||!("set"in L)||(w=L.set(c,w,x))!==void 0)&&(H?X.setProperty(p,w):X[p]=w)}else return L&&"get"in L&&(M=L.get(c,!1,x))!==void 0?M:X[p]}},css:function(c,p,w,x){var M,D,L,W=R(p),H=Vd.test(p);return H||(p=qd(W)),L=h.cssHooks[p]||h.cssHooks[W],L&&"get"in L&&(M=L.get(c,!0,w)),M===void 0&&(M=Jo(c,p,x)),M==="normal"&&p in g_&&(M=g_[p]),w===""||w?(D=parseFloat(M),w===!0||isFinite(D)?D||0:M):M}}),h.each(["height","width"],function(c,p){h.cssHooks[p]={get:function(w,x,M){if(x)return hE.test(h.css(w,"display"))&&(!w.getClientRects().length||!w.getBoundingClientRect().width)?c_(w,gE,function(){return m_(w,p,M)}):m_(w,p,M)},set:function(w,x,M){var D,L=Vl(w),W=!y.scrollboxSize()&&L.position==="absolute",H=W||M,X=H&&h.css(w,"boxSizing",!1,L)==="border-box",se=M?Kd(w,p,M,X,L):0;return X&&W&&(se-=Math.ceil(w["offset"+p[0].toUpperCase()+p.slice(1)]-parseFloat(L[p])-Kd(w,p,"border",!1,L)-.5)),se&&(D=wn.exec(x))&&(D[3]||"px")!=="px"&&(w.style[p]=x,x=h.css(w,p)),p_(w,x,se)}}}),h.cssHooks.marginLeft=u_(y.reliableMarginLeft,function(c,p){if(p)return(parseFloat(Jo(c,"marginLeft"))||c.getBoundingClientRect().left-c_(c,{marginLeft:0},function(){return c.getBoundingClientRect().left}))+"px"}),h.each({margin:"",padding:"",border:"Width"},function(c,p){h.cssHooks[c+p]={expand:function(w){for(var x=0,M={},D=typeof w=="string"?w.split(" "):[w];x<4;x++)M[c+Vt[x]+p]=D[x]||D[x-2]||D[0];return M}},c!=="margin"&&(h.cssHooks[c+p].set=p_)}),h.fn.extend({css:function(c,p){return Ie(this,function(w,x,M){var D,L,W={},H=0;if(Array.isArray(x)){for(D=Vl(w),L=x.length;H<L;H++)W[x[H]]=h.css(w,x[H],!1,D);return W}return M!==void 0?h.style(w,x,M):h.css(w,x)},c,p,arguments.length>1)}});function Dn(c,p,w,x,M){return new Dn.prototype.init(c,p,w,x,M)}h.Tween=Dn,Dn.prototype={constructor:Dn,init:function(c,p,w,x,M,D){this.elem=c,this.prop=w,this.easing=M||h.easing._default,this.options=p,this.start=this.now=this.cur(),this.end=x,this.unit=D||(h.cssNumber[w]?"":"px")},cur:function(){var c=Dn.propHooks[this.prop];return c&&c.get?c.get(this):Dn.propHooks._default.get(this)},run:function(c){var p,w=Dn.propHooks[this.prop];return this.options.duration?this.pos=p=h.easing[this.easing](c,this.options.duration*c,0,1,this.options.duration):this.pos=p=c,this.now=(this.end-this.start)*p+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),w&&w.set?w.set(this):Dn.propHooks._default.set(this),this}},Dn.prototype.init.prototype=Dn.prototype,Dn.propHooks={_default:{get:function(c){var p;return c.elem.nodeType!==1||c.elem[c.prop]!=null&&c.elem.style[c.prop]==null?c.elem[c.prop]:(p=h.css(c.elem,c.prop,""),!p||p==="auto"?0:p)},set:function(c){h.fx.step[c.prop]?h.fx.step[c.prop](c):c.elem.nodeType===1&&(h.cssHooks[c.prop]||c.elem.style[qd(c.prop)]!=null)?h.style(c.elem,c.prop,c.now+c.unit):c.elem[c.prop]=c.now}}},Dn.propHooks.scrollTop=Dn.propHooks.scrollLeft={set:function(c){c.elem.nodeType&&c.elem.parentNode&&(c.elem[c.prop]=c.now)}},h.easing={linear:function(c){return c},swing:function(c){return .5-Math.cos(c*Math.PI)/2},_default:"swing"},h.fx=Dn.prototype.init,h.fx.step={};var Bs,ql,pE=/^(?:toggle|show|hide)$/,mE=/queueHooks$/;function Gd(){ql&&(S.hidden===!1&&e.requestAnimationFrame?e.requestAnimationFrame(Gd):e.setTimeout(Gd,h.fx.interval),h.fx.tick())}function y_(){return e.setTimeout(function(){Bs=void 0}),Bs=Date.now()}function Kl(c,p){var w,x=0,M={height:c};for(p=p?1:0;x<4;x+=2-p)w=Vt[x],M["margin"+w]=M["padding"+w]=c;return p&&(M.opacity=M.width=c),M}function __(c,p,w){for(var x,M=(lr.tweeners[p]||[]).concat(lr.tweeners["*"]),D=0,L=M.length;D<L;D++)if(x=M[D].call(w,p,c))return x}function yE(c,p,w){var x,M,D,L,W,H,X,se,ce="width"in p||"height"in p,ee=this,_e={},Ye=c.style,ut=c.nodeType&&gi(c),Qe=K.get(c,"fxshow");w.queue||(L=h._queueHooks(c,"fx"),L.unqueued==null&&(L.unqueued=0,W=L.empty.fire,L.empty.fire=function(){L.unqueued||W()}),L.unqueued++,ee.always(function(){ee.always(function(){L.unqueued--,h.queue(c,"fx").length||L.empty.fire()})}));for(x in p)if(M=p[x],pE.test(M)){if(delete p[x],D=D||M==="toggle",M===(ut?"hide":"show"))if(M==="show"&&Qe&&Qe[x]!==void 0)ut=!0;else continue;_e[x]=Qe&&Qe[x]||h.style(c,x)}if(H=!h.isEmptyObject(p),!(!H&&h.isEmptyObject(_e))){ce&&c.nodeType===1&&(w.overflow=[Ye.overflow,Ye.overflowX,Ye.overflowY],X=Qe&&Qe.display,X==null&&(X=K.get(c,"display")),se=h.css(c,"display"),se==="none"&&(X?se=X:(pi([c],!0),X=c.style.display||X,se=h.css(c,"display"),pi([c]))),(se==="inline"||se==="inline-block"&&X!=null)&&h.css(c,"float")==="none"&&(H||(ee.done(function(){Ye.display=X}),X==null&&(se=Ye.display,X=se==="none"?"":se)),Ye.display="inline-block")),w.overflow&&(Ye.overflow="hidden",ee.always(function(){Ye.overflow=w.overflow[0],Ye.overflowX=w.overflow[1],Ye.overflowY=w.overflow[2]})),H=!1;for(x in _e)H||(Qe?"hidden"in Qe&&(ut=Qe.hidden):Qe=K.access(c,"fxshow",{display:X}),D&&(Qe.hidden=!ut),ut&&pi([c],!0),ee.done(function(){ut||pi([c]),K.remove(c,"fxshow");for(x in _e)h.style(c,x,_e[x])})),H=__(ut?Qe[x]:0,x,ee),x in Qe||(Qe[x]=H.start,ut&&(H.end=H.start,H.start=0))}}function _E(c,p){var w,x,M,D,L;for(w in c)if(x=R(w),M=p[x],D=c[w],Array.isArray(D)&&(M=D[1],D=c[w]=D[0]),w!==x&&(c[x]=D,delete c[w]),L=h.cssHooks[x],L&&"expand"in L){D=L.expand(D),delete c[x];for(w in D)w in c||(c[w]=D[w],p[w]=M)}else p[x]=M}function lr(c,p,w){var x,M,D=0,L=lr.prefilters.length,W=h.Deferred().always(function(){delete H.elem}),H=function(){if(M)return!1;for(var ce=Bs||y_(),ee=Math.max(0,X.startTime+X.duration-ce),_e=ee/X.duration||0,Ye=1-_e,ut=0,Qe=X.tweens.length;ut<Qe;ut++)X.tweens[ut].run(Ye);return W.notifyWith(c,[X,Ye,ee]),Ye<1&&Qe?ee:(Qe||W.notifyWith(c,[X,1,0]),W.resolveWith(c,[X]),!1)},X=W.promise({elem:c,props:h.extend({},p),opts:h.extend(!0,{specialEasing:{},easing:h.easing._default},w),originalProperties:p,originalOptions:w,startTime:Bs||y_(),duration:w.duration,tweens:[],createTween:function(ce,ee){var _e=h.Tween(c,X.opts,ce,ee,X.opts.specialEasing[ce]||X.opts.easing);return X.tweens.push(_e),_e},stop:function(ce){var ee=0,_e=ce?X.tweens.length:0;if(M)return this;for(M=!0;ee<_e;ee++)X.tweens[ee].run(1);return ce?(W.notifyWith(c,[X,1,0]),W.resolveWith(c,[X,ce])):W.rejectWith(c,[X,ce]),this}}),se=X.props;for(_E(se,X.opts.specialEasing);D<L;D++)if(x=lr.prefilters[D].call(X,c,se,X.opts),x)return b(x.stop)&&(h._queueHooks(X.elem,X.opts.queue).stop=x.stop.bind(x)),x;return h.map(se,__,X),b(X.opts.start)&&X.opts.start.call(c,X),X.progress(X.opts.progress).done(X.opts.done,X.opts.complete).fail(X.opts.fail).always(X.opts.always),h.fx.timer(h.extend(H,{elem:c,anim:X,queue:X.opts.queue})),X}h.Animation=h.extend(lr,{tweeners:{"*":[function(c,p){var w=this.createTween(c,p);return qo(w.elem,c,wn.exec(p),w),w}]},tweener:function(c,p){b(c)?(p=c,c=["*"]):c=c.match(Pe);for(var w,x=0,M=c.length;x<M;x++)w=c[x],lr.tweeners[w]=lr.tweeners[w]||[],lr.tweeners[w].unshift(p)},prefilters:[yE],prefilter:function(c,p){p?lr.prefilters.unshift(c):lr.prefilters.push(c)}}),h.speed=function(c,p,w){var x=c&&typeof c=="object"?h.extend({},c):{complete:w||!w&&p||b(c)&&c,duration:c,easing:w&&p||p&&!b(p)&&p};return h.fx.off?x.duration=0:typeof x.duration!="number"&&(x.duration in h.fx.speeds?x.duration=h.fx.speeds[x.duration]:x.duration=h.fx.speeds._default),(x.queue==null||x.queue===!0)&&(x.queue="fx"),x.old=x.complete,x.complete=function(){b(x.old)&&x.old.call(this),x.queue&&h.dequeue(this,x.queue)},x},h.fn.extend({fadeTo:function(c,p,w,x){return this.filter(gi).css("opacity",0).show().end().animate({opacity:p},c,w,x)},animate:function(c,p,w,x){var M=h.isEmptyObject(c),D=h.speed(p,w,x),L=function(){var W=lr(this,h.extend({},c),D);(M||K.get(this,"finish"))&&W.stop(!0)};return L.finish=L,M||D.queue===!1?this.each(L):this.queue(D.queue,L)},stop:function(c,p,w){var x=function(M){var D=M.stop;delete M.stop,D(w)};return typeof c!="string"&&(w=p,p=c,c=void 0),p&&this.queue(c||"fx",[]),this.each(function(){var M=!0,D=c!=null&&c+"queueHooks",L=h.timers,W=K.get(this);if(D)W[D]&&W[D].stop&&x(W[D]);else for(D in W)W[D]&&W[D].stop&&mE.test(D)&&x(W[D]);for(D=L.length;D--;)L[D].elem===this&&(c==null||L[D].queue===c)&&(L[D].anim.stop(w),M=!1,L.splice(D,1));(M||!w)&&h.dequeue(this,c)})},finish:function(c){return c!==!1&&(c=c||"fx"),this.each(function(){var p,w=K.get(this),x=w[c+"queue"],M=w[c+"queueHooks"],D=h.timers,L=x?x.length:0;for(w.finish=!0,h.queue(this,c,[]),M&&M.stop&&M.stop.call(this,!0),p=D.length;p--;)D[p].elem===this&&D[p].queue===c&&(D[p].anim.stop(!0),D.splice(p,1));for(p=0;p<L;p++)x[p]&&x[p].finish&&x[p].finish.call(this);delete w.finish})}}),h.each(["toggle","show","hide"],function(c,p){var w=h.fn[p];h.fn[p]=function(x,M,D){return x==null||typeof x=="boolean"?w.apply(this,arguments):this.animate(Kl(p,!0),x,M,D)}}),h.each({slideDown:Kl("show"),slideUp:Kl("hide"),slideToggle:Kl("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(c,p){h.fn[c]=function(w,x,M){return this.animate(p,w,x,M)}}),h.timers=[],h.fx.tick=function(){var c,p=0,w=h.timers;for(Bs=Date.now();p<w.length;p++)c=w[p],!c()&&w[p]===c&&w.splice(p--,1);w.length||h.fx.stop(),Bs=void 0},h.fx.timer=function(c){h.timers.push(c),h.fx.start()},h.fx.interval=13,h.fx.start=function(){ql||(ql=!0,Gd())},h.fx.stop=function(){ql=null},h.fx.speeds={slow:600,fast:200,_default:400},h.fn.delay=function(c,p){return c=h.fx&&h.fx.speeds[c]||c,p=p||"fx",this.queue(p,function(w,x){var M=e.setTimeout(w,c);x.stop=function(){e.clearTimeout(M)}})},function(){var c=S.createElement("input"),p=S.createElement("select"),w=p.appendChild(S.createElement("option"));c.type="checkbox",y.checkOn=c.value!=="",y.optSelected=w.selected,c=S.createElement("input"),c.value="t",c.type="radio",y.radioValue=c.value==="t"}();var b_,Zo=h.expr.attrHandle;h.fn.extend({attr:function(c,p){return Ie(this,h.attr,c,p,arguments.length>1)},removeAttr:function(c){return this.each(function(){h.removeAttr(this,c)})}}),h.extend({attr:function(c,p,w){var x,M,D=c.nodeType;if(!(D===3||D===8||D===2)){if(typeof c.getAttribute>"u")return h.prop(c,p,w);if((D!==1||!h.isXMLDoc(c))&&(M=h.attrHooks[p.toLowerCase()]||(h.expr.match.bool.test(p)?b_:void 0)),w!==void 0){if(w===null){h.removeAttr(c,p);return}return M&&"set"in M&&(x=M.set(c,w,p))!==void 0?x:(c.setAttribute(p,w+""),w)}return M&&"get"in M&&(x=M.get(c,p))!==null?x:(x=h.find.attr(c,p),x??void 0)}},attrHooks:{type:{set:function(c,p){if(!y.radioValue&&p==="radio"&&O(c,"input")){var w=c.value;return c.setAttribute("type",p),w&&(c.value=w),p}}}},removeAttr:function(c,p){var w,x=0,M=p&&p.match(Pe);if(M&&c.nodeType===1)for(;w=M[x++];)c.removeAttribute(w)}}),b_={set:function(c,p,w){return p===!1?h.removeAttr(c,w):c.setAttribute(w,w),w}},h.each(h.expr.match.bool.source.match(/\w+/g),function(c,p){var w=Zo[p]||h.find.attr;Zo[p]=function(x,M,D){var L,W,H=M.toLowerCase();return D||(W=Zo[H],Zo[H]=L,L=w(x,M,D)!=null?H:null,Zo[H]=W),L}});var bE=/^(?:input|select|textarea|button)$/i,wE=/^(?:a|area)$/i;h.fn.extend({prop:function(c,p){return Ie(this,h.prop,c,p,arguments.length>1)},removeProp:function(c){return this.each(function(){delete this[h.propFix[c]||c]})}}),h.extend({prop:function(c,p,w){var x,M,D=c.nodeType;if(!(D===3||D===8||D===2))return(D!==1||!h.isXMLDoc(c))&&(p=h.propFix[p]||p,M=h.propHooks[p]),w!==void 0?M&&"set"in M&&(x=M.set(c,w,p))!==void 0?x:c[p]=w:M&&"get"in M&&(x=M.get(c,p))!==null?x:c[p]},propHooks:{tabIndex:{get:function(c){var p=h.find.attr(c,"tabindex");return p?parseInt(p,10):bE.test(c.nodeName)||wE.test(c.nodeName)&&c.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),y.optSelected||(h.propHooks.selected={get:function(c){var p=c.parentNode;return p&&p.parentNode&&p.parentNode.selectedIndex,null},set:function(c){var p=c.parentNode;p&&(p.selectedIndex,p.parentNode&&p.parentNode.selectedIndex)}}),h.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){h.propFix[this.toLowerCase()]=this});function Yi(c){var p=c.match(Pe)||[];return p.join(" ")}function Vi(c){return c.getAttribute&&c.getAttribute("class")||""}function Xd(c){return Array.isArray(c)?c:typeof c=="string"?c.match(Pe)||[]:[]}h.fn.extend({addClass:function(c){var p,w,x,M,D,L;return b(c)?this.each(function(W){h(this).addClass(c.call(this,W,Vi(this)))}):(p=Xd(c),p.length?this.each(function(){if(x=Vi(this),w=this.nodeType===1&&" "+Yi(x)+" ",w){for(D=0;D<p.length;D++)M=p[D],w.indexOf(" "+M+" ")<0&&(w+=M+" ");L=Yi(w),x!==L&&this.setAttribute("class",L)}}):this)},removeClass:function(c){var p,w,x,M,D,L;return b(c)?this.each(function(W){h(this).removeClass(c.call(this,W,Vi(this)))}):arguments.length?(p=Xd(c),p.length?this.each(function(){if(x=Vi(this),w=this.nodeType===1&&" "+Yi(x)+" ",w){for(D=0;D<p.length;D++)for(M=p[D];w.indexOf(" "+M+" ")>-1;)w=w.replace(" "+M+" "," ");L=Yi(w),x!==L&&this.setAttribute("class",L)}}):this):this.attr("class","")},toggleClass:function(c,p){var w,x,M,D,L=typeof c,W=L==="string"||Array.isArray(c);return b(c)?this.each(function(H){h(this).toggleClass(c.call(this,H,Vi(this),p),p)}):typeof p=="boolean"&&W?p?this.addClass(c):this.removeClass(c):(w=Xd(c),this.each(function(){if(W)for(D=h(this),M=0;M<w.length;M++)x=w[M],D.hasClass(x)?D.removeClass(x):D.addClass(x);else(c===void 0||L==="boolean")&&(x=Vi(this),x&&K.set(this,"__className__",x),this.setAttribute&&this.setAttribute("class",x||c===!1?"":K.get(this,"__className__")||""))}))},hasClass:function(c){var p,w,x=0;for(p=" "+c+" ";w=this[x++];)if(w.nodeType===1&&(" "+Yi(Vi(w))+" ").indexOf(p)>-1)return!0;return!1}});var vE=/\r/g;h.fn.extend({val:function(c){var p,w,x,M=this[0];return arguments.length?(x=b(c),this.each(function(D){var L;this.nodeType===1&&(x?L=c.call(this,D,h(this).val()):L=c,L==null?L="":typeof L=="number"?L+="":Array.isArray(L)&&(L=h.map(L,function(W){return W==null?"":W+""})),p=h.valHooks[this.type]||h.valHooks[this.nodeName.toLowerCase()],(!p||!("set"in p)||p.set(this,L,"value")===void 0)&&(this.value=L))})):M?(p=h.valHooks[M.type]||h.valHooks[M.nodeName.toLowerCase()],p&&"get"in p&&(w=p.get(M,"value"))!==void 0?w:(w=M.value,typeof w=="string"?w.replace(vE,""):w??"")):void 0}}),h.extend({valHooks:{option:{get:function(c){var p=h.find.attr(c,"value");return p??Yi(h.text(c))}},select:{get:function(c){var p,w,x,M=c.options,D=c.selectedIndex,L=c.type==="select-one",W=L?null:[],H=L?D+1:M.length;for(D<0?x=H:x=L?D:0;x<H;x++)if(w=M[x],(w.selected||x===D)&&!w.disabled&&(!w.parentNode.disabled||!O(w.parentNode,"optgroup"))){if(p=h(w).val(),L)return p;W.push(p)}return W},set:function(c,p){for(var w,x,M=c.options,D=h.makeArray(p),L=M.length;L--;)x=M[L],(x.selected=h.inArray(h.valHooks.option.get(x),D)>-1)&&(w=!0);return w||(c.selectedIndex=-1),D}}}}),h.each(["radio","checkbox"],function(){h.valHooks[this]={set:function(c,p){if(Array.isArray(p))return c.checked=h.inArray(h(c).val(),p)>-1}},y.checkOn||(h.valHooks[this].get=function(c){return c.getAttribute("value")===null?"on":c.value})});var Qo=e.location,w_={guid:Date.now()},Jd=/\?/;h.parseXML=function(c){var p,w;if(!c||typeof c!="string")return null;try{p=new e.DOMParser().parseFromString(c,"text/xml")}catch{}return w=p&&p.getElementsByTagName("parsererror")[0],(!p||w)&&h.error("Invalid XML: "+(w?h.map(w.childNodes,function(x){return x.textContent}).join(`
56
- `):c)),p};var v_=/^(?:focusinfocus|focusoutblur)$/,x_=function(c){c.stopPropagation()};h.extend(h.event,{trigger:function(c,p,w,x){var M,D,L,W,H,X,se,ce,ee=[w||S],_e=d.call(c,"type")?c.type:c,Ye=d.call(c,"namespace")?c.namespace.split("."):[];if(D=ce=L=w=w||S,!(w.nodeType===3||w.nodeType===8)&&!v_.test(_e+h.event.triggered)&&(_e.indexOf(".")>-1&&(Ye=_e.split("."),_e=Ye.shift(),Ye.sort()),H=_e.indexOf(":")<0&&"on"+_e,c=c[h.expando]?c:new h.Event(_e,typeof c=="object"&&c),c.isTrigger=x?2:3,c.namespace=Ye.join("."),c.rnamespace=c.namespace?new RegExp("(^|\\.)"+Ye.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=void 0,c.target||(c.target=w),p=p==null?[c]:h.makeArray(p,[c]),se=h.event.special[_e]||{},!(!x&&se.trigger&&se.trigger.apply(w,p)===!1))){if(!x&&!se.noBubble&&!C(w)){for(W=se.delegateType||_e,v_.test(W+_e)||(D=D.parentNode);D;D=D.parentNode)ee.push(D),L=D;L===(w.ownerDocument||S)&&ee.push(L.defaultView||L.parentWindow||e)}for(M=0;(D=ee[M++])&&!c.isPropagationStopped();)ce=D,c.type=M>1?W:se.bindType||_e,X=(K.get(D,"events")||Object.create(null))[c.type]&&K.get(D,"handle"),X&&X.apply(D,p),X=H&&D[H],X&&X.apply&&Y(D)&&(c.result=X.apply(D,p),c.result===!1&&c.preventDefault());return c.type=_e,!x&&!c.isDefaultPrevented()&&(!se._default||se._default.apply(ee.pop(),p)===!1)&&Y(w)&&H&&b(w[_e])&&!C(w)&&(L=w[H],L&&(w[H]=null),h.event.triggered=_e,c.isPropagationStopped()&&ce.addEventListener(_e,x_),w[_e](),c.isPropagationStopped()&&ce.removeEventListener(_e,x_),h.event.triggered=void 0,L&&(w[H]=L)),c.result}},simulate:function(c,p,w){var x=h.extend(new h.Event,w,{type:c,isSimulated:!0});h.event.trigger(x,null,p)}}),h.fn.extend({trigger:function(c,p){return this.each(function(){h.event.trigger(c,p,this)})},triggerHandler:function(c,p){var w=this[0];if(w)return h.event.trigger(c,p,w,!0)}});var xE=/\[\]$/,C_=/\r?\n/g,CE=/^(?:submit|button|image|reset|file)$/i,SE=/^(?:input|select|textarea|keygen)/i;function Zd(c,p,w,x){var M;if(Array.isArray(p))h.each(p,function(D,L){w||xE.test(c)?x(c,L):Zd(c+"["+(typeof L=="object"&&L!=null?D:"")+"]",L,w,x)});else if(!w&&k(p)==="object")for(M in p)Zd(c+"["+M+"]",p[M],w,x);else x(c,p)}h.param=function(c,p){var w,x=[],M=function(D,L){var W=b(L)?L():L;x[x.length]=encodeURIComponent(D)+"="+encodeURIComponent(W??"")};if(c==null)return"";if(Array.isArray(c)||c.jquery&&!h.isPlainObject(c))h.each(c,function(){M(this.name,this.value)});else for(w in c)Zd(w,c[w],p,M);return x.join("&")},h.fn.extend({serialize:function(){return h.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var c=h.prop(this,"elements");return c?h.makeArray(c):this}).filter(function(){var c=this.type;return this.name&&!h(this).is(":disabled")&&SE.test(this.nodeName)&&!CE.test(c)&&(this.checked||!mi.test(c))}).map(function(c,p){var w=h(this).val();return w==null?null:Array.isArray(w)?h.map(w,function(x){return{name:p.name,value:x.replace(C_,`\r
55
+ */(function(n){(function(e,t){n.exports=e.document?t(e,!0):function(r){if(!r.document)throw new Error("jQuery requires a window with a document");return t(r)}})(typeof window<"u"?window:Zn,function(e,t){var r=[],i=Object.getPrototypeOf,s=r.slice,o=r.flat?function(c){return r.flat.call(c)}:function(c){return r.concat.apply([],c)},a=r.push,l=r.indexOf,u={},g=u.toString,d=u.hasOwnProperty,f=d.toString,m=f.call(Object),y={},b=function(p){return typeof p=="function"&&typeof p.nodeType!="number"&&typeof p.item!="function"},C=function(p){return p!=null&&p===p.window},S=e.document,A={type:!0,src:!0,nonce:!0,noModule:!0};function v(c,p,w){w=w||S;var x,M,D=w.createElement("script");if(D.text=c,p)for(x in A)M=p[x]||p.getAttribute&&p.getAttribute(x),M&&D.setAttribute(x,M);w.head.appendChild(D).parentNode.removeChild(D)}function k(c){return c==null?c+"":typeof c=="object"||typeof c=="function"?u[g.call(c)]||"object":typeof c}var T="3.7.1",N=/HTML$/i,h=function(c,p){return new h.fn.init(c,p)};h.fn=h.prototype={jquery:T,constructor:h,length:0,toArray:function(){return s.call(this)},get:function(c){return c==null?s.call(this):c<0?this[c+this.length]:this[c]},pushStack:function(c){var p=h.merge(this.constructor(),c);return p.prevObject=this,p},each:function(c){return h.each(this,c)},map:function(c){return this.pushStack(h.map(this,function(p,w){return c.call(p,w,p)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(h.grep(this,function(c,p){return(p+1)%2}))},odd:function(){return this.pushStack(h.grep(this,function(c,p){return p%2}))},eq:function(c){var p=this.length,w=+c+(c<0?p:0);return this.pushStack(w>=0&&w<p?[this[w]]:[])},end:function(){return this.prevObject||this.constructor()},push:a,sort:r.sort,splice:r.splice},h.extend=h.fn.extend=function(){var c,p,w,x,M,D,L=arguments[0]||{},W=1,H=arguments.length,X=!1;for(typeof L=="boolean"&&(X=L,L=arguments[W]||{},W++),typeof L!="object"&&!b(L)&&(L={}),W===H&&(L=this,W--);W<H;W++)if((c=arguments[W])!=null)for(p in c)x=c[p],!(p==="__proto__"||L===x)&&(X&&x&&(h.isPlainObject(x)||(M=Array.isArray(x)))?(w=L[p],M&&!Array.isArray(w)?D=[]:!M&&!h.isPlainObject(w)?D={}:D=w,M=!1,L[p]=h.extend(X,D,x)):x!==void 0&&(L[p]=x));return L},h.extend({expando:"jQuery"+(T+Math.random()).replace(/\D/g,""),isReady:!0,error:function(c){throw new Error(c)},noop:function(){},isPlainObject:function(c){var p,w;return!c||g.call(c)!=="[object Object]"?!1:(p=i(c),p?(w=d.call(p,"constructor")&&p.constructor,typeof w=="function"&&f.call(w)===m):!0)},isEmptyObject:function(c){var p;for(p in c)return!1;return!0},globalEval:function(c,p,w){v(c,{nonce:p&&p.nonce},w)},each:function(c,p){var w,x=0;if(I(c))for(w=c.length;x<w&&p.call(c[x],x,c[x])!==!1;x++);else for(x in c)if(p.call(c[x],x,c[x])===!1)break;return c},text:function(c){var p,w="",x=0,M=c.nodeType;if(!M)for(;p=c[x++];)w+=h.text(p);return M===1||M===11?c.textContent:M===9?c.documentElement.textContent:M===3||M===4?c.nodeValue:w},makeArray:function(c,p){var w=p||[];return c!=null&&(I(Object(c))?h.merge(w,typeof c=="string"?[c]:c):a.call(w,c)),w},inArray:function(c,p,w){return p==null?-1:l.call(p,c,w)},isXMLDoc:function(c){var p=c&&c.namespaceURI,w=c&&(c.ownerDocument||c).documentElement;return!N.test(p||w&&w.nodeName||"HTML")},merge:function(c,p){for(var w=+p.length,x=0,M=c.length;x<w;x++)c[M++]=p[x];return c.length=M,c},grep:function(c,p,w){for(var x,M=[],D=0,L=c.length,W=!w;D<L;D++)x=!p(c[D],D),x!==W&&M.push(c[D]);return M},map:function(c,p,w){var x,M,D=0,L=[];if(I(c))for(x=c.length;D<x;D++)M=p(c[D],D,w),M!=null&&L.push(M);else for(D in c)M=p(c[D],D,w),M!=null&&L.push(M);return o(L)},guid:1,support:y}),typeof Symbol=="function"&&(h.fn[Symbol.iterator]=r[Symbol.iterator]),h.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(c,p){u["[object "+p+"]"]=p.toLowerCase()});function I(c){var p=!!c&&"length"in c&&c.length,w=k(c);return b(c)||C(c)?!1:w==="array"||p===0||typeof p=="number"&&p>0&&p-1 in c}function O(c,p){return c.nodeName&&c.nodeName.toLowerCase()===p.toLowerCase()}var j=r.pop,P=r.sort,q=r.splice,G="[\\x20\\t\\r\\n\\f]",ee=new RegExp("^"+G+"+|((?:^|[^\\\\])(?:\\\\.)*)"+G+"+$","g");h.contains=function(c,p){var w=p&&p.parentNode;return c===w||!!(w&&w.nodeType===1&&(c.contains?c.contains(w):c.compareDocumentPosition&&c.compareDocumentPosition(w)&16))};var ue=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function ae(c,p){return p?c==="\0"?"�":c.slice(0,-1)+"\\"+c.charCodeAt(c.length-1).toString(16)+" ":"\\"+c}h.escapeSelector=function(c){return(c+"").replace(ue,ae)};var ge=S,Le=a;(function(){var c,p,w,x,M,D=Le,L,W,H,X,se,ce=h.expando,te=0,_e=0,Ye=Gl(),ut=Gl(),Qe=Gl(),cn=Gl(),Jt=function(z,V){return z===V&&(M=!0),0},kr="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",Nr="(?:\\\\[\\da-fA-F]{1,6}"+G+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",st="\\["+G+"*("+Nr+")(?:"+G+"*([*^$|!~]?=)"+G+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+Nr+"))|)"+G+"*\\]",qi=":("+Nr+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+st+")*)|.*)\\)|)",ht=new RegExp(G+"+","g"),zt=new RegExp("^"+G+"*,"+G+"*"),ta=new RegExp("^"+G+"*([>+~]|"+G+")"+G+"*"),rf=new RegExp(G+"|>"),Mr=new RegExp(qi),na=new RegExp("^"+Nr+"$"),Dr={ID:new RegExp("^#("+Nr+")"),CLASS:new RegExp("^\\.("+Nr+")"),TAG:new RegExp("^("+Nr+"|[*])"),ATTR:new RegExp("^"+st),PSEUDO:new RegExp("^"+qi),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+G+"*(even|odd|(([+-]|)(\\d*)n|)"+G+"*(?:([+-]|)"+G+"*(\\d+)|))"+G+"*\\)|)","i"),bool:new RegExp("^(?:"+kr+")$","i"),needsContext:new RegExp("^"+G+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+G+"*((?:-\\d)?\\d*)"+G+"*\\)|)(?=[^-]|$)","i")},yi=/^(?:input|select|textarea|button)$/i,_i=/^h\d$/i,Xn=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,sf=/[+~]/,Yr=new RegExp("\\\\[\\da-fA-F]{1,6}"+G+"?|\\\\([^\\r\\n\\f])","g"),Vr=function(z,V){var Q="0x"+z.slice(1)-65536;return V||(Q<0?String.fromCharCode(Q+65536):String.fromCharCode(Q>>10|55296,Q&1023|56320))},FE=function(){bi()},zE=Jl(function(z){return z.disabled===!0&&O(z,"fieldset")},{dir:"parentNode",next:"legend"});function BE(){try{return L.activeElement}catch{}}try{D.apply(r=s.call(ge.childNodes),ge.childNodes),r[ge.childNodes.length].nodeType}catch{D={apply:function(V,Q){Le.apply(V,s.call(Q))},call:function(V){Le.apply(V,s.call(arguments,1))}}}function xt(z,V,Q,ne){var le,Se,Ie,Be,Re,nt,$e,qe=V&&V.ownerDocument,rt=V?V.nodeType:9;if(Q=Q||[],typeof z!="string"||!z||rt!==1&&rt!==9&&rt!==11)return Q;if(!ne&&(bi(V),V=V||L,H)){if(rt!==11&&(Re=Xn.exec(z)))if(le=Re[1]){if(rt===9)if(Ie=V.getElementById(le)){if(Ie.id===le)return D.call(Q,Ie),Q}else return Q;else if(qe&&(Ie=qe.getElementById(le))&&xt.contains(V,Ie)&&Ie.id===le)return D.call(Q,Ie),Q}else{if(Re[2])return D.apply(Q,V.getElementsByTagName(z)),Q;if((le=Re[3])&&V.getElementsByClassName)return D.apply(Q,V.getElementsByClassName(le)),Q}if(!cn[z+" "]&&(!X||!X.test(z))){if($e=z,qe=V,rt===1&&(rf.test(z)||ta.test(z))){for(qe=sf.test(z)&&of(V.parentNode)||V,(qe!=V||!y.scope)&&((Be=V.getAttribute("id"))?Be=h.escapeSelector(Be):V.setAttribute("id",Be=ce)),nt=ra(z),Se=nt.length;Se--;)nt[Se]=(Be?"#"+Be:":scope")+" "+Xl(nt[Se]);$e=nt.join(",")}try{return D.apply(Q,qe.querySelectorAll($e)),Q}catch{cn(z,!0)}finally{Be===ce&&V.removeAttribute("id")}}}return A_(z.replace(ee,"$1"),V,Q,ne)}function Gl(){var z=[];function V(Q,ne){return z.push(Q+" ")>p.cacheLength&&delete V[z.shift()],V[Q+" "]=ne}return V}function cr(z){return z[ce]=!0,z}function Us(z){var V=L.createElement("fieldset");try{return!!z(V)}catch{return!1}finally{V.parentNode&&V.parentNode.removeChild(V),V=null}}function UE(z){return function(V){return O(V,"input")&&V.type===z}}function HE(z){return function(V){return(O(V,"input")||O(V,"button"))&&V.type===z}}function M_(z){return function(V){return"form"in V?V.parentNode&&V.disabled===!1?"label"in V?"label"in V.parentNode?V.parentNode.disabled===z:V.disabled===z:V.isDisabled===z||V.isDisabled!==!z&&zE(V)===z:V.disabled===z:"label"in V?V.disabled===z:!1}}function Ki(z){return cr(function(V){return V=+V,cr(function(Q,ne){for(var le,Se=z([],Q.length,V),Ie=Se.length;Ie--;)Q[le=Se[Ie]]&&(Q[le]=!(ne[le]=Q[le]))})})}function of(z){return z&&typeof z.getElementsByTagName<"u"&&z}function bi(z){var V,Q=z?z.ownerDocument||z:ge;return Q==L||Q.nodeType!==9||!Q.documentElement||(L=Q,W=L.documentElement,H=!h.isXMLDoc(L),se=W.matches||W.webkitMatchesSelector||W.msMatchesSelector,W.msMatchesSelector&&ge!=L&&(V=L.defaultView)&&V.top!==V&&V.addEventListener("unload",FE),y.getById=Us(function(ne){return W.appendChild(ne).id=h.expando,!L.getElementsByName||!L.getElementsByName(h.expando).length}),y.disconnectedMatch=Us(function(ne){return se.call(ne,"*")}),y.scope=Us(function(){return L.querySelectorAll(":scope")}),y.cssHas=Us(function(){try{return L.querySelector(":has(*,:jqfake)"),!1}catch{return!0}}),y.getById?(p.filter.ID=function(ne){var le=ne.replace(Yr,Vr);return function(Se){return Se.getAttribute("id")===le}},p.find.ID=function(ne,le){if(typeof le.getElementById<"u"&&H){var Se=le.getElementById(ne);return Se?[Se]:[]}}):(p.filter.ID=function(ne){var le=ne.replace(Yr,Vr);return function(Se){var Ie=typeof Se.getAttributeNode<"u"&&Se.getAttributeNode("id");return Ie&&Ie.value===le}},p.find.ID=function(ne,le){if(typeof le.getElementById<"u"&&H){var Se,Ie,Be,Re=le.getElementById(ne);if(Re){if(Se=Re.getAttributeNode("id"),Se&&Se.value===ne)return[Re];for(Be=le.getElementsByName(ne),Ie=0;Re=Be[Ie++];)if(Se=Re.getAttributeNode("id"),Se&&Se.value===ne)return[Re]}return[]}}),p.find.TAG=function(ne,le){return typeof le.getElementsByTagName<"u"?le.getElementsByTagName(ne):le.querySelectorAll(ne)},p.find.CLASS=function(ne,le){if(typeof le.getElementsByClassName<"u"&&H)return le.getElementsByClassName(ne)},X=[],Us(function(ne){var le;W.appendChild(ne).innerHTML="<a id='"+ce+"' href='' disabled='disabled'></a><select id='"+ce+"-\r\\' disabled='disabled'><option selected=''></option></select>",ne.querySelectorAll("[selected]").length||X.push("\\["+G+"*(?:value|"+kr+")"),ne.querySelectorAll("[id~="+ce+"-]").length||X.push("~="),ne.querySelectorAll("a#"+ce+"+*").length||X.push(".#.+[+~]"),ne.querySelectorAll(":checked").length||X.push(":checked"),le=L.createElement("input"),le.setAttribute("type","hidden"),ne.appendChild(le).setAttribute("name","D"),W.appendChild(ne).disabled=!0,ne.querySelectorAll(":disabled").length!==2&&X.push(":enabled",":disabled"),le=L.createElement("input"),le.setAttribute("name",""),ne.appendChild(le),ne.querySelectorAll("[name='']").length||X.push("\\["+G+"*name"+G+"*="+G+`*(?:''|"")`)}),y.cssHas||X.push(":has"),X=X.length&&new RegExp(X.join("|")),Jt=function(ne,le){if(ne===le)return M=!0,0;var Se=!ne.compareDocumentPosition-!le.compareDocumentPosition;return Se||(Se=(ne.ownerDocument||ne)==(le.ownerDocument||le)?ne.compareDocumentPosition(le):1,Se&1||!y.sortDetached&&le.compareDocumentPosition(ne)===Se?ne===L||ne.ownerDocument==ge&&xt.contains(ge,ne)?-1:le===L||le.ownerDocument==ge&&xt.contains(ge,le)?1:x?l.call(x,ne)-l.call(x,le):0:Se&4?-1:1)}),L}xt.matches=function(z,V){return xt(z,null,null,V)},xt.matchesSelector=function(z,V){if(bi(z),H&&!cn[V+" "]&&(!X||!X.test(V)))try{var Q=se.call(z,V);if(Q||y.disconnectedMatch||z.document&&z.document.nodeType!==11)return Q}catch{cn(V,!0)}return xt(V,L,null,[z]).length>0},xt.contains=function(z,V){return(z.ownerDocument||z)!=L&&bi(z),h.contains(z,V)},xt.attr=function(z,V){(z.ownerDocument||z)!=L&&bi(z);var Q=p.attrHandle[V.toLowerCase()],ne=Q&&d.call(p.attrHandle,V.toLowerCase())?Q(z,V,!H):void 0;return ne!==void 0?ne:z.getAttribute(V)},xt.error=function(z){throw new Error("Syntax error, unrecognized expression: "+z)},h.uniqueSort=function(z){var V,Q=[],ne=0,le=0;if(M=!y.sortStable,x=!y.sortStable&&s.call(z,0),P.call(z,Jt),M){for(;V=z[le++];)V===z[le]&&(ne=Q.push(le));for(;ne--;)q.call(z,Q[ne],1)}return x=null,z},h.fn.uniqueSort=function(){return this.pushStack(h.uniqueSort(s.apply(this)))},p=h.expr={cacheLength:50,createPseudo:cr,match:Dr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(z){return z[1]=z[1].replace(Yr,Vr),z[3]=(z[3]||z[4]||z[5]||"").replace(Yr,Vr),z[2]==="~="&&(z[3]=" "+z[3]+" "),z.slice(0,4)},CHILD:function(z){return z[1]=z[1].toLowerCase(),z[1].slice(0,3)==="nth"?(z[3]||xt.error(z[0]),z[4]=+(z[4]?z[5]+(z[6]||1):2*(z[3]==="even"||z[3]==="odd")),z[5]=+(z[7]+z[8]||z[3]==="odd")):z[3]&&xt.error(z[0]),z},PSEUDO:function(z){var V,Q=!z[6]&&z[2];return Dr.CHILD.test(z[0])?null:(z[3]?z[2]=z[4]||z[5]||"":Q&&Mr.test(Q)&&(V=ra(Q,!0))&&(V=Q.indexOf(")",Q.length-V)-Q.length)&&(z[0]=z[0].slice(0,V),z[2]=Q.slice(0,V)),z.slice(0,3))}},filter:{TAG:function(z){var V=z.replace(Yr,Vr).toLowerCase();return z==="*"?function(){return!0}:function(Q){return O(Q,V)}},CLASS:function(z){var V=Ye[z+" "];return V||(V=new RegExp("(^|"+G+")"+z+"("+G+"|$)"))&&Ye(z,function(Q){return V.test(typeof Q.className=="string"&&Q.className||typeof Q.getAttribute<"u"&&Q.getAttribute("class")||"")})},ATTR:function(z,V,Q){return function(ne){var le=xt.attr(ne,z);return le==null?V==="!=":V?(le+="",V==="="?le===Q:V==="!="?le!==Q:V==="^="?Q&&le.indexOf(Q)===0:V==="*="?Q&&le.indexOf(Q)>-1:V==="$="?Q&&le.slice(-Q.length)===Q:V==="~="?(" "+le.replace(ht," ")+" ").indexOf(Q)>-1:V==="|="?le===Q||le.slice(0,Q.length+1)===Q+"-":!1):!0}},CHILD:function(z,V,Q,ne,le){var Se=z.slice(0,3)!=="nth",Ie=z.slice(-4)!=="last",Be=V==="of-type";return ne===1&&le===0?function(Re){return!!Re.parentNode}:function(Re,nt,$e){var qe,rt,He,Mt,An,gn=Se!==Ie?"nextSibling":"previousSibling",Jn=Re.parentNode,Ar=Be&&Re.nodeName.toLowerCase(),Hs=!$e&&!Be,vn=!1;if(Jn){if(Se){for(;gn;){for(He=Re;He=He[gn];)if(Be?O(He,Ar):He.nodeType===1)return!1;An=gn=z==="only"&&!An&&"nextSibling"}return!0}if(An=[Ie?Jn.firstChild:Jn.lastChild],Ie&&Hs){for(rt=Jn[ce]||(Jn[ce]={}),qe=rt[z]||[],Mt=qe[0]===te&&qe[1],vn=Mt&&qe[2],He=Mt&&Jn.childNodes[Mt];He=++Mt&&He&&He[gn]||(vn=Mt=0)||An.pop();)if(He.nodeType===1&&++vn&&He===Re){rt[z]=[te,Mt,vn];break}}else if(Hs&&(rt=Re[ce]||(Re[ce]={}),qe=rt[z]||[],Mt=qe[0]===te&&qe[1],vn=Mt),vn===!1)for(;(He=++Mt&&He&&He[gn]||(vn=Mt=0)||An.pop())&&!((Be?O(He,Ar):He.nodeType===1)&&++vn&&(Hs&&(rt=He[ce]||(He[ce]={}),rt[z]=[te,vn]),He===Re)););return vn-=le,vn===ne||vn%ne===0&&vn/ne>=0}}},PSEUDO:function(z,V){var Q,ne=p.pseudos[z]||p.setFilters[z.toLowerCase()]||xt.error("unsupported pseudo: "+z);return ne[ce]?ne(V):ne.length>1?(Q=[z,z,"",V],p.setFilters.hasOwnProperty(z.toLowerCase())?cr(function(le,Se){for(var Ie,Be=ne(le,V),Re=Be.length;Re--;)Ie=l.call(le,Be[Re]),le[Ie]=!(Se[Ie]=Be[Re])}):function(le){return ne(le,0,Q)}):ne}},pseudos:{not:cr(function(z){var V=[],Q=[],ne=uf(z.replace(ee,"$1"));return ne[ce]?cr(function(le,Se,Ie,Be){for(var Re,nt=ne(le,null,Be,[]),$e=le.length;$e--;)(Re=nt[$e])&&(le[$e]=!(Se[$e]=Re))}):function(le,Se,Ie){return V[0]=le,ne(V,null,Ie,Q),V[0]=null,!Q.pop()}}),has:cr(function(z){return function(V){return xt(z,V).length>0}}),contains:cr(function(z){return z=z.replace(Yr,Vr),function(V){return(V.textContent||h.text(V)).indexOf(z)>-1}}),lang:cr(function(z){return na.test(z||"")||xt.error("unsupported lang: "+z),z=z.replace(Yr,Vr).toLowerCase(),function(V){var Q;do if(Q=H?V.lang:V.getAttribute("xml:lang")||V.getAttribute("lang"))return Q=Q.toLowerCase(),Q===z||Q.indexOf(z+"-")===0;while((V=V.parentNode)&&V.nodeType===1);return!1}}),target:function(z){var V=e.location&&e.location.hash;return V&&V.slice(1)===z.id},root:function(z){return z===W},focus:function(z){return z===BE()&&L.hasFocus()&&!!(z.type||z.href||~z.tabIndex)},enabled:M_(!1),disabled:M_(!0),checked:function(z){return O(z,"input")&&!!z.checked||O(z,"option")&&!!z.selected},selected:function(z){return z.parentNode&&z.parentNode.selectedIndex,z.selected===!0},empty:function(z){for(z=z.firstChild;z;z=z.nextSibling)if(z.nodeType<6)return!1;return!0},parent:function(z){return!p.pseudos.empty(z)},header:function(z){return _i.test(z.nodeName)},input:function(z){return yi.test(z.nodeName)},button:function(z){return O(z,"input")&&z.type==="button"||O(z,"button")},text:function(z){var V;return O(z,"input")&&z.type==="text"&&((V=z.getAttribute("type"))==null||V.toLowerCase()==="text")},first:Ki(function(){return[0]}),last:Ki(function(z,V){return[V-1]}),eq:Ki(function(z,V,Q){return[Q<0?Q+V:Q]}),even:Ki(function(z,V){for(var Q=0;Q<V;Q+=2)z.push(Q);return z}),odd:Ki(function(z,V){for(var Q=1;Q<V;Q+=2)z.push(Q);return z}),lt:Ki(function(z,V,Q){var ne;for(Q<0?ne=Q+V:Q>V?ne=V:ne=Q;--ne>=0;)z.push(ne);return z}),gt:Ki(function(z,V,Q){for(var ne=Q<0?Q+V:Q;++ne<V;)z.push(ne);return z})}},p.pseudos.nth=p.pseudos.eq;for(c in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})p.pseudos[c]=UE(c);for(c in{submit:!0,reset:!0})p.pseudos[c]=HE(c);function D_(){}D_.prototype=p.filters=p.pseudos,p.setFilters=new D_;function ra(z,V){var Q,ne,le,Se,Ie,Be,Re,nt=ut[z+" "];if(nt)return V?0:nt.slice(0);for(Ie=z,Be=[],Re=p.preFilter;Ie;){(!Q||(ne=zt.exec(Ie)))&&(ne&&(Ie=Ie.slice(ne[0].length)||Ie),Be.push(le=[])),Q=!1,(ne=ta.exec(Ie))&&(Q=ne.shift(),le.push({value:Q,type:ne[0].replace(ee," ")}),Ie=Ie.slice(Q.length));for(Se in p.filter)(ne=Dr[Se].exec(Ie))&&(!Re[Se]||(ne=Re[Se](ne)))&&(Q=ne.shift(),le.push({value:Q,type:Se,matches:ne}),Ie=Ie.slice(Q.length));if(!Q)break}return V?Ie.length:Ie?xt.error(z):ut(z,Be).slice(0)}function Xl(z){for(var V=0,Q=z.length,ne="";V<Q;V++)ne+=z[V].value;return ne}function Jl(z,V,Q){var ne=V.dir,le=V.next,Se=le||ne,Ie=Q&&Se==="parentNode",Be=_e++;return V.first?function(Re,nt,$e){for(;Re=Re[ne];)if(Re.nodeType===1||Ie)return z(Re,nt,$e);return!1}:function(Re,nt,$e){var qe,rt,He=[te,Be];if($e){for(;Re=Re[ne];)if((Re.nodeType===1||Ie)&&z(Re,nt,$e))return!0}else for(;Re=Re[ne];)if(Re.nodeType===1||Ie)if(rt=Re[ce]||(Re[ce]={}),le&&O(Re,le))Re=Re[ne]||Re;else{if((qe=rt[Se])&&qe[0]===te&&qe[1]===Be)return He[2]=qe[2];if(rt[Se]=He,He[2]=z(Re,nt,$e))return!0}return!1}}function af(z){return z.length>1?function(V,Q,ne){for(var le=z.length;le--;)if(!z[le](V,Q,ne))return!1;return!0}:z[0]}function WE(z,V,Q){for(var ne=0,le=V.length;ne<le;ne++)xt(z,V[ne],Q);return Q}function Zl(z,V,Q,ne,le){for(var Se,Ie=[],Be=0,Re=z.length,nt=V!=null;Be<Re;Be++)(Se=z[Be])&&(!Q||Q(Se,ne,le))&&(Ie.push(Se),nt&&V.push(Be));return Ie}function lf(z,V,Q,ne,le,Se){return ne&&!ne[ce]&&(ne=lf(ne)),le&&!le[ce]&&(le=lf(le,Se)),cr(function(Ie,Be,Re,nt){var $e,qe,rt,He,Mt=[],An=[],gn=Be.length,Jn=Ie||WE(V||"*",Re.nodeType?[Re]:Re,[]),Ar=z&&(Ie||!V)?Zl(Jn,Mt,z,Re,nt):Jn;if(Q?(He=le||(Ie?z:gn||ne)?[]:Be,Q(Ar,He,Re,nt)):He=Ar,ne)for($e=Zl(He,An),ne($e,[],Re,nt),qe=$e.length;qe--;)(rt=$e[qe])&&(He[An[qe]]=!(Ar[An[qe]]=rt));if(Ie){if(le||z){if(le){for($e=[],qe=He.length;qe--;)(rt=He[qe])&&$e.push(Ar[qe]=rt);le(null,He=[],$e,nt)}for(qe=He.length;qe--;)(rt=He[qe])&&($e=le?l.call(Ie,rt):Mt[qe])>-1&&(Ie[$e]=!(Be[$e]=rt))}}else He=Zl(He===Be?He.splice(gn,He.length):He),le?le(null,Be,He,nt):D.apply(Be,He)})}function cf(z){for(var V,Q,ne,le=z.length,Se=p.relative[z[0].type],Ie=Se||p.relative[" "],Be=Se?1:0,Re=Jl(function(qe){return qe===V},Ie,!0),nt=Jl(function(qe){return l.call(V,qe)>-1},Ie,!0),$e=[function(qe,rt,He){var Mt=!Se&&(He||rt!=w)||((V=rt).nodeType?Re(qe,rt,He):nt(qe,rt,He));return V=null,Mt}];Be<le;Be++)if(Q=p.relative[z[Be].type])$e=[Jl(af($e),Q)];else{if(Q=p.filter[z[Be].type].apply(null,z[Be].matches),Q[ce]){for(ne=++Be;ne<le&&!p.relative[z[ne].type];ne++);return lf(Be>1&&af($e),Be>1&&Xl(z.slice(0,Be-1).concat({value:z[Be-2].type===" "?"*":""})).replace(ee,"$1"),Q,Be<ne&&cf(z.slice(Be,ne)),ne<le&&cf(z=z.slice(ne)),ne<le&&Xl(z))}$e.push(Q)}return af($e)}function $E(z,V){var Q=V.length>0,ne=z.length>0,le=function(Se,Ie,Be,Re,nt){var $e,qe,rt,He=0,Mt="0",An=Se&&[],gn=[],Jn=w,Ar=Se||ne&&p.find.TAG("*",nt),Hs=te+=Jn==null?1:Math.random()||.1,vn=Ar.length;for(nt&&(w=Ie==L||Ie||nt);Mt!==vn&&($e=Ar[Mt])!=null;Mt++){if(ne&&$e){for(qe=0,!Ie&&$e.ownerDocument!=L&&(bi($e),Be=!H);rt=z[qe++];)if(rt($e,Ie||L,Be)){D.call(Re,$e);break}nt&&(te=Hs)}Q&&(($e=!rt&&$e)&&He--,Se&&An.push($e))}if(He+=Mt,Q&&Mt!==He){for(qe=0;rt=V[qe++];)rt(An,gn,Ie,Be);if(Se){if(He>0)for(;Mt--;)An[Mt]||gn[Mt]||(gn[Mt]=j.call(Re));gn=Zl(gn)}D.apply(Re,gn),nt&&!Se&&gn.length>0&&He+V.length>1&&h.uniqueSort(Re)}return nt&&(te=Hs,w=Jn),An};return Q?cr(le):le}function uf(z,V){var Q,ne=[],le=[],Se=Qe[z+" "];if(!Se){for(V||(V=ra(z)),Q=V.length;Q--;)Se=cf(V[Q]),Se[ce]?ne.push(Se):le.push(Se);Se=Qe(z,$E(le,ne)),Se.selector=z}return Se}function A_(z,V,Q,ne){var le,Se,Ie,Be,Re,nt=typeof z=="function"&&z,$e=!ne&&ra(z=nt.selector||z);if(Q=Q||[],$e.length===1){if(Se=$e[0]=$e[0].slice(0),Se.length>2&&(Ie=Se[0]).type==="ID"&&V.nodeType===9&&H&&p.relative[Se[1].type]){if(V=(p.find.ID(Ie.matches[0].replace(Yr,Vr),V)||[])[0],V)nt&&(V=V.parentNode);else return Q;z=z.slice(Se.shift().value.length)}for(le=Dr.needsContext.test(z)?0:Se.length;le--&&(Ie=Se[le],!p.relative[Be=Ie.type]);)if((Re=p.find[Be])&&(ne=Re(Ie.matches[0].replace(Yr,Vr),sf.test(Se[0].type)&&of(V.parentNode)||V))){if(Se.splice(le,1),z=ne.length&&Xl(Se),!z)return D.apply(Q,ne),Q;break}}return(nt||uf(z,$e))(ne,V,!H,Q,!V||sf.test(z)&&of(V.parentNode)||V),Q}y.sortStable=ce.split("").sort(Jt).join("")===ce,bi(),y.sortDetached=Us(function(z){return z.compareDocumentPosition(L.createElement("fieldset"))&1}),h.find=xt,h.expr[":"]=h.expr.pseudos,h.unique=h.uniqueSort,xt.compile=uf,xt.select=A_,xt.setDocument=bi,xt.tokenize=ra,xt.escape=h.escapeSelector,xt.getText=h.text,xt.isXML=h.isXMLDoc,xt.selectors=h.expr,xt.support=h.support,xt.uniqueSort=h.uniqueSort})();var be=function(c,p,w){for(var x=[],M=w!==void 0;(c=c[p])&&c.nodeType!==9;)if(c.nodeType===1){if(M&&h(c).is(w))break;x.push(c)}return x},oe=function(c,p){for(var w=[];c;c=c.nextSibling)c.nodeType===1&&c!==p&&w.push(c);return w},fe=h.expr.match.needsContext,Ce=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Te(c,p,w){return b(p)?h.grep(c,function(x,M){return!!p.call(x,M,x)!==w}):p.nodeType?h.grep(c,function(x){return x===p!==w}):typeof p!="string"?h.grep(c,function(x){return l.call(p,x)>-1!==w}):h.filter(p,c,w)}h.filter=function(c,p,w){var x=p[0];return w&&(c=":not("+c+")"),p.length===1&&x.nodeType===1?h.find.matchesSelector(x,c)?[x]:[]:h.find.matches(c,h.grep(p,function(M){return M.nodeType===1}))},h.fn.extend({find:function(c){var p,w,x=this.length,M=this;if(typeof c!="string")return this.pushStack(h(c).filter(function(){for(p=0;p<x;p++)if(h.contains(M[p],this))return!0}));for(w=this.pushStack([]),p=0;p<x;p++)h.find(c,M[p],w);return x>1?h.uniqueSort(w):w},filter:function(c){return this.pushStack(Te(this,c||[],!1))},not:function(c){return this.pushStack(Te(this,c||[],!0))},is:function(c){return!!Te(this,typeof c=="string"&&fe.test(c)?h(c):c||[],!1).length}});var ve,Fe=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,De=h.fn.init=function(c,p,w){var x,M;if(!c)return this;if(w=w||ve,typeof c=="string")if(c[0]==="<"&&c[c.length-1]===">"&&c.length>=3?x=[null,c,null]:x=Fe.exec(c),x&&(x[1]||!p))if(x[1]){if(p=p instanceof h?p[0]:p,h.merge(this,h.parseHTML(x[1],p&&p.nodeType?p.ownerDocument||p:S,!0)),Ce.test(x[1])&&h.isPlainObject(p))for(x in p)b(this[x])?this[x](p[x]):this.attr(x,p[x]);return this}else return M=S.getElementById(x[2]),M&&(this[0]=M,this.length=1),this;else return!p||p.jquery?(p||w).find(c):this.constructor(p).find(c);else{if(c.nodeType)return this[0]=c,this.length=1,this;if(b(c))return w.ready!==void 0?w.ready(c):c(h)}return h.makeArray(c,this)};De.prototype=h.fn,ve=h(S);var ke=/^(?:parents|prev(?:Until|All))/,ze={children:!0,contents:!0,next:!0,prev:!0};h.fn.extend({has:function(c){var p=h(c,this),w=p.length;return this.filter(function(){for(var x=0;x<w;x++)if(h.contains(this,p[x]))return!0})},closest:function(c,p){var w,x=0,M=this.length,D=[],L=typeof c!="string"&&h(c);if(!fe.test(c)){for(;x<M;x++)for(w=this[x];w&&w!==p;w=w.parentNode)if(w.nodeType<11&&(L?L.index(w)>-1:w.nodeType===1&&h.find.matchesSelector(w,c))){D.push(w);break}}return this.pushStack(D.length>1?h.uniqueSort(D):D)},index:function(c){return c?typeof c=="string"?l.call(h(c),this[0]):l.call(this,c.jquery?c[0]:c):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(c,p){return this.pushStack(h.uniqueSort(h.merge(this.get(),h(c,p))))},addBack:function(c){return this.add(c==null?this.prevObject:this.prevObject.filter(c))}});function xe(c,p){for(;(c=c[p])&&c.nodeType!==1;);return c}h.each({parent:function(c){var p=c.parentNode;return p&&p.nodeType!==11?p:null},parents:function(c){return be(c,"parentNode")},parentsUntil:function(c,p,w){return be(c,"parentNode",w)},next:function(c){return xe(c,"nextSibling")},prev:function(c){return xe(c,"previousSibling")},nextAll:function(c){return be(c,"nextSibling")},prevAll:function(c){return be(c,"previousSibling")},nextUntil:function(c,p,w){return be(c,"nextSibling",w)},prevUntil:function(c,p,w){return be(c,"previousSibling",w)},siblings:function(c){return oe((c.parentNode||{}).firstChild,c)},children:function(c){return oe(c.firstChild)},contents:function(c){return c.contentDocument!=null&&i(c.contentDocument)?c.contentDocument:(O(c,"template")&&(c=c.content||c),h.merge([],c.childNodes))}},function(c,p){h.fn[c]=function(w,x){var M=h.map(this,p,w);return c.slice(-5)!=="Until"&&(x=w),x&&typeof x=="string"&&(M=h.filter(x,M)),this.length>1&&(ze[c]||h.uniqueSort(M),ke.test(c)&&M.reverse()),this.pushStack(M)}});var Pe=/[^\x20\t\r\n\f]+/g;function ft(c){var p={};return h.each(c.match(Pe)||[],function(w,x){p[x]=!0}),p}h.Callbacks=function(c){c=typeof c=="string"?ft(c):h.extend({},c);var p,w,x,M,D=[],L=[],W=-1,H=function(){for(M=M||c.once,x=p=!0;L.length;W=-1)for(w=L.shift();++W<D.length;)D[W].apply(w[0],w[1])===!1&&c.stopOnFalse&&(W=D.length,w=!1);c.memory||(w=!1),p=!1,M&&(w?D=[]:D="")},X={add:function(){return D&&(w&&!p&&(W=D.length-1,L.push(w)),function se(ce){h.each(ce,function(te,_e){b(_e)?(!c.unique||!X.has(_e))&&D.push(_e):_e&&_e.length&&k(_e)!=="string"&&se(_e)})}(arguments),w&&!p&&H()),this},remove:function(){return h.each(arguments,function(se,ce){for(var te;(te=h.inArray(ce,D,te))>-1;)D.splice(te,1),te<=W&&W--}),this},has:function(se){return se?h.inArray(se,D)>-1:D.length>0},empty:function(){return D&&(D=[]),this},disable:function(){return M=L=[],D=w="",this},disabled:function(){return!D},lock:function(){return M=L=[],!w&&!p&&(D=w=""),this},locked:function(){return!!M},fireWith:function(se,ce){return M||(ce=ce||[],ce=[se,ce.slice?ce.slice():ce],L.push(ce),p||H()),this},fire:function(){return X.fireWith(this,arguments),this},fired:function(){return!!x}};return X};function we(c){return c}function yt(c){throw c}function Wt(c,p,w,x){var M;try{c&&b(M=c.promise)?M.call(c).done(p).fail(w):c&&b(M=c.then)?M.call(c,p,w):p.apply(void 0,[c].slice(x))}catch(D){w.apply(void 0,[D])}}h.extend({Deferred:function(c){var p=[["notify","progress",h.Callbacks("memory"),h.Callbacks("memory"),2],["resolve","done",h.Callbacks("once memory"),h.Callbacks("once memory"),0,"resolved"],["reject","fail",h.Callbacks("once memory"),h.Callbacks("once memory"),1,"rejected"]],w="pending",x={state:function(){return w},always:function(){return M.done(arguments).fail(arguments),this},catch:function(D){return x.then(null,D)},pipe:function(){var D=arguments;return h.Deferred(function(L){h.each(p,function(W,H){var X=b(D[H[4]])&&D[H[4]];M[H[1]](function(){var se=X&&X.apply(this,arguments);se&&b(se.promise)?se.promise().progress(L.notify).done(L.resolve).fail(L.reject):L[H[0]+"With"](this,X?[se]:arguments)})}),D=null}).promise()},then:function(D,L,W){var H=0;function X(se,ce,te,_e){return function(){var Ye=this,ut=arguments,Qe=function(){var Jt,kr;if(!(se<H)){if(Jt=te.apply(Ye,ut),Jt===ce.promise())throw new TypeError("Thenable self-resolution");kr=Jt&&(typeof Jt=="object"||typeof Jt=="function")&&Jt.then,b(kr)?_e?kr.call(Jt,X(H,ce,we,_e),X(H,ce,yt,_e)):(H++,kr.call(Jt,X(H,ce,we,_e),X(H,ce,yt,_e),X(H,ce,we,ce.notifyWith))):(te!==we&&(Ye=void 0,ut=[Jt]),(_e||ce.resolveWith)(Ye,ut))}},cn=_e?Qe:function(){try{Qe()}catch(Jt){h.Deferred.exceptionHook&&h.Deferred.exceptionHook(Jt,cn.error),se+1>=H&&(te!==yt&&(Ye=void 0,ut=[Jt]),ce.rejectWith(Ye,ut))}};se?cn():(h.Deferred.getErrorHook?cn.error=h.Deferred.getErrorHook():h.Deferred.getStackHook&&(cn.error=h.Deferred.getStackHook()),e.setTimeout(cn))}}return h.Deferred(function(se){p[0][3].add(X(0,se,b(W)?W:we,se.notifyWith)),p[1][3].add(X(0,se,b(D)?D:we)),p[2][3].add(X(0,se,b(L)?L:yt))}).promise()},promise:function(D){return D!=null?h.extend(D,x):x}},M={};return h.each(p,function(D,L){var W=L[2],H=L[5];x[L[1]]=W.add,H&&W.add(function(){w=H},p[3-D][2].disable,p[3-D][3].disable,p[0][2].lock,p[0][3].lock),W.add(L[3].fire),M[L[0]]=function(){return M[L[0]+"With"](this===M?void 0:this,arguments),this},M[L[0]+"With"]=W.fireWith}),x.promise(M),c&&c.call(M,M),M},when:function(c){var p=arguments.length,w=p,x=Array(w),M=s.call(arguments),D=h.Deferred(),L=function(W){return function(H){x[W]=this,M[W]=arguments.length>1?s.call(arguments):H,--p||D.resolveWith(x,M)}};if(p<=1&&(Wt(c,D.done(L(w)).resolve,D.reject,!p),D.state()==="pending"||b(M[w]&&M[w].then)))return D.then();for(;w--;)Wt(M[w],L(w),D.reject);return D.promise()}});var Z=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;h.Deferred.exceptionHook=function(c,p){e.console&&e.console.warn&&c&&Z.test(c.name)&&e.console.warn("jQuery.Deferred exception: "+c.message,c.stack,p)},h.readyException=function(c){e.setTimeout(function(){throw c})};var re=h.Deferred();h.fn.ready=function(c){return re.then(c).catch(function(p){h.readyException(p)}),this},h.extend({isReady:!1,readyWait:1,ready:function(c){(c===!0?--h.readyWait:h.isReady)||(h.isReady=!0,!(c!==!0&&--h.readyWait>0)&&re.resolveWith(S,[h]))}}),h.ready.then=re.then;function ye(){S.removeEventListener("DOMContentLoaded",ye),e.removeEventListener("load",ye),h.ready()}S.readyState==="complete"||S.readyState!=="loading"&&!S.documentElement.doScroll?e.setTimeout(h.ready):(S.addEventListener("DOMContentLoaded",ye),e.addEventListener("load",ye));var Ae=function(c,p,w,x,M,D,L){var W=0,H=c.length,X=w==null;if(k(w)==="object"){M=!0;for(W in w)Ae(c,p,W,w[W],!0,D,L)}else if(x!==void 0&&(M=!0,b(x)||(L=!0),X&&(L?(p.call(c,x),p=null):(X=p,p=function(se,ce,te){return X.call(h(se),te)})),p))for(;W<H;W++)p(c[W],w,L?x:x.call(c[W],W,p(c[W],w)));return M?c:X?p.call(c):H?p(c[0],w):D},B=/^-ms-/,_=/-([a-z])/g;function E(c,p){return p.toUpperCase()}function R(c){return c.replace(B,"ms-").replace(_,E)}var Y=function(c){return c.nodeType===1||c.nodeType===9||!+c.nodeType};function J(){this.expando=h.expando+J.uid++}J.uid=1,J.prototype={cache:function(c){var p=c[this.expando];return p||(p={},Y(c)&&(c.nodeType?c[this.expando]=p:Object.defineProperty(c,this.expando,{value:p,configurable:!0}))),p},set:function(c,p,w){var x,M=this.cache(c);if(typeof p=="string")M[R(p)]=w;else for(x in p)M[R(x)]=p[x];return M},get:function(c,p){return p===void 0?this.cache(c):c[this.expando]&&c[this.expando][R(p)]},access:function(c,p,w){return p===void 0||p&&typeof p=="string"&&w===void 0?this.get(c,p):(this.set(c,p,w),w!==void 0?w:p)},remove:function(c,p){var w,x=c[this.expando];if(x!==void 0){if(p!==void 0)for(Array.isArray(p)?p=p.map(R):(p=R(p),p=p in x?[p]:p.match(Pe)||[]),w=p.length;w--;)delete x[p[w]];(p===void 0||h.isEmptyObject(x))&&(c.nodeType?c[this.expando]=void 0:delete c[this.expando])}},hasData:function(c){var p=c[this.expando];return p!==void 0&&!h.isEmptyObject(p)}};var K=new J,Ee=new J,Je=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Ct=/[A-Z]/g;function Ze(c){return c==="true"?!0:c==="false"?!1:c==="null"?null:c===+c+""?+c:Je.test(c)?JSON.parse(c):c}function Ge(c,p,w){var x;if(w===void 0&&c.nodeType===1)if(x="data-"+p.replace(Ct,"-$&").toLowerCase(),w=c.getAttribute(x),typeof w=="string"){try{w=Ze(w)}catch{}Ee.set(c,p,w)}else w=void 0;return w}h.extend({hasData:function(c){return Ee.hasData(c)||K.hasData(c)},data:function(c,p,w){return Ee.access(c,p,w)},removeData:function(c,p){Ee.remove(c,p)},_data:function(c,p,w){return K.access(c,p,w)},_removeData:function(c,p){K.remove(c,p)}}),h.fn.extend({data:function(c,p){var w,x,M,D=this[0],L=D&&D.attributes;if(c===void 0){if(this.length&&(M=Ee.get(D),D.nodeType===1&&!K.get(D,"hasDataAttrs"))){for(w=L.length;w--;)L[w]&&(x=L[w].name,x.indexOf("data-")===0&&(x=R(x.slice(5)),Ge(D,x,M[x])));K.set(D,"hasDataAttrs",!0)}return M}return typeof c=="object"?this.each(function(){Ee.set(this,c)}):Ae(this,function(W){var H;if(D&&W===void 0)return H=Ee.get(D,c),H!==void 0||(H=Ge(D,c),H!==void 0)?H:void 0;this.each(function(){Ee.set(this,c,W)})},null,p,arguments.length>1,null,!0)},removeData:function(c){return this.each(function(){Ee.remove(this,c)})}}),h.extend({queue:function(c,p,w){var x;if(c)return p=(p||"fx")+"queue",x=K.get(c,p),w&&(!x||Array.isArray(w)?x=K.access(c,p,h.makeArray(w)):x.push(w)),x||[]},dequeue:function(c,p){p=p||"fx";var w=h.queue(c,p),x=w.length,M=w.shift(),D=h._queueHooks(c,p),L=function(){h.dequeue(c,p)};M==="inprogress"&&(M=w.shift(),x--),M&&(p==="fx"&&w.unshift("inprogress"),delete D.stop,M.call(c,L,D)),!x&&D&&D.empty.fire()},_queueHooks:function(c,p){var w=p+"queueHooks";return K.get(c,w)||K.access(c,w,{empty:h.Callbacks("once memory").add(function(){K.remove(c,[p+"queue",w])})})}}),h.fn.extend({queue:function(c,p){var w=2;return typeof c!="string"&&(p=c,c="fx",w--),arguments.length<w?h.queue(this[0],c):p===void 0?this:this.each(function(){var x=h.queue(this,c,p);h._queueHooks(this,c),c==="fx"&&x[0]!=="inprogress"&&h.dequeue(this,c)})},dequeue:function(c){return this.each(function(){h.dequeue(this,c)})},clearQueue:function(c){return this.queue(c||"fx",[])},promise:function(c,p){var w,x=1,M=h.Deferred(),D=this,L=this.length,W=function(){--x||M.resolveWith(D,[D])};for(typeof c!="string"&&(p=c,c=void 0),c=c||"fx";L--;)w=K.get(D[L],c+"queueHooks"),w&&w.empty&&(x++,w.empty.add(W));return W(),M.promise(p)}});var Ft=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,wn=new RegExp("^(?:([+-])=|)("+Ft+")([a-z%]*)$","i"),Vt=["Top","Right","Bottom","Left"],hn=S.documentElement,qt=function(c){return h.contains(c.ownerDocument,c)},Gn={composed:!0};hn.getRootNode&&(qt=function(c){return h.contains(c.ownerDocument,c)||c.getRootNode(Gn)===c.ownerDocument});var gi=function(c,p){return c=p||c,c.style.display==="none"||c.style.display===""&&qt(c)&&h.css(c,"display")==="none"};function qo(c,p,w,x){var M,D,L=20,W=x?function(){return x.cur()}:function(){return h.css(c,p,"")},H=W(),X=w&&w[3]||(h.cssNumber[p]?"":"px"),se=c.nodeType&&(h.cssNumber[p]||X!=="px"&&+H)&&wn.exec(h.css(c,p));if(se&&se[3]!==X){for(H=H/2,X=X||se[3],se=+H||1;L--;)h.style(c,p,se+X),(1-D)*(1-(D=W()/H||.5))<=0&&(L=0),se=se/D;se=se*2,h.style(c,p,se+X),w=w||[]}return w&&(se=+se||+H||0,M=w[1]?se+(w[1]+1)*w[2]:+w[2],x&&(x.unit=X,x.start=se,x.end=M)),M}var Ul={};function Hl(c){var p,w=c.ownerDocument,x=c.nodeName,M=Ul[x];return M||(p=w.body.appendChild(w.createElement(x)),M=h.css(p,"display"),p.parentNode.removeChild(p),M==="none"&&(M="block"),Ul[x]=M,M)}function pi(c,p){for(var w,x,M=[],D=0,L=c.length;D<L;D++)x=c[D],x.style&&(w=x.style.display,p?(w==="none"&&(M[D]=K.get(x,"display")||null,M[D]||(x.style.display="")),x.style.display===""&&gi(x)&&(M[D]=Hl(x))):w!=="none"&&(M[D]="none",K.set(x,"display",w)));for(D=0;D<L;D++)M[D]!=null&&(c[D].style.display=M[D]);return c}h.fn.extend({show:function(){return pi(this,!0)},hide:function(){return pi(this)},toggle:function(c){return typeof c=="boolean"?c?this.show():this.hide():this.each(function(){gi(this)?h(this).show():h(this).hide()})}});var mi=/^(?:checkbox|radio)$/i,Ko=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Wl=/^$|^module$|\/(?:java|ecma)script/i;(function(){var c=S.createDocumentFragment(),p=c.appendChild(S.createElement("div")),w=S.createElement("input");w.setAttribute("type","radio"),w.setAttribute("checked","checked"),w.setAttribute("name","t"),p.appendChild(w),y.checkClone=p.cloneNode(!0).cloneNode(!0).lastChild.checked,p.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!p.cloneNode(!0).lastChild.defaultValue,p.innerHTML="<option></option>",y.option=!!p.lastChild})();var Mn={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Mn.tbody=Mn.tfoot=Mn.colgroup=Mn.caption=Mn.thead,Mn.th=Mn.td,y.option||(Mn.optgroup=Mn.option=[1,"<select multiple='multiple'>","</select>"]);function an(c,p){var w;return typeof c.getElementsByTagName<"u"?w=c.getElementsByTagName(p||"*"):typeof c.querySelectorAll<"u"?w=c.querySelectorAll(p||"*"):w=[],p===void 0||p&&O(c,p)?h.merge([c],w):w}function Go(c,p){for(var w=0,x=c.length;w<x;w++)K.set(c[w],"globalEval",!p||K.get(p[w],"globalEval"))}var Yd=/<|&#?\w+;/;function $l(c,p,w,x,M){for(var D,L,W,H,X,se,ce=p.createDocumentFragment(),te=[],_e=0,Ye=c.length;_e<Ye;_e++)if(D=c[_e],D||D===0)if(k(D)==="object")h.merge(te,D.nodeType?[D]:D);else if(!Yd.test(D))te.push(p.createTextNode(D));else{for(L=L||ce.appendChild(p.createElement("div")),W=(Ko.exec(D)||["",""])[1].toLowerCase(),H=Mn[W]||Mn._default,L.innerHTML=H[1]+h.htmlPrefilter(D)+H[2],se=H[0];se--;)L=L.lastChild;h.merge(te,L.childNodes),L=ce.firstChild,L.textContent=""}for(ce.textContent="",_e=0;D=te[_e++];){if(x&&h.inArray(D,x)>-1){M&&M.push(D);continue}if(X=qt(D),L=an(ce.appendChild(D),"script"),X&&Go(L),w)for(se=0;D=L[se++];)Wl.test(D.type||"")&&w.push(D)}return ce}var Yl=/^([^.]*)(?:\.(.+)|)/;function $(){return!0}function pe(){return!1}function Ne(c,p,w,x,M,D){var L,W;if(typeof p=="object"){typeof w!="string"&&(x=x||w,w=void 0);for(W in p)Ne(c,W,w,x,p[W],D);return c}if(x==null&&M==null?(M=w,x=w=void 0):M==null&&(typeof w=="string"?(M=x,x=void 0):(M=x,x=w,w=void 0)),M===!1)M=pe;else if(!M)return c;return D===1&&(L=M,M=function(H){return h().off(H),L.apply(this,arguments)},M.guid=L.guid||(L.guid=h.guid++)),c.each(function(){h.event.add(this,p,M,x,w)})}h.event={global:{},add:function(c,p,w,x,M){var D,L,W,H,X,se,ce,te,_e,Ye,ut,Qe=K.get(c);if(Y(c))for(w.handler&&(D=w,w=D.handler,M=D.selector),M&&h.find.matchesSelector(hn,M),w.guid||(w.guid=h.guid++),(H=Qe.events)||(H=Qe.events=Object.create(null)),(L=Qe.handle)||(L=Qe.handle=function(cn){return typeof h<"u"&&h.event.triggered!==cn.type?h.event.dispatch.apply(c,arguments):void 0}),p=(p||"").match(Pe)||[""],X=p.length;X--;)W=Yl.exec(p[X])||[],_e=ut=W[1],Ye=(W[2]||"").split(".").sort(),_e&&(ce=h.event.special[_e]||{},_e=(M?ce.delegateType:ce.bindType)||_e,ce=h.event.special[_e]||{},se=h.extend({type:_e,origType:ut,data:x,handler:w,guid:w.guid,selector:M,needsContext:M&&h.expr.match.needsContext.test(M),namespace:Ye.join(".")},D),(te=H[_e])||(te=H[_e]=[],te.delegateCount=0,(!ce.setup||ce.setup.call(c,x,Ye,L)===!1)&&c.addEventListener&&c.addEventListener(_e,L)),ce.add&&(ce.add.call(c,se),se.handler.guid||(se.handler.guid=w.guid)),M?te.splice(te.delegateCount++,0,se):te.push(se),h.event.global[_e]=!0)},remove:function(c,p,w,x,M){var D,L,W,H,X,se,ce,te,_e,Ye,ut,Qe=K.hasData(c)&&K.get(c);if(!(!Qe||!(H=Qe.events))){for(p=(p||"").match(Pe)||[""],X=p.length;X--;){if(W=Yl.exec(p[X])||[],_e=ut=W[1],Ye=(W[2]||"").split(".").sort(),!_e){for(_e in H)h.event.remove(c,_e+p[X],w,x,!0);continue}for(ce=h.event.special[_e]||{},_e=(x?ce.delegateType:ce.bindType)||_e,te=H[_e]||[],W=W[2]&&new RegExp("(^|\\.)"+Ye.join("\\.(?:.*\\.|)")+"(\\.|$)"),L=D=te.length;D--;)se=te[D],(M||ut===se.origType)&&(!w||w.guid===se.guid)&&(!W||W.test(se.namespace))&&(!x||x===se.selector||x==="**"&&se.selector)&&(te.splice(D,1),se.selector&&te.delegateCount--,ce.remove&&ce.remove.call(c,se));L&&!te.length&&((!ce.teardown||ce.teardown.call(c,Ye,Qe.handle)===!1)&&h.removeEvent(c,_e,Qe.handle),delete H[_e])}h.isEmptyObject(H)&&K.remove(c,"handle events")}},dispatch:function(c){var p,w,x,M,D,L,W=new Array(arguments.length),H=h.event.fix(c),X=(K.get(this,"events")||Object.create(null))[H.type]||[],se=h.event.special[H.type]||{};for(W[0]=H,p=1;p<arguments.length;p++)W[p]=arguments[p];if(H.delegateTarget=this,!(se.preDispatch&&se.preDispatch.call(this,H)===!1)){for(L=h.event.handlers.call(this,H,X),p=0;(M=L[p++])&&!H.isPropagationStopped();)for(H.currentTarget=M.elem,w=0;(D=M.handlers[w++])&&!H.isImmediatePropagationStopped();)(!H.rnamespace||D.namespace===!1||H.rnamespace.test(D.namespace))&&(H.handleObj=D,H.data=D.data,x=((h.event.special[D.origType]||{}).handle||D.handler).apply(M.elem,W),x!==void 0&&(H.result=x)===!1&&(H.preventDefault(),H.stopPropagation()));return se.postDispatch&&se.postDispatch.call(this,H),H.result}},handlers:function(c,p){var w,x,M,D,L,W=[],H=p.delegateCount,X=c.target;if(H&&X.nodeType&&!(c.type==="click"&&c.button>=1)){for(;X!==this;X=X.parentNode||this)if(X.nodeType===1&&!(c.type==="click"&&X.disabled===!0)){for(D=[],L={},w=0;w<H;w++)x=p[w],M=x.selector+" ",L[M]===void 0&&(L[M]=x.needsContext?h(M,this).index(X)>-1:h.find(M,this,null,[X]).length),L[M]&&D.push(x);D.length&&W.push({elem:X,handlers:D})}}return X=this,H<p.length&&W.push({elem:X,handlers:p.slice(H)}),W},addProp:function(c,p){Object.defineProperty(h.Event.prototype,c,{enumerable:!0,configurable:!0,get:b(p)?function(){if(this.originalEvent)return p(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[c]},set:function(w){Object.defineProperty(this,c,{enumerable:!0,configurable:!0,writable:!0,value:w})}})},fix:function(c){return c[h.expando]?c:new h.Event(c)},special:{load:{noBubble:!0},click:{setup:function(c){var p=this||c;return mi.test(p.type)&&p.click&&O(p,"input")&&We(p,"click",!0),!1},trigger:function(c){var p=this||c;return mi.test(p.type)&&p.click&&O(p,"input")&&We(p,"click"),!0},_default:function(c){var p=c.target;return mi.test(p.type)&&p.click&&O(p,"input")&&K.get(p,"click")||O(p,"a")}},beforeunload:{postDispatch:function(c){c.result!==void 0&&c.originalEvent&&(c.originalEvent.returnValue=c.result)}}}};function We(c,p,w){if(!w){K.get(c,p)===void 0&&h.event.add(c,p,$);return}K.set(c,p,!1),h.event.add(c,p,{namespace:!1,handler:function(x){var M,D=K.get(this,p);if(x.isTrigger&1&&this[p]){if(D)(h.event.special[p]||{}).delegateType&&x.stopPropagation();else if(D=s.call(arguments),K.set(this,p,D),this[p](),M=K.get(this,p),K.set(this,p,!1),D!==M)return x.stopImmediatePropagation(),x.preventDefault(),M}else D&&(K.set(this,p,h.event.trigger(D[0],D.slice(1),this)),x.stopPropagation(),x.isImmediatePropagationStopped=$)}})}h.removeEvent=function(c,p,w){c.removeEventListener&&c.removeEventListener(p,w)},h.Event=function(c,p){if(!(this instanceof h.Event))return new h.Event(c,p);c&&c.type?(this.originalEvent=c,this.type=c.type,this.isDefaultPrevented=c.defaultPrevented||c.defaultPrevented===void 0&&c.returnValue===!1?$:pe,this.target=c.target&&c.target.nodeType===3?c.target.parentNode:c.target,this.currentTarget=c.currentTarget,this.relatedTarget=c.relatedTarget):this.type=c,p&&h.extend(this,p),this.timeStamp=c&&c.timeStamp||Date.now(),this[h.expando]=!0},h.Event.prototype={constructor:h.Event,isDefaultPrevented:pe,isPropagationStopped:pe,isImmediatePropagationStopped:pe,isSimulated:!1,preventDefault:function(){var c=this.originalEvent;this.isDefaultPrevented=$,c&&!this.isSimulated&&c.preventDefault()},stopPropagation:function(){var c=this.originalEvent;this.isPropagationStopped=$,c&&!this.isSimulated&&c.stopPropagation()},stopImmediatePropagation:function(){var c=this.originalEvent;this.isImmediatePropagationStopped=$,c&&!this.isSimulated&&c.stopImmediatePropagation(),this.stopPropagation()}},h.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},h.event.addProp),h.each({focus:"focusin",blur:"focusout"},function(c,p){function w(x){if(S.documentMode){var M=K.get(this,"handle"),D=h.event.fix(x);D.type=x.type==="focusin"?"focus":"blur",D.isSimulated=!0,M(x),D.target===D.currentTarget&&M(D)}else h.event.simulate(p,x.target,h.event.fix(x))}h.event.special[c]={setup:function(){var x;if(We(this,c,!0),S.documentMode)x=K.get(this,p),x||this.addEventListener(p,w),K.set(this,p,(x||0)+1);else return!1},trigger:function(){return We(this,c),!0},teardown:function(){var x;if(S.documentMode)x=K.get(this,p)-1,x?K.set(this,p,x):(this.removeEventListener(p,w),K.remove(this,p));else return!1},_default:function(x){return K.get(x.target,c)},delegateType:p},h.event.special[p]={setup:function(){var x=this.ownerDocument||this.document||this,M=S.documentMode?this:x,D=K.get(M,p);D||(S.documentMode?this.addEventListener(p,w):x.addEventListener(c,w,!0)),K.set(M,p,(D||0)+1)},teardown:function(){var x=this.ownerDocument||this.document||this,M=S.documentMode?this:x,D=K.get(M,p)-1;D?K.set(M,p,D):(S.documentMode?this.removeEventListener(p,w):x.removeEventListener(c,w,!0),K.remove(M,p))}}}),h.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(c,p){h.event.special[c]={delegateType:p,bindType:p,handle:function(w){var x,M=this,D=w.relatedTarget,L=w.handleObj;return(!D||D!==M&&!h.contains(M,D))&&(w.type=L.origType,x=L.handler.apply(this,arguments),w.type=p),x}}}),h.fn.extend({on:function(c,p,w,x){return Ne(this,c,p,w,x)},one:function(c,p,w,x){return Ne(this,c,p,w,x,1)},off:function(c,p,w){var x,M;if(c&&c.preventDefault&&c.handleObj)return x=c.handleObj,h(c.delegateTarget).off(x.namespace?x.origType+"."+x.namespace:x.origType,x.selector,x.handler),this;if(typeof c=="object"){for(M in c)this.off(M,p,c[M]);return this}return(p===!1||typeof p=="function")&&(w=p,p=void 0),w===!1&&(w=pe),this.each(function(){h.event.remove(this,c,w,p)})}});var wt=/<script|<style|<link/i,vt=/checked\s*(?:[^=]|=\s*.checked.)/i,ct=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function et(c,p){return O(c,"table")&&O(p.nodeType!==11?p:p.firstChild,"tr")&&h(c).children("tbody")[0]||c}function ln(c){return c.type=(c.getAttribute("type")!==null)+"/"+c.type,c}function Ot(c){return(c.type||"").slice(0,5)==="true/"?c.type=c.type.slice(5):c.removeAttribute("type"),c}function jt(c,p){var w,x,M,D,L,W,H;if(p.nodeType===1){if(K.hasData(c)&&(D=K.get(c),H=D.events,H)){K.remove(p,"handle events");for(M in H)for(w=0,x=H[M].length;w<x;w++)h.event.add(p,M,H[M][w])}Ee.hasData(c)&&(L=Ee.access(c),W=h.extend({},L),Ee.set(p,W))}}function ar(c,p){var w=p.nodeName.toLowerCase();w==="input"&&mi.test(c.type)?p.checked=c.checked:(w==="input"||w==="textarea")&&(p.defaultValue=c.defaultValue)}function Bn(c,p,w,x){p=o(p);var M,D,L,W,H,X,se=0,ce=c.length,te=ce-1,_e=p[0],Ye=b(_e);if(Ye||ce>1&&typeof _e=="string"&&!y.checkClone&&vt.test(_e))return c.each(function(ut){var Qe=c.eq(ut);Ye&&(p[0]=_e.call(this,ut,Qe.html())),Bn(Qe,p,w,x)});if(ce&&(M=$l(p,c[0].ownerDocument,!1,c,x),D=M.firstChild,M.childNodes.length===1&&(M=D),D||x)){for(L=h.map(an(M,"script"),ln),W=L.length;se<ce;se++)H=M,se!==te&&(H=h.clone(H,!0,!0),W&&h.merge(L,an(H,"script"))),w.call(c[se],H,se);if(W)for(X=L[L.length-1].ownerDocument,h.map(L,Ot),se=0;se<W;se++)H=L[se],Wl.test(H.type||"")&&!K.access(H,"globalEval")&&h.contains(X,H)&&(H.src&&(H.type||"").toLowerCase()!=="module"?h._evalUrl&&!H.noModule&&h._evalUrl(H.src,{nonce:H.nonce||H.getAttribute("nonce")},X):v(H.textContent.replace(ct,""),H,X))}return c}function Xo(c,p,w){for(var x,M=p?h.filter(p,c):c,D=0;(x=M[D])!=null;D++)!w&&x.nodeType===1&&h.cleanData(an(x)),x.parentNode&&(w&&qt(x)&&Go(an(x,"script")),x.parentNode.removeChild(x));return c}h.extend({htmlPrefilter:function(c){return c},clone:function(c,p,w){var x,M,D,L,W=c.cloneNode(!0),H=qt(c);if(!y.noCloneChecked&&(c.nodeType===1||c.nodeType===11)&&!h.isXMLDoc(c))for(L=an(W),D=an(c),x=0,M=D.length;x<M;x++)ar(D[x],L[x]);if(p)if(w)for(D=D||an(c),L=L||an(W),x=0,M=D.length;x<M;x++)jt(D[x],L[x]);else jt(c,W);return L=an(W,"script"),L.length>0&&Go(L,!H&&an(c,"script")),W},cleanData:function(c){for(var p,w,x,M=h.event.special,D=0;(w=c[D])!==void 0;D++)if(Y(w)){if(p=w[K.expando]){if(p.events)for(x in p.events)M[x]?h.event.remove(w,x):h.removeEvent(w,x,p.handle);w[K.expando]=void 0}w[Ee.expando]&&(w[Ee.expando]=void 0)}}}),h.fn.extend({detach:function(c){return Xo(this,c,!0)},remove:function(c){return Xo(this,c)},text:function(c){return Ae(this,function(p){return p===void 0?h.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=p)})},null,c,arguments.length)},append:function(){return Bn(this,arguments,function(c){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var p=et(this,c);p.appendChild(c)}})},prepend:function(){return Bn(this,arguments,function(c){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var p=et(this,c);p.insertBefore(c,p.firstChild)}})},before:function(){return Bn(this,arguments,function(c){this.parentNode&&this.parentNode.insertBefore(c,this)})},after:function(){return Bn(this,arguments,function(c){this.parentNode&&this.parentNode.insertBefore(c,this.nextSibling)})},empty:function(){for(var c,p=0;(c=this[p])!=null;p++)c.nodeType===1&&(h.cleanData(an(c,!1)),c.textContent="");return this},clone:function(c,p){return c=c??!1,p=p??c,this.map(function(){return h.clone(this,c,p)})},html:function(c){return Ae(this,function(p){var w=this[0]||{},x=0,M=this.length;if(p===void 0&&w.nodeType===1)return w.innerHTML;if(typeof p=="string"&&!wt.test(p)&&!Mn[(Ko.exec(p)||["",""])[1].toLowerCase()]){p=h.htmlPrefilter(p);try{for(;x<M;x++)w=this[x]||{},w.nodeType===1&&(h.cleanData(an(w,!1)),w.innerHTML=p);w=0}catch{}}w&&this.empty().append(p)},null,c,arguments.length)},replaceWith:function(){var c=[];return Bn(this,arguments,function(p){var w=this.parentNode;h.inArray(this,c)<0&&(h.cleanData(an(this)),w&&w.replaceChild(p,this))},c)}}),h.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(c,p){h.fn[c]=function(w){for(var x,M=[],D=h(w),L=D.length-1,W=0;W<=L;W++)x=W===L?this:this.clone(!0),h(D[W])[p](x),a.apply(M,x.get());return this.pushStack(M)}});var Un=new RegExp("^("+Ft+")(?!px)[a-z%]+$","i"),Vd=/^--/,Vl=function(c){var p=c.ownerDocument.defaultView;return(!p||!p.opener)&&(p=e),p.getComputedStyle(c)},c_=function(c,p,w){var x,M,D={};for(M in p)D[M]=c.style[M],c.style[M]=p[M];x=w.call(c);for(M in p)c.style[M]=D[M];return x},dE=new RegExp(Vt.join("|"),"i");(function(){function c(){if(X){H.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",X.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",hn.appendChild(H).appendChild(X);var se=e.getComputedStyle(X);w=se.top!=="1%",W=p(se.marginLeft)===12,X.style.right="60%",D=p(se.right)===36,x=p(se.width)===36,X.style.position="absolute",M=p(X.offsetWidth/3)===12,hn.removeChild(H),X=null}}function p(se){return Math.round(parseFloat(se))}var w,x,M,D,L,W,H=S.createElement("div"),X=S.createElement("div");X.style&&(X.style.backgroundClip="content-box",X.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle=X.style.backgroundClip==="content-box",h.extend(y,{boxSizingReliable:function(){return c(),x},pixelBoxStyles:function(){return c(),D},pixelPosition:function(){return c(),w},reliableMarginLeft:function(){return c(),W},scrollboxSize:function(){return c(),M},reliableTrDimensions:function(){var se,ce,te,_e;return L==null&&(se=S.createElement("table"),ce=S.createElement("tr"),te=S.createElement("div"),se.style.cssText="position:absolute;left:-11111px;border-collapse:separate",ce.style.cssText="box-sizing:content-box;border:1px solid",ce.style.height="1px",te.style.height="9px",te.style.display="block",hn.appendChild(se).appendChild(ce).appendChild(te),_e=e.getComputedStyle(ce),L=parseInt(_e.height,10)+parseInt(_e.borderTopWidth,10)+parseInt(_e.borderBottomWidth,10)===ce.offsetHeight,hn.removeChild(se)),L}}))})();function Jo(c,p,w){var x,M,D,L,W=Vd.test(p),H=c.style;return w=w||Vl(c),w&&(L=w.getPropertyValue(p)||w[p],W&&L&&(L=L.replace(ee,"$1")||void 0),L===""&&!qt(c)&&(L=h.style(c,p)),!y.pixelBoxStyles()&&Un.test(L)&&dE.test(p)&&(x=H.width,M=H.minWidth,D=H.maxWidth,H.minWidth=H.maxWidth=H.width=L,L=w.width,H.width=x,H.minWidth=M,H.maxWidth=D)),L!==void 0?L+"":L}function u_(c,p){return{get:function(){if(c()){delete this.get;return}return(this.get=p).apply(this,arguments)}}}var d_=["Webkit","Moz","ms"],f_=S.createElement("div").style,h_={};function fE(c){for(var p=c[0].toUpperCase()+c.slice(1),w=d_.length;w--;)if(c=d_[w]+p,c in f_)return c}function qd(c){var p=h.cssProps[c]||h_[c];return p||(c in f_?c:h_[c]=fE(c)||c)}var hE=/^(none|table(?!-c[ea]).+)/,gE={position:"absolute",visibility:"hidden",display:"block"},g_={letterSpacing:"0",fontWeight:"400"};function p_(c,p,w){var x=wn.exec(p);return x?Math.max(0,x[2]-(w||0))+(x[3]||"px"):p}function Kd(c,p,w,x,M,D){var L=p==="width"?1:0,W=0,H=0,X=0;if(w===(x?"border":"content"))return 0;for(;L<4;L+=2)w==="margin"&&(X+=h.css(c,w+Vt[L],!0,M)),x?(w==="content"&&(H-=h.css(c,"padding"+Vt[L],!0,M)),w!=="margin"&&(H-=h.css(c,"border"+Vt[L]+"Width",!0,M))):(H+=h.css(c,"padding"+Vt[L],!0,M),w!=="padding"?H+=h.css(c,"border"+Vt[L]+"Width",!0,M):W+=h.css(c,"border"+Vt[L]+"Width",!0,M));return!x&&D>=0&&(H+=Math.max(0,Math.ceil(c["offset"+p[0].toUpperCase()+p.slice(1)]-D-H-W-.5))||0),H+X}function m_(c,p,w){var x=Vl(c),M=!y.boxSizingReliable()||w,D=M&&h.css(c,"boxSizing",!1,x)==="border-box",L=D,W=Jo(c,p,x),H="offset"+p[0].toUpperCase()+p.slice(1);if(Un.test(W)){if(!w)return W;W="auto"}return(!y.boxSizingReliable()&&D||!y.reliableTrDimensions()&&O(c,"tr")||W==="auto"||!parseFloat(W)&&h.css(c,"display",!1,x)==="inline")&&c.getClientRects().length&&(D=h.css(c,"boxSizing",!1,x)==="border-box",L=H in c,L&&(W=c[H])),W=parseFloat(W)||0,W+Kd(c,p,w||(D?"border":"content"),L,x,W)+"px"}h.extend({cssHooks:{opacity:{get:function(c,p){if(p){var w=Jo(c,"opacity");return w===""?"1":w}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(c,p,w,x){if(!(!c||c.nodeType===3||c.nodeType===8||!c.style)){var M,D,L,W=R(p),H=Vd.test(p),X=c.style;if(H||(p=qd(W)),L=h.cssHooks[p]||h.cssHooks[W],w!==void 0){if(D=typeof w,D==="string"&&(M=wn.exec(w))&&M[1]&&(w=qo(c,p,M),D="number"),w==null||w!==w)return;D==="number"&&!H&&(w+=M&&M[3]||(h.cssNumber[W]?"":"px")),!y.clearCloneStyle&&w===""&&p.indexOf("background")===0&&(X[p]="inherit"),(!L||!("set"in L)||(w=L.set(c,w,x))!==void 0)&&(H?X.setProperty(p,w):X[p]=w)}else return L&&"get"in L&&(M=L.get(c,!1,x))!==void 0?M:X[p]}},css:function(c,p,w,x){var M,D,L,W=R(p),H=Vd.test(p);return H||(p=qd(W)),L=h.cssHooks[p]||h.cssHooks[W],L&&"get"in L&&(M=L.get(c,!0,w)),M===void 0&&(M=Jo(c,p,x)),M==="normal"&&p in g_&&(M=g_[p]),w===""||w?(D=parseFloat(M),w===!0||isFinite(D)?D||0:M):M}}),h.each(["height","width"],function(c,p){h.cssHooks[p]={get:function(w,x,M){if(x)return hE.test(h.css(w,"display"))&&(!w.getClientRects().length||!w.getBoundingClientRect().width)?c_(w,gE,function(){return m_(w,p,M)}):m_(w,p,M)},set:function(w,x,M){var D,L=Vl(w),W=!y.scrollboxSize()&&L.position==="absolute",H=W||M,X=H&&h.css(w,"boxSizing",!1,L)==="border-box",se=M?Kd(w,p,M,X,L):0;return X&&W&&(se-=Math.ceil(w["offset"+p[0].toUpperCase()+p.slice(1)]-parseFloat(L[p])-Kd(w,p,"border",!1,L)-.5)),se&&(D=wn.exec(x))&&(D[3]||"px")!=="px"&&(w.style[p]=x,x=h.css(w,p)),p_(w,x,se)}}}),h.cssHooks.marginLeft=u_(y.reliableMarginLeft,function(c,p){if(p)return(parseFloat(Jo(c,"marginLeft"))||c.getBoundingClientRect().left-c_(c,{marginLeft:0},function(){return c.getBoundingClientRect().left}))+"px"}),h.each({margin:"",padding:"",border:"Width"},function(c,p){h.cssHooks[c+p]={expand:function(w){for(var x=0,M={},D=typeof w=="string"?w.split(" "):[w];x<4;x++)M[c+Vt[x]+p]=D[x]||D[x-2]||D[0];return M}},c!=="margin"&&(h.cssHooks[c+p].set=p_)}),h.fn.extend({css:function(c,p){return Ae(this,function(w,x,M){var D,L,W={},H=0;if(Array.isArray(x)){for(D=Vl(w),L=x.length;H<L;H++)W[x[H]]=h.css(w,x[H],!1,D);return W}return M!==void 0?h.style(w,x,M):h.css(w,x)},c,p,arguments.length>1)}});function Dn(c,p,w,x,M){return new Dn.prototype.init(c,p,w,x,M)}h.Tween=Dn,Dn.prototype={constructor:Dn,init:function(c,p,w,x,M,D){this.elem=c,this.prop=w,this.easing=M||h.easing._default,this.options=p,this.start=this.now=this.cur(),this.end=x,this.unit=D||(h.cssNumber[w]?"":"px")},cur:function(){var c=Dn.propHooks[this.prop];return c&&c.get?c.get(this):Dn.propHooks._default.get(this)},run:function(c){var p,w=Dn.propHooks[this.prop];return this.options.duration?this.pos=p=h.easing[this.easing](c,this.options.duration*c,0,1,this.options.duration):this.pos=p=c,this.now=(this.end-this.start)*p+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),w&&w.set?w.set(this):Dn.propHooks._default.set(this),this}},Dn.prototype.init.prototype=Dn.prototype,Dn.propHooks={_default:{get:function(c){var p;return c.elem.nodeType!==1||c.elem[c.prop]!=null&&c.elem.style[c.prop]==null?c.elem[c.prop]:(p=h.css(c.elem,c.prop,""),!p||p==="auto"?0:p)},set:function(c){h.fx.step[c.prop]?h.fx.step[c.prop](c):c.elem.nodeType===1&&(h.cssHooks[c.prop]||c.elem.style[qd(c.prop)]!=null)?h.style(c.elem,c.prop,c.now+c.unit):c.elem[c.prop]=c.now}}},Dn.propHooks.scrollTop=Dn.propHooks.scrollLeft={set:function(c){c.elem.nodeType&&c.elem.parentNode&&(c.elem[c.prop]=c.now)}},h.easing={linear:function(c){return c},swing:function(c){return .5-Math.cos(c*Math.PI)/2},_default:"swing"},h.fx=Dn.prototype.init,h.fx.step={};var Bs,ql,pE=/^(?:toggle|show|hide)$/,mE=/queueHooks$/;function Gd(){ql&&(S.hidden===!1&&e.requestAnimationFrame?e.requestAnimationFrame(Gd):e.setTimeout(Gd,h.fx.interval),h.fx.tick())}function y_(){return e.setTimeout(function(){Bs=void 0}),Bs=Date.now()}function Kl(c,p){var w,x=0,M={height:c};for(p=p?1:0;x<4;x+=2-p)w=Vt[x],M["margin"+w]=M["padding"+w]=c;return p&&(M.opacity=M.width=c),M}function __(c,p,w){for(var x,M=(lr.tweeners[p]||[]).concat(lr.tweeners["*"]),D=0,L=M.length;D<L;D++)if(x=M[D].call(w,p,c))return x}function yE(c,p,w){var x,M,D,L,W,H,X,se,ce="width"in p||"height"in p,te=this,_e={},Ye=c.style,ut=c.nodeType&&gi(c),Qe=K.get(c,"fxshow");w.queue||(L=h._queueHooks(c,"fx"),L.unqueued==null&&(L.unqueued=0,W=L.empty.fire,L.empty.fire=function(){L.unqueued||W()}),L.unqueued++,te.always(function(){te.always(function(){L.unqueued--,h.queue(c,"fx").length||L.empty.fire()})}));for(x in p)if(M=p[x],pE.test(M)){if(delete p[x],D=D||M==="toggle",M===(ut?"hide":"show"))if(M==="show"&&Qe&&Qe[x]!==void 0)ut=!0;else continue;_e[x]=Qe&&Qe[x]||h.style(c,x)}if(H=!h.isEmptyObject(p),!(!H&&h.isEmptyObject(_e))){ce&&c.nodeType===1&&(w.overflow=[Ye.overflow,Ye.overflowX,Ye.overflowY],X=Qe&&Qe.display,X==null&&(X=K.get(c,"display")),se=h.css(c,"display"),se==="none"&&(X?se=X:(pi([c],!0),X=c.style.display||X,se=h.css(c,"display"),pi([c]))),(se==="inline"||se==="inline-block"&&X!=null)&&h.css(c,"float")==="none"&&(H||(te.done(function(){Ye.display=X}),X==null&&(se=Ye.display,X=se==="none"?"":se)),Ye.display="inline-block")),w.overflow&&(Ye.overflow="hidden",te.always(function(){Ye.overflow=w.overflow[0],Ye.overflowX=w.overflow[1],Ye.overflowY=w.overflow[2]})),H=!1;for(x in _e)H||(Qe?"hidden"in Qe&&(ut=Qe.hidden):Qe=K.access(c,"fxshow",{display:X}),D&&(Qe.hidden=!ut),ut&&pi([c],!0),te.done(function(){ut||pi([c]),K.remove(c,"fxshow");for(x in _e)h.style(c,x,_e[x])})),H=__(ut?Qe[x]:0,x,te),x in Qe||(Qe[x]=H.start,ut&&(H.end=H.start,H.start=0))}}function _E(c,p){var w,x,M,D,L;for(w in c)if(x=R(w),M=p[x],D=c[w],Array.isArray(D)&&(M=D[1],D=c[w]=D[0]),w!==x&&(c[x]=D,delete c[w]),L=h.cssHooks[x],L&&"expand"in L){D=L.expand(D),delete c[x];for(w in D)w in c||(c[w]=D[w],p[w]=M)}else p[x]=M}function lr(c,p,w){var x,M,D=0,L=lr.prefilters.length,W=h.Deferred().always(function(){delete H.elem}),H=function(){if(M)return!1;for(var ce=Bs||y_(),te=Math.max(0,X.startTime+X.duration-ce),_e=te/X.duration||0,Ye=1-_e,ut=0,Qe=X.tweens.length;ut<Qe;ut++)X.tweens[ut].run(Ye);return W.notifyWith(c,[X,Ye,te]),Ye<1&&Qe?te:(Qe||W.notifyWith(c,[X,1,0]),W.resolveWith(c,[X]),!1)},X=W.promise({elem:c,props:h.extend({},p),opts:h.extend(!0,{specialEasing:{},easing:h.easing._default},w),originalProperties:p,originalOptions:w,startTime:Bs||y_(),duration:w.duration,tweens:[],createTween:function(ce,te){var _e=h.Tween(c,X.opts,ce,te,X.opts.specialEasing[ce]||X.opts.easing);return X.tweens.push(_e),_e},stop:function(ce){var te=0,_e=ce?X.tweens.length:0;if(M)return this;for(M=!0;te<_e;te++)X.tweens[te].run(1);return ce?(W.notifyWith(c,[X,1,0]),W.resolveWith(c,[X,ce])):W.rejectWith(c,[X,ce]),this}}),se=X.props;for(_E(se,X.opts.specialEasing);D<L;D++)if(x=lr.prefilters[D].call(X,c,se,X.opts),x)return b(x.stop)&&(h._queueHooks(X.elem,X.opts.queue).stop=x.stop.bind(x)),x;return h.map(se,__,X),b(X.opts.start)&&X.opts.start.call(c,X),X.progress(X.opts.progress).done(X.opts.done,X.opts.complete).fail(X.opts.fail).always(X.opts.always),h.fx.timer(h.extend(H,{elem:c,anim:X,queue:X.opts.queue})),X}h.Animation=h.extend(lr,{tweeners:{"*":[function(c,p){var w=this.createTween(c,p);return qo(w.elem,c,wn.exec(p),w),w}]},tweener:function(c,p){b(c)?(p=c,c=["*"]):c=c.match(Pe);for(var w,x=0,M=c.length;x<M;x++)w=c[x],lr.tweeners[w]=lr.tweeners[w]||[],lr.tweeners[w].unshift(p)},prefilters:[yE],prefilter:function(c,p){p?lr.prefilters.unshift(c):lr.prefilters.push(c)}}),h.speed=function(c,p,w){var x=c&&typeof c=="object"?h.extend({},c):{complete:w||!w&&p||b(c)&&c,duration:c,easing:w&&p||p&&!b(p)&&p};return h.fx.off?x.duration=0:typeof x.duration!="number"&&(x.duration in h.fx.speeds?x.duration=h.fx.speeds[x.duration]:x.duration=h.fx.speeds._default),(x.queue==null||x.queue===!0)&&(x.queue="fx"),x.old=x.complete,x.complete=function(){b(x.old)&&x.old.call(this),x.queue&&h.dequeue(this,x.queue)},x},h.fn.extend({fadeTo:function(c,p,w,x){return this.filter(gi).css("opacity",0).show().end().animate({opacity:p},c,w,x)},animate:function(c,p,w,x){var M=h.isEmptyObject(c),D=h.speed(p,w,x),L=function(){var W=lr(this,h.extend({},c),D);(M||K.get(this,"finish"))&&W.stop(!0)};return L.finish=L,M||D.queue===!1?this.each(L):this.queue(D.queue,L)},stop:function(c,p,w){var x=function(M){var D=M.stop;delete M.stop,D(w)};return typeof c!="string"&&(w=p,p=c,c=void 0),p&&this.queue(c||"fx",[]),this.each(function(){var M=!0,D=c!=null&&c+"queueHooks",L=h.timers,W=K.get(this);if(D)W[D]&&W[D].stop&&x(W[D]);else for(D in W)W[D]&&W[D].stop&&mE.test(D)&&x(W[D]);for(D=L.length;D--;)L[D].elem===this&&(c==null||L[D].queue===c)&&(L[D].anim.stop(w),M=!1,L.splice(D,1));(M||!w)&&h.dequeue(this,c)})},finish:function(c){return c!==!1&&(c=c||"fx"),this.each(function(){var p,w=K.get(this),x=w[c+"queue"],M=w[c+"queueHooks"],D=h.timers,L=x?x.length:0;for(w.finish=!0,h.queue(this,c,[]),M&&M.stop&&M.stop.call(this,!0),p=D.length;p--;)D[p].elem===this&&D[p].queue===c&&(D[p].anim.stop(!0),D.splice(p,1));for(p=0;p<L;p++)x[p]&&x[p].finish&&x[p].finish.call(this);delete w.finish})}}),h.each(["toggle","show","hide"],function(c,p){var w=h.fn[p];h.fn[p]=function(x,M,D){return x==null||typeof x=="boolean"?w.apply(this,arguments):this.animate(Kl(p,!0),x,M,D)}}),h.each({slideDown:Kl("show"),slideUp:Kl("hide"),slideToggle:Kl("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(c,p){h.fn[c]=function(w,x,M){return this.animate(p,w,x,M)}}),h.timers=[],h.fx.tick=function(){var c,p=0,w=h.timers;for(Bs=Date.now();p<w.length;p++)c=w[p],!c()&&w[p]===c&&w.splice(p--,1);w.length||h.fx.stop(),Bs=void 0},h.fx.timer=function(c){h.timers.push(c),h.fx.start()},h.fx.interval=13,h.fx.start=function(){ql||(ql=!0,Gd())},h.fx.stop=function(){ql=null},h.fx.speeds={slow:600,fast:200,_default:400},h.fn.delay=function(c,p){return c=h.fx&&h.fx.speeds[c]||c,p=p||"fx",this.queue(p,function(w,x){var M=e.setTimeout(w,c);x.stop=function(){e.clearTimeout(M)}})},function(){var c=S.createElement("input"),p=S.createElement("select"),w=p.appendChild(S.createElement("option"));c.type="checkbox",y.checkOn=c.value!=="",y.optSelected=w.selected,c=S.createElement("input"),c.value="t",c.type="radio",y.radioValue=c.value==="t"}();var b_,Zo=h.expr.attrHandle;h.fn.extend({attr:function(c,p){return Ae(this,h.attr,c,p,arguments.length>1)},removeAttr:function(c){return this.each(function(){h.removeAttr(this,c)})}}),h.extend({attr:function(c,p,w){var x,M,D=c.nodeType;if(!(D===3||D===8||D===2)){if(typeof c.getAttribute>"u")return h.prop(c,p,w);if((D!==1||!h.isXMLDoc(c))&&(M=h.attrHooks[p.toLowerCase()]||(h.expr.match.bool.test(p)?b_:void 0)),w!==void 0){if(w===null){h.removeAttr(c,p);return}return M&&"set"in M&&(x=M.set(c,w,p))!==void 0?x:(c.setAttribute(p,w+""),w)}return M&&"get"in M&&(x=M.get(c,p))!==null?x:(x=h.find.attr(c,p),x??void 0)}},attrHooks:{type:{set:function(c,p){if(!y.radioValue&&p==="radio"&&O(c,"input")){var w=c.value;return c.setAttribute("type",p),w&&(c.value=w),p}}}},removeAttr:function(c,p){var w,x=0,M=p&&p.match(Pe);if(M&&c.nodeType===1)for(;w=M[x++];)c.removeAttribute(w)}}),b_={set:function(c,p,w){return p===!1?h.removeAttr(c,w):c.setAttribute(w,w),w}},h.each(h.expr.match.bool.source.match(/\w+/g),function(c,p){var w=Zo[p]||h.find.attr;Zo[p]=function(x,M,D){var L,W,H=M.toLowerCase();return D||(W=Zo[H],Zo[H]=L,L=w(x,M,D)!=null?H:null,Zo[H]=W),L}});var bE=/^(?:input|select|textarea|button)$/i,wE=/^(?:a|area)$/i;h.fn.extend({prop:function(c,p){return Ae(this,h.prop,c,p,arguments.length>1)},removeProp:function(c){return this.each(function(){delete this[h.propFix[c]||c]})}}),h.extend({prop:function(c,p,w){var x,M,D=c.nodeType;if(!(D===3||D===8||D===2))return(D!==1||!h.isXMLDoc(c))&&(p=h.propFix[p]||p,M=h.propHooks[p]),w!==void 0?M&&"set"in M&&(x=M.set(c,w,p))!==void 0?x:c[p]=w:M&&"get"in M&&(x=M.get(c,p))!==null?x:c[p]},propHooks:{tabIndex:{get:function(c){var p=h.find.attr(c,"tabindex");return p?parseInt(p,10):bE.test(c.nodeName)||wE.test(c.nodeName)&&c.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),y.optSelected||(h.propHooks.selected={get:function(c){var p=c.parentNode;return p&&p.parentNode&&p.parentNode.selectedIndex,null},set:function(c){var p=c.parentNode;p&&(p.selectedIndex,p.parentNode&&p.parentNode.selectedIndex)}}),h.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){h.propFix[this.toLowerCase()]=this});function Yi(c){var p=c.match(Pe)||[];return p.join(" ")}function Vi(c){return c.getAttribute&&c.getAttribute("class")||""}function Xd(c){return Array.isArray(c)?c:typeof c=="string"?c.match(Pe)||[]:[]}h.fn.extend({addClass:function(c){var p,w,x,M,D,L;return b(c)?this.each(function(W){h(this).addClass(c.call(this,W,Vi(this)))}):(p=Xd(c),p.length?this.each(function(){if(x=Vi(this),w=this.nodeType===1&&" "+Yi(x)+" ",w){for(D=0;D<p.length;D++)M=p[D],w.indexOf(" "+M+" ")<0&&(w+=M+" ");L=Yi(w),x!==L&&this.setAttribute("class",L)}}):this)},removeClass:function(c){var p,w,x,M,D,L;return b(c)?this.each(function(W){h(this).removeClass(c.call(this,W,Vi(this)))}):arguments.length?(p=Xd(c),p.length?this.each(function(){if(x=Vi(this),w=this.nodeType===1&&" "+Yi(x)+" ",w){for(D=0;D<p.length;D++)for(M=p[D];w.indexOf(" "+M+" ")>-1;)w=w.replace(" "+M+" "," ");L=Yi(w),x!==L&&this.setAttribute("class",L)}}):this):this.attr("class","")},toggleClass:function(c,p){var w,x,M,D,L=typeof c,W=L==="string"||Array.isArray(c);return b(c)?this.each(function(H){h(this).toggleClass(c.call(this,H,Vi(this),p),p)}):typeof p=="boolean"&&W?p?this.addClass(c):this.removeClass(c):(w=Xd(c),this.each(function(){if(W)for(D=h(this),M=0;M<w.length;M++)x=w[M],D.hasClass(x)?D.removeClass(x):D.addClass(x);else(c===void 0||L==="boolean")&&(x=Vi(this),x&&K.set(this,"__className__",x),this.setAttribute&&this.setAttribute("class",x||c===!1?"":K.get(this,"__className__")||""))}))},hasClass:function(c){var p,w,x=0;for(p=" "+c+" ";w=this[x++];)if(w.nodeType===1&&(" "+Yi(Vi(w))+" ").indexOf(p)>-1)return!0;return!1}});var vE=/\r/g;h.fn.extend({val:function(c){var p,w,x,M=this[0];return arguments.length?(x=b(c),this.each(function(D){var L;this.nodeType===1&&(x?L=c.call(this,D,h(this).val()):L=c,L==null?L="":typeof L=="number"?L+="":Array.isArray(L)&&(L=h.map(L,function(W){return W==null?"":W+""})),p=h.valHooks[this.type]||h.valHooks[this.nodeName.toLowerCase()],(!p||!("set"in p)||p.set(this,L,"value")===void 0)&&(this.value=L))})):M?(p=h.valHooks[M.type]||h.valHooks[M.nodeName.toLowerCase()],p&&"get"in p&&(w=p.get(M,"value"))!==void 0?w:(w=M.value,typeof w=="string"?w.replace(vE,""):w??"")):void 0}}),h.extend({valHooks:{option:{get:function(c){var p=h.find.attr(c,"value");return p??Yi(h.text(c))}},select:{get:function(c){var p,w,x,M=c.options,D=c.selectedIndex,L=c.type==="select-one",W=L?null:[],H=L?D+1:M.length;for(D<0?x=H:x=L?D:0;x<H;x++)if(w=M[x],(w.selected||x===D)&&!w.disabled&&(!w.parentNode.disabled||!O(w.parentNode,"optgroup"))){if(p=h(w).val(),L)return p;W.push(p)}return W},set:function(c,p){for(var w,x,M=c.options,D=h.makeArray(p),L=M.length;L--;)x=M[L],(x.selected=h.inArray(h.valHooks.option.get(x),D)>-1)&&(w=!0);return w||(c.selectedIndex=-1),D}}}}),h.each(["radio","checkbox"],function(){h.valHooks[this]={set:function(c,p){if(Array.isArray(p))return c.checked=h.inArray(h(c).val(),p)>-1}},y.checkOn||(h.valHooks[this].get=function(c){return c.getAttribute("value")===null?"on":c.value})});var Qo=e.location,w_={guid:Date.now()},Jd=/\?/;h.parseXML=function(c){var p,w;if(!c||typeof c!="string")return null;try{p=new e.DOMParser().parseFromString(c,"text/xml")}catch{}return w=p&&p.getElementsByTagName("parsererror")[0],(!p||w)&&h.error("Invalid XML: "+(w?h.map(w.childNodes,function(x){return x.textContent}).join(`
56
+ `):c)),p};var v_=/^(?:focusinfocus|focusoutblur)$/,x_=function(c){c.stopPropagation()};h.extend(h.event,{trigger:function(c,p,w,x){var M,D,L,W,H,X,se,ce,te=[w||S],_e=d.call(c,"type")?c.type:c,Ye=d.call(c,"namespace")?c.namespace.split("."):[];if(D=ce=L=w=w||S,!(w.nodeType===3||w.nodeType===8)&&!v_.test(_e+h.event.triggered)&&(_e.indexOf(".")>-1&&(Ye=_e.split("."),_e=Ye.shift(),Ye.sort()),H=_e.indexOf(":")<0&&"on"+_e,c=c[h.expando]?c:new h.Event(_e,typeof c=="object"&&c),c.isTrigger=x?2:3,c.namespace=Ye.join("."),c.rnamespace=c.namespace?new RegExp("(^|\\.)"+Ye.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=void 0,c.target||(c.target=w),p=p==null?[c]:h.makeArray(p,[c]),se=h.event.special[_e]||{},!(!x&&se.trigger&&se.trigger.apply(w,p)===!1))){if(!x&&!se.noBubble&&!C(w)){for(W=se.delegateType||_e,v_.test(W+_e)||(D=D.parentNode);D;D=D.parentNode)te.push(D),L=D;L===(w.ownerDocument||S)&&te.push(L.defaultView||L.parentWindow||e)}for(M=0;(D=te[M++])&&!c.isPropagationStopped();)ce=D,c.type=M>1?W:se.bindType||_e,X=(K.get(D,"events")||Object.create(null))[c.type]&&K.get(D,"handle"),X&&X.apply(D,p),X=H&&D[H],X&&X.apply&&Y(D)&&(c.result=X.apply(D,p),c.result===!1&&c.preventDefault());return c.type=_e,!x&&!c.isDefaultPrevented()&&(!se._default||se._default.apply(te.pop(),p)===!1)&&Y(w)&&H&&b(w[_e])&&!C(w)&&(L=w[H],L&&(w[H]=null),h.event.triggered=_e,c.isPropagationStopped()&&ce.addEventListener(_e,x_),w[_e](),c.isPropagationStopped()&&ce.removeEventListener(_e,x_),h.event.triggered=void 0,L&&(w[H]=L)),c.result}},simulate:function(c,p,w){var x=h.extend(new h.Event,w,{type:c,isSimulated:!0});h.event.trigger(x,null,p)}}),h.fn.extend({trigger:function(c,p){return this.each(function(){h.event.trigger(c,p,this)})},triggerHandler:function(c,p){var w=this[0];if(w)return h.event.trigger(c,p,w,!0)}});var xE=/\[\]$/,C_=/\r?\n/g,CE=/^(?:submit|button|image|reset|file)$/i,SE=/^(?:input|select|textarea|keygen)/i;function Zd(c,p,w,x){var M;if(Array.isArray(p))h.each(p,function(D,L){w||xE.test(c)?x(c,L):Zd(c+"["+(typeof L=="object"&&L!=null?D:"")+"]",L,w,x)});else if(!w&&k(p)==="object")for(M in p)Zd(c+"["+M+"]",p[M],w,x);else x(c,p)}h.param=function(c,p){var w,x=[],M=function(D,L){var W=b(L)?L():L;x[x.length]=encodeURIComponent(D)+"="+encodeURIComponent(W??"")};if(c==null)return"";if(Array.isArray(c)||c.jquery&&!h.isPlainObject(c))h.each(c,function(){M(this.name,this.value)});else for(w in c)Zd(w,c[w],p,M);return x.join("&")},h.fn.extend({serialize:function(){return h.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var c=h.prop(this,"elements");return c?h.makeArray(c):this}).filter(function(){var c=this.type;return this.name&&!h(this).is(":disabled")&&SE.test(this.nodeName)&&!CE.test(c)&&(this.checked||!mi.test(c))}).map(function(c,p){var w=h(this).val();return w==null?null:Array.isArray(w)?h.map(w,function(x){return{name:p.name,value:x.replace(C_,`\r
57
57
  `)}}):{name:p.name,value:w.replace(C_,`\r
58
- `)}}).get()}});var TE=/%20/g,EE=/#.*$/,kE=/([?&])_=[^&]*/,NE=/^(.*?):[ \t]*([^\r\n]*)$/mg,ME=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,DE=/^(?:GET|HEAD)$/,AE=/^\/\//,S_={},Qd={},T_="*/".concat("*"),ef=S.createElement("a");ef.href=Qo.href;function E_(c){return function(p,w){typeof p!="string"&&(w=p,p="*");var x,M=0,D=p.toLowerCase().match(Pe)||[];if(b(w))for(;x=D[M++];)x[0]==="+"?(x=x.slice(1)||"*",(c[x]=c[x]||[]).unshift(w)):(c[x]=c[x]||[]).push(w)}}function k_(c,p,w,x){var M={},D=c===Qd;function L(W){var H;return M[W]=!0,h.each(c[W]||[],function(X,se){var ce=se(p,w,x);if(typeof ce=="string"&&!D&&!M[ce])return p.dataTypes.unshift(ce),L(ce),!1;if(D)return!(H=ce)}),H}return L(p.dataTypes[0])||!M["*"]&&L("*")}function tf(c,p){var w,x,M=h.ajaxSettings.flatOptions||{};for(w in p)p[w]!==void 0&&((M[w]?c:x||(x={}))[w]=p[w]);return x&&h.extend(!0,c,x),c}function IE(c,p,w){for(var x,M,D,L,W=c.contents,H=c.dataTypes;H[0]==="*";)H.shift(),x===void 0&&(x=c.mimeType||p.getResponseHeader("Content-Type"));if(x){for(M in W)if(W[M]&&W[M].test(x)){H.unshift(M);break}}if(H[0]in w)D=H[0];else{for(M in w){if(!H[0]||c.converters[M+" "+H[0]]){D=M;break}L||(L=M)}D=D||L}if(D)return D!==H[0]&&H.unshift(D),w[D]}function RE(c,p,w,x){var M,D,L,W,H,X={},se=c.dataTypes.slice();if(se[1])for(L in c.converters)X[L.toLowerCase()]=c.converters[L];for(D=se.shift();D;)if(c.responseFields[D]&&(w[c.responseFields[D]]=p),!H&&x&&c.dataFilter&&(p=c.dataFilter(p,c.dataType)),H=D,D=se.shift(),D){if(D==="*")D=H;else if(H!=="*"&&H!==D){if(L=X[H+" "+D]||X["* "+D],!L){for(M in X)if(W=M.split(" "),W[1]===D&&(L=X[H+" "+W[0]]||X["* "+W[0]],L)){L===!0?L=X[M]:X[M]!==!0&&(D=W[0],se.unshift(W[1]));break}}if(L!==!0)if(L&&c.throws)p=L(p);else try{p=L(p)}catch(ce){return{state:"parsererror",error:L?ce:"No conversion from "+H+" to "+D}}}}return{state:"success",data:p}}h.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qo.href,type:"GET",isLocal:ME.test(Qo.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":T_,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":h.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(c,p){return p?tf(tf(c,h.ajaxSettings),p):tf(h.ajaxSettings,c)},ajaxPrefilter:E_(S_),ajaxTransport:E_(Qd),ajax:function(c,p){typeof c=="object"&&(p=c,c=void 0),p=p||{};var w,x,M,D,L,W,H,X,se,ce,ee=h.ajaxSetup({},p),_e=ee.context||ee,Ye=ee.context&&(_e.nodeType||_e.jquery)?h(_e):h.event,ut=h.Deferred(),Qe=h.Callbacks("once memory"),cn=ee.statusCode||{},Jt={},kr={},Nr="canceled",st={readyState:0,getResponseHeader:function(ht){var zt;if(H){if(!D)for(D={};zt=NE.exec(M);)D[zt[1].toLowerCase()+" "]=(D[zt[1].toLowerCase()+" "]||[]).concat(zt[2]);zt=D[ht.toLowerCase()+" "]}return zt==null?null:zt.join(", ")},getAllResponseHeaders:function(){return H?M:null},setRequestHeader:function(ht,zt){return H==null&&(ht=kr[ht.toLowerCase()]=kr[ht.toLowerCase()]||ht,Jt[ht]=zt),this},overrideMimeType:function(ht){return H==null&&(ee.mimeType=ht),this},statusCode:function(ht){var zt;if(ht)if(H)st.always(ht[st.status]);else for(zt in ht)cn[zt]=[cn[zt],ht[zt]];return this},abort:function(ht){var zt=ht||Nr;return w&&w.abort(zt),qi(0,zt),this}};if(ut.promise(st),ee.url=((c||ee.url||Qo.href)+"").replace(AE,Qo.protocol+"//"),ee.type=p.method||p.type||ee.method||ee.type,ee.dataTypes=(ee.dataType||"*").toLowerCase().match(Pe)||[""],ee.crossDomain==null){W=S.createElement("a");try{W.href=ee.url,W.href=W.href,ee.crossDomain=ef.protocol+"//"+ef.host!=W.protocol+"//"+W.host}catch{ee.crossDomain=!0}}if(ee.data&&ee.processData&&typeof ee.data!="string"&&(ee.data=h.param(ee.data,ee.traditional)),k_(S_,ee,p,st),H)return st;X=h.event&&ee.global,X&&h.active++===0&&h.event.trigger("ajaxStart"),ee.type=ee.type.toUpperCase(),ee.hasContent=!DE.test(ee.type),x=ee.url.replace(EE,""),ee.hasContent?ee.data&&ee.processData&&(ee.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(ee.data=ee.data.replace(TE,"+")):(ce=ee.url.slice(x.length),ee.data&&(ee.processData||typeof ee.data=="string")&&(x+=(Jd.test(x)?"&":"?")+ee.data,delete ee.data),ee.cache===!1&&(x=x.replace(kE,"$1"),ce=(Jd.test(x)?"&":"?")+"_="+w_.guid+++ce),ee.url=x+ce),ee.ifModified&&(h.lastModified[x]&&st.setRequestHeader("If-Modified-Since",h.lastModified[x]),h.etag[x]&&st.setRequestHeader("If-None-Match",h.etag[x])),(ee.data&&ee.hasContent&&ee.contentType!==!1||p.contentType)&&st.setRequestHeader("Content-Type",ee.contentType),st.setRequestHeader("Accept",ee.dataTypes[0]&&ee.accepts[ee.dataTypes[0]]?ee.accepts[ee.dataTypes[0]]+(ee.dataTypes[0]!=="*"?", "+T_+"; q=0.01":""):ee.accepts["*"]);for(se in ee.headers)st.setRequestHeader(se,ee.headers[se]);if(ee.beforeSend&&(ee.beforeSend.call(_e,st,ee)===!1||H))return st.abort();if(Nr="abort",Qe.add(ee.complete),st.done(ee.success),st.fail(ee.error),w=k_(Qd,ee,p,st),!w)qi(-1,"No Transport");else{if(st.readyState=1,X&&Ye.trigger("ajaxSend",[st,ee]),H)return st;ee.async&&ee.timeout>0&&(L=e.setTimeout(function(){st.abort("timeout")},ee.timeout));try{H=!1,w.send(Jt,qi)}catch(ht){if(H)throw ht;qi(-1,ht)}}function qi(ht,zt,ta,rf){var Mr,na,Dr,yi,_i,Xn=zt;H||(H=!0,L&&e.clearTimeout(L),w=void 0,M=rf||"",st.readyState=ht>0?4:0,Mr=ht>=200&&ht<300||ht===304,ta&&(yi=IE(ee,st,ta)),!Mr&&h.inArray("script",ee.dataTypes)>-1&&h.inArray("json",ee.dataTypes)<0&&(ee.converters["text script"]=function(){}),yi=RE(ee,yi,st,Mr),Mr?(ee.ifModified&&(_i=st.getResponseHeader("Last-Modified"),_i&&(h.lastModified[x]=_i),_i=st.getResponseHeader("etag"),_i&&(h.etag[x]=_i)),ht===204||ee.type==="HEAD"?Xn="nocontent":ht===304?Xn="notmodified":(Xn=yi.state,na=yi.data,Dr=yi.error,Mr=!Dr)):(Dr=Xn,(ht||!Xn)&&(Xn="error",ht<0&&(ht=0))),st.status=ht,st.statusText=(zt||Xn)+"",Mr?ut.resolveWith(_e,[na,Xn,st]):ut.rejectWith(_e,[st,Xn,Dr]),st.statusCode(cn),cn=void 0,X&&Ye.trigger(Mr?"ajaxSuccess":"ajaxError",[st,ee,Mr?na:Dr]),Qe.fireWith(_e,[st,Xn]),X&&(Ye.trigger("ajaxComplete",[st,ee]),--h.active||h.event.trigger("ajaxStop")))}return st},getJSON:function(c,p,w){return h.get(c,p,w,"json")},getScript:function(c,p){return h.get(c,void 0,p,"script")}}),h.each(["get","post"],function(c,p){h[p]=function(w,x,M,D){return b(x)&&(D=D||M,M=x,x=void 0),h.ajax(h.extend({url:w,type:p,dataType:D,data:x,success:M},h.isPlainObject(w)&&w))}}),h.ajaxPrefilter(function(c){var p;for(p in c.headers)p.toLowerCase()==="content-type"&&(c.contentType=c.headers[p]||"")}),h._evalUrl=function(c,p,w){return h.ajax({url:c,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(x){h.globalEval(x,p,w)}})},h.fn.extend({wrapAll:function(c){var p;return this[0]&&(b(c)&&(c=c.call(this[0])),p=h(c,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&p.insertBefore(this[0]),p.map(function(){for(var w=this;w.firstElementChild;)w=w.firstElementChild;return w}).append(this)),this},wrapInner:function(c){return b(c)?this.each(function(p){h(this).wrapInner(c.call(this,p))}):this.each(function(){var p=h(this),w=p.contents();w.length?w.wrapAll(c):p.append(c)})},wrap:function(c){var p=b(c);return this.each(function(w){h(this).wrapAll(p?c.call(this,w):c)})},unwrap:function(c){return this.parent(c).not("body").each(function(){h(this).replaceWith(this.childNodes)}),this}}),h.expr.pseudos.hidden=function(c){return!h.expr.pseudos.visible(c)},h.expr.pseudos.visible=function(c){return!!(c.offsetWidth||c.offsetHeight||c.getClientRects().length)},h.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch{}};var LE={0:200,1223:204},ea=h.ajaxSettings.xhr();y.cors=!!ea&&"withCredentials"in ea,y.ajax=ea=!!ea,h.ajaxTransport(function(c){var p,w;if(y.cors||ea&&!c.crossDomain)return{send:function(x,M){var D,L=c.xhr();if(L.open(c.type,c.url,c.async,c.username,c.password),c.xhrFields)for(D in c.xhrFields)L[D]=c.xhrFields[D];c.mimeType&&L.overrideMimeType&&L.overrideMimeType(c.mimeType),!c.crossDomain&&!x["X-Requested-With"]&&(x["X-Requested-With"]="XMLHttpRequest");for(D in x)L.setRequestHeader(D,x[D]);p=function(W){return function(){p&&(p=w=L.onload=L.onerror=L.onabort=L.ontimeout=L.onreadystatechange=null,W==="abort"?L.abort():W==="error"?typeof L.status!="number"?M(0,"error"):M(L.status,L.statusText):M(LE[L.status]||L.status,L.statusText,(L.responseType||"text")!=="text"||typeof L.responseText!="string"?{binary:L.response}:{text:L.responseText},L.getAllResponseHeaders()))}},L.onload=p(),w=L.onerror=L.ontimeout=p("error"),L.onabort!==void 0?L.onabort=w:L.onreadystatechange=function(){L.readyState===4&&e.setTimeout(function(){p&&w()})},p=p("abort");try{L.send(c.hasContent&&c.data||null)}catch(W){if(p)throw W}},abort:function(){p&&p()}}}),h.ajaxPrefilter(function(c){c.crossDomain&&(c.contents.script=!1)}),h.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(c){return h.globalEval(c),c}}}),h.ajaxPrefilter("script",function(c){c.cache===void 0&&(c.cache=!1),c.crossDomain&&(c.type="GET")}),h.ajaxTransport("script",function(c){if(c.crossDomain||c.scriptAttrs){var p,w;return{send:function(x,M){p=h("<script>").attr(c.scriptAttrs||{}).prop({charset:c.scriptCharset,src:c.url}).on("load error",w=function(D){p.remove(),w=null,D&&M(D.type==="error"?404:200,D.type)}),S.head.appendChild(p[0])},abort:function(){w&&w()}}}});var N_=[],nf=/(=)\?(?=&|$)|\?\?/;h.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var c=N_.pop()||h.expando+"_"+w_.guid++;return this[c]=!0,c}}),h.ajaxPrefilter("json jsonp",function(c,p,w){var x,M,D,L=c.jsonp!==!1&&(nf.test(c.url)?"url":typeof c.data=="string"&&(c.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&nf.test(c.data)&&"data");if(L||c.dataTypes[0]==="jsonp")return x=c.jsonpCallback=b(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,L?c[L]=c[L].replace(nf,"$1"+x):c.jsonp!==!1&&(c.url+=(Jd.test(c.url)?"&":"?")+c.jsonp+"="+x),c.converters["script json"]=function(){return D||h.error(x+" was not called"),D[0]},c.dataTypes[0]="json",M=e[x],e[x]=function(){D=arguments},w.always(function(){M===void 0?h(e).removeProp(x):e[x]=M,c[x]&&(c.jsonpCallback=p.jsonpCallback,N_.push(x)),D&&b(M)&&M(D[0]),D=M=void 0}),"script"}),y.createHTMLDocument=function(){var c=S.implementation.createHTMLDocument("").body;return c.innerHTML="<form></form><form></form>",c.childNodes.length===2}(),h.parseHTML=function(c,p,w){if(typeof c!="string")return[];typeof p=="boolean"&&(w=p,p=!1);var x,M,D;return p||(y.createHTMLDocument?(p=S.implementation.createHTMLDocument(""),x=p.createElement("base"),x.href=S.location.href,p.head.appendChild(x)):p=S),M=xe.exec(c),D=!w&&[],M?[p.createElement(M[1])]:(M=$l([c],p,D),D&&D.length&&h(D).remove(),h.merge([],M.childNodes))},h.fn.load=function(c,p,w){var x,M,D,L=this,W=c.indexOf(" ");return W>-1&&(x=Yi(c.slice(W)),c=c.slice(0,W)),b(p)?(w=p,p=void 0):p&&typeof p=="object"&&(M="POST"),L.length>0&&h.ajax({url:c,type:M||"GET",dataType:"html",data:p}).done(function(H){D=arguments,L.html(x?h("<div>").append(h.parseHTML(H)).find(x):H)}).always(w&&function(H,X){L.each(function(){w.apply(this,D||[H.responseText,X,H])})}),this},h.expr.pseudos.animated=function(c){return h.grep(h.timers,function(p){return c===p.elem}).length},h.offset={setOffset:function(c,p,w){var x,M,D,L,W,H,X,se=h.css(c,"position"),ce=h(c),ee={};se==="static"&&(c.style.position="relative"),W=ce.offset(),D=h.css(c,"top"),H=h.css(c,"left"),X=(se==="absolute"||se==="fixed")&&(D+H).indexOf("auto")>-1,X?(x=ce.position(),L=x.top,M=x.left):(L=parseFloat(D)||0,M=parseFloat(H)||0),b(p)&&(p=p.call(c,w,h.extend({},W))),p.top!=null&&(ee.top=p.top-W.top+L),p.left!=null&&(ee.left=p.left-W.left+M),"using"in p?p.using.call(c,ee):ce.css(ee)}},h.fn.extend({offset:function(c){if(arguments.length)return c===void 0?this:this.each(function(M){h.offset.setOffset(this,c,M)});var p,w,x=this[0];if(x)return x.getClientRects().length?(p=x.getBoundingClientRect(),w=x.ownerDocument.defaultView,{top:p.top+w.pageYOffset,left:p.left+w.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var c,p,w,x=this[0],M={top:0,left:0};if(h.css(x,"position")==="fixed")p=x.getBoundingClientRect();else{for(p=this.offset(),w=x.ownerDocument,c=x.offsetParent||w.documentElement;c&&(c===w.body||c===w.documentElement)&&h.css(c,"position")==="static";)c=c.parentNode;c&&c!==x&&c.nodeType===1&&(M=h(c).offset(),M.top+=h.css(c,"borderTopWidth",!0),M.left+=h.css(c,"borderLeftWidth",!0))}return{top:p.top-M.top-h.css(x,"marginTop",!0),left:p.left-M.left-h.css(x,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var c=this.offsetParent;c&&h.css(c,"position")==="static";)c=c.offsetParent;return c||hn})}}),h.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(c,p){var w=p==="pageYOffset";h.fn[c]=function(x){return Ie(this,function(M,D,L){var W;if(C(M)?W=M:M.nodeType===9&&(W=M.defaultView),L===void 0)return W?W[p]:M[D];W?W.scrollTo(w?W.pageXOffset:L,w?L:W.pageYOffset):M[D]=L},c,x,arguments.length)}}),h.each(["top","left"],function(c,p){h.cssHooks[p]=u_(y.pixelPosition,function(w,x){if(x)return x=Jo(w,p),Un.test(x)?h(w).position()[p]+"px":x})}),h.each({Height:"height",Width:"width"},function(c,p){h.each({padding:"inner"+c,content:p,"":"outer"+c},function(w,x){h.fn[x]=function(M,D){var L=arguments.length&&(w||typeof M!="boolean"),W=w||(M===!0||D===!0?"margin":"border");return Ie(this,function(H,X,se){var ce;return C(H)?x.indexOf("outer")===0?H["inner"+c]:H.document.documentElement["client"+c]:H.nodeType===9?(ce=H.documentElement,Math.max(H.body["scroll"+c],ce["scroll"+c],H.body["offset"+c],ce["offset"+c],ce["client"+c])):se===void 0?h.css(H,X,W):h.style(H,X,se,W)},p,L?M:void 0,L)}})}),h.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(c,p){h.fn[p]=function(w){return this.on(p,w)}}),h.fn.extend({bind:function(c,p,w){return this.on(c,null,p,w)},unbind:function(c,p){return this.off(c,null,p)},delegate:function(c,p,w,x){return this.on(p,c,w,x)},undelegate:function(c,p,w){return arguments.length===1?this.off(c,"**"):this.off(p,c||"**",w)},hover:function(c,p){return this.on("mouseenter",c).on("mouseleave",p||c)}}),h.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(c,p){h.fn[p]=function(w,x){return arguments.length>0?this.on(p,null,w,x):this.trigger(p)}});var OE=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;h.proxy=function(c,p){var w,x,M;if(typeof p=="string"&&(w=c[p],p=c,c=w),!!b(c))return x=s.call(arguments,2),M=function(){return c.apply(p||this,x.concat(s.call(arguments)))},M.guid=c.guid=c.guid||h.guid++,M},h.holdReady=function(c){c?h.readyWait++:h.ready(!0)},h.isArray=Array.isArray,h.parseJSON=JSON.parse,h.nodeName=O,h.isFunction=b,h.isWindow=C,h.camelCase=R,h.type=k,h.now=Date.now,h.isNumeric=function(c){var p=h.type(c);return(p==="number"||p==="string")&&!isNaN(c-parseFloat(c))},h.trim=function(c){return c==null?"":(c+"").replace(OE,"$1")};var jE=e.jQuery,PE=e.$;return h.noConflict=function(c){return e.$===h&&(e.$=PE),c&&e.jQuery===h&&(e.jQuery=jE),h},typeof t>"u"&&(e.jQuery=e.$=h),h})})(gy);var WC=gy.exports;const py=Gi(WC);var Cd={exports:{}},Ll={exports:{}},pt={};/** @license React v16.13.1
58
+ `)}}).get()}});var TE=/%20/g,EE=/#.*$/,kE=/([?&])_=[^&]*/,NE=/^(.*?):[ \t]*([^\r\n]*)$/mg,ME=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,DE=/^(?:GET|HEAD)$/,AE=/^\/\//,S_={},Qd={},T_="*/".concat("*"),ef=S.createElement("a");ef.href=Qo.href;function E_(c){return function(p,w){typeof p!="string"&&(w=p,p="*");var x,M=0,D=p.toLowerCase().match(Pe)||[];if(b(w))for(;x=D[M++];)x[0]==="+"?(x=x.slice(1)||"*",(c[x]=c[x]||[]).unshift(w)):(c[x]=c[x]||[]).push(w)}}function k_(c,p,w,x){var M={},D=c===Qd;function L(W){var H;return M[W]=!0,h.each(c[W]||[],function(X,se){var ce=se(p,w,x);if(typeof ce=="string"&&!D&&!M[ce])return p.dataTypes.unshift(ce),L(ce),!1;if(D)return!(H=ce)}),H}return L(p.dataTypes[0])||!M["*"]&&L("*")}function tf(c,p){var w,x,M=h.ajaxSettings.flatOptions||{};for(w in p)p[w]!==void 0&&((M[w]?c:x||(x={}))[w]=p[w]);return x&&h.extend(!0,c,x),c}function IE(c,p,w){for(var x,M,D,L,W=c.contents,H=c.dataTypes;H[0]==="*";)H.shift(),x===void 0&&(x=c.mimeType||p.getResponseHeader("Content-Type"));if(x){for(M in W)if(W[M]&&W[M].test(x)){H.unshift(M);break}}if(H[0]in w)D=H[0];else{for(M in w){if(!H[0]||c.converters[M+" "+H[0]]){D=M;break}L||(L=M)}D=D||L}if(D)return D!==H[0]&&H.unshift(D),w[D]}function RE(c,p,w,x){var M,D,L,W,H,X={},se=c.dataTypes.slice();if(se[1])for(L in c.converters)X[L.toLowerCase()]=c.converters[L];for(D=se.shift();D;)if(c.responseFields[D]&&(w[c.responseFields[D]]=p),!H&&x&&c.dataFilter&&(p=c.dataFilter(p,c.dataType)),H=D,D=se.shift(),D){if(D==="*")D=H;else if(H!=="*"&&H!==D){if(L=X[H+" "+D]||X["* "+D],!L){for(M in X)if(W=M.split(" "),W[1]===D&&(L=X[H+" "+W[0]]||X["* "+W[0]],L)){L===!0?L=X[M]:X[M]!==!0&&(D=W[0],se.unshift(W[1]));break}}if(L!==!0)if(L&&c.throws)p=L(p);else try{p=L(p)}catch(ce){return{state:"parsererror",error:L?ce:"No conversion from "+H+" to "+D}}}}return{state:"success",data:p}}h.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Qo.href,type:"GET",isLocal:ME.test(Qo.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":T_,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":h.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(c,p){return p?tf(tf(c,h.ajaxSettings),p):tf(h.ajaxSettings,c)},ajaxPrefilter:E_(S_),ajaxTransport:E_(Qd),ajax:function(c,p){typeof c=="object"&&(p=c,c=void 0),p=p||{};var w,x,M,D,L,W,H,X,se,ce,te=h.ajaxSetup({},p),_e=te.context||te,Ye=te.context&&(_e.nodeType||_e.jquery)?h(_e):h.event,ut=h.Deferred(),Qe=h.Callbacks("once memory"),cn=te.statusCode||{},Jt={},kr={},Nr="canceled",st={readyState:0,getResponseHeader:function(ht){var zt;if(H){if(!D)for(D={};zt=NE.exec(M);)D[zt[1].toLowerCase()+" "]=(D[zt[1].toLowerCase()+" "]||[]).concat(zt[2]);zt=D[ht.toLowerCase()+" "]}return zt==null?null:zt.join(", ")},getAllResponseHeaders:function(){return H?M:null},setRequestHeader:function(ht,zt){return H==null&&(ht=kr[ht.toLowerCase()]=kr[ht.toLowerCase()]||ht,Jt[ht]=zt),this},overrideMimeType:function(ht){return H==null&&(te.mimeType=ht),this},statusCode:function(ht){var zt;if(ht)if(H)st.always(ht[st.status]);else for(zt in ht)cn[zt]=[cn[zt],ht[zt]];return this},abort:function(ht){var zt=ht||Nr;return w&&w.abort(zt),qi(0,zt),this}};if(ut.promise(st),te.url=((c||te.url||Qo.href)+"").replace(AE,Qo.protocol+"//"),te.type=p.method||p.type||te.method||te.type,te.dataTypes=(te.dataType||"*").toLowerCase().match(Pe)||[""],te.crossDomain==null){W=S.createElement("a");try{W.href=te.url,W.href=W.href,te.crossDomain=ef.protocol+"//"+ef.host!=W.protocol+"//"+W.host}catch{te.crossDomain=!0}}if(te.data&&te.processData&&typeof te.data!="string"&&(te.data=h.param(te.data,te.traditional)),k_(S_,te,p,st),H)return st;X=h.event&&te.global,X&&h.active++===0&&h.event.trigger("ajaxStart"),te.type=te.type.toUpperCase(),te.hasContent=!DE.test(te.type),x=te.url.replace(EE,""),te.hasContent?te.data&&te.processData&&(te.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(te.data=te.data.replace(TE,"+")):(ce=te.url.slice(x.length),te.data&&(te.processData||typeof te.data=="string")&&(x+=(Jd.test(x)?"&":"?")+te.data,delete te.data),te.cache===!1&&(x=x.replace(kE,"$1"),ce=(Jd.test(x)?"&":"?")+"_="+w_.guid+++ce),te.url=x+ce),te.ifModified&&(h.lastModified[x]&&st.setRequestHeader("If-Modified-Since",h.lastModified[x]),h.etag[x]&&st.setRequestHeader("If-None-Match",h.etag[x])),(te.data&&te.hasContent&&te.contentType!==!1||p.contentType)&&st.setRequestHeader("Content-Type",te.contentType),st.setRequestHeader("Accept",te.dataTypes[0]&&te.accepts[te.dataTypes[0]]?te.accepts[te.dataTypes[0]]+(te.dataTypes[0]!=="*"?", "+T_+"; q=0.01":""):te.accepts["*"]);for(se in te.headers)st.setRequestHeader(se,te.headers[se]);if(te.beforeSend&&(te.beforeSend.call(_e,st,te)===!1||H))return st.abort();if(Nr="abort",Qe.add(te.complete),st.done(te.success),st.fail(te.error),w=k_(Qd,te,p,st),!w)qi(-1,"No Transport");else{if(st.readyState=1,X&&Ye.trigger("ajaxSend",[st,te]),H)return st;te.async&&te.timeout>0&&(L=e.setTimeout(function(){st.abort("timeout")},te.timeout));try{H=!1,w.send(Jt,qi)}catch(ht){if(H)throw ht;qi(-1,ht)}}function qi(ht,zt,ta,rf){var Mr,na,Dr,yi,_i,Xn=zt;H||(H=!0,L&&e.clearTimeout(L),w=void 0,M=rf||"",st.readyState=ht>0?4:0,Mr=ht>=200&&ht<300||ht===304,ta&&(yi=IE(te,st,ta)),!Mr&&h.inArray("script",te.dataTypes)>-1&&h.inArray("json",te.dataTypes)<0&&(te.converters["text script"]=function(){}),yi=RE(te,yi,st,Mr),Mr?(te.ifModified&&(_i=st.getResponseHeader("Last-Modified"),_i&&(h.lastModified[x]=_i),_i=st.getResponseHeader("etag"),_i&&(h.etag[x]=_i)),ht===204||te.type==="HEAD"?Xn="nocontent":ht===304?Xn="notmodified":(Xn=yi.state,na=yi.data,Dr=yi.error,Mr=!Dr)):(Dr=Xn,(ht||!Xn)&&(Xn="error",ht<0&&(ht=0))),st.status=ht,st.statusText=(zt||Xn)+"",Mr?ut.resolveWith(_e,[na,Xn,st]):ut.rejectWith(_e,[st,Xn,Dr]),st.statusCode(cn),cn=void 0,X&&Ye.trigger(Mr?"ajaxSuccess":"ajaxError",[st,te,Mr?na:Dr]),Qe.fireWith(_e,[st,Xn]),X&&(Ye.trigger("ajaxComplete",[st,te]),--h.active||h.event.trigger("ajaxStop")))}return st},getJSON:function(c,p,w){return h.get(c,p,w,"json")},getScript:function(c,p){return h.get(c,void 0,p,"script")}}),h.each(["get","post"],function(c,p){h[p]=function(w,x,M,D){return b(x)&&(D=D||M,M=x,x=void 0),h.ajax(h.extend({url:w,type:p,dataType:D,data:x,success:M},h.isPlainObject(w)&&w))}}),h.ajaxPrefilter(function(c){var p;for(p in c.headers)p.toLowerCase()==="content-type"&&(c.contentType=c.headers[p]||"")}),h._evalUrl=function(c,p,w){return h.ajax({url:c,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(x){h.globalEval(x,p,w)}})},h.fn.extend({wrapAll:function(c){var p;return this[0]&&(b(c)&&(c=c.call(this[0])),p=h(c,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&p.insertBefore(this[0]),p.map(function(){for(var w=this;w.firstElementChild;)w=w.firstElementChild;return w}).append(this)),this},wrapInner:function(c){return b(c)?this.each(function(p){h(this).wrapInner(c.call(this,p))}):this.each(function(){var p=h(this),w=p.contents();w.length?w.wrapAll(c):p.append(c)})},wrap:function(c){var p=b(c);return this.each(function(w){h(this).wrapAll(p?c.call(this,w):c)})},unwrap:function(c){return this.parent(c).not("body").each(function(){h(this).replaceWith(this.childNodes)}),this}}),h.expr.pseudos.hidden=function(c){return!h.expr.pseudos.visible(c)},h.expr.pseudos.visible=function(c){return!!(c.offsetWidth||c.offsetHeight||c.getClientRects().length)},h.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch{}};var LE={0:200,1223:204},ea=h.ajaxSettings.xhr();y.cors=!!ea&&"withCredentials"in ea,y.ajax=ea=!!ea,h.ajaxTransport(function(c){var p,w;if(y.cors||ea&&!c.crossDomain)return{send:function(x,M){var D,L=c.xhr();if(L.open(c.type,c.url,c.async,c.username,c.password),c.xhrFields)for(D in c.xhrFields)L[D]=c.xhrFields[D];c.mimeType&&L.overrideMimeType&&L.overrideMimeType(c.mimeType),!c.crossDomain&&!x["X-Requested-With"]&&(x["X-Requested-With"]="XMLHttpRequest");for(D in x)L.setRequestHeader(D,x[D]);p=function(W){return function(){p&&(p=w=L.onload=L.onerror=L.onabort=L.ontimeout=L.onreadystatechange=null,W==="abort"?L.abort():W==="error"?typeof L.status!="number"?M(0,"error"):M(L.status,L.statusText):M(LE[L.status]||L.status,L.statusText,(L.responseType||"text")!=="text"||typeof L.responseText!="string"?{binary:L.response}:{text:L.responseText},L.getAllResponseHeaders()))}},L.onload=p(),w=L.onerror=L.ontimeout=p("error"),L.onabort!==void 0?L.onabort=w:L.onreadystatechange=function(){L.readyState===4&&e.setTimeout(function(){p&&w()})},p=p("abort");try{L.send(c.hasContent&&c.data||null)}catch(W){if(p)throw W}},abort:function(){p&&p()}}}),h.ajaxPrefilter(function(c){c.crossDomain&&(c.contents.script=!1)}),h.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(c){return h.globalEval(c),c}}}),h.ajaxPrefilter("script",function(c){c.cache===void 0&&(c.cache=!1),c.crossDomain&&(c.type="GET")}),h.ajaxTransport("script",function(c){if(c.crossDomain||c.scriptAttrs){var p,w;return{send:function(x,M){p=h("<script>").attr(c.scriptAttrs||{}).prop({charset:c.scriptCharset,src:c.url}).on("load error",w=function(D){p.remove(),w=null,D&&M(D.type==="error"?404:200,D.type)}),S.head.appendChild(p[0])},abort:function(){w&&w()}}}});var N_=[],nf=/(=)\?(?=&|$)|\?\?/;h.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var c=N_.pop()||h.expando+"_"+w_.guid++;return this[c]=!0,c}}),h.ajaxPrefilter("json jsonp",function(c,p,w){var x,M,D,L=c.jsonp!==!1&&(nf.test(c.url)?"url":typeof c.data=="string"&&(c.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&nf.test(c.data)&&"data");if(L||c.dataTypes[0]==="jsonp")return x=c.jsonpCallback=b(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,L?c[L]=c[L].replace(nf,"$1"+x):c.jsonp!==!1&&(c.url+=(Jd.test(c.url)?"&":"?")+c.jsonp+"="+x),c.converters["script json"]=function(){return D||h.error(x+" was not called"),D[0]},c.dataTypes[0]="json",M=e[x],e[x]=function(){D=arguments},w.always(function(){M===void 0?h(e).removeProp(x):e[x]=M,c[x]&&(c.jsonpCallback=p.jsonpCallback,N_.push(x)),D&&b(M)&&M(D[0]),D=M=void 0}),"script"}),y.createHTMLDocument=function(){var c=S.implementation.createHTMLDocument("").body;return c.innerHTML="<form></form><form></form>",c.childNodes.length===2}(),h.parseHTML=function(c,p,w){if(typeof c!="string")return[];typeof p=="boolean"&&(w=p,p=!1);var x,M,D;return p||(y.createHTMLDocument?(p=S.implementation.createHTMLDocument(""),x=p.createElement("base"),x.href=S.location.href,p.head.appendChild(x)):p=S),M=Ce.exec(c),D=!w&&[],M?[p.createElement(M[1])]:(M=$l([c],p,D),D&&D.length&&h(D).remove(),h.merge([],M.childNodes))},h.fn.load=function(c,p,w){var x,M,D,L=this,W=c.indexOf(" ");return W>-1&&(x=Yi(c.slice(W)),c=c.slice(0,W)),b(p)?(w=p,p=void 0):p&&typeof p=="object"&&(M="POST"),L.length>0&&h.ajax({url:c,type:M||"GET",dataType:"html",data:p}).done(function(H){D=arguments,L.html(x?h("<div>").append(h.parseHTML(H)).find(x):H)}).always(w&&function(H,X){L.each(function(){w.apply(this,D||[H.responseText,X,H])})}),this},h.expr.pseudos.animated=function(c){return h.grep(h.timers,function(p){return c===p.elem}).length},h.offset={setOffset:function(c,p,w){var x,M,D,L,W,H,X,se=h.css(c,"position"),ce=h(c),te={};se==="static"&&(c.style.position="relative"),W=ce.offset(),D=h.css(c,"top"),H=h.css(c,"left"),X=(se==="absolute"||se==="fixed")&&(D+H).indexOf("auto")>-1,X?(x=ce.position(),L=x.top,M=x.left):(L=parseFloat(D)||0,M=parseFloat(H)||0),b(p)&&(p=p.call(c,w,h.extend({},W))),p.top!=null&&(te.top=p.top-W.top+L),p.left!=null&&(te.left=p.left-W.left+M),"using"in p?p.using.call(c,te):ce.css(te)}},h.fn.extend({offset:function(c){if(arguments.length)return c===void 0?this:this.each(function(M){h.offset.setOffset(this,c,M)});var p,w,x=this[0];if(x)return x.getClientRects().length?(p=x.getBoundingClientRect(),w=x.ownerDocument.defaultView,{top:p.top+w.pageYOffset,left:p.left+w.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var c,p,w,x=this[0],M={top:0,left:0};if(h.css(x,"position")==="fixed")p=x.getBoundingClientRect();else{for(p=this.offset(),w=x.ownerDocument,c=x.offsetParent||w.documentElement;c&&(c===w.body||c===w.documentElement)&&h.css(c,"position")==="static";)c=c.parentNode;c&&c!==x&&c.nodeType===1&&(M=h(c).offset(),M.top+=h.css(c,"borderTopWidth",!0),M.left+=h.css(c,"borderLeftWidth",!0))}return{top:p.top-M.top-h.css(x,"marginTop",!0),left:p.left-M.left-h.css(x,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var c=this.offsetParent;c&&h.css(c,"position")==="static";)c=c.offsetParent;return c||hn})}}),h.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(c,p){var w=p==="pageYOffset";h.fn[c]=function(x){return Ae(this,function(M,D,L){var W;if(C(M)?W=M:M.nodeType===9&&(W=M.defaultView),L===void 0)return W?W[p]:M[D];W?W.scrollTo(w?W.pageXOffset:L,w?L:W.pageYOffset):M[D]=L},c,x,arguments.length)}}),h.each(["top","left"],function(c,p){h.cssHooks[p]=u_(y.pixelPosition,function(w,x){if(x)return x=Jo(w,p),Un.test(x)?h(w).position()[p]+"px":x})}),h.each({Height:"height",Width:"width"},function(c,p){h.each({padding:"inner"+c,content:p,"":"outer"+c},function(w,x){h.fn[x]=function(M,D){var L=arguments.length&&(w||typeof M!="boolean"),W=w||(M===!0||D===!0?"margin":"border");return Ae(this,function(H,X,se){var ce;return C(H)?x.indexOf("outer")===0?H["inner"+c]:H.document.documentElement["client"+c]:H.nodeType===9?(ce=H.documentElement,Math.max(H.body["scroll"+c],ce["scroll"+c],H.body["offset"+c],ce["offset"+c],ce["client"+c])):se===void 0?h.css(H,X,W):h.style(H,X,se,W)},p,L?M:void 0,L)}})}),h.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(c,p){h.fn[p]=function(w){return this.on(p,w)}}),h.fn.extend({bind:function(c,p,w){return this.on(c,null,p,w)},unbind:function(c,p){return this.off(c,null,p)},delegate:function(c,p,w,x){return this.on(p,c,w,x)},undelegate:function(c,p,w){return arguments.length===1?this.off(c,"**"):this.off(p,c||"**",w)},hover:function(c,p){return this.on("mouseenter",c).on("mouseleave",p||c)}}),h.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(c,p){h.fn[p]=function(w,x){return arguments.length>0?this.on(p,null,w,x):this.trigger(p)}});var OE=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;h.proxy=function(c,p){var w,x,M;if(typeof p=="string"&&(w=c[p],p=c,c=w),!!b(c))return x=s.call(arguments,2),M=function(){return c.apply(p||this,x.concat(s.call(arguments)))},M.guid=c.guid=c.guid||h.guid++,M},h.holdReady=function(c){c?h.readyWait++:h.ready(!0)},h.isArray=Array.isArray,h.parseJSON=JSON.parse,h.nodeName=O,h.isFunction=b,h.isWindow=C,h.camelCase=R,h.type=k,h.now=Date.now,h.isNumeric=function(c){var p=h.type(c);return(p==="number"||p==="string")&&!isNaN(c-parseFloat(c))},h.trim=function(c){return c==null?"":(c+"").replace(OE,"$1")};var jE=e.jQuery,PE=e.$;return h.noConflict=function(c){return e.$===h&&(e.$=PE),c&&e.jQuery===h&&(e.jQuery=jE),h},typeof t>"u"&&(e.jQuery=e.$=h),h})})(gy);var WC=gy.exports;const py=Gi(WC);var Cd={exports:{}},Ll={exports:{}},pt={};/** @license React v16.13.1
59
59
  * react-is.production.min.js
60
60
  *
61
61
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -69,8 +69,8 @@ ${e}`),Em=(n,e,t)=>{const r=sr(e),i=bt(),s=Ve(r),o=n.messageHandlers[s];return o
69
69
  *
70
70
  * This source code is licensed under the MIT license found in the
71
71
  * LICENSE file in the root directory of this source tree.
72
- */var yy;function YC(){return yy||(yy=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,u=n?Symbol.for("react.concurrent_mode"):60111,g=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,C=n?Symbol.for("react.fundamental"):60117,S=n?Symbol.for("react.responder"):60118,A=n?Symbol.for("react.scope"):60119;function v(we){return typeof we=="string"||typeof we=="function"||we===r||we===u||we===s||we===i||we===d||we===f||typeof we=="object"&&we!==null&&(we.$$typeof===y||we.$$typeof===m||we.$$typeof===o||we.$$typeof===a||we.$$typeof===g||we.$$typeof===C||we.$$typeof===S||we.$$typeof===A||we.$$typeof===b)}function k(we){if(typeof we=="object"&&we!==null){var yt=we.$$typeof;switch(yt){case e:var Wt=we.type;switch(Wt){case l:case u:case r:case s:case i:case d:return Wt;default:var Z=Wt&&Wt.$$typeof;switch(Z){case a:case g:case y:case m:case o:return Z;default:return yt}}case t:return yt}}}var T=l,N=u,h=a,I=o,O=e,j=g,P=r,q=y,G=m,ne=t,oe=s,ue=i,fe=d,Ee=!1;function be(we){return Ee||(Ee=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),ae(we)||k(we)===l}function ae(we){return k(we)===u}function de(we){return k(we)===a}function xe(we){return k(we)===o}function Te(we){return typeof we=="object"&&we!==null&&we.$$typeof===e}function ve(we){return k(we)===g}function Fe(we){return k(we)===r}function Ae(we){return k(we)===y}function Ne(we){return k(we)===m}function ze(we){return k(we)===t}function Ce(we){return k(we)===s}function Pe(we){return k(we)===i}function ft(we){return k(we)===d}mt.AsyncMode=T,mt.ConcurrentMode=N,mt.ContextConsumer=h,mt.ContextProvider=I,mt.Element=O,mt.ForwardRef=j,mt.Fragment=P,mt.Lazy=q,mt.Memo=G,mt.Portal=ne,mt.Profiler=oe,mt.StrictMode=ue,mt.Suspense=fe,mt.isAsyncMode=be,mt.isConcurrentMode=ae,mt.isContextConsumer=de,mt.isContextProvider=xe,mt.isElement=Te,mt.isForwardRef=ve,mt.isFragment=Fe,mt.isLazy=Ae,mt.isMemo=Ne,mt.isPortal=ze,mt.isProfiler=Ce,mt.isStrictMode=Pe,mt.isSuspense=ft,mt.isValidElementType=v,mt.typeOf=k}()),mt}var _y;function by(){return _y||(_y=1,process.env.NODE_ENV==="production"?Ll.exports=$C():Ll.exports=YC()),Ll.exports}var Sd,wy;function Td(){if(wy)return Sd;wy=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Sd=n,Sd}var Ed,vy;function xy(){return vy||(vy=1,Ed=Function.call.bind(Object.prototype.hasOwnProperty)),Ed}var kd,Cy;function VC(){if(Cy)return kd;Cy=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=Td(),t={},r=xy();n=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,a,l,u){if(process.env.NODE_ENV!=="production"){for(var g in s)if(r(s,g)){var d;try{if(typeof s[g]!="function"){var f=Error((l||"React class")+": "+a+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}d=s[g](o,g,l,a,null,e)}catch(y){d=y}if(d&&!(d instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+g+"` 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 t)){t[d.message]=!0;var m=u?u():"";n("Failed "+a+" type: "+d.message+(m??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},kd=i,kd}var Nd,Sy;function qC(){if(Sy)return Nd;Sy=1;var n=by(),e=ia(),t=Td(),r=xy(),i=VC(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Nd=function(a,l){var u=typeof Symbol=="function"&&Symbol.iterator,g="@@iterator";function d(ae){var de=ae&&(u&&ae[u]||ae[g]);if(typeof de=="function")return de}var f="<<anonymous>>",m={array:S("array"),bigint:S("bigint"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:A(),arrayOf:v,element:k(),elementType:T(),instanceOf:N,node:j(),objectOf:I,oneOf:h,oneOfType:O,shape:q,exact:G};function y(ae,de){return ae===de?ae!==0||1/ae===1/de:ae!==ae&&de!==de}function b(ae,de){this.message=ae,this.data=de&&typeof de=="object"?de:{},this.stack=""}b.prototype=Error.prototype;function C(ae){if(process.env.NODE_ENV!=="production")var de={},xe=0;function Te(Fe,Ae,Ne,ze,Ce,Pe,ft){if(ze=ze||f,Pe=Pe||Ne,ft!==t){if(l){var we=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 we.name="Invariant Violation",we}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var yt=ze+":"+Ne;!de[yt]&&xe<3&&(s("You are manually calling a React.PropTypes validation function for the `"+Pe+"` prop on `"+ze+"`. 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."),de[yt]=!0,xe++)}}return Ae[Ne]==null?Fe?Ae[Ne]===null?new b("The "+Ce+" `"+Pe+"` is marked as required "+("in `"+ze+"`, but its value is `null`.")):new b("The "+Ce+" `"+Pe+"` is marked as required in "+("`"+ze+"`, but its value is `undefined`.")):null:ae(Ae,Ne,ze,Ce,Pe)}var ve=Te.bind(null,!1);return ve.isRequired=Te.bind(null,!0),ve}function S(ae){function de(xe,Te,ve,Fe,Ae,Ne){var ze=xe[Te],Ce=ue(ze);if(Ce!==ae){var Pe=fe(ze);return new b("Invalid "+Fe+" `"+Ae+"` of type "+("`"+Pe+"` supplied to `"+ve+"`, expected ")+("`"+ae+"`."),{expectedType:ae})}return null}return C(de)}function A(){return C(o)}function v(ae){function de(xe,Te,ve,Fe,Ae){if(typeof ae!="function")return new b("Property `"+Ae+"` of component `"+ve+"` has invalid PropType notation inside arrayOf.");var Ne=xe[Te];if(!Array.isArray(Ne)){var ze=ue(Ne);return new b("Invalid "+Fe+" `"+Ae+"` of type "+("`"+ze+"` supplied to `"+ve+"`, expected an array."))}for(var Ce=0;Ce<Ne.length;Ce++){var Pe=ae(Ne,Ce,ve,Fe,Ae+"["+Ce+"]",t);if(Pe instanceof Error)return Pe}return null}return C(de)}function k(){function ae(de,xe,Te,ve,Fe){var Ae=de[xe];if(!a(Ae)){var Ne=ue(Ae);return new b("Invalid "+ve+" `"+Fe+"` of type "+("`"+Ne+"` supplied to `"+Te+"`, expected a single ReactElement."))}return null}return C(ae)}function T(){function ae(de,xe,Te,ve,Fe){var Ae=de[xe];if(!n.isValidElementType(Ae)){var Ne=ue(Ae);return new b("Invalid "+ve+" `"+Fe+"` of type "+("`"+Ne+"` supplied to `"+Te+"`, expected a single ReactElement type."))}return null}return C(ae)}function N(ae){function de(xe,Te,ve,Fe,Ae){if(!(xe[Te]instanceof ae)){var Ne=ae.name||f,ze=be(xe[Te]);return new b("Invalid "+Fe+" `"+Ae+"` of type "+("`"+ze+"` supplied to `"+ve+"`, expected ")+("instance of `"+Ne+"`."))}return null}return C(de)}function h(ae){if(!Array.isArray(ae))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("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])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function de(xe,Te,ve,Fe,Ae){for(var Ne=xe[Te],ze=0;ze<ae.length;ze++)if(y(Ne,ae[ze]))return null;var Ce=JSON.stringify(ae,function(ft,we){var yt=fe(we);return yt==="symbol"?String(we):we});return new b("Invalid "+Fe+" `"+Ae+"` of value `"+String(Ne)+"` "+("supplied to `"+ve+"`, expected one of "+Ce+"."))}return C(de)}function I(ae){function de(xe,Te,ve,Fe,Ae){if(typeof ae!="function")return new b("Property `"+Ae+"` of component `"+ve+"` has invalid PropType notation inside objectOf.");var Ne=xe[Te],ze=ue(Ne);if(ze!=="object")return new b("Invalid "+Fe+" `"+Ae+"` of type "+("`"+ze+"` supplied to `"+ve+"`, expected an object."));for(var Ce in Ne)if(r(Ne,Ce)){var Pe=ae(Ne,Ce,ve,Fe,Ae+"."+Ce,t);if(Pe instanceof Error)return Pe}return null}return C(de)}function O(ae){if(!Array.isArray(ae))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var de=0;de<ae.length;de++){var xe=ae[de];if(typeof xe!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Ee(xe)+" at index "+de+"."),o}function Te(ve,Fe,Ae,Ne,ze){for(var Ce=[],Pe=0;Pe<ae.length;Pe++){var ft=ae[Pe],we=ft(ve,Fe,Ae,Ne,ze,t);if(we==null)return null;we.data&&r(we.data,"expectedType")&&Ce.push(we.data.expectedType)}var yt=Ce.length>0?", expected one of type ["+Ce.join(", ")+"]":"";return new b("Invalid "+Ne+" `"+ze+"` supplied to "+("`"+Ae+"`"+yt+"."))}return C(Te)}function j(){function ae(de,xe,Te,ve,Fe){return ne(de[xe])?null:new b("Invalid "+ve+" `"+Fe+"` supplied to "+("`"+Te+"`, expected a ReactNode."))}return C(ae)}function P(ae,de,xe,Te,ve){return new b((ae||"React class")+": "+de+" type `"+xe+"."+Te+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+ve+"`.")}function q(ae){function de(xe,Te,ve,Fe,Ae){var Ne=xe[Te],ze=ue(Ne);if(ze!=="object")return new b("Invalid "+Fe+" `"+Ae+"` of type `"+ze+"` "+("supplied to `"+ve+"`, expected `object`."));for(var Ce in ae){var Pe=ae[Ce];if(typeof Pe!="function")return P(ve,Fe,Ae,Ce,fe(Pe));var ft=Pe(Ne,Ce,ve,Fe,Ae+"."+Ce,t);if(ft)return ft}return null}return C(de)}function G(ae){function de(xe,Te,ve,Fe,Ae){var Ne=xe[Te],ze=ue(Ne);if(ze!=="object")return new b("Invalid "+Fe+" `"+Ae+"` of type `"+ze+"` "+("supplied to `"+ve+"`, expected `object`."));var Ce=e({},xe[Te],ae);for(var Pe in Ce){var ft=ae[Pe];if(r(ae,Pe)&&typeof ft!="function")return P(ve,Fe,Ae,Pe,fe(ft));if(!ft)return new b("Invalid "+Fe+" `"+Ae+"` key `"+Pe+"` supplied to `"+ve+"`.\nBad object: "+JSON.stringify(xe[Te],null," ")+`
73
- Valid keys: `+JSON.stringify(Object.keys(ae),null," "));var we=ft(Ne,Pe,ve,Fe,Ae+"."+Pe,t);if(we)return we}return null}return C(de)}function ne(ae){switch(typeof ae){case"number":case"string":case"undefined":return!0;case"boolean":return!ae;case"object":if(Array.isArray(ae))return ae.every(ne);if(ae===null||a(ae))return!0;var de=d(ae);if(de){var xe=de.call(ae),Te;if(de!==ae.entries){for(;!(Te=xe.next()).done;)if(!ne(Te.value))return!1}else for(;!(Te=xe.next()).done;){var ve=Te.value;if(ve&&!ne(ve[1]))return!1}}else return!1;return!0;default:return!1}}function oe(ae,de){return ae==="symbol"?!0:de?de["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&de instanceof Symbol:!1}function ue(ae){var de=typeof ae;return Array.isArray(ae)?"array":ae instanceof RegExp?"object":oe(de,ae)?"symbol":de}function fe(ae){if(typeof ae>"u"||ae===null)return""+ae;var de=ue(ae);if(de==="object"){if(ae instanceof Date)return"date";if(ae instanceof RegExp)return"regexp"}return de}function Ee(ae){var de=fe(ae);switch(de){case"array":case"object":return"an "+de;case"boolean":case"date":case"regexp":return"a "+de;default:return de}}function be(ae){return!ae.constructor||!ae.constructor.name?f:ae.constructor.name}return m.checkPropTypes=i,m.resetWarningCache=i.resetWarningCache,m.PropTypes=m,m},Nd}var Md,Ty;function KC(){if(Ty)return Md;Ty=1;var n=Td();function e(){}function t(){}return t.resetWarningCache=e,Md=function(){function r(o,a,l,u,g,d){if(d!==n){var f=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 f.name="Invariant Violation",f}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return s.PropTypes=s,s},Md}if(process.env.NODE_ENV!=="production"){var GC=by(),XC=!0;Cd.exports=qC()(GC.isElement,XC)}else Cd.exports=KC()();var JC=Cd.exports;const Rt=Gi(JC);function ZC(n){return n&&typeof n=="object"&&"default"in n?n.default:n}var Ey=U,QC=ZC(Ey);function ky(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eS(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}var tS=!!(typeof window<"u"&&window.document&&window.document.createElement);function nS(n,e,t){if(typeof n!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof e!="function")throw new Error("Expected handleStateChangeOnClient to be a function.");if(typeof t<"u"&&typeof t!="function")throw new Error("Expected mapStateOnServer to either be undefined or a function.");function r(i){return i.displayName||i.name||"Component"}return function(s){if(typeof s!="function")throw new Error("Expected WrappedComponent to be a React component.");var o=[],a;function l(){a=n(o.map(function(g){return g.props})),u.canUseDOM?e(a):t&&(a=t(a))}var u=function(g){eS(d,g);function d(){return g.apply(this,arguments)||this}d.peek=function(){return a},d.rewind=function(){if(d.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var y=a;return a=void 0,o=[],y};var f=d.prototype;return f.UNSAFE_componentWillMount=function(){o.push(this),l()},f.componentDidUpdate=function(){l()},f.componentWillUnmount=function(){var y=o.indexOf(this);o.splice(y,1),l()},f.render=function(){return QC.createElement(s,this.props)},d}(Ey.PureComponent);return ky(u,"displayName","SideEffect("+r(s)+")"),ky(u,"canUseDOM",tS),u}}var rS=nS;const iS=Gi(rS);var sS=typeof Element<"u",oS=typeof Map=="function",aS=typeof Set=="function",lS=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Ol(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){if(n.constructor!==e.constructor)return!1;var t,r,i;if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(!Ol(n[r],e[r]))return!1;return!0}var s;if(oS&&n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(s=n.entries();!(r=s.next()).done;)if(!e.has(r.value[0]))return!1;for(s=n.entries();!(r=s.next()).done;)if(!Ol(r.value[1],e.get(r.value[0])))return!1;return!0}if(aS&&n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(s=n.entries();!(r=s.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(lS&&ArrayBuffer.isView(n)&&ArrayBuffer.isView(e)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(n[r]!==e[r])return!1;return!0}if(n.constructor===RegExp)return n.source===e.source&&n.flags===e.flags;if(n.valueOf!==Object.prototype.valueOf&&typeof n.valueOf=="function"&&typeof e.valueOf=="function")return n.valueOf()===e.valueOf();if(n.toString!==Object.prototype.toString&&typeof n.toString=="function"&&typeof e.toString=="function")return n.toString()===e.toString();if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(sS&&n instanceof Element)return!1;for(r=t;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&n.$$typeof)&&!Ol(n[i[r]],e[i[r]]))return!1;return!0}return n!==n&&e!==e}var cS=function(e,t){try{return Ol(e,t)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const uS=Gi(cS);var dS=ia();const fS=Gi(dS);var $i={BODY:"bodyAttributes",HTML:"htmlAttributes",TITLE:"titleAttributes"},Ke={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"},Ny=Object.keys(Ke).map(function(n){return Ke[n]}),Lt={CHARSET:"charset",CSS_TEXT:"cssText",HREF:"href",HTTPEQUIV:"http-equiv",INNER_HTML:"innerHTML",ITEM_PROP:"itemprop",NAME:"name",PROPERTY:"property",REL:"rel",SRC:"src",TARGET:"target"},jl={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Ho={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate"},hS=Object.keys(jl).reduce(function(n,e){return n[jl[e]]=e,n},{}),gS=[Ke.NOSCRIPT,Ke.SCRIPT,Ke.STYLE],or="data-react-helmet",pS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},mS=function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")},yS=function(){function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),Nn=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},_S=function(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)},My=function(n,e){var t={};for(var r in n)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},bS=function(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:n},Dd=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return t===!1?String(e):String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")},wS=function(e){var t=Ls(e,Ke.TITLE),r=Ls(e,Ho.TITLE_TEMPLATE);if(r&&t)return r.replace(/%s/g,function(){return Array.isArray(t)?t.join(""):t});var i=Ls(e,Ho.DEFAULT_TITLE);return t||i||void 0},vS=function(e){return Ls(e,Ho.ON_CHANGE_CLIENT_STATE)||function(){}},Ad=function(e,t){return t.filter(function(r){return typeof r[e]<"u"}).map(function(r){return r[e]}).reduce(function(r,i){return Nn({},r,i)},{})},xS=function(e,t){return t.filter(function(r){return typeof r[Ke.BASE]<"u"}).map(function(r){return r[Ke.BASE]}).reverse().reduce(function(r,i){if(!r.length)for(var s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],l=a.toLowerCase();if(e.indexOf(l)!==-1&&i[l])return r.concat(i)}return r},[])},Wo=function(e,t,r){var i={};return r.filter(function(s){return Array.isArray(s[e])?!0:(typeof s[e]<"u"&&Rd("Helmet: "+e+' should be of type "Array". Instead found type "'+pS(s[e])+'"'),!1)}).map(function(s){return s[e]}).reverse().reduce(function(s,o){var a={};o.filter(function(f){for(var m=void 0,y=Object.keys(f),b=0;b<y.length;b++){var C=y[b],S=C.toLowerCase();t.indexOf(S)!==-1&&!(m===Lt.REL&&f[m].toLowerCase()==="canonical")&&!(S===Lt.REL&&f[S].toLowerCase()==="stylesheet")&&(m=S),t.indexOf(C)!==-1&&(C===Lt.INNER_HTML||C===Lt.CSS_TEXT||C===Lt.ITEM_PROP)&&(m=C)}if(!m||!f[m])return!1;var A=f[m].toLowerCase();return i[m]||(i[m]={}),a[m]||(a[m]={}),i[m][A]?!1:(a[m][A]=!0,!0)}).reverse().forEach(function(f){return s.push(f)});for(var l=Object.keys(a),u=0;u<l.length;u++){var g=l[u],d=fS({},i[g],a[g]);i[g]=d}return s},[]).reverse()},Ls=function(e,t){for(var r=e.length-1;r>=0;r--){var i=e[r];if(i.hasOwnProperty(t))return i[t]}return null},CS=function(e){return{baseTag:xS([Lt.HREF,Lt.TARGET],e),bodyAttributes:Ad($i.BODY,e),defer:Ls(e,Ho.DEFER),encode:Ls(e,Ho.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Ad($i.HTML,e),linkTags:Wo(Ke.LINK,[Lt.REL,Lt.HREF],e),metaTags:Wo(Ke.META,[Lt.NAME,Lt.CHARSET,Lt.HTTPEQUIV,Lt.PROPERTY,Lt.ITEM_PROP],e),noscriptTags:Wo(Ke.NOSCRIPT,[Lt.INNER_HTML],e),onChangeClientState:vS(e),scriptTags:Wo(Ke.SCRIPT,[Lt.SRC,Lt.INNER_HTML],e),styleTags:Wo(Ke.STYLE,[Lt.CSS_TEXT],e),title:wS(e),titleAttributes:Ad($i.TITLE,e)}},Id=function(){var n=Date.now();return function(e){var t=Date.now();t-n>16?(n=t,e(t)):setTimeout(function(){Id(e)},0)}}(),Dy=function(e){return clearTimeout(e)},SS=typeof window<"u"?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||Id:global.requestAnimationFrame||Id,TS=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||Dy:global.cancelAnimationFrame||Dy,Rd=function(e){return console&&typeof console.warn=="function"&&console.warn(e)},$o=null,ES=function(e){$o&&TS($o),e.defer?$o=SS(function(){Ay(e,function(){$o=null})}):(Ay(e),$o=null)},Ay=function(e,t){var r=e.baseTag,i=e.bodyAttributes,s=e.htmlAttributes,o=e.linkTags,a=e.metaTags,l=e.noscriptTags,u=e.onChangeClientState,g=e.scriptTags,d=e.styleTags,f=e.title,m=e.titleAttributes;Ld(Ke.BODY,i),Ld(Ke.HTML,s),kS(f,m);var y={baseTag:Os(Ke.BASE,r),linkTags:Os(Ke.LINK,o),metaTags:Os(Ke.META,a),noscriptTags:Os(Ke.NOSCRIPT,l),scriptTags:Os(Ke.SCRIPT,g),styleTags:Os(Ke.STYLE,d)},b={},C={};Object.keys(y).forEach(function(S){var A=y[S],v=A.newTags,k=A.oldTags;v.length&&(b[S]=v),k.length&&(C[S]=y[S].oldTags)}),t&&t(),u(e,b,C)},Iy=function(e){return Array.isArray(e)?e.join(""):e},kS=function(e,t){typeof e<"u"&&document.title!==e&&(document.title=Iy(e)),Ld(Ke.TITLE,t)},Ld=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var i=r.getAttribute(or),s=i?i.split(","):[],o=[].concat(s),a=Object.keys(t),l=0;l<a.length;l++){var u=a[l],g=t[u]||"";r.getAttribute(u)!==g&&r.setAttribute(u,g),s.indexOf(u)===-1&&s.push(u);var d=o.indexOf(u);d!==-1&&o.splice(d,1)}for(var f=o.length-1;f>=0;f--)r.removeAttribute(o[f]);s.length===o.length?r.removeAttribute(or):r.getAttribute(or)!==a.join(",")&&r.setAttribute(or,a.join(","))}},Os=function(e,t){var r=document.head||document.querySelector(Ke.HEAD),i=r.querySelectorAll(e+"["+or+"]"),s=Array.prototype.slice.call(i),o=[],a=void 0;return t&&t.length&&t.forEach(function(l){var u=document.createElement(e);for(var g in l)if(l.hasOwnProperty(g))if(g===Lt.INNER_HTML)u.innerHTML=l.innerHTML;else if(g===Lt.CSS_TEXT)u.styleSheet?u.styleSheet.cssText=l.cssText:u.appendChild(document.createTextNode(l.cssText));else{var d=typeof l[g]>"u"?"":l[g];u.setAttribute(g,d)}u.setAttribute(or,"true"),s.some(function(f,m){return a=m,u.isEqualNode(f)})?s.splice(a,1):o.push(u)}),s.forEach(function(l){return l.parentNode.removeChild(l)}),o.forEach(function(l){return r.appendChild(l)}),{oldTags:s,newTags:o}},Ry=function(e){return Object.keys(e).reduce(function(t,r){var i=typeof e[r]<"u"?r+'="'+e[r]+'"':""+r;return t?t+" "+i:i},"")},NS=function(e,t,r,i){var s=Ry(r),o=Iy(t);return s?"<"+e+" "+or+'="true" '+s+">"+Dd(o,i)+"</"+e+">":"<"+e+" "+or+'="true">'+Dd(o,i)+"</"+e+">"},MS=function(e,t,r){return t.reduce(function(i,s){var o=Object.keys(s).filter(function(u){return!(u===Lt.INNER_HTML||u===Lt.CSS_TEXT)}).reduce(function(u,g){var d=typeof s[g]>"u"?g:g+'="'+Dd(s[g],r)+'"';return u?u+" "+d:d},""),a=s.innerHTML||s.cssText||"",l=gS.indexOf(e)===-1;return i+"<"+e+" "+or+'="true" '+o+(l?"/>":">"+a+"</"+e+">")},"")},Ly=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,i){return r[jl[i]||i]=e[i],r},t)},DS=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,i){return r[hS[i]||i]=e[i],r},t)},AS=function(e,t,r){var i,s=(i={key:t},i[or]=!0,i),o=Ly(r,s);return[U.createElement(Ke.TITLE,o,t)]},IS=function(e,t){return t.map(function(r,i){var s,o=(s={key:i},s[or]=!0,s);return Object.keys(r).forEach(function(a){var l=jl[a]||a;if(l===Lt.INNER_HTML||l===Lt.CSS_TEXT){var u=r.innerHTML||r.cssText;o.dangerouslySetInnerHTML={__html:u}}else o[l]=r[a]}),U.createElement(e,o)})},Wr=function(e,t,r){switch(e){case Ke.TITLE:return{toComponent:function(){return AS(e,t.title,t.titleAttributes)},toString:function(){return NS(e,t.title,t.titleAttributes,r)}};case $i.BODY:case $i.HTML:return{toComponent:function(){return Ly(t)},toString:function(){return Ry(t)}};default:return{toComponent:function(){return IS(e,t)},toString:function(){return MS(e,t,r)}}}},Oy=function(e){var t=e.baseTag,r=e.bodyAttributes,i=e.encode,s=e.htmlAttributes,o=e.linkTags,a=e.metaTags,l=e.noscriptTags,u=e.scriptTags,g=e.styleTags,d=e.title,f=d===void 0?"":d,m=e.titleAttributes;return{base:Wr(Ke.BASE,t,i),bodyAttributes:Wr($i.BODY,r,i),htmlAttributes:Wr($i.HTML,s,i),link:Wr(Ke.LINK,o,i),meta:Wr(Ke.META,a,i),noscript:Wr(Ke.NOSCRIPT,l,i),script:Wr(Ke.SCRIPT,u,i),style:Wr(Ke.STYLE,g,i),title:Wr(Ke.TITLE,{title:f,titleAttributes:m},i)}},RS=function(e){var t,r;return r=t=function(i){_S(s,i);function s(){return mS(this,s),bS(this,i.apply(this,arguments))}return s.prototype.shouldComponentUpdate=function(a){return!uS(this.props,a)},s.prototype.mapNestedChildrenToProps=function(a,l){if(!l)return null;switch(a.type){case Ke.SCRIPT:case Ke.NOSCRIPT:return{innerHTML:l};case Ke.STYLE:return{cssText:l}}throw new Error("<"+a.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},s.prototype.flattenArrayTypeChildren=function(a){var l,u=a.child,g=a.arrayTypeChildren,d=a.newChildProps,f=a.nestedChildren;return Nn({},g,(l={},l[u.type]=[].concat(g[u.type]||[],[Nn({},d,this.mapNestedChildrenToProps(u,f))]),l))},s.prototype.mapObjectTypeChildren=function(a){var l,u,g=a.child,d=a.newProps,f=a.newChildProps,m=a.nestedChildren;switch(g.type){case Ke.TITLE:return Nn({},d,(l={},l[g.type]=m,l.titleAttributes=Nn({},f),l));case Ke.BODY:return Nn({},d,{bodyAttributes:Nn({},f)});case Ke.HTML:return Nn({},d,{htmlAttributes:Nn({},f)})}return Nn({},d,(u={},u[g.type]=Nn({},f),u))},s.prototype.mapArrayTypeChildrenToProps=function(a,l){var u=Nn({},l);return Object.keys(a).forEach(function(g){var d;u=Nn({},u,(d={},d[g]=a[g],d))}),u},s.prototype.warnOnInvalidChildren=function(a,l){if(process.env.NODE_ENV!=="production"){if(!Ny.some(function(u){return a.type===u}))return typeof a.type=="function"?Rd("You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information."):Rd("Only elements types "+Ny.join(", ")+" are allowed. Helmet does not support rendering <"+a.type+"> elements. Refer to our API for more information.");if(l&&typeof l!="string"&&(!Array.isArray(l)||l.some(function(u){return typeof u!="string"})))throw new Error("Helmet expects a string as a child of <"+a.type+">. Did you forget to wrap your children in braces? ( <"+a.type+">{``}</"+a.type+"> ) Refer to our API for more information.")}return!0},s.prototype.mapChildrenToProps=function(a,l){var u=this,g={};return U.Children.forEach(a,function(d){if(!(!d||!d.props)){var f=d.props,m=f.children,y=My(f,["children"]),b=DS(y);switch(u.warnOnInvalidChildren(d,m),d.type){case Ke.LINK:case Ke.META:case Ke.NOSCRIPT:case Ke.SCRIPT:case Ke.STYLE:g=u.flattenArrayTypeChildren({child:d,arrayTypeChildren:g,newChildProps:b,nestedChildren:m});break;default:l=u.mapObjectTypeChildren({child:d,newProps:l,newChildProps:b,nestedChildren:m});break}}}),l=this.mapArrayTypeChildrenToProps(g,l),l},s.prototype.render=function(){var a=this.props,l=a.children,u=My(a,["children"]),g=Nn({},u);return l&&(g=this.mapChildrenToProps(l,g)),U.createElement(e,g)},yS(s,null,[{key:"canUseDOM",set:function(a){e.canUseDOM=a}}]),s}(U.Component),t.propTypes={base:Rt.object,bodyAttributes:Rt.object,children:Rt.oneOfType([Rt.arrayOf(Rt.node),Rt.node]),defaultTitle:Rt.string,defer:Rt.bool,encodeSpecialCharacters:Rt.bool,htmlAttributes:Rt.object,link:Rt.arrayOf(Rt.object),meta:Rt.arrayOf(Rt.object),noscript:Rt.arrayOf(Rt.object),onChangeClientState:Rt.func,script:Rt.arrayOf(Rt.object),style:Rt.arrayOf(Rt.object),title:Rt.string,titleAttributes:Rt.object,titleTemplate:Rt.string},t.defaultProps={defer:!0,encodeSpecialCharacters:!0},t.peek=e.peek,t.rewind=function(){var i=e.rewind();return i||(i=Oy({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),i},r},LS=function(){return null},OS=iS(CS,ES,Oy)(LS),Od=RS(OS);Od.renderStatic=Od.rewind;const jS=({styleConfig:n})=>{const{heading:e}=n;let t=e.find(a=>a.title==="Heading1"),r=e.find(a=>a.title==="Heading2"),i=e.find(a=>a.title==="Heading3"),s=e.find(a=>a.title==="Heading4"),o=e.find(a=>a.title==="Heading5");return F.jsx(Od,{children:F.jsx("style",{type:"text/css",children:`
72
+ */var yy;function YC(){return yy||(yy=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,o=n?Symbol.for("react.provider"):60109,a=n?Symbol.for("react.context"):60110,l=n?Symbol.for("react.async_mode"):60111,u=n?Symbol.for("react.concurrent_mode"):60111,g=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,C=n?Symbol.for("react.fundamental"):60117,S=n?Symbol.for("react.responder"):60118,A=n?Symbol.for("react.scope"):60119;function v(we){return typeof we=="string"||typeof we=="function"||we===r||we===u||we===s||we===i||we===d||we===f||typeof we=="object"&&we!==null&&(we.$$typeof===y||we.$$typeof===m||we.$$typeof===o||we.$$typeof===a||we.$$typeof===g||we.$$typeof===C||we.$$typeof===S||we.$$typeof===A||we.$$typeof===b)}function k(we){if(typeof we=="object"&&we!==null){var yt=we.$$typeof;switch(yt){case e:var Wt=we.type;switch(Wt){case l:case u:case r:case s:case i:case d:return Wt;default:var Z=Wt&&Wt.$$typeof;switch(Z){case a:case g:case y:case m:case o:return Z;default:return yt}}case t:return yt}}}var T=l,N=u,h=a,I=o,O=e,j=g,P=r,q=y,G=m,ee=t,ue=s,ae=i,ge=d,Le=!1;function be(we){return Le||(Le=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),oe(we)||k(we)===l}function oe(we){return k(we)===u}function fe(we){return k(we)===a}function Ce(we){return k(we)===o}function Te(we){return typeof we=="object"&&we!==null&&we.$$typeof===e}function ve(we){return k(we)===g}function Fe(we){return k(we)===r}function De(we){return k(we)===y}function ke(we){return k(we)===m}function ze(we){return k(we)===t}function xe(we){return k(we)===s}function Pe(we){return k(we)===i}function ft(we){return k(we)===d}mt.AsyncMode=T,mt.ConcurrentMode=N,mt.ContextConsumer=h,mt.ContextProvider=I,mt.Element=O,mt.ForwardRef=j,mt.Fragment=P,mt.Lazy=q,mt.Memo=G,mt.Portal=ee,mt.Profiler=ue,mt.StrictMode=ae,mt.Suspense=ge,mt.isAsyncMode=be,mt.isConcurrentMode=oe,mt.isContextConsumer=fe,mt.isContextProvider=Ce,mt.isElement=Te,mt.isForwardRef=ve,mt.isFragment=Fe,mt.isLazy=De,mt.isMemo=ke,mt.isPortal=ze,mt.isProfiler=xe,mt.isStrictMode=Pe,mt.isSuspense=ft,mt.isValidElementType=v,mt.typeOf=k}()),mt}var _y;function by(){return _y||(_y=1,process.env.NODE_ENV==="production"?Ll.exports=$C():Ll.exports=YC()),Ll.exports}var Sd,wy;function Td(){if(wy)return Sd;wy=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Sd=n,Sd}var Ed,vy;function xy(){return vy||(vy=1,Ed=Function.call.bind(Object.prototype.hasOwnProperty)),Ed}var kd,Cy;function VC(){if(Cy)return kd;Cy=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=Td(),t={},r=xy();n=function(s){var o="Warning: "+s;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function i(s,o,a,l,u){if(process.env.NODE_ENV!=="production"){for(var g in s)if(r(s,g)){var d;try{if(typeof s[g]!="function"){var f=Error((l||"React class")+": "+a+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}d=s[g](o,g,l,a,null,e)}catch(y){d=y}if(d&&!(d instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+g+"` 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 t)){t[d.message]=!0;var m=u?u():"";n("Failed "+a+" type: "+d.message+(m??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},kd=i,kd}var Nd,Sy;function qC(){if(Sy)return Nd;Sy=1;var n=by(),e=ia(),t=Td(),r=xy(),i=VC(),s=function(){};process.env.NODE_ENV!=="production"&&(s=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Nd=function(a,l){var u=typeof Symbol=="function"&&Symbol.iterator,g="@@iterator";function d(oe){var fe=oe&&(u&&oe[u]||oe[g]);if(typeof fe=="function")return fe}var f="<<anonymous>>",m={array:S("array"),bigint:S("bigint"),bool:S("boolean"),func:S("function"),number:S("number"),object:S("object"),string:S("string"),symbol:S("symbol"),any:A(),arrayOf:v,element:k(),elementType:T(),instanceOf:N,node:j(),objectOf:I,oneOf:h,oneOfType:O,shape:q,exact:G};function y(oe,fe){return oe===fe?oe!==0||1/oe===1/fe:oe!==oe&&fe!==fe}function b(oe,fe){this.message=oe,this.data=fe&&typeof fe=="object"?fe:{},this.stack=""}b.prototype=Error.prototype;function C(oe){if(process.env.NODE_ENV!=="production")var fe={},Ce=0;function Te(Fe,De,ke,ze,xe,Pe,ft){if(ze=ze||f,Pe=Pe||ke,ft!==t){if(l){var we=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 we.name="Invariant Violation",we}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var yt=ze+":"+ke;!fe[yt]&&Ce<3&&(s("You are manually calling a React.PropTypes validation function for the `"+Pe+"` prop on `"+ze+"`. 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."),fe[yt]=!0,Ce++)}}return De[ke]==null?Fe?De[ke]===null?new b("The "+xe+" `"+Pe+"` is marked as required "+("in `"+ze+"`, but its value is `null`.")):new b("The "+xe+" `"+Pe+"` is marked as required in "+("`"+ze+"`, but its value is `undefined`.")):null:oe(De,ke,ze,xe,Pe)}var ve=Te.bind(null,!1);return ve.isRequired=Te.bind(null,!0),ve}function S(oe){function fe(Ce,Te,ve,Fe,De,ke){var ze=Ce[Te],xe=ae(ze);if(xe!==oe){var Pe=ge(ze);return new b("Invalid "+Fe+" `"+De+"` of type "+("`"+Pe+"` supplied to `"+ve+"`, expected ")+("`"+oe+"`."),{expectedType:oe})}return null}return C(fe)}function A(){return C(o)}function v(oe){function fe(Ce,Te,ve,Fe,De){if(typeof oe!="function")return new b("Property `"+De+"` of component `"+ve+"` has invalid PropType notation inside arrayOf.");var ke=Ce[Te];if(!Array.isArray(ke)){var ze=ae(ke);return new b("Invalid "+Fe+" `"+De+"` of type "+("`"+ze+"` supplied to `"+ve+"`, expected an array."))}for(var xe=0;xe<ke.length;xe++){var Pe=oe(ke,xe,ve,Fe,De+"["+xe+"]",t);if(Pe instanceof Error)return Pe}return null}return C(fe)}function k(){function oe(fe,Ce,Te,ve,Fe){var De=fe[Ce];if(!a(De)){var ke=ae(De);return new b("Invalid "+ve+" `"+Fe+"` of type "+("`"+ke+"` supplied to `"+Te+"`, expected a single ReactElement."))}return null}return C(oe)}function T(){function oe(fe,Ce,Te,ve,Fe){var De=fe[Ce];if(!n.isValidElementType(De)){var ke=ae(De);return new b("Invalid "+ve+" `"+Fe+"` of type "+("`"+ke+"` supplied to `"+Te+"`, expected a single ReactElement type."))}return null}return C(oe)}function N(oe){function fe(Ce,Te,ve,Fe,De){if(!(Ce[Te]instanceof oe)){var ke=oe.name||f,ze=be(Ce[Te]);return new b("Invalid "+Fe+" `"+De+"` of type "+("`"+ze+"` supplied to `"+ve+"`, expected ")+("instance of `"+ke+"`."))}return null}return C(fe)}function h(oe){if(!Array.isArray(oe))return process.env.NODE_ENV!=="production"&&(arguments.length>1?s("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])."):s("Invalid argument supplied to oneOf, expected an array.")),o;function fe(Ce,Te,ve,Fe,De){for(var ke=Ce[Te],ze=0;ze<oe.length;ze++)if(y(ke,oe[ze]))return null;var xe=JSON.stringify(oe,function(ft,we){var yt=ge(we);return yt==="symbol"?String(we):we});return new b("Invalid "+Fe+" `"+De+"` of value `"+String(ke)+"` "+("supplied to `"+ve+"`, expected one of "+xe+"."))}return C(fe)}function I(oe){function fe(Ce,Te,ve,Fe,De){if(typeof oe!="function")return new b("Property `"+De+"` of component `"+ve+"` has invalid PropType notation inside objectOf.");var ke=Ce[Te],ze=ae(ke);if(ze!=="object")return new b("Invalid "+Fe+" `"+De+"` of type "+("`"+ze+"` supplied to `"+ve+"`, expected an object."));for(var xe in ke)if(r(ke,xe)){var Pe=oe(ke,xe,ve,Fe,De+"."+xe,t);if(Pe instanceof Error)return Pe}return null}return C(fe)}function O(oe){if(!Array.isArray(oe))return process.env.NODE_ENV!=="production"&&s("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var fe=0;fe<oe.length;fe++){var Ce=oe[fe];if(typeof Ce!="function")return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Le(Ce)+" at index "+fe+"."),o}function Te(ve,Fe,De,ke,ze){for(var xe=[],Pe=0;Pe<oe.length;Pe++){var ft=oe[Pe],we=ft(ve,Fe,De,ke,ze,t);if(we==null)return null;we.data&&r(we.data,"expectedType")&&xe.push(we.data.expectedType)}var yt=xe.length>0?", expected one of type ["+xe.join(", ")+"]":"";return new b("Invalid "+ke+" `"+ze+"` supplied to "+("`"+De+"`"+yt+"."))}return C(Te)}function j(){function oe(fe,Ce,Te,ve,Fe){return ee(fe[Ce])?null:new b("Invalid "+ve+" `"+Fe+"` supplied to "+("`"+Te+"`, expected a ReactNode."))}return C(oe)}function P(oe,fe,Ce,Te,ve){return new b((oe||"React class")+": "+fe+" type `"+Ce+"."+Te+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+ve+"`.")}function q(oe){function fe(Ce,Te,ve,Fe,De){var ke=Ce[Te],ze=ae(ke);if(ze!=="object")return new b("Invalid "+Fe+" `"+De+"` of type `"+ze+"` "+("supplied to `"+ve+"`, expected `object`."));for(var xe in oe){var Pe=oe[xe];if(typeof Pe!="function")return P(ve,Fe,De,xe,ge(Pe));var ft=Pe(ke,xe,ve,Fe,De+"."+xe,t);if(ft)return ft}return null}return C(fe)}function G(oe){function fe(Ce,Te,ve,Fe,De){var ke=Ce[Te],ze=ae(ke);if(ze!=="object")return new b("Invalid "+Fe+" `"+De+"` of type `"+ze+"` "+("supplied to `"+ve+"`, expected `object`."));var xe=e({},Ce[Te],oe);for(var Pe in xe){var ft=oe[Pe];if(r(oe,Pe)&&typeof ft!="function")return P(ve,Fe,De,Pe,ge(ft));if(!ft)return new b("Invalid "+Fe+" `"+De+"` key `"+Pe+"` supplied to `"+ve+"`.\nBad object: "+JSON.stringify(Ce[Te],null," ")+`
73
+ Valid keys: `+JSON.stringify(Object.keys(oe),null," "));var we=ft(ke,Pe,ve,Fe,De+"."+Pe,t);if(we)return we}return null}return C(fe)}function ee(oe){switch(typeof oe){case"number":case"string":case"undefined":return!0;case"boolean":return!oe;case"object":if(Array.isArray(oe))return oe.every(ee);if(oe===null||a(oe))return!0;var fe=d(oe);if(fe){var Ce=fe.call(oe),Te;if(fe!==oe.entries){for(;!(Te=Ce.next()).done;)if(!ee(Te.value))return!1}else for(;!(Te=Ce.next()).done;){var ve=Te.value;if(ve&&!ee(ve[1]))return!1}}else return!1;return!0;default:return!1}}function ue(oe,fe){return oe==="symbol"?!0:fe?fe["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&fe instanceof Symbol:!1}function ae(oe){var fe=typeof oe;return Array.isArray(oe)?"array":oe instanceof RegExp?"object":ue(fe,oe)?"symbol":fe}function ge(oe){if(typeof oe>"u"||oe===null)return""+oe;var fe=ae(oe);if(fe==="object"){if(oe instanceof Date)return"date";if(oe instanceof RegExp)return"regexp"}return fe}function Le(oe){var fe=ge(oe);switch(fe){case"array":case"object":return"an "+fe;case"boolean":case"date":case"regexp":return"a "+fe;default:return fe}}function be(oe){return!oe.constructor||!oe.constructor.name?f:oe.constructor.name}return m.checkPropTypes=i,m.resetWarningCache=i.resetWarningCache,m.PropTypes=m,m},Nd}var Md,Ty;function KC(){if(Ty)return Md;Ty=1;var n=Td();function e(){}function t(){}return t.resetWarningCache=e,Md=function(){function r(o,a,l,u,g,d){if(d!==n){var f=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 f.name="Invariant Violation",f}}r.isRequired=r;function i(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return s.PropTypes=s,s},Md}if(process.env.NODE_ENV!=="production"){var GC=by(),XC=!0;Cd.exports=qC()(GC.isElement,XC)}else Cd.exports=KC()();var JC=Cd.exports;const Rt=Gi(JC);function ZC(n){return n&&typeof n=="object"&&"default"in n?n.default:n}var Ey=U,QC=ZC(Ey);function ky(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eS(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}var tS=!!(typeof window<"u"&&window.document&&window.document.createElement);function nS(n,e,t){if(typeof n!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof e!="function")throw new Error("Expected handleStateChangeOnClient to be a function.");if(typeof t<"u"&&typeof t!="function")throw new Error("Expected mapStateOnServer to either be undefined or a function.");function r(i){return i.displayName||i.name||"Component"}return function(s){if(typeof s!="function")throw new Error("Expected WrappedComponent to be a React component.");var o=[],a;function l(){a=n(o.map(function(g){return g.props})),u.canUseDOM?e(a):t&&(a=t(a))}var u=function(g){eS(d,g);function d(){return g.apply(this,arguments)||this}d.peek=function(){return a},d.rewind=function(){if(d.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var y=a;return a=void 0,o=[],y};var f=d.prototype;return f.UNSAFE_componentWillMount=function(){o.push(this),l()},f.componentDidUpdate=function(){l()},f.componentWillUnmount=function(){var y=o.indexOf(this);o.splice(y,1),l()},f.render=function(){return QC.createElement(s,this.props)},d}(Ey.PureComponent);return ky(u,"displayName","SideEffect("+r(s)+")"),ky(u,"canUseDOM",tS),u}}var rS=nS;const iS=Gi(rS);var sS=typeof Element<"u",oS=typeof Map=="function",aS=typeof Set=="function",lS=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Ol(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){if(n.constructor!==e.constructor)return!1;var t,r,i;if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(!Ol(n[r],e[r]))return!1;return!0}var s;if(oS&&n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(s=n.entries();!(r=s.next()).done;)if(!e.has(r.value[0]))return!1;for(s=n.entries();!(r=s.next()).done;)if(!Ol(r.value[1],e.get(r.value[0])))return!1;return!0}if(aS&&n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(s=n.entries();!(r=s.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(lS&&ArrayBuffer.isView(n)&&ArrayBuffer.isView(e)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(n[r]!==e[r])return!1;return!0}if(n.constructor===RegExp)return n.source===e.source&&n.flags===e.flags;if(n.valueOf!==Object.prototype.valueOf&&typeof n.valueOf=="function"&&typeof e.valueOf=="function")return n.valueOf()===e.valueOf();if(n.toString!==Object.prototype.toString&&typeof n.toString=="function"&&typeof e.toString=="function")return n.toString()===e.toString();if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(sS&&n instanceof Element)return!1;for(r=t;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&n.$$typeof)&&!Ol(n[i[r]],e[i[r]]))return!1;return!0}return n!==n&&e!==e}var cS=function(e,t){try{return Ol(e,t)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const uS=Gi(cS);var dS=ia();const fS=Gi(dS);var $i={BODY:"bodyAttributes",HTML:"htmlAttributes",TITLE:"titleAttributes"},Ke={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"},Ny=Object.keys(Ke).map(function(n){return Ke[n]}),Lt={CHARSET:"charset",CSS_TEXT:"cssText",HREF:"href",HTTPEQUIV:"http-equiv",INNER_HTML:"innerHTML",ITEM_PROP:"itemprop",NAME:"name",PROPERTY:"property",REL:"rel",SRC:"src",TARGET:"target"},jl={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Ho={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate"},hS=Object.keys(jl).reduce(function(n,e){return n[jl[e]]=e,n},{}),gS=[Ke.NOSCRIPT,Ke.SCRIPT,Ke.STYLE],or="data-react-helmet",pS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},mS=function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")},yS=function(){function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),Nn=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},_S=function(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)},My=function(n,e){var t={};for(var r in n)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},bS=function(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:n},Dd=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return t===!1?String(e):String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")},wS=function(e){var t=Ls(e,Ke.TITLE),r=Ls(e,Ho.TITLE_TEMPLATE);if(r&&t)return r.replace(/%s/g,function(){return Array.isArray(t)?t.join(""):t});var i=Ls(e,Ho.DEFAULT_TITLE);return t||i||void 0},vS=function(e){return Ls(e,Ho.ON_CHANGE_CLIENT_STATE)||function(){}},Ad=function(e,t){return t.filter(function(r){return typeof r[e]<"u"}).map(function(r){return r[e]}).reduce(function(r,i){return Nn({},r,i)},{})},xS=function(e,t){return t.filter(function(r){return typeof r[Ke.BASE]<"u"}).map(function(r){return r[Ke.BASE]}).reverse().reduce(function(r,i){if(!r.length)for(var s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],l=a.toLowerCase();if(e.indexOf(l)!==-1&&i[l])return r.concat(i)}return r},[])},Wo=function(e,t,r){var i={};return r.filter(function(s){return Array.isArray(s[e])?!0:(typeof s[e]<"u"&&Rd("Helmet: "+e+' should be of type "Array". Instead found type "'+pS(s[e])+'"'),!1)}).map(function(s){return s[e]}).reverse().reduce(function(s,o){var a={};o.filter(function(f){for(var m=void 0,y=Object.keys(f),b=0;b<y.length;b++){var C=y[b],S=C.toLowerCase();t.indexOf(S)!==-1&&!(m===Lt.REL&&f[m].toLowerCase()==="canonical")&&!(S===Lt.REL&&f[S].toLowerCase()==="stylesheet")&&(m=S),t.indexOf(C)!==-1&&(C===Lt.INNER_HTML||C===Lt.CSS_TEXT||C===Lt.ITEM_PROP)&&(m=C)}if(!m||!f[m])return!1;var A=f[m].toLowerCase();return i[m]||(i[m]={}),a[m]||(a[m]={}),i[m][A]?!1:(a[m][A]=!0,!0)}).reverse().forEach(function(f){return s.push(f)});for(var l=Object.keys(a),u=0;u<l.length;u++){var g=l[u],d=fS({},i[g],a[g]);i[g]=d}return s},[]).reverse()},Ls=function(e,t){for(var r=e.length-1;r>=0;r--){var i=e[r];if(i.hasOwnProperty(t))return i[t]}return null},CS=function(e){return{baseTag:xS([Lt.HREF,Lt.TARGET],e),bodyAttributes:Ad($i.BODY,e),defer:Ls(e,Ho.DEFER),encode:Ls(e,Ho.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Ad($i.HTML,e),linkTags:Wo(Ke.LINK,[Lt.REL,Lt.HREF],e),metaTags:Wo(Ke.META,[Lt.NAME,Lt.CHARSET,Lt.HTTPEQUIV,Lt.PROPERTY,Lt.ITEM_PROP],e),noscriptTags:Wo(Ke.NOSCRIPT,[Lt.INNER_HTML],e),onChangeClientState:vS(e),scriptTags:Wo(Ke.SCRIPT,[Lt.SRC,Lt.INNER_HTML],e),styleTags:Wo(Ke.STYLE,[Lt.CSS_TEXT],e),title:wS(e),titleAttributes:Ad($i.TITLE,e)}},Id=function(){var n=Date.now();return function(e){var t=Date.now();t-n>16?(n=t,e(t)):setTimeout(function(){Id(e)},0)}}(),Dy=function(e){return clearTimeout(e)},SS=typeof window<"u"?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||Id:global.requestAnimationFrame||Id,TS=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||Dy:global.cancelAnimationFrame||Dy,Rd=function(e){return console&&typeof console.warn=="function"&&console.warn(e)},$o=null,ES=function(e){$o&&TS($o),e.defer?$o=SS(function(){Ay(e,function(){$o=null})}):(Ay(e),$o=null)},Ay=function(e,t){var r=e.baseTag,i=e.bodyAttributes,s=e.htmlAttributes,o=e.linkTags,a=e.metaTags,l=e.noscriptTags,u=e.onChangeClientState,g=e.scriptTags,d=e.styleTags,f=e.title,m=e.titleAttributes;Ld(Ke.BODY,i),Ld(Ke.HTML,s),kS(f,m);var y={baseTag:Os(Ke.BASE,r),linkTags:Os(Ke.LINK,o),metaTags:Os(Ke.META,a),noscriptTags:Os(Ke.NOSCRIPT,l),scriptTags:Os(Ke.SCRIPT,g),styleTags:Os(Ke.STYLE,d)},b={},C={};Object.keys(y).forEach(function(S){var A=y[S],v=A.newTags,k=A.oldTags;v.length&&(b[S]=v),k.length&&(C[S]=y[S].oldTags)}),t&&t(),u(e,b,C)},Iy=function(e){return Array.isArray(e)?e.join(""):e},kS=function(e,t){typeof e<"u"&&document.title!==e&&(document.title=Iy(e)),Ld(Ke.TITLE,t)},Ld=function(e,t){var r=document.getElementsByTagName(e)[0];if(r){for(var i=r.getAttribute(or),s=i?i.split(","):[],o=[].concat(s),a=Object.keys(t),l=0;l<a.length;l++){var u=a[l],g=t[u]||"";r.getAttribute(u)!==g&&r.setAttribute(u,g),s.indexOf(u)===-1&&s.push(u);var d=o.indexOf(u);d!==-1&&o.splice(d,1)}for(var f=o.length-1;f>=0;f--)r.removeAttribute(o[f]);s.length===o.length?r.removeAttribute(or):r.getAttribute(or)!==a.join(",")&&r.setAttribute(or,a.join(","))}},Os=function(e,t){var r=document.head||document.querySelector(Ke.HEAD),i=r.querySelectorAll(e+"["+or+"]"),s=Array.prototype.slice.call(i),o=[],a=void 0;return t&&t.length&&t.forEach(function(l){var u=document.createElement(e);for(var g in l)if(l.hasOwnProperty(g))if(g===Lt.INNER_HTML)u.innerHTML=l.innerHTML;else if(g===Lt.CSS_TEXT)u.styleSheet?u.styleSheet.cssText=l.cssText:u.appendChild(document.createTextNode(l.cssText));else{var d=typeof l[g]>"u"?"":l[g];u.setAttribute(g,d)}u.setAttribute(or,"true"),s.some(function(f,m){return a=m,u.isEqualNode(f)})?s.splice(a,1):o.push(u)}),s.forEach(function(l){return l.parentNode.removeChild(l)}),o.forEach(function(l){return r.appendChild(l)}),{oldTags:s,newTags:o}},Ry=function(e){return Object.keys(e).reduce(function(t,r){var i=typeof e[r]<"u"?r+'="'+e[r]+'"':""+r;return t?t+" "+i:i},"")},NS=function(e,t,r,i){var s=Ry(r),o=Iy(t);return s?"<"+e+" "+or+'="true" '+s+">"+Dd(o,i)+"</"+e+">":"<"+e+" "+or+'="true">'+Dd(o,i)+"</"+e+">"},MS=function(e,t,r){return t.reduce(function(i,s){var o=Object.keys(s).filter(function(u){return!(u===Lt.INNER_HTML||u===Lt.CSS_TEXT)}).reduce(function(u,g){var d=typeof s[g]>"u"?g:g+'="'+Dd(s[g],r)+'"';return u?u+" "+d:d},""),a=s.innerHTML||s.cssText||"",l=gS.indexOf(e)===-1;return i+"<"+e+" "+or+'="true" '+o+(l?"/>":">"+a+"</"+e+">")},"")},Ly=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,i){return r[jl[i]||i]=e[i],r},t)},DS=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,i){return r[hS[i]||i]=e[i],r},t)},AS=function(e,t,r){var i,s=(i={key:t},i[or]=!0,i),o=Ly(r,s);return[U.createElement(Ke.TITLE,o,t)]},IS=function(e,t){return t.map(function(r,i){var s,o=(s={key:i},s[or]=!0,s);return Object.keys(r).forEach(function(a){var l=jl[a]||a;if(l===Lt.INNER_HTML||l===Lt.CSS_TEXT){var u=r.innerHTML||r.cssText;o.dangerouslySetInnerHTML={__html:u}}else o[l]=r[a]}),U.createElement(e,o)})},Wr=function(e,t,r){switch(e){case Ke.TITLE:return{toComponent:function(){return AS(e,t.title,t.titleAttributes)},toString:function(){return NS(e,t.title,t.titleAttributes,r)}};case $i.BODY:case $i.HTML:return{toComponent:function(){return Ly(t)},toString:function(){return Ry(t)}};default:return{toComponent:function(){return IS(e,t)},toString:function(){return MS(e,t,r)}}}},Oy=function(e){var t=e.baseTag,r=e.bodyAttributes,i=e.encode,s=e.htmlAttributes,o=e.linkTags,a=e.metaTags,l=e.noscriptTags,u=e.scriptTags,g=e.styleTags,d=e.title,f=d===void 0?"":d,m=e.titleAttributes;return{base:Wr(Ke.BASE,t,i),bodyAttributes:Wr($i.BODY,r,i),htmlAttributes:Wr($i.HTML,s,i),link:Wr(Ke.LINK,o,i),meta:Wr(Ke.META,a,i),noscript:Wr(Ke.NOSCRIPT,l,i),script:Wr(Ke.SCRIPT,u,i),style:Wr(Ke.STYLE,g,i),title:Wr(Ke.TITLE,{title:f,titleAttributes:m},i)}},RS=function(e){var t,r;return r=t=function(i){_S(s,i);function s(){return mS(this,s),bS(this,i.apply(this,arguments))}return s.prototype.shouldComponentUpdate=function(a){return!uS(this.props,a)},s.prototype.mapNestedChildrenToProps=function(a,l){if(!l)return null;switch(a.type){case Ke.SCRIPT:case Ke.NOSCRIPT:return{innerHTML:l};case Ke.STYLE:return{cssText:l}}throw new Error("<"+a.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},s.prototype.flattenArrayTypeChildren=function(a){var l,u=a.child,g=a.arrayTypeChildren,d=a.newChildProps,f=a.nestedChildren;return Nn({},g,(l={},l[u.type]=[].concat(g[u.type]||[],[Nn({},d,this.mapNestedChildrenToProps(u,f))]),l))},s.prototype.mapObjectTypeChildren=function(a){var l,u,g=a.child,d=a.newProps,f=a.newChildProps,m=a.nestedChildren;switch(g.type){case Ke.TITLE:return Nn({},d,(l={},l[g.type]=m,l.titleAttributes=Nn({},f),l));case Ke.BODY:return Nn({},d,{bodyAttributes:Nn({},f)});case Ke.HTML:return Nn({},d,{htmlAttributes:Nn({},f)})}return Nn({},d,(u={},u[g.type]=Nn({},f),u))},s.prototype.mapArrayTypeChildrenToProps=function(a,l){var u=Nn({},l);return Object.keys(a).forEach(function(g){var d;u=Nn({},u,(d={},d[g]=a[g],d))}),u},s.prototype.warnOnInvalidChildren=function(a,l){if(process.env.NODE_ENV!=="production"){if(!Ny.some(function(u){return a.type===u}))return typeof a.type=="function"?Rd("You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information."):Rd("Only elements types "+Ny.join(", ")+" are allowed. Helmet does not support rendering <"+a.type+"> elements. Refer to our API for more information.");if(l&&typeof l!="string"&&(!Array.isArray(l)||l.some(function(u){return typeof u!="string"})))throw new Error("Helmet expects a string as a child of <"+a.type+">. Did you forget to wrap your children in braces? ( <"+a.type+">{``}</"+a.type+"> ) Refer to our API for more information.")}return!0},s.prototype.mapChildrenToProps=function(a,l){var u=this,g={};return U.Children.forEach(a,function(d){if(!(!d||!d.props)){var f=d.props,m=f.children,y=My(f,["children"]),b=DS(y);switch(u.warnOnInvalidChildren(d,m),d.type){case Ke.LINK:case Ke.META:case Ke.NOSCRIPT:case Ke.SCRIPT:case Ke.STYLE:g=u.flattenArrayTypeChildren({child:d,arrayTypeChildren:g,newChildProps:b,nestedChildren:m});break;default:l=u.mapObjectTypeChildren({child:d,newProps:l,newChildProps:b,nestedChildren:m});break}}}),l=this.mapArrayTypeChildrenToProps(g,l),l},s.prototype.render=function(){var a=this.props,l=a.children,u=My(a,["children"]),g=Nn({},u);return l&&(g=this.mapChildrenToProps(l,g)),U.createElement(e,g)},yS(s,null,[{key:"canUseDOM",set:function(a){e.canUseDOM=a}}]),s}(U.Component),t.propTypes={base:Rt.object,bodyAttributes:Rt.object,children:Rt.oneOfType([Rt.arrayOf(Rt.node),Rt.node]),defaultTitle:Rt.string,defer:Rt.bool,encodeSpecialCharacters:Rt.bool,htmlAttributes:Rt.object,link:Rt.arrayOf(Rt.object),meta:Rt.arrayOf(Rt.object),noscript:Rt.arrayOf(Rt.object),onChangeClientState:Rt.func,script:Rt.arrayOf(Rt.object),style:Rt.arrayOf(Rt.object),title:Rt.string,titleAttributes:Rt.object,titleTemplate:Rt.string},t.defaultProps={defer:!0,encodeSpecialCharacters:!0},t.peek=e.peek,t.rewind=function(){var i=e.rewind();return i||(i=Oy({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),i},r},LS=function(){return null},OS=iS(CS,ES,Oy)(LS),Od=RS(OS);Od.renderStatic=Od.rewind;const jS=({styleConfig:n})=>{const{heading:e}=n;let t=e.find(a=>a.title==="Heading1"),r=e.find(a=>a.title==="Heading2"),i=e.find(a=>a.title==="Heading3"),s=e.find(a=>a.title==="Heading4"),o=e.find(a=>a.title==="Heading5");return F.jsx(Od,{children:F.jsx("style",{type:"text/css",children:`
74
74
  .PlaygroundEditorTheme__h1 {
75
75
  font-size: ${t?t.fontSize:""}px;
76
76
  font-family: ${t?t.fontFamily:""};
@@ -129,5 +129,5 @@ Valid keys: `+JSON.stringify(Object.keys(ae),null," "));var we=ft(Ne,Pe,ve,Fe,A
129
129
  text-align: ${o?o.alignment:""};
130
130
  line-height: ${o?o.lineSpacing:""};
131
131
  }
132
- `})})},PS="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE1IDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMDAwMDEgOC4zMzMzM0wxLjkwMDAxIDEzLjhMMS4xMDAwMSAxMy4yTDUuMzc1MDEgNy41TDEuMTAwMDEgMS44TDEuOTAwMDEgMS4yTDYuMDAwMDEgNi42NjY2N0wxMC4xIDEuMkwxMC45IDEuOEw2LjYyNTAxIDcuNUwxMC45IDEzLjJMMTAuMSAxMy44TDYuMDAwMDEgOC4zMzMzM1pNMTIgMTIuNUMxMiAxMS42NzE2IDEyLjY3MTYgMTEgMTMuNSAxMUgxMy43OTI5QzE0LjQ1OTYgMTEgMTUgMTEuNTQwNCAxNSAxMi4yMDcxQzE1IDEyLjUyNzMgMTQuODcyOCAxMi44MzQzIDE0LjY0NjUgMTMuMDYwN0wxMy43MDcxIDE0SDE1VjE1SDEyLjVDMTIuMjk3OCAxNSAxMi4xMTU1IDE0Ljg3ODIgMTIuMDM4MSAxNC42OTEzQzExLjk2MDcgMTQuNTA0NSAxMi4wMDM1IDE0LjI4OTQgMTIuMTQ2NSAxNC4xNDY0TDEzLjkzOTMgMTIuMzUzNkMxMy45NzgyIDEyLjMxNDcgMTQgMTIuMjYyIDE0IDEyLjIwNzFDMTQgMTIuMDkyNyAxMy45MDczIDEyIDEzLjc5MjkgMTJIMTMuNUMxMy4yMjM5IDEyIDEzIDEyLjIyMzkgMTMgMTIuNUgxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+",FS="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiBpbWFnZS1yZW5kZXJpbmc9Im9wdGltaXplUXVhbGl0eSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZpZXdCb3g9IjAgMCA1MDQgNTEyLjM2Ij48cGF0aCBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik00OTkuNDMgMjMxLjM2SDM2OC40Yy0yLjUzIDAtNC41OC0yLjA1LTQuNTgtNC41N3YtOC4xMWMwLTEuMjYuNTItMi40IDEuMzQtMy4yMmw3MS41Ny04Mi41M2M2LjczLTcuNzUgMTIuNTctMTQuOTcgMTcuNDgtMjEuNjggNC44OC02LjY0IDguODMtMTIuNzQgMTEuODUtMTguMjggMi45Ny01LjQzIDUuMTgtMTAuNjEgNi42NC0xNS41NSAxLjQyLTQuODUgMi4xMy05LjUzIDIuMTMtMTQgMC0xNC42OC0zLjk4LTI2LjA1LTExLjkyLTM0LjA5LTMuOTItMy45Ni04Ljc1LTYuOTMtMTQuNDktOC45Mi01Ljk1LTIuMDMtMTIuOTEtMy4wNS0yMC44Ny0zLjA1LTguNDUgMC0xNS44OCAxLjIxLTIyLjI5IDMuNjItNi4yNyAyLjM2LTExLjYzIDUuOTItMTYuMDcgMTAuNjNhNDcuODg0IDQ3Ljg4NCAwIDAgMC0xMC4xNCAxNi42Yy0yLjI3IDYuMjktMy40MSAxMy4zOS0zLjQxIDIxLjI2IDAgMi41Mi0yLjA1IDQuNTctNC41NyA0LjU3aC02Ljg5Yy0yLjA1IDAtMy44LTEuMzYtNC4zNy0zLjI0bC0uMjctLjgyYy0uMTgtLjU2LS4yNS0xLjEzLS4yMi0xLjY3LS4yMy05LjMyIDEuMTQtMTcuOTkgNC4xMi0yNS45NyAzLjAyLTguMTMgNy42OC0xNS41NCAxMy45NC0yMi4xOSA2LjI2LTYuNyAxMy42My0xMS43NiAyMi4xLTE1LjEzQzQwNy44NCAxLjY4IDQxNy4yIDAgNDI3LjU1IDBjOS41OSAwIDE4LjI2IDEuMzggMjYuMDMgNC4xMyA3Ljg2IDIuNzkgMTQuNzcgNyAyMC43MiAxMi42MSA2LjAyIDUuNjMgMTAuNTUgMTIuNCAxMy41NSAyMC4yOCAyLjk2IDcuNzUgNC40NSAxNi41NiA0LjQ1IDI2LjQgMCA2LjUtMS4wNyAxMy4wOC0zLjE3IDE5LjY5bC0uMTQuMzhjLTIuMDkgNi40Ni01LjE3IDEyLjk3LTkuMiAxOS40OWwtLjE0LjIxYy00LjA4IDYuNTEtOC45IDEzLjQzLTE0LjQzIDIwLjc0LTUuNTYgNy4zMy0xMS45NiAxNS4yMy0xOS4yMiAyMy42N2wtNTYuOTEgNjYuNTFoMTEwLjM0YzIuNTIgMCA0LjU3IDIuMDUgNC41NyA0LjU3djguMTFjMCAyLjUyLTIuMDUgNC41Ny00LjU3IDQuNTd6bS0zMjcuMjUgNjguNzUgMTM3Ljk2LTE2Ny43NmMuODktMS4wNyAyLjMtMS42NSAzLjc0LTEuNjVsMjAuMTMtLjAyYzIuNTIgMCA0LjU3IDEuNzQgNC41NyAzLjg4IDAgLjkxLS4zNyAxLjc1LS45OCAyLjQxTDE4OC4zMiAzMTcuNjYgMzQ0LjEgNTA2LjI0YzEuNDUgMS43NS45NSA0LjE3LTEuMSA1LjQtLjguNDgtMS43Mi43MS0yLjYzLjcxbC0yMC4xMy4wMWMtMS43IDAtMy4xOC0uNzktMy45Ny0xLjk2bC0xNDQuMS0xNzUuMkwyOC4yMyA1MTAuNjljLS44OCAxLjA3LTIuMyAxLjY0LTMuNzMgMS42NWwtMTkuOTMuMDJjLTIuNTIgMC00LjU3LTEuNzQtNC41Ny0zLjg5IDAtLjkuMzctMS43NC45OC0yLjRsMTU1LjY1LTE4OC40TDYuOSAxMzYuOGMtMS40NS0xLjc1LS45NS00LjE4IDEuMTEtNS40MS43OS0uNDcgMS43MS0uNyAyLjYyLS43bDIwLjQ0LS4wMWMxLjYzIDAgMy4wNi43MiAzLjg3IDEuODFsMTM3LjI0IDE2Ny42MnoiLz48L3N2Zz4=",l1="",jy=tn.createContext(null),Py=4;function Er({children:n,className:e,onClick:t,title:r}){const i=U.useRef(null),s=tn.useContext(jy);if(s===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:o}=s;return U.useEffect(()=>{i&&i.current&&o(i)},[i,o]),F.jsx("button",{className:e,onClick:t,ref:i,title:r,type:"button",children:n})}function zS({children:n,dropDownRef:e,onClose:t}){const[r,i]=U.useState(),[s,o]=U.useState(),a=U.useCallback(g=>{i(d=>d?[...d,g]:[g])},[i]),l=g=>{if(!r)return;const d=g.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(d)&&g.preventDefault(),d==="Escape"||d==="Tab"?t():d==="ArrowUp"?o(f=>{if(!f)return r[0];const m=r.indexOf(f)-1;return r[m===-1?r.length-1:m]}):d==="ArrowDown"&&o(f=>f?r[r.indexOf(f)+1]:r[0])},u=U.useMemo(()=>({registerItem:a}),[a]);return U.useEffect(()=>{r&&!s&&o(r[0]),s&&s.current&&s.current.focus()},[r,s]),F.jsx(jy.Provider,{value:u,children:F.jsx("div",{className:"dropdown",ref:e,onKeyDown:l,children:n})})}function jd({disabled:n=!1,buttonLabel:e,buttonAriaLabel:t,buttonClassName:r,buttonIconClassName:i,children:s,stopCloseOnClickSelf:o}){const a=U.useRef(null),l=U.useRef(null),[u,g]=U.useState(!1),d=()=>{g(!1),l&&l.current&&l.current.focus()};return U.useEffect(()=>{const f=l.current,m=a.current;if(u&&f!==null&&m!==null){const{top:y,left:b}=f.getBoundingClientRect();m.style.top=`${y+f.offsetHeight+Py}px`,m.style.left=`${Math.min(b,window.innerWidth-m.offsetWidth-20)}px`}},[a,l,u]),U.useEffect(()=>{const f=l.current;if(f!==null&&u){const m=y=>{const b=y.target;o&&a.current&&a.current.contains(b)||f.contains(b)||g(!1)};return document.addEventListener("click",m),()=>{document.removeEventListener("click",m)}}},[a,l,u,o]),U.useEffect(()=>{const f=()=>{if(u){const m=l.current,y=a.current;if(m!==null&&y!==null){const{top:b}=m.getBoundingClientRect(),C=b+m.offsetHeight+Py;C!==y.getBoundingClientRect().top&&(y.style.top=`${C}px`)}}};return document.addEventListener("scroll",f),()=>{document.removeEventListener("scroll",f)}},[l,a,u]),F.jsxs(F.Fragment,{children:[F.jsxs("button",{type:"button",disabled:n,"aria-label":t||e,className:r,onClick:()=>g(!u),ref:l,children:[i&&F.jsx("span",{className:i}),e&&F.jsx("span",{className:"text dropdown-button-text",children:e}),F.jsx("i",{className:"chevron-down"})]}),u&&In.createPortal(F.jsx(zS,{dropDownRef:a,onClose:d,children:s}),document.body)]})}function Fy(){return F.jsx("div",{className:"divider"})}const zy=8,By=72,$r={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},BS=({selectionFontSize:n,disabled:e,editor:t,blockType:r,styleConfig:i,isenterPressed:s,currentElementClick:o,currentElementSelect:a})=>{const[l,u]=tn.useState(n),[g,d]=tn.useState(r),[f,m]=tn.useState("");tn.useState([]),tn.useState("");const y=v=>{v&&v.title&&t.update(()=>{if(t.isEditable()){const k=ge();k&&kv(k,v)}})},b=v=>{u(v.target.value)},C=()=>{const v=Number(l);if(!isNaN(v)){const k=Math.min(Math.max(v,zy),By);u(String(k)),y({"font-size":`${k}px`})}},S=v=>{m(v),t.update(()=>{const N=ge();he(N)&&Mv(N,()=>Rs(v))});const{heading:k}=i;let T=null;if(k)switch(v){case"h1":T=k.find(N=>N.title==="Heading1").fontSize;break;case"h2":T=k.find(N=>N.title==="Heading2").fontSize;break;case"h3":T=k.find(N=>N.title==="Heading3").fontSize;break;case"h4":T=k.find(N=>N.title==="Heading4").fontSize;break;case"h5":T=k.find(N=>N.title==="Heading5").fontSize;break;case"paragraph":T=11;break;default:T=11}u(T),m(v),d(v)},A=()=>{u("11")};return tn.useEffect(()=>{console.log("enter pressed"),A()},[s]),tn.useEffect(()=>{const v=()=>{t.update(()=>{const k=ge();if(k!==null){const N=k.getNodes()[0];if(!me(N)){const h=N.getType();h in $r&&d(h)}}})};return t.registerUpdateListener(v),()=>{t.registerUpdateListener(v)}},[t]),tn.useEffect(()=>{switch(o.tagName){case"P":u("11");break;case"H1":d("h1"),u(i.heading.find(v=>v.title==="Heading1").fontSize);break;case"H2":d("h2"),u(i.heading.find(v=>v.title==="Heading2").fontSize);break;case"H3":d("h3"),u(i.heading.find(v=>v.title==="Heading3").fontSize);break;case"H4":d("h4"),u(i.heading.find(v=>v.title==="Heading4").fontSize);break;case"H5":d("h5"),u(i.heading.find(v=>v.title==="Heading5").fontSize);break;case"default":d("paragraph"),u("11");break}},[o]),tn.useEffect(()=>{switch(a||(u("11"),d("paragraph")),a&&a.trim(" ")){case"P":u("11"),d("paragraph");break;case"h1":d("h1"),u(i.heading.find(v=>v.title==="Heading1").fontSize);break;case"h2":d("h2"),u(i.heading.find(v=>v.title==="Heading2").fontSize);break;case"h3":d("h3"),u(i.heading.find(v=>v.title==="Heading3").fontSize);break;case"h4":d("h4"),u(i.heading.find(v=>v.title==="Heading4").fontSize);break;case"h5":d("h5"),u(i.heading.find(v=>v.title==="Heading5").fontSize);break;case"default":d("paragraph"),u("11");break}},[a]),F.jsxs(F.Fragment,{children:[F.jsx("input",{title:"Font Size",type:"number",value:l,disabled:e,readOnly:!0,className:"toolbar-item font-size-input",min:zy,max:By,onChange:b,onBlur:C}),F.jsx(Fy,{}),i&&i.heading?F.jsxs("div",{title:$r[g],className:"symbol-dropdown cust-head-dropDown",children:[F.jsxs(jd,{disabled:e,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+g,buttonLabel:$r[g],children:[F.jsxs(Er,{className:`item ${g==="paragraph"?"active":""}`,onClick:()=>S("paragraph"),children:[F.jsx("i",{className:"icon paragraph"}),F.jsx("span",{className:"text",children:$r.paragraph})]}),i.heading&&i.heading.find(v=>v.title==="Heading1")&&F.jsxs(Er,{className:`item ${g==="h1"?"active":""}`,onClick:()=>S("h1"),children:[F.jsx("i",{className:"icon h1"}),F.jsx("span",{className:"text",children:$r.h1})]}),i.heading&&i.heading.find(v=>v.title==="Heading2")&&F.jsxs(Er,{className:`item ${g==="h2"?"active":""}`,onClick:()=>S("h2"),children:[F.jsx("i",{className:"icon h2"}),F.jsx("span",{className:"text",children:$r.h2})]}),i.heading&&i.heading.find(v=>v.title==="Heading3")&&F.jsxs(Er,{className:`item ${g==="h3"?"active":""}`,onClick:()=>S("h3"),children:[F.jsx("i",{className:"icon h3"}),F.jsx("span",{className:"text",children:$r.h3})]}),i.heading&&i.heading.find(v=>v.title==="Heading4")&&F.jsxs(Er,{className:`item ${g==="h4"?"active":""}`,onClick:()=>S("h4"),children:[F.jsx("i",{className:"icon h4"}),F.jsx("span",{className:"text",children:$r.h4})]}),i.heading&&i.heading.find(v=>v.title==="Heading5")&&F.jsxs(Er,{className:`item ${g==="h5"?"active":""}`,onClick:()=>S("h5"),children:[F.jsx("i",{className:"icon h5"}),F.jsx("span",{className:"text",children:$r.h5})]})]}),F.jsx(Fy,{})]}):""]})},Pl="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGQ9Ik0wIDI1NkMwIDExNC42IDExNC42IDAgMjU2IDBzMjU2IDExNC42IDI1NiAyNTYtMTE0LjYgMjU2LTI1NiAyNTZTMCAzOTcuNCAwIDI1NnptMTc1LTQ3LjkgNDcuMSA0N0wxNzUgMzAzYy05LjMgOS40LTkuMyAyNC42IDAgMzMuMSA5LjQgMTAuMiAyNC42IDEwLjIgMzMuMSAwbDQ3LTQ2LjIgNDcuOSA0Ni4yYzkuNCAxMC4yIDI0LjYgMTAuMiAzMy4xIDAgMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMWwtNDYuMi00Ny45IDQ2LjItNDdjMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMS04LjUtOS4zLTIzLjctOS4zLTMzLjEgMGwtNDcuOSA0Ny4xLTQ3LTQ3LjFjLTguNS05LjMtMjMuNy05LjMtMzMuMSAwLTkuMyA5LjQtOS4zIDI0LjYgMCAzMy4xeiIvPjwvc3ZnPg==";function US({onClose:n}){const[e,t]=U.useState("4"),[r,i]=U.useState("4"),[s,o]=U.useState(!0);U.useState();const[a]=$t(),l=()=>{!e||!r||(a.update(()=>{const g=Am(e,r,!0);tm(g)}),n==null||n())},u=()=>{o(!1),n==null||n()};return F.jsx(F.Fragment,{children:s&&F.jsx("div",{className:"modal-overlay",children:F.jsxs("div",{className:"modal-content",children:[F.jsx("h3",{children:"Select Table Dimensions"}),F.jsx("button",{className:"modal-buttons-close",onClick:()=>u(),children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[F.jsx("label",{children:"Rows"}),F.jsx("input",{type:"number",value:e,onChange:g=>t(Number(g.target.value))})]}),F.jsxs("div",{className:"select-table-container",children:[F.jsx("label",{children:"Column"}),F.jsx("input",{type:"number",value:r,onChange:g=>i(Number(g.target.value))})]}),F.jsx("div",{children:F.jsx("div",{className:"modal-buttons",children:F.jsx("button",{className:"toolbar-item",onClick:l,children:"Confirm"})})})]})})})}const HS=[{letter:"",uppercase:"A",lowercase:"α"},{letter:"Beta",uppercase:"Β",lowercase:"β"},{letter:"Gamma",uppercase:"Γ",lowercase:"γ"},{letter:"Delta",uppercase:"Δ",lowercase:"δ"},{letter:"Epsilon",uppercase:"Ε",lowercase:"ε"},{letter:"Zeta",uppercase:"Ζ",lowercase:"ζ"},{letter:" Eta ",uppercase:"Η",lowercase:"η"},{letter:"Theta",uppercase:"Θ",lowercase:"θ"},{letter:"Iota",uppercase:"Ι",lowercase:"ι"},{letter:"Kappa",uppercase:"Κ",lowercase:"κ"}];function WS(){const[n]=$t(),[e,t]=U.useState(!1),r=i=>{n.update(()=>{var o;const s=ge();if(he(s)){const a=s.anchor.getNode();let l="inherit";if(a instanceof Ni){const g=a.getStyle();l=((o=g==null?void 0:g.match(/font-size:\s*(\S+);/))==null?void 0:o[1])||l}const u=Bt(i);s.insertNodes([u])}}),t(!1)};return F.jsx("div",{title:"Symbols",className:"symbol-dropdown cust-head-dropDown",children:F.jsx(jd,{buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"For appying Symbols",buttonLabel:"Symbols",children:F.jsx("div",{className:"symbol-Flex-container",children:HS.map(({letter:i,uppercase:s,lowercase:o})=>F.jsxs("div",{className:"symbol-items",children:[F.jsx(Er,{className:"terr",onClick:()=>r(o),children:o}),F.jsx(Er,{className:"terr",onClick:()=>r(s),children:s})]},i))})})})}const $S=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function YS(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function Fl(){return function(n){const[e]=$t(),t=U.useMemo(()=>n(e),[e,n]),r=U.useRef(t.initialValueFn()),[i,s]=U.useState(r.current);return $S(()=>{const{initialValueFn:o,subscribe:a}=t,l=o();return r.current!==l&&(r.current=l,s(l)),a(u=>{r.current=u,s(u)})},[t,n]),i}(YS)}const Uy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNCAxMkgyME0xMiA0VjIwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPg==",Hy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNiAxMkwxOCAxMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4=";var VS=typeof global=="object"&&global&&global.Object===Object&&global;const qS=VS;var KS=typeof self=="object"&&self&&self.Object===Object&&self,GS=qS||KS||Function("return this")();const Wy=GS;var XS=Wy.Symbol;const zl=XS;var $y=Object.prototype,JS=$y.hasOwnProperty,ZS=$y.toString,Yo=zl?zl.toStringTag:void 0;function QS(n){var e=JS.call(n,Yo),t=n[Yo];try{n[Yo]=void 0;var r=!0}catch{}var i=ZS.call(n);return r&&(e?n[Yo]=t:delete n[Yo]),i}var eT=Object.prototype,tT=eT.toString;function nT(n){return tT.call(n)}var rT="[object Null]",iT="[object Undefined]",Yy=zl?zl.toStringTag:void 0;function sT(n){return n==null?n===void 0?iT:rT:Yy&&Yy in Object(n)?QS(n):nT(n)}function oT(n){return n!=null&&typeof n=="object"}var aT="[object Symbol]";function lT(n){return typeof n=="symbol"||oT(n)&&sT(n)==aT}var cT=/\s/;function uT(n){for(var e=n.length;e--&&cT.test(n.charAt(e)););return e}var dT=/^\s+/;function fT(n){return n&&n.slice(0,uT(n)+1).replace(dT,"")}function Pd(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Vy=0/0,hT=/^[-+]0x[0-9a-f]+$/i,gT=/^0b[01]+$/i,pT=/^0o[0-7]+$/i,mT=parseInt;function qy(n){if(typeof n=="number")return n;if(lT(n))return Vy;if(Pd(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Pd(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=fT(n);var t=gT.test(n);return t||pT.test(n)?mT(n.slice(2),t?2:8):hT.test(n)?Vy:+n}var yT=function(){return Wy.Date.now()};const Fd=yT;var _T="Expected a function",bT=Math.max,wT=Math.min;function vT(n,e,t){var r,i,s,o,a,l,u=0,g=!1,d=!1,f=!0;if(typeof n!="function")throw new TypeError(_T);e=qy(e)||0,Pd(t)&&(g=!!t.leading,d="maxWait"in t,s=d?bT(qy(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function m(N){var h=r,I=i;return r=i=void 0,u=N,o=n.apply(I,h),o}function y(N){return u=N,a=setTimeout(S,e),g?m(N):o}function b(N){var h=N-l,I=N-u,O=e-h;return d?wT(O,s-I):O}function C(N){var h=N-l,I=N-u;return l===void 0||h>=e||h<0||d&&I>=s}function S(){var N=Fd();if(C(N))return A(N);a=setTimeout(S,b(N))}function A(N){return a=void 0,f&&r?m(N):(r=i=void 0,o)}function v(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function k(){return a===void 0?o:A(Fd())}function T(){var N=Fd(),h=C(N);if(r=arguments,i=this,l=N,h){if(a===void 0)return y(l);if(d)return clearTimeout(a),a=setTimeout(S,e),m(l)}return a===void 0&&(a=setTimeout(S,e)),o}return T.cancel=v,T.flush=k,T}function xT(n,e,t){const r=U.useRef(null);return r.current=n,U.useMemo(()=>vT((...i)=>{r.current&&r.current(...i)},e,{maxWait:t}),[e,t])}const Ky=20;function CT({anchorElem:n}){const[e]=$t(),t=Fl(),[r,i]=U.useState(!1),[s,o]=U.useState(!1),[a,l]=U.useState(!1),[u,g]=U.useState({}),d=U.useRef(new Set),f=U.useRef(null),m=xT(S=>{const{isOutside:A,tableDOMNode:v}=ST(S);if(A){i(!1),o(!1);return}if(!v)return;f.current=v;let k=null,T=null,N=null;if(e.update(()=>{var I;const h=Pt(v);if(Ue(h)){const O=it(h,j=>At(j));if(!At(O))return;if(N=e.getElementByKey(O==null?void 0:O.getKey()),N){const j=O.getChildrenSize(),P=(I=O.getChildAtIndex(0))==null?void 0:I.getChildrenSize(),q=Rm(h),G=Lm(h);q===j-1?k=h:G===P-1&&(T=h)}}}),N){const{width:h,y:I,right:O,left:j,bottom:P,height:q}=N.getBoundingClientRect(),{y:G,left:ne}=n.getBoundingClientRect();k?(o(!1),i(!0),g({height:Ky,left:j-ne,top:P-G+25,width:h})):T&&(o(!0),i(!1),g({height:q,left:O-ne+10,top:I-G-2,width:Ky}))}},50,250),y=U.useMemo(()=>new ResizeObserver(()=>{i(!1),o(!1)}),[]);U.useEffect(()=>{if(a)return document.addEventListener("mousemove",m),()=>{i(!1),o(!1),m.cancel(),document.removeEventListener("mousemove",m)}},[a,m]),U.useEffect(()=>Kn(e.registerMutationListener(Tr,S=>{e.getEditorState().read(()=>{for(const[A,v]of S){const k=e.getElementByKey(A);switch(v){case"created":d.current.add(A),l(d.current.size>0),k&&y.observe(k);break;case"destroyed":d.current.delete(A),l(d.current.size>0),y.disconnect(),d.current.forEach(T=>{const N=e.getElementByKey(T);N&&y.observe(N)});break}}})})),[e,y]);const b=S=>{e.update(()=>{if(f.current){const A=Pt(f.current);A==null||A.selectEnd(),S?(Ux(),i(!1)):(Hx(),o(!1))}})},C=S=>{e.update(()=>{if(f.current){const A=Pt(f.current);A==null||A.selectEnd(),S?(Wx(),i(!1)):($x(),o(!1))}})};return t?F.jsxs(F.Fragment,{children:[r&&F.jsxs("div",{children:[F.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...u,flex:"50%",padding:"20px"},onClick:()=>b(!0),children:F.jsx("img",{src:Uy,height:14,width:14,style:{backgroundColor:"#90EE90",marginLeft:"-3px",borderRadius:"20px"}})}),F.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...u,flex:"50%"},onClick:()=>C(!0),children:F.jsx("img",{src:Hy,height:14,width:14,style:{backgroundColor:"#FFCCCB",marginLeft:"-3px",borderRadius:"20px"}})})]}),s&&F.jsxs("div",{className:"table-add-row-flex-container",children:[F.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...u,flex:"50%",padding:"20px"},onClick:()=>b(!1),children:F.jsx("img",{src:Uy,height:14,width:14,style:{backgroundColor:"#90EE90",marginLeft:"3px",borderRadius:"20px",border:"green"}})}),F.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...u,flex:"30%"},onClick:()=>C(!1),children:F.jsx("img",{src:Hy,height:14,width:14,style:{backgroundColor:"#FFCCCB",marginLeft:"-3px",borderRadius:"20px",border:"green"}})})]})]}):null}function ST(n){const e=n.target;if(e&&e instanceof HTMLElement){const t=e.closest("td.PlaygroundEditorTheme__tableCell, th.PlaygroundEditorTheme__tableCell");return{isOutside:!(t||e.closest("button.PlaygroundEditorTheme__tableAddRows")||e.closest("button.PlaygroundEditorTheme__tableAddColumns")||e.closest("div.TableCellResizer__resizer")),tableDOMNode:t}}else return{isOutside:!0,tableDOMNode:null}}function TT({anchorElem:n=document.body}){return Fl()?In.createPortal(F.jsx(CT,{anchorElem:n}),n):null}const c1="";function ET({onClose:n,children:e,title:t,closeOnClickOutside:r}){const i=U.useRef(null);return U.useEffect(()=>{i.current!==null&&i.current.focus()},[]),U.useEffect(()=>{let s=null;const o=u=>{u.key==="Escape"&&n()},a=u=>{const g=u.target;i.current!==null&&!i.current.contains(g)&&r&&n()},l=i.current;return l!==null&&(s=l.parentElement,s!==null&&s.addEventListener("click",a)),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),s!==null&&(s==null||s.removeEventListener("click",a))}},[r,n]),F.jsx("div",{className:"Modal__overlay",role:"dialog",children:F.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:i,children:[F.jsx("h2",{className:"Modal__title",children:t}),F.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:n,children:"X"}),F.jsx("div",{className:"Modal__content",children:e})]})})}function kT({onClose:n,children:e,title:t,closeOnClickOutside:r=!1}){return In.createPortal(F.jsx(ET,{onClose:n,title:t,closeOnClickOutside:r,children:e}),document.body)}function Gy(){const[n,e]=U.useState(null),t=U.useCallback(()=>{e(null)},[]),r=U.useMemo(()=>{if(n===null)return null;const{title:s,content:o,closeOnClickOutside:a}=n;return F.jsx(kT,{onClose:t,title:s,closeOnClickOutside:a,children:o})},[n,t]),i=U.useCallback((s,o,a=!1)=>{e({closeOnClickOutside:a,content:o(t),title:s})},[t]);return[r,i]}const NT="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxpdmVsbG9fMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5zdDB7ZmlsbDojNDFBNUVFO30gLnN0MXtmaWxsOiMyQjdDRDM7fSAuc3Qye2ZpbGw6IzE4NUFCRDt9IC5zdDN7ZmlsbDojMTAzRjkxO30gLnN0NHtvcGFjaXR5OjAuMTtlbmFibGUtYmFja2dyb3VuZDpuZXcgO30gLnN0NXtvcGFjaXR5OjAuMjtlbmFibGUtYmFja2dyb3VuZDpuZXcgO30gLnN0NntmaWxsOnVybCgjU1ZHSURfMV8pO30gLnN0N3tmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTQ5MC4xNywxOS4ySDE0MC45Yy0xMi4wNSwwLTIxLjgzLDkuNzItMjEuODMsMjEuN2wwLDB2OTYuN2wyMDIuNDIsNTkuMkw1MTIsMTM3LjZWNDAuOQlDNTEyLDI4LjkxLDUwMi4yMywxOS4yLDQ5MC4xNywxOS4yTDQ5MC4xNywxOS4yeiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik01MTIsMTM3LjZIMTE5LjA3VjI1NmwyMDIuNDIsMzUuNTJMNTEyLDI1NlYxMzcuNnoiLz48cGF0aCBjbGFzcz0ic3QyIiBkPSJNMTE5LjA3LDI1NnYxMTguNGwxOTAuNTEsMjMuNjhMNTEyLDM3NC40VjI1NkgxMTkuMDd6Ii8+PHBhdGggY2xhc3M9InN0MyIgZD0iTTE0MC45LDQ5Mi44aDM0OS4yOGMxMi4wNSwwLDIxLjgzLTkuNzIsMjEuODMtMjEuN2wwLDB2LTk2LjdIMTE5LjA3djk2LjcJQzExOS4wNyw0ODMuMDksMTI4Ljg0LDQ5Mi44LDE0MC45LDQ5Mi44TDE0MC45LDQ5Mi44eiIvPjxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik0yNjMuOTQsMTEzLjkySDExOS4wN3YyOTZoMTQ0Ljg3YzEyLjA0LTAuMDQsMjEuNzktOS43MywyMS44My0yMS43di0yNTIuNglDMjg1LjczLDEyMy42NSwyNzUuOTgsMTEzLjk2LDI2My45NCwxMTMuOTJ6Ii8+PHBhdGggY2xhc3M9InN0NSIgZD0iTTI1Mi4wNCwxMjUuNzZIMTE5LjA3djI5NmgxMzIuOTdjMTIuMDQtMC4wNCwyMS43OS05LjczLDIxLjgzLTIxLjd2LTI1Mi42CUMyNzMuODIsMTM1LjQ5LDI2NC4wNywxMjUuOCwyNTIuMDQsMTI1Ljc2eiIvPjxwYXRoIGNsYXNzPSJzdDUiIGQ9Ik0yNTIuMDQsMTI1Ljc2SDExOS4wN3YyNzIuMzJoMTMyLjk3YzEyLjA0LTAuMDQsMjEuNzktOS43MywyMS44My0yMS43VjE0Ny40NglDMjczLjgyLDEzNS40OSwyNjQuMDcsMTI1LjgsMjUyLjA0LDEyNS43NnoiLz48cGF0aCBjbGFzcz0ic3Q1IiBkPSJNMjQwLjEzLDEyNS43NkgxMTkuMDd2MjcyLjMyaDEyMS4wNmMxMi4wNC0wLjA0LDIxLjc5LTkuNzMsMjEuODMtMjEuN1YxNDcuNDYJQzI2MS45MSwxMzUuNDksMjUyLjE3LDEyNS44LDI0MC4xMywxMjUuNzZ6Ii8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8xXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI0NS44MTgzIiB5MT0iLTEwODMuNDkxNiIgeDI9IjIxNi4xMzYxIiB5Mj0iLTc4OC41MDgyIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMCAxMTkyKSI+PHN0b3Agb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojMjM2OEM0Ii8+PHN0b3Agb2Zmc2V0PSIwLjUiIHN0eWxlPSJzdG9wLWNvbG9yOiMxQTVEQkUiLz48c3RvcCBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiMxMTQ2QUMiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGNsYXNzPSJzdDYiIGQ9Ik0yMS44MywxMjUuNzZoMjE4LjNjMTIuMDUsMCwyMS44Myw5LjcyLDIxLjgzLDIxLjd2MjE3LjA4YzAsMTEuOTktOS43NywyMS43LTIxLjgzLDIxLjdIMjEuODMJQzkuNzcsMzg2LjI0LDAsMzc2LjUyLDAsMzY0LjU0VjE0Ny40NkMwLDEzNS40OCw5Ljc3LDEyNS43NiwyMS44MywxMjUuNzZ6Ii8+PHBhdGggY2xhc3M9InN0NyIgZD0iTTg5LjU2LDI5Mi4yMWMwLjQzLDMuMzUsMC43MSw2LjI2LDAuODUsOC43NmgwLjVjMC4xOS0yLjM3LDAuNTktNS4yMiwxLjE5LTguNTZjMC42LTMuMzQsMS4xNS02LjE2LDEuNjMtOC40NwlsMjIuOTYtOTguNDloMjkuNjhsMjMuODEsOTcuMDFjMS4zOCw2LjAzLDIuMzcsMTIuMTUsMi45NiwxOC4zaDAuMzljMC40NC01Ljk3LDEuMjctMTEuOSwyLjQ4LTE3Ljc2bDE4Ljk5LTk3LjZoMjcuMDIJbC0zMy4zNiwxNDEuMTNIMTU3LjFsLTIyLjYyLTkzLjQ3Yy0wLjY1LTIuNjktMS40LTYuMi0yLjIzLTEwLjUzcy0xLjMzLTcuNDgtMS41NC05LjQ3aC0wLjM5Yy0wLjI2LDIuMy0wLjc3LDUuNzEtMS41NCwxMC4yMwljLTAuNzYsNC41Mi0xLjM3LDcuODctMS44MywxMC4wNGwtMjEuMjcsOTMuMTdoLTMyLjFMNDAuMDQsMTg1LjQ2aDI3LjVsMjAuNjgsOTguNjlDODguNywyODYuMTcsODkuMTQsMjg4Ljg3LDg5LjU2LDI5Mi4yMXoiLz48L3N2Zz4=",MT=({htmlPasteModalOpen:n,onlUser:e,collabApiKey:t,sethtmlPasteModalOpen:r})=>{const i=U.useRef(null),[s,o]=U.useState(""),[a,l]=U.useState();$t();const u=()=>{l({root:{type:"root",version:1,children:[{children:[],direction:"ltr",format:"",indent:0,type:"text",version:1}],direction:"ltr",format:"",indent:0}}),o("")};U.useEffect(()=>{u()},[]);const g=()=>{r(!1),o(" "),u()},d=v=>{const k=/display:\s*([^;]+);/,T=v.match(k);if(T)return T[1]};function f(){const[v]=$t(),k=(N,h)=>{v.update(()=>{const I=_t(),O=Bt(`${N}`);O.setStyle(h.style),O.setFormat(h.format),I.append(O),v.getRootElement()&&N&&N.length>3&&v.getEditorState().read(()=>dt()).append(I)})},T=()=>{y(s).root.children.map(h=>{h&&h.text&&h.text.trim("")&&h.text.trim("").length>1&&h.style&&h.style.length>10&&d(h.style)==="block"&&k(h.text.trim(""),h)}),g()};return F.jsx("button",{className:`green-button-paste ${s.length>100?"":"disable-btn"}`,onClick:T,children:"Insert Node"})}function m(v,k){const T=/font-weight:\s*([a-zA-Z0-9\-]+);/,N=/text-decoration:\s*([^;]+?)(?=\s*;|\s*$)/,h=/font-style:\s*([a-zA-Z0-9\-]+);/,I=/font-size:\s*([\d.]+(?:px|pt|em|rem|%)?)/,O=/color:\s*([^;]+)/,j=v.match(T),P=v.match(N),q=v.match(h),G=v.match(I),ne=v.match(O),oe=j?j[1]:null,ue=P?P[1]:null,fe=q?q[1]:null,Ee=G?G[1]:null,be=ne?ne[1]:null;let de={"font-weight":oe&&oe!==null?oe:"none","text-decoration":ue&&ue!==null?ue:"none","font-style":fe&&fe!==null?fe:"none","font-size":Ee&&Ee!==null?"11px":"none",display:["span","table","tbody","tr","td"].includes(k)?"block":"none",color:be&&be!=="transparent"?be:"black"};function xe(ve){return Object.entries(ve).map(([Fe,Ae])=>`${Fe}: ${Ae};`).join(" ")}return{cssString:xe(de),fontSize:Ee&&Ee!==null?Ee:"none",fontWeight:oe&&oe!==null?oe:"none",fontStyle:fe&&fe!==null?fe:"none",textDecoration:ue&&ue!==null?ue:"none"}}function y(v){const N=new DOMParser().parseFromString(v,"text/html").querySelectorAll("*"),h=Array.from(N).map(O=>({elemText:O.innerText,tagName:O.tagName.toLowerCase(),style:O.getAttribute("style")||""}));let I=a;return h.map(O=>{let j=m(O.style,O.tagName);const{cssString:P,fontSize:q,fontWeight:G,textDecoration:ne,fontStyle:oe}=j||{};if(O.style&&O.style.length>0&&O.elemText.trim(" ").length&&q!=="none"&&G!==null&&ne!==null&&oe!==null){let ue=G==="bold"&&oe==="italic"&&ne==="underline line-through"?15:ne==="underline line-through"?12:oe==="italic"&&ne=="line-through"?6:oe==="italic"&&ne==="underline"?10:G==="bold"&&ne==="line-through"?5:G==="bold"&&ne==="underline"?9:G==="bold"&&oe==="italic"?3:G==="bold"?1:oe==="italic"?2:O.style.includes("text-decoration: underline")?8:O.style.includes("text-decoration: line-through")?4:0;I.root.children.push({detail:0,format:ue,mode:"normal",style:`${P}`,text:`${O.elemText}`,type:"text",version:1})}}),I}const b=v=>{if(v){v.preventDefault();const T=(v.clipboardData||window.clipboardData).getData("text/html");T&&o(T)}},C=()=>{o("")};U.useEffect(()=>()=>{o(" "),console.log("cleaned up")},[]);const S=()=>{r(!0)},A=()=>{r(!1),o("")};return F.jsxs(F.Fragment,{children:[F.jsx("button",{title:"MS-Word content paste",className:"toolbar-item space insert-ms-word-btn",onClick:S,children:F.jsx("img",{src:NT,height:16,width:16})}),e&&e.length>0?n&&F.jsx("div",{className:"modal-overlay",children:F.jsxs("div",{className:"modal-content custom-paste-modal-content",children:[F.jsx("h3",{children:"Paste MS Word Content below"}),F.jsx("button",{className:"modal-buttons-close",onClick:A,children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[s.length>100,F.jsx("textarea",{onPaste:b,className:s&&s.length>100?"small-paste-area":"enlarge-paste-area"}),F.jsx("div",{contentEditable:!0,className:s&&s.length>100?"enlarge-paste-area":"small-paste-area",ref:i,dangerouslySetInnerHTML:{__html:s}})]}),F.jsx("div",{children:F.jsxs("div",{className:"modal-buttons",children:[F.jsx("button",{className:`red-button-paste ${s.length>100?"":"disable-btn"}`,onClick:C,children:"Reset"}),F.jsx(f,{})]})})]})}):n&&F.jsx("div",{className:"modal-overlay",children:t?F.jsxs("div",{className:"modal-content custom-paste-modal-content",children:[F.jsx("h3",{children:"Paste MS Word Content below"}),F.jsx("button",{className:"modal-buttons-close",onClick:A,children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[s.length>100,F.jsx("div",{className:"text-area-loading",children:"Loading..."})]})]}):F.jsxs("div",{className:"modal-content custom-paste-modal-content",children:[F.jsx("h3",{children:"Paste MS Word Content below"}),F.jsx("button",{className:"modal-buttons-close",onClick:A,children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[s.length>100,F.jsx("textarea",{onPaste:b,className:s&&s.length>100?"small-paste-area":"enlarge-paste-area"}),F.jsx("div",{contentEditable:!0,className:s&&s.length>100?"enlarge-paste-area":"small-paste-area",ref:i,dangerouslySetInnerHTML:{__html:s}})]}),F.jsx("div",{children:F.jsxs("div",{className:"modal-buttons",children:[F.jsx("button",{className:`red-button-paste ${s.length>100?"":"disable-btn"}`,onClick:C,children:"Reset"}),F.jsx(f,{})]})})]})})]})},DT="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktdGFibGUiPjxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz48L3N2Zz4=",AT="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0naXNvLTg4NTktMSc/Pgo8IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIGZpbGw9IiMwMDAwMDAiIGhlaWdodD0iODAwcHgiIHdpZHRoPSI4MDBweCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNTAgMzUwIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzUwIDM1MCI+CiAgPHBhdGggZD0iTTUsMzUwaDM0MFYwSDVWMzUweiBNMjUsMzMwdi02Mi4yMTJoMzAwVjMzMEgyNXogTTE3OS41MDksMjQ3LjQ5NEg2MC40OTFMMTIwLDE3MS4yNTNMMTc5LjUwOSwyNDcuNDk0eiAgIE0xNzYuNDQzLDIxMS4wNjFsMzMuNjgzLTMyLjMyM2w3NC42NTQsNjkuMDVoLTc5LjY3TDE3Ni40NDMsMjExLjA2MXogTTMyNSw5Ni41NzRjLTYuMzg0LDIuMjY5LTEzLjA4NSwzLjQyNi0yMCwzLjQyNiAgYy0zMy4wODQsMC02MC0yNi45MTYtNjAtNjBjMC02LjkxMSwxLjE1Ni0xMy42MTIsMy40MjItMjBIMzI1Vjk2LjU3NHogTTI1LDIwaDIwMi41MTZDMjI1Ljg0NSwyNi40NzksMjI1LDMzLjE2NiwyMjUsNDAgIGMwLDQ0LjExMiwzNS44ODgsODAsODAsODBjNi44MzcsMCwxMy41MjMtMC44NDYsMjAtMi41MTh2MTMwLjMwNmgtMTAuNzY3bC0xMDQuMzU5LTk2LjUyNmwtNDUuODAxLDQzLjk1MUwxMjAsMTM4Ljc0OCAgbC04NS4xMDksMTA5LjA0SDI1VjIweiIvPgo8L3N2Zz4=",Vo=1;function js(){return F.jsx("div",{className:"divider"})}function IT({onlUser:n,styleConfig:e,collabApiKey:t}){const[r]=$t(),i=U.useRef(null),[s,o]=U.useState(!1),[a,l]=U.useState(!1),[u,g]=U.useState(!1),[d,f]=U.useState(!1),[m,y]=U.useState(!1),[b,C]=U.useState(!1),[S,A]=U.useState(!1),[v,k]=U.useState(!1),[T,N]=U.useState("11px"),[h,I]=U.useState(()=>r.isEditable()),[O,j]=U.useState(""),[P,q]=U.useState(""),[G,ne]=U.useState(""),[oe,ue]=Gy(),[fe,Ee]=U.useState(!1),be=U.useCallback(()=>{const xe=ge();he(xe)&&(g(xe.hasFormat("bold")),f(xe.hasFormat("italic")),y(xe.hasFormat("underline")),C(xe.hasFormat("strikethrough")),A(xe.hasFormat("subscript")),k(xe.hasFormat("superscript")))},[]),ae=xe=>{r.update(()=>{const Te=ge();he(Te)&&Te.getNodes().forEach(Fe=>{if(me(Fe)){let Ne=Fe.getStyle()||"";for(const[ze,Ce]of Object.entries(xe)){const Pe=new RegExp(`${ze}:\\s*[^;]+;?`,"g");Ne=Ne.replace(Pe,""),Ne+=`${ze}: ${Ce}; `}Fe.setStyle(Ne.trim())}})})},de=U.useCallback(()=>{var Te,ve;const xe=ge();if(he(xe)){const Fe=((ve=(Te=ge())==null?void 0:Te.getNodes()[0])==null?void 0:ve.__style)??"",Ae=["font-weight","font-style","text-decoration"],Ne={};if(Fe.split(";").map(Ce=>Ce.trim()).forEach(Ce=>{const[Pe,ft]=Ce.split(":").map(we=>we.trim());Ae.includes(Pe)&&(Ne[Pe]=ft)}),Ne["font-weight"]==="bold"){const Ce=ge();he(Ce)&&u===Ce.hasFormat("bold")&&ae({"font-weight":"400"})}else{const Ce=ge();he(Ce)&&u!==Ce.hasFormat("bold")&&ae({"font-weight":"bold"})}if(Ne["font-style"]==="italic"){const Ce=ge();he(Ce)&&d===Ce.hasFormat("italic")&&ae({"font-style":"normal"})}else{const Ce=ge();he(Ce)&&d!==Ce.hasFormat("italic")&&ae({"font-style":"italic"})}if(Ne["text-decoration"]==="line-through"){const Ce=ge();he(Ce)&&b===Ce.hasFormat("strikethrough")&&ae({"text-decoration":b?"line-through":"none"})}else{const Ce=ge();he(Ce)&&b!==Ce.hasFormat("strikethrough")&&ae({"text-decoration":b!==Ce.hasFormat("strikethrough")&&m!==Ce.hasFormat("underline")?"underline line-through":b?"none":"line-through"})}if(Ne["text-decoration"]==="underline"){const Ce=ge();he(Ce)&&m===Ce.hasFormat("underline")&&ae({"text-decoration":m?"underline":"none"})}else{const Ce=ge();he(Ce)&&m!==Ce.hasFormat("underline")&&ae({"text-decoration":b!==Ce.hasFormat("strikethrough")&&m!==Ce.hasFormat("underline")?"underline line-through":m?"none":"underline"})}}},[]);return U.useEffect(()=>Kn(r.registerUpdateListener(({editorState:xe})=>{xe.read(()=>{be()})}),r.registerCommand(Hn,(xe,Te)=>{var Ae;j("");const ve=(Ae=ge())==null?void 0:Ae.getNodes()[0].__parent;return r.getEditorState()._nodeMap.forEach((Ne,ze)=>{ze===ve&&ne(Ne.__tag)}),be(),de(),!1},Vo),r.registerCommand($s,xe=>(q(xe.target),de(),!1),Vo),r.registerCommand(xf,xe=>(o(xe),!1),Vo),r.registerCommand(vf,xe=>(l(xe),!1),Vo),r.registerCommand(Ci,xe=>(j("Enter"),!0),Vo)),[r,be,de]),F.jsxs("div",{className:"toolbar",ref:i,children:[F.jsx("button",{title:"Undo",disabled:!s,onClick:()=>{r.dispatchCommand(aa,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:F.jsx("i",{className:"format undo"})}),F.jsx("button",{title:"Redo",disabled:!a,onClick:()=>{r.dispatchCommand(la,void 0)},className:"toolbar-item","aria-label":"Redo",children:F.jsx("i",{className:"format redo"})}),F.jsx(js,{}),F.jsx(BS,{currentElementClick:P,selectionFontSize:T.slice(0,-2),editor:r,disabled:!h,blockType:"paragraph",styleConfig:e,isenterPressed:O,currentElementSelect:G}),F.jsx(js,{}),F.jsx("button",{title:"Bold",onClick:()=>{r.dispatchCommand(mn,"bold")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Bold",children:F.jsx("i",{className:"format bold"})}),F.jsx("button",{title:"Italic",onClick:()=>{r.dispatchCommand(mn,"italic")},className:"toolbar-item spaced "+(d?"active":""),"aria-label":"Format Italics",children:F.jsx("i",{className:"format italic"})}),F.jsx("button",{title:"Underline",onClick:()=>{r.dispatchCommand(mn,"underline")},className:"toolbar-item spaced "+(m?"active":""),"aria-label":"Format Underline",children:F.jsx("i",{className:"format underline"})}),F.jsx("button",{title:"Strikethrough",onClick:()=>{r.dispatchCommand(mn,"strikethrough")},className:"toolbar-item spaced "+(b?"active":""),"aria-label":"Format Strikethrough",children:F.jsx("i",{className:"format strikethrough"})}),F.jsx("button",{title:"SuperScript",onClick:()=>{r.dispatchCommand(mn,"superscript")},className:"toolbar-item spaced "+(v?"active":""),"aria-label":"Format SuperScript",children:F.jsx("img",{src:FS,height:16,width:16,style:{marginTop:"1px"}})}),F.jsx("button",{title:"SubScript",onClick:()=>{r.dispatchCommand(mn,"subscript")},className:"toolbar-item spaced "+(S?"active":""),"aria-label":"Format SubScript",children:F.jsx("img",{src:PS,height:16,width:16,style:{marginTop:"1px"}})}),F.jsx(js,{}),F.jsx("button",{title:"Left Align",onClick:()=>{r.dispatchCommand(Qi,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:F.jsx("i",{className:"format left-align"})}),F.jsx("button",{title:"Center Align",onClick:()=>{r.dispatchCommand(Qi,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:F.jsx("i",{className:"format center-align"})}),F.jsx("button",{title:"Right Align",onClick:()=>{r.dispatchCommand(Qi,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:F.jsx("i",{className:"format right-align"})}),F.jsx("button",{title:"Justify Align",onClick:()=>{r.dispatchCommand(Qi,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:F.jsx("i",{className:"format justify-align"})}),F.jsx(js,{}),F.jsx(WS,{}),F.jsx(MT,{htmlPasteModalOpen:fe,sethtmlPasteModalOpen:Ee,onlUser:n,collabApiKey:t}),F.jsx(js,{}),F.jsx(TT,{}),F.jsxs(jd,{disabled:!h,buttonClassName:"toolbar-item spaced",buttonLabel:"Insert",buttonAriaLabel:"Insert specialized editor node",buttonIconClassName:"icon plus",children:[F.jsx(Er,{onClick:()=>{ue("Insert Image",xe=>F.jsx(xC,{activeEditor:r,onClose:xe}))},className:"item",children:F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[F.jsx("img",{className:"add-toolbar-image-icon",src:AT,alt:"Add Image",style:{height:"16px",width:"16px"}}),F.jsx("span",{className:"text",children:"Image"})]})}),F.jsx(Er,{onClick:()=>{ue("Insert Table",xe=>F.jsx(US,{onClose:xe}))},className:"item",children:F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[F.jsx("img",{className:"add-toolbar-table-icon",src:DT,alt:"Add Table",style:{height:"16px",width:"16px"}}),F.jsx("span",{className:"text",children:"Table"})]})})]}),F.jsx(js,{}),F.jsx("div",{className:"flex-container-onluser",children:n}),oe]})}function RT(){return dt().getTextContent()}function LT(n,e=!0){if(n)return!1;let t=RT();return e&&(t=t.trim()),t===""}function OT(n){if(!LT(n,!1))return!1;const e=dt().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const i=e[r];if(gt(i))return!1;if(ie(i)){if(!us(i)||i.__indent!==0)return!1;const s=i.getChildren(),o=s.length;for(let a=0;a<o;a++){const l=s[r];if(!me(l))return!1}}}return!0}function jT(n){return()=>OT(n)}function PT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}PT(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function FT(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const i=n.getRootElement();if(document.activeElement!==i)return;const s=r.data;if(typeof s=="string"){let o;try{o=JSON.parse(s)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[u,g,d,f,m,y]=l;n.update(()=>{const b=ge();if(he(b)){const C=b.anchor;let S=C.getNode(),A=0,v=0;if(me(S)&&u>=0&&g>=0&&(A=u,v=u+g,b.setTextNodeRange(S,A,S,v)),A===v&&d===""||(b.insertRawText(d),S=C.getNode()),me(S)){A=f,v=f+m;const k=S.getTextContentSize();A=A>k?k:A,v=v>k?k:v,b.setTextNodeRange(S,A,S,v)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const zd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function Xy(n){return n.getEditorState().read(jT(n.isComposing()))}function Bd({contentEditable:n,placeholder:e,ErrorBoundary:t}){const[r]=$t(),i=function(s,o){const[a,l]=U.useState(()=>s.getDecorators());return zd(()=>s.registerDecoratorListener(u=>{In.flushSync(()=>{l(u)})}),[s]),U.useEffect(()=>{l(s.getDecorators())},[s]),U.useMemo(()=>{const u=[],g=Object.keys(a);for(let d=0;d<g.length;d++){const f=g[d],m=F.jsx(o,{onError:b=>s._onError(b),children:F.jsx(U.Suspense,{fallback:null,children:a[f]})}),y=s.getElementByKey(f);y!==null&&u.push(In.createPortal(m,y,f))}return u},[o,a,s])}(r,t);return function(s){zd(()=>Kn(pC(s),FT(s)),[s])}(r),F.jsxs(F.Fragment,{children:[n,F.jsx(zT,{content:e}),i]})}function zT({content:n}){const[e]=$t(),t=function(i){const[s,o]=U.useState(()=>Xy(i));return zd(()=>{function a(){const l=Xy(i);o(l)}return a(),Kn(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),s}(e),r=Fl();return t?typeof n=="function"?n(r):n:null}function Ud(n,e){return Ud=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Ud(n,e)}var Jy={error:null},BT=function(n){var e,t;function r(){for(var s,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(s=n.call.apply(n,[this].concat(a))||this).state=Jy,s.resetErrorBoundary=function(){for(var u,g=arguments.length,d=new Array(g),f=0;f<g;f++)d[f]=arguments[f];s.props.onReset==null||(u=s.props).onReset.apply(u,d),s.reset()},s}t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,Ud(e,t),r.getDerivedStateFromError=function(s){return{error:s}};var i=r.prototype;return i.reset=function(){this.setState(Jy)},i.componentDidCatch=function(s,o){var a,l;(a=(l=this.props).onError)==null||a.call(l,s,o)},i.componentDidUpdate=function(s,o){var a,l,u,g,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=s.resetKeys)===void 0&&(u=[]),(g=f)===void 0&&(g=[]),u.length!==g.length||u.some(function(m,y){return!Object.is(m,g[y])}))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,s.resetKeys,f),this.reset())},i.render=function(){var s=this.state.error,o=this.props,a=o.fallbackRender,l=o.FallbackComponent,u=o.fallback;if(s!==null){var g={error:s,resetErrorBoundary:this.resetErrorBoundary};if(tn.isValidElement(u))return u;if(typeof a=="function")return a(g);if(l)return tn.createElement(l,g);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},r}(tn.Component);function Hd({children:n,onError:e}){return F.jsx(BT,{fallback:F.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}function UT({defaultSelection:n}){const[e]=$t();return U.useEffect(()=>{e.focus(()=>{const t=document.activeElement,r=e.getRootElement();r===null||t!==null&&r.contains(t)||r.focus({preventScroll:!0})},{defaultSelection:n})},[n,e]),null}const HT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function Zy({ariaActiveDescendant:n,ariaAutoComplete:e,ariaControls:t,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:s,ariaLabelledBy:o,ariaMultiline:a,ariaOwns:l,ariaRequired:u,autoCapitalize:g,className:d,id:f,role:m="textbox",spellCheck:y=!0,style:b,tabIndex:C,"data-testid":S,...A}){const[v]=$t(),[k,T]=U.useState(!1),N=U.useCallback(h=>{h&&h.ownerDocument&&h.ownerDocument.defaultView&&v.setRootElement(h)},[v]);return HT(()=>(T(v.isEditable()),v.registerEditableListener(h=>{T(h)})),[v]),F.jsx("div",{...A,"aria-activedescendant":k?n:void 0,"aria-autocomplete":k?e:"none","aria-controls":k?t:void 0,"aria-describedby":r,"aria-expanded":k&&m==="combobox"?!!i:void 0,"aria-label":s,"aria-labelledby":o,"aria-multiline":a,"aria-owns":k?l:void 0,"aria-readonly":!k||void 0,"aria-required":u,autoCapitalize:g,className:d,contentEditable:k,"data-testid":S,id:f,ref:N,role:m,spellCheck:y,style:b,tabIndex:C})}const WT=33,$T=50;function YT({editor:n}){const e=U.useRef(null),t=U.useRef(null),r=U.useRef(null),i=U.useRef(null),[s,o]=U.useState(null),[a,l]=U.useState(null),[u,g]=U.useState(!1),[d,f]=U.useState(null);U.useEffect(()=>n.registerCommand(Hn,T=>{const N=ge(),h=It(N);return u!==h&&g(h),!1},$n));const m=U.useCallback(()=>{l(null),e.current=null,f(null),i.current=null,r.current=null},[]);U.useEffect(()=>{const T=N=>{setTimeout(()=>{const h=N.target;if(d){o({x:N.clientX,y:N.clientY});return}if(!(t.current&&t.current.contains(h))&&e.current!==h){e.current=h;const I=gd(h);I&&a!==I?n.update(()=>{const O=Pt(I.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");const j=xl(O),P=n.getElementByKey(j.getKey());if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=h,r.current=P.getBoundingClientRect(),l(I)}):I==null&&m()}},0)};return document.addEventListener("mousemove",T),()=>{document.removeEventListener("mousemove",T)}},[a,d,n,m]);const y=T=>T==="bottom",b=U.useCallback(T=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");n.update(()=>{const N=Pt(a.elem);if(!Ue(N))throw new Error("TableCellResizer: Table cell node not found.");const h=xl(N),I=Rm(N),O=h.getChildren();if(I>=O.length||I<0)throw new Error("Expected table cell to be inside of table row.");const j=O[I];if(!Yt(j))throw new Error("Expected table row");j.setHeight(T)})},[a,n]),C=U.useCallback(T=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");n.update(()=>{const N=Pt(a.elem);if(!Ue(N))throw new Error("TableCellResizer: Table cell node not found.");const h=xl(N),I=Lm(N),O=h.getChildren();for(let j=0;j<O.length;j++){const P=O[j];if(!Yt(P))throw new Error("Expected table row");const q=P.getChildren(),oe=q.map(fe=>fe.getColSpan()).reduce((fe,Ee)=>{const be=fe[fe.length-1]??0;return fe.push(be+Ee),fe},[]).findIndex(fe=>fe>I);if(oe>=q.length||oe<0)throw new Error("Expected table cell to be inside of table row.");const ue=q[oe];if(!Ue(ue))throw new Error("Expected table cell");ue.setWidth(T)}})},[a,n]),S=U.useCallback(T=>{const N=h=>{if(h.preventDefault(),h.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){const{x:I,y:O}=i.current;if(a===null)return;if(y(T)){const j=a.elem.getBoundingClientRect().height,P=Math.abs(h.clientY-O),q=T==="bottom"&&O>h.clientY;b(Math.max(q?j-P:P+j,WT))}else{const j=getComputedStyle(a.elem);let P=a.elem.clientWidth;P-=parseFloat(j.paddingLeft)+parseFloat(j.paddingRight);const q=Math.abs(h.clientX-I),G=T==="right"&&I>h.clientX;C(Math.max(G?P-q:q+P,$T))}m(),document.removeEventListener("mouseup",N)}};return N},[a,m,C,b]),A=U.useCallback(T=>N=>{if(N.preventDefault(),N.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:N.clientX,y:N.clientY},o(i.current),f(T),document.addEventListener("mouseup",S(T))},[a,S]),k=U.useCallback(()=>{if(a){const{height:T,width:N,top:h,left:I}=a.elem.getBoundingClientRect(),O={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+I}px`,top:`${window.pageYOffset+h+T}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${T}px`,left:`${window.pageXOffset+I+N}px`,top:`${window.pageYOffset+h}px`,width:"10px"}},j=r.current;return d&&s&&j&&(y(d)?(O[d].left=`${window.pageXOffset+j.left}px`,O[d].top=`${window.pageYOffset+s.y}px`,O[d].height="3px",O[d].width=`${j.width}px`):(O[d].top=`${window.pageYOffset+j.top}px`,O[d].left=`${window.pageXOffset+s.x}px`,O[d].width="3px",O[d].height=`${j.height}px`),O[d].backgroundColor="#adf"),O}return{bottom:null,left:null,right:null,top:null}},[a,d,s])();return F.jsx("div",{ref:t,children:a!=null&&!u&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:k.right||void 0,onMouseDown:A("right")}),F.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:k.bottom||void 0,onMouseDown:A("bottom")})]})})}function VT(){const[n]=$t(),e=Fl();return U.useMemo(()=>e?In.createPortal(F.jsx(YT,{editor:n}),document.body):null,[n,e])}const qT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function KT({ignoreHistoryMergeTagChange:n=!0,ignoreSelectionChange:e=!1,onChange:t}){const[r]=$t();return qT(()=>{if(t)return r.registerUpdateListener(({editorState:i,dirtyElements:s,dirtyLeaves:o,prevEditorState:a,tags:l})=>{e&&s.size===0&&o.size===0||n&&l.has("history-merge")||a.isEmpty()||t(i,r,l)})},[r,n,e,t]),null}const GT=[Tr,Ns,Hr,El,Nl,Dl];function XT({userObj:n,styleConfig:e,docId:t,onlUser:r,setonlUser:i,userNamesArr:s,setuserNamesArr:o,savedSpfEditorState:a,setSavedEditorState:l}){const u=new URLSearchParams(window.location.search).get("provider")??"webrtc",[g,d]=U.useState(()=>lx(n)),[f,m]=U.useState([]),y=U.useRef(null),[b,C]=U.useState(null),[S,A]=U.useState(!1),{pageMarginTop:v,pageMarginLeft:k,pageMarginBottom:T,pageMarginRight:N,heading:h}=e||{},[I,O]=U.useState(!0),j={namespace:"React.js Collab Demo",nodes:GT,onError(oe){throw oe},editorPlugins:[],theme:ax,editorState:oe=>{oe.update(()=>{if(I){const fe=new DOMParser().parseFromString(a,"text/html"),Ee=Vm(oe,fe);za(Ee),O(!1)}})}};let P="";const q=()=>{const oe=py(".editor-input").html();oe!==P&&(l(oe),P=oe)},G=U.useCallback(()=>{const oe=b.awareness;let ue=Array.from(oe.getStates().entries()).map(([fe,{color:Ee,name:be}])=>({color:Ee,name:be,userId:fe}));m(ue),ue&&ue.length>0&&ue.map((fe,Ee)=>{let be=r||[],ae=s||[],de=fe.name,xe=F.jsxs("div",{title:fe.name,className:`avatarStyle avatar-color-${Ee+1}`,children:[" ",de&&de[0],de&&de[4]]},fe.name);ae.includes(de)||(ae.push(de),o(ae),be.push(xe),i(be),console.log("nameOfUser ===> ",ae))})},[b]);U.useEffect(()=>{},[]),U.useEffect(()=>{setTimeout(()=>{py(".custom-margin").css({paddingTop:`${v||"16px"}`,paddingRight:`${N||"16px"}`,paddingLeft:`${k||"16px"}`,paddingBottom:`${T||"16px"}`})},3e3)},[]),U.useEffect(()=>{if(b!=null)return b.awareness.on("update",G),()=>b.awareness.off("update",G)},[b,G]);const ne=U.useCallback((oe,ue)=>{const fe=u==="webrtc"?Ox(oe,ue):jx(oe,ue);return fe.on("status",Ee=>{A(Ee.status==="connected"||"connected"in Ee&&Ee.connected===!0)}),setTimeout(()=>C(fe),0),fe},[u]);return F.jsxs("div",{ref:y,children:[F.jsx(RC,{children:F.jsxs(ox,{initialConfig:j,children:[F.jsx(rx,{id:t,providerFactory:ne,shouldBootstrap:!1,username:n?n.userName:"",cursorColor:g.color,cursorsContainerRef:y}),F.jsxs("div",{className:"editor-container",children:[F.jsx(IT,{styleConfig:e,onlUser:r}),F.jsxs("div",{className:"editor-inner",children:[F.jsx(Bd,{contentEditable:F.jsx("div",{className:"custom-margin",children:F.jsx(Zy,{onChange:()=>console.log("11111"),className:"editor-input"})}),placeholder:null,ErrorBoundary:Hd}),F.jsx(UT,{})]})]}),F.jsx(yC,{}),F.jsx(VT,{}),F.jsx(TC,{}),F.jsx(jC,{}),F.jsx(KT,{onChange:q})]})}),F.jsx(jS,{styleConfig:e})]})}const u1="";function JT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ZT=JT(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Qy(n){const e=n.transform();return e!==null?new Set([e]):new Set}function e_({initialEditor:n,children:e,initialNodes:t,initialTheme:r,skipCollabChecks:i}){const s=U.useRef(!1),o=U.useContext(sa);o==null&&ZT(9);const[a,{getTheme:l}]=o,u=U.useMemo(()=>{const m=r||l()||void 0,y=yf(o,m);if(m!==void 0&&(n._config.theme=m),n._parentEditor=a,t)for(let b of t){let C=null,S=null;if(typeof b!="function"){const v=b;b=v.replace,C=v.with,S=v.withKlass||null}const A=n._nodes.get(b.getType());n._nodes.set(b.getType(),{exportDOM:A?A.exportDOM:void 0,klass:b,replace:C,replaceWithKlass:S,transforms:Qy(b)})}else{const b=n._nodes=new Map(a._nodes);for(const[C,S]of b)n._nodes.set(C,{exportDOM:S.exportDOM,klass:S.klass,replace:S.replace,replaceWithKlass:S.replaceWithKlass,transforms:Qy(S.klass)})}return n._config.namespace=a._config.namespace,n._editable=a._editable,[n,y]},[]),{isCollabActive:g,yjsDocMap:d}=mf(),f=i||s.current||d.has(n.getKey());return U.useEffect(()=>{f&&(s.current=!0)},[f]),U.useEffect(()=>a.registerEditableListener(m=>{n.setEditable(m)}),[n,a]),F.jsx(sa.Provider,{value:u,children:!g||f?e:null})}function t_(n,e){return n.getEditorState().read(()=>{const t=tt(e);return t!==null&&t.isSelected()})}function n_(n){const[e]=$t(),[t,r]=U.useState(()=>t_(e,n));return U.useEffect(()=>{let i=!0;const s=e.registerUpdateListener(()=>{i&&r(t_(e,n))});return()=>{i=!1,s()}},[e,n]),[t,U.useCallback(i=>{e.update(()=>{let s=ge();Dt(s)||(s=Zc(),Nt(s)),Dt(s)&&(i?s.add(n):s.delete(n))})},[e,n]),U.useCallback(()=>{e.update(()=>{const i=ge();Dt(i)&&i.clear()})},[e])]}const d1="";function r_({className:n,style:e}){return F.jsx(Zy,{className:n||"ContentEditable__root",style:e})}function Wd(n,e,t){return Math.min(Math.max(n,e),t)}const kt={east:1,north:8,south:2,west:4};function QT({onResizeStart:n,onResizeEnd:e,buttonRef:t,imageRef:r,maxWidth:i,editor:s,showCaption:o,setShowCaption:a,captionsEnabled:l}){const u=U.useRef(null),g=U.useRef({priority:"",value:"default"}),d=U.useRef({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),f=s.getRootElement(),m=f!==null?f.getBoundingClientRect().width-20:100,y=f!==null?f.getBoundingClientRect().height-20:100,b=100,C=100,S=N=>{const h=N===kt.east||N===kt.west,I=N===kt.north||N===kt.south,O=N&kt.north&&N&kt.west||N&kt.south&&N&kt.east,j=h?"ew":I?"ns":O?"nwse":"nesw";f!==null&&f.style.setProperty("cursor",`${j}-resize`,"important"),document.body!==null&&(document.body.style.setProperty("cursor",`${j}-resize`,"important"),g.current.value=document.body.style.getPropertyValue("-webkit-user-select"),g.current.priority=document.body.style.getPropertyPriority("-webkit-user-select"),document.body.style.setProperty("-webkit-user-select","none","important"))},A=()=>{f!==null&&f.style.setProperty("cursor","text"),document.body!==null&&(document.body.style.setProperty("cursor","default"),document.body.style.setProperty("-webkit-user-select",g.current.value,g.current.priority))},v=(N,h)=>{if(!s.isEditable())return;const I=r.current,O=u.current;if(I!==null&&O!==null){N.preventDefault();const{width:j,height:P}=I.getBoundingClientRect(),q=d.current;q.startWidth=j,q.startHeight=P,q.ratio=j/P,q.currentWidth=j,q.currentHeight=P,q.startX=N.clientX,q.startY=N.clientY,q.isResizing=!0,q.direction=h,S(h),n(),O.classList.add("image-control-wrapper--resizing"),I.style.height=`${P}px`,I.style.width=`${j}px`,document.addEventListener("pointermove",k),document.addEventListener("pointerup",T)}},k=N=>{const h=r.current,I=d.current,O=I.direction&(kt.east|kt.west),j=I.direction&(kt.south|kt.north);if(h!==null&&I.isResizing){if(O&&j){let P=Math.floor(I.startX-N.clientX);P=I.direction&kt.east?-P:P;const q=Wd(I.startWidth+P,b,m),G=q/I.ratio;h.style.width=`${q}px`,h.style.height=`${G}px`,I.currentHeight=G,I.currentWidth=q}else if(j){let P=Math.floor(I.startY-N.clientY);P=I.direction&kt.south?-P:P;const q=Wd(I.startHeight+P,C,y);h.style.height=`${q}px`,h.style.maxHeight=`${q}px`,I.currentHeight=q}else{let P=Math.floor(I.startX-N.clientX);P=I.direction&kt.east?-P:P;const q=Wd(I.startWidth+P,b,m);h.style.width=`${q}px`,h.style.maxWidth=`${q}px`,I.currentWidth=q}h&&(h.setAttribute("width",`${I.currentWidth}`),h.setAttribute("height",`${I.currentHeight}`))}},T=()=>{const N=r.current,h=d.current,I=u.current;if(N!==null&&I!==null&&h.isResizing){const O=h.currentWidth,j=h.currentHeight;h.startWidth=0,h.startHeight=0,h.ratio=0,h.startX=0,h.startY=0,h.currentWidth=0,h.currentHeight=0,h.isResizing=!1,I.classList.remove("image-control-wrapper--resizing"),A(),e(O,j),document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",T)}};return F.jsxs("div",{ref:u,children:[F.jsx("div",{className:"image-resizer image-resizer-n",onPointerDown:N=>{v(N,kt.north)}}),F.jsx("div",{className:"image-resizer image-resizer-ne",onPointerDown:N=>{v(N,kt.north|kt.east)}}),F.jsx("div",{className:"image-resizer image-resizer-e",onPointerDown:N=>{v(N,kt.east)}}),F.jsx("div",{className:"image-resizer image-resizer-se",onPointerDown:N=>{v(N,kt.south|kt.east)}}),F.jsx("div",{className:"image-resizer image-resizer-s",onPointerDown:N=>{v(N,kt.south)}}),F.jsx("div",{className:"image-resizer image-resizer-sw",onPointerDown:N=>{v(N,kt.south|kt.west)}}),F.jsx("div",{className:"image-resizer image-resizer-w",onPointerDown:N=>{v(N,kt.west)}}),F.jsx("div",{className:"image-resizer image-resizer-nw",onPointerDown:N=>{v(N,kt.north|kt.west)}})]})}const f1="";function i_({children:n,className:e}){return F.jsx("div",{className:e||"Placeholder__root",children:n})}const Bl={x:0,y:0,width:0,height:0,unit:"px"},Ps=(n,e,t)=>Math.min(Math.max(n,e),t),eE=(...n)=>n.filter(e=>e&&typeof e=="string").join(" "),s_=(n,e)=>n===e||n.width===e.width&&n.height===e.height&&n.x===e.x&&n.y===e.y&&n.unit===e.unit;function Fs(n,e,t){return n.unit==="%"?{...Bl,...n,unit:"%"}:{unit:"%",x:n.x?n.x/e*100:0,y:n.y?n.y/t*100:0,width:n.width?n.width/e*100:0,height:n.height?n.height/t*100:0}}function fi(n,e,t){return n.unit?n.unit==="px"?{...Bl,...n,unit:"px"}:{unit:"px",x:n.x?n.x*e/100:0,y:n.y?n.y*t/100:0,width:n.width?n.width*e/100:0,height:n.height?n.height*t/100:0}:{...Bl,...n,unit:"px"}}function o_(n,e,t,r,i,s=0,o=0,a=r,l=i){const u={...n};let g=Math.min(s,r),d=Math.min(o,i),f=Math.min(a,r),m=Math.min(l,i);e&&(e>1?(g=o?o*e:g,d=g/e,f=a*e):(d=s?s/e:d,g=d*e,m=l/e)),u.y<0&&(u.height=Math.max(u.height+u.y,d),u.y=0),u.x<0&&(u.width=Math.max(u.width+u.x,g),u.x=0);const y=r-(u.x+u.width);y<0&&(u.x=Math.min(u.x,r-g),u.width+=y);const b=i-(u.y+u.height);if(b<0&&(u.y=Math.min(u.y,i-d),u.height+=b),u.width<g&&((t==="sw"||t=="nw")&&(u.x-=g-u.width),u.width=g),u.height<d&&((t==="nw"||t=="ne")&&(u.y-=d-u.height),u.height=d),u.width>f&&((t==="sw"||t=="nw")&&(u.x-=f-u.width),u.width=f),u.height>m&&((t==="nw"||t=="ne")&&(u.y-=m-u.height),u.height=m),e){const C=u.width/u.height;if(C<e){const S=Math.max(u.width/e,d);(t==="nw"||t=="ne")&&(u.y-=S-u.height),u.height=S}else if(C>e){const S=Math.max(u.height*e,g);(t==="sw"||t=="nw")&&(u.x-=S-u.width),u.width=S}}return u}function tE(n,e,t,r){const i={...n};return e==="ArrowLeft"?r==="nw"?(i.x-=t,i.y-=t,i.width+=t,i.height+=t):r==="w"?(i.x-=t,i.width+=t):r==="sw"?(i.x-=t,i.width+=t,i.height+=t):r==="ne"?(i.y+=t,i.width-=t,i.height-=t):r==="e"?i.width-=t:r==="se"&&(i.width-=t,i.height-=t):e==="ArrowRight"&&(r==="nw"?(i.x+=t,i.y+=t,i.width-=t,i.height-=t):r==="w"?(i.x+=t,i.width-=t):r==="sw"?(i.x+=t,i.width-=t,i.height-=t):r==="ne"?(i.y-=t,i.width+=t,i.height+=t):r==="e"?i.width+=t:r==="se"&&(i.width+=t,i.height+=t)),e==="ArrowUp"?r==="nw"?(i.x-=t,i.y-=t,i.width+=t,i.height+=t):r==="n"?(i.y-=t,i.height+=t):r==="ne"?(i.y-=t,i.width+=t,i.height+=t):r==="sw"?(i.x+=t,i.width-=t,i.height-=t):r==="s"?i.height-=t:r==="se"&&(i.width-=t,i.height-=t):e==="ArrowDown"&&(r==="nw"?(i.x+=t,i.y+=t,i.width-=t,i.height-=t):r==="n"?(i.y+=t,i.height-=t):r==="ne"?(i.y+=t,i.width-=t,i.height-=t):r==="sw"?(i.x-=t,i.width+=t,i.height+=t):r==="s"?i.height+=t:r==="se"&&(i.width+=t,i.height+=t)),i}const zs={capture:!0,passive:!1};let nE=0;const hi=class ur extends U.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=U.createRef(),this.mediaRef=U.createRef(),this.initChangeCalled=!1,this.instanceId=`rc-${nE++}`,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{const{crop:t,disabled:r}=this.props,i=this.getBox();if(!t)return;const s=fi(t,i.width,i.height);if(r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const o=e.target.dataset.ord,a=!!o;let l=e.clientX,u=e.clientY,g=s.x,d=s.y;if(o){const f=e.clientX-i.x,m=e.clientY-i.y;let y=0,b=0;o==="ne"||o=="e"?(y=f-(s.x+s.width),b=m-s.y,g=s.x,d=s.y+s.height):o==="se"||o==="s"?(y=f-(s.x+s.width),b=m-(s.y+s.height),g=s.x,d=s.y):o==="sw"||o=="w"?(y=f-s.x,b=m-(s.y+s.height),g=s.x+s.width,d=s.y):(o==="nw"||o=="n")&&(y=f-s.x,b=m-s.y,g=s.x+s.width,d=s.y+s.height),l=g+i.x+y,u=d+i.y+b}this.evData={startClientX:l,startClientY:u,startCropX:g,startCropY:d,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:o},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{const{crop:t,disabled:r,locked:i,keepSelection:s,onChange:o}=this.props,a=this.getBox();if(r||i||s&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=e.clientX-a.x,u=e.clientY-a.y,g={unit:"px",x:l,y:u,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:l,startCropY:u,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(fi(g,a.width,a.height),Fs(g,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{const{crop:t,disabled:r,onChange:i,onDragStart:s}=this.props,o=this.getBox();if(r||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));const{evData:a}=this;a.clientX=e.clientX,a.clientY=e.clientY;let l;a.isResize?l=this.resizeCrop():l=this.dragCrop(),s_(t,l)||i(fi(l,o.width,o.height),Fs(l,o.width,o.height))},this.onComponentKeyDown=e=>{const{crop:t,disabled:r,onChange:i,onComplete:s}=this.props;if(r)return;const o=e.key;let a=!1;if(!t)return;const l=this.getBox(),u=this.makePixelCrop(l),g=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?ur.nudgeStepLarge:e.shiftKey?ur.nudgeStepMedium:ur.nudgeStep;if(o==="ArrowLeft"?(u.x-=g,a=!0):o==="ArrowRight"?(u.x+=g,a=!0):o==="ArrowUp"?(u.y-=g,a=!0):o==="ArrowDown"&&(u.y+=g,a=!0),a){e.cancelable&&e.preventDefault(),u.x=Ps(u.x,0,l.width-u.width),u.y=Ps(u.y,0,l.height-u.height);const d=fi(u,l.width,l.height),f=Fs(u,l.width,l.height);i(d,f),s&&s(d,f)}},this.onHandlerKeyDown=(e,t)=>{const{aspect:r=0,crop:i,disabled:s,minWidth:o=0,minHeight:a=0,maxWidth:l,maxHeight:u,onChange:g,onComplete:d}=this.props,f=this.getBox();if(s||!i)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;const m=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?ur.nudgeStepLarge:e.shiftKey?ur.nudgeStepMedium:ur.nudgeStep,y=fi(i,f.width,f.height),b=tE(y,e.key,m,t),C=o_(b,r,t,f.width,f.height,o,a,l,u);if(!s_(i,C)){const S=Fs(C,f.width,f.height);g(C,S),d&&d(C,S)}},this.onDocPointerDone=e=>{const{crop:t,disabled:r,onComplete:i,onDragEnd:s}=this.props,o=this.getBox();this.unbindDocMove(),!(r||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,s&&s(e),i&&i(fi(t,o.width,o.height),Fs(t,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=()=>{var e;(e=this.componentRef.current)==null||e.scrollTo(0,0)}}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};const{x:t,y:r,width:i,height:s}=e.getBoundingClientRect();return{x:t,y:r,width:i,height:s}}componentDidUpdate(e){const{crop:t,onComplete:r}=this.props;if(r&&!e.crop&&t){const{width:i,height:s}=this.getBox();i&&s&&r(fi(t,i,s),Fs(t,i,s))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,zs),this.document.addEventListener("pointerup",this.onDocPointerDone,zs),this.document.addEventListener("pointercancel",this.onDocPointerDone,zs),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,zs),this.document.removeEventListener("pointerup",this.onDocPointerDone,zs),this.document.removeEventListener("pointercancel",this.onDocPointerDone,zs),this.docMoveBound=!1)}getCropStyle(){const{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,t=this.getBox(),r=this.makePixelCrop(t),i=e.clientX-e.startClientX,s=e.clientY-e.startClientY;return r.x=Ps(e.startCropX+i,0,t.width-r.width),r.y=Ps(e.startCropY+s,0,t.height-r.height),r}getPointRegion(e,t,r,i){const{evData:s}=this,o=s.clientX-e.x,a=s.clientY-e.y;let l;i&&t?l=t==="nw"||t==="n"||t==="ne":l=a<s.startCropY;let u;return r&&t?u=t==="nw"||t==="w"||t==="sw":u=o<s.startCropX,u?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(e,t,r=0,i=0){const s=Math.min(r,e.width),o=Math.min(i,e.height);return!t||!s&&!o?[s,o]:t>1?s?[s,s/t]:[o*t,o]:o?[o*t,o]:[s,s/t]}resizeCrop(){const{evData:e}=this,{aspect:t=0,maxWidth:r,maxHeight:i}=this.props,s=this.getBox(),[o,a]=this.resolveMinDimensions(s,t,this.props.minWidth,this.props.minHeight);let l=this.makePixelCrop(s);const u=this.getPointRegion(s,e.ord,o,a),g=e.ord||u;let d=e.clientX-e.startClientX,f=e.clientY-e.startClientY;(o&&g==="nw"||g==="w"||g==="sw")&&(d=Math.min(d,-o)),(a&&g==="nw"||g==="n"||g==="ne")&&(f=Math.min(f,-a));const m={unit:"px",x:0,y:0,width:0,height:0};u==="ne"?(m.x=e.startCropX,m.width=d,t?(m.height=m.width/t,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY-m.height)):u==="se"?(m.x=e.startCropX,m.y=e.startCropY,m.width=d,t?m.height=m.width/t:m.height=f):u==="sw"?(m.x=e.startCropX+d,m.y=e.startCropY,m.width=Math.abs(d),t?m.height=m.width/t:m.height=f):u==="nw"&&(m.x=e.startCropX+d,m.width=Math.abs(d),t?(m.height=m.width/t,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY+f));const y=o_(m,t,u,s.width,s.height,o,a,r,i);return t||ur.xyOrds.indexOf(g)>-1?l=y:ur.xOrds.indexOf(g)>-1?(l.x=y.x,l.width=y.width):ur.yOrds.indexOf(g)>-1&&(l.y=y.y,l.height=y.height),l.x=Ps(l.x,0,s.width-l.width),l.y=Ps(l.y,0,s.height-l.height),l}renderCropSelection(){const{ariaLabels:e=ur.defaultProps.ariaLabels,disabled:t,locked:r,renderSelectionAddon:i,ruleOfThirds:s,crop:o}=this.props,a=this.getCropStyle();if(o)return U.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!t&&!r&&U.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},U.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),U.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),U.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),U.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"nw"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"n"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"ne"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"e"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"se"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"s"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"sw"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"w"),role:"button"})),i&&U.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:l=>l.stopPropagation()},i(this.state)),s&&U.createElement(U.Fragment,null,U.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),U.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){const t={...Bl,...this.props.crop||{}};return fi(t,e.width,e.height)}render(){const{aspect:e,children:t,circularCrop:r,className:i,crop:s,disabled:o,locked:a,style:l,ruleOfThirds:u}=this.props,{cropIsActive:g,newCropIsBeingDrawn:d}=this.state,f=s?this.renderCropSelection():null,m=eE("ReactCrop",i,g&&"ReactCrop--active",o&&"ReactCrop--disabled",a&&"ReactCrop--locked",d&&"ReactCrop--new-crop",s&&e&&"ReactCrop--fixed-aspect",s&&r&&"ReactCrop--circular-crop",s&&u&&"ReactCrop--rule-of-thirds",!this.dragStarted&&s&&!s.width&&!s.height&&"ReactCrop--invisible-crop",r&&"ReactCrop--no-animate");return U.createElement("div",{ref:this.componentRef,className:m,style:l},U.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),s?U.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},U.createElement("defs",null,U.createElement("mask",{id:`hole-${this.instanceId}`},U.createElement("rect",{width:"100%",height:"100%",fill:"white"}),r?U.createElement("ellipse",{cx:`${s.x+s.width/2}${s.unit}`,cy:`${s.y+s.height/2}${s.unit}`,rx:`${s.width/2}${s.unit}`,ry:`${s.height/2}${s.unit}`,fill:"black"}):U.createElement("rect",{x:`${s.x}${s.unit}`,y:`${s.y}${s.unit}`,width:`${s.width}${s.unit}`,height:`${s.height}${s.unit}`,fill:"black"}))),U.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,f)}};hi.xOrds=["e","w"],hi.yOrds=["n","s"],hi.xyOrds=["nw","ne","se","sw"],hi.nudgeStep=1,hi.nudgeStepMedium=10,hi.nudgeStepLarge=100,hi.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};let rE=hi;const h1="",$d=wi();function iE({altText:n,className:e,src:t,width:r,height:i,maxWidth:s,imageRef:o,startCrop:a,setStartCrop:l,isFocused:u}){const[g,d]=U.useState(null),[f,m]=U.useState(null),[y,b]=U.useState({aspect:1,x:0,y:0,width:100,height:100}),C=()=>{if(g){const T=o.current;if(!T||!g)return;const N=T.naturalWidth/T.width,h=T.naturalHeight/T.height,I=new OffscreenCanvas(g.width*N,g.height*h),O=I.getContext("2d");if(!O)throw new Error("No 2D context available");O.drawImage(T,g.x*N,g.y*h,g.width*N,g.height*h,0,0,g.width*N,g.height*h),I.convertToBlob({type:"image/png"}).then(j=>{const P=URL.createObjectURL(j);m(P),l(!1)})}},S=()=>{a||l(T=>(T===!1&&b({aspect:1,x:0,y:0,width:100,height:100}),!T))},A=U.useRef(null),v=U.useRef(null);U.useEffect(()=>{g&&(A.current=g)},[g]);const k=T=>{v.current&&!v.current.contains(T.target)&&l(!1)};return U.useEffect(()=>(document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}),[]),F.jsxs("div",{ref:v,children:[u&&F.jsx("button",{style:{zIndex:999},className:"image-caption-button",onClick:()=>S(),children:"Crop"}),a&&F.jsx("button",{style:{zIndex:999},className:"image-caption-button",onClick:()=>C(),children:"Apply Crop"}),a?F.jsx(rE,{crop:y,onChange:T=>b(T),onComplete:T=>d(T),children:F.jsx("img",{className:e||void 0,src:f||t,alt:n,ref:o,style:{height:i,maxWidth:s,width:r},draggable:"false"})}):F.jsx("img",{className:e||void 0,src:f||t,alt:n,ref:o,style:{height:i,maxWidth:s,width:r},draggable:"false"})]})}function sE({src:n,altText:e,nodeKey:t,width:r,height:i,maxWidth:s,resizable:o,showCaption:a,caption:l}){const u=U.useRef(null),g=U.useRef(null),[d,f,m]=n_(t),[y,b]=U.useState(!1),[C]=$t(),[S,A]=U.useState(null),[v,k]=U.useState(!1),T=U.useRef(null),N=U.useCallback(ue=>{if(d&&Dt(ge())){ue.preventDefault();const Ee=tt(t);if(kl(Ee))return Ee.remove(),!0}return!1},[d,t]),h=U.useCallback(ue=>{const fe=ge(),Ee=g.current;if(d&&Dt(fe)&&fe.getNodes().length===1){if(a)return Nt(null),ue.preventDefault(),l.focus(),!0;if(Ee!==null&&Ee!==document.activeElement)return ue.preventDefault(),Ee.focus(),!0}return!1},[l,d,a]),I=U.useCallback(ue=>T.current===l||g.current===ue.target?(Nt(null),C.update(()=>{f(!0);const fe=C.getRootElement();fe!==null&&fe.focus()}),!0):!1,[l,C,f]),O=U.useCallback(ue=>{const fe=ue;return y?!0:fe.target===u.current?(fe.shiftKey?f(!d):(m(),f(!0)),!0):!1},[y,d,f,m]),j=U.useCallback(ue=>{C.getEditorState().read(()=>{const fe=ge();ue.target.tagName==="IMG"&&he(fe)&&fe.getNodes().length===1&&C.dispatchCommand($d,ue)})},[C]);U.useEffect(()=>{let ue=!0;const fe=C.getRootElement(),Ee=Kn(C.registerUpdateListener(({editorState:be})=>{ue&&A(be.read(()=>ge()))}),C.registerCommand(Hn,(be,ae)=>(T.current=ae,!1),rn),C.registerCommand($s,O,rn),C.registerCommand($d,O,rn),C.registerCommand(es,be=>be.target===u.current?(be.preventDefault(),!0):!1,rn),C.registerCommand(Ks,N,rn),C.registerCommand(Vs,N,rn),C.registerCommand(Ci,h,rn),C.registerCommand(qs,I,rn));return fe==null||fe.addEventListener("contextmenu",j),()=>{ue=!1,Ee(),fe==null||fe.removeEventListener("contextmenu",j)}},[m,C,y,d,t,N,h,I,O,j,f]);const P=()=>{C.update(()=>{const ue=tt(t);kl(ue)&&ue.setShowCaption(!0)})},q=(ue,fe)=>{setTimeout(()=>{b(!1)},200),C.update(()=>{const Ee=tt(t);kl(Ee)&&Ee.setWidthAndHeight(ue,fe)})},G=()=>{v||b(!0)},ne=d&&Dt(S)&&!y,oe=d||y;return F.jsx(U.Suspense,{fallback:null,children:F.jsxs(F.Fragment,{children:[F.jsx("div",{draggable:ne,children:F.jsx(iE,{className:oe?`focused ${Dt(S)?"draggable":""}`:null,src:n,altText:e,width:r,height:i,maxWidth:s,imageRef:u,startCrop:v,setStartCrop:k,isFocused:oe})}),a&&F.jsx("div",{className:"image-caption-container",children:F.jsx(e_,{initialEditor:l,children:F.jsx(Bd,{contentEditable:F.jsx(r_,{className:"ImageNode__contentEditable"}),placeholder:F.jsx(i_,{className:"ImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:Hd})})}),!v&&o&&Dt(S)&&oe&&F.jsx(QT,{showCaption:a,setShowCaption:P,editor:C,buttonRef:g,maxWidth:s,onResizeStart:v?()=>{}:G,onResizeEnd:v?()=>{}:q,captionsEnabled:!1,imageRef:u})]})})}const oE=Object.freeze(Object.defineProperty({__proto__:null,RIGHT_CLICK_IMAGE_COMMAND:$d,default:sE},Symbol.toStringTag,{value:"Module"})),a_=new Set;function aE(n){if(!a_.has(n))throw new Promise(e=>{const t=new Image;t.src=n,t.onload=()=>{a_.add(n),e(null)}})}function lE({altText:n,className:e,imageRef:t,src:r,width:i,height:s,position:o}){return aE(r),F.jsx("img",{className:e||void 0,src:r,alt:n,ref:t,"data-position":o,style:{display:"block",height:s,width:i},draggable:"false"})}function l_({activeEditor:n,nodeKey:e,onClose:t}){const i=n.getEditorState().read(()=>tt(e)),[s,o]=U.useState(i.getAltText()),[a,l]=U.useState(i.getShowCaption()),[u,g]=U.useState(i.getPosition()),d=y=>{l(y.target.checked)},f=y=>{g(y.target.value)},m=()=>{const y={altText:s,position:u,showCaption:a};i&&n.update(()=>{i.update(y)}),t()};return F.jsxs(F.Fragment,{children:[F.jsx("div",{style:{marginBottom:"1em"},children:F.jsx(oy,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:o,value:s,"data-test-id":"image-modal-alt-text-input"})}),F.jsxs(LC,{style:{marginBottom:"1em",width:"208px"},value:u,label:"Position",name:"position",id:"position-select",onChange:f,children:[F.jsx("option",{value:"left",children:"Left"}),F.jsx("option",{value:"right",children:"Right"}),F.jsx("option",{value:"full",children:"Full Width"})]}),F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("input",{id:"caption",type:"checkbox",checked:a,onChange:d}),F.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),F.jsx(ay,{children:F.jsx(ly,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>m(),children:"Confirm"})})]})}function cE({src:n,altText:e,nodeKey:t,width:r,height:i,showCaption:s,caption:o,position:a}){const[l,u]=Gy(),g=U.useRef(null),d=U.useRef(null),[f,m,y]=n_(t),[b]=$t(),[C,S]=U.useState(null),A=U.useRef(null),v=U.useCallback(I=>{if(f&&Dt(ge())){I.preventDefault();const j=tt(t);if(Ym(j))return j.remove(),!0}return!1},[f,t]),k=U.useCallback(I=>{const O=ge(),j=d.current;if(f&&Dt(O)&&O.getNodes().length===1){if(s)return Nt(null),I.preventDefault(),o.focus(),!0;if(j!==null&&j!==document.activeElement)return I.preventDefault(),j.focus(),!0}return!1},[o,f,s]),T=U.useCallback(I=>A.current===o||d.current===I.target?(Nt(null),b.update(()=>{m(!0);const O=b.getRootElement();O!==null&&O.focus()}),!0):!1,[o,b,m]);U.useEffect(()=>{let I=!0;const O=Kn(b.registerUpdateListener(({editorState:j})=>{I&&S(j.read(()=>ge()))}),b.registerCommand(Hn,(j,P)=>(A.current=P,!1),rn),b.registerCommand($s,j=>{const P=j;return P.target===g.current?(P.shiftKey?m(!f):(y(),m(!0)),!0):!1},rn),b.registerCommand(es,j=>j.target===g.current?(j.preventDefault(),!0):!1,rn),b.registerCommand(Ks,v,rn),b.registerCommand(Vs,v,rn),b.registerCommand(Ci,k,rn),b.registerCommand(qs,T,rn));return()=>{I=!1,O()}},[y,b,f,t,v,k,T,m]);const N=f&&Dt(C),h=f;return F.jsxs(U.Suspense,{fallback:null,children:[F.jsxs(F.Fragment,{children:[F.jsxs("div",{draggable:N,children:[F.jsx("button",{className:"image-edit-button",ref:d,onClick:()=>{u("Update Inline Image",I=>F.jsx(l_,{activeEditor:b,nodeKey:t,onClose:I}))},children:"Edit"}),F.jsx(lE,{className:h?`focused ${Dt(C)?"draggable":""}`:null,src:n,altText:e,imageRef:g,width:r,height:i,position:a})]}),s&&F.jsx("div",{className:"image-caption-container",children:F.jsx(e_,{initialEditor:o,children:F.jsx(Bd,{contentEditable:F.jsx(r_,{className:"InlineImageNode__contentEditable"}),placeholder:F.jsx(i_,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:Hd})})})]}),l]})}const uE=Object.freeze(Object.defineProperty({__proto__:null,UpdateInlineImageDialog:l_,default:cE},Symbol.toStringTag,{value:"Module"}));xn.Editor=XT,Object.defineProperty(xn,Symbol.toStringTag,{value:"Module"})});
132
+ `})})},PS="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE1IDE1IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMDAwMDEgOC4zMzMzM0wxLjkwMDAxIDEzLjhMMS4xMDAwMSAxMy4yTDUuMzc1MDEgNy41TDEuMTAwMDEgMS44TDEuOTAwMDEgMS4yTDYuMDAwMDEgNi42NjY2N0wxMC4xIDEuMkwxMC45IDEuOEw2LjYyNTAxIDcuNUwxMC45IDEzLjJMMTAuMSAxMy44TDYuMDAwMDEgOC4zMzMzM1pNMTIgMTIuNUMxMiAxMS42NzE2IDEyLjY3MTYgMTEgMTMuNSAxMUgxMy43OTI5QzE0LjQ1OTYgMTEgMTUgMTEuNTQwNCAxNSAxMi4yMDcxQzE1IDEyLjUyNzMgMTQuODcyOCAxMi44MzQzIDE0LjY0NjUgMTMuMDYwN0wxMy43MDcxIDE0SDE1VjE1SDEyLjVDMTIuMjk3OCAxNSAxMi4xMTU1IDE0Ljg3ODIgMTIuMDM4MSAxNC42OTEzQzExLjk2MDcgMTQuNTA0NSAxMi4wMDM1IDE0LjI4OTQgMTIuMTQ2NSAxNC4xNDY0TDEzLjkzOTMgMTIuMzUzNkMxMy45NzgyIDEyLjMxNDcgMTQgMTIuMjYyIDE0IDEyLjIwNzFDMTQgMTIuMDkyNyAxMy45MDczIDEyIDEzLjc5MjkgMTJIMTMuNUMxMy4yMjM5IDEyIDEzIDEyLjIyMzkgMTMgMTIuNUgxMloiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+",FS="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiBpbWFnZS1yZW5kZXJpbmc9Im9wdGltaXplUXVhbGl0eSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZpZXdCb3g9IjAgMCA1MDQgNTEyLjM2Ij48cGF0aCBmaWxsLXJ1bGU9Im5vbnplcm8iIGQ9Ik00OTkuNDMgMjMxLjM2SDM2OC40Yy0yLjUzIDAtNC41OC0yLjA1LTQuNTgtNC41N3YtOC4xMWMwLTEuMjYuNTItMi40IDEuMzQtMy4yMmw3MS41Ny04Mi41M2M2LjczLTcuNzUgMTIuNTctMTQuOTcgMTcuNDgtMjEuNjggNC44OC02LjY0IDguODMtMTIuNzQgMTEuODUtMTguMjggMi45Ny01LjQzIDUuMTgtMTAuNjEgNi42NC0xNS41NSAxLjQyLTQuODUgMi4xMy05LjUzIDIuMTMtMTQgMC0xNC42OC0zLjk4LTI2LjA1LTExLjkyLTM0LjA5LTMuOTItMy45Ni04Ljc1LTYuOTMtMTQuNDktOC45Mi01Ljk1LTIuMDMtMTIuOTEtMy4wNS0yMC44Ny0zLjA1LTguNDUgMC0xNS44OCAxLjIxLTIyLjI5IDMuNjItNi4yNyAyLjM2LTExLjYzIDUuOTItMTYuMDcgMTAuNjNhNDcuODg0IDQ3Ljg4NCAwIDAgMC0xMC4xNCAxNi42Yy0yLjI3IDYuMjktMy40MSAxMy4zOS0zLjQxIDIxLjI2IDAgMi41Mi0yLjA1IDQuNTctNC41NyA0LjU3aC02Ljg5Yy0yLjA1IDAtMy44LTEuMzYtNC4zNy0zLjI0bC0uMjctLjgyYy0uMTgtLjU2LS4yNS0xLjEzLS4yMi0xLjY3LS4yMy05LjMyIDEuMTQtMTcuOTkgNC4xMi0yNS45NyAzLjAyLTguMTMgNy42OC0xNS41NCAxMy45NC0yMi4xOSA2LjI2LTYuNyAxMy42My0xMS43NiAyMi4xLTE1LjEzQzQwNy44NCAxLjY4IDQxNy4yIDAgNDI3LjU1IDBjOS41OSAwIDE4LjI2IDEuMzggMjYuMDMgNC4xMyA3Ljg2IDIuNzkgMTQuNzcgNyAyMC43MiAxMi42MSA2LjAyIDUuNjMgMTAuNTUgMTIuNCAxMy41NSAyMC4yOCAyLjk2IDcuNzUgNC40NSAxNi41NiA0LjQ1IDI2LjQgMCA2LjUtMS4wNyAxMy4wOC0zLjE3IDE5LjY5bC0uMTQuMzhjLTIuMDkgNi40Ni01LjE3IDEyLjk3LTkuMiAxOS40OWwtLjE0LjIxYy00LjA4IDYuNTEtOC45IDEzLjQzLTE0LjQzIDIwLjc0LTUuNTYgNy4zMy0xMS45NiAxNS4yMy0xOS4yMiAyMy42N2wtNTYuOTEgNjYuNTFoMTEwLjM0YzIuNTIgMCA0LjU3IDIuMDUgNC41NyA0LjU3djguMTFjMCAyLjUyLTIuMDUgNC41Ny00LjU3IDQuNTd6bS0zMjcuMjUgNjguNzUgMTM3Ljk2LTE2Ny43NmMuODktMS4wNyAyLjMtMS42NSAzLjc0LTEuNjVsMjAuMTMtLjAyYzIuNTIgMCA0LjU3IDEuNzQgNC41NyAzLjg4IDAgLjkxLS4zNyAxLjc1LS45OCAyLjQxTDE4OC4zMiAzMTcuNjYgMzQ0LjEgNTA2LjI0YzEuNDUgMS43NS45NSA0LjE3LTEuMSA1LjQtLjguNDgtMS43Mi43MS0yLjYzLjcxbC0yMC4xMy4wMWMtMS43IDAtMy4xOC0uNzktMy45Ny0xLjk2bC0xNDQuMS0xNzUuMkwyOC4yMyA1MTAuNjljLS44OCAxLjA3LTIuMyAxLjY0LTMuNzMgMS42NWwtMTkuOTMuMDJjLTIuNTIgMC00LjU3LTEuNzQtNC41Ny0zLjg5IDAtLjkuMzctMS43NC45OC0yLjRsMTU1LjY1LTE4OC40TDYuOSAxMzYuOGMtMS40NS0xLjc1LS45NS00LjE4IDEuMTEtNS40MS43OS0uNDcgMS43MS0uNyAyLjYyLS43bDIwLjQ0LS4wMWMxLjYzIDAgMy4wNi43MiAzLjg3IDEuODFsMTM3LjI0IDE2Ny42MnoiLz48L3N2Zz4=",l1="",jy=tn.createContext(null),Py=4;function Er({children:n,className:e,onClick:t,title:r}){const i=U.useRef(null),s=tn.useContext(jy);if(s===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:o}=s;return U.useEffect(()=>{i&&i.current&&o(i)},[i,o]),F.jsx("button",{className:e,onClick:t,ref:i,title:r,type:"button",children:n})}function zS({children:n,dropDownRef:e,onClose:t}){const[r,i]=U.useState(),[s,o]=U.useState(),a=U.useCallback(g=>{i(d=>d?[...d,g]:[g])},[i]),l=g=>{if(!r)return;const d=g.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(d)&&g.preventDefault(),d==="Escape"||d==="Tab"?t():d==="ArrowUp"?o(f=>{if(!f)return r[0];const m=r.indexOf(f)-1;return r[m===-1?r.length-1:m]}):d==="ArrowDown"&&o(f=>f?r[r.indexOf(f)+1]:r[0])},u=U.useMemo(()=>({registerItem:a}),[a]);return U.useEffect(()=>{r&&!s&&o(r[0]),s&&s.current&&s.current.focus()},[r,s]),F.jsx(jy.Provider,{value:u,children:F.jsx("div",{className:"dropdown",ref:e,onKeyDown:l,children:n})})}function jd({disabled:n=!1,buttonLabel:e,buttonAriaLabel:t,buttonClassName:r,buttonIconClassName:i,children:s,stopCloseOnClickSelf:o}){const a=U.useRef(null),l=U.useRef(null),[u,g]=U.useState(!1),d=()=>{g(!1),l&&l.current&&l.current.focus()};return U.useEffect(()=>{const f=l.current,m=a.current;if(u&&f!==null&&m!==null){const{top:y,left:b}=f.getBoundingClientRect();m.style.top=`${y+f.offsetHeight+Py}px`,m.style.left=`${Math.min(b,window.innerWidth-m.offsetWidth-20)}px`}},[a,l,u]),U.useEffect(()=>{const f=l.current;if(f!==null&&u){const m=y=>{const b=y.target;o&&a.current&&a.current.contains(b)||f.contains(b)||g(!1)};return document.addEventListener("click",m),()=>{document.removeEventListener("click",m)}}},[a,l,u,o]),U.useEffect(()=>{const f=()=>{if(u){const m=l.current,y=a.current;if(m!==null&&y!==null){const{top:b}=m.getBoundingClientRect(),C=b+m.offsetHeight+Py;C!==y.getBoundingClientRect().top&&(y.style.top=`${C}px`)}}};return document.addEventListener("scroll",f),()=>{document.removeEventListener("scroll",f)}},[l,a,u]),F.jsxs(F.Fragment,{children:[F.jsxs("button",{type:"button",disabled:n,"aria-label":t||e,className:r,onClick:()=>g(!u),ref:l,children:[i&&F.jsx("span",{className:i}),e&&F.jsx("span",{className:"text dropdown-button-text",children:e}),F.jsx("i",{className:"chevron-down"})]}),u&&In.createPortal(F.jsx(zS,{dropDownRef:a,onClose:d,children:s}),document.body)]})}function Fy(){return F.jsx("div",{className:"divider"})}const zy=8,By=72,$r={h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",paragraph:"Normal"},BS=({selectionFontSize:n,disabled:e,editor:t,blockType:r,styleConfig:i,isenterPressed:s,currentElementClick:o,currentElementSelect:a})=>{const[l,u]=tn.useState(n),[g,d]=tn.useState(r),[f,m]=tn.useState("");tn.useState([]),tn.useState("");const y=v=>{v&&v.title&&t.update(()=>{if(t.isEditable()){const k=he();k&&kv(k,v)}})},b=v=>{u(v.target.value)},C=()=>{const v=Number(l);if(!isNaN(v)){const k=Math.min(Math.max(v,zy),By);u(String(k)),y({"font-size":`${k}px`})}},S=v=>{m(v),t.update(()=>{const N=he();de(N)&&Mv(N,()=>Rs(v))});const{heading:k}=i;let T=null;if(k)switch(v){case"h1":T=k.find(N=>N.title==="Heading1").fontSize;break;case"h2":T=k.find(N=>N.title==="Heading2").fontSize;break;case"h3":T=k.find(N=>N.title==="Heading3").fontSize;break;case"h4":T=k.find(N=>N.title==="Heading4").fontSize;break;case"h5":T=k.find(N=>N.title==="Heading5").fontSize;break;case"paragraph":T=11;break;default:T=11}u(T),m(v),d(v)},A=()=>{u("11")};return tn.useEffect(()=>{console.log("enter pressed"),A()},[s]),tn.useEffect(()=>{const v=()=>{t.update(()=>{const k=he();if(k!==null){const N=k.getNodes()[0];if(!me(N)){const h=N.getType();h in $r&&d(h)}}})};return t.registerUpdateListener(v),()=>{t.registerUpdateListener(v)}},[t]),tn.useEffect(()=>{switch(o.tagName){case"P":u("11");break;case"H1":d("h1"),u(i.heading.find(v=>v.title==="Heading1").fontSize);break;case"H2":d("h2"),u(i.heading.find(v=>v.title==="Heading2").fontSize);break;case"H3":d("h3"),u(i.heading.find(v=>v.title==="Heading3").fontSize);break;case"H4":d("h4"),u(i.heading.find(v=>v.title==="Heading4").fontSize);break;case"H5":d("h5"),u(i.heading.find(v=>v.title==="Heading5").fontSize);break;case"default":d("paragraph"),u("11");break}},[o]),tn.useEffect(()=>{switch(a||(u("11"),d("paragraph")),a&&a.trim(" ")){case"P":u("11"),d("paragraph");break;case"h1":d("h1"),u(i.heading.find(v=>v.title==="Heading1").fontSize);break;case"h2":d("h2"),u(i.heading.find(v=>v.title==="Heading2").fontSize);break;case"h3":d("h3"),u(i.heading.find(v=>v.title==="Heading3").fontSize);break;case"h4":d("h4"),u(i.heading.find(v=>v.title==="Heading4").fontSize);break;case"h5":d("h5"),u(i.heading.find(v=>v.title==="Heading5").fontSize);break;case"default":d("paragraph"),u("11");break}},[a]),F.jsxs(F.Fragment,{children:[F.jsx("input",{title:"Font Size",type:"number",value:l,disabled:e,readOnly:!0,className:"toolbar-item font-size-input",min:zy,max:By,onChange:b,onBlur:C}),F.jsx(Fy,{}),i&&i.heading?F.jsxs("div",{title:$r[g],className:"symbol-dropdown cust-head-dropDown",children:[F.jsxs(jd,{disabled:e,buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"Formatting options for text style",buttonIconClassName:"icon block-type "+g,buttonLabel:$r[g],children:[F.jsxs(Er,{className:`item ${g==="paragraph"?"active":""}`,onClick:()=>S("paragraph"),children:[F.jsx("i",{className:"icon paragraph"}),F.jsx("span",{className:"text",children:$r.paragraph})]}),i.heading&&i.heading.find(v=>v.title==="Heading1")&&F.jsxs(Er,{className:`item ${g==="h1"?"active":""}`,onClick:()=>S("h1"),children:[F.jsx("i",{className:"icon h1"}),F.jsx("span",{className:"text",children:$r.h1})]}),i.heading&&i.heading.find(v=>v.title==="Heading2")&&F.jsxs(Er,{className:`item ${g==="h2"?"active":""}`,onClick:()=>S("h2"),children:[F.jsx("i",{className:"icon h2"}),F.jsx("span",{className:"text",children:$r.h2})]}),i.heading&&i.heading.find(v=>v.title==="Heading3")&&F.jsxs(Er,{className:`item ${g==="h3"?"active":""}`,onClick:()=>S("h3"),children:[F.jsx("i",{className:"icon h3"}),F.jsx("span",{className:"text",children:$r.h3})]}),i.heading&&i.heading.find(v=>v.title==="Heading4")&&F.jsxs(Er,{className:`item ${g==="h4"?"active":""}`,onClick:()=>S("h4"),children:[F.jsx("i",{className:"icon h4"}),F.jsx("span",{className:"text",children:$r.h4})]}),i.heading&&i.heading.find(v=>v.title==="Heading5")&&F.jsxs(Er,{className:`item ${g==="h5"?"active":""}`,onClick:()=>S("h5"),children:[F.jsx("i",{className:"icon h5"}),F.jsx("span",{className:"text",children:$r.h5})]})]}),F.jsx(Fy,{})]}):""]})},Pl="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgUHJvIDYuMS4xIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlIChDb21tZXJjaWFsIExpY2Vuc2UpIENvcHlyaWdodCAyMDIyIEZvbnRpY29ucywgSW5jLi0tPjxwYXRoIGQ9Ik0wIDI1NkMwIDExNC42IDExNC42IDAgMjU2IDBzMjU2IDExNC42IDI1NiAyNTYtMTE0LjYgMjU2LTI1NiAyNTZTMCAzOTcuNCAwIDI1NnptMTc1LTQ3LjkgNDcuMSA0N0wxNzUgMzAzYy05LjMgOS40LTkuMyAyNC42IDAgMzMuMSA5LjQgMTAuMiAyNC42IDEwLjIgMzMuMSAwbDQ3LTQ2LjIgNDcuOSA0Ni4yYzkuNCAxMC4yIDI0LjYgMTAuMiAzMy4xIDAgMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMWwtNDYuMi00Ny45IDQ2LjItNDdjMTAuMi04LjUgMTAuMi0yMy43IDAtMzMuMS04LjUtOS4zLTIzLjctOS4zLTMzLjEgMGwtNDcuOSA0Ny4xLTQ3LTQ3LjFjLTguNS05LjMtMjMuNy05LjMtMzMuMSAwLTkuMyA5LjQtOS4zIDI0LjYgMCAzMy4xeiIvPjwvc3ZnPg==";function US({onClose:n}){const[e,t]=U.useState("4"),[r,i]=U.useState("4"),[s,o]=U.useState(!0);U.useState();const[a]=$t(),l=()=>{!e||!r||(a.update(()=>{const g=Am(e,r,!0);tm(g)}),n==null||n())},u=()=>{o(!1),n==null||n()};return F.jsx(F.Fragment,{children:s&&F.jsx("div",{className:"modal-overlay",children:F.jsxs("div",{className:"modal-content",children:[F.jsx("h3",{children:"Select Table Dimensions"}),F.jsx("button",{className:"modal-buttons-close",onClick:()=>u(),children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[F.jsx("label",{children:"Rows"}),F.jsx("input",{type:"number",value:e,onChange:g=>t(Number(g.target.value))})]}),F.jsxs("div",{className:"select-table-container",children:[F.jsx("label",{children:"Column"}),F.jsx("input",{type:"number",value:r,onChange:g=>i(Number(g.target.value))})]}),F.jsx("div",{children:F.jsx("div",{className:"modal-buttons",children:F.jsx("button",{className:"toolbar-item",onClick:l,children:"Confirm"})})})]})})})}const HS=[{letter:"",uppercase:"A",lowercase:"α"},{letter:"Beta",uppercase:"Β",lowercase:"β"},{letter:"Gamma",uppercase:"Γ",lowercase:"γ"},{letter:"Delta",uppercase:"Δ",lowercase:"δ"},{letter:"Epsilon",uppercase:"Ε",lowercase:"ε"},{letter:"Zeta",uppercase:"Ζ",lowercase:"ζ"},{letter:" Eta ",uppercase:"Η",lowercase:"η"},{letter:"Theta",uppercase:"Θ",lowercase:"θ"},{letter:"Iota",uppercase:"Ι",lowercase:"ι"},{letter:"Kappa",uppercase:"Κ",lowercase:"κ"}];function WS(){const[n]=$t(),[e,t]=U.useState(!1),r=i=>{n.update(()=>{var o;const s=he();if(de(s)){const a=s.anchor.getNode();let l="inherit";if(a instanceof Ni){const g=a.getStyle();l=((o=g==null?void 0:g.match(/font-size:\s*(\S+);/))==null?void 0:o[1])||l}const u=Bt(i);s.insertNodes([u])}}),t(!1)};return F.jsx("div",{title:"Symbols",className:"symbol-dropdown cust-head-dropDown",children:F.jsx(jd,{buttonClassName:"toolbar-item block-controls",buttonAriaLabel:"For appying Symbols",buttonLabel:"Symbols",children:F.jsx("div",{className:"symbol-Flex-container",children:HS.map(({letter:i,uppercase:s,lowercase:o})=>F.jsxs("div",{className:"symbol-items",children:[F.jsx(Er,{className:"terr",onClick:()=>r(o),children:o}),F.jsx(Er,{className:"terr",onClick:()=>r(s),children:s})]},i))})})})}const $S=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function YS(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function Fl(){return function(n){const[e]=$t(),t=U.useMemo(()=>n(e),[e,n]),r=U.useRef(t.initialValueFn()),[i,s]=U.useState(r.current);return $S(()=>{const{initialValueFn:o,subscribe:a}=t,l=o();return r.current!==l&&(r.current=l,s(l)),a(u=>{r.current=u,s(u)})},[t,n]),i}(YS)}const Uy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNCAxMkgyME0xMiA0VjIwIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPg==",Hy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNNiAxMkwxOCAxMiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4=";var VS=typeof global=="object"&&global&&global.Object===Object&&global;const qS=VS;var KS=typeof self=="object"&&self&&self.Object===Object&&self,GS=qS||KS||Function("return this")();const Wy=GS;var XS=Wy.Symbol;const zl=XS;var $y=Object.prototype,JS=$y.hasOwnProperty,ZS=$y.toString,Yo=zl?zl.toStringTag:void 0;function QS(n){var e=JS.call(n,Yo),t=n[Yo];try{n[Yo]=void 0;var r=!0}catch{}var i=ZS.call(n);return r&&(e?n[Yo]=t:delete n[Yo]),i}var eT=Object.prototype,tT=eT.toString;function nT(n){return tT.call(n)}var rT="[object Null]",iT="[object Undefined]",Yy=zl?zl.toStringTag:void 0;function sT(n){return n==null?n===void 0?iT:rT:Yy&&Yy in Object(n)?QS(n):nT(n)}function oT(n){return n!=null&&typeof n=="object"}var aT="[object Symbol]";function lT(n){return typeof n=="symbol"||oT(n)&&sT(n)==aT}var cT=/\s/;function uT(n){for(var e=n.length;e--&&cT.test(n.charAt(e)););return e}var dT=/^\s+/;function fT(n){return n&&n.slice(0,uT(n)+1).replace(dT,"")}function Pd(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Vy=0/0,hT=/^[-+]0x[0-9a-f]+$/i,gT=/^0b[01]+$/i,pT=/^0o[0-7]+$/i,mT=parseInt;function qy(n){if(typeof n=="number")return n;if(lT(n))return Vy;if(Pd(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Pd(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=fT(n);var t=gT.test(n);return t||pT.test(n)?mT(n.slice(2),t?2:8):hT.test(n)?Vy:+n}var yT=function(){return Wy.Date.now()};const Fd=yT;var _T="Expected a function",bT=Math.max,wT=Math.min;function vT(n,e,t){var r,i,s,o,a,l,u=0,g=!1,d=!1,f=!0;if(typeof n!="function")throw new TypeError(_T);e=qy(e)||0,Pd(t)&&(g=!!t.leading,d="maxWait"in t,s=d?bT(qy(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function m(N){var h=r,I=i;return r=i=void 0,u=N,o=n.apply(I,h),o}function y(N){return u=N,a=setTimeout(S,e),g?m(N):o}function b(N){var h=N-l,I=N-u,O=e-h;return d?wT(O,s-I):O}function C(N){var h=N-l,I=N-u;return l===void 0||h>=e||h<0||d&&I>=s}function S(){var N=Fd();if(C(N))return A(N);a=setTimeout(S,b(N))}function A(N){return a=void 0,f&&r?m(N):(r=i=void 0,o)}function v(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function k(){return a===void 0?o:A(Fd())}function T(){var N=Fd(),h=C(N);if(r=arguments,i=this,l=N,h){if(a===void 0)return y(l);if(d)return clearTimeout(a),a=setTimeout(S,e),m(l)}return a===void 0&&(a=setTimeout(S,e)),o}return T.cancel=v,T.flush=k,T}function xT(n,e,t){const r=U.useRef(null);return r.current=n,U.useMemo(()=>vT((...i)=>{r.current&&r.current(...i)},e,{maxWait:t}),[e,t])}const Ky=20;function CT({anchorElem:n}){const[e]=$t(),t=Fl(),[r,i]=U.useState(!1),[s,o]=U.useState(!1),[a,l]=U.useState(!1),[u,g]=U.useState({}),d=U.useRef(new Set),f=U.useRef(null),m=xT(S=>{const{isOutside:A,tableDOMNode:v}=ST(S);if(A){i(!1),o(!1);return}if(!v)return;f.current=v;let k=null,T=null,N=null;if(e.update(()=>{var I;const h=Pt(v);if(Ue(h)){const O=it(h,j=>At(j));if(!At(O))return;if(N=e.getElementByKey(O==null?void 0:O.getKey()),N){const j=O.getChildrenSize(),P=(I=O.getChildAtIndex(0))==null?void 0:I.getChildrenSize(),q=Rm(h),G=Lm(h);q===j-1?k=h:G===P-1&&(T=h)}}}),N){const{width:h,y:I,right:O,left:j,bottom:P,height:q}=N.getBoundingClientRect(),{y:G,left:ee}=n.getBoundingClientRect();k?(o(!1),i(!0),g({height:Ky,left:j-ee,top:P-G+25,width:h})):T&&(o(!0),i(!1),g({height:q,left:O-ee+10,top:I-G-2,width:Ky}))}},50,250),y=U.useMemo(()=>new ResizeObserver(()=>{i(!1),o(!1)}),[]);U.useEffect(()=>{if(a)return document.addEventListener("mousemove",m),()=>{i(!1),o(!1),m.cancel(),document.removeEventListener("mousemove",m)}},[a,m]),U.useEffect(()=>Kn(e.registerMutationListener(Tr,S=>{e.getEditorState().read(()=>{for(const[A,v]of S){const k=e.getElementByKey(A);switch(v){case"created":d.current.add(A),l(d.current.size>0),k&&y.observe(k);break;case"destroyed":d.current.delete(A),l(d.current.size>0),y.disconnect(),d.current.forEach(T=>{const N=e.getElementByKey(T);N&&y.observe(N)});break}}})})),[e,y]);const b=S=>{e.update(()=>{if(f.current){const A=Pt(f.current);A==null||A.selectEnd(),S?(Ux(),i(!1)):(Hx(),o(!1))}})},C=S=>{e.update(()=>{if(f.current){const A=Pt(f.current);A==null||A.selectEnd(),S?(Wx(),i(!1)):($x(),o(!1))}})};return t?F.jsxs(F.Fragment,{children:[r&&F.jsxs("div",{children:[F.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...u,flex:"50%",padding:"20px"},onClick:()=>b(!0),children:F.jsx("img",{src:Uy,height:14,width:14,style:{backgroundColor:"#90EE90",marginLeft:"-3px",borderRadius:"20px"}})}),F.jsx("button",{className:"PlaygroundEditorTheme__tableAddRows",style:{...u,flex:"50%"},onClick:()=>C(!0),children:F.jsx("img",{src:Hy,height:14,width:14,style:{backgroundColor:"#FFCCCB",marginLeft:"-3px",borderRadius:"20px"}})})]}),s&&F.jsxs("div",{className:"table-add-row-flex-container",children:[F.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...u,flex:"50%",padding:"20px"},onClick:()=>b(!1),children:F.jsx("img",{src:Uy,height:14,width:14,style:{backgroundColor:"#90EE90",marginLeft:"3px",borderRadius:"20px",border:"green"}})}),F.jsx("button",{className:"PlaygroundEditorTheme__tableAddColumns table-add-row-flex-children",style:{...u,flex:"30%"},onClick:()=>C(!1),children:F.jsx("img",{src:Hy,height:14,width:14,style:{backgroundColor:"#FFCCCB",marginLeft:"-3px",borderRadius:"20px",border:"green"}})})]})]}):null}function ST(n){const e=n.target;if(e&&e instanceof HTMLElement){const t=e.closest("td.PlaygroundEditorTheme__tableCell, th.PlaygroundEditorTheme__tableCell");return{isOutside:!(t||e.closest("button.PlaygroundEditorTheme__tableAddRows")||e.closest("button.PlaygroundEditorTheme__tableAddColumns")||e.closest("div.TableCellResizer__resizer")),tableDOMNode:t}}else return{isOutside:!0,tableDOMNode:null}}function TT({anchorElem:n=document.body}){return Fl()?In.createPortal(F.jsx(CT,{anchorElem:n}),n):null}const c1="";function ET({onClose:n,children:e,title:t,closeOnClickOutside:r}){const i=U.useRef(null);return U.useEffect(()=>{i.current!==null&&i.current.focus()},[]),U.useEffect(()=>{let s=null;const o=u=>{u.key==="Escape"&&n()},a=u=>{const g=u.target;i.current!==null&&!i.current.contains(g)&&r&&n()},l=i.current;return l!==null&&(s=l.parentElement,s!==null&&s.addEventListener("click",a)),window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o),s!==null&&(s==null||s.removeEventListener("click",a))}},[r,n]),F.jsx("div",{className:"Modal__overlay",role:"dialog",children:F.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:i,children:[F.jsx("h2",{className:"Modal__title",children:t}),F.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:n,children:"X"}),F.jsx("div",{className:"Modal__content",children:e})]})})}function kT({onClose:n,children:e,title:t,closeOnClickOutside:r=!1}){return In.createPortal(F.jsx(ET,{onClose:n,title:t,closeOnClickOutside:r,children:e}),document.body)}function Gy(){const[n,e]=U.useState(null),t=U.useCallback(()=>{e(null)},[]),r=U.useMemo(()=>{if(n===null)return null;const{title:s,content:o,closeOnClickOutside:a}=n;return F.jsx(kT,{onClose:t,title:s,closeOnClickOutside:a,children:o})},[n,t]),i=U.useCallback((s,o,a=!1)=>{e({closeOnClickOutside:a,content:o(t),title:s})},[t]);return[r,i]}const NT="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxpdmVsbG9fMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5zdDB7ZmlsbDojNDFBNUVFO30gLnN0MXtmaWxsOiMyQjdDRDM7fSAuc3Qye2ZpbGw6IzE4NUFCRDt9IC5zdDN7ZmlsbDojMTAzRjkxO30gLnN0NHtvcGFjaXR5OjAuMTtlbmFibGUtYmFja2dyb3VuZDpuZXcgO30gLnN0NXtvcGFjaXR5OjAuMjtlbmFibGUtYmFja2dyb3VuZDpuZXcgO30gLnN0NntmaWxsOnVybCgjU1ZHSURfMV8pO30gLnN0N3tmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTQ5MC4xNywxOS4ySDE0MC45Yy0xMi4wNSwwLTIxLjgzLDkuNzItMjEuODMsMjEuN2wwLDB2OTYuN2wyMDIuNDIsNTkuMkw1MTIsMTM3LjZWNDAuOQlDNTEyLDI4LjkxLDUwMi4yMywxOS4yLDQ5MC4xNywxOS4yTDQ5MC4xNywxOS4yeiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik01MTIsMTM3LjZIMTE5LjA3VjI1NmwyMDIuNDIsMzUuNTJMNTEyLDI1NlYxMzcuNnoiLz48cGF0aCBjbGFzcz0ic3QyIiBkPSJNMTE5LjA3LDI1NnYxMTguNGwxOTAuNTEsMjMuNjhMNTEyLDM3NC40VjI1NkgxMTkuMDd6Ii8+PHBhdGggY2xhc3M9InN0MyIgZD0iTTE0MC45LDQ5Mi44aDM0OS4yOGMxMi4wNSwwLDIxLjgzLTkuNzIsMjEuODMtMjEuN2wwLDB2LTk2LjdIMTE5LjA3djk2LjcJQzExOS4wNyw0ODMuMDksMTI4Ljg0LDQ5Mi44LDE0MC45LDQ5Mi44TDE0MC45LDQ5Mi44eiIvPjxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik0yNjMuOTQsMTEzLjkySDExOS4wN3YyOTZoMTQ0Ljg3YzEyLjA0LTAuMDQsMjEuNzktOS43MywyMS44My0yMS43di0yNTIuNglDMjg1LjczLDEyMy42NSwyNzUuOTgsMTEzLjk2LDI2My45NCwxMTMuOTJ6Ii8+PHBhdGggY2xhc3M9InN0NSIgZD0iTTI1Mi4wNCwxMjUuNzZIMTE5LjA3djI5NmgxMzIuOTdjMTIuMDQtMC4wNCwyMS43OS05LjczLDIxLjgzLTIxLjd2LTI1Mi42CUMyNzMuODIsMTM1LjQ5LDI2NC4wNywxMjUuOCwyNTIuMDQsMTI1Ljc2eiIvPjxwYXRoIGNsYXNzPSJzdDUiIGQ9Ik0yNTIuMDQsMTI1Ljc2SDExOS4wN3YyNzIuMzJoMTMyLjk3YzEyLjA0LTAuMDQsMjEuNzktOS43MywyMS44My0yMS43VjE0Ny40NglDMjczLjgyLDEzNS40OSwyNjQuMDcsMTI1LjgsMjUyLjA0LDEyNS43NnoiLz48cGF0aCBjbGFzcz0ic3Q1IiBkPSJNMjQwLjEzLDEyNS43NkgxMTkuMDd2MjcyLjMyaDEyMS4wNmMxMi4wNC0wLjA0LDIxLjc5LTkuNzMsMjEuODMtMjEuN1YxNDcuNDYJQzI2MS45MSwxMzUuNDksMjUyLjE3LDEyNS44LDI0MC4xMywxMjUuNzZ6Ii8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8xXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI0NS44MTgzIiB5MT0iLTEwODMuNDkxNiIgeDI9IjIxNi4xMzYxIiB5Mj0iLTc4OC41MDgyIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMCAxMTkyKSI+PHN0b3Agb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojMjM2OEM0Ii8+PHN0b3Agb2Zmc2V0PSIwLjUiIHN0eWxlPSJzdG9wLWNvbG9yOiMxQTVEQkUiLz48c3RvcCBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiMxMTQ2QUMiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGNsYXNzPSJzdDYiIGQ9Ik0yMS44MywxMjUuNzZoMjE4LjNjMTIuMDUsMCwyMS44Myw5LjcyLDIxLjgzLDIxLjd2MjE3LjA4YzAsMTEuOTktOS43NywyMS43LTIxLjgzLDIxLjdIMjEuODMJQzkuNzcsMzg2LjI0LDAsMzc2LjUyLDAsMzY0LjU0VjE0Ny40NkMwLDEzNS40OCw5Ljc3LDEyNS43NiwyMS44MywxMjUuNzZ6Ii8+PHBhdGggY2xhc3M9InN0NyIgZD0iTTg5LjU2LDI5Mi4yMWMwLjQzLDMuMzUsMC43MSw2LjI2LDAuODUsOC43NmgwLjVjMC4xOS0yLjM3LDAuNTktNS4yMiwxLjE5LTguNTZjMC42LTMuMzQsMS4xNS02LjE2LDEuNjMtOC40NwlsMjIuOTYtOTguNDloMjkuNjhsMjMuODEsOTcuMDFjMS4zOCw2LjAzLDIuMzcsMTIuMTUsMi45NiwxOC4zaDAuMzljMC40NC01Ljk3LDEuMjctMTEuOSwyLjQ4LTE3Ljc2bDE4Ljk5LTk3LjZoMjcuMDIJbC0zMy4zNiwxNDEuMTNIMTU3LjFsLTIyLjYyLTkzLjQ3Yy0wLjY1LTIuNjktMS40LTYuMi0yLjIzLTEwLjUzcy0xLjMzLTcuNDgtMS41NC05LjQ3aC0wLjM5Yy0wLjI2LDIuMy0wLjc3LDUuNzEtMS41NCwxMC4yMwljLTAuNzYsNC41Mi0xLjM3LDcuODctMS44MywxMC4wNGwtMjEuMjcsOTMuMTdoLTMyLjFMNDAuMDQsMTg1LjQ2aDI3LjVsMjAuNjgsOTguNjlDODguNywyODYuMTcsODkuMTQsMjg4Ljg3LDg5LjU2LDI5Mi4yMXoiLz48L3N2Zz4=",MT=({htmlPasteModalOpen:n,onlUser:e,collabApiKey:t,sethtmlPasteModalOpen:r})=>{const i=U.useRef(null),[s,o]=U.useState(""),[a,l]=U.useState();$t();const u=()=>{l({root:{type:"root",version:1,children:[{children:[],direction:"ltr",format:"",indent:0,type:"text",version:1}],direction:"ltr",format:"",indent:0}}),o("")};U.useEffect(()=>{u()},[]);const g=()=>{r(!1),o(" "),u()},d=v=>{const k=/display:\s*([^;]+);/,T=v.match(k);if(T)return T[1]};function f(){const[v]=$t(),k=(N,h)=>{v.update(()=>{const I=_t(),O=Bt(`${N}`);O.setStyle(h.style),O.setFormat(h.format),I.append(O),v.getRootElement()&&N&&N.length>3&&v.getEditorState().read(()=>dt()).append(I)})},T=()=>{y(s).root.children.map(h=>{h&&h.text&&h.text.trim("")&&h.text.trim("").length>1&&h.style&&h.style.length>10&&d(h.style)==="block"&&k(h.text.trim(""),h)}),g()};return F.jsx("button",{className:`green-button-paste ${s.length>100?"":"disable-btn"}`,onClick:T,children:"Insert Node"})}function m(v,k){const T=/font-weight:\s*([a-zA-Z0-9\-]+);/,N=/text-decoration:\s*([^;]+?)(?=\s*;|\s*$)/,h=/font-style:\s*([a-zA-Z0-9\-]+);/,I=/font-size:\s*([\d.]+(?:px|pt|em|rem|%)?)/,O=/color:\s*([^;]+)/,j=v.match(T),P=v.match(N),q=v.match(h),G=v.match(I),ee=v.match(O),ue=j?j[1]:null,ae=P?P[1]:null,ge=q?q[1]:null,Le=G?G[1]:null,be=ee?ee[1]:null;let fe={"font-weight":ue&&ue!==null?ue:"none","text-decoration":ae&&ae!==null?ae:"none","font-style":ge&&ge!==null?ge:"none","font-size":Le&&Le!==null?"11px":"none",display:["span","table","tbody","tr","td"].includes(k)?"block":"none",color:be&&be!=="transparent"?be:"black"};function Ce(ve){return Object.entries(ve).map(([Fe,De])=>`${Fe}: ${De};`).join(" ")}return{cssString:Ce(fe),fontSize:Le&&Le!==null?Le:"none",fontWeight:ue&&ue!==null?ue:"none",fontStyle:ge&&ge!==null?ge:"none",textDecoration:ae&&ae!==null?ae:"none"}}function y(v){const N=new DOMParser().parseFromString(v,"text/html").querySelectorAll("*"),h=Array.from(N).map(O=>({elemText:O.innerText,tagName:O.tagName.toLowerCase(),style:O.getAttribute("style")||""}));let I=a;return h.map(O=>{let j=m(O.style,O.tagName);const{cssString:P,fontSize:q,fontWeight:G,textDecoration:ee,fontStyle:ue}=j||{};if(O.style&&O.style.length>0&&O.elemText.trim(" ").length&&q!=="none"&&G!==null&&ee!==null&&ue!==null){let ae=G==="bold"&&ue==="italic"&&ee==="underline line-through"?15:ee==="underline line-through"?12:ue==="italic"&&ee=="line-through"?6:ue==="italic"&&ee==="underline"?10:G==="bold"&&ee==="line-through"?5:G==="bold"&&ee==="underline"?9:G==="bold"&&ue==="italic"?3:G==="bold"?1:ue==="italic"?2:O.style.includes("text-decoration: underline")?8:O.style.includes("text-decoration: line-through")?4:0;I.root.children.push({detail:0,format:ae,mode:"normal",style:`${P}`,text:`${O.elemText}`,type:"text",version:1})}}),I}const b=v=>{if(v){v.preventDefault();const T=(v.clipboardData||window.clipboardData).getData("text/html");T&&o(T)}},C=()=>{o("")};U.useEffect(()=>()=>{o(" "),console.log("cleaned up")},[]);const S=()=>{r(!0)},A=()=>{r(!1),o("")};return F.jsxs(F.Fragment,{children:[F.jsx("button",{title:"MS-Word content paste",className:"toolbar-item space insert-ms-word-btn",onClick:S,children:F.jsx("img",{src:NT,height:16,width:16})}),e&&e.length>0?n&&F.jsx("div",{className:"modal-overlay",children:F.jsxs("div",{className:"modal-content custom-paste-modal-content",children:[F.jsx("h3",{children:"Paste MS Word Content below"}),F.jsx("button",{className:"modal-buttons-close",onClick:A,children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[s.length>100,F.jsx("textarea",{onPaste:b,className:s&&s.length>100?"small-paste-area":"enlarge-paste-area"}),F.jsx("div",{contentEditable:!0,className:s&&s.length>100?"enlarge-paste-area":"small-paste-area",ref:i,dangerouslySetInnerHTML:{__html:s}})]}),F.jsx("div",{children:F.jsxs("div",{className:"modal-buttons",children:[F.jsx("button",{className:`red-button-paste ${s.length>100?"":"disable-btn"}`,onClick:C,children:"Reset"}),F.jsx(f,{})]})})]})}):n&&F.jsx("div",{className:"modal-overlay",children:t?F.jsxs("div",{className:"modal-content custom-paste-modal-content",children:[F.jsx("h3",{children:"Paste MS Word Content below"}),F.jsx("button",{className:"modal-buttons-close",onClick:A,children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[s.length>100,F.jsx("div",{className:"text-area-loading",children:"Loading..."})]})]}):F.jsxs("div",{className:"modal-content custom-paste-modal-content",children:[F.jsx("h3",{children:"Paste MS Word Content below"}),F.jsx("button",{className:"modal-buttons-close",onClick:A,children:F.jsx("img",{src:Pl,height:16,width:16,style:{margin:"0 0 29px 10px"}})}),F.jsxs("div",{className:"select-table-container",children:[s.length>100,F.jsx("textarea",{onPaste:b,className:s&&s.length>100?"small-paste-area":"enlarge-paste-area"}),F.jsx("div",{contentEditable:!0,className:s&&s.length>100?"enlarge-paste-area":"small-paste-area",ref:i,dangerouslySetInnerHTML:{__html:s}})]}),F.jsx("div",{children:F.jsxs("div",{className:"modal-buttons",children:[F.jsx("button",{className:`red-button-paste ${s.length>100?"":"disable-btn"}`,onClick:C,children:"Reset"}),F.jsx(f,{})]})})]})})]})},DT="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iY3VycmVudENvbG9yIiBjbGFzcz0iYmkgYmktdGFibGUiPjxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz48L3N2Zz4=",AT="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0naXNvLTg4NTktMSc/Pgo8IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIGZpbGw9IiMwMDAwMDAiIGhlaWdodD0iODAwcHgiIHdpZHRoPSI4MDBweCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNTAgMzUwIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzUwIDM1MCI+CiAgPHBhdGggZD0iTTUsMzUwaDM0MFYwSDVWMzUweiBNMjUsMzMwdi02Mi4yMTJoMzAwVjMzMEgyNXogTTE3OS41MDksMjQ3LjQ5NEg2MC40OTFMMTIwLDE3MS4yNTNMMTc5LjUwOSwyNDcuNDk0eiAgIE0xNzYuNDQzLDIxMS4wNjFsMzMuNjgzLTMyLjMyM2w3NC42NTQsNjkuMDVoLTc5LjY3TDE3Ni40NDMsMjExLjA2MXogTTMyNSw5Ni41NzRjLTYuMzg0LDIuMjY5LTEzLjA4NSwzLjQyNi0yMCwzLjQyNiAgYy0zMy4wODQsMC02MC0yNi45MTYtNjAtNjBjMC02LjkxMSwxLjE1Ni0xMy42MTIsMy40MjItMjBIMzI1Vjk2LjU3NHogTTI1LDIwaDIwMi41MTZDMjI1Ljg0NSwyNi40NzksMjI1LDMzLjE2NiwyMjUsNDAgIGMwLDQ0LjExMiwzNS44ODgsODAsODAsODBjNi44MzcsMCwxMy41MjMtMC44NDYsMjAtMi41MTh2MTMwLjMwNmgtMTAuNzY3bC0xMDQuMzU5LTk2LjUyNmwtNDUuODAxLDQzLjk1MUwxMjAsMTM4Ljc0OCAgbC04NS4xMDksMTA5LjA0SDI1VjIweiIvPgo8L3N2Zz4=",Vo=1;function js(){return F.jsx("div",{className:"divider"})}function IT({onlUser:n,styleConfig:e,collabApiKey:t}){const[r]=$t(),i=U.useRef(null),[s,o]=U.useState(!1),[a,l]=U.useState(!1),[u,g]=U.useState(!1),[d,f]=U.useState(!1),[m,y]=U.useState(!1),[b,C]=U.useState(!1),[S,A]=U.useState(!1),[v,k]=U.useState(!1),[T,N]=U.useState("11px"),[h,I]=U.useState(()=>r.isEditable()),[O,j]=U.useState(""),[P,q]=U.useState(""),[G,ee]=U.useState(""),[ue,ae]=Gy(),[ge,Le]=U.useState(!1),be=U.useCallback(()=>{const Ce=he();de(Ce)&&(g(Ce.hasFormat("bold")),f(Ce.hasFormat("italic")),y(Ce.hasFormat("underline")),C(Ce.hasFormat("strikethrough")),A(Ce.hasFormat("subscript")),k(Ce.hasFormat("superscript")))},[]),oe=Ce=>{r.update(()=>{const Te=he();de(Te)&&Te.getNodes().forEach(Fe=>{if(me(Fe)){let ke=Fe.getStyle()||"";for(const[ze,xe]of Object.entries(Ce)){const Pe=new RegExp(`${ze}:\\s*[^;]+;?`,"g");ke=ke.replace(Pe,""),ke+=`${ze}: ${xe}; `}Fe.setStyle(ke.trim())}})})},fe=U.useCallback(()=>{var Te,ve;const Ce=he();if(de(Ce)){const Fe=((ve=(Te=he())==null?void 0:Te.getNodes()[0])==null?void 0:ve.__style)??"",De=["font-weight","font-style","text-decoration"],ke={};if(Fe.split(";").map(xe=>xe.trim()).forEach(xe=>{const[Pe,ft]=xe.split(":").map(we=>we.trim());De.includes(Pe)&&(ke[Pe]=ft)}),ke["font-weight"]==="bold"){const xe=he();de(xe)&&u===xe.hasFormat("bold")&&oe({"font-weight":"400"})}else{const xe=he();de(xe)&&u!==xe.hasFormat("bold")&&oe({"font-weight":"bold"})}if(ke["font-style"]==="italic"){const xe=he();de(xe)&&d===xe.hasFormat("italic")&&oe({"font-style":"normal"})}else{const xe=he();de(xe)&&d!==xe.hasFormat("italic")&&oe({"font-style":"italic"})}if(ke["text-decoration"]==="line-through"){const xe=he();de(xe)&&b===xe.hasFormat("strikethrough")&&oe({"text-decoration":b?"line-through":"none"})}else{const xe=he();de(xe)&&b!==xe.hasFormat("strikethrough")&&oe({"text-decoration":b!==xe.hasFormat("strikethrough")&&m!==xe.hasFormat("underline")?"underline line-through":b?"none":"line-through"})}if(ke["text-decoration"]==="underline"){const xe=he();de(xe)&&m===xe.hasFormat("underline")&&oe({"text-decoration":m?"underline":"none"})}else{const xe=he();de(xe)&&m!==xe.hasFormat("underline")&&oe({"text-decoration":b!==xe.hasFormat("strikethrough")&&m!==xe.hasFormat("underline")?"underline line-through":m?"none":"underline"})}}},[]);return U.useEffect(()=>Kn(r.registerUpdateListener(({editorState:Ce})=>{Ce.read(()=>{be()})}),r.registerCommand(Hn,(Ce,Te)=>{var De;j("");const ve=(De=he())==null?void 0:De.getNodes()[0].__parent;return r.getEditorState()._nodeMap.forEach((ke,ze)=>{ze===ve&&ee(ke.__tag)}),be(),fe(),!1},Vo),r.registerCommand($s,Ce=>(q(Ce.target),fe(),!1),Vo),r.registerCommand(xf,Ce=>(o(Ce),!1),Vo),r.registerCommand(vf,Ce=>(l(Ce),!1),Vo),r.registerCommand(Ci,Ce=>(j("Enter"),!0),Vo)),[r,be,fe]),F.jsxs("div",{className:"toolbar",ref:i,children:[F.jsx("button",{title:"Undo",disabled:!s,onClick:()=>{r.dispatchCommand(aa,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:F.jsx("i",{className:"format undo"})}),F.jsx("button",{title:"Redo",disabled:!a,onClick:()=>{r.dispatchCommand(la,void 0)},className:"toolbar-item","aria-label":"Redo",children:F.jsx("i",{className:"format redo"})}),F.jsx(js,{}),F.jsx(BS,{currentElementClick:P,selectionFontSize:T.slice(0,-2),editor:r,disabled:!h,blockType:"paragraph",styleConfig:e,isenterPressed:O,currentElementSelect:G}),F.jsx(js,{}),F.jsx("button",{title:"Bold",onClick:()=>{r.dispatchCommand(mn,"bold")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Bold",children:F.jsx("i",{className:"format bold"})}),F.jsx("button",{title:"Italic",onClick:()=>{r.dispatchCommand(mn,"italic")},className:"toolbar-item spaced "+(d?"active":""),"aria-label":"Format Italics",children:F.jsx("i",{className:"format italic"})}),F.jsx("button",{title:"Underline",onClick:()=>{r.dispatchCommand(mn,"underline")},className:"toolbar-item spaced "+(m?"active":""),"aria-label":"Format Underline",children:F.jsx("i",{className:"format underline"})}),F.jsx("button",{title:"Strikethrough",onClick:()=>{r.dispatchCommand(mn,"strikethrough")},className:"toolbar-item spaced "+(b?"active":""),"aria-label":"Format Strikethrough",children:F.jsx("i",{className:"format strikethrough"})}),F.jsx("button",{title:"SuperScript",onClick:()=>{r.dispatchCommand(mn,"superscript")},className:"toolbar-item spaced "+(v?"active":""),"aria-label":"Format SuperScript",children:F.jsx("img",{src:FS,height:16,width:16,style:{marginTop:"1px"}})}),F.jsx("button",{title:"SubScript",onClick:()=>{r.dispatchCommand(mn,"subscript")},className:"toolbar-item spaced "+(S?"active":""),"aria-label":"Format SubScript",children:F.jsx("img",{src:PS,height:16,width:16,style:{marginTop:"1px"}})}),F.jsx(js,{}),F.jsx("button",{title:"Left Align",onClick:()=>{r.dispatchCommand(Qi,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:F.jsx("i",{className:"format left-align"})}),F.jsx("button",{title:"Center Align",onClick:()=>{r.dispatchCommand(Qi,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:F.jsx("i",{className:"format center-align"})}),F.jsx("button",{title:"Right Align",onClick:()=>{r.dispatchCommand(Qi,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:F.jsx("i",{className:"format right-align"})}),F.jsx("button",{title:"Justify Align",onClick:()=>{r.dispatchCommand(Qi,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:F.jsx("i",{className:"format justify-align"})}),F.jsx(js,{}),F.jsx(WS,{}),F.jsx(MT,{htmlPasteModalOpen:ge,sethtmlPasteModalOpen:Le,onlUser:n,collabApiKey:t}),F.jsx(js,{}),F.jsx(TT,{}),F.jsxs(jd,{disabled:!h,buttonClassName:"toolbar-item spaced",buttonLabel:"Insert",buttonAriaLabel:"Insert specialized editor node",buttonIconClassName:"icon plus",children:[F.jsx(Er,{onClick:()=>{ae("Insert Image",Ce=>F.jsx(xC,{activeEditor:r,onClose:Ce}))},className:"item",children:F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[F.jsx("img",{className:"add-toolbar-image-icon",src:AT,alt:"Add Image",style:{height:"16px",width:"16px"}}),F.jsx("span",{className:"text",children:"Image"})]})}),F.jsx(Er,{onClick:()=>{ae("Insert Table",Ce=>F.jsx(US,{onClose:Ce}))},className:"item",children:F.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[F.jsx("img",{className:"add-toolbar-table-icon",src:DT,alt:"Add Table",style:{height:"16px",width:"16px"}}),F.jsx("span",{className:"text",children:"Table"})]})})]}),F.jsx(js,{}),F.jsx("div",{className:"flex-container-onluser",children:n}),ue]})}function RT(){return dt().getTextContent()}function LT(n,e=!0){if(n)return!1;let t=RT();return e&&(t=t.trim()),t===""}function OT(n){if(!LT(n,!1))return!1;const e=dt().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const i=e[r];if(gt(i))return!1;if(ie(i)){if(!us(i)||i.__indent!==0)return!1;const s=i.getChildren(),o=s.length;for(let a=0;a<o;a++){const l=s[r];if(!me(l))return!1}}}return!0}function jT(n){return()=>OT(n)}function PT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}PT(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function FT(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const i=n.getRootElement();if(document.activeElement!==i)return;const s=r.data;if(typeof s=="string"){let o;try{o=JSON.parse(s)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const a=o.payload;if(a&&a.functionId==="makeChanges"){const l=a.args;if(l){const[u,g,d,f,m,y]=l;n.update(()=>{const b=he();if(de(b)){const C=b.anchor;let S=C.getNode(),A=0,v=0;if(me(S)&&u>=0&&g>=0&&(A=u,v=u+g,b.setTextNodeRange(S,A,S,v)),A===v&&d===""||(b.insertRawText(d),S=C.getNode()),me(S)){A=f,v=f+m;const k=S.getTextContentSize();A=A>k?k:A,v=v>k?k:v,b.setTextNodeRange(S,A,S,v)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const zd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function Xy(n){return n.getEditorState().read(jT(n.isComposing()))}function Bd({contentEditable:n,placeholder:e,ErrorBoundary:t}){const[r]=$t(),i=function(s,o){const[a,l]=U.useState(()=>s.getDecorators());return zd(()=>s.registerDecoratorListener(u=>{In.flushSync(()=>{l(u)})}),[s]),U.useEffect(()=>{l(s.getDecorators())},[s]),U.useMemo(()=>{const u=[],g=Object.keys(a);for(let d=0;d<g.length;d++){const f=g[d],m=F.jsx(o,{onError:b=>s._onError(b),children:F.jsx(U.Suspense,{fallback:null,children:a[f]})}),y=s.getElementByKey(f);y!==null&&u.push(In.createPortal(m,y,f))}return u},[o,a,s])}(r,t);return function(s){zd(()=>Kn(pC(s),FT(s)),[s])}(r),F.jsxs(F.Fragment,{children:[n,F.jsx(zT,{content:e}),i]})}function zT({content:n}){const[e]=$t(),t=function(i){const[s,o]=U.useState(()=>Xy(i));return zd(()=>{function a(){const l=Xy(i);o(l)}return a(),Kn(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),s}(e),r=Fl();return t?typeof n=="function"?n(r):n:null}function Ud(n,e){return Ud=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Ud(n,e)}var Jy={error:null},BT=function(n){var e,t;function r(){for(var s,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(s=n.call.apply(n,[this].concat(a))||this).state=Jy,s.resetErrorBoundary=function(){for(var u,g=arguments.length,d=new Array(g),f=0;f<g;f++)d[f]=arguments[f];s.props.onReset==null||(u=s.props).onReset.apply(u,d),s.reset()},s}t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,Ud(e,t),r.getDerivedStateFromError=function(s){return{error:s}};var i=r.prototype;return i.reset=function(){this.setState(Jy)},i.componentDidCatch=function(s,o){var a,l;(a=(l=this.props).onError)==null||a.call(l,s,o)},i.componentDidUpdate=function(s,o){var a,l,u,g,d=this.state.error,f=this.props.resetKeys;d!==null&&o.error!==null&&((u=s.resetKeys)===void 0&&(u=[]),(g=f)===void 0&&(g=[]),u.length!==g.length||u.some(function(m,y){return!Object.is(m,g[y])}))&&((a=(l=this.props).onResetKeysChange)==null||a.call(l,s.resetKeys,f),this.reset())},i.render=function(){var s=this.state.error,o=this.props,a=o.fallbackRender,l=o.FallbackComponent,u=o.fallback;if(s!==null){var g={error:s,resetErrorBoundary:this.resetErrorBoundary};if(tn.isValidElement(u))return u;if(typeof a=="function")return a(g);if(l)return tn.createElement(l,g);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},r}(tn.Component);function Hd({children:n,onError:e}){return F.jsx(BT,{fallback:F.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}function UT({defaultSelection:n}){const[e]=$t();return U.useEffect(()=>{e.focus(()=>{const t=document.activeElement,r=e.getRootElement();r===null||t!==null&&r.contains(t)||r.focus({preventScroll:!0})},{defaultSelection:n})},[n,e]),null}const HT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function Zy({ariaActiveDescendant:n,ariaAutoComplete:e,ariaControls:t,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:s,ariaLabelledBy:o,ariaMultiline:a,ariaOwns:l,ariaRequired:u,autoCapitalize:g,className:d,id:f,role:m="textbox",spellCheck:y=!0,style:b,tabIndex:C,"data-testid":S,...A}){const[v]=$t(),[k,T]=U.useState(!1),N=U.useCallback(h=>{h&&h.ownerDocument&&h.ownerDocument.defaultView&&v.setRootElement(h)},[v]);return HT(()=>(T(v.isEditable()),v.registerEditableListener(h=>{T(h)})),[v]),F.jsx("div",{...A,"aria-activedescendant":k?n:void 0,"aria-autocomplete":k?e:"none","aria-controls":k?t:void 0,"aria-describedby":r,"aria-expanded":k&&m==="combobox"?!!i:void 0,"aria-label":s,"aria-labelledby":o,"aria-multiline":a,"aria-owns":k?l:void 0,"aria-readonly":!k||void 0,"aria-required":u,autoCapitalize:g,className:d,contentEditable:k,"data-testid":S,id:f,ref:N,role:m,spellCheck:y,style:b,tabIndex:C})}const WT=33,$T=50;function YT({editor:n}){const e=U.useRef(null),t=U.useRef(null),r=U.useRef(null),i=U.useRef(null),[s,o]=U.useState(null),[a,l]=U.useState(null),[u,g]=U.useState(!1),[d,f]=U.useState(null);U.useEffect(()=>n.registerCommand(Hn,T=>{const N=he(),h=It(N);return u!==h&&g(h),!1},$n));const m=U.useCallback(()=>{l(null),e.current=null,f(null),i.current=null,r.current=null},[]);U.useEffect(()=>{const T=N=>{setTimeout(()=>{const h=N.target;if(d){o({x:N.clientX,y:N.clientY});return}if(!(t.current&&t.current.contains(h))&&e.current!==h){e.current=h;const I=gd(h);I&&a!==I?n.update(()=>{const O=Pt(I.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");const j=xl(O),P=n.getElementByKey(j.getKey());if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=h,r.current=P.getBoundingClientRect(),l(I)}):I==null&&m()}},0)};return document.addEventListener("mousemove",T),()=>{document.removeEventListener("mousemove",T)}},[a,d,n,m]);const y=T=>T==="bottom",b=U.useCallback(T=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");n.update(()=>{const N=Pt(a.elem);if(!Ue(N))throw new Error("TableCellResizer: Table cell node not found.");const h=xl(N),I=Rm(N),O=h.getChildren();if(I>=O.length||I<0)throw new Error("Expected table cell to be inside of table row.");const j=O[I];if(!Yt(j))throw new Error("Expected table row");j.setHeight(T)})},[a,n]),C=U.useCallback(T=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");n.update(()=>{const N=Pt(a.elem);if(!Ue(N))throw new Error("TableCellResizer: Table cell node not found.");const h=xl(N),I=Lm(N),O=h.getChildren();for(let j=0;j<O.length;j++){const P=O[j];if(!Yt(P))throw new Error("Expected table row");const q=P.getChildren(),ue=q.map(ge=>ge.getColSpan()).reduce((ge,Le)=>{const be=ge[ge.length-1]??0;return ge.push(be+Le),ge},[]).findIndex(ge=>ge>I);if(ue>=q.length||ue<0)throw new Error("Expected table cell to be inside of table row.");const ae=q[ue];if(!Ue(ae))throw new Error("Expected table cell");ae.setWidth(T)}})},[a,n]),S=U.useCallback(T=>{const N=h=>{if(h.preventDefault(),h.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){const{x:I,y:O}=i.current;if(a===null)return;if(y(T)){const j=a.elem.getBoundingClientRect().height,P=Math.abs(h.clientY-O),q=T==="bottom"&&O>h.clientY;b(Math.max(q?j-P:P+j,WT))}else{const j=getComputedStyle(a.elem);let P=a.elem.clientWidth;P-=parseFloat(j.paddingLeft)+parseFloat(j.paddingRight);const q=Math.abs(h.clientX-I),G=T==="right"&&I>h.clientX;C(Math.max(G?P-q:q+P,$T))}m(),document.removeEventListener("mouseup",N)}};return N},[a,m,C,b]),A=U.useCallback(T=>N=>{if(N.preventDefault(),N.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:N.clientX,y:N.clientY},o(i.current),f(T),document.addEventListener("mouseup",S(T))},[a,S]),k=U.useCallback(()=>{if(a){const{height:T,width:N,top:h,left:I}=a.elem.getBoundingClientRect(),O={bottom:{backgroundColor:"none",cursor:"row-resize",height:"10px",left:`${window.pageXOffset+I}px`,top:`${window.pageYOffset+h+T}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${T}px`,left:`${window.pageXOffset+I+N}px`,top:`${window.pageYOffset+h}px`,width:"10px"}},j=r.current;return d&&s&&j&&(y(d)?(O[d].left=`${window.pageXOffset+j.left}px`,O[d].top=`${window.pageYOffset+s.y}px`,O[d].height="3px",O[d].width=`${j.width}px`):(O[d].top=`${window.pageYOffset+j.top}px`,O[d].left=`${window.pageXOffset+s.x}px`,O[d].width="3px",O[d].height=`${j.height}px`),O[d].backgroundColor="#adf"),O}return{bottom:null,left:null,right:null,top:null}},[a,d,s])();return F.jsx("div",{ref:t,children:a!=null&&!u&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:k.right||void 0,onMouseDown:A("right")}),F.jsx("div",{className:"TableCellResizer__resizer TableCellResizer__ui",style:k.bottom||void 0,onMouseDown:A("bottom")})]})})}function VT(){const[n]=$t(),e=Fl();return U.useMemo(()=>e?In.createPortal(F.jsx(YT,{editor:n}),document.body):null,[n,e])}const qT=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?U.useLayoutEffect:U.useEffect;function KT({ignoreHistoryMergeTagChange:n=!0,ignoreSelectionChange:e=!1,onChange:t}){const[r]=$t();return qT(()=>{if(t)return r.registerUpdateListener(({editorState:i,dirtyElements:s,dirtyLeaves:o,prevEditorState:a,tags:l})=>{e&&s.size===0&&o.size===0||n&&l.has("history-merge")||a.isEmpty()||t(i,r,l)})},[r,n,e,t]),null}const GT=[Tr,Ns,Hr,El,Nl,Dl];function XT({userObj:n,styleConfig:e,docId:t,onlUser:r,setonlUser:i,userNamesArr:s,setuserNamesArr:o,savedSpfEditorState:a,setSavedEditorState:l}){const u=new URLSearchParams(window.location.search).get("provider")??"webrtc",[g,d]=U.useState(()=>lx(n)),[f,m]=U.useState([]),y=U.useRef(null),[b,C]=U.useState(null),[S,A]=U.useState(!1),{pageMarginTop:v,pageMarginLeft:k,pageMarginBottom:T,pageMarginRight:N,heading:h}=e||{};U.useState(!0),U.useState("");const I={namespace:"React.js Collab Demo",nodes:GT,onError(ee){throw ee},editorPlugins:[],theme:ax,editorState:ee=>{ee.update(()=>{const ae=new DOMParser().parseFromString(a,"text/html"),ge=Vm(ee,ae);za(ge)})}};let O="";const j=()=>{const ee=py(".editor-input").html();ee!==O&&(console.log("editorInput",ee),l(ee),O=ee)},P=U.useCallback(()=>{const ee=b.awareness;let ue=Array.from(ee.getStates().entries()).map(([ae,{color:ge,name:Le}])=>({color:ge,name:Le,userId:ae}));m(ue),ue&&ue.length>0&&ue.map((ae,ge)=>{let Le=r||[],be=s||[],oe=ae.name,fe=F.jsxs("div",{title:ae.name,className:`avatarStyle avatar-color-${ge+1}`,children:[" ",oe&&oe[0],oe&&oe[4]]},ae.name);be.includes(oe)||(be.push(oe),o(be),Le.push(fe),i(Le))})},[b]),q=()=>{b!=null&&(S?b.disconnect():b.connect())};U.useEffect(()=>{q()},[]),U.useEffect(()=>{setTimeout(()=>{py(".custom-margin").css({paddingTop:`${v||"16px"}`,paddingRight:`${N||"16px"}`,paddingLeft:`${k||"16px"}`,paddingBottom:`${T||"16px"}`})},2e3)},[]),U.useEffect(()=>{if(b!=null)return b.awareness.on("update",P),()=>b.awareness.off("update",P)},[b,P]);const G=U.useCallback((ee,ue)=>{const ae=u==="webrtc"?Ox(ee,ue):jx(ee,ue);return ae.on("status",ge=>{A(ge.status==="connected"||"connected"in ge&&ge.connected===!0)}),setTimeout(()=>C(ae),0),ae},[u]);return F.jsxs("div",{ref:y,children:[F.jsx(RC,{children:F.jsxs(ox,{initialConfig:I,children:[F.jsx(rx,{id:t,providerFactory:G,shouldBootstrap:!1,username:n?n.userName:"",cursorColor:g.color,cursorsContainerRef:y}),F.jsxs("div",{className:"editor-container",children:[F.jsx(IT,{styleConfig:e,onlUser:r}),F.jsxs("div",{className:"editor-inner",children:[F.jsx(Bd,{contentEditable:F.jsx("div",{className:"custom-margin",children:F.jsx(Zy,{className:"editor-input"})}),placeholder:null,ErrorBoundary:Hd}),F.jsx(UT,{})]})]}),F.jsx(yC,{}),F.jsx(VT,{}),F.jsx(TC,{}),F.jsx(jC,{}),F.jsx(KT,{onChange:j})]})}),F.jsx(jS,{styleConfig:e})]})}const u1="";function JT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ZT=JT(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Qy(n){const e=n.transform();return e!==null?new Set([e]):new Set}function e_({initialEditor:n,children:e,initialNodes:t,initialTheme:r,skipCollabChecks:i}){const s=U.useRef(!1),o=U.useContext(sa);o==null&&ZT(9);const[a,{getTheme:l}]=o,u=U.useMemo(()=>{const m=r||l()||void 0,y=yf(o,m);if(m!==void 0&&(n._config.theme=m),n._parentEditor=a,t)for(let b of t){let C=null,S=null;if(typeof b!="function"){const v=b;b=v.replace,C=v.with,S=v.withKlass||null}const A=n._nodes.get(b.getType());n._nodes.set(b.getType(),{exportDOM:A?A.exportDOM:void 0,klass:b,replace:C,replaceWithKlass:S,transforms:Qy(b)})}else{const b=n._nodes=new Map(a._nodes);for(const[C,S]of b)n._nodes.set(C,{exportDOM:S.exportDOM,klass:S.klass,replace:S.replace,replaceWithKlass:S.replaceWithKlass,transforms:Qy(S.klass)})}return n._config.namespace=a._config.namespace,n._editable=a._editable,[n,y]},[]),{isCollabActive:g,yjsDocMap:d}=mf(),f=i||s.current||d.has(n.getKey());return U.useEffect(()=>{f&&(s.current=!0)},[f]),U.useEffect(()=>a.registerEditableListener(m=>{n.setEditable(m)}),[n,a]),F.jsx(sa.Provider,{value:u,children:!g||f?e:null})}function t_(n,e){return n.getEditorState().read(()=>{const t=tt(e);return t!==null&&t.isSelected()})}function n_(n){const[e]=$t(),[t,r]=U.useState(()=>t_(e,n));return U.useEffect(()=>{let i=!0;const s=e.registerUpdateListener(()=>{i&&r(t_(e,n))});return()=>{i=!1,s()}},[e,n]),[t,U.useCallback(i=>{e.update(()=>{let s=he();Dt(s)||(s=Zc(),Nt(s)),Dt(s)&&(i?s.add(n):s.delete(n))})},[e,n]),U.useCallback(()=>{e.update(()=>{const i=he();Dt(i)&&i.clear()})},[e])]}const d1="";function r_({className:n,style:e}){return F.jsx(Zy,{className:n||"ContentEditable__root",style:e})}function Wd(n,e,t){return Math.min(Math.max(n,e),t)}const kt={east:1,north:8,south:2,west:4};function QT({onResizeStart:n,onResizeEnd:e,buttonRef:t,imageRef:r,maxWidth:i,editor:s,showCaption:o,setShowCaption:a,captionsEnabled:l}){const u=U.useRef(null),g=U.useRef({priority:"",value:"default"}),d=U.useRef({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),f=s.getRootElement(),m=f!==null?f.getBoundingClientRect().width-20:100,y=f!==null?f.getBoundingClientRect().height-20:100,b=100,C=100,S=N=>{const h=N===kt.east||N===kt.west,I=N===kt.north||N===kt.south,O=N&kt.north&&N&kt.west||N&kt.south&&N&kt.east,j=h?"ew":I?"ns":O?"nwse":"nesw";f!==null&&f.style.setProperty("cursor",`${j}-resize`,"important"),document.body!==null&&(document.body.style.setProperty("cursor",`${j}-resize`,"important"),g.current.value=document.body.style.getPropertyValue("-webkit-user-select"),g.current.priority=document.body.style.getPropertyPriority("-webkit-user-select"),document.body.style.setProperty("-webkit-user-select","none","important"))},A=()=>{f!==null&&f.style.setProperty("cursor","text"),document.body!==null&&(document.body.style.setProperty("cursor","default"),document.body.style.setProperty("-webkit-user-select",g.current.value,g.current.priority))},v=(N,h)=>{if(!s.isEditable())return;const I=r.current,O=u.current;if(I!==null&&O!==null){N.preventDefault();const{width:j,height:P}=I.getBoundingClientRect(),q=d.current;q.startWidth=j,q.startHeight=P,q.ratio=j/P,q.currentWidth=j,q.currentHeight=P,q.startX=N.clientX,q.startY=N.clientY,q.isResizing=!0,q.direction=h,S(h),n(),O.classList.add("image-control-wrapper--resizing"),I.style.height=`${P}px`,I.style.width=`${j}px`,document.addEventListener("pointermove",k),document.addEventListener("pointerup",T)}},k=N=>{const h=r.current,I=d.current,O=I.direction&(kt.east|kt.west),j=I.direction&(kt.south|kt.north);if(h!==null&&I.isResizing){if(O&&j){let P=Math.floor(I.startX-N.clientX);P=I.direction&kt.east?-P:P;const q=Wd(I.startWidth+P,b,m),G=q/I.ratio;h.style.width=`${q}px`,h.style.height=`${G}px`,I.currentHeight=G,I.currentWidth=q}else if(j){let P=Math.floor(I.startY-N.clientY);P=I.direction&kt.south?-P:P;const q=Wd(I.startHeight+P,C,y);h.style.height=`${q}px`,h.style.maxHeight=`${q}px`,I.currentHeight=q}else{let P=Math.floor(I.startX-N.clientX);P=I.direction&kt.east?-P:P;const q=Wd(I.startWidth+P,b,m);h.style.width=`${q}px`,h.style.maxWidth=`${q}px`,I.currentWidth=q}h&&(h.setAttribute("width",`${I.currentWidth}`),h.setAttribute("height",`${I.currentHeight}`))}},T=()=>{const N=r.current,h=d.current,I=u.current;if(N!==null&&I!==null&&h.isResizing){const O=h.currentWidth,j=h.currentHeight;h.startWidth=0,h.startHeight=0,h.ratio=0,h.startX=0,h.startY=0,h.currentWidth=0,h.currentHeight=0,h.isResizing=!1,I.classList.remove("image-control-wrapper--resizing"),A(),e(O,j),document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",T)}};return F.jsxs("div",{ref:u,children:[F.jsx("div",{className:"image-resizer image-resizer-n",onPointerDown:N=>{v(N,kt.north)}}),F.jsx("div",{className:"image-resizer image-resizer-ne",onPointerDown:N=>{v(N,kt.north|kt.east)}}),F.jsx("div",{className:"image-resizer image-resizer-e",onPointerDown:N=>{v(N,kt.east)}}),F.jsx("div",{className:"image-resizer image-resizer-se",onPointerDown:N=>{v(N,kt.south|kt.east)}}),F.jsx("div",{className:"image-resizer image-resizer-s",onPointerDown:N=>{v(N,kt.south)}}),F.jsx("div",{className:"image-resizer image-resizer-sw",onPointerDown:N=>{v(N,kt.south|kt.west)}}),F.jsx("div",{className:"image-resizer image-resizer-w",onPointerDown:N=>{v(N,kt.west)}}),F.jsx("div",{className:"image-resizer image-resizer-nw",onPointerDown:N=>{v(N,kt.north|kt.west)}})]})}const f1="";function i_({children:n,className:e}){return F.jsx("div",{className:e||"Placeholder__root",children:n})}const Bl={x:0,y:0,width:0,height:0,unit:"px"},Ps=(n,e,t)=>Math.min(Math.max(n,e),t),eE=(...n)=>n.filter(e=>e&&typeof e=="string").join(" "),s_=(n,e)=>n===e||n.width===e.width&&n.height===e.height&&n.x===e.x&&n.y===e.y&&n.unit===e.unit;function Fs(n,e,t){return n.unit==="%"?{...Bl,...n,unit:"%"}:{unit:"%",x:n.x?n.x/e*100:0,y:n.y?n.y/t*100:0,width:n.width?n.width/e*100:0,height:n.height?n.height/t*100:0}}function fi(n,e,t){return n.unit?n.unit==="px"?{...Bl,...n,unit:"px"}:{unit:"px",x:n.x?n.x*e/100:0,y:n.y?n.y*t/100:0,width:n.width?n.width*e/100:0,height:n.height?n.height*t/100:0}:{...Bl,...n,unit:"px"}}function o_(n,e,t,r,i,s=0,o=0,a=r,l=i){const u={...n};let g=Math.min(s,r),d=Math.min(o,i),f=Math.min(a,r),m=Math.min(l,i);e&&(e>1?(g=o?o*e:g,d=g/e,f=a*e):(d=s?s/e:d,g=d*e,m=l/e)),u.y<0&&(u.height=Math.max(u.height+u.y,d),u.y=0),u.x<0&&(u.width=Math.max(u.width+u.x,g),u.x=0);const y=r-(u.x+u.width);y<0&&(u.x=Math.min(u.x,r-g),u.width+=y);const b=i-(u.y+u.height);if(b<0&&(u.y=Math.min(u.y,i-d),u.height+=b),u.width<g&&((t==="sw"||t=="nw")&&(u.x-=g-u.width),u.width=g),u.height<d&&((t==="nw"||t=="ne")&&(u.y-=d-u.height),u.height=d),u.width>f&&((t==="sw"||t=="nw")&&(u.x-=f-u.width),u.width=f),u.height>m&&((t==="nw"||t=="ne")&&(u.y-=m-u.height),u.height=m),e){const C=u.width/u.height;if(C<e){const S=Math.max(u.width/e,d);(t==="nw"||t=="ne")&&(u.y-=S-u.height),u.height=S}else if(C>e){const S=Math.max(u.height*e,g);(t==="sw"||t=="nw")&&(u.x-=S-u.width),u.width=S}}return u}function tE(n,e,t,r){const i={...n};return e==="ArrowLeft"?r==="nw"?(i.x-=t,i.y-=t,i.width+=t,i.height+=t):r==="w"?(i.x-=t,i.width+=t):r==="sw"?(i.x-=t,i.width+=t,i.height+=t):r==="ne"?(i.y+=t,i.width-=t,i.height-=t):r==="e"?i.width-=t:r==="se"&&(i.width-=t,i.height-=t):e==="ArrowRight"&&(r==="nw"?(i.x+=t,i.y+=t,i.width-=t,i.height-=t):r==="w"?(i.x+=t,i.width-=t):r==="sw"?(i.x+=t,i.width-=t,i.height-=t):r==="ne"?(i.y-=t,i.width+=t,i.height+=t):r==="e"?i.width+=t:r==="se"&&(i.width+=t,i.height+=t)),e==="ArrowUp"?r==="nw"?(i.x-=t,i.y-=t,i.width+=t,i.height+=t):r==="n"?(i.y-=t,i.height+=t):r==="ne"?(i.y-=t,i.width+=t,i.height+=t):r==="sw"?(i.x+=t,i.width-=t,i.height-=t):r==="s"?i.height-=t:r==="se"&&(i.width-=t,i.height-=t):e==="ArrowDown"&&(r==="nw"?(i.x+=t,i.y+=t,i.width-=t,i.height-=t):r==="n"?(i.y+=t,i.height-=t):r==="ne"?(i.y+=t,i.width-=t,i.height-=t):r==="sw"?(i.x-=t,i.width+=t,i.height+=t):r==="s"?i.height+=t:r==="se"&&(i.width+=t,i.height+=t)),i}const zs={capture:!0,passive:!1};let nE=0;const hi=class ur extends U.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=U.createRef(),this.mediaRef=U.createRef(),this.initChangeCalled=!1,this.instanceId=`rc-${nE++}`,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{const{crop:t,disabled:r}=this.props,i=this.getBox();if(!t)return;const s=fi(t,i.width,i.height);if(r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const o=e.target.dataset.ord,a=!!o;let l=e.clientX,u=e.clientY,g=s.x,d=s.y;if(o){const f=e.clientX-i.x,m=e.clientY-i.y;let y=0,b=0;o==="ne"||o=="e"?(y=f-(s.x+s.width),b=m-s.y,g=s.x,d=s.y+s.height):o==="se"||o==="s"?(y=f-(s.x+s.width),b=m-(s.y+s.height),g=s.x,d=s.y):o==="sw"||o=="w"?(y=f-s.x,b=m-(s.y+s.height),g=s.x+s.width,d=s.y):(o==="nw"||o=="n")&&(y=f-s.x,b=m-s.y,g=s.x+s.width,d=s.y+s.height),l=g+i.x+y,u=d+i.y+b}this.evData={startClientX:l,startClientY:u,startCropX:g,startCropY:d,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:o},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{const{crop:t,disabled:r,locked:i,keepSelection:s,onChange:o}=this.props,a=this.getBox();if(r||i||s&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=e.clientX-a.x,u=e.clientY-a.y,g={unit:"px",x:l,y:u,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:l,startCropY:u,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(fi(g,a.width,a.height),Fs(g,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{const{crop:t,disabled:r,onChange:i,onDragStart:s}=this.props,o=this.getBox();if(r||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(e));const{evData:a}=this;a.clientX=e.clientX,a.clientY=e.clientY;let l;a.isResize?l=this.resizeCrop():l=this.dragCrop(),s_(t,l)||i(fi(l,o.width,o.height),Fs(l,o.width,o.height))},this.onComponentKeyDown=e=>{const{crop:t,disabled:r,onChange:i,onComplete:s}=this.props;if(r)return;const o=e.key;let a=!1;if(!t)return;const l=this.getBox(),u=this.makePixelCrop(l),g=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?ur.nudgeStepLarge:e.shiftKey?ur.nudgeStepMedium:ur.nudgeStep;if(o==="ArrowLeft"?(u.x-=g,a=!0):o==="ArrowRight"?(u.x+=g,a=!0):o==="ArrowUp"?(u.y-=g,a=!0):o==="ArrowDown"&&(u.y+=g,a=!0),a){e.cancelable&&e.preventDefault(),u.x=Ps(u.x,0,l.width-u.width),u.y=Ps(u.y,0,l.height-u.height);const d=fi(u,l.width,l.height),f=Fs(u,l.width,l.height);i(d,f),s&&s(d,f)}},this.onHandlerKeyDown=(e,t)=>{const{aspect:r=0,crop:i,disabled:s,minWidth:o=0,minHeight:a=0,maxWidth:l,maxHeight:u,onChange:g,onComplete:d}=this.props,f=this.getBox();if(s||!i)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;const m=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?ur.nudgeStepLarge:e.shiftKey?ur.nudgeStepMedium:ur.nudgeStep,y=fi(i,f.width,f.height),b=tE(y,e.key,m,t),C=o_(b,r,t,f.width,f.height,o,a,l,u);if(!s_(i,C)){const S=Fs(C,f.width,f.height);g(C,S),d&&d(C,S)}},this.onDocPointerDone=e=>{const{crop:t,disabled:r,onComplete:i,onDragEnd:s}=this.props,o=this.getBox();this.unbindDocMove(),!(r||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,s&&s(e),i&&i(fi(t,o.width,o.height),Fs(t,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=()=>{var e;(e=this.componentRef.current)==null||e.scrollTo(0,0)}}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};const{x:t,y:r,width:i,height:s}=e.getBoundingClientRect();return{x:t,y:r,width:i,height:s}}componentDidUpdate(e){const{crop:t,onComplete:r}=this.props;if(r&&!e.crop&&t){const{width:i,height:s}=this.getBox();i&&s&&r(fi(t,i,s),Fs(t,i,s))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,zs),this.document.addEventListener("pointerup",this.onDocPointerDone,zs),this.document.addEventListener("pointercancel",this.onDocPointerDone,zs),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,zs),this.document.removeEventListener("pointerup",this.onDocPointerDone,zs),this.document.removeEventListener("pointercancel",this.onDocPointerDone,zs),this.docMoveBound=!1)}getCropStyle(){const{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,t=this.getBox(),r=this.makePixelCrop(t),i=e.clientX-e.startClientX,s=e.clientY-e.startClientY;return r.x=Ps(e.startCropX+i,0,t.width-r.width),r.y=Ps(e.startCropY+s,0,t.height-r.height),r}getPointRegion(e,t,r,i){const{evData:s}=this,o=s.clientX-e.x,a=s.clientY-e.y;let l;i&&t?l=t==="nw"||t==="n"||t==="ne":l=a<s.startCropY;let u;return r&&t?u=t==="nw"||t==="w"||t==="sw":u=o<s.startCropX,u?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(e,t,r=0,i=0){const s=Math.min(r,e.width),o=Math.min(i,e.height);return!t||!s&&!o?[s,o]:t>1?s?[s,s/t]:[o*t,o]:o?[o*t,o]:[s,s/t]}resizeCrop(){const{evData:e}=this,{aspect:t=0,maxWidth:r,maxHeight:i}=this.props,s=this.getBox(),[o,a]=this.resolveMinDimensions(s,t,this.props.minWidth,this.props.minHeight);let l=this.makePixelCrop(s);const u=this.getPointRegion(s,e.ord,o,a),g=e.ord||u;let d=e.clientX-e.startClientX,f=e.clientY-e.startClientY;(o&&g==="nw"||g==="w"||g==="sw")&&(d=Math.min(d,-o)),(a&&g==="nw"||g==="n"||g==="ne")&&(f=Math.min(f,-a));const m={unit:"px",x:0,y:0,width:0,height:0};u==="ne"?(m.x=e.startCropX,m.width=d,t?(m.height=m.width/t,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY-m.height)):u==="se"?(m.x=e.startCropX,m.y=e.startCropY,m.width=d,t?m.height=m.width/t:m.height=f):u==="sw"?(m.x=e.startCropX+d,m.y=e.startCropY,m.width=Math.abs(d),t?m.height=m.width/t:m.height=f):u==="nw"&&(m.x=e.startCropX+d,m.width=Math.abs(d),t?(m.height=m.width/t,m.y=e.startCropY-m.height):(m.height=Math.abs(f),m.y=e.startCropY+f));const y=o_(m,t,u,s.width,s.height,o,a,r,i);return t||ur.xyOrds.indexOf(g)>-1?l=y:ur.xOrds.indexOf(g)>-1?(l.x=y.x,l.width=y.width):ur.yOrds.indexOf(g)>-1&&(l.y=y.y,l.height=y.height),l.x=Ps(l.x,0,s.width-l.width),l.y=Ps(l.y,0,s.height-l.height),l}renderCropSelection(){const{ariaLabels:e=ur.defaultProps.ariaLabels,disabled:t,locked:r,renderSelectionAddon:i,ruleOfThirds:s,crop:o}=this.props,a=this.getCropStyle();if(o)return U.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!t&&!r&&U.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},U.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),U.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),U.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),U.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"nw"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"n"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"ne"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"e"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"se"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"s"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"sw"),role:"button"}),U.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"w"),role:"button"})),i&&U.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:l=>l.stopPropagation()},i(this.state)),s&&U.createElement(U.Fragment,null,U.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),U.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){const t={...Bl,...this.props.crop||{}};return fi(t,e.width,e.height)}render(){const{aspect:e,children:t,circularCrop:r,className:i,crop:s,disabled:o,locked:a,style:l,ruleOfThirds:u}=this.props,{cropIsActive:g,newCropIsBeingDrawn:d}=this.state,f=s?this.renderCropSelection():null,m=eE("ReactCrop",i,g&&"ReactCrop--active",o&&"ReactCrop--disabled",a&&"ReactCrop--locked",d&&"ReactCrop--new-crop",s&&e&&"ReactCrop--fixed-aspect",s&&r&&"ReactCrop--circular-crop",s&&u&&"ReactCrop--rule-of-thirds",!this.dragStarted&&s&&!s.width&&!s.height&&"ReactCrop--invisible-crop",r&&"ReactCrop--no-animate");return U.createElement("div",{ref:this.componentRef,className:m,style:l},U.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),s?U.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},U.createElement("defs",null,U.createElement("mask",{id:`hole-${this.instanceId}`},U.createElement("rect",{width:"100%",height:"100%",fill:"white"}),r?U.createElement("ellipse",{cx:`${s.x+s.width/2}${s.unit}`,cy:`${s.y+s.height/2}${s.unit}`,rx:`${s.width/2}${s.unit}`,ry:`${s.height/2}${s.unit}`,fill:"black"}):U.createElement("rect",{x:`${s.x}${s.unit}`,y:`${s.y}${s.unit}`,width:`${s.width}${s.unit}`,height:`${s.height}${s.unit}`,fill:"black"}))),U.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,f)}};hi.xOrds=["e","w"],hi.yOrds=["n","s"],hi.xyOrds=["nw","ne","se","sw"],hi.nudgeStep=1,hi.nudgeStepMedium=10,hi.nudgeStepLarge=100,hi.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};let rE=hi;const h1="",$d=wi();function iE({altText:n,className:e,src:t,width:r,height:i,maxWidth:s,imageRef:o,startCrop:a,setStartCrop:l,isFocused:u}){const[g,d]=U.useState(null),[f,m]=U.useState(null),[y,b]=U.useState({aspect:1,x:0,y:0,width:100,height:100}),C=()=>{if(g){const T=o.current;if(!T||!g)return;const N=T.naturalWidth/T.width,h=T.naturalHeight/T.height,I=new OffscreenCanvas(g.width*N,g.height*h),O=I.getContext("2d");if(!O)throw new Error("No 2D context available");O.drawImage(T,g.x*N,g.y*h,g.width*N,g.height*h,0,0,g.width*N,g.height*h),I.convertToBlob({type:"image/png"}).then(j=>{const P=URL.createObjectURL(j);m(P),l(!1)})}},S=()=>{a||l(T=>(T===!1&&b({aspect:1,x:0,y:0,width:100,height:100}),!T))},A=U.useRef(null),v=U.useRef(null);U.useEffect(()=>{g&&(A.current=g)},[g]);const k=T=>{v.current&&!v.current.contains(T.target)&&l(!1)};return U.useEffect(()=>(document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}),[]),F.jsxs("div",{ref:v,children:[u&&F.jsx("button",{style:{zIndex:999},className:"image-caption-button",onClick:()=>S(),children:"Crop"}),a&&F.jsx("button",{style:{zIndex:999},className:"image-caption-button",onClick:()=>C(),children:"Apply Crop"}),a?F.jsx(rE,{crop:y,onChange:T=>b(T),onComplete:T=>d(T),children:F.jsx("img",{className:e||void 0,src:f||t,alt:n,ref:o,style:{height:i,maxWidth:s,width:r},draggable:"false"})}):F.jsx("img",{className:e||void 0,src:f||t,alt:n,ref:o,style:{height:i,maxWidth:s,width:r},draggable:"false"})]})}function sE({src:n,altText:e,nodeKey:t,width:r,height:i,maxWidth:s,resizable:o,showCaption:a,caption:l}){const u=U.useRef(null),g=U.useRef(null),[d,f,m]=n_(t),[y,b]=U.useState(!1),[C]=$t(),[S,A]=U.useState(null),[v,k]=U.useState(!1),T=U.useRef(null),N=U.useCallback(ae=>{if(d&&Dt(he())){ae.preventDefault();const Le=tt(t);if(kl(Le))return Le.remove(),!0}return!1},[d,t]),h=U.useCallback(ae=>{const ge=he(),Le=g.current;if(d&&Dt(ge)&&ge.getNodes().length===1){if(a)return Nt(null),ae.preventDefault(),l.focus(),!0;if(Le!==null&&Le!==document.activeElement)return ae.preventDefault(),Le.focus(),!0}return!1},[l,d,a]),I=U.useCallback(ae=>T.current===l||g.current===ae.target?(Nt(null),C.update(()=>{f(!0);const ge=C.getRootElement();ge!==null&&ge.focus()}),!0):!1,[l,C,f]),O=U.useCallback(ae=>{const ge=ae;return y?!0:ge.target===u.current?(ge.shiftKey?f(!d):(m(),f(!0)),!0):!1},[y,d,f,m]),j=U.useCallback(ae=>{C.getEditorState().read(()=>{const ge=he();ae.target.tagName==="IMG"&&de(ge)&&ge.getNodes().length===1&&C.dispatchCommand($d,ae)})},[C]);U.useEffect(()=>{let ae=!0;const ge=C.getRootElement(),Le=Kn(C.registerUpdateListener(({editorState:be})=>{ae&&A(be.read(()=>he()))}),C.registerCommand(Hn,(be,oe)=>(T.current=oe,!1),rn),C.registerCommand($s,O,rn),C.registerCommand($d,O,rn),C.registerCommand(es,be=>be.target===u.current?(be.preventDefault(),!0):!1,rn),C.registerCommand(Ks,N,rn),C.registerCommand(Vs,N,rn),C.registerCommand(Ci,h,rn),C.registerCommand(qs,I,rn));return ge==null||ge.addEventListener("contextmenu",j),()=>{ae=!1,Le(),ge==null||ge.removeEventListener("contextmenu",j)}},[m,C,y,d,t,N,h,I,O,j,f]);const P=()=>{C.update(()=>{const ae=tt(t);kl(ae)&&ae.setShowCaption(!0)})},q=(ae,ge)=>{setTimeout(()=>{b(!1)},200),C.update(()=>{const Le=tt(t);kl(Le)&&Le.setWidthAndHeight(ae,ge)})},G=()=>{v||b(!0)},ee=d&&Dt(S)&&!y,ue=d||y;return F.jsx(U.Suspense,{fallback:null,children:F.jsxs(F.Fragment,{children:[F.jsx("div",{draggable:ee,children:F.jsx(iE,{className:ue?`focused ${Dt(S)?"draggable":""}`:null,src:n,altText:e,width:r,height:i,maxWidth:s,imageRef:u,startCrop:v,setStartCrop:k,isFocused:ue})}),a&&F.jsx("div",{className:"image-caption-container",children:F.jsx(e_,{initialEditor:l,children:F.jsx(Bd,{contentEditable:F.jsx(r_,{className:"ImageNode__contentEditable"}),placeholder:F.jsx(i_,{className:"ImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:Hd})})}),!v&&o&&Dt(S)&&ue&&F.jsx(QT,{showCaption:a,setShowCaption:P,editor:C,buttonRef:g,maxWidth:s,onResizeStart:v?()=>{}:G,onResizeEnd:v?()=>{}:q,captionsEnabled:!1,imageRef:u})]})})}const oE=Object.freeze(Object.defineProperty({__proto__:null,RIGHT_CLICK_IMAGE_COMMAND:$d,default:sE},Symbol.toStringTag,{value:"Module"})),a_=new Set;function aE(n){if(!a_.has(n))throw new Promise(e=>{const t=new Image;t.src=n,t.onload=()=>{a_.add(n),e(null)}})}function lE({altText:n,className:e,imageRef:t,src:r,width:i,height:s,position:o}){return aE(r),F.jsx("img",{className:e||void 0,src:r,alt:n,ref:t,"data-position":o,style:{display:"block",height:s,width:i},draggable:"false"})}function l_({activeEditor:n,nodeKey:e,onClose:t}){const i=n.getEditorState().read(()=>tt(e)),[s,o]=U.useState(i.getAltText()),[a,l]=U.useState(i.getShowCaption()),[u,g]=U.useState(i.getPosition()),d=y=>{l(y.target.checked)},f=y=>{g(y.target.value)},m=()=>{const y={altText:s,position:u,showCaption:a};i&&n.update(()=>{i.update(y)}),t()};return F.jsxs(F.Fragment,{children:[F.jsx("div",{style:{marginBottom:"1em"},children:F.jsx(oy,{label:"Alt Text",placeholder:"Descriptive alternative text",onChange:o,value:s,"data-test-id":"image-modal-alt-text-input"})}),F.jsxs(LC,{style:{marginBottom:"1em",width:"208px"},value:u,label:"Position",name:"position",id:"position-select",onChange:f,children:[F.jsx("option",{value:"left",children:"Left"}),F.jsx("option",{value:"right",children:"Right"}),F.jsx("option",{value:"full",children:"Full Width"})]}),F.jsxs("div",{className:"Input__wrapper",children:[F.jsx("input",{id:"caption",type:"checkbox",checked:a,onChange:d}),F.jsx("label",{htmlFor:"caption",children:"Show Caption"})]}),F.jsx(ay,{children:F.jsx(ly,{"data-test-id":"image-modal-file-upload-btn",onClick:()=>m(),children:"Confirm"})})]})}function cE({src:n,altText:e,nodeKey:t,width:r,height:i,showCaption:s,caption:o,position:a}){const[l,u]=Gy(),g=U.useRef(null),d=U.useRef(null),[f,m,y]=n_(t),[b]=$t(),[C,S]=U.useState(null),A=U.useRef(null),v=U.useCallback(I=>{if(f&&Dt(he())){I.preventDefault();const j=tt(t);if(Ym(j))return j.remove(),!0}return!1},[f,t]),k=U.useCallback(I=>{const O=he(),j=d.current;if(f&&Dt(O)&&O.getNodes().length===1){if(s)return Nt(null),I.preventDefault(),o.focus(),!0;if(j!==null&&j!==document.activeElement)return I.preventDefault(),j.focus(),!0}return!1},[o,f,s]),T=U.useCallback(I=>A.current===o||d.current===I.target?(Nt(null),b.update(()=>{m(!0);const O=b.getRootElement();O!==null&&O.focus()}),!0):!1,[o,b,m]);U.useEffect(()=>{let I=!0;const O=Kn(b.registerUpdateListener(({editorState:j})=>{I&&S(j.read(()=>he()))}),b.registerCommand(Hn,(j,P)=>(A.current=P,!1),rn),b.registerCommand($s,j=>{const P=j;return P.target===g.current?(P.shiftKey?m(!f):(y(),m(!0)),!0):!1},rn),b.registerCommand(es,j=>j.target===g.current?(j.preventDefault(),!0):!1,rn),b.registerCommand(Ks,v,rn),b.registerCommand(Vs,v,rn),b.registerCommand(Ci,k,rn),b.registerCommand(qs,T,rn));return()=>{I=!1,O()}},[y,b,f,t,v,k,T,m]);const N=f&&Dt(C),h=f;return F.jsxs(U.Suspense,{fallback:null,children:[F.jsxs(F.Fragment,{children:[F.jsxs("div",{draggable:N,children:[F.jsx("button",{className:"image-edit-button",ref:d,onClick:()=>{u("Update Inline Image",I=>F.jsx(l_,{activeEditor:b,nodeKey:t,onClose:I}))},children:"Edit"}),F.jsx(lE,{className:h?`focused ${Dt(C)?"draggable":""}`:null,src:n,altText:e,imageRef:g,width:r,height:i,position:a})]}),s&&F.jsx("div",{className:"image-caption-container",children:F.jsx(e_,{initialEditor:o,children:F.jsx(Bd,{contentEditable:F.jsx(r_,{className:"InlineImageNode__contentEditable"}),placeholder:F.jsx(i_,{className:"InlineImageNode__placeholder",children:"Enter a caption..."}),ErrorBoundary:Hd})})})]}),l]})}const uE=Object.freeze(Object.defineProperty({__proto__:null,UpdateInlineImageDialog:l_,default:cE},Symbol.toStringTag,{value:"Module"}));xn.Editor=XT,Object.defineProperty(xn,Symbol.toStringTag,{value:"Module"})});
133
133
  //# sourceMappingURL=index.umd.js.map