datocms-plugin-record-comments 1.0.0 → 1.0.1
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.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var vl=Symbol.for("react.element"),GT=Symbol.for("react.portal"),JT=Symbol.for("react.fragment"),YT=Symbol.for("react.strict_mode"),QT=Symbol.for("react.profiler"),XT=Symbol.for("react.provider"),ZT=Symbol.for("react.context"),eC=Symbol.for("react.forward_ref"),tC=Symbol.for("react.suspense"),nC=Symbol.for("react.memo"),rC=Symbol.for("react.lazy"),Fg=Symbol.iterator;function oC(t){return t===null||typeof t!="object"?null:(t=Fg&&t[Fg]||t["@@iterator"],typeof t=="function"?t:null)}var sb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ab=Object.assign,lb={};function Cs(t,e,n){this.props=t,this.context=e,this.refs=lb,this.updater=n||sb}Cs.prototype.isReactComponent={};Cs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Cs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function ub(){}ub.prototype=Cs.prototype;function Im(t,e,n){this.props=t,this.context=e,this.refs=lb,this.updater=n||sb}var Pm=Im.prototype=new ub;Pm.constructor=Im;ab(Pm,Cs.prototype);Pm.isPureReactComponent=!0;var $g=Array.isArray,cb=Object.prototype.hasOwnProperty,Rm={current:null},db={key:!0,ref:!0,__self:!0,__source:!0};function fb(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)cb.call(e,r)&&!db.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var u=Array(a),l=0;l<a;l++)u[l]=arguments[l+2];o.children=u}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:vl,type:t,key:i,ref:s,props:o,_owner:Rm.current}}function iC(t,e){return{$$typeof:vl,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Dm(t){return typeof t=="object"&&t!==null&&t.$$typeof===vl}function sC(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var zg=/\/+/g;function lf(t,e){return typeof t=="object"&&t!==null&&t.key!=null?sC(""+t.key):e.toString(36)}function gu(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case vl:case GT:s=!0}}if(s)return s=t,o=o(s),t=r===""?"."+lf(s,0):r,$g(o)?(n="",t!=null&&(n=t.replace(zg,"$&/")+"/"),gu(o,e,n,"",function(l){return l})):o!=null&&(Dm(o)&&(o=iC(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(zg,"$&/")+"/")+t)),e.push(o)),1;if(s=0,r=r===""?".":r+":",$g(t))for(var a=0;a<t.length;a++){i=t[a];var u=r+lf(i,a);s+=gu(i,e,n,u,o)}else if(u=oC(t),typeof u=="function")for(t=u.call(t),a=0;!(i=t.next()).done;)i=i.value,u=r+lf(i,a++),s+=gu(i,e,n,u,o);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function Ol(t,e,n){if(t==null)return t;var r=[],o=0;return gu(t,r,"","",function(i){return e.call(n,i,o++)}),r}function aC(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var
|
|
9
|
+
*/var vl=Symbol.for("react.element"),GT=Symbol.for("react.portal"),JT=Symbol.for("react.fragment"),YT=Symbol.for("react.strict_mode"),QT=Symbol.for("react.profiler"),XT=Symbol.for("react.provider"),ZT=Symbol.for("react.context"),eC=Symbol.for("react.forward_ref"),tC=Symbol.for("react.suspense"),nC=Symbol.for("react.memo"),rC=Symbol.for("react.lazy"),Fg=Symbol.iterator;function oC(t){return t===null||typeof t!="object"?null:(t=Fg&&t[Fg]||t["@@iterator"],typeof t=="function"?t:null)}var sb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ab=Object.assign,lb={};function Cs(t,e,n){this.props=t,this.context=e,this.refs=lb,this.updater=n||sb}Cs.prototype.isReactComponent={};Cs.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Cs.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function ub(){}ub.prototype=Cs.prototype;function Im(t,e,n){this.props=t,this.context=e,this.refs=lb,this.updater=n||sb}var Pm=Im.prototype=new ub;Pm.constructor=Im;ab(Pm,Cs.prototype);Pm.isPureReactComponent=!0;var $g=Array.isArray,cb=Object.prototype.hasOwnProperty,Rm={current:null},db={key:!0,ref:!0,__self:!0,__source:!0};function fb(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)cb.call(e,r)&&!db.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var u=Array(a),l=0;l<a;l++)u[l]=arguments[l+2];o.children=u}if(t&&t.defaultProps)for(r in a=t.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:vl,type:t,key:i,ref:s,props:o,_owner:Rm.current}}function iC(t,e){return{$$typeof:vl,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Dm(t){return typeof t=="object"&&t!==null&&t.$$typeof===vl}function sC(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var zg=/\/+/g;function lf(t,e){return typeof t=="object"&&t!==null&&t.key!=null?sC(""+t.key):e.toString(36)}function gu(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case vl:case GT:s=!0}}if(s)return s=t,o=o(s),t=r===""?"."+lf(s,0):r,$g(o)?(n="",t!=null&&(n=t.replace(zg,"$&/")+"/"),gu(o,e,n,"",function(l){return l})):o!=null&&(Dm(o)&&(o=iC(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(zg,"$&/")+"/")+t)),e.push(o)),1;if(s=0,r=r===""?".":r+":",$g(t))for(var a=0;a<t.length;a++){i=t[a];var u=r+lf(i,a);s+=gu(i,e,n,u,o)}else if(u=oC(t),typeof u=="function")for(t=u.call(t),a=0;!(i=t.next()).done;)i=i.value,u=r+lf(i,a++),s+=gu(i,e,n,u,o);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function Ol(t,e,n){if(t==null)return t;var r=[],o=0;return gu(t,r,"","",function(i){return e.call(n,i,o++)}),r}function aC(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Vt={current:null},vu={transition:null},lC={ReactCurrentDispatcher:Vt,ReactCurrentBatchConfig:vu,ReactCurrentOwner:Rm};function pb(){throw Error("act(...) is not supported in production builds of React.")}ve.Children={map:Ol,forEach:function(t,e,n){Ol(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Ol(t,function(){e++}),e},toArray:function(t){return Ol(t,function(e){return e})||[]},only:function(t){if(!Dm(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ve.Component=Cs;ve.Fragment=JT;ve.Profiler=QT;ve.PureComponent=Im;ve.StrictMode=YT;ve.Suspense=tC;ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lC;ve.act=pb;ve.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=ab({},t.props),o=t.key,i=t.ref,s=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,s=Rm.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var a=t.type.defaultProps;for(u in e)cb.call(e,u)&&!db.hasOwnProperty(u)&&(r[u]=e[u]===void 0&&a!==void 0?a[u]:e[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){a=Array(u);for(var l=0;l<u;l++)a[l]=arguments[l+2];r.children=a}return{$$typeof:vl,type:t.type,key:o,ref:i,props:r,_owner:s}};ve.createContext=function(t){return t={$$typeof:ZT,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:XT,_context:t},t.Consumer=t};ve.createElement=fb;ve.createFactory=function(t){var e=fb.bind(null,t);return e.type=t,e};ve.createRef=function(){return{current:null}};ve.forwardRef=function(t){return{$$typeof:eC,render:t}};ve.isValidElement=Dm;ve.lazy=function(t){return{$$typeof:rC,_payload:{_status:-1,_result:t},_init:aC}};ve.memo=function(t,e){return{$$typeof:nC,type:t,compare:e===void 0?null:e}};ve.startTransition=function(t){var e=vu.transition;vu.transition={};try{t()}finally{vu.transition=e}};ve.unstable_act=pb;ve.useCallback=function(t,e){return Vt.current.useCallback(t,e)};ve.useContext=function(t){return Vt.current.useContext(t)};ve.useDebugValue=function(){};ve.useDeferredValue=function(t){return Vt.current.useDeferredValue(t)};ve.useEffect=function(t,e){return Vt.current.useEffect(t,e)};ve.useId=function(){return Vt.current.useId()};ve.useImperativeHandle=function(t,e,n){return Vt.current.useImperativeHandle(t,e,n)};ve.useInsertionEffect=function(t,e){return Vt.current.useInsertionEffect(t,e)};ve.useLayoutEffect=function(t,e){return Vt.current.useLayoutEffect(t,e)};ve.useMemo=function(t,e){return Vt.current.useMemo(t,e)};ve.useReducer=function(t,e,n){return Vt.current.useReducer(t,e,n)};ve.useRef=function(t){return Vt.current.useRef(t)};ve.useState=function(t){return Vt.current.useState(t)};ve.useSyncExternalStore=function(t,e,n){return Vt.current.useSyncExternalStore(t,e,n)};ve.useTransition=function(){return Vt.current.useTransition()};ve.version="18.3.1";ib.exports=ve;var _=ib.exports;const ue=di(_);/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -36,14 +36,14 @@ Caused By:
|
|
|
36
36
|
*
|
|
37
37
|
* This source code is licensed under the MIT license found in the
|
|
38
38
|
* LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/var ZN=_,ln=XN;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var kb=new Set,Ma={};function hi(t,e){cs(t,e),cs(t+"Capture",e)}function cs(t,e){for(Ma[t]=e,t=0;t<e.length;t++)kb.add(e[t])}var Sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ip=Object.prototype.hasOwnProperty,eA=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Jg={},Yg={};function tA(t){return Ip.call(Yg,t)?!0:Ip.call(Jg,t)?!1:eA.test(t)?Yg[t]=!0:(Jg[t]=!0,!1)}function nA(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function rA(t,e,n,r){if(e===null||typeof e>"u"||nA(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function
|
|
39
|
+
*/var ZN=_,ln=XN;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var kb=new Set,Ma={};function hi(t,e){cs(t,e),cs(t+"Capture",e)}function cs(t,e){for(Ma[t]=e,t=0;t<e.length;t++)kb.add(e[t])}var Sr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ip=Object.prototype.hasOwnProperty,eA=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Jg={},Yg={};function tA(t){return Ip.call(Yg,t)?!0:Ip.call(Jg,t)?!1:eA.test(t)?Yg[t]=!0:(Jg[t]=!0,!1)}function nA(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function rA(t,e,n,r){if(e===null||typeof e>"u"||nA(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function qt(t,e,n,r,o,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ct[t]=new qt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ct[e]=new qt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ct[t]=new qt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ct[t]=new qt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ct[t]=new qt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ct[t]=new qt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ct[t]=new qt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ct[t]=new qt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ct[t]=new qt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Fm=/[\-:]([a-z])/g;function $m(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Fm,$m);Ct[e]=new qt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Fm,$m);Ct[e]=new qt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Fm,$m);Ct[e]=new qt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ct[t]=new qt(t,1,!1,t.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new qt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ct[t]=new qt(t,1,!1,t.toLowerCase(),null,!0,!0)});function zm(t,e,n,r){var o=Ct.hasOwnProperty(e)?Ct[e]:null;(o!==null?o.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(rA(e,n,o,r)&&(n=null),r||o===null?tA(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):o.mustUseProperty?t[o.propertyName]=n===null?o.type===3?!1:"":n:(e=o.attributeName,r=o.attributeNamespace,n===null?t.removeAttribute(e):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Mr=ZN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Il=Symbol.for("react.element"),Oi=Symbol.for("react.portal"),Ni=Symbol.for("react.fragment"),Um=Symbol.for("react.strict_mode"),Pp=Symbol.for("react.profiler"),xb=Symbol.for("react.provider"),Eb=Symbol.for("react.context"),Vm=Symbol.for("react.forward_ref"),Rp=Symbol.for("react.suspense"),Dp=Symbol.for("react.suspense_list"),qm=Symbol.for("react.memo"),jr=Symbol.for("react.lazy"),Tb=Symbol.for("react.offscreen"),Qg=Symbol.iterator;function Is(t){return t===null||typeof t!="object"?null:(t=Qg&&t[Qg]||t["@@iterator"],typeof t=="function"?t:null)}var Ge=Object.assign,df;function Ys(t){if(df===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);df=e&&e[1]||""}return`
|
|
40
40
|
`+df+t}var ff=!1;function pf(t,e){if(!t||ff)return"";ff=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(l){var r=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){r=l}t.call(e.prototype)}else{try{throw Error()}catch(l){r=l}t()}}catch(l){if(l&&r&&typeof l.stack=="string"){for(var o=l.stack.split(`
|
|
41
41
|
`),i=r.stack.split(`
|
|
42
42
|
`),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var u=`
|
|
43
43
|
`+o[s].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=s&&0<=a);break}}}finally{ff=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Ys(t):""}function oA(t){switch(t.tag){case 5:return Ys(t.type);case 16:return Ys("Lazy");case 13:return Ys("Suspense");case 19:return Ys("SuspenseList");case 0:case 2:case 15:return t=pf(t.type,!1),t;case 11:return t=pf(t.type.render,!1),t;case 1:return t=pf(t.type,!0),t;default:return""}}function jp(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Ni:return"Fragment";case Oi:return"Portal";case Pp:return"Profiler";case Um:return"StrictMode";case Rp:return"Suspense";case Dp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Eb:return(t.displayName||"Context")+".Consumer";case xb:return(t._context.displayName||"Context")+".Provider";case Vm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case qm:return e=t.displayName||null,e!==null?e:jp(t.type)||"Memo";case jr:e=t._payload,t=t._init;try{return jp(t(e))}catch{}}return null}function iA(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return jp(e);case 8:return e===Um?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function co(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Cb(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function sA(t){var e=Cb(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Pl(t){t._valueTracker||(t._valueTracker=sA(t))}function Mb(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Cb(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Gu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Lp(t,e){var n=e.checked;return Ge({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Xg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=co(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Ob(t,e){e=e.checked,e!=null&&zm(t,"checked",e,!1)}function Bp(t,e){Ob(t,e);var n=co(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Fp(t,e.type,n):e.hasOwnProperty("defaultValue")&&Fp(t,e.type,co(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Zg(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Fp(t,e,n){(e!=="number"||Gu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Qs=Array.isArray;function Xi(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o<n.length;o++)e["$"+n[o]]=!0;for(n=0;n<t.length;n++)o=e.hasOwnProperty("$"+t[n].value),t[n].selected!==o&&(t[n].selected=o),o&&r&&(t[n].defaultSelected=!0)}else{for(n=""+co(n),e=null,o=0;o<t.length;o++){if(t[o].value===n){t[o].selected=!0,r&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function $p(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(W(91));return Ge({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function e0(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(W(92));if(Qs(n)){if(1<n.length)throw Error(W(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:co(n)}}function Nb(t,e){var n=co(e.value),r=co(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function t0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Ab(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function zp(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Ab(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Rl,Ib=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,o){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Rl=Rl||document.createElement("div"),Rl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Rl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Oa(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var sa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},aA=["Webkit","ms","Moz","O"];Object.keys(sa).forEach(function(t){aA.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),sa[e]=sa[t]})});function Pb(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||sa.hasOwnProperty(t)&&sa[t]?(""+e).trim():e+"px"}function Rb(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Pb(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var lA=Ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Up(t,e){if(e){if(lA[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function Vp(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qp=null;function Hm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Hp=null,Zi=null,es=null;function n0(t){if(t=Sl(t)){if(typeof Hp!="function")throw Error(W(280));var e=t.stateNode;e&&(e=Cd(e),Hp(t.stateNode,t.type,e))}}function Db(t){Zi?es?es.push(t):es=[t]:Zi=t}function jb(){if(Zi){var t=Zi,e=es;if(es=Zi=null,n0(t),e)for(t=0;t<e.length;t++)n0(e[t])}}function Lb(t,e){return t(e)}function Bb(){}var hf=!1;function Fb(t,e,n){if(hf)return t(e,n);hf=!0;try{return Lb(t,e,n)}finally{hf=!1,(Zi!==null||es!==null)&&(Bb(),jb())}}function Na(t,e){var n=t.stateNode;if(n===null)return null;var r=Cd(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(W(231,e,typeof n));return n}var Wp=!1;if(Sr)try{var Ps={};Object.defineProperty(Ps,"passive",{get:function(){Wp=!0}}),window.addEventListener("test",Ps,Ps),window.removeEventListener("test",Ps,Ps)}catch{Wp=!1}function uA(t,e,n,r,o,i,s,a,u){var l=Array.prototype.slice.call(arguments,3);try{e.apply(n,l)}catch(c){this.onError(c)}}var aa=!1,Ju=null,Yu=!1,Kp=null,cA={onError:function(t){aa=!0,Ju=t}};function dA(t,e,n,r,o,i,s,a,u){aa=!1,Ju=null,uA.apply(cA,arguments)}function fA(t,e,n,r,o,i,s,a,u){if(dA.apply(this,arguments),aa){if(aa){var l=Ju;aa=!1,Ju=null}else throw Error(W(198));Yu||(Yu=!0,Kp=l)}}function mi(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function $b(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function r0(t){if(mi(t)!==t)throw Error(W(188))}function pA(t){var e=t.alternate;if(!e){if(e=mi(t),e===null)throw Error(W(188));return e!==t?null:t}for(var n=t,r=e;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return r0(o),t;if(i===r)return r0(o),e;i=i.sibling}throw Error(W(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?t:e}function zb(t){return t=pA(t),t!==null?Ub(t):null}function Ub(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Ub(t);if(e!==null)return e;t=t.sibling}return null}var Vb=ln.unstable_scheduleCallback,o0=ln.unstable_cancelCallback,hA=ln.unstable_shouldYield,mA=ln.unstable_requestPaint,Ze=ln.unstable_now,yA=ln.unstable_getCurrentPriorityLevel,Wm=ln.unstable_ImmediatePriority,qb=ln.unstable_UserBlockingPriority,Qu=ln.unstable_NormalPriority,gA=ln.unstable_LowPriority,Hb=ln.unstable_IdlePriority,kd=null,Zn=null;function vA(t){if(Zn&&typeof Zn.onCommitFiberRoot=="function")try{Zn.onCommitFiberRoot(kd,t,void 0,(t.current.flags&128)===128)}catch{}}var Ln=Math.clz32?Math.clz32:_A,wA=Math.log,bA=Math.LN2;function _A(t){return t>>>=0,t===0?32:31-(wA(t)/bA|0)|0}var Dl=64,jl=4194304;function Xs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Xu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Xs(a):(i&=s,i!==0&&(r=Xs(i)))}else s=n&~o,s!==0?r=Xs(s):i!==0&&(r=Xs(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&o)&&(o=r&-r,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Ln(e),o=1<<n,r|=t[n],e&=~o;return r}function SA(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kA(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var s=31-Ln(i),a=1<<s,u=o[s];u===-1?(!(a&n)||a&r)&&(o[s]=SA(a,e)):u<=e&&(t.expiredLanes|=a),i&=~a}}function Gp(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Wb(){var t=Dl;return Dl<<=1,!(Dl&4194240)&&(Dl=64),t}function mf(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function bl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Ln(e),t[e]=n}function xA(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var o=31-Ln(n),i=1<<o;e[o]=0,r[o]=-1,t[o]=-1,n&=~i}}function Km(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Ln(n),o=1<<r;o&e|t[r]&e&&(t[r]|=e),n&=~o}}var Oe=0;function Kb(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Gb,Gm,Jb,Yb,Qb,Jp=!1,Ll=[],Qr=null,Xr=null,Zr=null,Aa=new Map,Ia=new Map,zr=[],EA="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function i0(t,e){switch(t){case"focusin":case"focusout":Qr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":Aa.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ia.delete(e.pointerId)}}function Rs(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},e!==null&&(e=Sl(e),e!==null&&Gm(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function TA(t,e,n,r,o){switch(e){case"focusin":return Qr=Rs(Qr,t,e,n,r,o),!0;case"dragenter":return Xr=Rs(Xr,t,e,n,r,o),!0;case"mouseover":return Zr=Rs(Zr,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return Aa.set(i,Rs(Aa.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ia.set(i,Rs(Ia.get(i)||null,t,e,n,r,o)),!0}return!1}function Xb(t){var e=Po(t.target);if(e!==null){var n=mi(e);if(n!==null){if(e=n.tag,e===13){if(e=$b(n),e!==null){t.blockedOn=e,Qb(t.priority,function(){Jb(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Su(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Yp(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);qp=r,n.target.dispatchEvent(r),qp=null}else return e=Sl(n),e!==null&&Gm(e),t.blockedOn=n,!1;e.shift()}return!0}function s0(t,e,n){Su(t)&&n.delete(e)}function CA(){Jp=!1,Qr!==null&&Su(Qr)&&(Qr=null),Xr!==null&&Su(Xr)&&(Xr=null),Zr!==null&&Su(Zr)&&(Zr=null),Aa.forEach(s0),Ia.forEach(s0)}function Ds(t,e){t.blockedOn===e&&(t.blockedOn=null,Jp||(Jp=!0,ln.unstable_scheduleCallback(ln.unstable_NormalPriority,CA)))}function Pa(t){function e(o){return Ds(o,t)}if(0<Ll.length){Ds(Ll[0],t);for(var n=1;n<Ll.length;n++){var r=Ll[n];r.blockedOn===t&&(r.blockedOn=null)}}for(Qr!==null&&Ds(Qr,t),Xr!==null&&Ds(Xr,t),Zr!==null&&Ds(Zr,t),Aa.forEach(e),Ia.forEach(e),n=0;n<zr.length;n++)r=zr[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<zr.length&&(n=zr[0],n.blockedOn===null);)Xb(n),n.blockedOn===null&&zr.shift()}var ts=Mr.ReactCurrentBatchConfig,Zu=!0;function MA(t,e,n,r){var o=Oe,i=ts.transition;ts.transition=null;try{Oe=1,Jm(t,e,n,r)}finally{Oe=o,ts.transition=i}}function OA(t,e,n,r){var o=Oe,i=ts.transition;ts.transition=null;try{Oe=4,Jm(t,e,n,r)}finally{Oe=o,ts.transition=i}}function Jm(t,e,n,r){if(Zu){var o=Yp(t,e,n,r);if(o===null)Ef(t,e,r,ec,n),i0(t,r);else if(TA(o,t,e,n,r))r.stopPropagation();else if(i0(t,r),e&4&&-1<EA.indexOf(t)){for(;o!==null;){var i=Sl(o);if(i!==null&&Gb(i),i=Yp(t,e,n,r),i===null&&Ef(t,e,r,ec,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Ef(t,e,r,null,n)}}var ec=null;function Yp(t,e,n,r){if(ec=null,t=Hm(r),t=Po(t),t!==null)if(e=mi(t),e===null)t=null;else if(n=e.tag,n===13){if(t=$b(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return ec=t,null}function Zb(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(yA()){case Wm:return 1;case qb:return 4;case Qu:case gA:return 16;case Hb:return 536870912;default:return 16}default:return 16}}var Wr=null,Ym=null,ku=null;function e_(){if(ku)return ku;var t,e=Ym,n=e.length,r,o="value"in Wr?Wr.value:Wr.textContent,i=o.length;for(t=0;t<n&&e[t]===o[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===o[i-r];r++);return ku=o.slice(t,1<r?1-r:void 0)}function xu(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Bl(){return!0}function a0(){return!1}function cn(t){function e(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(n=t[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Bl:a0,this.isPropagationStopped=a0,this}return Ge(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Bl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Bl)},persist:function(){},isPersistent:Bl}),e}var Ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qm=cn(Ms),_l=Ge({},Ms,{view:0,detail:0}),NA=cn(_l),yf,gf,js,xd=Ge({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xm,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==js&&(js&&t.type==="mousemove"?(yf=t.screenX-js.screenX,gf=t.screenY-js.screenY):gf=yf=0,js=t),yf)},movementY:function(t){return"movementY"in t?t.movementY:gf}}),l0=cn(xd),AA=Ge({},xd,{dataTransfer:0}),IA=cn(AA),PA=Ge({},_l,{relatedTarget:0}),vf=cn(PA),RA=Ge({},Ms,{animationName:0,elapsedTime:0,pseudoElement:0}),DA=cn(RA),jA=Ge({},Ms,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),LA=cn(jA),BA=Ge({},Ms,{data:0}),u0=cn(BA),FA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$A={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},zA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function UA(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=zA[t])?!!e[t]:!1}function Xm(){return UA}var VA=Ge({},_l,{key:function(t){if(t.key){var e=FA[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=xu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?$A[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xm,charCode:function(t){return t.type==="keypress"?xu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?xu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),qA=cn(VA),HA=Ge({},xd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),c0=cn(HA),WA=Ge({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xm}),KA=cn(WA),GA=Ge({},Ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),JA=cn(GA),YA=Ge({},xd,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),QA=cn(YA),XA=[9,13,27,32],Zm=Sr&&"CompositionEvent"in window,la=null;Sr&&"documentMode"in document&&(la=document.documentMode);var ZA=Sr&&"TextEvent"in window&&!la,t_=Sr&&(!Zm||la&&8<la&&11>=la),d0=" ",f0=!1;function n_(t,e){switch(t){case"keyup":return XA.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function r_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ai=!1;function eI(t,e){switch(t){case"compositionend":return r_(e);case"keypress":return e.which!==32?null:(f0=!0,d0);case"textInput":return t=e.data,t===d0&&f0?null:t;default:return null}}function tI(t,e){if(Ai)return t==="compositionend"||!Zm&&n_(t,e)?(t=e_(),ku=Ym=Wr=null,Ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return t_&&e.locale!=="ko"?null:e.data;default:return null}}var nI={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function p0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!nI[t.type]:e==="textarea"}function o_(t,e,n,r){Db(r),e=tc(e,"onChange"),0<e.length&&(n=new Qm("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ua=null,Ra=null;function rI(t){m_(t,0)}function Ed(t){var e=Ri(t);if(Mb(e))return t}function oI(t,e){if(t==="change")return e}var i_=!1;if(Sr){var wf;if(Sr){var bf="oninput"in document;if(!bf){var h0=document.createElement("div");h0.setAttribute("oninput","return;"),bf=typeof h0.oninput=="function"}wf=bf}else wf=!1;i_=wf&&(!document.documentMode||9<document.documentMode)}function m0(){ua&&(ua.detachEvent("onpropertychange",s_),Ra=ua=null)}function s_(t){if(t.propertyName==="value"&&Ed(Ra)){var e=[];o_(e,Ra,t,Hm(t)),Fb(rI,e)}}function iI(t,e,n){t==="focusin"?(m0(),ua=e,Ra=n,ua.attachEvent("onpropertychange",s_)):t==="focusout"&&m0()}function sI(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ed(Ra)}function aI(t,e){if(t==="click")return Ed(e)}function lI(t,e){if(t==="input"||t==="change")return Ed(e)}function uI(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Fn=typeof Object.is=="function"?Object.is:uI;function Da(t,e){if(Fn(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!Ip.call(e,o)||!Fn(t[o],e[o]))return!1}return!0}function y0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function g0(t,e){var n=y0(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=y0(n)}}function a_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?a_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function l_(){for(var t=window,e=Gu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Gu(t.document)}return e}function ey(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function cI(t){var e=l_(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&a_(n.ownerDocument.documentElement,n)){if(r!==null&&ey(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!t.extend&&i>r&&(o=r,r=i,i=o),o=g0(n,i);var s=g0(n,r);o&&s&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var dI=Sr&&"documentMode"in document&&11>=document.documentMode,Ii=null,Qp=null,ca=null,Xp=!1;function v0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xp||Ii==null||Ii!==Gu(r)||(r=Ii,"selectionStart"in r&&ey(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ca&&Da(ca,r)||(ca=r,r=tc(Qp,"onSelect"),0<r.length&&(e=new Qm("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Ii)))}function Fl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Pi={animationend:Fl("Animation","AnimationEnd"),animationiteration:Fl("Animation","AnimationIteration"),animationstart:Fl("Animation","AnimationStart"),transitionend:Fl("Transition","TransitionEnd")},_f={},u_={};Sr&&(u_=document.createElement("div").style,"AnimationEvent"in window||(delete Pi.animationend.animation,delete Pi.animationiteration.animation,delete Pi.animationstart.animation),"TransitionEvent"in window||delete Pi.transitionend.transition);function Td(t){if(_f[t])return _f[t];if(!Pi[t])return t;var e=Pi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in u_)return _f[t]=e[n];return t}var c_=Td("animationend"),d_=Td("animationiteration"),f_=Td("animationstart"),p_=Td("transitionend"),h_=new Map,w0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function mo(t,e){h_.set(t,e),hi(e,[t])}for(var Sf=0;Sf<w0.length;Sf++){var kf=w0[Sf],fI=kf.toLowerCase(),pI=kf[0].toUpperCase()+kf.slice(1);mo(fI,"on"+pI)}mo(c_,"onAnimationEnd");mo(d_,"onAnimationIteration");mo(f_,"onAnimationStart");mo("dblclick","onDoubleClick");mo("focusin","onFocus");mo("focusout","onBlur");mo(p_,"onTransitionEnd");cs("onMouseEnter",["mouseout","mouseover"]);cs("onMouseLeave",["mouseout","mouseover"]);cs("onPointerEnter",["pointerout","pointerover"]);cs("onPointerLeave",["pointerout","pointerover"]);hi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));hi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));hi("onBeforeInput",["compositionend","keypress","textInput","paste"]);hi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));hi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));hi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),hI=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zs));function b0(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,fA(r,e,void 0,t),t.currentTarget=null}function m_(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],o=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var a=r[s],u=a.instance,l=a.currentTarget;if(a=a.listener,u!==i&&o.isPropagationStopped())break e;b0(o,a,l),i=u}else for(s=0;s<r.length;s++){if(a=r[s],u=a.instance,l=a.currentTarget,a=a.listener,u!==i&&o.isPropagationStopped())break e;b0(o,a,l),i=u}}}if(Yu)throw t=Kp,Yu=!1,Kp=null,t}function Re(t,e){var n=e[rh];n===void 0&&(n=e[rh]=new Set);var r=t+"__bubble";n.has(r)||(y_(e,t,2,!1),n.add(r))}function xf(t,e,n){var r=0;e&&(r|=4),y_(n,t,r,e)}var $l="_reactListening"+Math.random().toString(36).slice(2);function ja(t){if(!t[$l]){t[$l]=!0,kb.forEach(function(n){n!=="selectionchange"&&(hI.has(n)||xf(n,!1,t),xf(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[$l]||(e[$l]=!0,xf("selectionchange",!1,e))}}function y_(t,e,n,r){switch(Zb(e)){case 1:var o=MA;break;case 4:o=OA;break;default:o=Jm}n=o.bind(null,e,n,t),o=void 0,!Wp||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),r?o!==void 0?t.addEventListener(e,n,{capture:!0,passive:o}):t.addEventListener(e,n,!0):o!==void 0?t.addEventListener(e,n,{passive:o}):t.addEventListener(e,n,!1)}function Ef(t,e,n,r,o){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var u=s.tag;if((u===3||u===4)&&(u=s.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;s=s.return}for(;a!==null;){if(s=Po(a),s===null)return;if(u=s.tag,u===5||u===6){r=i=s;continue e}a=a.parentNode}}r=r.return}Fb(function(){var l=i,c=Hm(n),d=[];e:{var f=h_.get(t);if(f!==void 0){var p=Qm,h=t;switch(t){case"keypress":if(xu(n)===0)break e;case"keydown":case"keyup":p=qA;break;case"focusin":h="focus",p=vf;break;case"focusout":h="blur",p=vf;break;case"beforeblur":case"afterblur":p=vf;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=l0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=IA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=KA;break;case c_:case d_:case f_:p=DA;break;case p_:p=JA;break;case"scroll":p=NA;break;case"wheel":p=QA;break;case"copy":case"cut":case"paste":p=LA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=c0}var m=(e&4)!==0,v=!m&&t==="scroll",y=m?f!==null?f+"Capture":null:f;m=[];for(var w=l,b;w!==null;){b=w;var S=b.stateNode;if(b.tag===5&&S!==null&&(b=S,y!==null&&(S=Na(w,y),S!=null&&m.push(La(w,S,b)))),v)break;w=w.return}0<m.length&&(f=new p(f,h,null,n,c),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&n!==qp&&(h=n.relatedTarget||n.fromElement)&&(Po(h)||h[kr]))break e;if((p||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,p?(h=n.relatedTarget||n.toElement,p=l,h=h?Po(h):null,h!==null&&(v=mi(h),h!==v||h.tag!==5&&h.tag!==6)&&(h=null)):(p=null,h=l),p!==h)){if(m=l0,S="onMouseLeave",y="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(m=c0,S="onPointerLeave",y="onPointerEnter",w="pointer"),v=p==null?f:Ri(p),b=h==null?f:Ri(h),f=new m(S,w+"leave",p,n,c),f.target=v,f.relatedTarget=b,S=null,Po(c)===l&&(m=new m(y,w+"enter",h,n,c),m.target=b,m.relatedTarget=v,S=m),v=S,p&&h)t:{for(m=p,y=h,w=0,b=m;b;b=bi(b))w++;for(b=0,S=y;S;S=bi(S))b++;for(;0<w-b;)m=bi(m),w--;for(;0<b-w;)y=bi(y),b--;for(;w--;){if(m===y||y!==null&&m===y.alternate)break t;m=bi(m),y=bi(y)}m=null}else m=null;p!==null&&_0(d,f,p,m,!1),h!==null&&v!==null&&_0(d,v,h,m,!0)}}e:{if(f=l?Ri(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var k=oI;else if(p0(f))if(i_)k=lI;else{k=sI;var E=iI}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(k=aI);if(k&&(k=k(t,l))){o_(d,k,n,c);break e}E&&E(t,f,l),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&Fp(f,"number",f.value)}switch(E=l?Ri(l):window,t){case"focusin":(p0(E)||E.contentEditable==="true")&&(Ii=E,Qp=l,ca=null);break;case"focusout":ca=Qp=Ii=null;break;case"mousedown":Xp=!0;break;case"contextmenu":case"mouseup":case"dragend":Xp=!1,v0(d,n,c);break;case"selectionchange":if(dI)break;case"keydown":case"keyup":v0(d,n,c)}var x;if(Zm)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ai?n_(t,n)&&(T="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(t_&&n.locale!=="ko"&&(Ai||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ai&&(x=e_()):(Wr=c,Ym="value"in Wr?Wr.value:Wr.textContent,Ai=!0)),E=tc(l,T),0<E.length&&(T=new u0(T,t,null,n,c),d.push({event:T,listeners:E}),x?T.data=x:(x=r_(n),x!==null&&(T.data=x)))),(x=ZA?eI(t,n):tI(t,n))&&(l=tc(l,"onBeforeInput"),0<l.length&&(c=new u0("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:l}),c.data=x))}m_(d,e)})}function La(t,e,n){return{instance:t,listener:e,currentTarget:n}}function tc(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Na(t,n),i!=null&&r.unshift(La(t,i,o)),i=Na(t,e),i!=null&&r.push(La(t,i,o))),t=t.return}return r}function bi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function _0(t,e,n,r,o){for(var i=e._reactName,s=[];n!==null&&n!==r;){var a=n,u=a.alternate,l=a.stateNode;if(u!==null&&u===r)break;a.tag===5&&l!==null&&(a=l,o?(u=Na(n,i),u!=null&&s.unshift(La(n,u,a))):o||(u=Na(n,i),u!=null&&s.push(La(n,u,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var mI=/\r\n?/g,yI=/\u0000|\uFFFD/g;function S0(t){return(typeof t=="string"?t:""+t).replace(mI,`
|
|
44
|
-
`).replace(yI,"")}function zl(t,e,n){if(e=S0(e),S0(t)!==e&&n)throw Error(W(425))}function nc(){}var Zp=null,eh=null;function th(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var nh=typeof setTimeout=="function"?setTimeout:void 0,gI=typeof clearTimeout=="function"?clearTimeout:void 0,k0=typeof Promise=="function"?Promise:void 0,vI=typeof queueMicrotask=="function"?queueMicrotask:typeof k0<"u"?function(t){return k0.resolve(null).then(t).catch(wI)}:nh;function wI(t){setTimeout(function(){throw t})}function Tf(t,e){var n=e,r=0;do{var o=n.nextSibling;if(t.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){t.removeChild(o),Pa(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Pa(e)}function eo(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function x0(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Os=Math.random().toString(36).slice(2),Jn="__reactFiber$"+Os,Ba="__reactProps$"+Os,kr="__reactContainer$"+Os,rh="__reactEvents$"+Os,bI="__reactListeners$"+Os,_I="__reactHandles$"+Os;function Po(t){var e=t[Jn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[kr]||n[Jn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=x0(t);t!==null;){if(n=t[Jn])return n;t=x0(t)}return e}t=n,n=t.parentNode}return null}function Sl(t){return t=t[Jn]||t[kr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ri(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(W(33))}function Cd(t){return t[Ba]||null}var oh=[],Di=-1;function yo(t){return{current:t}}function je(t){0>Di||(t.current=oh[Di],oh[Di]=null,Di--)}function Pe(t,e){Di++,oh[Di]=t.current,t.current=e}var fo={},Pt=yo(fo),Yt=yo(!1),Qo=fo;function ds(t,e){var n=t.type.contextTypes;if(!n)return fo;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Qt(t){return t=t.childContextTypes,t!=null}function rc(){je(Yt),je(Pt)}function E0(t,e,n){if(Pt.current!==fo)throw Error(W(168));Pe(Pt,e),Pe(Yt,n)}function g_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error(W(108,iA(t)||"Unknown",o));return Ge({},n,r)}function oc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||fo,Qo=Pt.current,Pe(Pt,t),Pe(Yt,Yt.current),!0}function T0(t,e,n){var r=t.stateNode;if(!r)throw Error(W(169));n?(t=g_(t,e,Qo),r.__reactInternalMemoizedMergedChildContext=t,je(Yt),je(Pt),Pe(Pt,t)):je(Yt),Pe(Yt,n)}var dr=null,Md=!1,Cf=!1;function v_(t){dr===null?dr=[t]:dr.push(t)}function SI(t){Md=!0,v_(t)}function go(){if(!Cf&&dr!==null){Cf=!0;var t=0,e=Oe;try{var n=dr;for(Oe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}dr=null,Md=!1}catch(o){throw dr!==null&&(dr=dr.slice(t+1)),Vb(Wm,go),o}finally{Oe=e,Cf=!1}}return null}var ji=[],Li=0,ic=null,sc=0,gn=[],vn=0,Xo=null,pr=1,hr="";function To(t,e){ji[Li++]=sc,ji[Li++]=ic,ic=t,sc=e}function w_(t,e,n){gn[vn++]=pr,gn[vn++]=hr,gn[vn++]=Xo,Xo=t;var r=pr;t=hr;var o=32-Ln(r)-1;r&=~(1<<o),n+=1;var i=32-Ln(e)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,pr=1<<32-Ln(e)+o|n<<o|r,hr=i+t}else pr=1<<i|n<<o|r,hr=t}function ty(t){t.return!==null&&(To(t,1),w_(t,1,0))}function ny(t){for(;t===ic;)ic=ji[--Li],ji[Li]=null,sc=ji[--Li],ji[Li]=null;for(;t===Xo;)Xo=gn[--vn],gn[vn]=null,hr=gn[--vn],gn[vn]=null,pr=gn[--vn],gn[vn]=null}var sn=null,on=null,Be=!1,Pn=null;function b_(t,e){var n=bn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function C0(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,sn=t,on=eo(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,sn=t,on=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Xo!==null?{id:pr,overflow:hr}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,sn=t,on=null,!0):!1;default:return!1}}function ih(t){return(t.mode&1)!==0&&(t.flags&128)===0}function sh(t){if(Be){var e=on;if(e){var n=e;if(!C0(t,e)){if(ih(t))throw Error(W(418));e=eo(n.nextSibling);var r=sn;e&&C0(t,e)?b_(r,n):(t.flags=t.flags&-4097|2,Be=!1,sn=t)}}else{if(ih(t))throw Error(W(418));t.flags=t.flags&-4097|2,Be=!1,sn=t}}}function M0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;sn=t}function Ul(t){if(t!==sn)return!1;if(!Be)return M0(t),Be=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!th(t.type,t.memoizedProps)),e&&(e=on)){if(ih(t))throw __(),Error(W(418));for(;e;)b_(t,e),e=eo(e.nextSibling)}if(M0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){on=eo(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}on=null}}else on=sn?eo(t.stateNode.nextSibling):null;return!0}function __(){for(var t=on;t;)t=eo(t.nextSibling)}function fs(){on=sn=null,Be=!1}function ry(t){Pn===null?Pn=[t]:Pn.push(t)}var kI=Mr.ReactCurrentBatchConfig;function Ls(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(W(309));var r=n.stateNode}if(!r)throw Error(W(147,t));var o=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},e._stringRef=i,e)}if(typeof t!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,t))}return t}function Vl(t,e){throw t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function O0(t){var e=t._init;return e(t._payload)}function S_(t){function e(y,w){if(t){var b=y.deletions;b===null?(y.deletions=[w],y.flags|=16):b.push(w)}}function n(y,w){if(!t)return null;for(;w!==null;)e(y,w),w=w.sibling;return null}function r(y,w){for(y=new Map;w!==null;)w.key!==null?y.set(w.key,w):y.set(w.index,w),w=w.sibling;return y}function o(y,w){return y=oo(y,w),y.index=0,y.sibling=null,y}function i(y,w,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<w?(y.flags|=2,w):b):(y.flags|=2,w)):(y.flags|=1048576,w)}function s(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,w,b,S){return w===null||w.tag!==6?(w=Rf(b,y.mode,S),w.return=y,w):(w=o(w,b),w.return=y,w)}function u(y,w,b,S){var k=b.type;return k===Ni?c(y,w,b.props.children,S,b.key):w!==null&&(w.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===jr&&O0(k)===w.type)?(S=o(w,b.props),S.ref=Ls(y,w,b),S.return=y,S):(S=Au(b.type,b.key,b.props,null,y.mode,S),S.ref=Ls(y,w,b),S.return=y,S)}function l(y,w,b,S){return w===null||w.tag!==4||w.stateNode.containerInfo!==b.containerInfo||w.stateNode.implementation!==b.implementation?(w=Df(b,y.mode,S),w.return=y,w):(w=o(w,b.children||[]),w.return=y,w)}function c(y,w,b,S,k){return w===null||w.tag!==7?(w=Uo(b,y.mode,S,k),w.return=y,w):(w=o(w,b),w.return=y,w)}function d(y,w,b){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Rf(""+w,y.mode,b),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Il:return b=Au(w.type,w.key,w.props,null,y.mode,b),b.ref=Ls(y,null,w),b.return=y,b;case Oi:return w=Df(w,y.mode,b),w.return=y,w;case jr:var S=w._init;return d(y,S(w._payload),b)}if(Qs(w)||Is(w))return w=Uo(w,y.mode,b,null),w.return=y,w;Vl(y,w)}return null}function f(y,w,b,S){var k=w!==null?w.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return k!==null?null:a(y,w,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Il:return b.key===k?u(y,w,b,S):null;case Oi:return b.key===k?l(y,w,b,S):null;case jr:return k=b._init,f(y,w,k(b._payload),S)}if(Qs(b)||Is(b))return k!==null?null:c(y,w,b,S,null);Vl(y,b)}return null}function p(y,w,b,S,k){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(b)||null,a(w,y,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Il:return y=y.get(S.key===null?b:S.key)||null,u(w,y,S,k);case Oi:return y=y.get(S.key===null?b:S.key)||null,l(w,y,S,k);case jr:var E=S._init;return p(y,w,b,E(S._payload),k)}if(Qs(S)||Is(S))return y=y.get(b)||null,c(w,y,S,k,null);Vl(w,S)}return null}function h(y,w,b,S){for(var k=null,E=null,x=w,T=w=0,O=null;x!==null&&T<b.length;T++){x.index>T?(O=x,x=null):O=x.sibling;var N=f(y,x,b[T],S);if(N===null){x===null&&(x=O);break}t&&x&&N.alternate===null&&e(y,x),w=i(N,w,T),E===null?k=N:E.sibling=N,E=N,x=O}if(T===b.length)return n(y,x),Be&&To(y,T),k;if(x===null){for(;T<b.length;T++)x=d(y,b[T],S),x!==null&&(w=i(x,w,T),E===null?k=x:E.sibling=x,E=x);return Be&&To(y,T),k}for(x=r(y,x);T<b.length;T++)O=p(x,y,T,b[T],S),O!==null&&(t&&O.alternate!==null&&x.delete(O.key===null?T:O.key),w=i(O,w,T),E===null?k=O:E.sibling=O,E=O);return t&&x.forEach(function($){return e(y,$)}),Be&&To(y,T),k}function m(y,w,b,S){var k=Is(b);if(typeof k!="function")throw Error(W(150));if(b=k.call(b),b==null)throw Error(W(151));for(var E=k=null,x=w,T=w=0,O=null,N=b.next();x!==null&&!N.done;T++,N=b.next()){x.index>T?(O=x,x=null):O=x.sibling;var $=f(y,x,N.value,S);if($===null){x===null&&(x=O);break}t&&x&&$.alternate===null&&e(y,x),w=i($,w,T),E===null?k=$:E.sibling=$,E=$,x=O}if(N.done)return n(y,x),Be&&To(y,T),k;if(x===null){for(;!N.done;T++,N=b.next())N=d(y,N.value,S),N!==null&&(w=i(N,w,T),E===null?k=N:E.sibling=N,E=N);return Be&&To(y,T),k}for(x=r(y,x);!N.done;T++,N=b.next())N=p(x,y,T,N.value,S),N!==null&&(t&&N.alternate!==null&&x.delete(N.key===null?T:N.key),w=i(N,w,T),E===null?k=N:E.sibling=N,E=N);return t&&x.forEach(function(P){return e(y,P)}),Be&&To(y,T),k}function v(y,w,b,S){if(typeof b=="object"&&b!==null&&b.type===Ni&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Il:e:{for(var k=b.key,E=w;E!==null;){if(E.key===k){if(k=b.type,k===Ni){if(E.tag===7){n(y,E.sibling),w=o(E,b.props.children),w.return=y,y=w;break e}}else if(E.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===jr&&O0(k)===E.type){n(y,E.sibling),w=o(E,b.props),w.ref=Ls(y,E,b),w.return=y,y=w;break e}n(y,E);break}else e(y,E);E=E.sibling}b.type===Ni?(w=Uo(b.props.children,y.mode,S,b.key),w.return=y,y=w):(S=Au(b.type,b.key,b.props,null,y.mode,S),S.ref=Ls(y,w,b),S.return=y,y=S)}return s(y);case Oi:e:{for(E=b.key;w!==null;){if(w.key===E)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){n(y,w.sibling),w=o(w,b.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=Df(b,y.mode,S),w.return=y,y=w}return s(y);case jr:return E=b._init,v(y,w,E(b._payload),S)}if(Qs(b))return h(y,w,b,S);if(Is(b))return m(y,w,b,S);Vl(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(y,w.sibling),w=o(w,b),w.return=y,y=w):(n(y,w),w=Rf(b,y.mode,S),w.return=y,y=w),s(y)):n(y,w)}return v}var ps=S_(!0),k_=S_(!1),ac=yo(null),lc=null,Bi=null,oy=null;function iy(){oy=Bi=lc=null}function sy(t){var e=ac.current;je(ac),t._currentValue=e}function ah(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ns(t,e){lc=t,oy=Bi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Jt=!0),t.firstContext=null)}function Tn(t){var e=t._currentValue;if(oy!==t)if(t={context:t,memoizedValue:e,next:null},Bi===null){if(lc===null)throw Error(W(308));Bi=t,lc.dependencies={lanes:0,firstContext:t}}else Bi=Bi.next=t;return e}var Ro=null;function ay(t){Ro===null?Ro=[t]:Ro.push(t)}function x_(t,e,n,r){var o=e.interleaved;return o===null?(n.next=n,ay(e)):(n.next=o.next,o.next=n),e.interleaved=n,xr(t,r)}function xr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Lr=!1;function ly(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E_(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function gr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function to(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,xe&2){var o=r.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),r.pending=e,xr(t,n)}return o=r.interleaved,o===null?(e.next=e,ay(r)):(e.next=o.next,o.next=e),r.interleaved=e,xr(t,n)}function Eu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Km(t,n)}}function N0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function uc(t,e,n,r){var o=t.updateQueue;Lr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var u=a,l=u.next;u.next=null,s===null?i=l:s.next=l,s=u;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==s&&(a===null?c.firstBaseUpdate=l:a.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;s=0,c=l=u=null,a=i;do{var f=a.lane,p=a.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var h=t,m=a;switch(f=e,p=n,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=Ge({},d,f);break e;case 2:Lr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,s|=f;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;f=a,a=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do s|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);ei|=s,t.lanes=s,t.memoizedState=d}}function A0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(W(191,o));o.call(r)}}}var kl={},er=yo(kl),Fa=yo(kl),$a=yo(kl);function Do(t){if(t===kl)throw Error(W(174));return t}function uy(t,e){switch(Pe($a,e),Pe(Fa,t),Pe(er,kl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zp(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=zp(e,t)}je(er),Pe(er,e)}function hs(){je(er),je(Fa),je($a)}function T_(t){Do($a.current);var e=Do(er.current),n=zp(e,t.type);e!==n&&(Pe(Fa,t),Pe(er,n))}function cy(t){Fa.current===t&&(je(er),je(Fa))}var We=yo(0);function cc(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mf=[];function dy(){for(var t=0;t<Mf.length;t++)Mf[t]._workInProgressVersionPrimary=null;Mf.length=0}var Tu=Mr.ReactCurrentDispatcher,Of=Mr.ReactCurrentBatchConfig,Zo=0,Ke=null,dt=null,ht=null,dc=!1,da=!1,za=0,xI=0;function Mt(){throw Error(W(321))}function fy(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Fn(t[n],e[n]))return!1;return!0}function py(t,e,n,r,o,i){if(Zo=i,Ke=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Tu.current=t===null||t.memoizedState===null?MI:OI,t=n(r,o),da){i=0;do{if(da=!1,za=0,25<=i)throw Error(W(301));i+=1,ht=dt=null,e.updateQueue=null,Tu.current=NI,t=n(r,o)}while(da)}if(Tu.current=fc,e=dt!==null&&dt.next!==null,Zo=0,ht=dt=Ke=null,dc=!1,e)throw Error(W(300));return t}function hy(){var t=za!==0;return za=0,t}function Hn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?Ke.memoizedState=ht=t:ht=ht.next=t,ht}function Cn(){if(dt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=dt.next;var e=ht===null?Ke.memoizedState:ht.next;if(e!==null)ht=e,dt=t;else{if(t===null)throw Error(W(310));dt=t,t={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},ht===null?Ke.memoizedState=ht=t:ht=ht.next=t}return ht}function Ua(t,e){return typeof e=="function"?e(t):e}function Nf(t){var e=Cn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=dt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,u=null,l=i;do{var c=l.lane;if((Zo&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),r=l.hasEagerState?l.eagerState:t(r,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(a=u=d,s=r):u=u.next=d,Ke.lanes|=c,ei|=c}l=l.next}while(l!==null&&l!==i);u===null?s=r:u.next=a,Fn(r,e.memoizedState)||(Jt=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=u,n.lastRenderedState=r}if(t=n.interleaved,t!==null){o=t;do i=o.lane,Ke.lanes|=i,ei|=i,o=o.next;while(o!==t)}else o===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Af(t){var e=Cn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);Fn(i,e.memoizedState)||(Jt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function C_(){}function M_(t,e){var n=Ke,r=Cn(),o=e(),i=!Fn(r.memoizedState,o);if(i&&(r.memoizedState=o,Jt=!0),r=r.queue,my(A_.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||ht!==null&&ht.memoizedState.tag&1){if(n.flags|=2048,Va(9,N_.bind(null,n,r,o,e),void 0,null),gt===null)throw Error(W(349));Zo&30||O_(n,e,o)}return o}function O_(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function N_(t,e,n,r){e.value=n,e.getSnapshot=r,I_(e)&&P_(t)}function A_(t,e,n){return n(function(){I_(e)&&P_(t)})}function I_(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Fn(t,n)}catch{return!0}}function P_(t){var e=xr(t,1);e!==null&&Bn(e,t,1,-1)}function I0(t){var e=Hn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:t},e.queue=t,t=t.dispatch=CI.bind(null,Ke,t),[e.memoizedState,t]}function Va(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function R_(){return Cn().memoizedState}function Cu(t,e,n,r){var o=Hn();Ke.flags|=t,o.memoizedState=Va(1|e,n,void 0,r===void 0?null:r)}function Od(t,e,n,r){var o=Cn();r=r===void 0?null:r;var i=void 0;if(dt!==null){var s=dt.memoizedState;if(i=s.destroy,r!==null&&fy(r,s.deps)){o.memoizedState=Va(e,n,i,r);return}}Ke.flags|=t,o.memoizedState=Va(1|e,n,i,r)}function P0(t,e){return Cu(8390656,8,t,e)}function my(t,e){return Od(2048,8,t,e)}function D_(t,e){return Od(4,2,t,e)}function j_(t,e){return Od(4,4,t,e)}function L_(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function B_(t,e,n){return n=n!=null?n.concat([t]):null,Od(4,4,L_.bind(null,e,t),n)}function yy(){}function F_(t,e){var n=Cn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fy(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function $_(t,e){var n=Cn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fy(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function z_(t,e,n){return Zo&21?(Fn(n,e)||(n=Wb(),Ke.lanes|=n,ei|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Jt=!0),t.memoizedState=n)}function EI(t,e){var n=Oe;Oe=n!==0&&4>n?n:4,t(!0);var r=Of.transition;Of.transition={};try{t(!1),e()}finally{Oe=n,Of.transition=r}}function U_(){return Cn().memoizedState}function TI(t,e,n){var r=ro(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},V_(t))q_(e,n);else if(n=x_(t,e,n,r),n!==null){var o=Ft();Bn(n,t,r,o),H_(n,e,r)}}function CI(t,e,n){var r=ro(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(V_(t))q_(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Fn(a,s)){var u=e.interleaved;u===null?(o.next=o,ay(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}n=x_(t,e,o,r),n!==null&&(o=Ft(),Bn(n,t,r,o),H_(n,e,r))}}function V_(t){var e=t.alternate;return t===Ke||e!==null&&e===Ke}function q_(t,e){da=dc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function H_(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Km(t,n)}}var fc={readContext:Tn,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useInsertionEffect:Mt,useLayoutEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useMutableSource:Mt,useSyncExternalStore:Mt,useId:Mt,unstable_isNewReconciler:!1},MI={readContext:Tn,useCallback:function(t,e){return Hn().memoizedState=[t,e===void 0?null:e],t},useContext:Tn,useEffect:P0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cu(4194308,4,L_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cu(4,2,t,e)},useMemo:function(t,e){var n=Hn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Hn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=TI.bind(null,Ke,t),[r.memoizedState,t]},useRef:function(t){var e=Hn();return t={current:t},e.memoizedState=t},useState:I0,useDebugValue:yy,useDeferredValue:function(t){return Hn().memoizedState=t},useTransition:function(){var t=I0(!1),e=t[0];return t=EI.bind(null,t[1]),Hn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ke,o=Hn();if(Be){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),gt===null)throw Error(W(349));Zo&30||O_(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,P0(A_.bind(null,r,i,t),[t]),r.flags|=2048,Va(9,N_.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Hn(),e=gt.identifierPrefix;if(Be){var n=hr,r=pr;n=(r&~(1<<32-Ln(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=za++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=xI++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},OI={readContext:Tn,useCallback:F_,useContext:Tn,useEffect:my,useImperativeHandle:B_,useInsertionEffect:D_,useLayoutEffect:j_,useMemo:$_,useReducer:Nf,useRef:R_,useState:function(){return Nf(Ua)},useDebugValue:yy,useDeferredValue:function(t){var e=Cn();return z_(e,dt.memoizedState,t)},useTransition:function(){var t=Nf(Ua)[0],e=Cn().memoizedState;return[t,e]},useMutableSource:C_,useSyncExternalStore:M_,useId:U_,unstable_isNewReconciler:!1},NI={readContext:Tn,useCallback:F_,useContext:Tn,useEffect:my,useImperativeHandle:B_,useInsertionEffect:D_,useLayoutEffect:j_,useMemo:$_,useReducer:Af,useRef:R_,useState:function(){return Af(Ua)},useDebugValue:yy,useDeferredValue:function(t){var e=Cn();return dt===null?e.memoizedState=t:z_(e,dt.memoizedState,t)},useTransition:function(){var t=Af(Ua)[0],e=Cn().memoizedState;return[t,e]},useMutableSource:C_,useSyncExternalStore:M_,useId:U_,unstable_isNewReconciler:!1};function Nn(t,e){if(t&&t.defaultProps){e=Ge({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function lh(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ge({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Nd={isMounted:function(t){return(t=t._reactInternals)?mi(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Ft(),o=ro(t),i=gr(r,o);i.payload=e,n!=null&&(i.callback=n),e=to(t,i,o),e!==null&&(Bn(e,t,o,r),Eu(e,t,o))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Ft(),o=ro(t),i=gr(r,o);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=to(t,i,o),e!==null&&(Bn(e,t,o,r),Eu(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ft(),r=ro(t),o=gr(n,r);o.tag=2,e!=null&&(o.callback=e),e=to(t,o,r),e!==null&&(Bn(e,t,r,n),Eu(e,t,r))}};function R0(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!Da(n,r)||!Da(o,i):!0}function W_(t,e,n){var r=!1,o=fo,i=e.contextType;return typeof i=="object"&&i!==null?i=Tn(i):(o=Qt(e)?Qo:Pt.current,r=e.contextTypes,i=(r=r!=null)?ds(t,o):fo),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Nd,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function D0(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Nd.enqueueReplaceState(e,e.state,null)}function uh(t,e,n,r){var o=t.stateNode;o.props=n,o.state=t.memoizedState,o.refs={},ly(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=Tn(i):(i=Qt(e)?Qo:Pt.current,o.context=ds(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(lh(t,e,i,n),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&Nd.enqueueReplaceState(o,o.state,null),uc(t,n,o,r),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function ms(t,e){try{var n="",r=e;do n+=oA(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
44
|
+
`).replace(yI,"")}function zl(t,e,n){if(e=S0(e),S0(t)!==e&&n)throw Error(W(425))}function nc(){}var Zp=null,eh=null;function th(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var nh=typeof setTimeout=="function"?setTimeout:void 0,gI=typeof clearTimeout=="function"?clearTimeout:void 0,k0=typeof Promise=="function"?Promise:void 0,vI=typeof queueMicrotask=="function"?queueMicrotask:typeof k0<"u"?function(t){return k0.resolve(null).then(t).catch(wI)}:nh;function wI(t){setTimeout(function(){throw t})}function Tf(t,e){var n=e,r=0;do{var o=n.nextSibling;if(t.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){t.removeChild(o),Pa(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Pa(e)}function eo(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function x0(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Os=Math.random().toString(36).slice(2),Jn="__reactFiber$"+Os,Ba="__reactProps$"+Os,kr="__reactContainer$"+Os,rh="__reactEvents$"+Os,bI="__reactListeners$"+Os,_I="__reactHandles$"+Os;function Po(t){var e=t[Jn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[kr]||n[Jn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=x0(t);t!==null;){if(n=t[Jn])return n;t=x0(t)}return e}t=n,n=t.parentNode}return null}function Sl(t){return t=t[Jn]||t[kr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function Ri(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(W(33))}function Cd(t){return t[Ba]||null}var oh=[],Di=-1;function yo(t){return{current:t}}function je(t){0>Di||(t.current=oh[Di],oh[Di]=null,Di--)}function Pe(t,e){Di++,oh[Di]=t.current,t.current=e}var fo={},Pt=yo(fo),Yt=yo(!1),Qo=fo;function ds(t,e){var n=t.type.contextTypes;if(!n)return fo;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Qt(t){return t=t.childContextTypes,t!=null}function rc(){je(Yt),je(Pt)}function E0(t,e,n){if(Pt.current!==fo)throw Error(W(168));Pe(Pt,e),Pe(Yt,n)}function g_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error(W(108,iA(t)||"Unknown",o));return Ge({},n,r)}function oc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||fo,Qo=Pt.current,Pe(Pt,t),Pe(Yt,Yt.current),!0}function T0(t,e,n){var r=t.stateNode;if(!r)throw Error(W(169));n?(t=g_(t,e,Qo),r.__reactInternalMemoizedMergedChildContext=t,je(Yt),je(Pt),Pe(Pt,t)):je(Yt),Pe(Yt,n)}var dr=null,Md=!1,Cf=!1;function v_(t){dr===null?dr=[t]:dr.push(t)}function SI(t){Md=!0,v_(t)}function go(){if(!Cf&&dr!==null){Cf=!0;var t=0,e=Oe;try{var n=dr;for(Oe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}dr=null,Md=!1}catch(o){throw dr!==null&&(dr=dr.slice(t+1)),Vb(Wm,go),o}finally{Oe=e,Cf=!1}}return null}var ji=[],Li=0,ic=null,sc=0,gn=[],vn=0,Xo=null,pr=1,hr="";function To(t,e){ji[Li++]=sc,ji[Li++]=ic,ic=t,sc=e}function w_(t,e,n){gn[vn++]=pr,gn[vn++]=hr,gn[vn++]=Xo,Xo=t;var r=pr;t=hr;var o=32-Ln(r)-1;r&=~(1<<o),n+=1;var i=32-Ln(e)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,pr=1<<32-Ln(e)+o|n<<o|r,hr=i+t}else pr=1<<i|n<<o|r,hr=t}function ty(t){t.return!==null&&(To(t,1),w_(t,1,0))}function ny(t){for(;t===ic;)ic=ji[--Li],ji[Li]=null,sc=ji[--Li],ji[Li]=null;for(;t===Xo;)Xo=gn[--vn],gn[vn]=null,hr=gn[--vn],gn[vn]=null,pr=gn[--vn],gn[vn]=null}var sn=null,on=null,Be=!1,Pn=null;function b_(t,e){var n=bn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function C0(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,sn=t,on=eo(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,sn=t,on=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=Xo!==null?{id:pr,overflow:hr}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,sn=t,on=null,!0):!1;default:return!1}}function ih(t){return(t.mode&1)!==0&&(t.flags&128)===0}function sh(t){if(Be){var e=on;if(e){var n=e;if(!C0(t,e)){if(ih(t))throw Error(W(418));e=eo(n.nextSibling);var r=sn;e&&C0(t,e)?b_(r,n):(t.flags=t.flags&-4097|2,Be=!1,sn=t)}}else{if(ih(t))throw Error(W(418));t.flags=t.flags&-4097|2,Be=!1,sn=t}}}function M0(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;sn=t}function Ul(t){if(t!==sn)return!1;if(!Be)return M0(t),Be=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!th(t.type,t.memoizedProps)),e&&(e=on)){if(ih(t))throw __(),Error(W(418));for(;e;)b_(t,e),e=eo(e.nextSibling)}if(M0(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(W(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){on=eo(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}on=null}}else on=sn?eo(t.stateNode.nextSibling):null;return!0}function __(){for(var t=on;t;)t=eo(t.nextSibling)}function fs(){on=sn=null,Be=!1}function ry(t){Pn===null?Pn=[t]:Pn.push(t)}var kI=Mr.ReactCurrentBatchConfig;function Ls(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(W(309));var r=n.stateNode}if(!r)throw Error(W(147,t));var o=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},e._stringRef=i,e)}if(typeof t!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,t))}return t}function Vl(t,e){throw t=Object.prototype.toString.call(e),Error(W(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function O0(t){var e=t._init;return e(t._payload)}function S_(t){function e(y,w){if(t){var b=y.deletions;b===null?(y.deletions=[w],y.flags|=16):b.push(w)}}function n(y,w){if(!t)return null;for(;w!==null;)e(y,w),w=w.sibling;return null}function r(y,w){for(y=new Map;w!==null;)w.key!==null?y.set(w.key,w):y.set(w.index,w),w=w.sibling;return y}function o(y,w){return y=oo(y,w),y.index=0,y.sibling=null,y}function i(y,w,b){return y.index=b,t?(b=y.alternate,b!==null?(b=b.index,b<w?(y.flags|=2,w):b):(y.flags|=2,w)):(y.flags|=1048576,w)}function s(y){return t&&y.alternate===null&&(y.flags|=2),y}function a(y,w,b,S){return w===null||w.tag!==6?(w=Rf(b,y.mode,S),w.return=y,w):(w=o(w,b),w.return=y,w)}function u(y,w,b,S){var k=b.type;return k===Ni?c(y,w,b.props.children,S,b.key):w!==null&&(w.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===jr&&O0(k)===w.type)?(S=o(w,b.props),S.ref=Ls(y,w,b),S.return=y,S):(S=Au(b.type,b.key,b.props,null,y.mode,S),S.ref=Ls(y,w,b),S.return=y,S)}function l(y,w,b,S){return w===null||w.tag!==4||w.stateNode.containerInfo!==b.containerInfo||w.stateNode.implementation!==b.implementation?(w=Df(b,y.mode,S),w.return=y,w):(w=o(w,b.children||[]),w.return=y,w)}function c(y,w,b,S,k){return w===null||w.tag!==7?(w=Uo(b,y.mode,S,k),w.return=y,w):(w=o(w,b),w.return=y,w)}function d(y,w,b){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Rf(""+w,y.mode,b),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Il:return b=Au(w.type,w.key,w.props,null,y.mode,b),b.ref=Ls(y,null,w),b.return=y,b;case Oi:return w=Df(w,y.mode,b),w.return=y,w;case jr:var S=w._init;return d(y,S(w._payload),b)}if(Qs(w)||Is(w))return w=Uo(w,y.mode,b,null),w.return=y,w;Vl(y,w)}return null}function f(y,w,b,S){var k=w!==null?w.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return k!==null?null:a(y,w,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Il:return b.key===k?u(y,w,b,S):null;case Oi:return b.key===k?l(y,w,b,S):null;case jr:return k=b._init,f(y,w,k(b._payload),S)}if(Qs(b)||Is(b))return k!==null?null:c(y,w,b,S,null);Vl(y,b)}return null}function p(y,w,b,S,k){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(b)||null,a(w,y,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Il:return y=y.get(S.key===null?b:S.key)||null,u(w,y,S,k);case Oi:return y=y.get(S.key===null?b:S.key)||null,l(w,y,S,k);case jr:var E=S._init;return p(y,w,b,E(S._payload),k)}if(Qs(S)||Is(S))return y=y.get(b)||null,c(w,y,S,k,null);Vl(w,S)}return null}function h(y,w,b,S){for(var k=null,E=null,x=w,T=w=0,O=null;x!==null&&T<b.length;T++){x.index>T?(O=x,x=null):O=x.sibling;var N=f(y,x,b[T],S);if(N===null){x===null&&(x=O);break}t&&x&&N.alternate===null&&e(y,x),w=i(N,w,T),E===null?k=N:E.sibling=N,E=N,x=O}if(T===b.length)return n(y,x),Be&&To(y,T),k;if(x===null){for(;T<b.length;T++)x=d(y,b[T],S),x!==null&&(w=i(x,w,T),E===null?k=x:E.sibling=x,E=x);return Be&&To(y,T),k}for(x=r(y,x);T<b.length;T++)O=p(x,y,T,b[T],S),O!==null&&(t&&O.alternate!==null&&x.delete(O.key===null?T:O.key),w=i(O,w,T),E===null?k=O:E.sibling=O,E=O);return t&&x.forEach(function($){return e(y,$)}),Be&&To(y,T),k}function m(y,w,b,S){var k=Is(b);if(typeof k!="function")throw Error(W(150));if(b=k.call(b),b==null)throw Error(W(151));for(var E=k=null,x=w,T=w=0,O=null,N=b.next();x!==null&&!N.done;T++,N=b.next()){x.index>T?(O=x,x=null):O=x.sibling;var $=f(y,x,N.value,S);if($===null){x===null&&(x=O);break}t&&x&&$.alternate===null&&e(y,x),w=i($,w,T),E===null?k=$:E.sibling=$,E=$,x=O}if(N.done)return n(y,x),Be&&To(y,T),k;if(x===null){for(;!N.done;T++,N=b.next())N=d(y,N.value,S),N!==null&&(w=i(N,w,T),E===null?k=N:E.sibling=N,E=N);return Be&&To(y,T),k}for(x=r(y,x);!N.done;T++,N=b.next())N=p(x,y,T,N.value,S),N!==null&&(t&&N.alternate!==null&&x.delete(N.key===null?T:N.key),w=i(N,w,T),E===null?k=N:E.sibling=N,E=N);return t&&x.forEach(function(P){return e(y,P)}),Be&&To(y,T),k}function v(y,w,b,S){if(typeof b=="object"&&b!==null&&b.type===Ni&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Il:e:{for(var k=b.key,E=w;E!==null;){if(E.key===k){if(k=b.type,k===Ni){if(E.tag===7){n(y,E.sibling),w=o(E,b.props.children),w.return=y,y=w;break e}}else if(E.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===jr&&O0(k)===E.type){n(y,E.sibling),w=o(E,b.props),w.ref=Ls(y,E,b),w.return=y,y=w;break e}n(y,E);break}else e(y,E);E=E.sibling}b.type===Ni?(w=Uo(b.props.children,y.mode,S,b.key),w.return=y,y=w):(S=Au(b.type,b.key,b.props,null,y.mode,S),S.ref=Ls(y,w,b),S.return=y,y=S)}return s(y);case Oi:e:{for(E=b.key;w!==null;){if(w.key===E)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){n(y,w.sibling),w=o(w,b.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=Df(b,y.mode,S),w.return=y,y=w}return s(y);case jr:return E=b._init,v(y,w,E(b._payload),S)}if(Qs(b))return h(y,w,b,S);if(Is(b))return m(y,w,b,S);Vl(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(y,w.sibling),w=o(w,b),w.return=y,y=w):(n(y,w),w=Rf(b,y.mode,S),w.return=y,y=w),s(y)):n(y,w)}return v}var ps=S_(!0),k_=S_(!1),ac=yo(null),lc=null,Bi=null,oy=null;function iy(){oy=Bi=lc=null}function sy(t){var e=ac.current;je(ac),t._currentValue=e}function ah(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function ns(t,e){lc=t,oy=Bi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Jt=!0),t.firstContext=null)}function Tn(t){var e=t._currentValue;if(oy!==t)if(t={context:t,memoizedValue:e,next:null},Bi===null){if(lc===null)throw Error(W(308));Bi=t,lc.dependencies={lanes:0,firstContext:t}}else Bi=Bi.next=t;return e}var Ro=null;function ay(t){Ro===null?Ro=[t]:Ro.push(t)}function x_(t,e,n,r){var o=e.interleaved;return o===null?(n.next=n,ay(e)):(n.next=o.next,o.next=n),e.interleaved=n,xr(t,r)}function xr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Lr=!1;function ly(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E_(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function gr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function to(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,xe&2){var o=r.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),r.pending=e,xr(t,n)}return o=r.interleaved,o===null?(e.next=e,ay(r)):(e.next=o.next,o.next=e),r.interleaved=e,xr(t,n)}function Eu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Km(t,n)}}function N0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function uc(t,e,n,r){var o=t.updateQueue;Lr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var u=a,l=u.next;u.next=null,s===null?i=l:s.next=l,s=u;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==s&&(a===null?c.firstBaseUpdate=l:a.next=l,c.lastBaseUpdate=u))}if(i!==null){var d=o.baseState;s=0,c=l=u=null,a=i;do{var f=a.lane,p=a.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var h=t,m=a;switch(f=e,p=n,m.tag){case 1:if(h=m.payload,typeof h=="function"){d=h.call(p,d,f);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=m.payload,f=typeof h=="function"?h.call(p,d,f):h,f==null)break e;d=Ge({},d,f);break e;case 2:Lr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,f=o.effects,f===null?o.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(l=c=p,u=d):c=c.next=p,s|=f;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;f=a,a=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(c===null&&(u=d),o.baseState=u,o.firstBaseUpdate=l,o.lastBaseUpdate=c,e=o.shared.interleaved,e!==null){o=e;do s|=o.lane,o=o.next;while(o!==e)}else i===null&&(o.shared.lanes=0);ei|=s,t.lanes=s,t.memoizedState=d}}function A0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(W(191,o));o.call(r)}}}var kl={},er=yo(kl),Fa=yo(kl),$a=yo(kl);function Do(t){if(t===kl)throw Error(W(174));return t}function uy(t,e){switch(Pe($a,e),Pe(Fa,t),Pe(er,kl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zp(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=zp(e,t)}je(er),Pe(er,e)}function hs(){je(er),je(Fa),je($a)}function T_(t){Do($a.current);var e=Do(er.current),n=zp(e,t.type);e!==n&&(Pe(Fa,t),Pe(er,n))}function cy(t){Fa.current===t&&(je(er),je(Fa))}var We=yo(0);function cc(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Mf=[];function dy(){for(var t=0;t<Mf.length;t++)Mf[t]._workInProgressVersionPrimary=null;Mf.length=0}var Tu=Mr.ReactCurrentDispatcher,Of=Mr.ReactCurrentBatchConfig,Zo=0,Ke=null,dt=null,ht=null,dc=!1,da=!1,za=0,xI=0;function Mt(){throw Error(W(321))}function fy(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Fn(t[n],e[n]))return!1;return!0}function py(t,e,n,r,o,i){if(Zo=i,Ke=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Tu.current=t===null||t.memoizedState===null?MI:OI,t=n(r,o),da){i=0;do{if(da=!1,za=0,25<=i)throw Error(W(301));i+=1,ht=dt=null,e.updateQueue=null,Tu.current=NI,t=n(r,o)}while(da)}if(Tu.current=fc,e=dt!==null&&dt.next!==null,Zo=0,ht=dt=Ke=null,dc=!1,e)throw Error(W(300));return t}function hy(){var t=za!==0;return za=0,t}function Hn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?Ke.memoizedState=ht=t:ht=ht.next=t,ht}function Cn(){if(dt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=dt.next;var e=ht===null?Ke.memoizedState:ht.next;if(e!==null)ht=e,dt=t;else{if(t===null)throw Error(W(310));dt=t,t={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},ht===null?Ke.memoizedState=ht=t:ht=ht.next=t}return ht}function Ua(t,e){return typeof e=="function"?e(t):e}function Nf(t){var e=Cn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=dt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,u=null,l=i;do{var c=l.lane;if((Zo&c)===c)u!==null&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),r=l.hasEagerState?l.eagerState:t(r,l.action);else{var d={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};u===null?(a=u=d,s=r):u=u.next=d,Ke.lanes|=c,ei|=c}l=l.next}while(l!==null&&l!==i);u===null?s=r:u.next=a,Fn(r,e.memoizedState)||(Jt=!0),e.memoizedState=r,e.baseState=s,e.baseQueue=u,n.lastRenderedState=r}if(t=n.interleaved,t!==null){o=t;do i=o.lane,Ke.lanes|=i,ei|=i,o=o.next;while(o!==t)}else o===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Af(t){var e=Cn(),n=e.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);Fn(i,e.memoizedState)||(Jt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function C_(){}function M_(t,e){var n=Ke,r=Cn(),o=e(),i=!Fn(r.memoizedState,o);if(i&&(r.memoizedState=o,Jt=!0),r=r.queue,my(A_.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||ht!==null&&ht.memoizedState.tag&1){if(n.flags|=2048,Va(9,N_.bind(null,n,r,o,e),void 0,null),gt===null)throw Error(W(349));Zo&30||O_(n,e,o)}return o}function O_(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function N_(t,e,n,r){e.value=n,e.getSnapshot=r,I_(e)&&P_(t)}function A_(t,e,n){return n(function(){I_(e)&&P_(t)})}function I_(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Fn(t,n)}catch{return!0}}function P_(t){var e=xr(t,1);e!==null&&Bn(e,t,1,-1)}function I0(t){var e=Hn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:t},e.queue=t,t=t.dispatch=CI.bind(null,Ke,t),[e.memoizedState,t]}function Va(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Ke.updateQueue,e===null?(e={lastEffect:null,stores:null},Ke.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function R_(){return Cn().memoizedState}function Cu(t,e,n,r){var o=Hn();Ke.flags|=t,o.memoizedState=Va(1|e,n,void 0,r===void 0?null:r)}function Od(t,e,n,r){var o=Cn();r=r===void 0?null:r;var i=void 0;if(dt!==null){var s=dt.memoizedState;if(i=s.destroy,r!==null&&fy(r,s.deps)){o.memoizedState=Va(e,n,i,r);return}}Ke.flags|=t,o.memoizedState=Va(1|e,n,i,r)}function P0(t,e){return Cu(8390656,8,t,e)}function my(t,e){return Od(2048,8,t,e)}function D_(t,e){return Od(4,2,t,e)}function j_(t,e){return Od(4,4,t,e)}function L_(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function B_(t,e,n){return n=n!=null?n.concat([t]):null,Od(4,4,L_.bind(null,e,t),n)}function yy(){}function F_(t,e){var n=Cn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fy(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function $_(t,e){var n=Cn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&fy(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function z_(t,e,n){return Zo&21?(Fn(n,e)||(n=Wb(),Ke.lanes|=n,ei|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Jt=!0),t.memoizedState=n)}function EI(t,e){var n=Oe;Oe=n!==0&&4>n?n:4,t(!0);var r=Of.transition;Of.transition={};try{t(!1),e()}finally{Oe=n,Of.transition=r}}function U_(){return Cn().memoizedState}function TI(t,e,n){var r=ro(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},V_(t))q_(e,n);else if(n=x_(t,e,n,r),n!==null){var o=$t();Bn(n,t,r,o),H_(n,e,r)}}function CI(t,e,n){var r=ro(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(V_(t))q_(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Fn(a,s)){var u=e.interleaved;u===null?(o.next=o,ay(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}n=x_(t,e,o,r),n!==null&&(o=$t(),Bn(n,t,r,o),H_(n,e,r))}}function V_(t){var e=t.alternate;return t===Ke||e!==null&&e===Ke}function q_(t,e){da=dc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function H_(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Km(t,n)}}var fc={readContext:Tn,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useInsertionEffect:Mt,useLayoutEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useMutableSource:Mt,useSyncExternalStore:Mt,useId:Mt,unstable_isNewReconciler:!1},MI={readContext:Tn,useCallback:function(t,e){return Hn().memoizedState=[t,e===void 0?null:e],t},useContext:Tn,useEffect:P0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cu(4194308,4,L_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cu(4,2,t,e)},useMemo:function(t,e){var n=Hn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Hn();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=TI.bind(null,Ke,t),[r.memoizedState,t]},useRef:function(t){var e=Hn();return t={current:t},e.memoizedState=t},useState:I0,useDebugValue:yy,useDeferredValue:function(t){return Hn().memoizedState=t},useTransition:function(){var t=I0(!1),e=t[0];return t=EI.bind(null,t[1]),Hn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ke,o=Hn();if(Be){if(n===void 0)throw Error(W(407));n=n()}else{if(n=e(),gt===null)throw Error(W(349));Zo&30||O_(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,P0(A_.bind(null,r,i,t),[t]),r.flags|=2048,Va(9,N_.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Hn(),e=gt.identifierPrefix;if(Be){var n=hr,r=pr;n=(r&~(1<<32-Ln(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=za++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=xI++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},OI={readContext:Tn,useCallback:F_,useContext:Tn,useEffect:my,useImperativeHandle:B_,useInsertionEffect:D_,useLayoutEffect:j_,useMemo:$_,useReducer:Nf,useRef:R_,useState:function(){return Nf(Ua)},useDebugValue:yy,useDeferredValue:function(t){var e=Cn();return z_(e,dt.memoizedState,t)},useTransition:function(){var t=Nf(Ua)[0],e=Cn().memoizedState;return[t,e]},useMutableSource:C_,useSyncExternalStore:M_,useId:U_,unstable_isNewReconciler:!1},NI={readContext:Tn,useCallback:F_,useContext:Tn,useEffect:my,useImperativeHandle:B_,useInsertionEffect:D_,useLayoutEffect:j_,useMemo:$_,useReducer:Af,useRef:R_,useState:function(){return Af(Ua)},useDebugValue:yy,useDeferredValue:function(t){var e=Cn();return dt===null?e.memoizedState=t:z_(e,dt.memoizedState,t)},useTransition:function(){var t=Af(Ua)[0],e=Cn().memoizedState;return[t,e]},useMutableSource:C_,useSyncExternalStore:M_,useId:U_,unstable_isNewReconciler:!1};function Nn(t,e){if(t&&t.defaultProps){e=Ge({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function lh(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ge({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Nd={isMounted:function(t){return(t=t._reactInternals)?mi(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=$t(),o=ro(t),i=gr(r,o);i.payload=e,n!=null&&(i.callback=n),e=to(t,i,o),e!==null&&(Bn(e,t,o,r),Eu(e,t,o))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=$t(),o=ro(t),i=gr(r,o);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=to(t,i,o),e!==null&&(Bn(e,t,o,r),Eu(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=$t(),r=ro(t),o=gr(n,r);o.tag=2,e!=null&&(o.callback=e),e=to(t,o,r),e!==null&&(Bn(e,t,r,n),Eu(e,t,r))}};function R0(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!Da(n,r)||!Da(o,i):!0}function W_(t,e,n){var r=!1,o=fo,i=e.contextType;return typeof i=="object"&&i!==null?i=Tn(i):(o=Qt(e)?Qo:Pt.current,r=e.contextTypes,i=(r=r!=null)?ds(t,o):fo),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Nd,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function D0(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Nd.enqueueReplaceState(e,e.state,null)}function uh(t,e,n,r){var o=t.stateNode;o.props=n,o.state=t.memoizedState,o.refs={},ly(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=Tn(i):(i=Qt(e)?Qo:Pt.current,o.context=ds(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(lh(t,e,i,n),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&Nd.enqueueReplaceState(o,o.state,null),uc(t,n,o,r),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function ms(t,e){try{var n="",r=e;do n+=oA(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
45
45
|
Error generating stack: `+i.message+`
|
|
46
|
-
`+i.stack}return{value:t,source:e,stack:o,digest:null}}function If(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function ch(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var AI=typeof WeakMap=="function"?WeakMap:Map;function K_(t,e,n){n=gr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){hc||(hc=!0,bh=r),ch(t,e)},n}function G_(t,e,n){n=gr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return r(o)},n.callback=function(){ch(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){ch(t,e),typeof r!="function"&&(no===null?no=new Set([this]):no.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function j0(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new AI;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(o.add(n),t=HI.bind(null,t,e,n),e.then(t,t))}function L0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function B0(t,e,n,r,o){return t.mode&1?(t.flags|=65536,t.lanes=o,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=gr(-1,1),e.tag=2,to(n,e,1))),n.lanes|=1),t)}var II=Mr.ReactCurrentOwner,Jt=!1;function jt(t,e,n,r){e.child=t===null?k_(e,null,n,r):ps(e,t.child,n,r)}function F0(t,e,n,r,o){n=n.render;var i=e.ref;return ns(e,o),r=py(t,e,n,r,i,o),n=hy(),t!==null&&!Jt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Er(t,e,o)):(Be&&n&&ty(e),e.flags|=1,jt(t,e,r,o),e.child)}function $0(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!xy(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,J_(t,e,i,r,o)):(t=Au(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Da,n(s,r)&&t.ref===e.ref)return Er(t,e,o)}return e.flags|=1,t=oo(i,r),t.ref=e.ref,t.return=e,e.child=t}function J_(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(Da(i,r)&&t.ref===e.ref)if(Jt=!1,e.pendingProps=r=i,(t.lanes&o)!==0)t.flags&131072&&(Jt=!0);else return e.lanes=t.lanes,Er(t,e,o)}return dh(t,e,n,r,o)}function Y_(t,e,n){var r=e.pendingProps,o=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pe($i,nn),nn|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Pe($i,nn),nn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Pe($i,nn),nn|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Pe($i,nn),nn|=r;return jt(t,e,o,n),e.child}function Q_(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function dh(t,e,n,r,o){var i=Qt(n)?Qo:Pt.current;return i=ds(e,i),ns(e,o),n=py(t,e,n,r,i,o),r=hy(),t!==null&&!Jt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Er(t,e,o)):(Be&&r&&ty(e),e.flags|=1,jt(t,e,n,o),e.child)}function z0(t,e,n,r,o){if(Qt(n)){var i=!0;oc(e)}else i=!1;if(ns(e,o),e.stateNode===null)Mu(t,e),W_(e,n,r),uh(e,n,r,o),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var u=s.context,l=n.contextType;typeof l=="object"&&l!==null?l=Tn(l):(l=Qt(n)?Qo:Pt.current,l=ds(e,l));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||u!==l)&&D0(e,s,r,l),Lr=!1;var f=e.memoizedState;s.state=f,uc(e,r,s,o),u=e.memoizedState,a!==r||f!==u||Yt.current||Lr?(typeof c=="function"&&(lh(e,n,c,r),u=e.memoizedState),(a=Lr||R0(e,n,a,r,f,u,l))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=u),s.props=r,s.state=u,s.context=l,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,E_(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:Nn(e.type,a),s.props=l,d=e.pendingProps,f=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=Tn(u):(u=Qt(n)?Qo:Pt.current,u=ds(e,u));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||f!==u)&&D0(e,s,r,u),Lr=!1,f=e.memoizedState,s.state=f,uc(e,r,s,o);var h=e.memoizedState;a!==d||f!==h||Yt.current||Lr?(typeof p=="function"&&(lh(e,n,p,r),h=e.memoizedState),(l=Lr||R0(e,n,l,r,f,h,u)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,h,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,h,u)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),s.props=r,s.state=h,s.context=u,r=l):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return fh(t,e,n,r,i,o)}function fh(t,e,n,r,o,i){Q_(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return o&&T0(e,n,!1),Er(t,e,i);r=e.stateNode,II.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=ps(e,t.child,null,i),e.child=ps(e,null,a,i)):jt(t,e,a,i),e.memoizedState=r.state,o&&T0(e,n,!0),e.child}function X_(t){var e=t.stateNode;e.pendingContext?E0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&E0(t,e.context,!1),uy(t,e.containerInfo)}function U0(t,e,n,r,o){return fs(),ry(o),e.flags|=256,jt(t,e,n,r),e.child}var ph={dehydrated:null,treeContext:null,retryLane:0};function hh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Z_(t,e,n){var r=e.pendingProps,o=We.current,i=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(o&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),Pe(We,o&1),t===null)return sh(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,i?(r=e.mode,i=e.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Pd(s,r,0,null),t=Uo(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=hh(n),e.memoizedState=ph,t):gy(e,s));if(o=t.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return PI(t,e,s,r,a,o,n);if(i){i=r.fallback,s=e.mode,o=t.child,a=o.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&e.child!==o?(r=e.child,r.childLanes=0,r.pendingProps=u,e.deletions=null):(r=oo(o,u),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=oo(a,i):(i=Uo(i,s,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,s=t.child.memoizedState,s=s===null?hh(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=t.childLanes&~n,e.memoizedState=ph,r}return i=t.child,t=i.sibling,r=oo(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function gy(t,e){return e=Pd({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ql(t,e,n,r){return r!==null&&ry(r),ps(e,t.child,null,n),t=gy(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function PI(t,e,n,r,o,i,s){if(n)return e.flags&256?(e.flags&=-257,r=If(Error(W(422))),ql(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,o=e.mode,r=Pd({mode:"visible",children:r.children},o,0,null),i=Uo(i,o,s,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&ps(e,t.child,null,s),e.child.memoizedState=hh(s),e.memoizedState=ph,i);if(!(e.mode&1))return ql(t,e,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(W(419)),r=If(i,r,void 0),ql(t,e,s,r)}if(a=(s&t.childLanes)!==0,Jt||a){if(r=gt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,xr(t,o),Bn(r,t,o,-1))}return ky(),r=If(Error(W(421))),ql(t,e,s,r)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=WI.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,on=eo(o.nextSibling),sn=e,Be=!0,Pn=null,t!==null&&(gn[vn++]=pr,gn[vn++]=hr,gn[vn++]=Xo,pr=t.id,hr=t.overflow,Xo=e),e=gy(e,r.children),e.flags|=4096,e)}function V0(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ah(t.return,e,n)}function Pf(t,e,n,r,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function eS(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(jt(t,e,r.children,n),r=We.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&V0(t,n,e);else if(t.tag===19)V0(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Pe(We,r),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(n=e.child,o=null;n!==null;)t=n.alternate,t!==null&&cc(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Pf(e,!1,o,n,i);break;case"backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&cc(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Pf(e,!0,n,null,i);break;case"together":Pf(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Mu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Er(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ei|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,n=oo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=oo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function RI(t,e,n){switch(e.tag){case 3:X_(e),fs();break;case 5:T_(e);break;case 1:Qt(e.type)&&oc(e);break;case 4:uy(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,o=e.memoizedProps.value;Pe(ac,r._currentValue),r._currentValue=o;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Pe(We,We.current&1),e.flags|=128,null):n&e.child.childLanes?Z_(t,e,n):(Pe(We,We.current&1),t=Er(t,e,n),t!==null?t.sibling:null);Pe(We,We.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return eS(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Pe(We,We.current),r)break;return null;case 22:case 23:return e.lanes=0,Y_(t,e,n)}return Er(t,e,n)}var tS,mh,nS,rS;tS=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};mh=function(){};nS=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,Do(er.current);var i=null;switch(n){case"input":o=Lp(t,o),r=Lp(t,r),i=[];break;case"select":o=Ge({},o,{value:void 0}),r=Ge({},r,{value:void 0}),i=[];break;case"textarea":o=$p(t,o),r=$p(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=nc)}Up(n,r);var s;n=null;for(l in o)if(!r.hasOwnProperty(l)&&o.hasOwnProperty(l)&&o[l]!=null)if(l==="style"){var a=o[l];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Ma.hasOwnProperty(l)?i||(i=[]):(i=i||[]).push(l,null));for(l in r){var u=r[l];if(a=o!=null?o[l]:void 0,r.hasOwnProperty(l)&&u!==a&&(u!=null||a!=null))if(l==="style")if(a){for(s in a)!a.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&a[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(i||(i=[]),i.push(l,n)),n=u;else l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(i=i||[]).push(l,u)):l==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(l,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(Ma.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&Re("scroll",t),i||a===u||(i=[])):(i=i||[]).push(l,u))}n&&(i=i||[]).push("style",n);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};rS=function(t,e,n,r){n!==r&&(e.flags|=4)};function Bs(t,e){if(!Be)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Ot(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function DI(t,e,n){var r=e.pendingProps;switch(ny(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(e),null;case 1:return Qt(e.type)&&rc(),Ot(e),null;case 3:return r=e.stateNode,hs(),je(Yt),je(Pt),dy(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ul(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Pn!==null&&(kh(Pn),Pn=null))),mh(t,e),Ot(e),null;case 5:cy(e);var o=Do($a.current);if(n=e.type,t!==null&&e.stateNode!=null)nS(t,e,n,r,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(W(166));return Ot(e),null}if(t=Do(er.current),Ul(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Jn]=e,r[Ba]=i,t=(e.mode&1)!==0,n){case"dialog":Re("cancel",r),Re("close",r);break;case"iframe":case"object":case"embed":Re("load",r);break;case"video":case"audio":for(o=0;o<Zs.length;o++)Re(Zs[o],r);break;case"source":Re("error",r);break;case"img":case"image":case"link":Re("error",r),Re("load",r);break;case"details":Re("toggle",r);break;case"input":Xg(r,i),Re("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Re("invalid",r);break;case"textarea":e0(r,i),Re("invalid",r)}Up(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&zl(r.textContent,a,t),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&zl(r.textContent,a,t),o=["children",""+a]):Ma.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Re("scroll",r)}switch(n){case"input":Pl(r),Zg(r,i,!0);break;case"textarea":Pl(r),t0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=nc)}r=o,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ab(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Jn]=e,t[Ba]=r,tS(t,e,!1,!1),e.stateNode=t;e:{switch(s=Vp(n,r),n){case"dialog":Re("cancel",t),Re("close",t),o=r;break;case"iframe":case"object":case"embed":Re("load",t),o=r;break;case"video":case"audio":for(o=0;o<Zs.length;o++)Re(Zs[o],t);o=r;break;case"source":Re("error",t),o=r;break;case"img":case"image":case"link":Re("error",t),Re("load",t),o=r;break;case"details":Re("toggle",t),o=r;break;case"input":Xg(t,r),o=Lp(t,r),Re("invalid",t);break;case"option":o=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},o=Ge({},r,{value:void 0}),Re("invalid",t);break;case"textarea":e0(t,r),o=$p(t,r),Re("invalid",t);break;default:o=r}Up(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var u=a[i];i==="style"?Rb(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Ib(t,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Oa(t,u):typeof u=="number"&&Oa(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ma.hasOwnProperty(i)?u!=null&&i==="onScroll"&&Re("scroll",t):u!=null&&zm(t,i,u,s))}switch(n){case"input":Pl(t),Zg(t,r,!1);break;case"textarea":Pl(t),t0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+co(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Xi(t,!!r.multiple,i,!1):r.defaultValue!=null&&Xi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=nc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Ot(e),null;case 6:if(t&&e.stateNode!=null)rS(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(W(166));if(n=Do($a.current),Do(er.current),Ul(e)){if(r=e.stateNode,n=e.memoizedProps,r[Jn]=e,(i=r.nodeValue!==n)&&(t=sn,t!==null))switch(t.tag){case 3:zl(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&zl(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Jn]=e,e.stateNode=r}return Ot(e),null;case 13:if(je(We),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Be&&on!==null&&e.mode&1&&!(e.flags&128))__(),fs(),e.flags|=98560,i=!1;else if(i=Ul(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(W(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(W(317));i[Jn]=e}else fs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ot(e),i=!1}else Pn!==null&&(kh(Pn),Pn=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||We.current&1?ft===0&&(ft=3):ky())),e.updateQueue!==null&&(e.flags|=4),Ot(e),null);case 4:return hs(),mh(t,e),t===null&&ja(e.stateNode.containerInfo),Ot(e),null;case 10:return sy(e.type._context),Ot(e),null;case 17:return Qt(e.type)&&rc(),Ot(e),null;case 19:if(je(We),i=e.memoizedState,i===null)return Ot(e),null;if(r=(e.flags&128)!==0,s=i.rendering,s===null)if(r)Bs(i,!1);else{if(ft!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=cc(t),s!==null){for(e.flags|=128,Bs(i,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,t=s.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Pe(We,We.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ze()>ys&&(e.flags|=128,r=!0,Bs(i,!1),e.lanes=4194304)}else{if(!r)if(t=cc(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Bs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Be)return Ot(e),null}else 2*Ze()-i.renderingStartTime>ys&&n!==1073741824&&(e.flags|=128,r=!0,Bs(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ze(),e.sibling=null,n=We.current,Pe(We,r?n&1|2:n&1),e):(Ot(e),null);case 22:case 23:return Sy(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?nn&1073741824&&(Ot(e),e.subtreeFlags&6&&(e.flags|=8192)):Ot(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function jI(t,e){switch(ny(e),e.tag){case 1:return Qt(e.type)&&rc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return hs(),je(Yt),je(Pt),dy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return cy(e),null;case 13:if(je(We),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));fs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return je(We),null;case 4:return hs(),null;case 10:return sy(e.type._context),null;case 22:case 23:return Sy(),null;case 24:return null;default:return null}}var Hl=!1,At=!1,LI=typeof WeakSet=="function"?WeakSet:Set,Q=null;function Fi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(t,e,r)}else n.current=null}function yh(t,e,n){try{n()}catch(r){Qe(t,e,r)}}var q0=!1;function BI(t,e){if(Zp=Zu,t=l_(),ey(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,l=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(u=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++l===o&&(a=s),f===i&&++c===r&&(u=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(eh={focusedElem:t,selectionRange:n},Zu=!1,Q=e;Q!==null;)if(e=Q,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Q=t;else for(;Q!==null;){e=Q;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,v=h.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:Nn(e.type,m),v);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(S){Qe(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Q=t;break}Q=e.return}return h=q0,q0=!1,h}function fa(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&yh(e,n,i)}o=o.next}while(o!==r)}}function Ad(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function gh(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function oS(t){var e=t.alternate;e!==null&&(t.alternate=null,oS(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Jn],delete e[Ba],delete e[rh],delete e[bI],delete e[_I])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function iS(t){return t.tag===5||t.tag===3||t.tag===4}function H0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||iS(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function vh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=nc));else if(r!==4&&(t=t.child,t!==null))for(vh(t,e,n),t=t.sibling;t!==null;)vh(t,e,n),t=t.sibling}function wh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(wh(t,e,n),t=t.sibling;t!==null;)wh(t,e,n),t=t.sibling}var St=null,In=!1;function Ir(t,e,n){for(n=n.child;n!==null;)sS(t,e,n),n=n.sibling}function sS(t,e,n){if(Zn&&typeof Zn.onCommitFiberUnmount=="function")try{Zn.onCommitFiberUnmount(kd,n)}catch{}switch(n.tag){case 5:At||Fi(n,e);case 6:var r=St,o=In;St=null,Ir(t,e,n),St=r,In=o,St!==null&&(In?(t=St,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):St.removeChild(n.stateNode));break;case 18:St!==null&&(In?(t=St,n=n.stateNode,t.nodeType===8?Tf(t.parentNode,n):t.nodeType===1&&Tf(t,n),Pa(t)):Tf(St,n.stateNode));break;case 4:r=St,o=In,St=n.stateNode.containerInfo,In=!0,Ir(t,e,n),St=r,In=o;break;case 0:case 11:case 14:case 15:if(!At&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&yh(n,e,s),o=o.next}while(o!==r)}Ir(t,e,n);break;case 1:if(!At&&(Fi(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,e,a)}Ir(t,e,n);break;case 21:Ir(t,e,n);break;case 22:n.mode&1?(At=(r=At)||n.memoizedState!==null,Ir(t,e,n),At=r):Ir(t,e,n);break;default:Ir(t,e,n)}}function W0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new LI),e.forEach(function(r){var o=KI.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function On(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:St=a.stateNode,In=!1;break e;case 3:St=a.stateNode.containerInfo,In=!0;break e;case 4:St=a.stateNode.containerInfo,In=!0;break e}a=a.return}if(St===null)throw Error(W(160));sS(i,s,o),St=null,In=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Qe(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)aS(e,t),e=e.sibling}function aS(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(On(e,t),Vn(t),r&4){try{fa(3,t,t.return),Ad(3,t)}catch(m){Qe(t,t.return,m)}try{fa(5,t,t.return)}catch(m){Qe(t,t.return,m)}}break;case 1:On(e,t),Vn(t),r&512&&n!==null&&Fi(n,n.return);break;case 5:if(On(e,t),Vn(t),r&512&&n!==null&&Fi(n,n.return),t.flags&32){var o=t.stateNode;try{Oa(o,"")}catch(m){Qe(t,t.return,m)}}if(r&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,s=n!==null?n.memoizedProps:i,a=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Ob(o,i),Vp(a,s);var l=Vp(a,i);for(s=0;s<u.length;s+=2){var c=u[s],d=u[s+1];c==="style"?Rb(o,d):c==="dangerouslySetInnerHTML"?Ib(o,d):c==="children"?Oa(o,d):zm(o,c,d,l)}switch(a){case"input":Bp(o,i);break;case"textarea":Nb(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Xi(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Xi(o,!!i.multiple,i.defaultValue,!0):Xi(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ba]=i}catch(m){Qe(t,t.return,m)}}break;case 6:if(On(e,t),Vn(t),r&4){if(t.stateNode===null)throw Error(W(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(m){Qe(t,t.return,m)}}break;case 3:if(On(e,t),Vn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pa(e.containerInfo)}catch(m){Qe(t,t.return,m)}break;case 4:On(e,t),Vn(t);break;case 13:On(e,t),Vn(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(by=Ze())),r&4&&W0(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(At=(l=At)||c,On(e,t),At=l):On(e,t),Vn(t),r&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(Q=t,c=t.child;c!==null;){for(d=Q=c;Q!==null;){switch(f=Q,p=f.child,f.tag){case 0:case 11:case 14:case 15:fa(4,f,f.return);break;case 1:Fi(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(m){Qe(r,n,m)}}break;case 5:Fi(f,f.return);break;case 22:if(f.memoizedState!==null){G0(d);continue}}p!==null?(p.return=f,Q=p):G0(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=d.stateNode,u=d.memoizedProps.style,s=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=Pb("display",s))}catch(m){Qe(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){Qe(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:On(e,t),Vn(t),r&4&&W0(t);break;case 21:break;default:On(e,t),Vn(t)}}function Vn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(iS(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Oa(o,""),r.flags&=-33);var i=H0(t);wh(t,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=H0(t);vh(t,a,s);break;default:throw Error(W(161))}}catch(u){Qe(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function FI(t,e,n){Q=t,lS(t)}function lS(t,e,n){for(var r=(t.mode&1)!==0;Q!==null;){var o=Q,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Hl;if(!s){var a=o.alternate,u=a!==null&&a.memoizedState!==null||At;a=Hl;var l=At;if(Hl=s,(At=u)&&!l)for(Q=o;Q!==null;)s=Q,u=s.child,s.tag===22&&s.memoizedState!==null?J0(o):u!==null?(u.return=s,Q=u):J0(o);for(;i!==null;)Q=i,lS(i),i=i.sibling;Q=o,Hl=a,At=l}K0(t)}else o.subtreeFlags&8772&&i!==null?(i.return=o,Q=i):K0(t)}}function K0(t){for(;Q!==null;){var e=Q;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:At||Ad(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!At)if(n===null)r.componentDidMount();else{var o=e.elementType===e.type?n.memoizedProps:Nn(e.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&A0(e,i,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}A0(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Pa(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}At||e.flags&512&&gh(e)}catch(f){Qe(e,e.return,f)}}if(e===t){Q=null;break}if(n=e.sibling,n!==null){n.return=e.return,Q=n;break}Q=e.return}}function G0(t){for(;Q!==null;){var e=Q;if(e===t){Q=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Q=n;break}Q=e.return}}function J0(t){for(;Q!==null;){var e=Q;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Ad(4,e)}catch(u){Qe(e,n,u)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var o=e.return;try{r.componentDidMount()}catch(u){Qe(e,o,u)}}var i=e.return;try{gh(e)}catch(u){Qe(e,i,u)}break;case 5:var s=e.return;try{gh(e)}catch(u){Qe(e,s,u)}}}catch(u){Qe(e,e.return,u)}if(e===t){Q=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Q=a;break}Q=e.return}}var $I=Math.ceil,pc=Mr.ReactCurrentDispatcher,vy=Mr.ReactCurrentOwner,_n=Mr.ReactCurrentBatchConfig,xe=0,gt=null,rt=null,Tt=0,nn=0,$i=yo(0),ft=0,qa=null,ei=0,Id=0,wy=0,pa=null,Wt=null,by=0,ys=1/0,ur=null,hc=!1,bh=null,no=null,Wl=!1,Kr=null,mc=0,ha=0,_h=null,Ou=-1,Nu=0;function Ft(){return xe&6?Ze():Ou!==-1?Ou:Ou=Ze()}function ro(t){return t.mode&1?xe&2&&Tt!==0?Tt&-Tt:kI.transition!==null?(Nu===0&&(Nu=Wb()),Nu):(t=Oe,t!==0||(t=window.event,t=t===void 0?16:Zb(t.type)),t):1}function Bn(t,e,n,r){if(50<ha)throw ha=0,_h=null,Error(W(185));bl(t,n,r),(!(xe&2)||t!==gt)&&(t===gt&&(!(xe&2)&&(Id|=n),ft===4&&Ur(t,Tt)),Xt(t,r),n===1&&xe===0&&!(e.mode&1)&&(ys=Ze()+500,Md&&go()))}function Xt(t,e){var n=t.callbackNode;kA(t,e);var r=Xu(t,t===gt?Tt:0);if(r===0)n!==null&&o0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&o0(n),e===1)t.tag===0?SI(Y0.bind(null,t)):v_(Y0.bind(null,t)),vI(function(){!(xe&6)&&go()}),n=null;else{switch(Kb(r)){case 1:n=Wm;break;case 4:n=qb;break;case 16:n=Qu;break;case 536870912:n=Hb;break;default:n=Qu}n=yS(n,uS.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function uS(t,e){if(Ou=-1,Nu=0,xe&6)throw Error(W(327));var n=t.callbackNode;if(rs()&&t.callbackNode!==n)return null;var r=Xu(t,t===gt?Tt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=yc(t,r);else{e=r;var o=xe;xe|=2;var i=dS();(gt!==t||Tt!==e)&&(ur=null,ys=Ze()+500,zo(t,e));do try{VI();break}catch(a){cS(t,a)}while(!0);iy(),pc.current=i,xe=o,rt!==null?e=0:(gt=null,Tt=0,e=ft)}if(e!==0){if(e===2&&(o=Gp(t),o!==0&&(r=o,e=Sh(t,o))),e===1)throw n=qa,zo(t,0),Ur(t,r),Xt(t,Ze()),n;if(e===6)Ur(t,r);else{if(o=t.current.alternate,!(r&30)&&!zI(o)&&(e=yc(t,r),e===2&&(i=Gp(t),i!==0&&(r=i,e=Sh(t,i))),e===1))throw n=qa,zo(t,0),Ur(t,r),Xt(t,Ze()),n;switch(t.finishedWork=o,t.finishedLanes=r,e){case 0:case 1:throw Error(W(345));case 2:Co(t,Wt,ur);break;case 3:if(Ur(t,r),(r&130023424)===r&&(e=by+500-Ze(),10<e)){if(Xu(t,0)!==0)break;if(o=t.suspendedLanes,(o&r)!==r){Ft(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=nh(Co.bind(null,t,Wt,ur),e);break}Co(t,Wt,ur);break;case 4:if(Ur(t,r),(r&4194240)===r)break;for(e=t.eventTimes,o=-1;0<r;){var s=31-Ln(r);i=1<<s,s=e[s],s>o&&(o=s),r&=~i}if(r=o,r=Ze()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*$I(r/1960))-r,10<r){t.timeoutHandle=nh(Co.bind(null,t,Wt,ur),r);break}Co(t,Wt,ur);break;case 5:Co(t,Wt,ur);break;default:throw Error(W(329))}}}return Xt(t,Ze()),t.callbackNode===n?uS.bind(null,t):null}function Sh(t,e){var n=pa;return t.current.memoizedState.isDehydrated&&(zo(t,e).flags|=256),t=yc(t,e),t!==2&&(e=Wt,Wt=n,e!==null&&kh(e)),t}function kh(t){Wt===null?Wt=t:Wt.push.apply(Wt,t)}function zI(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Fn(i(),o))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Ur(t,e){for(e&=~wy,e&=~Id,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Ln(e),r=1<<n;t[n]=-1,e&=~r}}function Y0(t){if(xe&6)throw Error(W(327));rs();var e=Xu(t,0);if(!(e&1))return Xt(t,Ze()),null;var n=yc(t,e);if(t.tag!==0&&n===2){var r=Gp(t);r!==0&&(e=r,n=Sh(t,r))}if(n===1)throw n=qa,zo(t,0),Ur(t,e),Xt(t,Ze()),n;if(n===6)throw Error(W(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Co(t,Wt,ur),Xt(t,Ze()),null}function _y(t,e){var n=xe;xe|=1;try{return t(e)}finally{xe=n,xe===0&&(ys=Ze()+500,Md&&go())}}function ti(t){Kr!==null&&Kr.tag===0&&!(xe&6)&&rs();var e=xe;xe|=1;var n=_n.transition,r=Oe;try{if(_n.transition=null,Oe=1,t)return t()}finally{Oe=r,_n.transition=n,xe=e,!(xe&6)&&go()}}function Sy(){nn=$i.current,je($i)}function zo(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,gI(n)),rt!==null)for(n=rt.return;n!==null;){var r=n;switch(ny(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&rc();break;case 3:hs(),je(Yt),je(Pt),dy();break;case 5:cy(r);break;case 4:hs();break;case 13:je(We);break;case 19:je(We);break;case 10:sy(r.type._context);break;case 22:case 23:Sy()}n=n.return}if(gt=t,rt=t=oo(t.current,null),Tt=nn=e,ft=0,qa=null,wy=Id=ei=0,Wt=pa=null,Ro!==null){for(e=0;e<Ro.length;e++)if(n=Ro[e],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}Ro=null}return t}function cS(t,e){do{var n=rt;try{if(iy(),Tu.current=fc,dc){for(var r=Ke.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}dc=!1}if(Zo=0,ht=dt=Ke=null,da=!1,za=0,vy.current=null,n===null||n.return===null){ft=1,qa=e,rt=null;break}e:{var i=t,s=n.return,a=n,u=e;if(e=Tt,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=a,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=L0(s);if(p!==null){p.flags&=-257,B0(p,s,a,i,e),p.mode&1&&j0(i,l,e),e=p,u=l;var h=e.updateQueue;if(h===null){var m=new Set;m.add(u),e.updateQueue=m}else h.add(u);break e}else{if(!(e&1)){j0(i,l,e),ky();break e}u=Error(W(426))}}else if(Be&&a.mode&1){var v=L0(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),B0(v,s,a,i,e),ry(ms(u,a));break e}}i=u=ms(u,a),ft!==4&&(ft=2),pa===null?pa=[i]:pa.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=K_(i,u,e);N0(i,y);break e;case 1:a=u;var w=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(no===null||!no.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=G_(i,a,e);N0(i,S);break e}}i=i.return}while(i!==null)}pS(n)}catch(k){e=k,rt===n&&n!==null&&(rt=n=n.return);continue}break}while(!0)}function dS(){var t=pc.current;return pc.current=fc,t===null?fc:t}function ky(){(ft===0||ft===3||ft===2)&&(ft=4),gt===null||!(ei&268435455)&&!(Id&268435455)||Ur(gt,Tt)}function yc(t,e){var n=xe;xe|=2;var r=dS();(gt!==t||Tt!==e)&&(ur=null,zo(t,e));do try{UI();break}catch(o){cS(t,o)}while(!0);if(iy(),xe=n,pc.current=r,rt!==null)throw Error(W(261));return gt=null,Tt=0,ft}function UI(){for(;rt!==null;)fS(rt)}function VI(){for(;rt!==null&&!hA();)fS(rt)}function fS(t){var e=mS(t.alternate,t,nn);t.memoizedProps=t.pendingProps,e===null?pS(t):rt=e,vy.current=null}function pS(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=jI(n,e),n!==null){n.flags&=32767,rt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ft=6,rt=null;return}}else if(n=DI(n,e,nn),n!==null){rt=n;return}if(e=e.sibling,e!==null){rt=e;return}rt=e=t}while(e!==null);ft===0&&(ft=5)}function Co(t,e,n){var r=Oe,o=_n.transition;try{_n.transition=null,Oe=1,qI(t,e,n,r)}finally{_n.transition=o,Oe=r}return null}function qI(t,e,n,r){do rs();while(Kr!==null);if(xe&6)throw Error(W(327));n=t.finishedWork;var o=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(W(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(xA(t,i),t===gt&&(rt=gt=null,Tt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Wl||(Wl=!0,yS(Qu,function(){return rs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=_n.transition,_n.transition=null;var s=Oe;Oe=1;var a=xe;xe|=4,vy.current=null,BI(t,n),aS(n,t),cI(eh),Zu=!!Zp,eh=Zp=null,t.current=n,FI(n),mA(),xe=a,Oe=s,_n.transition=i}else t.current=n;if(Wl&&(Wl=!1,Kr=t,mc=o),i=t.pendingLanes,i===0&&(no=null),vA(n.stateNode),Xt(t,Ze()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)o=e[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(hc)throw hc=!1,t=bh,bh=null,t;return mc&1&&t.tag!==0&&rs(),i=t.pendingLanes,i&1?t===_h?ha++:(ha=0,_h=t):ha=0,go(),null}function rs(){if(Kr!==null){var t=Kb(mc),e=_n.transition,n=Oe;try{if(_n.transition=null,Oe=16>t?16:t,Kr===null)var r=!1;else{if(t=Kr,Kr=null,mc=0,xe&6)throw Error(W(331));var o=xe;for(xe|=4,Q=t.current;Q!==null;){var i=Q,s=i.child;if(Q.flags&16){var a=i.deletions;if(a!==null){for(var u=0;u<a.length;u++){var l=a[u];for(Q=l;Q!==null;){var c=Q;switch(c.tag){case 0:case 11:case 15:fa(8,c,i)}var d=c.child;if(d!==null)d.return=c,Q=d;else for(;Q!==null;){c=Q;var f=c.sibling,p=c.return;if(oS(c),c===l){Q=null;break}if(f!==null){f.return=p,Q=f;break}Q=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(m!==null)}}Q=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Q=s;else e:for(;Q!==null;){if(i=Q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fa(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,Q=y;break e}Q=i.return}}var w=t.current;for(Q=w;Q!==null;){s=Q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Q=b;else e:for(s=w;Q!==null;){if(a=Q,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ad(9,a)}}catch(k){Qe(a,a.return,k)}if(a===s){Q=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,Q=S;break e}Q=a.return}}if(xe=o,go(),Zn&&typeof Zn.onPostCommitFiberRoot=="function")try{Zn.onPostCommitFiberRoot(kd,t)}catch{}r=!0}return r}finally{Oe=n,_n.transition=e}}return!1}function Q0(t,e,n){e=ms(n,e),e=K_(t,e,1),t=to(t,e,1),e=Ft(),t!==null&&(bl(t,1,e),Xt(t,e))}function Qe(t,e,n){if(t.tag===3)Q0(t,t,n);else for(;e!==null;){if(e.tag===3){Q0(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(no===null||!no.has(r))){t=ms(n,t),t=G_(e,t,1),e=to(e,t,1),t=Ft(),e!==null&&(bl(e,1,t),Xt(e,t));break}}e=e.return}}function HI(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Ft(),t.pingedLanes|=t.suspendedLanes&n,gt===t&&(Tt&n)===n&&(ft===4||ft===3&&(Tt&130023424)===Tt&&500>Ze()-by?zo(t,0):wy|=n),Xt(t,e)}function hS(t,e){e===0&&(t.mode&1?(e=jl,jl<<=1,!(jl&130023424)&&(jl=4194304)):e=1);var n=Ft();t=xr(t,e),t!==null&&(bl(t,e,n),Xt(t,n))}function WI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),hS(t,n)}function KI(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),hS(t,n)}var mS;mS=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Yt.current)Jt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Jt=!1,RI(t,e,n);Jt=!!(t.flags&131072)}else Jt=!1,Be&&e.flags&1048576&&w_(e,sc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Mu(t,e),t=e.pendingProps;var o=ds(e,Pt.current);ns(e,n),o=py(null,e,r,t,o,n);var i=hy();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Qt(r)?(i=!0,oc(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ly(e),o.updater=Nd,e.stateNode=o,o._reactInternals=e,uh(e,r,t,n),e=fh(null,e,r,!0,i,n)):(e.tag=0,Be&&i&&ty(e),jt(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Mu(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=JI(r),t=Nn(r,t),o){case 0:e=dh(null,e,r,t,n);break e;case 1:e=z0(null,e,r,t,n);break e;case 11:e=F0(null,e,r,t,n);break e;case 14:e=$0(null,e,r,Nn(r.type,t),n);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),dh(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),z0(t,e,r,o,n);case 3:e:{if(X_(e),t===null)throw Error(W(387));r=e.pendingProps,i=e.memoizedState,o=i.element,E_(t,e),uc(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=ms(Error(W(423)),e),e=U0(t,e,r,n,o);break e}else if(r!==o){o=ms(Error(W(424)),e),e=U0(t,e,r,n,o);break e}else for(on=eo(e.stateNode.containerInfo.firstChild),sn=e,Be=!0,Pn=null,n=k_(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fs(),r===o){e=Er(t,e,n);break e}jt(t,e,r,n)}e=e.child}return e;case 5:return T_(e),t===null&&sh(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,th(r,o)?s=null:i!==null&&th(r,i)&&(e.flags|=32),Q_(t,e),jt(t,e,s,n),e.child;case 6:return t===null&&sh(e),null;case 13:return Z_(t,e,n);case 4:return uy(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ps(e,null,r,n):jt(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),F0(t,e,r,o,n);case 7:return jt(t,e,e.pendingProps,n),e.child;case 8:return jt(t,e,e.pendingProps.children,n),e.child;case 12:return jt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Pe(ac,r._currentValue),r._currentValue=s,i!==null)if(Fn(i.value,s)){if(i.children===o.children&&!Yt.current){e=Er(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=gr(-1,n&-n),u.tag=2;var l=i.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?u.next=u:(u.next=c.next,c.next=u),l.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ah(i.return,n,e),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(W(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ah(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}jt(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,ns(e,n),o=Tn(o),r=r(o),e.flags|=1,jt(t,e,r,n),e.child;case 14:return r=e.type,o=Nn(r,e.pendingProps),o=Nn(r.type,o),$0(t,e,r,o,n);case 15:return J_(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),Mu(t,e),e.tag=1,Qt(r)?(t=!0,oc(e)):t=!1,ns(e,n),W_(e,r,o),uh(e,r,o,n),fh(null,e,r,!0,t,n);case 19:return eS(t,e,n);case 22:return Y_(t,e,n)}throw Error(W(156,e.tag))};function yS(t,e){return Vb(t,e)}function GI(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(t,e,n,r){return new GI(t,e,n,r)}function xy(t){return t=t.prototype,!(!t||!t.isReactComponent)}function JI(t){if(typeof t=="function")return xy(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Vm)return 11;if(t===qm)return 14}return 2}function oo(t,e){var n=t.alternate;return n===null?(n=bn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Au(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")xy(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Ni:return Uo(n.children,o,i,e);case Um:s=8,o|=8;break;case Pp:return t=bn(12,n,e,o|2),t.elementType=Pp,t.lanes=i,t;case Rp:return t=bn(13,n,e,o),t.elementType=Rp,t.lanes=i,t;case Dp:return t=bn(19,n,e,o),t.elementType=Dp,t.lanes=i,t;case Tb:return Pd(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case xb:s=10;break e;case Eb:s=9;break e;case Vm:s=11;break e;case qm:s=14;break e;case jr:s=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=bn(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Uo(t,e,n,r){return t=bn(7,t,r,e),t.lanes=n,t}function Pd(t,e,n,r){return t=bn(22,t,r,e),t.elementType=Tb,t.lanes=n,t.stateNode={isHidden:!1},t}function Rf(t,e,n){return t=bn(6,t,null,e),t.lanes=n,t}function Df(t,e,n){return e=bn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function YI(t,e,n,r,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mf(0),this.expirationTimes=mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mf(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Ey(t,e,n,r,o,i,s,a,u){return t=new YI(t,e,n,a,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=bn(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ly(i),t}function QI(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Oi,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function gS(t){if(!t)return fo;t=t._reactInternals;e:{if(mi(t)!==t||t.tag!==1)throw Error(W(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Qt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(W(171))}if(t.tag===1){var n=t.type;if(Qt(n))return g_(t,n,e)}return e}function vS(t,e,n,r,o,i,s,a,u){return t=Ey(n,r,!0,t,o,i,s,a,u),t.context=gS(null),n=t.current,r=Ft(),o=ro(n),i=gr(r,o),i.callback=e??null,to(n,i,o),t.current.lanes=o,bl(t,o,r),Xt(t,r),t}function Rd(t,e,n,r){var o=e.current,i=Ft(),s=ro(o);return n=gS(n),e.context===null?e.context=n:e.pendingContext=n,e=gr(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=to(o,e,s),t!==null&&(Bn(t,o,s,i),Eu(t,o,s)),s}function gc(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function X0(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Ty(t,e){X0(t,e),(t=t.alternate)&&X0(t,e)}function XI(){return null}var wS=typeof reportError=="function"?reportError:function(t){console.error(t)};function Cy(t){this._internalRoot=t}Dd.prototype.render=Cy.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));Rd(t,e,null,null)};Dd.prototype.unmount=Cy.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ti(function(){Rd(null,t,null,null)}),e[kr]=null}};function Dd(t){this._internalRoot=t}Dd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Yb();t={blockedOn:null,target:t,priority:e};for(var n=0;n<zr.length&&e!==0&&e<zr[n].priority;n++);zr.splice(n,0,t),n===0&&Xb(t)}};function My(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function jd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Z0(){}function ZI(t,e,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var l=gc(s);i.call(l)}}var s=vS(e,r,t,0,null,!1,!1,"",Z0);return t._reactRootContainer=s,t[kr]=s.current,ja(t.nodeType===8?t.parentNode:t),ti(),s}for(;o=t.lastChild;)t.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var l=gc(u);a.call(l)}}var u=Ey(t,0,!1,null,null,!1,!1,"",Z0);return t._reactRootContainer=u,t[kr]=u.current,ja(t.nodeType===8?t.parentNode:t),ti(function(){Rd(e,u,n,r)}),u}function Ld(t,e,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var u=gc(s);a.call(u)}}Rd(e,s,t,o)}else s=ZI(n,e,t,o,r);return gc(s)}Gb=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Xs(e.pendingLanes);n!==0&&(Km(e,n|1),Xt(e,Ze()),!(xe&6)&&(ys=Ze()+500,go()))}break;case 13:ti(function(){var r=xr(t,1);if(r!==null){var o=Ft();Bn(r,t,1,o)}}),Ty(t,1)}};Gm=function(t){if(t.tag===13){var e=xr(t,134217728);if(e!==null){var n=Ft();Bn(e,t,134217728,n)}Ty(t,134217728)}};Jb=function(t){if(t.tag===13){var e=ro(t),n=xr(t,e);if(n!==null){var r=Ft();Bn(n,t,e,r)}Ty(t,e)}};Yb=function(){return Oe};Qb=function(t,e){var n=Oe;try{return Oe=t,e()}finally{Oe=n}};Hp=function(t,e,n){switch(e){case"input":if(Bp(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var o=Cd(r);if(!o)throw Error(W(90));Mb(r),Bp(r,o)}}}break;case"textarea":Nb(t,n);break;case"select":e=n.value,e!=null&&Xi(t,!!n.multiple,e,!1)}};Lb=_y;Bb=ti;var e2={usingClientEntryPoint:!1,Events:[Sl,Ri,Cd,Db,jb,_y]},Fs={findFiberByHostInstance:Po,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},t2={bundleType:Fs.bundleType,version:Fs.version,rendererPackageName:Fs.rendererPackageName,rendererConfig:Fs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Mr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=zb(t),t===null?null:t.stateNode},findFiberByHostInstance:Fs.findFiberByHostInstance||XI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{kd=Kl.inject(t2),Zn=Kl}catch{}}un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=e2;un.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!My(e))throw Error(W(200));return QI(t,e,null,n)};un.createRoot=function(t,e){if(!My(t))throw Error(W(299));var n=!1,r="",o=wS;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Ey(t,1,!1,null,null,n,!1,r,o),t[kr]=e.current,ja(t.nodeType===8?t.parentNode:t),new Cy(e)};un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(W(188)):(t=Object.keys(t).join(","),Error(W(268,t)));return t=zb(e),t=t===null?null:t.stateNode,t};un.flushSync=function(t){return ti(t)};un.hydrate=function(t,e,n){if(!jd(e))throw Error(W(200));return Ld(null,t,e,!0,n)};un.hydrateRoot=function(t,e,n){if(!My(t))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=wS;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=vS(e,null,t,1,n??null,o,!1,i,s),t[kr]=e.current,ja(t),r)for(t=0;t<r.length;t++)n=r[t],o=n._getVersion,o=o(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,o]:e.mutableSourceEagerHydrationData.push(n,o);return new Dd(e)};un.render=function(t,e,n){if(!jd(e))throw Error(W(200));return Ld(null,t,e,!1,n)};un.unmountComponentAtNode=function(t){if(!jd(t))throw Error(W(40));return t._reactRootContainer?(ti(function(){Ld(null,null,t,!1,function(){t._reactRootContainer=null,t[kr]=null})}),!0):!1};un.unstable_batchedUpdates=_y;un.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!jd(n))throw Error(W(200));if(t==null||t._reactInternals===void 0)throw Error(W(38));return Ld(t,e,n,!1,r)};un.version="18.3.1-next-f1338f8080-20240426";function bS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bS)}catch(t){console.error(t)}}bS(),bb.exports=un;var Oy=bb.exports;const n2=di(Oy);var _S,ev=Oy;_S=ev.createRoot,ev.hydrateRoot;const r2=document.getElementById("root"),o2=_S(r2);function jf(t){o2.render(g.jsx(_.StrictMode,{children:t}))}var SS={exports:{}};/*!
|
|
46
|
+
`+i.stack}return{value:t,source:e,stack:o,digest:null}}function If(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function ch(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var AI=typeof WeakMap=="function"?WeakMap:Map;function K_(t,e,n){n=gr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){hc||(hc=!0,bh=r),ch(t,e)},n}function G_(t,e,n){n=gr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return r(o)},n.callback=function(){ch(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){ch(t,e),typeof r!="function"&&(no===null?no=new Set([this]):no.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function j0(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new AI;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(o.add(n),t=HI.bind(null,t,e,n),e.then(t,t))}function L0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function B0(t,e,n,r,o){return t.mode&1?(t.flags|=65536,t.lanes=o,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=gr(-1,1),e.tag=2,to(n,e,1))),n.lanes|=1),t)}var II=Mr.ReactCurrentOwner,Jt=!1;function Lt(t,e,n,r){e.child=t===null?k_(e,null,n,r):ps(e,t.child,n,r)}function F0(t,e,n,r,o){n=n.render;var i=e.ref;return ns(e,o),r=py(t,e,n,r,i,o),n=hy(),t!==null&&!Jt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Er(t,e,o)):(Be&&n&&ty(e),e.flags|=1,Lt(t,e,r,o),e.child)}function $0(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!xy(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,J_(t,e,i,r,o)):(t=Au(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Da,n(s,r)&&t.ref===e.ref)return Er(t,e,o)}return e.flags|=1,t=oo(i,r),t.ref=e.ref,t.return=e,e.child=t}function J_(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(Da(i,r)&&t.ref===e.ref)if(Jt=!1,e.pendingProps=r=i,(t.lanes&o)!==0)t.flags&131072&&(Jt=!0);else return e.lanes=t.lanes,Er(t,e,o)}return dh(t,e,n,r,o)}function Y_(t,e,n){var r=e.pendingProps,o=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pe($i,nn),nn|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Pe($i,nn),nn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Pe($i,nn),nn|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Pe($i,nn),nn|=r;return Lt(t,e,o,n),e.child}function Q_(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function dh(t,e,n,r,o){var i=Qt(n)?Qo:Pt.current;return i=ds(e,i),ns(e,o),n=py(t,e,n,r,i,o),r=hy(),t!==null&&!Jt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Er(t,e,o)):(Be&&r&&ty(e),e.flags|=1,Lt(t,e,n,o),e.child)}function z0(t,e,n,r,o){if(Qt(n)){var i=!0;oc(e)}else i=!1;if(ns(e,o),e.stateNode===null)Mu(t,e),W_(e,n,r),uh(e,n,r,o),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var u=s.context,l=n.contextType;typeof l=="object"&&l!==null?l=Tn(l):(l=Qt(n)?Qo:Pt.current,l=ds(e,l));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||u!==l)&&D0(e,s,r,l),Lr=!1;var f=e.memoizedState;s.state=f,uc(e,r,s,o),u=e.memoizedState,a!==r||f!==u||Yt.current||Lr?(typeof c=="function"&&(lh(e,n,c,r),u=e.memoizedState),(a=Lr||R0(e,n,a,r,f,u,l))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=u),s.props=r,s.state=u,s.context=l,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,E_(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:Nn(e.type,a),s.props=l,d=e.pendingProps,f=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=Tn(u):(u=Qt(n)?Qo:Pt.current,u=ds(e,u));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||f!==u)&&D0(e,s,r,u),Lr=!1,f=e.memoizedState,s.state=f,uc(e,r,s,o);var h=e.memoizedState;a!==d||f!==h||Yt.current||Lr?(typeof p=="function"&&(lh(e,n,p,r),h=e.memoizedState),(l=Lr||R0(e,n,l,r,f,h,u)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,h,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,h,u)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),s.props=r,s.state=h,s.context=u,r=l):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return fh(t,e,n,r,i,o)}function fh(t,e,n,r,o,i){Q_(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return o&&T0(e,n,!1),Er(t,e,i);r=e.stateNode,II.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=ps(e,t.child,null,i),e.child=ps(e,null,a,i)):Lt(t,e,a,i),e.memoizedState=r.state,o&&T0(e,n,!0),e.child}function X_(t){var e=t.stateNode;e.pendingContext?E0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&E0(t,e.context,!1),uy(t,e.containerInfo)}function U0(t,e,n,r,o){return fs(),ry(o),e.flags|=256,Lt(t,e,n,r),e.child}var ph={dehydrated:null,treeContext:null,retryLane:0};function hh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Z_(t,e,n){var r=e.pendingProps,o=We.current,i=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(o&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),Pe(We,o&1),t===null)return sh(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,i?(r=e.mode,i=e.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Pd(s,r,0,null),t=Uo(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=hh(n),e.memoizedState=ph,t):gy(e,s));if(o=t.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return PI(t,e,s,r,a,o,n);if(i){i=r.fallback,s=e.mode,o=t.child,a=o.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&e.child!==o?(r=e.child,r.childLanes=0,r.pendingProps=u,e.deletions=null):(r=oo(o,u),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=oo(a,i):(i=Uo(i,s,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,s=t.child.memoizedState,s=s===null?hh(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=t.childLanes&~n,e.memoizedState=ph,r}return i=t.child,t=i.sibling,r=oo(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function gy(t,e){return e=Pd({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ql(t,e,n,r){return r!==null&&ry(r),ps(e,t.child,null,n),t=gy(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function PI(t,e,n,r,o,i,s){if(n)return e.flags&256?(e.flags&=-257,r=If(Error(W(422))),ql(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,o=e.mode,r=Pd({mode:"visible",children:r.children},o,0,null),i=Uo(i,o,s,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&ps(e,t.child,null,s),e.child.memoizedState=hh(s),e.memoizedState=ph,i);if(!(e.mode&1))return ql(t,e,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(W(419)),r=If(i,r,void 0),ql(t,e,s,r)}if(a=(s&t.childLanes)!==0,Jt||a){if(r=gt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,xr(t,o),Bn(r,t,o,-1))}return ky(),r=If(Error(W(421))),ql(t,e,s,r)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=WI.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,on=eo(o.nextSibling),sn=e,Be=!0,Pn=null,t!==null&&(gn[vn++]=pr,gn[vn++]=hr,gn[vn++]=Xo,pr=t.id,hr=t.overflow,Xo=e),e=gy(e,r.children),e.flags|=4096,e)}function V0(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ah(t.return,e,n)}function Pf(t,e,n,r,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function eS(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(Lt(t,e,r.children,n),r=We.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&V0(t,n,e);else if(t.tag===19)V0(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Pe(We,r),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(n=e.child,o=null;n!==null;)t=n.alternate,t!==null&&cc(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Pf(e,!1,o,n,i);break;case"backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&cc(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Pf(e,!0,n,null,i);break;case"together":Pf(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Mu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Er(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ei|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(W(153));if(e.child!==null){for(t=e.child,n=oo(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=oo(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function RI(t,e,n){switch(e.tag){case 3:X_(e),fs();break;case 5:T_(e);break;case 1:Qt(e.type)&&oc(e);break;case 4:uy(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,o=e.memoizedProps.value;Pe(ac,r._currentValue),r._currentValue=o;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Pe(We,We.current&1),e.flags|=128,null):n&e.child.childLanes?Z_(t,e,n):(Pe(We,We.current&1),t=Er(t,e,n),t!==null?t.sibling:null);Pe(We,We.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return eS(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Pe(We,We.current),r)break;return null;case 22:case 23:return e.lanes=0,Y_(t,e,n)}return Er(t,e,n)}var tS,mh,nS,rS;tS=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};mh=function(){};nS=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,Do(er.current);var i=null;switch(n){case"input":o=Lp(t,o),r=Lp(t,r),i=[];break;case"select":o=Ge({},o,{value:void 0}),r=Ge({},r,{value:void 0}),i=[];break;case"textarea":o=$p(t,o),r=$p(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=nc)}Up(n,r);var s;n=null;for(l in o)if(!r.hasOwnProperty(l)&&o.hasOwnProperty(l)&&o[l]!=null)if(l==="style"){var a=o[l];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Ma.hasOwnProperty(l)?i||(i=[]):(i=i||[]).push(l,null));for(l in r){var u=r[l];if(a=o!=null?o[l]:void 0,r.hasOwnProperty(l)&&u!==a&&(u!=null||a!=null))if(l==="style")if(a){for(s in a)!a.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&a[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(i||(i=[]),i.push(l,n)),n=u;else l==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(i=i||[]).push(l,u)):l==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(l,""+u):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(Ma.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&Re("scroll",t),i||a===u||(i=[])):(i=i||[]).push(l,u))}n&&(i=i||[]).push("style",n);var l=i;(e.updateQueue=l)&&(e.flags|=4)}};rS=function(t,e,n,r){n!==r&&(e.flags|=4)};function Bs(t,e){if(!Be)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Ot(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function DI(t,e,n){var r=e.pendingProps;switch(ny(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(e),null;case 1:return Qt(e.type)&&rc(),Ot(e),null;case 3:return r=e.stateNode,hs(),je(Yt),je(Pt),dy(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Ul(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Pn!==null&&(kh(Pn),Pn=null))),mh(t,e),Ot(e),null;case 5:cy(e);var o=Do($a.current);if(n=e.type,t!==null&&e.stateNode!=null)nS(t,e,n,r,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(W(166));return Ot(e),null}if(t=Do(er.current),Ul(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Jn]=e,r[Ba]=i,t=(e.mode&1)!==0,n){case"dialog":Re("cancel",r),Re("close",r);break;case"iframe":case"object":case"embed":Re("load",r);break;case"video":case"audio":for(o=0;o<Zs.length;o++)Re(Zs[o],r);break;case"source":Re("error",r);break;case"img":case"image":case"link":Re("error",r),Re("load",r);break;case"details":Re("toggle",r);break;case"input":Xg(r,i),Re("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Re("invalid",r);break;case"textarea":e0(r,i),Re("invalid",r)}Up(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&zl(r.textContent,a,t),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&zl(r.textContent,a,t),o=["children",""+a]):Ma.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Re("scroll",r)}switch(n){case"input":Pl(r),Zg(r,i,!0);break;case"textarea":Pl(r),t0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=nc)}r=o,e.updateQueue=r,r!==null&&(e.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ab(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Jn]=e,t[Ba]=r,tS(t,e,!1,!1),e.stateNode=t;e:{switch(s=Vp(n,r),n){case"dialog":Re("cancel",t),Re("close",t),o=r;break;case"iframe":case"object":case"embed":Re("load",t),o=r;break;case"video":case"audio":for(o=0;o<Zs.length;o++)Re(Zs[o],t);o=r;break;case"source":Re("error",t),o=r;break;case"img":case"image":case"link":Re("error",t),Re("load",t),o=r;break;case"details":Re("toggle",t),o=r;break;case"input":Xg(t,r),o=Lp(t,r),Re("invalid",t);break;case"option":o=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},o=Ge({},r,{value:void 0}),Re("invalid",t);break;case"textarea":e0(t,r),o=$p(t,r),Re("invalid",t);break;default:o=r}Up(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var u=a[i];i==="style"?Rb(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&Ib(t,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Oa(t,u):typeof u=="number"&&Oa(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ma.hasOwnProperty(i)?u!=null&&i==="onScroll"&&Re("scroll",t):u!=null&&zm(t,i,u,s))}switch(n){case"input":Pl(t),Zg(t,r,!1);break;case"textarea":Pl(t),t0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+co(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Xi(t,!!r.multiple,i,!1):r.defaultValue!=null&&Xi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=nc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Ot(e),null;case 6:if(t&&e.stateNode!=null)rS(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(W(166));if(n=Do($a.current),Do(er.current),Ul(e)){if(r=e.stateNode,n=e.memoizedProps,r[Jn]=e,(i=r.nodeValue!==n)&&(t=sn,t!==null))switch(t.tag){case 3:zl(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&zl(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Jn]=e,e.stateNode=r}return Ot(e),null;case 13:if(je(We),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Be&&on!==null&&e.mode&1&&!(e.flags&128))__(),fs(),e.flags|=98560,i=!1;else if(i=Ul(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(W(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(W(317));i[Jn]=e}else fs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ot(e),i=!1}else Pn!==null&&(kh(Pn),Pn=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||We.current&1?ft===0&&(ft=3):ky())),e.updateQueue!==null&&(e.flags|=4),Ot(e),null);case 4:return hs(),mh(t,e),t===null&&ja(e.stateNode.containerInfo),Ot(e),null;case 10:return sy(e.type._context),Ot(e),null;case 17:return Qt(e.type)&&rc(),Ot(e),null;case 19:if(je(We),i=e.memoizedState,i===null)return Ot(e),null;if(r=(e.flags&128)!==0,s=i.rendering,s===null)if(r)Bs(i,!1);else{if(ft!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(s=cc(t),s!==null){for(e.flags|=128,Bs(i,!1),r=s.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,t=s.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Pe(We,We.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ze()>ys&&(e.flags|=128,r=!0,Bs(i,!1),e.lanes=4194304)}else{if(!r)if(t=cc(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Bs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Be)return Ot(e),null}else 2*Ze()-i.renderingStartTime>ys&&n!==1073741824&&(e.flags|=128,r=!0,Bs(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ze(),e.sibling=null,n=We.current,Pe(We,r?n&1|2:n&1),e):(Ot(e),null);case 22:case 23:return Sy(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?nn&1073741824&&(Ot(e),e.subtreeFlags&6&&(e.flags|=8192)):Ot(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function jI(t,e){switch(ny(e),e.tag){case 1:return Qt(e.type)&&rc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return hs(),je(Yt),je(Pt),dy(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return cy(e),null;case 13:if(je(We),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));fs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return je(We),null;case 4:return hs(),null;case 10:return sy(e.type._context),null;case 22:case 23:return Sy(),null;case 24:return null;default:return null}}var Hl=!1,At=!1,LI=typeof WeakSet=="function"?WeakSet:Set,Q=null;function Fi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(t,e,r)}else n.current=null}function yh(t,e,n){try{n()}catch(r){Qe(t,e,r)}}var q0=!1;function BI(t,e){if(Zp=Zu,t=l_(),ey(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,l=0,c=0,d=t,f=null;t:for(;;){for(var p;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(u=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++l===o&&(a=s),f===i&&++c===r&&(u=s),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(eh={focusedElem:t,selectionRange:n},Zu=!1,Q=e;Q!==null;)if(e=Q,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Q=t;else for(;Q!==null;){e=Q;try{var h=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var m=h.memoizedProps,v=h.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?m:Nn(e.type,m),v);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(S){Qe(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Q=t;break}Q=e.return}return h=q0,q0=!1,h}function fa(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&yh(e,n,i)}o=o.next}while(o!==r)}}function Ad(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function gh(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function oS(t){var e=t.alternate;e!==null&&(t.alternate=null,oS(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Jn],delete e[Ba],delete e[rh],delete e[bI],delete e[_I])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function iS(t){return t.tag===5||t.tag===3||t.tag===4}function H0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||iS(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function vh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=nc));else if(r!==4&&(t=t.child,t!==null))for(vh(t,e,n),t=t.sibling;t!==null;)vh(t,e,n),t=t.sibling}function wh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(wh(t,e,n),t=t.sibling;t!==null;)wh(t,e,n),t=t.sibling}var St=null,In=!1;function Ir(t,e,n){for(n=n.child;n!==null;)sS(t,e,n),n=n.sibling}function sS(t,e,n){if(Zn&&typeof Zn.onCommitFiberUnmount=="function")try{Zn.onCommitFiberUnmount(kd,n)}catch{}switch(n.tag){case 5:At||Fi(n,e);case 6:var r=St,o=In;St=null,Ir(t,e,n),St=r,In=o,St!==null&&(In?(t=St,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):St.removeChild(n.stateNode));break;case 18:St!==null&&(In?(t=St,n=n.stateNode,t.nodeType===8?Tf(t.parentNode,n):t.nodeType===1&&Tf(t,n),Pa(t)):Tf(St,n.stateNode));break;case 4:r=St,o=In,St=n.stateNode.containerInfo,In=!0,Ir(t,e,n),St=r,In=o;break;case 0:case 11:case 14:case 15:if(!At&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&yh(n,e,s),o=o.next}while(o!==r)}Ir(t,e,n);break;case 1:if(!At&&(Fi(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,e,a)}Ir(t,e,n);break;case 21:Ir(t,e,n);break;case 22:n.mode&1?(At=(r=At)||n.memoizedState!==null,Ir(t,e,n),At=r):Ir(t,e,n);break;default:Ir(t,e,n)}}function W0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new LI),e.forEach(function(r){var o=KI.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function On(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=t,s=e,a=s;e:for(;a!==null;){switch(a.tag){case 5:St=a.stateNode,In=!1;break e;case 3:St=a.stateNode.containerInfo,In=!0;break e;case 4:St=a.stateNode.containerInfo,In=!0;break e}a=a.return}if(St===null)throw Error(W(160));sS(i,s,o),St=null,In=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Qe(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)aS(e,t),e=e.sibling}function aS(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(On(e,t),Vn(t),r&4){try{fa(3,t,t.return),Ad(3,t)}catch(m){Qe(t,t.return,m)}try{fa(5,t,t.return)}catch(m){Qe(t,t.return,m)}}break;case 1:On(e,t),Vn(t),r&512&&n!==null&&Fi(n,n.return);break;case 5:if(On(e,t),Vn(t),r&512&&n!==null&&Fi(n,n.return),t.flags&32){var o=t.stateNode;try{Oa(o,"")}catch(m){Qe(t,t.return,m)}}if(r&4&&(o=t.stateNode,o!=null)){var i=t.memoizedProps,s=n!==null?n.memoizedProps:i,a=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Ob(o,i),Vp(a,s);var l=Vp(a,i);for(s=0;s<u.length;s+=2){var c=u[s],d=u[s+1];c==="style"?Rb(o,d):c==="dangerouslySetInnerHTML"?Ib(o,d):c==="children"?Oa(o,d):zm(o,c,d,l)}switch(a){case"input":Bp(o,i);break;case"textarea":Nb(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Xi(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?Xi(o,!!i.multiple,i.defaultValue,!0):Xi(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ba]=i}catch(m){Qe(t,t.return,m)}}break;case 6:if(On(e,t),Vn(t),r&4){if(t.stateNode===null)throw Error(W(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(m){Qe(t,t.return,m)}}break;case 3:if(On(e,t),Vn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pa(e.containerInfo)}catch(m){Qe(t,t.return,m)}break;case 4:On(e,t),Vn(t);break;case 13:On(e,t),Vn(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(by=Ze())),r&4&&W0(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(At=(l=At)||c,On(e,t),At=l):On(e,t),Vn(t),r&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(Q=t,c=t.child;c!==null;){for(d=Q=c;Q!==null;){switch(f=Q,p=f.child,f.tag){case 0:case 11:case 14:case 15:fa(4,f,f.return);break;case 1:Fi(f,f.return);var h=f.stateNode;if(typeof h.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,h.props=e.memoizedProps,h.state=e.memoizedState,h.componentWillUnmount()}catch(m){Qe(r,n,m)}}break;case 5:Fi(f,f.return);break;case 22:if(f.memoizedState!==null){G0(d);continue}}p!==null?(p.return=f,Q=p):G0(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{o=d.stateNode,l?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=d.stateNode,u=d.memoizedProps.style,s=u!=null&&u.hasOwnProperty("display")?u.display:null,a.style.display=Pb("display",s))}catch(m){Qe(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(m){Qe(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:On(e,t),Vn(t),r&4&&W0(t);break;case 21:break;default:On(e,t),Vn(t)}}function Vn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(iS(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Oa(o,""),r.flags&=-33);var i=H0(t);wh(t,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=H0(t);vh(t,a,s);break;default:throw Error(W(161))}}catch(u){Qe(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function FI(t,e,n){Q=t,lS(t)}function lS(t,e,n){for(var r=(t.mode&1)!==0;Q!==null;){var o=Q,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Hl;if(!s){var a=o.alternate,u=a!==null&&a.memoizedState!==null||At;a=Hl;var l=At;if(Hl=s,(At=u)&&!l)for(Q=o;Q!==null;)s=Q,u=s.child,s.tag===22&&s.memoizedState!==null?J0(o):u!==null?(u.return=s,Q=u):J0(o);for(;i!==null;)Q=i,lS(i),i=i.sibling;Q=o,Hl=a,At=l}K0(t)}else o.subtreeFlags&8772&&i!==null?(i.return=o,Q=i):K0(t)}}function K0(t){for(;Q!==null;){var e=Q;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:At||Ad(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!At)if(n===null)r.componentDidMount();else{var o=e.elementType===e.type?n.memoizedProps:Nn(e.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&A0(e,i,r);break;case 3:var s=e.updateQueue;if(s!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}A0(e,s,n)}break;case 5:var a=e.stateNode;if(n===null&&e.flags&4){n=a;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Pa(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}At||e.flags&512&&gh(e)}catch(f){Qe(e,e.return,f)}}if(e===t){Q=null;break}if(n=e.sibling,n!==null){n.return=e.return,Q=n;break}Q=e.return}}function G0(t){for(;Q!==null;){var e=Q;if(e===t){Q=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Q=n;break}Q=e.return}}function J0(t){for(;Q!==null;){var e=Q;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Ad(4,e)}catch(u){Qe(e,n,u)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var o=e.return;try{r.componentDidMount()}catch(u){Qe(e,o,u)}}var i=e.return;try{gh(e)}catch(u){Qe(e,i,u)}break;case 5:var s=e.return;try{gh(e)}catch(u){Qe(e,s,u)}}}catch(u){Qe(e,e.return,u)}if(e===t){Q=null;break}var a=e.sibling;if(a!==null){a.return=e.return,Q=a;break}Q=e.return}}var $I=Math.ceil,pc=Mr.ReactCurrentDispatcher,vy=Mr.ReactCurrentOwner,_n=Mr.ReactCurrentBatchConfig,xe=0,gt=null,rt=null,Tt=0,nn=0,$i=yo(0),ft=0,qa=null,ei=0,Id=0,wy=0,pa=null,Wt=null,by=0,ys=1/0,ur=null,hc=!1,bh=null,no=null,Wl=!1,Kr=null,mc=0,ha=0,_h=null,Ou=-1,Nu=0;function $t(){return xe&6?Ze():Ou!==-1?Ou:Ou=Ze()}function ro(t){return t.mode&1?xe&2&&Tt!==0?Tt&-Tt:kI.transition!==null?(Nu===0&&(Nu=Wb()),Nu):(t=Oe,t!==0||(t=window.event,t=t===void 0?16:Zb(t.type)),t):1}function Bn(t,e,n,r){if(50<ha)throw ha=0,_h=null,Error(W(185));bl(t,n,r),(!(xe&2)||t!==gt)&&(t===gt&&(!(xe&2)&&(Id|=n),ft===4&&Ur(t,Tt)),Xt(t,r),n===1&&xe===0&&!(e.mode&1)&&(ys=Ze()+500,Md&&go()))}function Xt(t,e){var n=t.callbackNode;kA(t,e);var r=Xu(t,t===gt?Tt:0);if(r===0)n!==null&&o0(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&o0(n),e===1)t.tag===0?SI(Y0.bind(null,t)):v_(Y0.bind(null,t)),vI(function(){!(xe&6)&&go()}),n=null;else{switch(Kb(r)){case 1:n=Wm;break;case 4:n=qb;break;case 16:n=Qu;break;case 536870912:n=Hb;break;default:n=Qu}n=yS(n,uS.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function uS(t,e){if(Ou=-1,Nu=0,xe&6)throw Error(W(327));var n=t.callbackNode;if(rs()&&t.callbackNode!==n)return null;var r=Xu(t,t===gt?Tt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=yc(t,r);else{e=r;var o=xe;xe|=2;var i=dS();(gt!==t||Tt!==e)&&(ur=null,ys=Ze()+500,zo(t,e));do try{VI();break}catch(a){cS(t,a)}while(!0);iy(),pc.current=i,xe=o,rt!==null?e=0:(gt=null,Tt=0,e=ft)}if(e!==0){if(e===2&&(o=Gp(t),o!==0&&(r=o,e=Sh(t,o))),e===1)throw n=qa,zo(t,0),Ur(t,r),Xt(t,Ze()),n;if(e===6)Ur(t,r);else{if(o=t.current.alternate,!(r&30)&&!zI(o)&&(e=yc(t,r),e===2&&(i=Gp(t),i!==0&&(r=i,e=Sh(t,i))),e===1))throw n=qa,zo(t,0),Ur(t,r),Xt(t,Ze()),n;switch(t.finishedWork=o,t.finishedLanes=r,e){case 0:case 1:throw Error(W(345));case 2:Co(t,Wt,ur);break;case 3:if(Ur(t,r),(r&130023424)===r&&(e=by+500-Ze(),10<e)){if(Xu(t,0)!==0)break;if(o=t.suspendedLanes,(o&r)!==r){$t(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=nh(Co.bind(null,t,Wt,ur),e);break}Co(t,Wt,ur);break;case 4:if(Ur(t,r),(r&4194240)===r)break;for(e=t.eventTimes,o=-1;0<r;){var s=31-Ln(r);i=1<<s,s=e[s],s>o&&(o=s),r&=~i}if(r=o,r=Ze()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*$I(r/1960))-r,10<r){t.timeoutHandle=nh(Co.bind(null,t,Wt,ur),r);break}Co(t,Wt,ur);break;case 5:Co(t,Wt,ur);break;default:throw Error(W(329))}}}return Xt(t,Ze()),t.callbackNode===n?uS.bind(null,t):null}function Sh(t,e){var n=pa;return t.current.memoizedState.isDehydrated&&(zo(t,e).flags|=256),t=yc(t,e),t!==2&&(e=Wt,Wt=n,e!==null&&kh(e)),t}function kh(t){Wt===null?Wt=t:Wt.push.apply(Wt,t)}function zI(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Fn(i(),o))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Ur(t,e){for(e&=~wy,e&=~Id,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Ln(e),r=1<<n;t[n]=-1,e&=~r}}function Y0(t){if(xe&6)throw Error(W(327));rs();var e=Xu(t,0);if(!(e&1))return Xt(t,Ze()),null;var n=yc(t,e);if(t.tag!==0&&n===2){var r=Gp(t);r!==0&&(e=r,n=Sh(t,r))}if(n===1)throw n=qa,zo(t,0),Ur(t,e),Xt(t,Ze()),n;if(n===6)throw Error(W(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Co(t,Wt,ur),Xt(t,Ze()),null}function _y(t,e){var n=xe;xe|=1;try{return t(e)}finally{xe=n,xe===0&&(ys=Ze()+500,Md&&go())}}function ti(t){Kr!==null&&Kr.tag===0&&!(xe&6)&&rs();var e=xe;xe|=1;var n=_n.transition,r=Oe;try{if(_n.transition=null,Oe=1,t)return t()}finally{Oe=r,_n.transition=n,xe=e,!(xe&6)&&go()}}function Sy(){nn=$i.current,je($i)}function zo(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,gI(n)),rt!==null)for(n=rt.return;n!==null;){var r=n;switch(ny(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&rc();break;case 3:hs(),je(Yt),je(Pt),dy();break;case 5:cy(r);break;case 4:hs();break;case 13:je(We);break;case 19:je(We);break;case 10:sy(r.type._context);break;case 22:case 23:Sy()}n=n.return}if(gt=t,rt=t=oo(t.current,null),Tt=nn=e,ft=0,qa=null,wy=Id=ei=0,Wt=pa=null,Ro!==null){for(e=0;e<Ro.length;e++)if(n=Ro[e],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}Ro=null}return t}function cS(t,e){do{var n=rt;try{if(iy(),Tu.current=fc,dc){for(var r=Ke.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}dc=!1}if(Zo=0,ht=dt=Ke=null,da=!1,za=0,vy.current=null,n===null||n.return===null){ft=1,qa=e,rt=null;break}e:{var i=t,s=n.return,a=n,u=e;if(e=Tt,a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var l=u,c=a,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=L0(s);if(p!==null){p.flags&=-257,B0(p,s,a,i,e),p.mode&1&&j0(i,l,e),e=p,u=l;var h=e.updateQueue;if(h===null){var m=new Set;m.add(u),e.updateQueue=m}else h.add(u);break e}else{if(!(e&1)){j0(i,l,e),ky();break e}u=Error(W(426))}}else if(Be&&a.mode&1){var v=L0(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),B0(v,s,a,i,e),ry(ms(u,a));break e}}i=u=ms(u,a),ft!==4&&(ft=2),pa===null?pa=[i]:pa.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=K_(i,u,e);N0(i,y);break e;case 1:a=u;var w=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(no===null||!no.has(b)))){i.flags|=65536,e&=-e,i.lanes|=e;var S=G_(i,a,e);N0(i,S);break e}}i=i.return}while(i!==null)}pS(n)}catch(k){e=k,rt===n&&n!==null&&(rt=n=n.return);continue}break}while(!0)}function dS(){var t=pc.current;return pc.current=fc,t===null?fc:t}function ky(){(ft===0||ft===3||ft===2)&&(ft=4),gt===null||!(ei&268435455)&&!(Id&268435455)||Ur(gt,Tt)}function yc(t,e){var n=xe;xe|=2;var r=dS();(gt!==t||Tt!==e)&&(ur=null,zo(t,e));do try{UI();break}catch(o){cS(t,o)}while(!0);if(iy(),xe=n,pc.current=r,rt!==null)throw Error(W(261));return gt=null,Tt=0,ft}function UI(){for(;rt!==null;)fS(rt)}function VI(){for(;rt!==null&&!hA();)fS(rt)}function fS(t){var e=mS(t.alternate,t,nn);t.memoizedProps=t.pendingProps,e===null?pS(t):rt=e,vy.current=null}function pS(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=jI(n,e),n!==null){n.flags&=32767,rt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ft=6,rt=null;return}}else if(n=DI(n,e,nn),n!==null){rt=n;return}if(e=e.sibling,e!==null){rt=e;return}rt=e=t}while(e!==null);ft===0&&(ft=5)}function Co(t,e,n){var r=Oe,o=_n.transition;try{_n.transition=null,Oe=1,qI(t,e,n,r)}finally{_n.transition=o,Oe=r}return null}function qI(t,e,n,r){do rs();while(Kr!==null);if(xe&6)throw Error(W(327));n=t.finishedWork;var o=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(W(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(xA(t,i),t===gt&&(rt=gt=null,Tt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Wl||(Wl=!0,yS(Qu,function(){return rs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=_n.transition,_n.transition=null;var s=Oe;Oe=1;var a=xe;xe|=4,vy.current=null,BI(t,n),aS(n,t),cI(eh),Zu=!!Zp,eh=Zp=null,t.current=n,FI(n),mA(),xe=a,Oe=s,_n.transition=i}else t.current=n;if(Wl&&(Wl=!1,Kr=t,mc=o),i=t.pendingLanes,i===0&&(no=null),vA(n.stateNode),Xt(t,Ze()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)o=e[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(hc)throw hc=!1,t=bh,bh=null,t;return mc&1&&t.tag!==0&&rs(),i=t.pendingLanes,i&1?t===_h?ha++:(ha=0,_h=t):ha=0,go(),null}function rs(){if(Kr!==null){var t=Kb(mc),e=_n.transition,n=Oe;try{if(_n.transition=null,Oe=16>t?16:t,Kr===null)var r=!1;else{if(t=Kr,Kr=null,mc=0,xe&6)throw Error(W(331));var o=xe;for(xe|=4,Q=t.current;Q!==null;){var i=Q,s=i.child;if(Q.flags&16){var a=i.deletions;if(a!==null){for(var u=0;u<a.length;u++){var l=a[u];for(Q=l;Q!==null;){var c=Q;switch(c.tag){case 0:case 11:case 15:fa(8,c,i)}var d=c.child;if(d!==null)d.return=c,Q=d;else for(;Q!==null;){c=Q;var f=c.sibling,p=c.return;if(oS(c),c===l){Q=null;break}if(f!==null){f.return=p,Q=f;break}Q=p}}}var h=i.alternate;if(h!==null){var m=h.child;if(m!==null){h.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(m!==null)}}Q=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Q=s;else e:for(;Q!==null;){if(i=Q,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fa(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,Q=y;break e}Q=i.return}}var w=t.current;for(Q=w;Q!==null;){s=Q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Q=b;else e:for(s=w;Q!==null;){if(a=Q,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Ad(9,a)}}catch(k){Qe(a,a.return,k)}if(a===s){Q=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,Q=S;break e}Q=a.return}}if(xe=o,go(),Zn&&typeof Zn.onPostCommitFiberRoot=="function")try{Zn.onPostCommitFiberRoot(kd,t)}catch{}r=!0}return r}finally{Oe=n,_n.transition=e}}return!1}function Q0(t,e,n){e=ms(n,e),e=K_(t,e,1),t=to(t,e,1),e=$t(),t!==null&&(bl(t,1,e),Xt(t,e))}function Qe(t,e,n){if(t.tag===3)Q0(t,t,n);else for(;e!==null;){if(e.tag===3){Q0(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(no===null||!no.has(r))){t=ms(n,t),t=G_(e,t,1),e=to(e,t,1),t=$t(),e!==null&&(bl(e,1,t),Xt(e,t));break}}e=e.return}}function HI(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=$t(),t.pingedLanes|=t.suspendedLanes&n,gt===t&&(Tt&n)===n&&(ft===4||ft===3&&(Tt&130023424)===Tt&&500>Ze()-by?zo(t,0):wy|=n),Xt(t,e)}function hS(t,e){e===0&&(t.mode&1?(e=jl,jl<<=1,!(jl&130023424)&&(jl=4194304)):e=1);var n=$t();t=xr(t,e),t!==null&&(bl(t,e,n),Xt(t,n))}function WI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),hS(t,n)}function KI(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(e),hS(t,n)}var mS;mS=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Yt.current)Jt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Jt=!1,RI(t,e,n);Jt=!!(t.flags&131072)}else Jt=!1,Be&&e.flags&1048576&&w_(e,sc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Mu(t,e),t=e.pendingProps;var o=ds(e,Pt.current);ns(e,n),o=py(null,e,r,t,o,n);var i=hy();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Qt(r)?(i=!0,oc(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ly(e),o.updater=Nd,e.stateNode=o,o._reactInternals=e,uh(e,r,t,n),e=fh(null,e,r,!0,i,n)):(e.tag=0,Be&&i&&ty(e),Lt(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Mu(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=JI(r),t=Nn(r,t),o){case 0:e=dh(null,e,r,t,n);break e;case 1:e=z0(null,e,r,t,n);break e;case 11:e=F0(null,e,r,t,n);break e;case 14:e=$0(null,e,r,Nn(r.type,t),n);break e}throw Error(W(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),dh(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),z0(t,e,r,o,n);case 3:e:{if(X_(e),t===null)throw Error(W(387));r=e.pendingProps,i=e.memoizedState,o=i.element,E_(t,e),uc(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=ms(Error(W(423)),e),e=U0(t,e,r,n,o);break e}else if(r!==o){o=ms(Error(W(424)),e),e=U0(t,e,r,n,o);break e}else for(on=eo(e.stateNode.containerInfo.firstChild),sn=e,Be=!0,Pn=null,n=k_(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fs(),r===o){e=Er(t,e,n);break e}Lt(t,e,r,n)}e=e.child}return e;case 5:return T_(e),t===null&&sh(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,th(r,o)?s=null:i!==null&&th(r,i)&&(e.flags|=32),Q_(t,e),Lt(t,e,s,n),e.child;case 6:return t===null&&sh(e),null;case 13:return Z_(t,e,n);case 4:return uy(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ps(e,null,r,n):Lt(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),F0(t,e,r,o,n);case 7:return Lt(t,e,e.pendingProps,n),e.child;case 8:return Lt(t,e,e.pendingProps.children,n),e.child;case 12:return Lt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Pe(ac,r._currentValue),r._currentValue=s,i!==null)if(Fn(i.value,s)){if(i.children===o.children&&!Yt.current){e=Er(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=gr(-1,n&-n),u.tag=2;var l=i.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?u.next=u:(u.next=c.next,c.next=u),l.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ah(i.return,n,e),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(W(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ah(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Lt(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,ns(e,n),o=Tn(o),r=r(o),e.flags|=1,Lt(t,e,r,n),e.child;case 14:return r=e.type,o=Nn(r,e.pendingProps),o=Nn(r.type,o),$0(t,e,r,o,n);case 15:return J_(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Nn(r,o),Mu(t,e),e.tag=1,Qt(r)?(t=!0,oc(e)):t=!1,ns(e,n),W_(e,r,o),uh(e,r,o,n),fh(null,e,r,!0,t,n);case 19:return eS(t,e,n);case 22:return Y_(t,e,n)}throw Error(W(156,e.tag))};function yS(t,e){return Vb(t,e)}function GI(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(t,e,n,r){return new GI(t,e,n,r)}function xy(t){return t=t.prototype,!(!t||!t.isReactComponent)}function JI(t){if(typeof t=="function")return xy(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Vm)return 11;if(t===qm)return 14}return 2}function oo(t,e){var n=t.alternate;return n===null?(n=bn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Au(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")xy(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Ni:return Uo(n.children,o,i,e);case Um:s=8,o|=8;break;case Pp:return t=bn(12,n,e,o|2),t.elementType=Pp,t.lanes=i,t;case Rp:return t=bn(13,n,e,o),t.elementType=Rp,t.lanes=i,t;case Dp:return t=bn(19,n,e,o),t.elementType=Dp,t.lanes=i,t;case Tb:return Pd(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case xb:s=10;break e;case Eb:s=9;break e;case Vm:s=11;break e;case qm:s=14;break e;case jr:s=16,r=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=bn(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Uo(t,e,n,r){return t=bn(7,t,r,e),t.lanes=n,t}function Pd(t,e,n,r){return t=bn(22,t,r,e),t.elementType=Tb,t.lanes=n,t.stateNode={isHidden:!1},t}function Rf(t,e,n){return t=bn(6,t,null,e),t.lanes=n,t}function Df(t,e,n){return e=bn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function YI(t,e,n,r,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mf(0),this.expirationTimes=mf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mf(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Ey(t,e,n,r,o,i,s,a,u){return t=new YI(t,e,n,a,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=bn(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ly(i),t}function QI(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Oi,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function gS(t){if(!t)return fo;t=t._reactInternals;e:{if(mi(t)!==t||t.tag!==1)throw Error(W(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Qt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(W(171))}if(t.tag===1){var n=t.type;if(Qt(n))return g_(t,n,e)}return e}function vS(t,e,n,r,o,i,s,a,u){return t=Ey(n,r,!0,t,o,i,s,a,u),t.context=gS(null),n=t.current,r=$t(),o=ro(n),i=gr(r,o),i.callback=e??null,to(n,i,o),t.current.lanes=o,bl(t,o,r),Xt(t,r),t}function Rd(t,e,n,r){var o=e.current,i=$t(),s=ro(o);return n=gS(n),e.context===null?e.context=n:e.pendingContext=n,e=gr(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=to(o,e,s),t!==null&&(Bn(t,o,s,i),Eu(t,o,s)),s}function gc(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function X0(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Ty(t,e){X0(t,e),(t=t.alternate)&&X0(t,e)}function XI(){return null}var wS=typeof reportError=="function"?reportError:function(t){console.error(t)};function Cy(t){this._internalRoot=t}Dd.prototype.render=Cy.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(W(409));Rd(t,e,null,null)};Dd.prototype.unmount=Cy.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ti(function(){Rd(null,t,null,null)}),e[kr]=null}};function Dd(t){this._internalRoot=t}Dd.prototype.unstable_scheduleHydration=function(t){if(t){var e=Yb();t={blockedOn:null,target:t,priority:e};for(var n=0;n<zr.length&&e!==0&&e<zr[n].priority;n++);zr.splice(n,0,t),n===0&&Xb(t)}};function My(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function jd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Z0(){}function ZI(t,e,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var l=gc(s);i.call(l)}}var s=vS(e,r,t,0,null,!1,!1,"",Z0);return t._reactRootContainer=s,t[kr]=s.current,ja(t.nodeType===8?t.parentNode:t),ti(),s}for(;o=t.lastChild;)t.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var l=gc(u);a.call(l)}}var u=Ey(t,0,!1,null,null,!1,!1,"",Z0);return t._reactRootContainer=u,t[kr]=u.current,ja(t.nodeType===8?t.parentNode:t),ti(function(){Rd(e,u,n,r)}),u}function Ld(t,e,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var u=gc(s);a.call(u)}}Rd(e,s,t,o)}else s=ZI(n,e,t,o,r);return gc(s)}Gb=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Xs(e.pendingLanes);n!==0&&(Km(e,n|1),Xt(e,Ze()),!(xe&6)&&(ys=Ze()+500,go()))}break;case 13:ti(function(){var r=xr(t,1);if(r!==null){var o=$t();Bn(r,t,1,o)}}),Ty(t,1)}};Gm=function(t){if(t.tag===13){var e=xr(t,134217728);if(e!==null){var n=$t();Bn(e,t,134217728,n)}Ty(t,134217728)}};Jb=function(t){if(t.tag===13){var e=ro(t),n=xr(t,e);if(n!==null){var r=$t();Bn(n,t,e,r)}Ty(t,e)}};Yb=function(){return Oe};Qb=function(t,e){var n=Oe;try{return Oe=t,e()}finally{Oe=n}};Hp=function(t,e,n){switch(e){case"input":if(Bp(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var o=Cd(r);if(!o)throw Error(W(90));Mb(r),Bp(r,o)}}}break;case"textarea":Nb(t,n);break;case"select":e=n.value,e!=null&&Xi(t,!!n.multiple,e,!1)}};Lb=_y;Bb=ti;var e2={usingClientEntryPoint:!1,Events:[Sl,Ri,Cd,Db,jb,_y]},Fs={findFiberByHostInstance:Po,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},t2={bundleType:Fs.bundleType,version:Fs.version,rendererPackageName:Fs.rendererPackageName,rendererConfig:Fs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Mr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=zb(t),t===null?null:t.stateNode},findFiberByHostInstance:Fs.findFiberByHostInstance||XI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kl.isDisabled&&Kl.supportsFiber)try{kd=Kl.inject(t2),Zn=Kl}catch{}}un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=e2;un.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!My(e))throw Error(W(200));return QI(t,e,null,n)};un.createRoot=function(t,e){if(!My(t))throw Error(W(299));var n=!1,r="",o=wS;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=Ey(t,1,!1,null,null,n,!1,r,o),t[kr]=e.current,ja(t.nodeType===8?t.parentNode:t),new Cy(e)};un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(W(188)):(t=Object.keys(t).join(","),Error(W(268,t)));return t=zb(e),t=t===null?null:t.stateNode,t};un.flushSync=function(t){return ti(t)};un.hydrate=function(t,e,n){if(!jd(e))throw Error(W(200));return Ld(null,t,e,!0,n)};un.hydrateRoot=function(t,e,n){if(!My(t))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=wS;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),e=vS(e,null,t,1,n??null,o,!1,i,s),t[kr]=e.current,ja(t),r)for(t=0;t<r.length;t++)n=r[t],o=n._getVersion,o=o(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,o]:e.mutableSourceEagerHydrationData.push(n,o);return new Dd(e)};un.render=function(t,e,n){if(!jd(e))throw Error(W(200));return Ld(null,t,e,!1,n)};un.unmountComponentAtNode=function(t){if(!jd(t))throw Error(W(40));return t._reactRootContainer?(ti(function(){Ld(null,null,t,!1,function(){t._reactRootContainer=null,t[kr]=null})}),!0):!1};un.unstable_batchedUpdates=_y;un.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!jd(n))throw Error(W(200));if(t==null||t._reactInternals===void 0)throw Error(W(38));return Ld(t,e,n,!1,r)};un.version="18.3.1-next-f1338f8080-20240426";function bS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bS)}catch(t){console.error(t)}}bS(),bb.exports=un;var Oy=bb.exports;const n2=di(Oy);var _S,ev=Oy;_S=ev.createRoot,ev.hydrateRoot;const r2=document.getElementById("root"),o2=_S(r2);function jf(t){o2.render(g.jsx(_.StrictMode,{children:t}))}var SS={exports:{}};/*!
|
|
47
47
|
Copyright (c) 2018 Jed Watson.
|
|
48
48
|
Licensed under the MIT License (MIT), see
|
|
49
49
|
http://jedwatson.github.io/classnames
|
|
@@ -53,7 +53,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
53
53
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j3(t,e){return F3(t)||B3(t,e)||KS(t,e)||L3()}function L3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
54
54
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KS(t,e){if(t){if(typeof t=="string")return Dv(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dv(t,e):void 0}}function Dv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function B3(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,o,i,s,a=[],u=!0,l=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(u=(r=i.call(n)).done)&&(a.push(r.value),a.length!==e);u=!0);}catch(c){l=!0,o=c}finally{try{if(!u&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw o}}return a}}function F3(t){if(Array.isArray(t))return t}function $3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z3(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,V3(r.key),r)}}function U3(t,e,n){return e&&z3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function V3(t){var e=q3(t,"string");return oi(e)=="symbol"?e:e+""}function q3(t,e){if(oi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(oi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Sn=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.polyfill;$3(this,t),typeof e=="string"&&(e=[e]),this.locale=jL(e.concat(t.getDefaultLocale()),zi),typeof Intl<"u"&&Intl.NumberFormat&&(this.numberFormat=new Intl.NumberFormat(this.locale)),r===!1?(this.IntlRelativeTimeFormat=Intl.RelativeTimeFormat,this.IntlPluralRules=Intl.PluralRules):(this.IntlRelativeTimeFormat=Tr,this.IntlPluralRules=Tr.PluralRules),this.relativeTimeFormatCache=new mv,this.pluralRulesCache=new mv}return U3(t,[{key:"format",value:function(n,r,o){o||(r&&!J3(r)?(o=r,r=void 0):o={}),r||(r=zh),typeof r=="string"&&(r=R3(r));var i=H3(n),s=this.getLabels(r.flavour||r.labels),a=s.labels,u=s.labelsType,l;r.now!==void 0&&(l=r.now),l===void 0&&o.now!==void 0&&(l=o.now),l===void 0&&(l=Date.now());var c=(l-i)/1e3,d=o.future||c<0,f=G3(a,zi(this.locale).now,zi(this.locale).long,d);if(r.custom){var p=r.custom({now:l,date:new Date(i),time:i,elapsed:c,locale:this.locale});if(p!==void 0)return p}var h=K3(r.units,a,f),m=o.round||r.round,v=HL(r.gradation||r.steps||zh.steps,c,{now:l,units:h,round:m,future:d}),y=j3(v,3),w=y[0],b=y[1],S=y[2],k=this.formatDateForStep(i,b,c,{labels:a,labelsType:u,nowLabel:f,now:l,future:d,round:m})||"";if(o.getTimeToNextUpdate){var E=XL(i,b,{nextStep:S,prevStep:w,now:l,future:d,round:m});return[k,E]}return k}},{key:"formatDateForStep",value:function(n,r,o,i){var s=this,a=i.labels,u=i.labelsType,l=i.nowLabel,c=i.now,d=i.future,f=i.round;if(r){if(r.format)return r.format(n,this.locale,{formatAs:function(y,w){return s.formatValue(w,y,{labels:a,future:d})},now:c,future:d});var p=r.unit||r.formatAs;if(!p)throw new Error("[javascript-time-ago] Each step must define either `formatAs` or `format()`. Step: ".concat(JSON.stringify(r)));if(p==="now")return l;var h=Math.abs(o)/FS(r);r.granularity&&(h=Wa(f)(h/r.granularity)*r.granularity);var m=-1*Math.sign(o)*Wa(f)(h);switch(m===0&&(d?m=0:m=-0),u){case"long":case"short":case"narrow":return this.getFormatter(u).format(m,p);default:return this.formatValue(m,p,{labels:a,future:d})}}}},{key:"formatValue",value:function(n,r,o){var i=o.labels,s=o.future;return this.getFormattingRule(i,r,n,{future:s}).replace("{0}",this.formatNumber(Math.abs(n)))}},{key:"getFormattingRule",value:function(n,r,o,i){var s=i.future;if(this.locale,n=n[r],typeof n=="string")return n;var a=o===0?s?"future":"past":o<0?"past":"future",u=n[a]||n;if(typeof u=="string")return u;var l=this.getPluralRules().select(Math.abs(o));return u[l]||u.other}},{key:"formatNumber",value:function(n){return this.numberFormat?this.numberFormat.format(n):String(n)}},{key:"getFormatter",value:function(n){return this.relativeTimeFormatCache.get(this.locale,n)||this.relativeTimeFormatCache.put(this.locale,n,new this.IntlRelativeTimeFormat(this.locale,{style:n}))}},{key:"getPluralRules",value:function(){return this.pluralRulesCache.get(this.locale)||this.pluralRulesCache.put(this.locale,new this.IntlPluralRules(this.locale))}},{key:"getLabels",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];typeof n=="string"&&(n=[n]),n=n.map(function(a){switch(a){case"tiny":case"mini-time":return"mini";default:return a}}),n=n.concat("long");for(var r=zi(this.locale),o=D3(n),i;!(i=o()).done;){var s=i.value;if(r[s])return{labelsType:s,labels:r[s]}}}}]),t}(),GS="en";Sn.getDefaultLocale=function(){return GS};Sn.setDefaultLocale=function(t){return GS=t};Sn.addDefaultLocale=function(t){if(jv)return console.error("[javascript-time-ago] `TimeAgo.addDefaultLocale()` can only be called once. To add other locales, use `TimeAgo.addLocale()`.");jv=!0,Sn.setDefaultLocale(t.locale),Sn.addLocale(t)};var jv;Sn.addLocale=function(t){qS(t),Tr.addLocale(t)};Sn.locale=Sn.addLocale;Sn.addLabels=function(t,e,n){var r=zi(t);r||(qS({locale:t}),r=zi(t)),r[e]=n};function H3(t){if(t.constructor===Date||W3(t))return t.getTime();if(typeof t=="number")return t;throw new Error("Unsupported relative time formatter input: ".concat(oi(t),", ").concat(t))}function W3(t){return oi(t)==="object"&&typeof t.getTime=="function"}function K3(t,e,n){var r=Object.keys(e);return n&&r.push("now"),t&&(r=t.filter(function(o){return o==="now"||r.indexOf(o)>=0})),r}function G3(t,e,n,r){var o=t.now||e&&e.now;if(o)return typeof o=="string"?o:r?o.future:o.past;if(n&&n.second&&n.second.current)return n.second.current}function J3(t){return typeof t=="string"||BL(t)}function Hh(t){"@babel/helpers - typeof";return Hh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hh(t)}function Y3(t){if(JS())return Intl.DateTimeFormat.supportedLocalesOf(t)[0]}function JS(){var t=(typeof Intl>"u"?"undefined":Hh(Intl))==="object";return t&&typeof Intl.DateTimeFormat=="function"}function Sc(t){"@babel/helpers - typeof";return Sc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sc(t)}function Q3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function X3(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Z3(t,e,n){return e&&X3(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var YS=function(){function t(){Q3(this,t),this.cache={}}return Z3(t,[{key:"get",value:function(){for(var n=this.cache,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];for(var s=0,a=o;s<a.length;s++){var u=a[s];if(Sc(n)!=="object")return;n=n[u]}return n}},{key:"put",value:function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];for(var i=r.pop(),s=r.pop(),a=this.cache,u=0,l=r;u<l.length;u++){var c=l[u];Sc(a[c])!=="object"&&(a[c]={}),a=a[c]}return a[s]=i}}]),t}(),Lv=new YS,e5=JS(),t5=function(e){return e.toString()};function n5(t,e){if(!e5)return t5;var n=o5(t),r=JSON.stringify(e),o=Lv.get(String(n),r)||Lv.put(String(n),r,new Intl.DateTimeFormat(n,e));return function(i){return o.format(i)}}const r5=C2(n5);var Ff={};function o5(t){var e=t.toString();return Ff[e]?Ff[e]:Ff[e]=Y3(t)}function Wh(t){"@babel/helpers - typeof";return Wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wh(t)}function i5(t){return s5(t)?t:new Date(t)}function s5(t){return t instanceof Date||a5(t)}function a5(t){return Wh(t)==="object"&&typeof t.getTime=="function"}var Bv=new YS;function l5(t,e){var n=e.polyfill,r=String(t)+":"+String(n);return Bv.get(r)||Bv.put(r,new Sn(t,{polyfill:n}))}var Bd={exports:{}},ea={exports:{}};(function(){var t,e,n,r,o,i;typeof performance<"u"&&performance!==null&&performance.now?ea.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(ea.exports=function(){return(t()-o)/1e6},e=process.hrtime,t=function(){var s;return s=e(),s[0]*1e9+s[1]},r=t(),i=process.uptime()*1e9,o=r-i):Date.now?(ea.exports=function(){return Date.now()-n},n=Date.now()):(ea.exports=function(){return new Date().getTime()-n},n=new Date().getTime())}).call(it);var u5=ea.exports,c5=u5,vr=typeof window>"u"?it:window,Xl=["moz","webkit"],ss="AnimationFrame",vs=vr["request"+ss],rl=vr["cancel"+ss]||vr["cancelRequest"+ss];for(var Us=0;!vs&&Us<Xl.length;Us++)vs=vr[Xl[Us]+"Request"+ss],rl=vr[Xl[Us]+"Cancel"+ss]||vr[Xl[Us]+"CancelRequest"+ss];if(!vs||!rl){var $f=0,Fv=0,xo=[],d5=1e3/60;vs=function(t){if(xo.length===0){var e=c5(),n=Math.max(0,d5-(e-$f));$f=n+e,setTimeout(function(){var r=xo.slice(0);xo.length=0;for(var o=0;o<r.length;o++)if(!r[o].cancelled)try{r[o].callback($f)}catch(i){setTimeout(function(){throw i},0)}},Math.round(n))}return xo.push({handle:++Fv,callback:t,cancelled:!1}),Fv},rl=function(t){for(var e=0;e<xo.length;e++)xo[e].handle===t&&(xo[e].cancelled=!0)}}Bd.exports=function(t){return vs.call(vr,t)};Bd.exports.cancel=function(){rl.apply(vr,arguments)};Bd.exports.polyfill=function(t){t||(t=vr),t.requestAnimationFrame=vs,t.cancelAnimationFrame=rl};var f5=Bd.exports;const $v=di(f5);function p5(t,e){if(t.length===0)return 0;for(var n=0,r=t.length-1,o;n<=r;){o=Math.floor((r+n)/2);var i=e(t[o]);if(i===0)return o;if(i<0){if(n=o+1,n>r)return n}else if(r=o-1,r<n)return n}}function h5(t,e){return v5(t)||g5(t,e)||y5(t,e)||m5()}function m5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
55
55
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y5(t,e){if(t){if(typeof t=="string")return zv(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zv(t,e)}}function zv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function g5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){i=!0,a=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function v5(t){if(Array.isArray(t))return t}const w5={instances:[],add:function(e){var n=this,r=this.instances.length===0;return QS(this.instances,e),r&&this.start(),{stop:function(){XS(n.instances,e),n.instances.length===0&&n.stop()},forceUpdate:function(){Uv(e,n.instances)}}},tick:function(){for(var e=Date.now();;){var n=this.instances[0];if(e>=n.nextUpdateTime)Uv(n,this.instances);else break}},scheduleNextTick:function(){var e=this;this.scheduledTick=$v(function(){e.tick(),e.scheduleNextTick()})},start:function(){this.scheduleNextTick()},stop:function(){$v.cancel(this.scheduledTick)}};function b5(t){var e=t.getNextValue(),n=h5(e,2),r=n[0],o=n[1];t.setValue(r),t.nextUpdateTime=o}function Uv(t,e){b5(t),XS(e,t),QS(e,t)}function QS(t,e){var n=_5(t,e);t.splice(n,0,e)}function XS(t,e){var n=t.indexOf(e);t.splice(n,1)}function _5(t,e){var n=e.nextUpdateTime;return p5(t,function(r){return r.nextUpdateTime===n?0:r.nextUpdateTime>n?1:-1})}function Zl(t,e){return E5(t)||x5(t,e)||k5(t,e)||S5()}function S5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
56
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k5(t,e){if(t){if(typeof t=="string")return Vv(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vv(t,e)}}function Vv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function x5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){i=!0,a=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function E5(t){if(Array.isArray(t))return t}function T5(t){var e=t.date,n=t.future,r=t.locale,o=t.locales,i=t.timeStyle,s=t.round,a=t.minTimeLeft,u=t.formatVerboseDate,l=t.verboseDateFormat,c=l===void 0?O5:l,d=t.updateInterval,f=t.tick,p=f===void 0?!0:f,h=t.now,m=t.timeOffset,v=m===void 0?0:m,y=t.polyfill,w=_.useMemo(function(){return r&&(o=[r]),o.concat(Sn.getDefaultLocale())},[r,o]),b=_.useMemo(function(){return l5(w,{polyfill:y})},[w,y]);e=_.useMemo(function(){return i5(e)},[e]);var S=_.useCallback(function(){var K=(h||Date.now())-v,I;if(n&&K>=e.getTime()&&(K=e.getTime(),I=!0),a!==void 0){var L=e.getTime()-a*1e3;K>L&&(K=L,I=!0)}var F=b.format(e,i,{getTimeToNextUpdate:!0,now:K,future:n,round:s}),Z=Zl(F,2),ie=Z[0],ke=Z[1];return I?ke=M5:ke=d||ke||60*1e3,[ie,K+ke]},[e,n,i,d,s,a,b,h]),k=_.useRef();k.current=S;var E=_.useMemo(S,[]),x=Zl(E,2),T=x[0],O=x[1],N=_.useState(T),$=Zl(N,2),P=$[0],D=$[1],q=_.useRef();_.useEffect(function(){if(p)return q.current=w5.add({getNextValue:function(){return k.current()},setValue:D,nextUpdateTime:O}),function(){return q.current.stop()}},[p]),_.useEffect(function(){if(q.current)q.current.forceUpdate();else{var K=S(),I=Zl(K,1),L=I[0];D(L)}},[S]);var B=_.useMemo(function(){return r5(w,c)},[w,c]),z=_.useMemo(function(){return u?u(e):B(e)},[e,u,B]);return{date:e,formattedDate:P,verboseDate:z}}var C5=365*24*60*60*1e3,M5=1e3*C5,O5={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"},Kh=Se.oneOfType,qv=Se.arrayOf,Ui=Se.string,Hv=Se.number,ta=Se.shape,eu=Se.func,N5=Kh([ta({minTime:Hv,formatAs:Ui.isRequired}),ta({test:eu,formatAs:Ui.isRequired}),ta({minTime:Hv,format:eu.isRequired}),ta({test:eu,format:eu.isRequired})]),A5=Kh([Ui,ta({steps:qv(N5).isRequired,labels:Kh([Ui,qv(Ui)]).isRequired,round:Ui})]),I5=["date","future","timeStyle","round","minTimeLeft","locale","locales","formatVerboseDate","verboseDateFormat","updateInterval","tick","now","timeOffset","polyfill","tooltip","component","container","wrapperComponent","wrapperProps"];function kc(){return kc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},kc.apply(this,arguments)}function P5(t,e){if(t==null)return{};var n=R5(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function R5(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function ol(t){var e=t.date,n=t.future,r=t.timeStyle,o=t.round,i=t.minTimeLeft,s=t.locale,a=t.locales,u=a===void 0?[]:a,l=t.formatVerboseDate,c=t.verboseDateFormat,d=t.updateInterval,f=t.tick,p=t.now,h=t.timeOffset,m=t.polyfill,v=t.tooltip,y=v===void 0?!0:v,w=t.component,b=w===void 0?bc:w,S=t.container,k=t.wrapperComponent,E=t.wrapperProps,x=P5(t,I5),T=T5({date:e,future:n,timeStyle:r,round:o,minTimeLeft:i,locale:s,locales:u,formatVerboseDate:l,verboseDateFormat:c,updateInterval:d,tick:f,now:p,timeOffset:h,polyfill:m}),O=T.date,N=T.verboseDate,$=T.formattedDate,P=ue.createElement(b,kc({date:O,verboseDate:N,tooltip:y},x),$),D=k||S;return D?ue.createElement(D,kc({},E,{verboseDate:N}),P):P}ol.propTypes={date:Se.oneOfType([Se.instanceOf(Date),Se.number]).isRequired,locale:Se.string,locales:Se.arrayOf(Se.string),future:Se.bool,timeStyle:A5,round:Se.string,minTimeLeft:Se.number,component:Se.elementType,tooltip:Se.bool,formatVerboseDate:Se.func,verboseDateFormat:Se.object,updateInterval:Se.oneOfType([Se.number,Se.arrayOf(Se.shape({threshold:Se.number,interval:Se.number.isRequired}))]),tick:Se.bool,now:Se.number,timeOffset:Se.number,polyfill:Se.bool,wrapperComponent:Se.elementType,wrapperProps:Se.object};ol=ue.memo(ol);function Wv(t){return t.type==="user"}function Kv(t){return t.type==="field"}function Gv(t){return t.type==="asset"}function Jv(t){return t.type==="record"}function Yv(t){return t.type==="model"}function ZS(t,e){return t.type!==e.type?!1:Wv(t)&&Wv(e)?t.id===e.id&&t.name===e.name&&t.email===e.email&&t.avatarUrl===e.avatarUrl:Kv(t)&&Kv(e)?t.fieldPath===e.fieldPath&&t.locale===e.locale&&t.apiKey===e.apiKey&&t.label===e.label&&t.localized===e.localized&&t.fieldType===e.fieldType:Gv(t)&&Gv(e)?t.id===e.id&&t.filename===e.filename&&t.url===e.url&&t.thumbnailUrl===e.thumbnailUrl&&t.mimeType===e.mimeType:Jv(t)&&Jv(e)?t.id===e.id&&t.title===e.title&&t.modelId===e.modelId&&t.modelApiKey===e.modelApiKey&&t.modelName===e.modelName&&t.modelEmoji===e.modelEmoji&&t.thumbnailUrl===e.thumbnailUrl&&t.isSingleton===e.isSingleton:Yv(t)&&Yv(e)?t.id===e.id&&t.apiKey===e.apiKey&&t.name===e.name&&t.isBlockModel===e.isBlockModel:!1}function D5(t,e){return t.type!==e.type?!1:t.type==="text"&&e.type==="text"?t.content===e.content:t.type==="mention"&&e.type==="mention"?ZS(t.mention,e.mention):!1}function il(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!D5(t[n],e[n]))return!1;return!0}function ek(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].email!==e[n].email)return!1;return!0}const j5=20;function tk(t,e,n=0){if(n>j5)return!1;if(t===e||!t&&!e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const o=t[r],i=e[r];if(o.id!==i.id||!il(o.content,i.content)||!ek(o.usersWhoUpvoted,i.usersWhoUpvoted)||!tk(o.replies,i.replies,n+1))return!1}return!0}function nk(t){const e=t.site.attributes.internal_domain;return e?`https://${e}`:""}function L5(t,e){return e?`/schema/blocks_library/${t}`:`/schema/item_types/${t}`}function Gh(t,e){return`/editor/item_types/${t}/items/${e}/edit`}function B5(t,e){const n=nk(t);e==="sso"?window.open(`${n}/project_settings/sso-users`,"_blank"):e==="user"&&window.open(`${n}/project_settings/users`,"_blank")}function F5(t,e,n){const r=nk(t),o=L5(e,n);window.open(`${r}${o}`,"_blank")}function rk(t){const e=_.useCallback((o="user")=>{B5(t,o)},[t]),n=_.useCallback((o,i)=>{F5(t,o,i)},[t]),r=_.useCallback(async o=>{await t.editUpload(o)},[t]);return{handleNavigateToUsers:e,handleNavigateToModel:n,handleOpenAsset:r}}function $5(t){const e=rk(t),n=_.useCallback(async(o,i,s)=>{var a;try{const u=t.itemType.id,l=(a=t.item)==null?void 0:a.id;if(!l)return;if(i){const c=s??t.locale;await t.scrollToField(o,c);const f=c&&o.includes(`.${c}.`)?o:`${o}.${c}`,p=`${Gh(u,l)}#fieldPath=${f}`;await t.navigateTo(p)}else{const c=`${Gh(u,l)}#fieldPath=${o}`;await t.navigateTo(c)}}catch{}},[t]),r=_.useCallback(async(o,i)=>{if(window.location.hash.includes("fieldPath=")){const s=window.location.pathname+window.location.search;window.history.replaceState(null,"",s)}await t.editItem(o)},[t]);return{...e,handleScrollToField:n,handleOpenRecord:r}}function z5(t){const e=rk(t),n=_.useCallback(async(o,i)=>{if(window.location.hash.includes("fieldPath=")){const s=window.location.pathname+window.location.search;window.history.replaceState(null,"",s)}await t.editItem(o)},[t]),r=_.useCallback(async(o,i)=>{const s=Gh(o,i);await t.navigateTo(s)},[t]);return{...e,handleOpenRecord:n,handleNavigateToRecordComments:r}}const Ry=_.createContext(null);function ok(){const t=_.useContext(Ry);if(!t)throw new Error("useNavigationContext must be used within a NavigationCallbacksProvider");return t}function U5({ctx:t,children:e}){const n=$5(t);return g.jsx(Ry.Provider,{value:n,children:e})}function V5({ctx:t,children:e}){const n=z5(t),r={handleNavigateToUsers:n.handleNavigateToUsers,handleNavigateToModel:n.handleNavigateToModel,handleOpenAsset:n.handleOpenAsset,handleOpenRecord:n.handleOpenRecord,handleNavigateToRecordComments:n.handleNavigateToRecordComments};return g.jsx(Ry.Provider,{value:r,children:e})}const ik=_.createContext(null);function sk({children:t,projectUsers:e,projectModels:n,modelFields:r,currentUserEmail:o,typedUsers:i}){const s=_.useMemo(()=>({projectUsers:e,projectModels:n,modelFields:r,currentUserEmail:o,typedUsers:i}),[e,n,r,o,i]);return g.jsx(ik.Provider,{value:s,children:t})}function Dy(){const t=_.useContext(ik);if(!t)throw new Error("useProjectDataContext must be used within a ProjectDataProvider");return t}const io="project_comment",jy="__global__",ak="__project__",Iu={SYNC_COOLDOWN_MS:8e3,VERSION_CONFLICT_BACKOFF_BASE:100,VERSION_CONFLICT_BACKOFF_MAX:5e3,POLLING_INTERVAL_MS:3e4},Pu=30,q5={MENTION_CHIP_MAX_NAME_LENGTH:8},zf={MODEL_ID:"model_id",RECORD_ID:"record_id",CONTENT:"content"},Vs={SIDEBAR:"comments",PAGE:"comments-dashboard",ICON:"comment-dots"},Lt={SAVE_FAILED:"Failed to save comment. Please refresh and try again.",SAVE_RECORD_FIRST:"Please save the record first before adding comments.",ASSET_PICKER_FAILED:"Failed to open asset picker. Please try again.",RECORD_PICKER_FAILED:"Failed to open record picker. Please try again.",VERSION_CONFLICT_RETRYING:"Another user edited comments. Retrying...",MAX_RETRIES_EXCEEDED:"Unable to save after multiple attempts. Please check your connection and try again.",OPERATION_TIMEOUT:"Operation timed out after 2 minutes. Please try again.",MISSING_USER_INFO:"Unable to add comment: user information is missing."},Qv={MAX_ATTEMPTS:15,MAX_DURATION_MS:12e4},H5=new RegExp("^(\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F?)\\s*","u");function Jh(t){const e=t.match(H5);if(!e)return{emoji:null,textWithoutEmoji:t};const n=e[0].trim(),r=t.slice(e[0].length);return{emoji:n,textWithoutEmoji:r}}function W5(t){const e=q5.MENTION_CHIP_MAX_NAME_LENGTH,n=t.lastIndexOf(".");if(!(n!==-1))return t.length>e?`${t.slice(0,e)}…`:t;const o=t.slice(0,n),i=t.slice(n);return o.length<=e?t:`${o.slice(0,e)}…${i}`}function K5(t){if(!t)return null;const e=t.replace(/_/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}const G5=({mention:t,onClick:e,isClickable:n=!0,isProjectOwner:r=!1,tabIndex:o=0,tooltipId:i,projectUsers:s})=>{const a=_.useId(),u=i??`mention-tooltip-${a}`,l=d=>{d.preventDefault(),d.stopPropagation(),e==null||e(d)},c=_.useMemo(()=>{if(t.type!=="user"||!s)return t.type==="user"?t.name:"";let d=s.find(f=>f.id===t.id);return!d&&t.email&&(d=s.find(f=>f.email&&f.email===t.email)),d?d.name:t.name},[t,s]);switch(t.type){case"user":{const d=r?"Project Owner":t.email||"Organization";return g.jsxs("span",{className:A.userMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.userMention}${n?"":` ${A.userMentionDisabled}`}`,"aria-describedby":u,onClick:n?l:void 0,disabled:!n,children:["@",c]}),g.jsxs("span",{id:u,role:"tooltip",className:A.userMentionTooltip,children:[d,g.jsx("span",{className:A.userMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"field":{const d=t.localized&&t.locale,f=K5(t.fieldType);return g.jsxs("span",{className:A.fieldMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.fieldMention}${n?"":` ${A.fieldMentionDisabled}`}`,"aria-describedby":f?u:void 0,onClick:n?l:void 0,disabled:!n,children:["#",t.apiKey,d&&g.jsx("span",{className:A.fieldMentionLocaleBadge,children:t.locale})]}),f&&g.jsxs("span",{id:u,role:"tooltip",className:A.fieldMentionTooltip,children:[f,g.jsx("span",{className:A.fieldMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"asset":{const d=t.mimeType.startsWith("image/")||t.mimeType.startsWith("video/"),f=t.thumbnailUrl&&d,p=W5(t.filename);return f?g.jsx("span",{className:A.assetMentionBlockWrapper,children:g.jsxs("button",{type:"button",tabIndex:o,className:A.assetMentionBlock,onClick:l,children:[g.jsx("img",{src:t.thumbnailUrl,alt:t.filename,className:A.assetMentionBlockThumb,onError:h=>{const m=h.currentTarget;m.onerror=null,m.style.display="none";const v=m.closest("button");v&&v.setAttribute("data-img-error","true")}}),g.jsx("span",{className:A.assetMentionBlockFallback,"aria-hidden":"true",children:"^"}),g.jsx("span",{className:A.assetMentionBlockName,children:t.filename})]})}):g.jsxs("span",{className:A.assetMentionWrapper,children:[g.jsx("button",{type:"button",tabIndex:o,className:`${A.assetMention} ${A.assetMentionNoThumb}`,"aria-describedby":u,onClick:l,children:g.jsx("span",{className:A.assetMentionName,children:p})}),g.jsxs("span",{id:u,role:"tooltip",className:A.assetMentionTooltip,children:[t.filename,g.jsx("span",{className:A.assetMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"record":{const{emoji:d,textWithoutEmoji:f}=Jh(t.title),p=t.thumbnailUrl?null:d||t.modelEmoji||(t.isSingleton?"📄":null),h=d?f:t.title,m=t.isSingleton?"Singleton":t.modelName;return g.jsxs("span",{className:A.recordMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.recordMention} ${t.thumbnailUrl?"":A.recordMentionNoThumb}`,"aria-describedby":u,onClick:l,children:[t.thumbnailUrl?g.jsxs(g.Fragment,{children:[g.jsx("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${h}`,className:A.recordMentionThumb,onError:v=>{const y=v.currentTarget;y.onerror=null,y.style.display="none";const w=y.closest("button");w&&w.setAttribute("data-img-error","true")}}),g.jsx("span",{className:A.recordMentionFallback,"aria-hidden":"true",children:g.jsx(iv,{className:A.recordMentionIcon})})]}):p?g.jsx("span",{className:A.recordMentionEmoji,children:p}):g.jsx(iv,{className:A.recordMentionIcon}),g.jsx("span",{className:A.recordMentionTitle,children:h})]}),g.jsxs("span",{id:u,role:"tooltip",className:A.recordMentionTooltip,children:[m,g.jsx("span",{className:A.recordMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"model":{const{emoji:d,textWithoutEmoji:f}=Jh(t.name);return g.jsxs("span",{className:A.modelMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:A.modelMention,"aria-describedby":u,onClick:l,children:[d?g.jsx("span",{className:A.modelMentionEmoji,children:d}):g.jsx(MS,{className:A.modelMentionIcon}),f]}),g.jsxs("span",{id:u,role:"tooltip",className:A.modelMentionTooltip,children:[t.isBlockModel?"Block":"Model",": ",t.apiKey,g.jsx("span",{className:A.modelMentionTooltipArrow,"aria-hidden":"true"})]})]})}default:return null}},lk=_.memo(G5,(t,e)=>t.isClickable!==e.isClickable||t.isProjectOwner!==e.isProjectOwner||t.tabIndex!==e.tabIndex||t.tooltipId!==e.tooltipId||t.onClick!==e.onClick||t.projectUsers!==e.projectUsers?!1:ZS(t.mention,e.mention));function J5(t,e){return il(t.segments,e.segments)}const Y5=_.memo(function({segments:e}){const n=ok(),{projectUsers:r,typedUsers:o}=Dy(),i=_.useCallback(u=>{let l=o.find(c=>c.user.id===u.id);if(!l&&u.email&&(l=o.find(c=>c.user.email===u.email)),!l)return"owner";switch(l.userType){case"user":return"user";case"sso":return"sso";case"org":case"account":default:return"owner"}},[o]),s=_.useMemo(()=>{const u=new Map;for(const l of e)l.type==="mention"&&l.mention.type==="user"&&u.set(l.mention.id,i(l.mention));return u},[e,i]),a=_.useCallback(u=>{switch(u.type){case"user":{const l=s.get(u.id)??"owner";return l==="owner"?void 0:()=>n.handleNavigateToUsers(l)}case"field":{if(!n.handleScrollToField)return;const l=u.fieldPath??u.apiKey;return()=>{var c;return(c=n.handleScrollToField)==null?void 0:c.call(n,l,u.localized,u.locale)}}case"asset":return()=>n.handleOpenAsset(u.id);case"record":return()=>n.handleOpenRecord(u.id,u.modelId);case"model":return()=>n.handleNavigateToModel(u.id,u.isBlockModel);default:return}},[n,s]);return g.jsx(g.Fragment,{children:e.map((u,l)=>{if(u.type==="text"){const v=`text-${l}`;return g.jsx("span",{children:u.content},v)}const{mention:c}=u,d=Q5(c,l),f=X5(c,l),p=a(c);let h=!0,m=!1;return c.type==="field"?h=!!n.handleScrollToField:c.type==="user"&&(m=(s.get(c.id)??"owner")==="owner",h=!m),g.jsx(lk,{mention:c,onClick:p,isClickable:h,isProjectOwner:m,tooltipId:f,projectUsers:r},d)})})},J5);function Q5(t,e){switch(t.type){case"user":return`user-${t.id}-${e}`;case"field":return`field-${t.fieldPath??t.apiKey}-${t.locale??""}-${e}`;case"asset":return`asset-${t.id}-${e}`;case"record":return`record-${t.id}-${e}`;case"model":return`model-${t.id}-${e}`;default:return`unknown-${e}`}}function X5(t,e){switch(t.type){case"user":return`user-tooltip-${t.id}-${e}`;case"field":return`field-tooltip-${t.fieldPath??t.apiKey}-${t.locale??""}-${e}`;case"asset":return`asset-tooltip-${t.id}-${e}`;case"record":return`record-tooltip-${t.id}-${e}`;case"model":return`model-tooltip-${t.id}-${e}`;default:return`tooltip-${e}`}}function Z5(t,e){return t.userUpvoted===e.userUpvoted&&t.userIsAuthor===e.userIsAuthor&&t.isTopLevel===e.isTopLevel&&t.hasUpvotes===e.hasUpvotes&&t.onUpvote===e.onUpvote&&t.onReply===e.onReply&&t.onEdit===e.onEdit&&t.onDelete===e.onDelete}const e4=_.memo(function({onUpvote:e,onReply:n,onEdit:r,onDelete:o,userUpvoted:i,userIsAuthor:s,isTopLevel:a,hasUpvotes:u}){return g.jsxs("div",{className:A.actionsWrapper,children:[g.jsx("button",{type:"button",className:A.actionsTrigger,"aria-label":"Comment actions menu","aria-haspopup":"menu","aria-expanded":"false",children:g.jsx(OR,{})}),g.jsxs("div",{className:A.actions,role:"menu","aria-label":"Comment actions",children:[!u&&g.jsx("button",{type:"button",role:"menuitem",className:ot(A.actionBtn,i&&A.actionBtnActive),onClick:e,"aria-label":i?"Remove upvote":"Upvote",children:g.jsx(CS,{"aria-hidden":"true"})}),a&&n&&g.jsx("button",{type:"button",role:"menuitem",className:A.actionBtn,onClick:n,"aria-label":"Reply to comment",children:g.jsx(NR,{"aria-hidden":"true"})}),s&&g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",role:"menuitem",className:A.actionBtn,onClick:r,"aria-label":"Edit comment",children:g.jsx(AR,{"aria-hidden":"true"})}),g.jsx("button",{type:"button",role:"menuitem",className:ot(A.actionBtn,A.actionBtnDanger),onClick:o,"aria-label":"Delete comment",children:g.jsx(IR,{"aria-hidden":"true"})})]})]})]})},Z5),uk=_.memo(function({compact:e=!1,accentColor:n,children:r}){const o=e?`${j.composerBox} ${j.compact}`:j.composerBox,i=n?{"--composer-accent":n}:void 0;return g.jsx("div",{className:o,style:i,children:r})});var ck={exports:{}},dk={};/**
|
|
56
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k5(t,e){if(t){if(typeof t=="string")return Vv(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vv(t,e)}}function Vv(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function x5(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){i=!0,a=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function E5(t){if(Array.isArray(t))return t}function T5(t){var e=t.date,n=t.future,r=t.locale,o=t.locales,i=t.timeStyle,s=t.round,a=t.minTimeLeft,u=t.formatVerboseDate,l=t.verboseDateFormat,c=l===void 0?O5:l,d=t.updateInterval,f=t.tick,p=f===void 0?!0:f,h=t.now,m=t.timeOffset,v=m===void 0?0:m,y=t.polyfill,w=_.useMemo(function(){return r&&(o=[r]),o.concat(Sn.getDefaultLocale())},[r,o]),b=_.useMemo(function(){return l5(w,{polyfill:y})},[w,y]);e=_.useMemo(function(){return i5(e)},[e]);var S=_.useCallback(function(){var K=(h||Date.now())-v,I;if(n&&K>=e.getTime()&&(K=e.getTime(),I=!0),a!==void 0){var L=e.getTime()-a*1e3;K>L&&(K=L,I=!0)}var F=b.format(e,i,{getTimeToNextUpdate:!0,now:K,future:n,round:s}),Z=Zl(F,2),ie=Z[0],ke=Z[1];return I?ke=M5:ke=d||ke||60*1e3,[ie,K+ke]},[e,n,i,d,s,a,b,h]),k=_.useRef();k.current=S;var E=_.useMemo(S,[]),x=Zl(E,2),T=x[0],O=x[1],N=_.useState(T),$=Zl(N,2),P=$[0],D=$[1],q=_.useRef();_.useEffect(function(){if(p)return q.current=w5.add({getNextValue:function(){return k.current()},setValue:D,nextUpdateTime:O}),function(){return q.current.stop()}},[p]),_.useEffect(function(){if(q.current)q.current.forceUpdate();else{var K=S(),I=Zl(K,1),L=I[0];D(L)}},[S]);var B=_.useMemo(function(){return r5(w,c)},[w,c]),z=_.useMemo(function(){return u?u(e):B(e)},[e,u,B]);return{date:e,formattedDate:P,verboseDate:z}}var C5=365*24*60*60*1e3,M5=1e3*C5,O5={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"},Kh=Se.oneOfType,qv=Se.arrayOf,Ui=Se.string,Hv=Se.number,ta=Se.shape,eu=Se.func,N5=Kh([ta({minTime:Hv,formatAs:Ui.isRequired}),ta({test:eu,formatAs:Ui.isRequired}),ta({minTime:Hv,format:eu.isRequired}),ta({test:eu,format:eu.isRequired})]),A5=Kh([Ui,ta({steps:qv(N5).isRequired,labels:Kh([Ui,qv(Ui)]).isRequired,round:Ui})]),I5=["date","future","timeStyle","round","minTimeLeft","locale","locales","formatVerboseDate","verboseDateFormat","updateInterval","tick","now","timeOffset","polyfill","tooltip","component","container","wrapperComponent","wrapperProps"];function kc(){return kc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},kc.apply(this,arguments)}function P5(t,e){if(t==null)return{};var n=R5(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function R5(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function ol(t){var e=t.date,n=t.future,r=t.timeStyle,o=t.round,i=t.minTimeLeft,s=t.locale,a=t.locales,u=a===void 0?[]:a,l=t.formatVerboseDate,c=t.verboseDateFormat,d=t.updateInterval,f=t.tick,p=t.now,h=t.timeOffset,m=t.polyfill,v=t.tooltip,y=v===void 0?!0:v,w=t.component,b=w===void 0?bc:w,S=t.container,k=t.wrapperComponent,E=t.wrapperProps,x=P5(t,I5),T=T5({date:e,future:n,timeStyle:r,round:o,minTimeLeft:i,locale:s,locales:u,formatVerboseDate:l,verboseDateFormat:c,updateInterval:d,tick:f,now:p,timeOffset:h,polyfill:m}),O=T.date,N=T.verboseDate,$=T.formattedDate,P=ue.createElement(b,kc({date:O,verboseDate:N,tooltip:y},x),$),D=k||S;return D?ue.createElement(D,kc({},E,{verboseDate:N}),P):P}ol.propTypes={date:Se.oneOfType([Se.instanceOf(Date),Se.number]).isRequired,locale:Se.string,locales:Se.arrayOf(Se.string),future:Se.bool,timeStyle:A5,round:Se.string,minTimeLeft:Se.number,component:Se.elementType,tooltip:Se.bool,formatVerboseDate:Se.func,verboseDateFormat:Se.object,updateInterval:Se.oneOfType([Se.number,Se.arrayOf(Se.shape({threshold:Se.number,interval:Se.number.isRequired}))]),tick:Se.bool,now:Se.number,timeOffset:Se.number,polyfill:Se.bool,wrapperComponent:Se.elementType,wrapperProps:Se.object};ol=ue.memo(ol);function Wv(t){return t.type==="user"}function Kv(t){return t.type==="field"}function Gv(t){return t.type==="asset"}function Jv(t){return t.type==="record"}function Yv(t){return t.type==="model"}function ZS(t,e){return t.type!==e.type?!1:Wv(t)&&Wv(e)?t.id===e.id&&t.name===e.name&&t.email===e.email&&t.avatarUrl===e.avatarUrl:Kv(t)&&Kv(e)?t.fieldPath===e.fieldPath&&t.locale===e.locale&&t.apiKey===e.apiKey&&t.label===e.label&&t.localized===e.localized&&t.fieldType===e.fieldType:Gv(t)&&Gv(e)?t.id===e.id&&t.filename===e.filename&&t.url===e.url&&t.thumbnailUrl===e.thumbnailUrl&&t.mimeType===e.mimeType:Jv(t)&&Jv(e)?t.id===e.id&&t.title===e.title&&t.modelId===e.modelId&&t.modelApiKey===e.modelApiKey&&t.modelName===e.modelName&&t.modelEmoji===e.modelEmoji&&t.thumbnailUrl===e.thumbnailUrl&&t.isSingleton===e.isSingleton:Yv(t)&&Yv(e)?t.id===e.id&&t.apiKey===e.apiKey&&t.name===e.name&&t.isBlockModel===e.isBlockModel:!1}function D5(t,e){return t.type!==e.type?!1:t.type==="text"&&e.type==="text"?t.content===e.content:t.type==="mention"&&e.type==="mention"?ZS(t.mention,e.mention):!1}function il(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!D5(t[n],e[n]))return!1;return!0}function ek(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].email!==e[n].email)return!1;return!0}const j5=20;function tk(t,e,n=0){if(n>j5)return!1;if(t===e||!t&&!e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const o=t[r],i=e[r];if(o.id!==i.id||!il(o.content,i.content)||!ek(o.usersWhoUpvoted,i.usersWhoUpvoted)||!tk(o.replies,i.replies,n+1))return!1}return!0}function nk(t){const e=t.site.attributes.internal_domain;return e?`https://${e}`:""}function L5(t,e){return e?`/schema/blocks_library/${t}`:`/schema/item_types/${t}`}function Gh(t,e){return`/editor/item_types/${t}/items/${e}/edit`}function B5(t,e){const n=nk(t);e==="sso"?window.open(`${n}/project_settings/sso-users`,"_blank"):e==="user"&&window.open(`${n}/project_settings/users`,"_blank")}function F5(t,e,n){const r=nk(t),o=L5(e,n);window.open(`${r}${o}`,"_blank")}function rk(t){const e=_.useCallback((o="user")=>{B5(t,o)},[t]),n=_.useCallback((o,i)=>{F5(t,o,i)},[t]),r=_.useCallback(async o=>{await t.editUpload(o)},[t]);return{handleNavigateToUsers:e,handleNavigateToModel:n,handleOpenAsset:r}}function $5(t){const e=rk(t),n=_.useCallback(async(o,i,s)=>{var a;try{const u=t.itemType.id,l=(a=t.item)==null?void 0:a.id;if(!l)return;if(i){const c=s??t.locale;await t.scrollToField(o,c);const f=c&&o.includes(`.${c}.`)?o:`${o}.${c}`,p=`${Gh(u,l)}#fieldPath=${f}`;await t.navigateTo(p)}else{const c=`${Gh(u,l)}#fieldPath=${o}`;await t.navigateTo(c)}}catch{}},[t]),r=_.useCallback(async(o,i)=>{if(window.location.hash.includes("fieldPath=")){const s=window.location.pathname+window.location.search;window.history.replaceState(null,"",s)}await t.editItem(o)},[t]);return{...e,handleScrollToField:n,handleOpenRecord:r}}function z5(t){const e=rk(t),n=_.useCallback(async(o,i)=>{if(window.location.hash.includes("fieldPath=")){const s=window.location.pathname+window.location.search;window.history.replaceState(null,"",s)}await t.editItem(o)},[t]),r=_.useCallback(async(o,i)=>{const s=Gh(o,i);await t.navigateTo(s)},[t]);return{...e,handleOpenRecord:n,handleNavigateToRecordComments:r}}const Ry=_.createContext(null);function ok(){const t=_.useContext(Ry);if(!t)throw new Error("useNavigationContext must be used within a NavigationCallbacksProvider");return t}function U5({ctx:t,children:e}){const n=$5(t);return g.jsx(Ry.Provider,{value:n,children:e})}function V5({ctx:t,children:e}){const n=z5(t),r={handleNavigateToUsers:n.handleNavigateToUsers,handleNavigateToModel:n.handleNavigateToModel,handleOpenAsset:n.handleOpenAsset,handleOpenRecord:n.handleOpenRecord,handleNavigateToRecordComments:n.handleNavigateToRecordComments};return g.jsx(Ry.Provider,{value:r,children:e})}const ik=_.createContext(null);function sk({children:t,projectUsers:e,projectModels:n,modelFields:r,currentUserEmail:o,typedUsers:i}){const s=_.useMemo(()=>({projectUsers:e,projectModels:n,modelFields:r,currentUserEmail:o,typedUsers:i}),[e,n,r,o,i]);return g.jsx(ik.Provider,{value:s,children:t})}function Dy(){const t=_.useContext(ik);if(!t)throw new Error("useProjectDataContext must be used within a ProjectDataProvider");return t}const io="project_comment",jy="__global__",ak="__project__",Iu={SYNC_COOLDOWN_MS:8e3,VERSION_CONFLICT_BACKOFF_BASE:100,VERSION_CONFLICT_BACKOFF_MAX:5e3,POLLING_INTERVAL_MS:3e4},Pu=30,q5={MENTION_CHIP_MAX_NAME_LENGTH:8},zf={MODEL_ID:"model_id",RECORD_ID:"record_id",CONTENT:"content"},Vs={SIDEBAR:"comments",PAGE:"comments-dashboard",ICON:"comment-dots"},Bt={SAVE_FAILED:"Failed to save comment. Please refresh and try again.",SAVE_RECORD_FIRST:"Please save the record first before adding comments.",ASSET_PICKER_FAILED:"Failed to open asset picker. Please try again.",RECORD_PICKER_FAILED:"Failed to open record picker. Please try again.",VERSION_CONFLICT_RETRYING:"Another user edited comments. Retrying...",MAX_RETRIES_EXCEEDED:"Unable to save after multiple attempts. Please check your connection and try again.",OPERATION_TIMEOUT:"Operation timed out after 2 minutes. Please try again.",MISSING_USER_INFO:"Unable to add comment: user information is missing."},Qv={MAX_ATTEMPTS:15,MAX_DURATION_MS:12e4},H5=new RegExp("^(\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F?)\\s*","u");function Jh(t){const e=t.match(H5);if(!e)return{emoji:null,textWithoutEmoji:t};const n=e[0].trim(),r=t.slice(e[0].length);return{emoji:n,textWithoutEmoji:r}}function W5(t){const e=q5.MENTION_CHIP_MAX_NAME_LENGTH,n=t.lastIndexOf(".");if(!(n!==-1))return t.length>e?`${t.slice(0,e)}…`:t;const o=t.slice(0,n),i=t.slice(n);return o.length<=e?t:`${o.slice(0,e)}…${i}`}function K5(t){if(!t)return null;const e=t.replace(/_/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}const G5=({mention:t,onClick:e,isClickable:n=!0,isProjectOwner:r=!1,tabIndex:o=0,tooltipId:i,projectUsers:s})=>{const a=_.useId(),u=i??`mention-tooltip-${a}`,l=d=>{d.preventDefault(),d.stopPropagation(),e==null||e(d)},c=_.useMemo(()=>{if(t.type!=="user"||!s)return t.type==="user"?t.name:"";let d=s.find(f=>f.id===t.id);return!d&&t.email&&(d=s.find(f=>f.email&&f.email===t.email)),d?d.name:t.name},[t,s]);switch(t.type){case"user":{const d=r?"Project Owner":t.email||"Organization";return g.jsxs("span",{className:A.userMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.userMention}${n?"":` ${A.userMentionDisabled}`}`,"aria-describedby":u,onClick:n?l:void 0,disabled:!n,children:["@",c]}),g.jsxs("span",{id:u,role:"tooltip",className:A.userMentionTooltip,children:[d,g.jsx("span",{className:A.userMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"field":{const d=t.localized&&t.locale,f=K5(t.fieldType);return g.jsxs("span",{className:A.fieldMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.fieldMention}${n?"":` ${A.fieldMentionDisabled}`}`,"aria-describedby":f?u:void 0,onClick:n?l:void 0,disabled:!n,children:["#",t.apiKey,d&&g.jsx("span",{className:A.fieldMentionLocaleBadge,children:t.locale})]}),f&&g.jsxs("span",{id:u,role:"tooltip",className:A.fieldMentionTooltip,children:[f,g.jsx("span",{className:A.fieldMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"asset":{const d=t.mimeType.startsWith("image/")||t.mimeType.startsWith("video/"),f=t.thumbnailUrl&&d,p=W5(t.filename);return f?g.jsx("span",{className:A.assetMentionBlockWrapper,children:g.jsxs("button",{type:"button",tabIndex:o,className:A.assetMentionBlock,onClick:l,children:[g.jsx("img",{src:t.thumbnailUrl,alt:t.filename,className:A.assetMentionBlockThumb,onError:h=>{const m=h.currentTarget;m.onerror=null,m.style.display="none";const v=m.closest("button");v&&v.setAttribute("data-img-error","true")}}),g.jsx("span",{className:A.assetMentionBlockFallback,"aria-hidden":"true",children:"^"}),g.jsx("span",{className:A.assetMentionBlockName,children:t.filename})]})}):g.jsxs("span",{className:A.assetMentionWrapper,children:[g.jsx("button",{type:"button",tabIndex:o,className:`${A.assetMention} ${A.assetMentionNoThumb}`,"aria-describedby":u,onClick:l,children:g.jsx("span",{className:A.assetMentionName,children:p})}),g.jsxs("span",{id:u,role:"tooltip",className:A.assetMentionTooltip,children:[t.filename,g.jsx("span",{className:A.assetMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"record":{const{emoji:d,textWithoutEmoji:f}=Jh(t.title),p=t.thumbnailUrl?null:d||t.modelEmoji||(t.isSingleton?"📄":null),h=d?f:t.title,m=t.isSingleton?"Singleton":t.modelName;return g.jsxs("span",{className:A.recordMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:`${A.recordMention} ${t.thumbnailUrl?"":A.recordMentionNoThumb}`,"aria-describedby":u,onClick:l,children:[t.thumbnailUrl?g.jsxs(g.Fragment,{children:[g.jsx("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${h}`,className:A.recordMentionThumb,onError:v=>{const y=v.currentTarget;y.onerror=null,y.style.display="none";const w=y.closest("button");w&&w.setAttribute("data-img-error","true")}}),g.jsx("span",{className:A.recordMentionFallback,"aria-hidden":"true",children:g.jsx(iv,{className:A.recordMentionIcon})})]}):p?g.jsx("span",{className:A.recordMentionEmoji,children:p}):g.jsx(iv,{className:A.recordMentionIcon}),g.jsx("span",{className:A.recordMentionTitle,children:h})]}),g.jsxs("span",{id:u,role:"tooltip",className:A.recordMentionTooltip,children:[m,g.jsx("span",{className:A.recordMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"model":{const{emoji:d,textWithoutEmoji:f}=Jh(t.name);return g.jsxs("span",{className:A.modelMentionWrapper,children:[g.jsxs("button",{type:"button",tabIndex:o,className:A.modelMention,"aria-describedby":u,onClick:l,children:[d?g.jsx("span",{className:A.modelMentionEmoji,children:d}):g.jsx(MS,{className:A.modelMentionIcon}),f]}),g.jsxs("span",{id:u,role:"tooltip",className:A.modelMentionTooltip,children:[t.isBlockModel?"Block":"Model",": ",t.apiKey,g.jsx("span",{className:A.modelMentionTooltipArrow,"aria-hidden":"true"})]})]})}default:return null}},lk=_.memo(G5,(t,e)=>t.isClickable!==e.isClickable||t.isProjectOwner!==e.isProjectOwner||t.tabIndex!==e.tabIndex||t.tooltipId!==e.tooltipId||t.onClick!==e.onClick||t.projectUsers!==e.projectUsers?!1:ZS(t.mention,e.mention));function J5(t,e){return il(t.segments,e.segments)}const Y5=_.memo(function({segments:e}){const n=ok(),{projectUsers:r,typedUsers:o}=Dy(),i=_.useCallback(u=>{let l=o.find(c=>c.user.id===u.id);if(!l&&u.email&&(l=o.find(c=>c.user.email===u.email)),!l)return"owner";switch(l.userType){case"user":return"user";case"sso":return"sso";case"org":case"account":default:return"owner"}},[o]),s=_.useMemo(()=>{const u=new Map;for(const l of e)l.type==="mention"&&l.mention.type==="user"&&u.set(l.mention.id,i(l.mention));return u},[e,i]),a=_.useCallback(u=>{switch(u.type){case"user":{const l=s.get(u.id)??"owner";return l==="owner"?void 0:()=>n.handleNavigateToUsers(l)}case"field":{if(!n.handleScrollToField)return;const l=u.fieldPath??u.apiKey;return()=>{var c;return(c=n.handleScrollToField)==null?void 0:c.call(n,l,u.localized,u.locale)}}case"asset":return()=>n.handleOpenAsset(u.id);case"record":return()=>n.handleOpenRecord(u.id,u.modelId);case"model":return()=>n.handleNavigateToModel(u.id,u.isBlockModel);default:return}},[n,s]);return g.jsx(g.Fragment,{children:e.map((u,l)=>{if(u.type==="text"){const v=`text-${l}`;return g.jsx("span",{children:u.content},v)}const{mention:c}=u,d=Q5(c,l),f=X5(c,l),p=a(c);let h=!0,m=!1;return c.type==="field"?h=!!n.handleScrollToField:c.type==="user"&&(m=(s.get(c.id)??"owner")==="owner",h=!m),g.jsx(lk,{mention:c,onClick:p,isClickable:h,isProjectOwner:m,tooltipId:f,projectUsers:r},d)})})},J5);function Q5(t,e){switch(t.type){case"user":return`user-${t.id}-${e}`;case"field":return`field-${t.fieldPath??t.apiKey}-${t.locale??""}-${e}`;case"asset":return`asset-${t.id}-${e}`;case"record":return`record-${t.id}-${e}`;case"model":return`model-${t.id}-${e}`;default:return`unknown-${e}`}}function X5(t,e){switch(t.type){case"user":return`user-tooltip-${t.id}-${e}`;case"field":return`field-tooltip-${t.fieldPath??t.apiKey}-${t.locale??""}-${e}`;case"asset":return`asset-tooltip-${t.id}-${e}`;case"record":return`record-tooltip-${t.id}-${e}`;case"model":return`model-tooltip-${t.id}-${e}`;default:return`tooltip-${e}`}}function Z5(t,e){return t.userUpvoted===e.userUpvoted&&t.userIsAuthor===e.userIsAuthor&&t.isTopLevel===e.isTopLevel&&t.hasUpvotes===e.hasUpvotes&&t.onUpvote===e.onUpvote&&t.onReply===e.onReply&&t.onEdit===e.onEdit&&t.onDelete===e.onDelete}const e4=_.memo(function({onUpvote:e,onReply:n,onEdit:r,onDelete:o,userUpvoted:i,userIsAuthor:s,isTopLevel:a,hasUpvotes:u}){return g.jsxs("div",{className:A.actionsWrapper,children:[g.jsx("button",{type:"button",className:A.actionsTrigger,"aria-label":"Comment actions menu","aria-haspopup":"menu","aria-expanded":"false",children:g.jsx(OR,{})}),g.jsxs("div",{className:A.actions,role:"menu","aria-label":"Comment actions",children:[!u&&g.jsx("button",{type:"button",role:"menuitem",className:ot(A.actionBtn,i&&A.actionBtnActive),onClick:e,"aria-label":i?"Remove upvote":"Upvote",children:g.jsx(CS,{"aria-hidden":"true"})}),a&&n&&g.jsx("button",{type:"button",role:"menuitem",className:A.actionBtn,onClick:n,"aria-label":"Reply to comment",children:g.jsx(NR,{"aria-hidden":"true"})}),s&&g.jsxs(g.Fragment,{children:[g.jsx("button",{type:"button",role:"menuitem",className:A.actionBtn,onClick:r,"aria-label":"Edit comment",children:g.jsx(AR,{"aria-hidden":"true"})}),g.jsx("button",{type:"button",role:"menuitem",className:ot(A.actionBtn,A.actionBtnDanger),onClick:o,"aria-label":"Delete comment",children:g.jsx(IR,{"aria-hidden":"true"})})]})]})]})},Z5),uk=_.memo(function({compact:e=!1,accentColor:n,children:r}){const o=e?`${j.composerBox} ${j.compact}`:j.composerBox,i=n?{"--composer-accent":n}:void 0;return g.jsx("div",{className:o,style:i,children:r})});var ck={exports:{}},dk={};/**
|
|
57
57
|
* @license React
|
|
58
58
|
* use-sync-external-store-shim.production.js
|
|
59
59
|
*
|
|
@@ -70,7 +70,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
70
70
|
`),d&&h==p.nodeValue.length)for(let m=p,v;m;m=m.parentNode){if(v=m.nextSibling){v.nodeName=="BR"&&(a=u={node:v.parentNode,offset:xt(v)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=p.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(xn&&c.focusNode&&c.focusNode!=u.node&&c.focusNode.nodeType==1){let p=c.focusNode.childNodes[c.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&Rt)&&ai(a.node,a.offset,c.anchorNode,c.anchorOffset)&&ai(u.node,u.offset,c.focusNode,c.focusOffset))return;let f=!1;if((l.extend||e==n)&&!(d&&xn)){l.collapse(a.node,a.offset);try{e!=n&&l.extend(u.node,u.offset),f=!0}catch{}}if(!f){if(e>n){let h=a;a=u,u=h}let p=document.createRange();p.setEnd(u.node,u.offset),p.setStart(a.node,a.offset),l.removeAllRanges(),l.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+i.border,u=s-i.border;if(e>=a&&n<=u){this.dirty=e==r||n==s?jo:E1,e==a&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=nr:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?jo:nr}r=s}this.dirty=jo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?jo:E1;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class px extends Tl{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==En&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class GB extends Tl{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class li extends Tl{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=gi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new li(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&nr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=nr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=En){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=En}}slice(e,n,r){let o=li.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=sm(i,n,s,r)),e>0&&(i=sm(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lo extends Tl{constructor(e,n,r,o,i,s,a,u,l){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,i,s){let a=i.nodeViews[n.type.name],u,l=a&&a(n,i,()=>{if(!u)return s;if(u.parent)return u.parent.posBeforeChild(u)},r,o),c=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=gi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=gx(c,r,n),l?u=new JB(e,n,r,o,c,d||null,f,l,i,s+1):n.isText?new qd(e,n,r,o,c,f,i):new lo(e,n,r,o,c,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>U.empty)}return e}matchesNode(e,n,r){return this.dirty==En&&e.eq(this.node)&&Oc(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,u=new QB(this,s&&s.node,e);eF(this.node,this.innerDeco,(l,c,d)=>{l.spec.marks?u.syncToMarks(l.spec.marks,r,e):l.type.side>=0&&!d&&u.syncToMarks(c==this.node.childCount?Ie.none:this.node.child(c).marks,r,e),u.placeWidget(l,e,o)},(l,c,d,f)=>{u.syncToMarks(l.marks,r,e);let p;u.findNodeMatch(l,c,d,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+l.nodeSize&&(p=u.findIndexWithChild(i.node))>-1&&u.updateNodeAt(l,c,d,p,e)||u.updateNextNode(l,c,d,e,f,o)||u.addNode(l,c,d,e,o),o+=l.nodeSize}),u.syncToMarks([],r,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==jo)&&(s&&this.protectLocalComposition(e,s),mx(this.contentDOM,this.children,e),ks&&tF(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof ce)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=nF(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new GB(this,i,n,o);e.input.compositionNodes.push(s),this.children=sm(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==nr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=En}updateOuterDeco(e){if(Oc(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=yx(this.dom,this.nodeDOM,im(this.outerDeco,this.node,n),im(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function T1(t,e,n,r,o){gx(r,e,t);let i=new lo(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class qd extends lo{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==nr||this.dirty!=En&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=En||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=En,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new qd(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=nr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class hx extends Tl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==En&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class JB extends lo{constructor(e,n,r,o,i,s,a,u,l,c){super(e,n,r,o,i,s,a,l,c),this.spec=u}update(e,n,r,o){if(this.dirty==nr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function mx(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=C1(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof li){let u=r?r.previousSibling:t.lastChild;mx(s.contentDOM,s.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=C1(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const va=function(t){t&&(this.nodeName=t)};va.prototype=Object.create(null);const Lo=[new va];function im(t,e,n){if(t.length==0)return Lo;let r=n?Lo[0]:new va,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new va(s.nodeName));for(let a in s){let u=s[a];u!=null&&(n&&o.length==1&&o.push(r=new va(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+u:a=="style"?r.style=(r.style?r.style+";":"")+u:a!="nodeName"&&(r[a]=u))}}}return o}function yx(t,e,n,r){if(n==Lo&&r==Lo)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let u;a&&a.nodeName==s.nodeName&&o!=t&&(u=o.parentNode)&&u.nodeName.toLowerCase()==s.nodeName||(u=document.createElement(s.nodeName),u.pmIsDeco=!0,u.appendChild(o),a=Lo[0]),o=u}YB(o,a||Lo[0],s)}return o}function YB(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function gx(t,e,n){return yx(t,t,Lo,im(e,n,t.nodeType!=1))}function Oc(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function C1(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class QB{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=XB(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=En,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let u=this.index;u<Math.min(this.index+3,this.top.children.length);u++){let l=this.top.children[u];if(l.matchesMark(e[i])&&!this.isLocked(l.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=li.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,u=Math.min(this.top.children.length,a+5);a<u;a++){let l=this.top.children[a];if(l.matchesNode(e,n,r)&&!this.preMatch.matched.has(l)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==nr&&s.dom==s.contentDOM&&(s.dirty=jo),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let u=this.top.children[a];if(u instanceof lo){let l=this.preMatch.matched.get(u);if(l!=null&&l!=i)return!1;let c=u.dom,d,f=this.isLocked(c)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=nr&&Oc(n,u.outerDeco));if(!f&&u.update(e,n,r,o))return this.destroyBetween(this.index,a),u.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(u,e,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=jo,d.updateChildren(o,s+1),d.dirty=En),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Oc(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=lo.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let u of a.children)u.parent=a}return e.destroy(),a}addNode(e,n,r,o,i){let s=lo.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new px(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof li;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Rt||yt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new hx(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function XB(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let l=n.children[r-1];if(l instanceof li)n=l,r=l.children.length;else{a=l,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function ZB(t,e){return t.type.side-e.type.side}function eF(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let l=0;l<t.childCount;l++){let c=t.child(l);r(c,o,e.forChild(i,c),l),i+=c.nodeSize}return}let s=0,a=[],u=null;for(let l=0;;){let c,d;for(;s<o.length&&o[s].to==i;){let v=o[s++];v.widget&&(c?(d||(d=[c])).push(v):c=v)}if(c)if(d){d.sort(ZB);for(let v=0;v<d.length;v++)n(d[v],l,!!u)}else n(c,l,!!u);let f,p;if(u)p=-1,f=u,u=null;else if(l<t.childCount)p=l,f=t.child(l++);else break;for(let v=0;v<a.length;v++)a[v].to<=i&&a.splice(v--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let v=h;s<o.length&&o[s].from<v&&(v=o[s].from);for(let y=0;y<a.length;y++)a[y].to<v&&(v=a[y].to);v<h&&(u=f.cut(v-i),f=f.cut(0,v-i),h=v,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?a.filter(v=>!v.inline):a.slice();r(f,m,e.forChild(i,f),p),i=h}}function tF(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function nF(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let u=s.text;for(;o<t.childCount;){let l=t.child(o++);if(i+=l.nodeSize,!l.isText)break;u+=l.text}if(i>=n){if(i>=r&&u.slice(r-e.length-a,r-a)==e)return r-e.length;let l=a<r?u.lastIndexOf(e,r-a-1):-1;if(l>=0&&l+e.length+a>=n)return a+l;if(n==r&&u.length>=r+e.length-a&&u.slice(r-a,r-a+e.length)==e)return r}}return-1}function sm(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let u=t[s],l=a,c=a+=u.size;l>=n||c<=e?i.push(u):(l<e&&i.push(u.slice(0,e-l,r)),o&&(i.push(o),o=void 0),c>n&&i.push(u.slice(n-l,u.size,r)))}return i}function Gy(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),u,l;if(Vd(n)){for(u=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&re.isSelectable(d)&&o.parent&&!(d.isInline&&OB(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;l=new re(s==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[u,s]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let c=r.resolve(u);if(!l){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;l=Jy(t,c,a,d)}return l}function vx(t){return t.editable?t.hasFocus():bx(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function br(t,e=!1){let n=t.state.selection;if(wx(t,n),!!vx(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&yt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&ai(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)oF(t);else{let{anchor:r,head:o}=n,i,s;M1&&!(n instanceof ce)&&(n.$from.parent.inlineContent||(i=O1(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=O1(t,n.to))),t.docView.setSelection(r,o,t,e),M1&&(i&&N1(i),s&&N1(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&rF(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const M1=Rt||yt&&ix<63;function O1(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Rt&&o&&o.contentEditable=="false")return Xf(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Xf(o);if(i)return Xf(i)}}function Xf(t){return t.contentEditable="true",Rt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function N1(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function rF(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!vx(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function oF(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,xt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Zt&&ao<=11&&(n.disabled=!0,n.disabled=!1)}function wx(t,e){if(e instanceof re){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(A1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else A1(t)}function A1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Jy(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||ce.between(e,n,r)}function I1(t){return t.editable&&!t.hasFocus()?!1:bx(t)}function bx(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function iF(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ai(e.node,e.offset,n.anchorNode,n.anchorOffset)}function am(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&me.findFrom(i,e)}function Br(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function P1(t,e,n){let r=t.state.selection;if(r instanceof ce)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Br(t,new ce(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=am(t.state,e);return o&&o instanceof re?Br(t,o):!1}else if(!(yn&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?re.isSelectable(i)?Br(t,new re(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):El?Br(t,new ce(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof re&&r.node.isInline)return Br(t,new ce(e>0?r.$to:r.$from));{let o=am(t.state,e);return o?Br(t,o):!1}}}function Nc(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function ki(t,e){return e<0?sF(t):aF(t)}function sF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(xn&&n.nodeType==1&&r<Nc(n)&&wa(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(wa(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(_x(n))break;{let a=n.previousSibling;for(;a&&wa(a,-1);)o=n.parentNode,i=xt(a),a=a.previousSibling;if(a)n=a,r=Nc(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?lm(t,n,r):o&&lm(t,o,i)}function aF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Nc(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(wa(a,1))i=n,s=++r;else break}else{if(_x(n))break;{let a=n.nextSibling;for(;a&&wa(a,1);)i=a.parentNode,s=xt(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=Nc(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&lm(t,i,s)}function _x(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function lF(t,e){for(;t&&e==t.childNodes.length&&!xl(t);)e=xt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function uF(t,e){for(;t&&!e&&!xl(t);)e=xt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function lm(t,e,n){if(e.nodeType!=3){let i,s;(s=lF(e,n))?(e=s,n=0):(i=uF(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Vd(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&br(t)},50)}function R1(t,e){let n=t.state.doc.resolve(e);if(!(yt||sx)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>o.top&&s<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function D1(t,e,n){let r=t.state.selection;if(r instanceof ce&&!r.empty||n.indexOf("s")>-1||yn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=am(t.state,e);if(s&&s instanceof re)return Br(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof an?me.near(s,e):me.findFrom(s,e);return a?Br(t,a):!1}return!1}function j1(t,e){if(!(t.state.selection instanceof ce))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function L1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cF(t){if(!Rt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;L1(t,r,"true"),setTimeout(()=>L1(t,r,"false"),20)}return!1}function dF(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function fF(t,e){let n=e.keyCode,r=dF(e);if(n==8||yn&&n==72&&r=="c")return j1(t,-1)||ki(t,-1);if(n==46&&!e.shiftKey||yn&&n==68&&r=="c")return j1(t,1)||ki(t,1);if(n==13||n==27)return!0;if(n==37||yn&&n==66&&r=="c"){let o=n==37?R1(t,t.state.selection.from)=="ltr"?-1:1:-1;return P1(t,o,r)||ki(t,o)}else if(n==39||yn&&n==70&&r=="c"){let o=n==39?R1(t,t.state.selection.from)=="ltr"?1:-1:1;return P1(t,o,r)||ki(t,o)}else{if(n==38||yn&&n==80&&r=="c")return D1(t,-1,r)||ki(t,-1);if(n==40||yn&&n==78&&r=="c")return cF(t)||D1(t,1,r)||ki(t,1);if(r==(yn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Yy(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||gi.fromSchema(t.state.schema),a=Cx(),u=a.createElement("div");u.appendChild(s.serializeFragment(r,{document:a}));let l=u.firstChild,c,d=0;for(;l&&l.nodeType==1&&(c=Tx[l.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let h=a.createElement(c[p]);for(;u.firstChild;)h.appendChild(u.firstChild);u.appendChild(h),d++}l=u.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
|
|
71
71
|
|
|
72
72
|
`);return{dom:u,text:f,slice:e}}function Sx(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return a=new J(U.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
73
|
-
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:p}=t.state,h=gi.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(h.serializeNode(p.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=yF(n),El&&gF(s);let l=s&&s.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||so.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(u||c),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!pF.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=vF(B1(a,+c[1],+c[2]),c[4]);else if(a=J.maxOpen(hF(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=B1(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,u)}),a}const pF=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function hF(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let u=o.findWrapping(a.type),l;if(!u)return s=null;if(l=s.length&&i.length&&xx(u,i,a,s[s.length-1],0))s[s.length-1]=l;else{s.length&&(s[s.length-1]=Ex(s[s.length-1],i.length));let c=kx(a,u);s.push(c),o=o.matchType(c.type),i=u}}),s)return U.from(s)}return t}function kx(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,U.from(t));return t}function xx(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=xx(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(U.from(kx(n,t,o+1))))}}function Ex(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ex(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(U.empty,!0);return t.copy(n.append(r))}function um(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=um(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(U.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function B1(t,e,n){return e<t.openStart&&(t=new J(um(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new J(um(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Tx={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let F1=null;function Cx(){return F1||(F1=document.implementation.createHTMLDocument("title"))}let Zf=null;function mF(t){let e=window.trustedTypes;return e?(Zf||(Zf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Zf.createHTML(t)):t}function yF(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Cx().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Tx[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=mF(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function gF(t){let e=t.querySelectorAll(yt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function vF(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let u=n.nodes[r[a]];if(!u||u.hasRequiredAttrs())break;o=U.from(u.create(r[a+1],o)),i++,s++}return new J(o,i,s)}const $t={},zt={},wF={touchstart:!0,touchmove:!0};class bF{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _F(t){for(let e in $t){let n=$t[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{kF(t,r)&&!Qy(t,r)&&(t.editable||!(r.type in zt))&&n(t,r)},wF[e]?{passive:!0}:void 0)}Rt&&t.dom.addEventListener("input",()=>null),cm(t)}function Yr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function SF(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function cm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Qy(t,r))})}function Qy(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function kF(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function xF(t,e){!Qy(t,e)&&$t[e.type]&&(t.editable||!(e.type in zt))&&$t[e.type](t,e)}zt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ox(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(mr&&yt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ks&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,No(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||fF(t,n)?n.preventDefault():Yr(t,"key")};zt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};zt.keypress=(t,e)=>{let n=e;if(Ox(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||yn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ce)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Hd(t){return{left:t.clientX,top:t.clientY}}function EF(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Xy(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function ls(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function TF(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&re.isSelectable(r)?(ls(t,new re(n)),!0):!1}function CF(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof re&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(ls(t,re.create(t.state.doc,o)),!0):!1}function MF(t,e,n,r,o){return Xy(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?CF(t,n):TF(t,n))}function OF(t,e,n,r){return Xy(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function NF(t,e,n,r){return Xy(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||AF(t,n,r)}function AF(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ls(t,ce.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)ls(t,ce.create(r,a+1,a+1+s.content.size));else if(re.isSelectable(s))ls(t,re.create(r,a));else continue;return!0}}function Zy(t){return Ac(t)}const Mx=yn?"metaKey":"ctrlKey";$t.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Zy(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&EF(n,t.input.lastClick)&&!n[Mx]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Hd(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new IF(t,s,n,!!r)):(i=="doubleClick"?OF:NF)(t,s.pos,s.inside,n)?n.preventDefault():Yr(t,"pointer"))};class IF{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Mx],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const a=o?null:r.target,u=a?e.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:l}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||l instanceof re&&l.from<=s&&l.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Yr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>br(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Hd(e))),this.updateAllowDefault(e),this.allowDefault||!n?Yr(this.view,"pointer"):MF(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rt&&this.mightDrag&&!this.mightDrag.node.isAtom||yt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ls(this.view,me.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}$t.touchstart=t=>{t.input.lastTouch=Date.now(),Zy(t),Yr(t,"pointer")};$t.touchmove=t=>{t.input.lastTouch=Date.now(),Yr(t,"pointer")};$t.contextmenu=t=>Zy(t);function Ox(t,e){return t.composing?!0:Rt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const PF=mr?5e3:-1;zt.compositionstart=zt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ce&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||yt&&sx&&RF(t)))t.markCursor=t.state.storedMarks||n.marks(),Ac(t,!0),t.markCursor=null;else if(Ac(t,!e.selection.empty),xn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Nx(t,PF)};function RF(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}zt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Nx(t,20))};function Nx(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ac(t),e))}function Ax(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=jF());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function DF(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=CB(e.focusNode,e.focusOffset),r=MB(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function jF(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ac(t,e=!1){if(!(mr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ax(t),e||t.docView&&t.docView.dirty){let n=Gy(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function LF(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cl=Zt&&ao<15||ks&&IB<604;$t.copy=zt.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=cl?null:n.clipboardData,s=r.content(),{dom:a,text:u}=Yy(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",u)):LF(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function BF(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function FF(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?dl(t,r.value,null,o,e):dl(t,r.textContent,r.innerHTML,o,e)},50)}function dl(t,e,n,r,o){let i=Sx(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,o,i||J.empty)))return!0;if(!i)return!1;let s=BF(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ix(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}zt.paste=(t,e)=>{let n=e;if(t.composing&&!mr)return;let r=cl?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&dl(t,Ix(r),r.getData("text/html"),o,n)?n.preventDefault():FF(t,n)};class Px{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const $F=yn?"altKey":"ctrlKey";function Rx(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[$F]}$t.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Hd(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof re?o.to-1:o.to))){if(r&&r.mightDrag)s=re.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=re.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:u,text:l,slice:c}=Yy(t,a);(!n.dataTransfer.files.length||!yt||ix>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cl?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",cl||n.dataTransfer.setData("text/plain",l),t.dragging=new Px(c,Rx(t,n),s)};$t.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};zt.dragover=zt.dragenter=(t,e)=>e.preventDefault();zt.drop=(t,e)=>{try{zF(t,e,t.dragging)}finally{t.dragging=null}};function zF(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Hd(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=Sx(t,Ix(e.dataTransfer),cl?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&Rx(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||J.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Bk(t.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let u=t.state.tr;if(s){let{node:p}=n;p?p.replace(u):u.deleteSelection()}let l=u.mapping.map(a),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=u.doc;if(c?u.replaceRangeWith(l,l,i.content.firstChild):u.replaceRange(l,l,i),u.doc.eq(d))return;let f=u.doc.resolve(l);if(c&&re.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new re(f));else{let p=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((h,m,v,y)=>p=y),u.setSelection(Jy(t,f,u.doc.resolve(p)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}$t.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&br(t)},20))};$t.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};$t.beforeinput=(t,e)=>{if(yt&&mr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,No(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in zt)$t[t]=zt[t];function fl(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ic{constructor(e,n){this.toDOM=e,this.spec=n||Wo,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new It(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ic&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class uo{constructor(e,n){this.attrs=e,this.spec=n||Wo}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new It(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof uo&&fl(this.attrs,e.attrs)&&fl(this.spec,e.spec)}static is(e){return e.type instanceof uo}destroy(){}}class eg{constructor(e,n){this.attrs=e,this.spec=n||Wo}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new It(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof eg&&fl(this.attrs,e.attrs)&&fl(this.spec,e.spec)}destroy(){}}class It{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new It(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new It(e,e,new Ic(n,r))}static inline(e,n,r,o){return new It(e,n,new uo(r,o))}static node(e,n,r,o){return new It(e,n,new eg(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof uo}get widget(){return this.type instanceof Ic}}const Ti=[],Wo={};class Le{constructor(e,n){this.local=e.length?e:Ti,this.children=n.length?n:Ti}static create(e,n){return n.length?Pc(n,e,0,Wo):Nt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Wo)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let u=this.local[a].map(e,r,o);u&&u.type.valid(n,u)?(s||(s=[])).push(u):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?UF(this.children,s||[],e,n,r,o,i):s?new Le(s.sort(Ko),Ti):Nt}add(e,n){return n.length?this==Nt?Le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,u)=>{let l=u+r,c;if(c=jx(n,a,l)){for(o||(o=this.children.slice());i<o.length&&o[i]<u;)i+=3;o[i]==u?o[i+2]=o[i+2].addInner(a,c,l+1):o.splice(i,0,u,u+a.nodeSize,Pc(c,a,l+1,Wo)),i+=3}});let s=Dx(i?Lx(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Le(s.length?this.local.concat(s).sort(Ko):this.local,o||this.children)}remove(e){return e.length==0||this==Nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,u=r[i+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<u&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let l=r[i+2].removeInner(s,a+1);l!=Nt?r[i+2]=l:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Le(o,r):Nt}forChild(e,n){if(this==Nt)return this;if(n.isLeaf)return Le.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let u=this.local[a];if(u.from<s&&u.to>i&&u.type instanceof uo){let l=Math.max(i,u.from)-i,c=Math.min(s,u.to)-i;l<c&&(o||(o=[])).push(u.copy(l,c))}}if(o){let a=new Le(o.sort(Ko),Ti);return r?new Vr([a,r]):a}return r||Nt}eq(e){if(this==e)return!0;if(!(e instanceof Le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return tg(this.localsInner(e))}localsInner(e){if(this==Nt)return Ti;if(e.inlineContent||!this.local.some(uo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof uo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=tg;const Nt=Le.empty;class Vr{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Wo));return Vr.from(r)}forChild(e,n){if(n.isLeaf)return Le.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Nt&&(i instanceof Vr?r=r.concat(i.members):r.push(i))}return Vr.from(r)}eq(e){if(!(e instanceof Vr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?tg(r?n:n.sort(Ko)):Ti}static from(e){switch(e.length){case 0:return Nt;case 1:return e[0];default:return new Vr(e.every(n=>n instanceof Le)?e:e.reduce((n,r)=>n.concat(r instanceof Le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function UF(t,e,n,r,o,i,s){let a=t.slice();for(let l=0,c=i;l<n.maps.length;l++){let d=0;n.maps[l].forEach((f,p,h,m)=>{let v=m-h-(p-f);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||f>w+c-d)continue;let b=a[y]+c-d;p>=b?a[y+1]=f<=b?-2:-1:f>=c&&v&&(a[y]+=v,a[y+1]+=v)}d+=v}),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(a[l+1]==-2){u=!0,a[l+1]=-1;continue}let c=n.map(t[l]+i),d=c-o;if(d<0||d>=r.content.size){u=!0;continue}let f=n.map(t[l+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),v=r.maybeChild(h);if(v&&m==d&&m+v.nodeSize==p){let y=a[l+2].mapInner(n,v,c+1,t[l]+i+1,s);y!=Nt?(a[l]=d,a[l+1]=p,a[l+2]=y):(a[l+1]=-2,u=!0)}else u=!0}if(u){let l=VF(a,t,e,n,o,i,s),c=Pc(l,r,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let p=c.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Le(e.sort(Ko),a)}function Dx(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new It(o.from+e,o.to+e,o.type))}return n}function VF(t,e,n,r,o,i,s){function a(u,l){for(let c=0;c<u.local.length;c++){let d=u.local[c].map(r,o,l);d?n.push(d):s.onRemove&&s.onRemove(u.local[c].spec)}for(let c=0;c<u.children.length;c+=3)a(u.children[c+2],u.children[c]+l+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&a(t[u+2],e[u]+i+1);return n}function jx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Lx(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Pc(t,e,n,r){let o=[],i=!1;e.forEach((a,u)=>{let l=jx(t,a,u+n);if(l){i=!0;let c=Pc(l,a,n+u+1,r);c!=Nt&&o.push(u,u+a.nodeSize,c)}});let s=Dx(i?Lx(t):t,-n).sort(Ko);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Le(s,o):Nt}function Ko(t,e){return t.from-e.from||t.to-e.to}function tg(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),$1(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),$1(e,o,r.copy(i.from,r.to)));break}}}return e}function $1(t,e,n){for(;e<t.length&&Ko(n,t[e])>0;)e++;t.splice(e,0,n)}function ep(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Nt&&e.push(r)}),t.cursorWrapper&&e.push(Le.create(t.state.doc,[t.cursorWrapper.deco])),Vr.from(e)}const qF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},HF=Zt&&ao<=11;class WF{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class KF{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new WF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Zt&&ao<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),HF&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,qF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(I1(this.view)){if(this.suppressingSelectionUpdates)return br(this.view);if(Zt&&ao<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ai(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Ss(i))n.add(i);for(let i=e.anchorNode;i;i=Ss(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&I1(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,u=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],u);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(xn&&u.length){let c=u.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||YF(e,d)!=p)&&f.remove()}}}else if((yt||Rt)&&u.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of u)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let l=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vd(r)&&(l=Gy(e))&&l.eq(me.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,br(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),GF(e)),this.handleDOMChange(i,s,a,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||br(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(Zt&&ao<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?xt(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),u=i&&i.parentNode==e.target?xt(i):e.target.childNodes.length,l=r.localPosFromDOM(e.target,u,1);return{from:a,to:l}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let z1=new WeakMap,U1=!1;function GF(t){if(!z1.has(t)&&(z1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=xn,U1)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),U1=!0}}function V1(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ai(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function JF(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return V1(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?V1(t,n):null}function YF(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function QF(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),l,c=u.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:u.anchorOffset}],Vd(u)||l.push({node:u.focusNode,offset:u.focusOffset})),yt&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let y=r.childNodes[v-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=v;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||so.fromSchema(t.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:XF,context:p});if(l&&l[0].pos!=null){let v=l[0].pos,y=l[1]&&l[1].pos;y==null&&(y=v),h={anchor:v+s,head:y+s}}return{doc:m,sel:h,from:s,to:a}}function XF(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Rt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Rt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ZF=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function e$(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let x=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=Gy(t,x);if(T&&!t.state.selection.eq(T)){if(yt&&mr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,No(13,"Enter"))))return;let O=t.state.tr.setSelection(T);x=="pointer"?O.setMeta("pointer",!0):x=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let u=t.state.selection,l=QF(t,e,n),c=t.state.doc,d=c.slice(l.from,l.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=r$(d.content,l.doc.content,l.from,f,p);if(h&&t.input.domChangeCount++,(ks&&t.input.lastIOSEnter>Date.now()-225||mr)&&o.some(x=>x.nodeType==1&&!ZF.test(x.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",x=>x(t,No(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&u instanceof ce&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))h={start:u.from,endA:u.to,endB:u.to};else{if(l.sel){let x=q1(t,t.state.doc,l.sel);if(x&&!x.eq(t.state.selection)){let T=t.state.tr.setSelection(x);i&&T.setMeta("composition",i),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof ce&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),Zt&&ao<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>l.from&&l.doc.textBetween(h.start-l.from-1,h.start-l.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=l.doc.resolveNoCache(h.start-l.from),v=l.doc.resolveNoCache(h.endB-l.from),y=c.resolve(h.start),w=m.sameParent(v)&&m.parent.inlineContent&&y.end()>=h.endA;if((ks&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!w&&m.pos<l.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(l.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",x=>x(t,No(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&n$(c,h.start,h.endA,m,v)&&t.someProp("handleKeyDown",x=>x(t,No(8,"Backspace")))){mr&&yt&&t.domObserver.suppressSelectionUpdates();return}yt&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),mr&&!w&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==h.endA&&(h.endB-=2,v=l.doc.resolveNoCache(h.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(x){return x(t,No(13,"Enter"))})},20));let b=h.start,S=h.endA,k=x=>{let T=x||t.state.tr.replace(b,S,l.doc.slice(h.start-l.from,h.endB-l.from));if(l.sel){let O=q1(t,T.doc,l.sel);O&&!(yt&&t.composing&&O.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==b||O.head==T.mapping.map(S)-1)||Zt&&O.empty&&O.head==b)&&T.setSelection(O)}return i&&T.setMeta("composition",i),T.scrollIntoView()},E;if(w)if(m.pos==v.pos){Zt&&ao<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>br(t),20));let x=k(t.state.tr.delete(b,S)),T=c.resolve(h.start).marksAcross(c.resolve(h.endA));T&&x.ensureMarks(T),t.dispatch(x)}else if(h.endA==h.endB&&(E=t$(m.parent.content.cut(m.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let x=k(t.state.tr);E.type=="add"?x.addMark(b,S,E.mark):x.removeMark(b,S,E.mark),t.dispatch(x)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let x=m.parent.textBetween(m.parentOffset,v.parentOffset),T=()=>k(t.state.tr.insertText(x,b,S));t.someProp("handleTextInput",O=>O(t,b,S,x,T))||t.dispatch(T())}else t.dispatch(k());else t.dispatch(k())}function q1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jy(t,e.resolve(n.anchor),e.resolve(n.head))}function t$(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,u;for(let c=0;c<r.length;c++)o=r[c].removeFromSet(o);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",u=c=>c.mark(a.addToSet(c.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",u=c=>c.mark(a.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(u(e.child(c)));if(U.from(l).eq(t))return{mark:a,type:s}}function n$(t,e,n,r,o){if(n-e<=o.pos-r.pos||tp(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(tp(i,!0,!0));return!s.parent.isTextblock||s.pos>n||tp(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function tp(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function r$(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let u=Math.max(0,i-Math.min(s,a));r-=s+u-i}if(s<i&&t.size<e.size){let u=r<=i&&r>=s?i-r:0;i-=u,i&&i<e.size&&H1(e.textBetween(i-1,i+1))&&(i+=u?1:-1),a=i+(a-s),s=i}else if(a<i){let u=r<=i&&r>=a?i-r:0;i-=u,i&&i<t.size&&H1(t.textBetween(i-1,i+1))&&(i+=u?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function H1(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Bx{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new bF,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Y1),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=G1(this),K1(this),this.nodeViews=J1(this),this.docView=T1(this.state.doc,W1(this),ep(this),this.dom,this),this.domObserver=new KF(this,(r,o,i,s)=>e$(this,r,o,i,s)),this.domObserver.start(),_F(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&cm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Y1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Ax(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=J1(this);i$(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&cm(this),this.editable=G1(this),K1(this);let u=ep(this),l=W1(this),c=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,u);(d||!e.selection.eq(o.selection))&&(s=!0);let f=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&DB(this);if(s){this.domObserver.stop();let p=d&&(Zt||yt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&o$(o.selection,e.selection);if(d){let h=yt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=DF(this)),(i||!this.docView.update(e.doc,l,u,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=T1(e.doc,l,u,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iF(this))?br(this,p):(wx(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&jB(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof re){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&b1(this,n.getBoundingClientRect(),e)}else b1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Px(e.slice,e.move,o<0?void 0:re.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Zt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&LB(this.dom),br(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return UB(this,e)}coordsAtPos(e,n=1){return dx(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return KB(this,n||this.state,e)}pasteHTML(e,n){return dl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return dl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yy(this,e)}destroy(){this.docView&&(SF(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ep(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,EB())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xF(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rt&&this.root.nodeType===11&&NB(this.dom.ownerDocument)==this.dom&&JF(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Bx.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function W1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[It.node(0,t.state.doc.content.size,e)]}function K1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:It.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function G1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function o$(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function J1(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function i$(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Y1(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var po={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Rc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s$=typeof navigator<"u"&&/Mac/.test(navigator.platform),a$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Et=0;Et<10;Et++)po[48+Et]=po[96+Et]=String(Et);for(var Et=1;Et<=24;Et++)po[Et+111]="F"+Et;for(var Et=65;Et<=90;Et++)po[Et]=String.fromCharCode(Et+32),Rc[Et]=String.fromCharCode(Et);for(var np in po)Rc.hasOwnProperty(np)||(Rc[np]=po[np]);function l$(t){var e=s$&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||a$&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Rc:po)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const u$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),c$=typeof navigator<"u"&&/Win/.test(navigator.platform);function d$(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a++){let u=e[a];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))u$?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function f$(t){let e=Object.create(null);for(let n in t)e[d$(n)]=t[n];return e}function rp(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function p$(t){return new ze({props:{handleKeyDown:Fx(t)}})}function Fx(t){let e=f$(t);return function(n,r){let o=l$(r),i,s=e[rp(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[rp(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(c$&&r.ctrlKey&&r.altKey)&&(i=po[r.keyCode])&&i!=o){let a=e[rp(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var h$=Object.defineProperty,ng=(t,e)=>{for(var n in e)h$(t,n,{get:e[n],enumerable:!0})};function Wd(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Kd=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...l)=>{const c=a(...l)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,u=t||o.tr,l=()=>(!a&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...h)=>{const m=this.buildProps(u,e),v=f(...h)(m);return s.push(v),c}])),run:l};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,u])=>[a,(...l)=>u(...l)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:Wd({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,u])=>[a,(...l)=>u(...l)(s)]))}};return s}},$x={};ng($x,{blur:()=>m$,clearContent:()=>y$,clearNodes:()=>g$,command:()=>v$,createParagraphNear:()=>w$,cut:()=>b$,deleteCurrentNode:()=>_$,deleteNode:()=>S$,deleteRange:()=>k$,deleteSelection:()=>x$,enter:()=>E$,exitCode:()=>T$,extendMarkRange:()=>C$,first:()=>M$,focus:()=>O$,forEach:()=>N$,insertContent:()=>A$,insertContentAt:()=>R$,joinBackward:()=>L$,joinDown:()=>j$,joinForward:()=>B$,joinItemBackward:()=>F$,joinItemForward:()=>$$,joinTextblockBackward:()=>z$,joinTextblockForward:()=>U$,joinUp:()=>D$,keyboardShortcut:()=>q$,lift:()=>H$,liftEmptyBlock:()=>W$,liftListItem:()=>K$,newlineInCode:()=>G$,resetAttributes:()=>J$,scrollIntoView:()=>Y$,selectAll:()=>Q$,selectNodeBackward:()=>X$,selectNodeForward:()=>Z$,selectParentNode:()=>e6,selectTextblockEnd:()=>t6,selectTextblockStart:()=>n6,setContent:()=>r6,setMark:()=>k6,setMeta:()=>x6,setNode:()=>E6,setNodeSelection:()=>T6,setTextDirection:()=>C6,setTextSelection:()=>M6,sinkListItem:()=>O6,splitBlock:()=>N6,splitListItem:()=>A6,toggleList:()=>I6,toggleMark:()=>P6,toggleNode:()=>R6,toggleWrap:()=>D6,undoInputRule:()=>j6,unsetAllMarks:()=>L6,unsetMark:()=>B6,unsetTextDirection:()=>F6,updateAttributes:()=>$6,wrapIn:()=>z6,wrapInList:()=>U6});var m$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),y$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),g$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,u)=>{if(a.type.isText)return;const{doc:l,mapping:c}=e,d=l.resolve(c.map(u)),f=l.resolve(c.map(u+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Ns(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},v$=t=>e=>t(e),w$=()=>({state:t,dispatch:e})=>ex(t,e),b$=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new ce(r.doc.resolve(Math.max(s-1,0)))),!0},_$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const a=o.before(i),u=o.after(i);t.delete(a,u).scrollIntoView()}return!0}return!1};function at(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var S$=t=>({tr:e,state:n,dispatch:r})=>{const o=at(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const u=i.before(s),l=i.after(s);e.delete(u,l).scrollIntoView()}return!0}return!1},k$=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},x$=()=>({state:t,dispatch:e})=>Uy(t,e),E$=()=>({commands:t})=>t.keyboardShortcut("Enter"),T$=()=>({state:t,dispatch:e})=>cB(t,e);function rg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Dc(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:rg(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function zx(t,e,n={}){return t.find(r=>r.type===e&&Dc(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Q1(t,e,n={}){return!!zx(t,e,n)}function og(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(c=>c.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(c=>c.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!zx([...o.node.marks],e,n)))return;let s=o.index,a=t.start()+o.offset,u=s+1,l=a+o.node.nodeSize;for(;s>0&&Q1([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;u<t.parent.childCount&&Q1([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:l}}function Or(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var C$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Or(t,r.schema),{doc:s,selection:a}=n,{$from:u,from:l,to:c}=a;if(o){const d=og(u,i,e);if(d&&d.from<=l&&d.to>=c){const f=ce.create(s,d.from,d.to);n.setSelection(f)}}return!0},M$=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ux(t){return t instanceof ce}function Bo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Vx(t,e=null){if(!e)return null;const n=me.atStart(t),r=me.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?ce.create(t,Bo(0,o,i),Bo(t.content.size,o,i)):ce.create(t,Bo(e,o,i),Bo(e,o,i))}function qx(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Gd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var O$=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Gd()||qx())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!Ux(n.state.selection))return s(),!0;const a=Vx(o.doc,t)||n.state.selection,u=n.state.selection.eq(a);return i&&(u||o.setSelection(a),u&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},N$=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),A$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Hx=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Hx(r)}return t};function ou(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Hx(n)}function pl(t,e,n){if(t instanceof kn||t instanceof U)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return U.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),pl("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const u=new Ck({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(s=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?so.fromSchema(u).parseSlice(ou(t),n.parseOptions):so.fromSchema(u).parse(ou(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=so.fromSchema(e);return n.slice?i.parseSlice(ou(t),n.parseOptions).content:i.parse(ou(t),n.parseOptions)}return pl("",e,n)}function I$(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof mt||o instanceof vt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,u,l,c)=>{s===0&&(s=c)}),t.setSelection(me.near(t.doc.resolve(s),n))}var P$=t=>!("type"in t),R$=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{pl(e,i.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(v){u(v)}try{a=pl(e,i.schema,{parseOptions:l,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((P$(a)?a:[a]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,p=p?v.isBlock:!1}),c===d&&p){const{parent:v}=r.doc.resolve(c);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof U){let v="";e.forEach(y=>{y.text&&(v+=y.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else{m=a;const v=r.doc.resolve(c),y=v.node(),w=v.parentOffset===0,b=y.isText||y.isTextblock,S=y.content.size>0;w&&b&&S&&(c=Math.max(0,c-1)),r.replaceWith(c,d,m)}n.updateSelection&&I$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},D$=()=>({state:t,dispatch:e})=>aB(t,e),j$=()=>({state:t,dispatch:e})=>lB(t,e),L$=()=>({state:t,dispatch:e})=>Kk(t,e),B$=()=>({state:t,dispatch:e})=>Qk(t,e),F$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$d(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$d(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},z$=()=>({state:t,dispatch:e})=>iB(t,e),U$=()=>({state:t,dispatch:e})=>sB(t,e);function Wx(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function V$(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a+=1){const u=e[a];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))Gd()||Wx()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var q$=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=V$(t).split(/-(?!$)/),s=i.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return u==null||u.steps.forEach(l=>{const c=l.map(r.mapping);c&&o&&r.maybeStep(c)}),!0};function ho(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?at(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(o,f+d.nodeSize);a.push({node:d,from:p,to:h})});const u=o-r,l=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Dc(d.node.attrs,n,{strict:!1}));return i?!!l.length:l.reduce((d,f)=>d+f.to-f.from,0)>=u}var H$=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return ho(n,o,e)?uB(n,r):!1},W$=()=>({state:t,dispatch:e})=>tx(t,e),K$=t=>({state:e,dispatch:n})=>{const r=at(t,e.schema);return _B(r)(e,n)},G$=()=>({state:t,dispatch:e})=>Zk(t,e);function Jd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function X1(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var J$=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Jd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Or(t,r.schema));let u=!1;return n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{i&&i===c.type&&(u=!0,o&&n.setNodeMarkup(d,void 0,X1(c.attrs,e))),s&&c.marks.length&&c.marks.forEach(f=>{s===f.type&&(u=!0,o&&n.addMark(d,d+c.nodeSize,s.create(X1(f.attrs,e))))})})}),u},Y$=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Q$=()=>({tr:t,dispatch:e})=>{if(e){const n=new an(t.doc);t.setSelection(n)}return!0},X$=()=>({state:t,dispatch:e})=>Jk(t,e),Z$=()=>({state:t,dispatch:e})=>Xk(t,e),e6=()=>({state:t,dispatch:e})=>pB(t,e),t6=()=>({state:t,dispatch:e})=>yB(t,e),n6=()=>({state:t,dispatch:e})=>mB(t,e);function dm(t,e,n={},r={}){return pl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var r6=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const l=dm(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,u.content.size,l).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function Kx(t,e){const n=Or(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,u=>{s.push(...u.marks)});const a=s.find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function Gx(t,e){const n=new Vk(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function o6(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function i6(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function s6(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Yd(t){return e=>s6(e.$from,t)}function oe(t,e,n){return t.config[e]===void 0&&t.parent?oe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?oe(t.parent,e,n):null}):t.config[e]}function ig(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=oe(e,"addExtensions",n);return r?[e,...ig(r())]:e}).flat(10)}function sg(t,e){const n=gi.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Jx(t){return typeof t=="function"}function Me(t,e=void 0,...n){return Jx(t)?e?t.bind(e)(...n):t(...n):t}function a6(t={}){return Object.keys(t).length===0&&t.constructor===Object}function xs(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Yx(t){const e=[],{nodeExtensions:n,markExtensions:r}=xs(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:o},u=oe(s,"addGlobalAttributes",a);if(!u)return;u().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...i,...p}})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},u=oe(s,"addAttributes",a);if(!u)return;const l=u();Object.entries(l).forEach(([c,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:c,attribute:f})})}),e}function $e(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const a=i?String(i).split(" "):[],u=r[o]?r[o].split(" "):[],l=a.filter(c=>!u.includes(c));r[o]=[...u,...l].join(" ")}else if(o==="style"){const a=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],u=r[o]?r[o].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;u.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());l.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());l.set(d,f)}),r[o]=Array.from(l.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[o]=i}),r},{})}function hl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>$e(n,r),{})}function l6(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Z1(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):l6(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function ew(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&a6(n)?!1:n!=null))}function tw(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function u6(t,e){var n;const r=Yx(t),{nodeExtensions:o,markExtensions:i}=xs(t),s=(n=o.find(l=>oe(l,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(l=>{const c=r.filter(y=>y.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},f=t.reduce((y,w)=>{const b=oe(w,"extendNodeSchema",d);return{...y,...b?b(l):{}}},{}),p=ew({...f,content:Me(oe(l,"content",d)),marks:Me(oe(l,"marks",d)),group:Me(oe(l,"group",d)),inline:Me(oe(l,"inline",d)),atom:Me(oe(l,"atom",d)),selectable:Me(oe(l,"selectable",d)),draggable:Me(oe(l,"draggable",d)),code:Me(oe(l,"code",d)),whitespace:Me(oe(l,"whitespace",d)),linebreakReplacement:Me(oe(l,"linebreakReplacement",d)),defining:Me(oe(l,"defining",d)),isolating:Me(oe(l,"isolating",d)),attrs:Object.fromEntries(c.map(tw))}),h=Me(oe(l,"parseHTML",d));h&&(p.parseDOM=h.map(y=>Z1(y,c)));const m=oe(l,"renderHTML",d);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:hl(y,c)}));const v=oe(l,"renderText",d);return v&&(p.toText=v),[l.name,p]})),u=Object.fromEntries(i.map(l=>{const c=r.filter(v=>v.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},f=t.reduce((v,y)=>{const w=oe(y,"extendMarkSchema",d);return{...v,...w?w(l):{}}},{}),p=ew({...f,inclusive:Me(oe(l,"inclusive",d)),excludes:Me(oe(l,"excludes",d)),group:Me(oe(l,"group",d)),spanning:Me(oe(l,"spanning",d)),code:Me(oe(l,"code",d)),attrs:Object.fromEntries(c.map(tw))}),h=Me(oe(l,"parseHTML",d));h&&(p.parseDOM=h.map(v=>Z1(v,c)));const m=oe(l,"renderHTML",d);return m&&(p.toDOM=v=>m({mark:v,HTMLAttributes:hl(v,c)})),[l.name,p]}));return new Ck({topNode:s,nodes:a,marks:u})}function c6(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ag(t){return t.sort((n,r)=>{const o=oe(n,"priority")||100,i=oe(r,"priority")||100;return o>i?-1:o<i?1:0})}function Qx(t){const e=ag(ig(t)),n=c6(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Xx(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
|
|
73
|
+
`))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:p}=t.state,h=gi.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let v=s.appendChild(document.createElement("p"));m&&v.appendChild(h.serializeNode(p.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=yF(n),El&&gF(s);let l=s&&s.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||so.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(u||c),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!pF.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=vF(B1(a,+c[1],+c[2]),c[4]);else if(a=J.maxOpen(hF(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=B1(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,u)}),a}const pF=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function hF(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let u=o.findWrapping(a.type),l;if(!u)return s=null;if(l=s.length&&i.length&&xx(u,i,a,s[s.length-1],0))s[s.length-1]=l;else{s.length&&(s[s.length-1]=Ex(s[s.length-1],i.length));let c=kx(a,u);s.push(c),o=o.matchType(c.type),i=u}}),s)return U.from(s)}return t}function kx(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,U.from(t));return t}function xx(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=xx(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(U.from(kx(n,t,o+1))))}}function Ex(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ex(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(U.empty,!0);return t.copy(n.append(r))}function um(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=um(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(U.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function B1(t,e,n){return e<t.openStart&&(t=new J(um(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new J(um(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Tx={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let F1=null;function Cx(){return F1||(F1=document.implementation.createHTMLDocument("title"))}let Zf=null;function mF(t){let e=window.trustedTypes;return e?(Zf||(Zf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Zf.createHTML(t)):t}function yF(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Cx().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Tx[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=mF(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function gF(t){let e=t.querySelectorAll(yt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function vF(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let u=n.nodes[r[a]];if(!u||u.hasRequiredAttrs())break;o=U.from(u.create(r[a+1],o)),i++,s++}return new J(o,i,s)}const zt={},Ut={},wF={touchstart:!0,touchmove:!0};class bF{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _F(t){for(let e in zt){let n=zt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{kF(t,r)&&!Qy(t,r)&&(t.editable||!(r.type in Ut))&&n(t,r)},wF[e]?{passive:!0}:void 0)}Rt&&t.dom.addEventListener("input",()=>null),cm(t)}function Yr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function SF(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function cm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Qy(t,r))})}function Qy(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function kF(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function xF(t,e){!Qy(t,e)&&zt[e.type]&&(t.editable||!(e.type in Ut))&&zt[e.type](t,e)}Ut.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ox(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(mr&&yt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ks&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,No(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||fF(t,n)?n.preventDefault():Yr(t,"key")};Ut.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ut.keypress=(t,e)=>{let n=e;if(Ox(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||yn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ce)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function Hd(t){return{left:t.clientX,top:t.clientY}}function EF(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Xy(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function ls(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function TF(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&re.isSelectable(r)?(ls(t,new re(n)),!0):!1}function CF(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof re&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(re.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(ls(t,re.create(t.state.doc,o)),!0):!1}function MF(t,e,n,r,o){return Xy(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?CF(t,n):TF(t,n))}function OF(t,e,n,r){return Xy(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function NF(t,e,n,r){return Xy(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||AF(t,n,r)}function AF(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ls(t,ce.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)ls(t,ce.create(r,a+1,a+1+s.content.size));else if(re.isSelectable(s))ls(t,re.create(r,a));else continue;return!0}}function Zy(t){return Ac(t)}const Mx=yn?"metaKey":"ctrlKey";zt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Zy(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&EF(n,t.input.lastClick)&&!n[Mx]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Hd(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new IF(t,s,n,!!r)):(i=="doubleClick"?OF:NF)(t,s.pos,s.inside,n)?n.preventDefault():Yr(t,"pointer"))};class IF{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Mx],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}const a=o?null:r.target,u=a?e.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:l}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||l instanceof re&&l.from<=s&&l.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Yr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>br(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Hd(e))),this.updateAllowDefault(e),this.allowDefault||!n?Yr(this.view,"pointer"):MF(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rt&&this.mightDrag&&!this.mightDrag.node.isAtom||yt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ls(this.view,me.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Yr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zt.touchstart=t=>{t.input.lastTouch=Date.now(),Zy(t),Yr(t,"pointer")};zt.touchmove=t=>{t.input.lastTouch=Date.now(),Yr(t,"pointer")};zt.contextmenu=t=>Zy(t);function Ox(t,e){return t.composing?!0:Rt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const PF=mr?5e3:-1;Ut.compositionstart=Ut.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ce&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||yt&&sx&&RF(t)))t.markCursor=t.state.storedMarks||n.marks(),Ac(t,!0),t.markCursor=null;else if(Ac(t,!e.selection.empty),xn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}Nx(t,PF)};function RF(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Ut.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Nx(t,20))};function Nx(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ac(t),e))}function Ax(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=jF());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function DF(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=CB(e.focusNode,e.focusOffset),r=MB(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function jF(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ac(t,e=!1){if(!(mr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ax(t),e||t.docView&&t.docView.dirty){let n=Gy(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function LF(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cl=Zt&&ao<15||ks&&IB<604;zt.copy=Ut.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=cl?null:n.clipboardData,s=r.content(),{dom:a,text:u}=Yy(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",u)):LF(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function BF(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function FF(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?dl(t,r.value,null,o,e):dl(t,r.textContent,r.innerHTML,o,e)},50)}function dl(t,e,n,r,o){let i=Sx(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,o,i||J.empty)))return!0;if(!i)return!1;let s=BF(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ix(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Ut.paste=(t,e)=>{let n=e;if(t.composing&&!mr)return;let r=cl?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&dl(t,Ix(r),r.getData("text/html"),o,n)?n.preventDefault():FF(t,n)};class Px{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const $F=yn?"altKey":"ctrlKey";function Rx(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[$F]}zt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Hd(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof re?o.to-1:o.to))){if(r&&r.mightDrag)s=re.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=re.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:u,text:l,slice:c}=Yy(t,a);(!n.dataTransfer.files.length||!yt||ix>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cl?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",cl||n.dataTransfer.setData("text/plain",l),t.dragging=new Px(c,Rx(t,n),s)};zt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ut.dragover=Ut.dragenter=(t,e)=>e.preventDefault();Ut.drop=(t,e)=>{try{zF(t,e,t.dragging)}finally{t.dragging=null}};function zF(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Hd(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",p=>{i=p(i,t,!1)}):i=Sx(t,Ix(e.dataTransfer),cl?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&Rx(t,e));if(t.someProp("handleDrop",p=>p(t,e,i||J.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?Bk(t.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let u=t.state.tr;if(s){let{node:p}=n;p?p.replace(u):u.deleteSelection()}let l=u.mapping.map(a),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=u.doc;if(c?u.replaceRangeWith(l,l,i.content.firstChild):u.replaceRange(l,l,i),u.doc.eq(d))return;let f=u.doc.resolve(l);if(c&&re.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new re(f));else{let p=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((h,m,v,y)=>p=y),u.setSelection(Jy(t,f,u.doc.resolve(p)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}zt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&br(t)},20))};zt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};zt.beforeinput=(t,e)=>{if(yt&&mr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,No(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Ut)zt[t]=Ut[t];function fl(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ic{constructor(e,n){this.toDOM=e,this.spec=n||Wo,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new It(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ic&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class uo{constructor(e,n){this.attrs=e,this.spec=n||Wo}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new It(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof uo&&fl(this.attrs,e.attrs)&&fl(this.spec,e.spec)}static is(e){return e.type instanceof uo}destroy(){}}class eg{constructor(e,n){this.attrs=e,this.spec=n||Wo}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new It(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof eg&&fl(this.attrs,e.attrs)&&fl(this.spec,e.spec)}destroy(){}}class It{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new It(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new It(e,e,new Ic(n,r))}static inline(e,n,r,o){return new It(e,n,new uo(r,o))}static node(e,n,r,o){return new It(e,n,new eg(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof uo}get widget(){return this.type instanceof Ic}}const Ti=[],Wo={};class Le{constructor(e,n){this.local=e.length?e:Ti,this.children=n.length?n:Ti}static create(e,n){return n.length?Pc(n,e,0,Wo):Nt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Nt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Wo)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let u=this.local[a].map(e,r,o);u&&u.type.valid(n,u)?(s||(s=[])).push(u):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?UF(this.children,s||[],e,n,r,o,i):s?new Le(s.sort(Ko),Ti):Nt}add(e,n){return n.length?this==Nt?Le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,u)=>{let l=u+r,c;if(c=jx(n,a,l)){for(o||(o=this.children.slice());i<o.length&&o[i]<u;)i+=3;o[i]==u?o[i+2]=o[i+2].addInner(a,c,l+1):o.splice(i,0,u,u+a.nodeSize,Pc(c,a,l+1,Wo)),i+=3}});let s=Dx(i?Lx(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Le(s.length?this.local.concat(s).sort(Ko):this.local,o||this.children)}remove(e){return e.length==0||this==Nt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,u=r[i+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<u&&(e[c]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let l=r[i+2].removeInner(s,a+1);l!=Nt?r[i+2]=l:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Le(o,r):Nt}forChild(e,n){if(this==Nt)return this;if(n.isLeaf)return Le.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let u=this.local[a];if(u.from<s&&u.to>i&&u.type instanceof uo){let l=Math.max(i,u.from)-i,c=Math.min(s,u.to)-i;l<c&&(o||(o=[])).push(u.copy(l,c))}}if(o){let a=new Le(o.sort(Ko),Ti);return r?new Vr([a,r]):a}return r||Nt}eq(e){if(this==e)return!0;if(!(e instanceof Le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return tg(this.localsInner(e))}localsInner(e){if(this==Nt)return Ti;if(e.inlineContent||!this.local.some(uo.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof uo||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=tg;const Nt=Le.empty;class Vr{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Wo));return Vr.from(r)}forChild(e,n){if(n.isLeaf)return Le.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Nt&&(i instanceof Vr?r=r.concat(i.members):r.push(i))}return Vr.from(r)}eq(e){if(!(e instanceof Vr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?tg(r?n:n.sort(Ko)):Ti}static from(e){switch(e.length){case 0:return Nt;case 1:return e[0];default:return new Vr(e.every(n=>n instanceof Le)?e:e.reduce((n,r)=>n.concat(r instanceof Le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function UF(t,e,n,r,o,i,s){let a=t.slice();for(let l=0,c=i;l<n.maps.length;l++){let d=0;n.maps[l].forEach((f,p,h,m)=>{let v=m-h-(p-f);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||f>w+c-d)continue;let b=a[y]+c-d;p>=b?a[y+1]=f<=b?-2:-1:f>=c&&v&&(a[y]+=v,a[y+1]+=v)}d+=v}),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(a[l+1]==-2){u=!0,a[l+1]=-1;continue}let c=n.map(t[l]+i),d=c-o;if(d<0||d>=r.content.size){u=!0;continue}let f=n.map(t[l+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),v=r.maybeChild(h);if(v&&m==d&&m+v.nodeSize==p){let y=a[l+2].mapInner(n,v,c+1,t[l]+i+1,s);y!=Nt?(a[l]=d,a[l+1]=p,a[l+2]=y):(a[l+1]=-2,u=!0)}else u=!0}if(u){let l=VF(a,t,e,n,o,i,s),c=Pc(l,r,0,s);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let p=c.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Le(e.sort(Ko),a)}function Dx(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new It(o.from+e,o.to+e,o.type))}return n}function VF(t,e,n,r,o,i,s){function a(u,l){for(let c=0;c<u.local.length;c++){let d=u.local[c].map(r,o,l);d?n.push(d):s.onRemove&&s.onRemove(u.local[c].spec)}for(let c=0;c<u.children.length;c+=3)a(u.children[c+2],u.children[c]+l+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&a(t[u+2],e[u]+i+1);return n}function jx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Lx(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Pc(t,e,n,r){let o=[],i=!1;e.forEach((a,u)=>{let l=jx(t,a,u+n);if(l){i=!0;let c=Pc(l,a,n+u+1,r);c!=Nt&&o.push(u,u+a.nodeSize,c)}});let s=Dx(i?Lx(t):t,-n).sort(Ko);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Le(s,o):Nt}function Ko(t,e){return t.from-e.from||t.to-e.to}function tg(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),$1(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),$1(e,o,r.copy(i.from,r.to)));break}}}return e}function $1(t,e,n){for(;e<t.length&&Ko(n,t[e])>0;)e++;t.splice(e,0,n)}function ep(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Nt&&e.push(r)}),t.cursorWrapper&&e.push(Le.create(t.state.doc,[t.cursorWrapper.deco])),Vr.from(e)}const qF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},HF=Zt&&ao<=11;class WF{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class KF{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new WF,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Zt&&ao<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),HF&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,qF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(I1(this.view)){if(this.suppressingSelectionUpdates)return br(this.view);if(Zt&&ao<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ai(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Ss(i))n.add(i);for(let i=e.anchorNode;i;i=Ss(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&I1(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,u=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],u);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(xn&&u.length){let c=u.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||YF(e,d)!=p)&&f.remove()}}}else if((yt||Rt)&&u.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of u)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let l=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Vd(r)&&(l=Gy(e))&&l.eq(me.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,br(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),GF(e)),this.handleDOMChange(i,s,a,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||br(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(Zt&&ao<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?xt(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),u=i&&i.parentNode==e.target?xt(i):e.target.childNodes.length,l=r.localPosFromDOM(e.target,u,1);return{from:a,to:l}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let z1=new WeakMap,U1=!1;function GF(t){if(!z1.has(t)&&(z1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=xn,U1)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),U1=!0}}function V1(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ai(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function JF(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return V1(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?V1(t,n):null}function YF(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function QF(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),l,c=u.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:u.anchorOffset}],Vd(u)||l.push({node:u.focusNode,offset:u.focusOffset})),yt&&t.input.lastKeyCode===8)for(let v=i;v>o;v--){let y=r.childNodes[v-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=v;break}if(!w||w.size)break}let d=t.state.doc,f=t.someProp("domParser")||so.fromSchema(t.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:XF,context:p});if(l&&l[0].pos!=null){let v=l[0].pos,y=l[1]&&l[1].pos;y==null&&(y=v),h={anchor:v+s,head:y+s}}return{doc:m,sel:h,from:s,to:a}}function XF(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Rt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Rt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ZF=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function e$(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let x=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=Gy(t,x);if(T&&!t.state.selection.eq(T)){if(yt&&mr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,No(13,"Enter"))))return;let O=t.state.tr.setSelection(T);x=="pointer"?O.setMeta("pointer",!0):x=="key"&&O.scrollIntoView(),i&&O.setMeta("composition",i),t.dispatch(O)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let u=t.state.selection,l=QF(t,e,n),c=t.state.doc,d=c.slice(l.from,l.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=r$(d.content,l.doc.content,l.from,f,p);if(h&&t.input.domChangeCount++,(ks&&t.input.lastIOSEnter>Date.now()-225||mr)&&o.some(x=>x.nodeType==1&&!ZF.test(x.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",x=>x(t,No(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&u instanceof ce&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))h={start:u.from,endA:u.to,endB:u.to};else{if(l.sel){let x=q1(t,t.state.doc,l.sel);if(x&&!x.eq(t.state.selection)){let T=t.state.tr.setSelection(x);i&&T.setMeta("composition",i),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof ce&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),Zt&&ao<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>l.from&&l.doc.textBetween(h.start-l.from-1,h.start-l.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=l.doc.resolveNoCache(h.start-l.from),v=l.doc.resolveNoCache(h.endB-l.from),y=c.resolve(h.start),w=m.sameParent(v)&&m.parent.inlineContent&&y.end()>=h.endA;if((ks&&t.input.lastIOSEnter>Date.now()-225&&(!w||o.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!w&&m.pos<l.doc.content.size&&(!m.sameParent(v)||!m.parent.inlineContent)&&m.pos<v.pos&&!/\S/.test(l.doc.textBetween(m.pos,v.pos,"","")))&&t.someProp("handleKeyDown",x=>x(t,No(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&n$(c,h.start,h.endA,m,v)&&t.someProp("handleKeyDown",x=>x(t,No(8,"Backspace")))){mr&&yt&&t.domObserver.suppressSelectionUpdates();return}yt&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),mr&&!w&&m.start()!=v.start()&&v.parentOffset==0&&m.depth==v.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==h.endA&&(h.endB-=2,v=l.doc.resolveNoCache(h.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(x){return x(t,No(13,"Enter"))})},20));let b=h.start,S=h.endA,k=x=>{let T=x||t.state.tr.replace(b,S,l.doc.slice(h.start-l.from,h.endB-l.from));if(l.sel){let O=q1(t,T.doc,l.sel);O&&!(yt&&t.composing&&O.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(O.head==b||O.head==T.mapping.map(S)-1)||Zt&&O.empty&&O.head==b)&&T.setSelection(O)}return i&&T.setMeta("composition",i),T.scrollIntoView()},E;if(w)if(m.pos==v.pos){Zt&&ao<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>br(t),20));let x=k(t.state.tr.delete(b,S)),T=c.resolve(h.start).marksAcross(c.resolve(h.endA));T&&x.ensureMarks(T),t.dispatch(x)}else if(h.endA==h.endB&&(E=t$(m.parent.content.cut(m.parentOffset,v.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start())))){let x=k(t.state.tr);E.type=="add"?x.addMark(b,S,E.mark):x.removeMark(b,S,E.mark),t.dispatch(x)}else if(m.parent.child(m.index()).isText&&m.index()==v.index()-(v.textOffset?0:1)){let x=m.parent.textBetween(m.parentOffset,v.parentOffset),T=()=>k(t.state.tr.insertText(x,b,S));t.someProp("handleTextInput",O=>O(t,b,S,x,T))||t.dispatch(T())}else t.dispatch(k());else t.dispatch(k())}function q1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Jy(t,e.resolve(n.anchor),e.resolve(n.head))}function t$(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,u;for(let c=0;c<r.length;c++)o=r[c].removeFromSet(o);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",u=c=>c.mark(a.addToSet(c.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",u=c=>c.mark(a.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(u(e.child(c)));if(U.from(l).eq(t))return{mark:a,type:s}}function n$(t,e,n,r,o){if(n-e<=o.pos-r.pos||tp(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(tp(i,!0,!0));return!s.parent.isTextblock||s.pos>n||tp(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function tp(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function r$(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let u=Math.max(0,i-Math.min(s,a));r-=s+u-i}if(s<i&&t.size<e.size){let u=r<=i&&r>=s?i-r:0;i-=u,i&&i<e.size&&H1(e.textBetween(i-1,i+1))&&(i+=u?1:-1),a=i+(a-s),s=i}else if(a<i){let u=r<=i&&r>=a?i-r:0;i-=u,i&&i<t.size&&H1(t.textBetween(i-1,i+1))&&(i+=u?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function H1(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Bx{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new bF,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Y1),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=G1(this),K1(this),this.nodeViews=J1(this),this.docView=T1(this.state.doc,W1(this),ep(this),this.dom,this),this.domObserver=new KF(this,(r,o,i,s)=>e$(this,r,o,i,s)),this.domObserver.start(),_F(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&cm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Y1),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Ax(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=J1(this);i$(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&cm(this),this.editable=G1(this),K1(this);let u=ep(this),l=W1(this),c=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,l,u);(d||!e.selection.eq(o.selection))&&(s=!0);let f=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&DB(this);if(s){this.domObserver.stop();let p=d&&(Zt||yt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&o$(o.selection,e.selection);if(d){let h=yt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=DF(this)),(i||!this.docView.update(e.doc,l,u,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=T1(e.doc,l,u,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iF(this))?br(this,p):(wx(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&jB(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof re){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&b1(this,n.getBoundingClientRect(),e)}else b1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Px(e.slice,e.move,o<0?void 0:re.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Zt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&LB(this.dom),br(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return UB(this,e)}coordsAtPos(e,n=1){return dx(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return KB(this,n||this.state,e)}pasteHTML(e,n){return dl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return dl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Yy(this,e)}destroy(){this.docView&&(SF(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ep(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,EB())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xF(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rt&&this.root.nodeType===11&&NB(this.dom.ownerDocument)==this.dom&&JF(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Bx.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function W1(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[It.node(0,t.state.doc.content.size,e)]}function K1(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:It.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function G1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function o$(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function J1(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function i$(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Y1(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var po={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Rc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s$=typeof navigator<"u"&&/Mac/.test(navigator.platform),a$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Et=0;Et<10;Et++)po[48+Et]=po[96+Et]=String(Et);for(var Et=1;Et<=24;Et++)po[Et+111]="F"+Et;for(var Et=65;Et<=90;Et++)po[Et]=String.fromCharCode(Et+32),Rc[Et]=String.fromCharCode(Et);for(var np in po)Rc.hasOwnProperty(np)||(Rc[np]=po[np]);function l$(t){var e=s$&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||a$&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Rc:po)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const u$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),c$=typeof navigator<"u"&&/Win/.test(navigator.platform);function d$(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a++){let u=e[a];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))u$?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function f$(t){let e=Object.create(null);for(let n in t)e[d$(n)]=t[n];return e}function rp(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function p$(t){return new ze({props:{handleKeyDown:Fx(t)}})}function Fx(t){let e=f$(t);return function(n,r){let o=l$(r),i,s=e[rp(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[rp(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(c$&&r.ctrlKey&&r.altKey)&&(i=po[r.keyCode])&&i!=o){let a=e[rp(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var h$=Object.defineProperty,ng=(t,e)=>{for(var n in e)h$(t,n,{get:e[n],enumerable:!0})};function Wd(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Kd=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([s,a])=>[s,(...l)=>{const c=a(...l)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,u=t||o.tr,l=()=>(!a&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),s.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...h)=>{const m=this.buildProps(u,e),v=f(...h)(m);return s.push(v),c}])),run:l};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,u])=>[a,(...l)=>u(...l)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:Wd({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([a,u])=>[a,(...l)=>u(...l)(s)]))}};return s}},$x={};ng($x,{blur:()=>m$,clearContent:()=>y$,clearNodes:()=>g$,command:()=>v$,createParagraphNear:()=>w$,cut:()=>b$,deleteCurrentNode:()=>_$,deleteNode:()=>S$,deleteRange:()=>k$,deleteSelection:()=>x$,enter:()=>E$,exitCode:()=>T$,extendMarkRange:()=>C$,first:()=>M$,focus:()=>O$,forEach:()=>N$,insertContent:()=>A$,insertContentAt:()=>R$,joinBackward:()=>L$,joinDown:()=>j$,joinForward:()=>B$,joinItemBackward:()=>F$,joinItemForward:()=>$$,joinTextblockBackward:()=>z$,joinTextblockForward:()=>U$,joinUp:()=>D$,keyboardShortcut:()=>q$,lift:()=>H$,liftEmptyBlock:()=>W$,liftListItem:()=>K$,newlineInCode:()=>G$,resetAttributes:()=>J$,scrollIntoView:()=>Y$,selectAll:()=>Q$,selectNodeBackward:()=>X$,selectNodeForward:()=>Z$,selectParentNode:()=>e6,selectTextblockEnd:()=>t6,selectTextblockStart:()=>n6,setContent:()=>r6,setMark:()=>k6,setMeta:()=>x6,setNode:()=>E6,setNodeSelection:()=>T6,setTextDirection:()=>C6,setTextSelection:()=>M6,sinkListItem:()=>O6,splitBlock:()=>N6,splitListItem:()=>A6,toggleList:()=>I6,toggleMark:()=>P6,toggleNode:()=>R6,toggleWrap:()=>D6,undoInputRule:()=>j6,unsetAllMarks:()=>L6,unsetMark:()=>B6,unsetTextDirection:()=>F6,updateAttributes:()=>$6,wrapIn:()=>z6,wrapInList:()=>U6});var m$=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),y$=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),g$=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,u)=>{if(a.type.isText)return;const{doc:l,mapping:c}=e,d=l.resolve(c.map(u)),f=l.resolve(c.map(u+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Ns(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},v$=t=>e=>t(e),w$=()=>({state:t,dispatch:e})=>ex(t,e),b$=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new ce(r.doc.resolve(Math.max(s-1,0)))),!0},_$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){const a=o.before(i),u=o.after(i);t.delete(a,u).scrollIntoView()}return!0}return!1};function at(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var S$=t=>({tr:e,state:n,dispatch:r})=>{const o=at(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){const u=i.before(s),l=i.after(s);e.delete(u,l).scrollIntoView()}return!0}return!1},k$=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},x$=()=>({state:t,dispatch:e})=>Uy(t,e),E$=()=>({commands:t})=>t.keyboardShortcut("Enter"),T$=()=>({state:t,dispatch:e})=>cB(t,e);function rg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Dc(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:rg(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function zx(t,e,n={}){return t.find(r=>r.type===e&&Dc(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function Q1(t,e,n={}){return!!zx(t,e,n)}function og(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(c=>c.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(c=>c.type===e)||(n=n||((r=o.node.marks[0])==null?void 0:r.attrs),!zx([...o.node.marks],e,n)))return;let s=o.index,a=t.start()+o.offset,u=s+1,l=a+o.node.nodeSize;for(;s>0&&Q1([...t.parent.child(s-1).marks],e,n);)s-=1,a-=t.parent.child(s).nodeSize;for(;u<t.parent.childCount&&Q1([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:l}}function Or(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var C$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const i=Or(t,r.schema),{doc:s,selection:a}=n,{$from:u,from:l,to:c}=a;if(o){const d=og(u,i,e);if(d&&d.from<=l&&d.to>=c){const f=ce.create(s,d.from,d.to);n.setSelection(f)}}return!0},M$=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ux(t){return t instanceof ce}function Bo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Vx(t,e=null){if(!e)return null;const n=me.atStart(t),r=me.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,i=r.to;return e==="all"?ce.create(t,Bo(0,o,i),Bo(t.content.size,o,i)):ce.create(t,Bo(e,o,i),Bo(e,o,i))}function qx(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Gd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var O$=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Gd()||qx())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!Ux(n.state.selection))return s(),!0;const a=Vx(o.doc,t)||n.state.selection,u=n.state.selection.eq(a);return i&&(u||o.setSelection(a),u&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},N$=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),A$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Hx=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Hx(r)}return t};function ou(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Hx(n)}function pl(t,e,n){if(t instanceof kn||t instanceof U)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return U.fromArray(t.map(a=>e.nodeFromJSON(a)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),pl("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const u=new Ck({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(s=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?so.fromSchema(u).parseSlice(ou(t),n.parseOptions):so.fromSchema(u).parse(ou(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=so.fromSchema(e);return n.slice?i.parseSlice(ou(t),n.parseOptions).content:i.parse(ou(t),n.parseOptions)}return pl("",e,n)}function I$(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof mt||o instanceof vt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,u,l,c)=>{s===0&&(s=c)}),t.setSelection(me.near(t.doc.resolve(s),n))}var P$=t=>!("type"in t),R$=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{pl(e,i.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(v){u(v)}try{a=pl(e,i.schema,{parseOptions:l,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((P$(a)?a:[a]).forEach(v=>{v.check(),f=f?v.isText&&v.marks.length===0:!1,p=p?v.isBlock:!1}),c===d&&p){const{parent:v}=r.doc.resolve(c);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(v=>v.text||"").join("");else if(e instanceof U){let v="";e.forEach(y=>{y.text&&(v+=y.text)}),m=v}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else{m=a;const v=r.doc.resolve(c),y=v.node(),w=v.parentOffset===0,b=y.isText||y.isTextblock,S=y.content.size>0;w&&b&&S&&(c=Math.max(0,c-1)),r.replaceWith(c,d,m)}n.updateSelection&&I$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},D$=()=>({state:t,dispatch:e})=>aB(t,e),j$=()=>({state:t,dispatch:e})=>lB(t,e),L$=()=>({state:t,dispatch:e})=>Kk(t,e),B$=()=>({state:t,dispatch:e})=>Qk(t,e),F$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$d(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=$d(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},z$=()=>({state:t,dispatch:e})=>iB(t,e),U$=()=>({state:t,dispatch:e})=>sB(t,e);function Wx(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function V$(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a+=1){const u=e[a];if(/^(cmd|meta|m)$/i.test(u))s=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))i=!0;else if(/^mod$/i.test(u))Gd()||Wx()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var q$=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=V$(t).split(/-(?!$)/),s=i.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return u==null||u.steps.forEach(l=>{const c=l.map(r.mapping);c&&o&&r.maybeStep(c)}),!0};function ho(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?at(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),h=Math.min(o,f+d.nodeSize);a.push({node:d,from:p,to:h})});const u=o-r,l=a.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Dc(d.node.attrs,n,{strict:!1}));return i?!!l.length:l.reduce((d,f)=>d+f.to-f.from,0)>=u}var H$=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return ho(n,o,e)?uB(n,r):!1},W$=()=>({state:t,dispatch:e})=>tx(t,e),K$=t=>({state:e,dispatch:n})=>{const r=at(t,e.schema);return _B(r)(e,n)},G$=()=>({state:t,dispatch:e})=>Zk(t,e);function Jd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function X1(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var J$=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Jd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Or(t,r.schema));let u=!1;return n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{i&&i===c.type&&(u=!0,o&&n.setNodeMarkup(d,void 0,X1(c.attrs,e))),s&&c.marks.length&&c.marks.forEach(f=>{s===f.type&&(u=!0,o&&n.addMark(d,d+c.nodeSize,s.create(X1(f.attrs,e))))})})}),u},Y$=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Q$=()=>({tr:t,dispatch:e})=>{if(e){const n=new an(t.doc);t.setSelection(n)}return!0},X$=()=>({state:t,dispatch:e})=>Jk(t,e),Z$=()=>({state:t,dispatch:e})=>Xk(t,e),e6=()=>({state:t,dispatch:e})=>pB(t,e),t6=()=>({state:t,dispatch:e})=>yB(t,e),n6=()=>({state:t,dispatch:e})=>mB(t,e);function dm(t,e,n={},r={}){return pl(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var r6=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const l=dm(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return s&&i.replaceWith(0,u.content.size,l).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function Kx(t,e){const n=Or(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,u=>{s.push(...u.marks)});const a=s.find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function Gx(t,e){const n=new Vk(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function o6(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function i6(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function s6(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Yd(t){return e=>s6(e.$from,t)}function oe(t,e,n){return t.config[e]===void 0&&t.parent?oe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?oe(t.parent,e,n):null}):t.config[e]}function ig(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=oe(e,"addExtensions",n);return r?[e,...ig(r())]:e}).flat(10)}function sg(t,e){const n=gi.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Jx(t){return typeof t=="function"}function Me(t,e=void 0,...n){return Jx(t)?e?t.bind(e)(...n):t(...n):t}function a6(t={}){return Object.keys(t).length===0&&t.constructor===Object}function xs(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Yx(t){const e=[],{nodeExtensions:n,markExtensions:r}=xs(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage,extensions:o},u=oe(s,"addGlobalAttributes",a);if(!u)return;u().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,p])=>{e.push({type:d,name:f,attribute:{...i,...p}})})})})}),o.forEach(s=>{const a={name:s.name,options:s.options,storage:s.storage},u=oe(s,"addAttributes",a);if(!u)return;const l=u();Object.entries(l).forEach(([c,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:c,attribute:f})})}),e}function $e(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){const a=i?String(i).split(" "):[],u=r[o]?r[o].split(" "):[],l=a.filter(c=>!u.includes(c));r[o]=[...u,...l].join(" ")}else if(o==="style"){const a=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],u=r[o]?r[o].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;u.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());l.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(p=>p.trim());l.set(d,f)}),r[o]=Array.from(l.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[o]=i}),r},{})}function hl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>$e(n,r),{})}function l6(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Z1(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((i,s)=>{const a=s.attribute.parseHTML?s.attribute.parseHTML(n):l6(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function ew(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&a6(n)?!1:n!=null))}function tw(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function u6(t,e){var n;const r=Yx(t),{nodeExtensions:o,markExtensions:i}=xs(t),s=(n=o.find(l=>oe(l,"topNode")))==null?void 0:n.name,a=Object.fromEntries(o.map(l=>{const c=r.filter(y=>y.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},f=t.reduce((y,w)=>{const b=oe(w,"extendNodeSchema",d);return{...y,...b?b(l):{}}},{}),p=ew({...f,content:Me(oe(l,"content",d)),marks:Me(oe(l,"marks",d)),group:Me(oe(l,"group",d)),inline:Me(oe(l,"inline",d)),atom:Me(oe(l,"atom",d)),selectable:Me(oe(l,"selectable",d)),draggable:Me(oe(l,"draggable",d)),code:Me(oe(l,"code",d)),whitespace:Me(oe(l,"whitespace",d)),linebreakReplacement:Me(oe(l,"linebreakReplacement",d)),defining:Me(oe(l,"defining",d)),isolating:Me(oe(l,"isolating",d)),attrs:Object.fromEntries(c.map(tw))}),h=Me(oe(l,"parseHTML",d));h&&(p.parseDOM=h.map(y=>Z1(y,c)));const m=oe(l,"renderHTML",d);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:hl(y,c)}));const v=oe(l,"renderText",d);return v&&(p.toText=v),[l.name,p]})),u=Object.fromEntries(i.map(l=>{const c=r.filter(v=>v.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},f=t.reduce((v,y)=>{const w=oe(y,"extendMarkSchema",d);return{...v,...w?w(l):{}}},{}),p=ew({...f,inclusive:Me(oe(l,"inclusive",d)),excludes:Me(oe(l,"excludes",d)),group:Me(oe(l,"group",d)),spanning:Me(oe(l,"spanning",d)),code:Me(oe(l,"code",d)),attrs:Object.fromEntries(c.map(tw))}),h=Me(oe(l,"parseHTML",d));h&&(p.parseDOM=h.map(v=>Z1(v,c)));const m=oe(l,"renderHTML",d);return m&&(p.toDOM=v=>m({mark:v,HTMLAttributes:hl(v,c)})),[l.name,p]}));return new Ck({topNode:s,nodes:a,marks:u})}function c6(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ag(t){return t.sort((n,r)=>{const o=oe(n,"priority")||100,i=oe(r,"priority")||100;return o>i?-1:o<i?1:0})}function Qx(t){const e=ag(ig(t)),n=c6(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Xx(t,e,n){const{from:r,to:o}=e,{blockSeparator:i=`
|
|
74
74
|
|
|
75
75
|
`,textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,o,(u,l,c,d)=>{var f;u.isBlock&&l>r&&(a+=i);const p=s==null?void 0:s[u.type.name];if(p)return c&&(a+=p({node:u,pos:l,parent:c,index:d,range:e})),!1;u.isText&&(a+=(f=u==null?void 0:u.text)==null?void 0:f.slice(Math.max(r,l)-l,o-l))}),a}function d6(t,e){const n={from:0,to:t.content.size};return Xx(t,n,e)}function Zx(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function f6(t,e){const n=at(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,a=>{i.push(a)});const s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function eE(t,e){const n=Jd(typeof e=="string"?e:e.name,t.schema);return n==="node"?f6(t,e):n==="mark"?Kx(t,e):{}}function p6(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function h6(t){const e=p6(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function tE(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{const s=[];if(o.ranges.length)o.forEach((a,u)=>{s.push({from:a,to:u})});else{const{from:a,to:u}=n[i];if(a===void 0||u===void 0)return;s.push({from:a,to:u})}s.forEach(({from:a,to:u})=>{const l=e.slice(i).map(a,-1),c=e.slice(i).map(u),d=e.invert().map(l,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:l,to:c}})})}),h6(r)}function lg(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t),s=og(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var m6=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&s===null;){const a=o.node(i);(a==null?void 0:a.type.name)===e?s=a:i-=1}return[s,i]};function op(t,e){return e.nodes[t]||e.marks[t]||null}function ju(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var y6=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var u,l;const c=((l=(u=o.type.spec).toText)==null?void 0:l.call(u,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?c:c.slice(0,Math.max(0,r-i))}),n};function fm(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?Or(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Dc(d.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;t.doc.nodesBetween(p,h,(m,v)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(p,v),w=Math.min(h,v+m.nodeSize),b=w-y;s+=b,a.push(...m.marks.map(S=>({mark:S,from:y,to:w})))})}),s===0)return!1;const u=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Dc(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),l=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(u>0?u+l:u)>=s}function g6(t,e,n={}){if(!e)return ho(t,null,n)||fm(t,null,n);const r=Jd(e,t.schema);return r==="node"?ho(t,e,n):r==="mark"?fm(t,e,n):!1}var v6=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const i=Yd(a=>a.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},w6=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function nw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function rw(t,e){const{nodeExtensions:n}=xs(e),r=n.find(s=>s.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},i=Me(oe(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Qd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(i=>{o!==!1&&(Qd(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function nE(t){return t instanceof re}var rE=class oE{constructor(e){this.position=e}static fromJSON(e){return new oE(e.position)}toJSON(){return{position:this.position}}};function b6(t,e){const n=e.mapping.mapResult(t.position);return{position:new rE(n.pos),mapResult:n}}function _6(t){return new rE(t)}function S6(t,e,n){var r;const{selection:o}=e;let i=null;if(Ux(o)&&(i=o.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(l=>l.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:a,$to:u})=>{let l=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,u.pos,(c,d,f)=>{if(l)return!1;if(c.isInline){const p=!f||f.type.allowsMarkType(n),h=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));l=p&&h}return!l}),l})}var k6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,u=Or(t,r.schema);if(o)if(s){const l=Kx(r,u);n.addStoredMark(u.create({...l,...e}))}else a.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(c,d,(f,p)=>{const h=Math.max(p,c),m=Math.min(p+f.nodeSize,d);f.marks.find(y=>y.type===u)?f.marks.forEach(y=>{u===y.type&&n.addMark(h,m,u.create({...y.attrs,...e}))}):n.addMark(h,m,u.create(e))})});return S6(r,n,u)},x6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),E6=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=at(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:a})=>g1(i,{...s,...e})(n)?!0:a.clearNodes()).command(({state:a})=>g1(i,{...s,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},T6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=Bo(t,0,r.content.size),i=re.create(r,o);e.setSelection(i)}return!0},C6=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return typeof e=="number"?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(u,l)=>{u.isText||n.setNodeMarkup(l,void 0,{...u.attrs,dir:t})}),!0},M6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=ce.atStart(r).from,a=ce.atEnd(r).to,u=Bo(o,s,a),l=Bo(i,s,a),c=ce.create(r,u,l);e.setSelection(c)}return!0},O6=t=>({state:e,dispatch:n})=>{const r=at(t,e.schema);return xB(r)(e,n)};function ow(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}var N6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=e,{$from:a,$to:u}=i,l=o.extensionManager.attributes,c=ju(l,a.node().type.name,a.node().attrs);if(i instanceof re&&i.node.isBlock)return!a.parentOffset||!wr(s,a.pos)?!1:(r&&(t&&ow(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=u.parentOffset===u.parent.content.size,f=a.depth===0?void 0:o6(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:c}]:void 0,h=wr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&wr(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:c}]:void 0),r){if(h&&(i instanceof ce&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),v=e.doc.resolve(m);a.node(-1).canReplaceWith(v.index(),v.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&ow(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return h},A6=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=at(t,r.schema),{$from:u,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(l))return!1;const d=u.node(-1);if(d.type!==a)return!1;const f=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(o){let y=U.empty;const w=u.index(-1)?1:u.index(-2)?2:3;for(let T=u.depth-w;T>=u.depth-3;T-=1)y=U.from(u.node(T).copy(y));const b=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,S={...ju(f,u.node().type.name,u.node().attrs),...e},k=((s=a.contentMatch.defaultType)==null?void 0:s.createAndFill(S))||void 0;y=y.append(U.from(a.createAndFill(null,k)||void 0));const E=u.before(u.depth-(w-1));n.replace(E,u.after(-b),new J(y,4-w,0));let x=-1;n.doc.nodesBetween(E,n.doc.content.size,(T,O)=>{if(x>-1)return!1;T.isTextblock&&T.content.size===0&&(x=O+1)}),x>-1&&n.setSelection(ce.near(n.doc.resolve(x))),n.scrollIntoView()}return!0}const p=l.pos===u.end()?d.contentMatchAt(0).defaultType:null,h={...ju(f,d.type.name,d.attrs),...e},m={...ju(f,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,l.pos);const v=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!wr(n.doc,u.pos,2))return!1;if(o){const{selection:y,storedMarks:w}=r,{splittableMarks:b}=i.extensionManager,S=w||y.$to.parentOffset&&y.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!S||!o)return!0;const k=S.filter(E=>b.includes(E.type.name));n.ensureMarks(k)}return!0},ip=(t,e)=>{const n=Yd(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&vo(t.doc,n.pos)&&t.join(n.pos),!0},sp=(t,e)=>{const n=Yd(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&vo(t.doc,r)&&t.join(r),!0},I6=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:u,commands:l,can:c})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=at(t,s.schema),h=at(e,s.schema),{selection:m,storedMarks:v}=s,{$from:y,$to:w}=m,b=y.blockRange(w),S=v||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const k=Yd(E=>rw(E.type.name,d))(m);if(b.depth>=1&&k&&b.depth-k.depth<=1){if(k.node.type===p)return l.liftListItem(h);if(rw(k.node.type.name,d)&&p.validContent(k.node.content)&&a)return u().command(()=>(i.setNodeMarkup(k.pos,p),!0)).command(()=>ip(i,p)).command(()=>sp(i,p)).run()}return!n||!S||!a?u().command(()=>c().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>ip(i,p)).command(()=>sp(i,p)).run():u().command(()=>{const E=c().wrapInList(p,r),x=S.filter(T=>f.includes(T.type.name));return i.ensureMarks(x),E?!0:l.clearNodes()}).wrapInList(p,r).command(()=>ip(i,p)).command(()=>sp(i,p)).run()},P6=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Or(t,r.schema);return fm(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},R6=(t,e,n={})=>({state:r,commands:o})=>{const i=at(t,r.schema),s=at(e,r.schema),a=ho(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),a?o.setNode(s,u):o.setNode(i,{...u,...n})},D6=(t,e={})=>({state:n,commands:r})=>{const o=at(t,n.schema);return ho(n,o,e)?r.lift(o):r.wrapIn(o,e)},j6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,a=i.transform;for(let u=a.steps.length-1;u>=0;u-=1)s.step(a.steps[u].invert(a.docs[u]));if(i.text){const u=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else s.delete(i.from,i.to)}return!0}}return!1},L6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},B6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,u=Or(t,r.schema),{$from:l,empty:c,ranges:d}=a;if(!o)return!0;if(c&&s){let{from:f,to:p}=a;const h=(i=l.marks().find(v=>v.type===u))==null?void 0:i.attrs,m=og(l,u,h);m&&(f=m.from,p=m.to),n.removeMark(f,p,u)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,u)});return n.removeStoredMark(u),!0},F6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=o.from,s=o.to),r&&e.doc.nodesBetween(i,s,(a,u)=>{if(a.isText)return;const l={...a.attrs};delete l.dir,e.setNodeMarkup(u,void 0,l)}),!0},$6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Jd(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=at(t,r.schema)),a==="mark"&&(s=Or(t,r.schema));let u=!1;return n.selection.ranges.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;let f,p,h,m;n.selection.empty?r.doc.nodesBetween(c,d,(v,y)=>{i&&i===v.type&&(u=!0,h=Math.max(y,c),m=Math.min(y+v.nodeSize,d),f=y,p=v)}):r.doc.nodesBetween(c,d,(v,y)=>{y<c&&i&&i===v.type&&(u=!0,h=Math.max(y,c),m=Math.min(y+v.nodeSize,d),f=y,p=v),y>=c&&y<=d&&(i&&i===v.type&&(u=!0,o&&n.setNodeMarkup(y,void 0,{...v.attrs,...e})),s&&v.marks.length&&v.marks.forEach(w=>{if(s===w.type&&(u=!0,o)){const b=Math.max(y,c),S=Math.min(y+v.nodeSize,d);n.addMark(b,S,s.create({...w.attrs,...e}))}}))}),p&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...p.attrs,...e}),s&&p.marks.length&&p.marks.forEach(v=>{s===v.type&&o&&n.addMark(h,m,s.create({...v.attrs,...e}))}))}),u},z6=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return gB(o,e)(n,r)},U6=(t,e={})=>({state:n,dispatch:r})=>{const o=at(t,n.schema);return vB(o,e)(n,r)},V6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Xd=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},q6=(t,e)=>{if(rg(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function iu(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:u}=n;if(u.composing)return!1;const l=u.state.doc.resolve(r);if(l.parent.type.spec.code||(e=l.nodeBefore||l.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=y6(l)+i;return s.forEach(f=>{if(c)return;const p=q6(d,f.find);if(!p)return;const h=u.state.tr,m=Wd({state:u.state,transaction:h}),v={from:r-(p[0].length-i.length),to:o},{commands:y,chain:w,can:b}=new Kd({editor:n,state:m});f.handler({state:m,range:v,match:p,commands:y,chain:w,can:b})===null||!h.steps.length||(f.undoable&&h.setMeta(a,{transform:h,from:r,to:o,text:i}),u.dispatch(h),c=!0)}),c}function H6(t){const{editor:e,rules:n}=t,r=new ze({state:{init(){return null},apply(o,i,s){const a=o.getMeta(r);if(a)return a;const u=o.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:c}=u;typeof c=="string"?c=c:c=sg(U.from(c),s.schema);const{from:d}=u,f=d+c.length;iu({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,a){return iu({editor:e,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:i}=o.state.selection;i&&iu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;const{$cursor:s}=o.state.selection;return s?iu({editor:e,from:s.pos,to:s.pos,text:`
|
|
76
76
|
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function W6(t){return Object.prototype.toString.call(t).slice(8,-1)}function su(t){return W6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function iE(t,e){const n={...t};return su(t)&&su(e)&&Object.keys(e).forEach(r=>{su(e[r])&&su(t[r])?n[r]=iE(t[r],e[r]):n[r]=e[r]}),n}var ug=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Me(oe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Me(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>iE(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},vi=class sE extends ug{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new sE(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const s=o.marks();if(!!!s.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const u=s.find(l=>(l==null?void 0:l.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function K6(t){return typeof t=="number"}var G6=class{constructor(t){this.find=t.find,this.handler=t.handler}},J6=(t,e,n)=>{if(rg(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function Y6(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:u,chain:l,can:c}=new Kd({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(p,h)=>{var m,v,y,w,b;if((v=(m=p.type)==null?void 0:m.spec)!=null&&v.code||!(p.isText||p.isTextblock||p.isInline))return;const S=(b=(w=(y=p.content)==null?void 0:y.size)!=null?w:p.nodeSize)!=null?b:0,k=Math.max(r,h),E=Math.min(o,h+S);if(k>=E)return;const x=p.isText?p.text||"":p.textBetween(k-h,E-h,void 0,"");J6(x,i.find,s).forEach(O=>{if(O.index===void 0)return;const N=k+O.index+1,$=N+O[0].length,P={from:n.tr.mapping.map(N),to:n.tr.mapping.map($)},D=i.handler({state:n,range:P,match:O,commands:u,chain:l,can:c,pasteEvent:s,dropEvent:a});d.push(D)})}),d.every(p=>p!==null)}var au=null,Q6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function X6(t){const{editor:e,rules:n}=t;let r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const u=({state:c,from:d,to:f,rule:p,pasteEvt:h})=>{const m=c.tr,v=Wd({state:c,transaction:m});if(!(!Y6({editor:e,state:v,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new ze({view(d){const f=h=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(h.target)?d.dom.parentElement:null,r&&(au=e)},p=()=>{au&&(au=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const p=au;p!=null&&p.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(d,f)=>{var p;const h=(p=f.clipboardData)==null?void 0:p.getData("text/html");return s=f,o=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,p)=>{const h=d[0],m=h.getMeta("uiEvent")==="paste"&&!o,v=h.getMeta("uiEvent")==="drop"&&!i,y=h.getMeta("applyPasteRules"),w=!!y;if(!m&&!v&&!w)return;if(w){let{text:k}=y;typeof k=="string"?k=k:k=sg(U.from(k),p.schema);const{from:E}=y,x=E+k.length,T=Q6(k);return u({rule:c,state:p,from:E,to:{b:x},pasteEvt:T})}const b=f.doc.content.findDiffStart(p.doc.content),S=f.doc.content.findDiffEnd(p.doc.content);if(!(!K6(b)||!S||b===S.b))return u({rule:c,state:p,from:b,to:S,pasteEvt:s})}}))}var Zd=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Qx(t),this.schema=u6(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:op(e.name,this.schema)},r=oe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return ag([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:op(r.name,this.schema)},i=[],s=oe(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&oe(r,"exitable",o)&&(a.ArrowRight=()=>vi.handleExit({editor:t,mark:r})),s){const f=Object.fromEntries(Object.entries(s()).map(([p,h])=>[p,()=>h({editor:t})]));a={...a,...f}}const u=p$(a);i.push(u);const l=oe(r,"addInputRules",o);if(nw(r,t.options.enableInputRules)&&l){const f=l();if(f&&f.length){const p=H6({editor:t,rules:f}),h=Array.isArray(p)?p:[p];i.push(...h)}}const c=oe(r,"addPasteRules",o);if(nw(r,t.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const p=X6({editor:t,rules:f});i.push(...p)}}const d=oe(r,"addProseMirrorPlugins",o);if(d){const f=d();i.push(...f)}return i})}get attributes(){return Yx(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=xs(this.extensions);return Object.fromEntries(e.filter(n=>!!oe(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:at(n.name,this.schema)},i=oe(n,"addNodeView",o);if(!i)return[];const s=i();if(!s)return[];const a=(u,l,c,d,f)=>{const p=hl(u,r);return s({node:u,view:l,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:p})};return[n.name,a]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=xs(this.extensions);return Object.fromEntries(e.filter(n=>!!oe(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Or(n.name,this.schema)},i=oe(n,"addMarkView",o);if(!i)return[];const s=(a,u,l)=>{const c=hl(a,r);return i()({mark:a,view:u,inline:l,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{fz(a,t,d)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:op(e.name,this.schema)};e.type==="mark"&&((n=Me(oe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const o=oe(e,"onBeforeCreate",r),i=oe(e,"onCreate",r),s=oe(e,"onUpdate",r),a=oe(e,"onSelectionUpdate",r),u=oe(e,"onTransaction",r),l=oe(e,"onFocus",r),c=oe(e,"onBlur",r),d=oe(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),u&&this.editor.on("transaction",u),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};Zd.resolve=Qx;Zd.sort=ag;Zd.flatten=ig;var Z6={};ng(Z6,{ClipboardTextSerializer:()=>lE,Commands:()=>uE,Delete:()=>cE,Drop:()=>dE,Editable:()=>fE,FocusEvents:()=>hE,Keymap:()=>mE,Paste:()=>yE,Tabindex:()=>gE,TextDirection:()=>vE,focusEventsPluginKey:()=>pE});var tt=class aE extends ug{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new aE(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},lE=tt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ze({key:new et("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(c=>c.$from.pos)),a=Math.max(...i.map(c=>c.$to.pos)),u=Zx(n);return Xx(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),uE=tt.create({name:"commands",addCommands(){return{...$x}}}),cE=tt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,o;const i=()=>{var s,a,u,l;if((l=(u=(a=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:a.filterTransaction)==null?void 0:u.call(a,t))!=null?l:t.getMeta("y-sync$"))return;const c=Gx(t.before,[t,...e]);tE(c).forEach(p=>{c.mapping.mapResult(p.oldRange.from).deletedAfter&&c.mapping.mapResult(p.oldRange.to).deletedBefore&&c.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const v=m+h.nodeSize-2,y=p.oldRange.from<=m&&v<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:v,newFrom:c.mapping.map(m),newTo:c.mapping.map(v),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:t,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((p,h)=>{var m,v;if(p instanceof jn){const y=f.slice(h).map(p.from,-1),w=f.slice(h).map(p.to),b=f.invert().map(y,-1),S=f.invert().map(w),k=(m=c.doc.nodeAt(y-1))==null?void 0:m.marks.some(x=>x.eq(p.mark)),E=(v=c.doc.nodeAt(w))==null?void 0:v.marks.some(x=>x.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:b,to:S},newRange:{from:y,to:w},partial:!!(E||k),editor:this.editor,transaction:t,combinedTransform:c})}})};(o=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||o?setTimeout(i,0):i()}}),dE=tt.create({name:"drop",addProseMirrorPlugins(){return[new ze({key:new et("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),fE=tt.create({name:"editable",addProseMirrorPlugins(){return[new ze({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),pE=new et("focusEvents"),hE=tt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ze({key:pE,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),mE=tt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{const{selection:u,doc:l}=a,{empty:c,$anchor:d}=u,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,v=d.pos-d.parentOffset,y=m&&h.parent.childCount===1?v===d.pos:me.atStart(l).from===f;return!c||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Gd()||Wx()?i:o},addProseMirrorPlugins(){return[new ze({key:new et("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),o=t.some(m=>m.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=e.selection,u=me.atStart(e.doc).from,l=me.atEnd(e.doc).to;if(i||!(s===u&&a===l)||!Qd(n.doc))return;const f=n.tr,p=Wd({state:n,transaction:f}),{commands:h}=new Kd({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),yE=tt.create({name:"paste",addProseMirrorPlugins(){return[new ze({key:new et("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),gE=tt.create({name:"tabindex",addProseMirrorPlugins(){return[new ze({key:new et("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),vE=tt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=xs(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ze({key:new et("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),ez=class Ci{constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Ci(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ci(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ci(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+r+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(s);if(!o&&a.depth<=this.depth)return;const u=new Ci(a,this.editor,o,o?n:null);o&&(u.actualDepth=this.depth+1),e.push(new Ci(a,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const i=o.node.attrs,s=Object.keys(n);for(let a=0;a<s.length;a+=1){const u=s[a];if(i[u]!==n[u])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(u=>n[u]===s.node.attrs[u])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},tz=`.ProseMirror {
|
|
@@ -223,17 +223,17 @@ ${p.slice(l+2)}`,d+=1;else break}e.push({indent:l,number:parseInt(a,10),content:
|
|
|
223
223
|
*
|
|
224
224
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
225
225
|
* @license MIT
|
|
226
|
-
*/var mV=function(t){return t!=null&&(gT(t)||yV(t)||!!t._isBuffer)};function gT(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function yV(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&gT(t.slice(0,0))}(function(){var t=hV,e=$w.utf8,n=mV,r=$w.bin,o=function(i,s){i.constructor==String?s&&s.encoding==="binary"?i=r.stringToBytes(i):i=e.stringToBytes(i):n(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var a=t.bytesToWords(i),u=i.length*8,l=1732584193,c=-271733879,d=-1732584194,f=271733878,p=0;p<a.length;p++)a[p]=(a[p]<<8|a[p]>>>24)&16711935|(a[p]<<24|a[p]>>>8)&4278255360;a[u>>>5]|=128<<u%32,a[(u+64>>>9<<4)+14]=u;for(var h=o._ff,m=o._gg,v=o._hh,y=o._ii,p=0;p<a.length;p+=16){var w=l,b=c,S=d,k=f;l=h(l,c,d,f,a[p+0],7,-680876936),f=h(f,l,c,d,a[p+1],12,-389564586),d=h(d,f,l,c,a[p+2],17,606105819),c=h(c,d,f,l,a[p+3],22,-1044525330),l=h(l,c,d,f,a[p+4],7,-176418897),f=h(f,l,c,d,a[p+5],12,1200080426),d=h(d,f,l,c,a[p+6],17,-1473231341),c=h(c,d,f,l,a[p+7],22,-45705983),l=h(l,c,d,f,a[p+8],7,1770035416),f=h(f,l,c,d,a[p+9],12,-1958414417),d=h(d,f,l,c,a[p+10],17,-42063),c=h(c,d,f,l,a[p+11],22,-1990404162),l=h(l,c,d,f,a[p+12],7,1804603682),f=h(f,l,c,d,a[p+13],12,-40341101),d=h(d,f,l,c,a[p+14],17,-1502002290),c=h(c,d,f,l,a[p+15],22,1236535329),l=m(l,c,d,f,a[p+1],5,-165796510),f=m(f,l,c,d,a[p+6],9,-1069501632),d=m(d,f,l,c,a[p+11],14,643717713),c=m(c,d,f,l,a[p+0],20,-373897302),l=m(l,c,d,f,a[p+5],5,-701558691),f=m(f,l,c,d,a[p+10],9,38016083),d=m(d,f,l,c,a[p+15],14,-660478335),c=m(c,d,f,l,a[p+4],20,-405537848),l=m(l,c,d,f,a[p+9],5,568446438),f=m(f,l,c,d,a[p+14],9,-1019803690),d=m(d,f,l,c,a[p+3],14,-187363961),c=m(c,d,f,l,a[p+8],20,1163531501),l=m(l,c,d,f,a[p+13],5,-1444681467),f=m(f,l,c,d,a[p+2],9,-51403784),d=m(d,f,l,c,a[p+7],14,1735328473),c=m(c,d,f,l,a[p+12],20,-1926607734),l=v(l,c,d,f,a[p+5],4,-378558),f=v(f,l,c,d,a[p+8],11,-2022574463),d=v(d,f,l,c,a[p+11],16,1839030562),c=v(c,d,f,l,a[p+14],23,-35309556),l=v(l,c,d,f,a[p+1],4,-1530992060),f=v(f,l,c,d,a[p+4],11,1272893353),d=v(d,f,l,c,a[p+7],16,-155497632),c=v(c,d,f,l,a[p+10],23,-1094730640),l=v(l,c,d,f,a[p+13],4,681279174),f=v(f,l,c,d,a[p+0],11,-358537222),d=v(d,f,l,c,a[p+3],16,-722521979),c=v(c,d,f,l,a[p+6],23,76029189),l=v(l,c,d,f,a[p+9],4,-640364487),f=v(f,l,c,d,a[p+12],11,-421815835),d=v(d,f,l,c,a[p+15],16,530742520),c=v(c,d,f,l,a[p+2],23,-995338651),l=y(l,c,d,f,a[p+0],6,-198630844),f=y(f,l,c,d,a[p+7],10,1126891415),d=y(d,f,l,c,a[p+14],15,-1416354905),c=y(c,d,f,l,a[p+5],21,-57434055),l=y(l,c,d,f,a[p+12],6,1700485571),f=y(f,l,c,d,a[p+3],10,-1894986606),d=y(d,f,l,c,a[p+10],15,-1051523),c=y(c,d,f,l,a[p+1],21,-2054922799),l=y(l,c,d,f,a[p+8],6,1873313359),f=y(f,l,c,d,a[p+15],10,-30611744),d=y(d,f,l,c,a[p+6],15,-1560198380),c=y(c,d,f,l,a[p+13],21,1309151649),l=y(l,c,d,f,a[p+4],6,-145523070),f=y(f,l,c,d,a[p+11],10,-1120210379),d=y(d,f,l,c,a[p+2],15,718787259),c=y(c,d,f,l,a[p+9],21,-343485551),l=l+w>>>0,c=c+b>>>0,d=d+S>>>0,f=f+k>>>0}return t.endian([l,c,d,f])};o._ff=function(i,s,a,u,l,c,d){var f=i+(s&a|~s&u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._gg=function(i,s,a,u,l,c,d){var f=i+(s&u|a&~u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._hh=function(i,s,a,u,l,c,d){var f=i+(s^a^u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._ii=function(i,s,a,u,l,c,d){var f=i+(a^(s|~u))+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._blocksize=16,o._digestsize=16,mT.exports=function(i,s){if(i==null)throw new Error("Illegal argument "+i);var a=t.wordsToBytes(o(i,s));return s&&s.asBytes?a:s&&s.asString?r.bytesToString(a):t.bytesToHex(a)}})();var gV=mT.exports;const vV=di(gV);function yr(t,e=64){return`https://www.gravatar.com/avatar/${vV(t)}?d=mp&s=${e}`}function Ag(t,e,n,r=300){const o=t.startsWith("image/"),i=t.startsWith("video/");return o&&e?`${e}?w=${r}&fit=max&auto=format`:i&&n?`https://image.mux.com/${n}/thumbnail.jpg?width=${r}&fit_mode=preserve`:null}function Ig(t){return t.length===0?!0:t.length===1&&t[0].type==="text"?!t[0].content.trim():!1}function Mm(t){const e=t.attributes.mime_type??"application/octet-stream",n=t.attributes.url??"",r=Ag(e,n,t.attributes.mux_playback_id);return{type:"asset",id:t.id,filename:t.attributes.filename,url:n,thumbnailUrl:r,mimeType:e}}function wV(t,e){const n=t.email.toLowerCase().trim(),r=t.name.toLowerCase().trim();if(n){const o=e.find(i=>i.user.email&&i.user.email.toLowerCase().trim()===n);if(o)return o}if(r){const o=e.find(i=>i.user.name.toLowerCase().trim()===r);if(o)return o}return null}function bV(t,e){const n=wV(t,e);return n?n.user.name:t.name||t.email.split("@")[0]}function _V(t,e){const n=t.commentObject,r=e.commentObject;return n===r?zw(t,e):n.id!==r.id||!il(n.content,r.content)||!ek(n.usersWhoUpvoted,r.usersWhoUpvoted)||!tk(n.replies,r.replies)?!1:zw(t,e)}function zw(t,e){return t.currentUserEmail===e.currentUserEmail&&t.isReply===e.isReply&&t.canMentionFields===e.canMentionFields&&t.canMentionAssets===e.canMentionAssets&&t.canMentionModels===e.canMentionModels&&t.isPickerActive===e.isPickerActive&&t.modelFields===e.modelFields&&t.projectUsers===e.projectUsers&&t.projectModels===e.projectModels&&t.deleteComment===e.deleteComment&&t.editComment===e.editComment&&t.upvoteComment===e.upvoteComment&&t.replyComment===e.replyComment&&t.onPickerRequest===e.onPickerRequest}const vT=_.memo(function t({deleteComment:e,editComment:n,upvoteComment:r,replyComment:o,commentObject:i,currentUserEmail:s,isReply:a=!1,modelFields:u=[],projectUsers:l,projectModels:c,ctx:d,canMentionFields:f=!0,onPickerRequest:p,canMentionAssets:h=!1,canMentionModels:m=!0,isPickerActive:v=!1,typedUsers:y=[]}){const w=i.usersWhoUpvoted.some(ge=>ge.email===s),b=Fw(i.content),S="replies"in i,k=i.author.email===s,E=S?i.replies??[]:[],x=E.length,T=E.some(ge=>Fw(ge.content)),O=a?24:32,N=_.useMemo(()=>{var G,le;const ge=new Map,lt=new Map;for(let Y=0;Y<y.length;Y++){const te=y[Y].user,ye=(G=te.email)==null?void 0:G.toLowerCase().trim(),ae=(le=te.name)==null?void 0:le.toLowerCase().trim();ye&&!ge.has(ye)&&ge.set(ye,Y),ae&&!lt.has(ae)&<.set(ae,Y)}return{byEmail:ge,byName:lt}},[y]),$=_.useMemo(()=>{var Y,te;const ge=yr(i.author.email||"",O*2),lt=(Y=i.author.email)==null?void 0:Y.toLowerCase().trim(),G=(te=i.author.name)==null?void 0:te.toLowerCase().trim();let le=-1;if(lt&&(le=N.byEmail.get(lt)??-1),le===-1&&G&&(le=N.byName.get(G)??-1),le!==-1&&le<l.length){const ye=l[le];return{name:ye.name,avatarUrl:ye.avatarUrl??ge}}return{name:i.author.name,avatarUrl:ge}},[i.author,l,N,O]),P=$.avatarUrl,D=$.name,[q,B]=_.useState(!1),z=_.useRef(v);z.current=v;const{isEditing:K,setIsEditing:I,segments:L,setSegments:F,composerRef:Z,handleStartEditing:ie,resetToOriginal:ke}=fV({commentContent:i.content,isNewComment:b});_.useEffect(()=>{T&&!q&&B(!0)},[T,q]);const fe=_.useMemo(()=>i.usersWhoUpvoted.map(ge=>bV(ge,y)).join(", "),[i.usersWhoUpvoted,y]),Ne=_.useMemo(()=>Ig(L),[L]),pe=()=>{if(Ne){S?e(i.id):e(i.id,i.parentCommentId);return}I(!1),S?n(i.id,L):n(i.id,L,i.parentCommentId)},Ae=()=>{S?e(i.id):e(i.id,i.parentCommentId)},Ue=()=>{S?r(i.id,w):r(i.id,w,i.parentCommentId)},pt=()=>{B(!0),o(i.id)},Ve=()=>{b?Ae():ke()},Mn=()=>{setTimeout(()=>{Ne&&b&&!z.current&&Ae()},150)},_o=()=>{B(!q)},se=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("@")},[Z]),Nr=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("#")},[Z]),So=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("$")},[Z]),Ar=_.useCallback(()=>{p&&p("asset",Z)},[p,Z]),$n=_.useCallback(()=>{p&&p("record",Z)},[p,Z]);return g.jsxs("div",{className:ot(A.comment,a&&A.reply,k&&A.ownComment),children:[!K&&g.jsx(e4,{onUpvote:Ue,onReply:S?pt:void 0,onEdit:ie,onDelete:Ae,userUpvoted:w,userIsAuthor:k,isTopLevel:S,hasUpvotes:i.usersWhoUpvoted.length>0}),g.jsxs("div",{className:A.commentBody,style:{gridTemplateColumns:`${O}px 1fr`},children:[g.jsx("div",{className:A.avatarContainer,children:g.jsx("img",{className:A.avatar,src:P,alt:D,style:{width:O,height:O},onError:ge=>{const lt=ge.currentTarget;lt.onerror=null,lt.src=yr(i.author.email||"",O*2)}})}),g.jsxs("div",{className:A.content,children:[g.jsxs("div",{className:A.header,children:[g.jsx("span",{className:A.authorName,children:D}),g.jsx("span",{className:A.timestamp,children:g.jsx(ol,{date:new Date(i.dateISO)})})]}),K?g.jsx("div",{className:A.editContainer,children:g.jsxs(uk,{compact:!0,children:[g.jsx(rf,{ref:Z,segments:L,onSegmentsChange:F,onSubmit:pe,onCancel:Ve,onBlur:Mn,placeholder:"Write a comment...",projectUsers:l,modelFields:u,projectModels:c,canMentionAssets:h,canMentionModels:m,canMentionFields:f,onAssetTrigger:Ar,onRecordTrigger:$n,autoFocus:!0,ctx:d}),g.jsx(Ay,{onUserClick:se,onFieldClick:Nr,onRecordClick:$n,onAssetClick:Ar,onModelClick:So,onSendClick:pe,isSendDisabled:Ne,canMentionAssets:h&&!!p,canMentionModels:m,canMentionFields:f})]})}):g.jsx("div",{className:A.text,children:g.jsx(Y5,{segments:i.content})}),g.jsxs("div",{className:A.footer,children:[i.usersWhoUpvoted.length>0&&!K&&g.jsxs("div",{className:A.reactionWrapper,children:[g.jsxs("button",{type:"button",className:ot(A.reaction,w&&A.reactionActive),onClick:Ue,children:[g.jsx(CS,{role:"img","aria-labelledby":"upvoteIconTitle"}),g.jsx("title",{id:"upvoteIconTitle",children:"Upvote"}),g.jsx("span",{children:i.usersWhoUpvoted.length})]}),g.jsxs("div",{className:A.tooltip,children:[fe,g.jsx("div",{className:A.tooltipArrow})]})]}),S&&x>0&&!K&&g.jsxs("button",{type:"button",className:A.replyToggle,onClick:_o,"aria-expanded":q,"aria-label":`${q?"Collapse":"Expand"} ${x} ${x===1?"reply":"replies"}`,children:[g.jsx("div",{className:A.replyAvatars,children:(()=>{var G,le;const ge=new Set,lt=[];for(const Y of E){const te=((G=Y.author.email)==null?void 0:G.toLowerCase().trim())||((le=Y.author.name)==null?void 0:le.toLowerCase().trim())||Y.id;if(!ge.has(te)&&(ge.add(te),lt.push(Y),lt.length>=3))break}return lt.map((Y,te)=>{var Ee,As;const ye=yr(Y.author.email||"",40),ae=(Ee=Y.author.email)==null?void 0:Ee.toLowerCase().trim(),we=(As=Y.author.name)==null?void 0:As.toLowerCase().trim();let Ce=-1;ae&&(Ce=N.byEmail.get(ae)??-1),Ce===-1&&we&&(Ce=N.byName.get(we)??-1);const qe=Ce!==-1?l[Ce]:null,ut=(qe==null?void 0:qe.avatarUrl)??ye,bt=(qe==null?void 0:qe.name)??Y.author.name,zn=yr(Y.author.email||"",40);return g.jsx("img",{src:ut,alt:bt,className:A.replyAvatar,style:{zIndex:3-te},onError:af=>{const Bg=af.currentTarget;Bg.onerror=null,Bg.src=zn}},Y.id)})})()}),g.jsx("div",{className:A.replyMeta,children:g.jsxs("span",{className:A.replyText,children:[x," ",x===1?"reply":"replies"]})}),g.jsx(BR,{className:ot(A.chevron,q&&A.chevronExpanded),role:"img","aria-labelledby":"chevronTitle"}),g.jsx("title",{id:"chevronTitle",children:q?"Collapse":"Expand"})]})]})]})]}),S&&x>0&&q&&g.jsx("div",{className:A.replies,children:E.map(ge=>g.jsx(t,{deleteComment:e,editComment:n,upvoteComment:r,replyComment:o,commentObject:ge,currentUserEmail:s,isReply:!0,modelFields:u,projectUsers:l,projectModels:c,ctx:d,canMentionFields:f,onPickerRequest:p,canMentionAssets:h,canMentionModels:m,isPickerActive:v,typedUsers:y},ge.id))})]})},_V);class hd extends ue.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){Te("Comment rendering failed",e,{componentStack:n.componentStack})}render(){return this.state.hasError?g.jsx("div",{className:A.errorFallback,children:this.props.fallbackMessage??"Unable to display comment"}):this.props.children}}const SV=({comments:t,hasMoreComments:e,onLoadMore:n,currentUserEmail:r,modelFields:o,projectUsers:i,projectModels:s,deleteComment:a,editComment:u,upvoteComment:l,replyComment:c,onPickerRequest:d,canMentionAssets:f,canMentionModels:p,ctx:h,isPickerActive:m,typedUsers:v})=>t.length===0?g.jsxs("div",{className:He.empty,children:[g.jsx("p",{children:"No comments yet"}),g.jsx("span",{children:"Be the first to leave a comment on this record."})]}):g.jsxs("div",{className:He.commentsList,children:[t.map(y=>g.jsx(hd,{children:g.jsx(vT,{deleteComment:a,editComment:u,upvoteComment:l,replyComment:c,commentObject:y,currentUserEmail:r,modelFields:o,projectUsers:i,projectModels:s,onPickerRequest:d,canMentionAssets:f,canMentionModels:p,ctx:h,isPickerActive:m,typedUsers:v})},y.id)),e&&g.jsx("button",{type:"button",className:He.loadMoreButton,onClick:n,children:"Load more comments"})]}),kV=_.memo(SV);var wT={},Qn={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});class bT extends Error{constructor(e,n,r,o,i,s,a){super(e),this.name="GraphQLError",this.message=e,i&&(this.path=i),n&&(this.nodes=Array.isArray(n)?n:[n]),r&&(this.source=r),o&&(this.positions=o),s&&(this.originalError=s);var u=a;if(!u&&s){var l=s.extensions;l&&typeof l=="object"&&(u=l)}this.extensions=u||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}var ee,V;function Bt(t){return new bT(`Syntax Error: Unexpected token at ${V} in ${t}`)}function Uw(t){if(t.lastIndex=V,t.test(ee))return ee.slice(V,V=t.lastIndex)}var mu=/ +(?=[^\s])/y;function xV(t){for(var e=t.split(`
|
|
226
|
+
*/var mV=function(t){return t!=null&&(gT(t)||yV(t)||!!t._isBuffer)};function gT(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function yV(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&gT(t.slice(0,0))}(function(){var t=hV,e=$w.utf8,n=mV,r=$w.bin,o=function(i,s){i.constructor==String?s&&s.encoding==="binary"?i=r.stringToBytes(i):i=e.stringToBytes(i):n(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var a=t.bytesToWords(i),u=i.length*8,l=1732584193,c=-271733879,d=-1732584194,f=271733878,p=0;p<a.length;p++)a[p]=(a[p]<<8|a[p]>>>24)&16711935|(a[p]<<24|a[p]>>>8)&4278255360;a[u>>>5]|=128<<u%32,a[(u+64>>>9<<4)+14]=u;for(var h=o._ff,m=o._gg,v=o._hh,y=o._ii,p=0;p<a.length;p+=16){var w=l,b=c,S=d,k=f;l=h(l,c,d,f,a[p+0],7,-680876936),f=h(f,l,c,d,a[p+1],12,-389564586),d=h(d,f,l,c,a[p+2],17,606105819),c=h(c,d,f,l,a[p+3],22,-1044525330),l=h(l,c,d,f,a[p+4],7,-176418897),f=h(f,l,c,d,a[p+5],12,1200080426),d=h(d,f,l,c,a[p+6],17,-1473231341),c=h(c,d,f,l,a[p+7],22,-45705983),l=h(l,c,d,f,a[p+8],7,1770035416),f=h(f,l,c,d,a[p+9],12,-1958414417),d=h(d,f,l,c,a[p+10],17,-42063),c=h(c,d,f,l,a[p+11],22,-1990404162),l=h(l,c,d,f,a[p+12],7,1804603682),f=h(f,l,c,d,a[p+13],12,-40341101),d=h(d,f,l,c,a[p+14],17,-1502002290),c=h(c,d,f,l,a[p+15],22,1236535329),l=m(l,c,d,f,a[p+1],5,-165796510),f=m(f,l,c,d,a[p+6],9,-1069501632),d=m(d,f,l,c,a[p+11],14,643717713),c=m(c,d,f,l,a[p+0],20,-373897302),l=m(l,c,d,f,a[p+5],5,-701558691),f=m(f,l,c,d,a[p+10],9,38016083),d=m(d,f,l,c,a[p+15],14,-660478335),c=m(c,d,f,l,a[p+4],20,-405537848),l=m(l,c,d,f,a[p+9],5,568446438),f=m(f,l,c,d,a[p+14],9,-1019803690),d=m(d,f,l,c,a[p+3],14,-187363961),c=m(c,d,f,l,a[p+8],20,1163531501),l=m(l,c,d,f,a[p+13],5,-1444681467),f=m(f,l,c,d,a[p+2],9,-51403784),d=m(d,f,l,c,a[p+7],14,1735328473),c=m(c,d,f,l,a[p+12],20,-1926607734),l=v(l,c,d,f,a[p+5],4,-378558),f=v(f,l,c,d,a[p+8],11,-2022574463),d=v(d,f,l,c,a[p+11],16,1839030562),c=v(c,d,f,l,a[p+14],23,-35309556),l=v(l,c,d,f,a[p+1],4,-1530992060),f=v(f,l,c,d,a[p+4],11,1272893353),d=v(d,f,l,c,a[p+7],16,-155497632),c=v(c,d,f,l,a[p+10],23,-1094730640),l=v(l,c,d,f,a[p+13],4,681279174),f=v(f,l,c,d,a[p+0],11,-358537222),d=v(d,f,l,c,a[p+3],16,-722521979),c=v(c,d,f,l,a[p+6],23,76029189),l=v(l,c,d,f,a[p+9],4,-640364487),f=v(f,l,c,d,a[p+12],11,-421815835),d=v(d,f,l,c,a[p+15],16,530742520),c=v(c,d,f,l,a[p+2],23,-995338651),l=y(l,c,d,f,a[p+0],6,-198630844),f=y(f,l,c,d,a[p+7],10,1126891415),d=y(d,f,l,c,a[p+14],15,-1416354905),c=y(c,d,f,l,a[p+5],21,-57434055),l=y(l,c,d,f,a[p+12],6,1700485571),f=y(f,l,c,d,a[p+3],10,-1894986606),d=y(d,f,l,c,a[p+10],15,-1051523),c=y(c,d,f,l,a[p+1],21,-2054922799),l=y(l,c,d,f,a[p+8],6,1873313359),f=y(f,l,c,d,a[p+15],10,-30611744),d=y(d,f,l,c,a[p+6],15,-1560198380),c=y(c,d,f,l,a[p+13],21,1309151649),l=y(l,c,d,f,a[p+4],6,-145523070),f=y(f,l,c,d,a[p+11],10,-1120210379),d=y(d,f,l,c,a[p+2],15,718787259),c=y(c,d,f,l,a[p+9],21,-343485551),l=l+w>>>0,c=c+b>>>0,d=d+S>>>0,f=f+k>>>0}return t.endian([l,c,d,f])};o._ff=function(i,s,a,u,l,c,d){var f=i+(s&a|~s&u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._gg=function(i,s,a,u,l,c,d){var f=i+(s&u|a&~u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._hh=function(i,s,a,u,l,c,d){var f=i+(s^a^u)+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._ii=function(i,s,a,u,l,c,d){var f=i+(a^(s|~u))+(l>>>0)+d;return(f<<c|f>>>32-c)+s},o._blocksize=16,o._digestsize=16,mT.exports=function(i,s){if(i==null)throw new Error("Illegal argument "+i);var a=t.wordsToBytes(o(i,s));return s&&s.asBytes?a:s&&s.asString?r.bytesToString(a):t.bytesToHex(a)}})();var gV=mT.exports;const vV=di(gV);function yr(t,e=64){return`https://www.gravatar.com/avatar/${vV(t)}?d=mp&s=${e}`}function Ag(t,e,n,r=300){const o=t.startsWith("image/"),i=t.startsWith("video/");return o&&e?`${e}?w=${r}&fit=max&auto=format`:i&&n?`https://image.mux.com/${n}/thumbnail.jpg?width=${r}&fit_mode=preserve`:null}function Ig(t){return t.length===0?!0:t.length===1&&t[0].type==="text"?!t[0].content.trim():!1}function Mm(t){const e=t.attributes.mime_type??"application/octet-stream",n=t.attributes.url??"",r=Ag(e,n,t.attributes.mux_playback_id);return{type:"asset",id:t.id,filename:t.attributes.filename,url:n,thumbnailUrl:r,mimeType:e}}function wV(t,e){const n=t.email.toLowerCase().trim(),r=t.name.toLowerCase().trim();if(n){const o=e.find(i=>i.user.email&&i.user.email.toLowerCase().trim()===n);if(o)return o}if(r){const o=e.find(i=>i.user.name.toLowerCase().trim()===r);if(o)return o}return null}function bV(t,e){const n=wV(t,e);return n?n.user.name:t.name||t.email.split("@")[0]}function _V(t,e){const n=t.commentObject,r=e.commentObject;return n===r?zw(t,e):n.id!==r.id||!il(n.content,r.content)||!ek(n.usersWhoUpvoted,r.usersWhoUpvoted)||!tk(n.replies,r.replies)?!1:zw(t,e)}function zw(t,e){return t.currentUserEmail===e.currentUserEmail&&t.isReply===e.isReply&&t.canMentionFields===e.canMentionFields&&t.canMentionAssets===e.canMentionAssets&&t.canMentionModels===e.canMentionModels&&t.isPickerActive===e.isPickerActive&&t.modelFields===e.modelFields&&t.projectUsers===e.projectUsers&&t.projectModels===e.projectModels&&t.deleteComment===e.deleteComment&&t.editComment===e.editComment&&t.upvoteComment===e.upvoteComment&&t.replyComment===e.replyComment&&t.onPickerRequest===e.onPickerRequest}const vT=_.memo(function t({deleteComment:e,editComment:n,upvoteComment:r,replyComment:o,commentObject:i,currentUserEmail:s,isReply:a=!1,modelFields:u=[],projectUsers:l,projectModels:c,ctx:d,canMentionFields:f=!0,onPickerRequest:p,canMentionAssets:h=!1,canMentionModels:m=!0,isPickerActive:v=!1,typedUsers:y=[]}){const w=i.usersWhoUpvoted.some(ge=>ge.email===s),b=Fw(i.content),S="replies"in i,k=i.author.email===s,E=S?i.replies??[]:[],x=E.length,T=E.some(ge=>Fw(ge.content)),O=a?24:32,N=_.useMemo(()=>{var G,le;const ge=new Map,lt=new Map;for(let Y=0;Y<y.length;Y++){const te=y[Y].user,ye=(G=te.email)==null?void 0:G.toLowerCase().trim(),ae=(le=te.name)==null?void 0:le.toLowerCase().trim();ye&&!ge.has(ye)&&ge.set(ye,Y),ae&&!lt.has(ae)&<.set(ae,Y)}return{byEmail:ge,byName:lt}},[y]),$=_.useMemo(()=>{var Y,te;const ge=yr(i.author.email||"",O*2),lt=(Y=i.author.email)==null?void 0:Y.toLowerCase().trim(),G=(te=i.author.name)==null?void 0:te.toLowerCase().trim();let le=-1;if(lt&&(le=N.byEmail.get(lt)??-1),le===-1&&G&&(le=N.byName.get(G)??-1),le!==-1&&le<l.length){const ye=l[le];return{name:ye.name,avatarUrl:ye.avatarUrl??ge}}return{name:i.author.name,avatarUrl:ge}},[i.author,l,N,O]),P=$.avatarUrl,D=$.name,[q,B]=_.useState(!1),z=_.useRef(v);z.current=v;const{isEditing:K,setIsEditing:I,segments:L,setSegments:F,composerRef:Z,handleStartEditing:ie,resetToOriginal:ke}=fV({commentContent:i.content,isNewComment:b});_.useEffect(()=>{T&&!q&&B(!0)},[T,q]);const fe=_.useMemo(()=>i.usersWhoUpvoted.map(ge=>bV(ge,y)).join(", "),[i.usersWhoUpvoted,y]),Ne=_.useMemo(()=>Ig(L),[L]),pe=()=>{if(Ne){S?e(i.id):e(i.id,i.parentCommentId);return}I(!1),S?n(i.id,L):n(i.id,L,i.parentCommentId)},Ae=()=>{S?e(i.id):e(i.id,i.parentCommentId)},Ue=()=>{S?r(i.id,w):r(i.id,w,i.parentCommentId)},pt=()=>{B(!0),o(i.id)},Ve=()=>{b?Ae():ke()},Mn=()=>{setTimeout(()=>{Ne&&b&&!z.current&&Ae()},150)},_o=()=>{B(!q)},se=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("@")},[Z]),Nr=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("#")},[Z]),So=_.useCallback(()=>{var ge;(ge=Z.current)==null||ge.insertText("$")},[Z]),Ar=_.useCallback(()=>{p&&p("asset",Z)},[p,Z]),$n=_.useCallback(()=>{p&&p("record",Z)},[p,Z]);return g.jsxs("div",{className:ot(A.comment,a&&A.reply,k&&A.ownComment),children:[!K&&g.jsx(e4,{onUpvote:Ue,onReply:S?pt:void 0,onEdit:ie,onDelete:Ae,userUpvoted:w,userIsAuthor:k,isTopLevel:S,hasUpvotes:i.usersWhoUpvoted.length>0}),g.jsxs("div",{className:A.commentBody,style:{gridTemplateColumns:`${O}px 1fr`},children:[g.jsx("div",{className:A.avatarContainer,children:g.jsx("img",{className:A.avatar,src:P,alt:D,style:{width:O,height:O},onError:ge=>{const lt=ge.currentTarget;lt.onerror=null,lt.src=yr(i.author.email||"",O*2)}})}),g.jsxs("div",{className:A.content,children:[g.jsxs("div",{className:A.header,children:[g.jsx("span",{className:A.authorName,children:D}),g.jsx("span",{className:A.timestamp,children:g.jsx(ol,{date:new Date(i.dateISO)})})]}),K?g.jsx("div",{className:A.editContainer,children:g.jsxs(uk,{compact:!0,children:[g.jsx(rf,{ref:Z,segments:L,onSegmentsChange:F,onSubmit:pe,onCancel:Ve,onBlur:Mn,placeholder:"Write a comment...",projectUsers:l,modelFields:u,projectModels:c,canMentionAssets:h,canMentionModels:m,canMentionFields:f,onAssetTrigger:Ar,onRecordTrigger:$n,autoFocus:!0,ctx:d}),g.jsx(Ay,{onUserClick:se,onFieldClick:Nr,onRecordClick:$n,onAssetClick:Ar,onModelClick:So,onSendClick:pe,isSendDisabled:Ne,canMentionAssets:h&&!!p,canMentionModels:m,canMentionFields:f})]})}):g.jsx("div",{className:A.text,children:g.jsx(Y5,{segments:i.content})}),g.jsxs("div",{className:A.footer,children:[i.usersWhoUpvoted.length>0&&!K&&g.jsxs("div",{className:A.reactionWrapper,children:[g.jsxs("button",{type:"button",className:ot(A.reaction,w&&A.reactionActive),onClick:Ue,children:[g.jsx(CS,{role:"img","aria-labelledby":"upvoteIconTitle"}),g.jsx("title",{id:"upvoteIconTitle",children:"Upvote"}),g.jsx("span",{children:i.usersWhoUpvoted.length})]}),g.jsxs("div",{className:A.tooltip,children:[fe,g.jsx("div",{className:A.tooltipArrow})]})]}),S&&x>0&&!K&&g.jsxs("button",{type:"button",className:A.replyToggle,onClick:_o,"aria-expanded":q,"aria-label":`${q?"Collapse":"Expand"} ${x} ${x===1?"reply":"replies"}`,children:[g.jsx("div",{className:A.replyAvatars,children:(()=>{var G,le;const ge=new Set,lt=[];for(const Y of E){const te=((G=Y.author.email)==null?void 0:G.toLowerCase().trim())||((le=Y.author.name)==null?void 0:le.toLowerCase().trim())||Y.id;if(!ge.has(te)&&(ge.add(te),lt.push(Y),lt.length>=3))break}return lt.map((Y,te)=>{var Ee,As;const ye=yr(Y.author.email||"",40),ae=(Ee=Y.author.email)==null?void 0:Ee.toLowerCase().trim(),we=(As=Y.author.name)==null?void 0:As.toLowerCase().trim();let Ce=-1;ae&&(Ce=N.byEmail.get(ae)??-1),Ce===-1&&we&&(Ce=N.byName.get(we)??-1);const qe=Ce!==-1?l[Ce]:null,ut=(qe==null?void 0:qe.avatarUrl)??ye,bt=(qe==null?void 0:qe.name)??Y.author.name,zn=yr(Y.author.email||"",40);return g.jsx("img",{src:ut,alt:bt,className:A.replyAvatar,style:{zIndex:3-te},onError:af=>{const Bg=af.currentTarget;Bg.onerror=null,Bg.src=zn}},Y.id)})})()}),g.jsx("div",{className:A.replyMeta,children:g.jsxs("span",{className:A.replyText,children:[x," ",x===1?"reply":"replies"]})}),g.jsx(BR,{className:ot(A.chevron,q&&A.chevronExpanded),role:"img","aria-labelledby":"chevronTitle"}),g.jsx("title",{id:"chevronTitle",children:q?"Collapse":"Expand"})]})]})]})]}),S&&x>0&&q&&g.jsx("div",{className:A.replies,children:E.map(ge=>g.jsx(t,{deleteComment:e,editComment:n,upvoteComment:r,replyComment:o,commentObject:ge,currentUserEmail:s,isReply:!0,modelFields:u,projectUsers:l,projectModels:c,ctx:d,canMentionFields:f,onPickerRequest:p,canMentionAssets:h,canMentionModels:m,isPickerActive:v,typedUsers:y},ge.id))})]})},_V);class hd extends ue.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){Te("Comment rendering failed",e,{componentStack:n.componentStack})}render(){return this.state.hasError?g.jsx("div",{className:A.errorFallback,children:this.props.fallbackMessage??"Unable to display comment"}):this.props.children}}const SV=({comments:t,hasMoreComments:e,onLoadMore:n,currentUserEmail:r,modelFields:o,projectUsers:i,projectModels:s,deleteComment:a,editComment:u,upvoteComment:l,replyComment:c,onPickerRequest:d,canMentionAssets:f,canMentionModels:p,ctx:h,isPickerActive:m,typedUsers:v})=>t.length===0?g.jsxs("div",{className:He.empty,children:[g.jsx("p",{children:"No comments yet"}),g.jsx("span",{children:"Be the first to leave a comment on this record."})]}):g.jsxs("div",{className:He.commentsList,children:[t.map(y=>g.jsx(hd,{children:g.jsx(vT,{deleteComment:a,editComment:u,upvoteComment:l,replyComment:c,commentObject:y,currentUserEmail:r,modelFields:o,projectUsers:i,projectModels:s,onPickerRequest:d,canMentionAssets:f,canMentionModels:p,ctx:h,isPickerActive:m,typedUsers:v})},y.id)),e&&g.jsx("button",{type:"button",className:He.loadMoreButton,onClick:n,children:"Load more comments"})]}),kV=_.memo(SV);var wT={},Qn={},_t={};Object.defineProperty(_t,"__esModule",{value:!0});class bT extends Error{constructor(e,n,r,o,i,s,a){super(e),this.name="GraphQLError",this.message=e,i&&(this.path=i),n&&(this.nodes=Array.isArray(n)?n:[n]),r&&(this.source=r),o&&(this.positions=o),s&&(this.originalError=s);var u=a;if(!u&&s){var l=s.extensions;l&&typeof l=="object"&&(u=l)}this.extensions=u||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}var ee,V;function Ft(t){return new bT(`Syntax Error: Unexpected token at ${V} in ${t}`)}function Uw(t){if(t.lastIndex=V,t.test(ee))return ee.slice(V,V=t.lastIndex)}var mu=/ +(?=[^\s])/y;function xV(t){for(var e=t.split(`
|
|
227
227
|
`),n="",r=0,o=0,i=e.length-1,s=0;s<e.length;s++)mu.lastIndex=0,mu.test(e[s])&&(s&&(!r||mu.lastIndex<r)&&(r=mu.lastIndex),o=o||s,i=s);for(var a=o;a<=i;a++)a!==o&&(n+=`
|
|
228
|
-
`),n+=e[a].slice(r).replace(/\\"""/g,'"""');return n}function be(){for(var t=0|ee.charCodeAt(V++);t===9||t===10||t===13||t===32||t===35||t===44||t===65279;t=0|ee.charCodeAt(V++))if(t===35)for(;(t=0|ee.charCodeAt(V++))&&t!==10&&t!==13;);V--}function Pg(){for(var t=V,e=0|ee.charCodeAt(V++);e>=48&&e<=57||e>=65&&e<=90||e===95||e>=97&&e<=122;e=0|ee.charCodeAt(V++));if(t===V-1)throw
|
|
228
|
+
`),n+=e[a].slice(r).replace(/\\"""/g,'"""');return n}function be(){for(var t=0|ee.charCodeAt(V++);t===9||t===10||t===13||t===32||t===35||t===44||t===65279;t=0|ee.charCodeAt(V++))if(t===35)for(;(t=0|ee.charCodeAt(V++))&&t!==10&&t!==13;);V--}function Pg(){for(var t=V,e=0|ee.charCodeAt(V++);e>=48&&e<=57||e>=65&&e<=90||e===95||e>=97&&e<=122;e=0|ee.charCodeAt(V++));if(t===V-1)throw Ft("Name");var n=ee.slice(t,--V);return be(),n}function Gt(){return{kind:"Name",value:Pg()}}var EV=/(?:"""|(?:[\s\S]*?[^\\])""")/y,TV=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function ci(t){var e;switch(ee.charCodeAt(V)){case 91:V++,be();for(var n=[];ee.charCodeAt(V)!==93;)n.push(ci(t));return V++,be(),{kind:"ListValue",values:n};case 123:V++,be();for(var r=[];ee.charCodeAt(V)!==125;){var o=Gt();if(ee.charCodeAt(V++)!==58)throw Ft("ObjectField");be(),r.push({kind:"ObjectField",name:o,value:ci(t)})}return V++,be(),{kind:"ObjectValue",fields:r};case 36:if(t)throw Ft("Variable");return V++,{kind:"Variable",name:Gt()};case 34:if(ee.charCodeAt(V+1)===34&&ee.charCodeAt(V+2)===34){if(V+=3,(e=Uw(EV))==null)throw Ft("StringValue");return be(),{kind:"StringValue",value:xV(e.slice(0,-3)),block:!0}}else{var i=V,s;V++;var a=!1;for(s=0|ee.charCodeAt(V++);s===92&&(V++,a=!0)||s!==10&&s!==13&&s!==34&&s;s=0|ee.charCodeAt(V++));if(s!==34)throw Ft("StringValue");return e=ee.slice(i,V),be(),{kind:"StringValue",value:a?JSON.parse(e):e.slice(1,-1),block:!1}}case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var u=V++,l;(l=0|ee.charCodeAt(V++))>=48&&l<=57;);var c=ee.slice(u,--V);if((l=ee.charCodeAt(V))===46||l===69||l===101){if((e=Uw(TV))==null)throw Ft("FloatValue");return be(),{kind:"FloatValue",value:c+e}}else return be(),{kind:"IntValue",value:c};case 110:if(ee.charCodeAt(V+1)===117&&ee.charCodeAt(V+2)===108&&ee.charCodeAt(V+3)===108)return V+=4,be(),{kind:"NullValue"};break;case 116:if(ee.charCodeAt(V+1)===114&&ee.charCodeAt(V+2)===117&&ee.charCodeAt(V+3)===101)return V+=4,be(),{kind:"BooleanValue",value:!0};break;case 102:if(ee.charCodeAt(V+1)===97&&ee.charCodeAt(V+2)===108&&ee.charCodeAt(V+3)===115&&ee.charCodeAt(V+4)===101)return V+=5,be(),{kind:"BooleanValue",value:!1};break}return{kind:"EnumValue",value:Pg()}}function _T(t){if(ee.charCodeAt(V)===40){var e=[];V++,be();do{var n=Gt();if(ee.charCodeAt(V++)!==58)throw Ft("Argument");be(),e.push({kind:"Argument",name:n,value:ci(t)})}while(ee.charCodeAt(V)!==41);return V++,be(),e}}function Hr(t){if(ee.charCodeAt(V)===64){var e=[];do V++,e.push({kind:"Directive",name:Gt(),arguments:_T(t)});while(ee.charCodeAt(V)===64);return e}}function ST(){for(var t=0;ee.charCodeAt(V)===91;)t++,V++,be();var e={kind:"NamedType",name:Gt()};do if(ee.charCodeAt(V)===33&&(V++,be(),e={kind:"NonNullType",type:e}),t){if(ee.charCodeAt(V++)!==93)throw Ft("NamedType");be(),e={kind:"ListType",type:e}}while(t--);return e}function md(){if(ee.charCodeAt(V++)!==123)throw Ft("SelectionSet");return be(),yd()}function yd(){var t=[];do if(ee.charCodeAt(V)===46){if(ee.charCodeAt(++V)!==46||ee.charCodeAt(++V)!==46)throw Ft("SelectionSet");switch(V++,be(),ee.charCodeAt(V)){case 64:t.push({kind:"InlineFragment",typeCondition:void 0,directives:Hr(!1),selectionSet:md()});break;case 111:ee.charCodeAt(V+1)===110?(V+=2,be(),t.push({kind:"InlineFragment",typeCondition:{kind:"NamedType",name:Gt()},directives:Hr(!1),selectionSet:md()})):t.push({kind:"FragmentSpread",name:Gt(),directives:Hr(!1)});break;case 123:V++,be(),t.push({kind:"InlineFragment",typeCondition:void 0,directives:void 0,selectionSet:yd()});break;default:t.push({kind:"FragmentSpread",name:Gt(),directives:Hr(!1)})}}else{var e=Gt(),n=void 0;ee.charCodeAt(V)===58&&(V++,be(),n=e,e=Gt());var r=_T(!1),o=Hr(!1),i=void 0;ee.charCodeAt(V)===123&&(V++,be(),i=yd()),t.push({kind:"Field",alias:n,name:e,arguments:r,directives:o,selectionSet:i})}while(ee.charCodeAt(V)!==125);return V++,be(),{kind:"SelectionSet",selections:t}}function CV(){if(be(),ee.charCodeAt(V)===40){var t=[];V++,be();do{var e=void 0;if(ee.charCodeAt(V)===34&&(e=ci(!0)),ee.charCodeAt(V++)!==36)throw Ft("Variable");var n=Gt();if(ee.charCodeAt(V++)!==58)throw Ft("VariableDefinition");be();var r=ST(),o=void 0;ee.charCodeAt(V)===61&&(V++,be(),o=ci(!0)),be();var i={kind:"VariableDefinition",variable:{kind:"Variable",name:n},type:r,defaultValue:o,directives:Hr(!0)};e&&(i.description=e),t.push(i)}while(ee.charCodeAt(V)!==41);return V++,be(),t}}function MV(t){var e=Gt();if(ee.charCodeAt(V++)!==111||ee.charCodeAt(V++)!==110)throw Ft("FragmentDefinition");be();var n={kind:"FragmentDefinition",name:e,typeCondition:{kind:"NamedType",name:Gt()},directives:Hr(!1),selectionSet:md()};return t&&(n.description=t),n}function Vw(){var t=[];do{var e=void 0;if(ee.charCodeAt(V)===34&&(e=ci(!0)),ee.charCodeAt(V)===123){if(e)throw Ft("Document");V++,be(),t.push({kind:"OperationDefinition",operation:"query",name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:yd()})}else{var n=Pg();switch(n){case"fragment":t.push(MV(e));break;case"query":case"mutation":case"subscription":var r,o=void 0;(r=ee.charCodeAt(V))!==40&&r!==64&&r!==123&&(o=Gt());var i={kind:"OperationDefinition",operation:n,name:o,variableDefinitions:CV(),directives:Hr(!1),selectionSet:md()};e&&(i.description=e),t.push(i);break;default:throw Ft("Document")}}}while(V<ee.length);return t}var xi={};function Ht(t,e,n){for(var r="",o=0;o<t.length;o++)o&&(r+=e),r+=n(t[o]);return r}function kT(t){return JSON.stringify(t)}function xT(t){return`"""
|
|
229
229
|
`+t.replace(/"""/g,'\\"""')+`
|
|
230
230
|
"""`}var qn=`
|
|
231
231
|
`,Ye={OperationDefinition(t){var e="";t.description&&(e+=Ye.StringValue(t.description)+`
|
|
232
|
-
`),e+=t.operation,t.name&&(e+=" "+t.name.value),t.variableDefinitions&&t.variableDefinitions.length&&(t.name||(e+=" "),e+="("+
|
|
232
|
+
`),e+=t.operation,t.name&&(e+=" "+t.name.value),t.variableDefinitions&&t.variableDefinitions.length&&(t.name||(e+=" "),e+="("+Ht(t.variableDefinitions,", ",Ye.VariableDefinition)+")"),t.directives&&t.directives.length&&(e+=" "+Ht(t.directives," ",Ye.Directive));var n=Ye.SelectionSet(t.selectionSet);return e!=="query"?e+" "+n:n},VariableDefinition(t){var e="";return t.description&&(e+=Ye.StringValue(t.description)+" "),e+=Ye.Variable(t.variable)+": "+sr(t.type),t.defaultValue&&(e+=" = "+sr(t.defaultValue)),t.directives&&t.directives.length&&(e+=" "+Ht(t.directives," ",Ye.Directive)),e},Field(t){var e=t.alias?t.alias.value+": "+t.name.value:t.name.value;if(t.arguments&&t.arguments.length){var n=Ht(t.arguments,", ",Ye.Argument);e.length+n.length+2>80?e+="("+(qn+=" ")+Ht(t.arguments,qn,Ye.Argument)+(qn=qn.slice(0,-2))+")":e+="("+n+")"}return t.directives&&t.directives.length&&(e+=" "+Ht(t.directives," ",Ye.Directive)),t.selectionSet&&t.selectionSet.selections.length&&(e+=" "+Ye.SelectionSet(t.selectionSet)),e},StringValue(t){return t.block?xT(t.value).replace(/\n/g,qn):kT(t.value)},BooleanValue:t=>""+t.value,NullValue:t=>"null",IntValue:t=>t.value,FloatValue:t=>t.value,EnumValue:t=>t.value,Name:t=>t.value,Variable:t=>"$"+t.name.value,ListValue:t=>"["+Ht(t.values,", ",sr)+"]",ObjectValue:t=>"{"+Ht(t.fields,", ",Ye.ObjectField)+"}",ObjectField:t=>t.name.value+": "+sr(t.value),Document(t){return!t.definitions||!t.definitions.length?"":Ht(t.definitions,`
|
|
233
233
|
|
|
234
|
-
`,sr)},SelectionSet:t=>"{"+(qn+=" ")+
|
|
235
|
-
`),e+="fragment "+t.name.value,e+=" on "+t.typeCondition.name.value,t.directives&&t.directives.length&&(e+=" "+
|
|
236
|
-
`,Ye[e.kind]?Ye[e.kind](e):""},_t.printBlockString=xT,_t.printString=kT,_t.valueFromASTUntyped=Ta,_t.valueFromTypeNode=function t(e,n,r){if(e.kind==="Variable")return r?t(r[e.name.value],n,r):void 0;if(n.kind==="NonNullType")return e.kind!=="NullValue"?t(e,n,r):void 0;if(e.kind==="NullValue")return null;if(n.kind==="ListType"){if(e.kind==="ListValue"){for(var o=[],i=0,s=e.values.length;i<s;i++){var a=t(e.values[i],n.type,r);if(a===void 0)return;o.push(a)}return o}}else if(n.kind==="NamedType")switch(n.name.value){case"Int":case"Float":case"String":case"Bool":return n.name.value+"Value"===e.kind?Ta(e,r):void 0;default:return Ta(e,r)}},_t.visit=function(e,n){var r=[],o=[];try{var i=function s(a,u,l){var c=!1,d=n[a.kind]&&n[a.kind].enter||n[a.kind]||n.enter,f=d&&d.call(n,a,u,l,o,r);if(f===!1)return a;if(f===null)return null;if(f===xi)throw xi;f&&typeof f.kind=="string"&&(c=f!==a,a=f),l&&r.push(l);var p,h={...a};for(var m in a){o.push(m);var v=a[m];if(Array.isArray(v)){for(var y=[],w=0;w<v.length;w++)v[w]!=null&&typeof v[w].kind=="string"&&(r.push(a),o.push(w),p=s(v[w],w,v),o.pop(),r.pop(),p==null?c=!0:(c=c||p!==v[w],y.push(p)));v=y}else v!=null&&typeof v.kind=="string"&&(p=s(v,m,a))!==void 0&&(c=c||v!==p,v=p);o.pop(),c&&(h[m]=v)}l&&r.pop();var b=n[a.kind]&&n[a.kind].leave||n.leave,S=b&&b.call(n,a,u,l,o,r);if(S===xi)throw xi;return S!==void 0?S:f!==void 0?c?h:f:c?h:a}(e);return i!==void 0&&i!==!1?i:e}catch(s){if(s!==xi)throw s;return e}};var Rg=it&&it.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ao=it&&it.__assign||function(){return Ao=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Ao.apply(this,arguments)},qw=it&&it.__awaiter||function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},Hw=it&&it.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Qn.__esModule=!0;Qn.subscribeToQuery=Qn.InvalidResponseError=Qn.Response400Error=Qn.Response500Error=void 0;var OV=_t,NV=function(){function t(e,n){this.type=e,this.data=n==null?void 0:n.data}return t}(),AV=typeof MessageEvent<"u"?MessageEvent:NV,ET=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.Response500Error=ET;var Om=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.Response400Error=Om;var TT=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.InvalidResponseError=TT;function CT(t){return qw(this,void 0,void 0,function(){var e,n,r,o,i,s,a,u,l,c,d,f,p,h,m,v,y,w,b,S,k,E,x,T,O,N,$,P=this;return Hw(this,function(D){switch(D.label){case 0:e=t.query,n=t.token,r=t.variables,o=t.preview,i=t.includeDrafts,s=t.excludeInvalid,a=t.environment,u=t.fetcher,l=t.eventSourceClass,c=t.onStatusChange,d=t.onUpdate,f=t.onChannelError,p=t.onError,h=t.onEvent,m=t.reconnectionPeriod,v=t.baseUrl,y=u||window.fetch,w=l||window.EventSource,b=Math.min(m||1e3,2e4),S=v||"https://graphql-listen.datocms.com",k=function(){return qw(P,void 0,void 0,function(){return Hw(this,function(q){switch(q.label){case 0:return[4,new Promise(function(B){return setTimeout(B,b)})];case 1:return q.sent(),[2,CT(Ao(Ao({},t),{reconnectionPeriod:b*2*(1+(Math.random()*.2-.1))}))]}})})},c&&c("connecting"),D.label=1;case 1:return D.trys.push([1,4,,5]),x=typeof e=="string"?e:(0,OV.print)(e),[4,y(S,{headers:Ao(Ao(Ao({Authorization:"Bearer ".concat(n),Accept:"application/json"},a?{"X-Environment":a}:{}),i||o?{"X-Include-Drafts":"true"}:{}),s?{"X-Exclude-Invalid":"true"}:{}),method:"POST",body:JSON.stringify({query:x,variables:r})})];case 2:if(T=D.sent(),T.status>=300&&T.status<500)throw new Om("Invalid status code: ".concat(T.status," ").concat(T.statusText),T);if(T.status>=500)throw new ET("Invalid status code: ".concat(T.status," ").concat(T.statusText),T);if(T.headers.get("Content-Type")!=="application/json")throw new TT("Invalid content type: ".concat(T.headers.get("Content-Type")),T);return[4,T.json()];case 3:return O=D.sent(),E=O.url,h&&h({status:"connecting",channelUrl:E,message:"Received channel URL",response:T}),[3,5];case 4:if(N=D.sent(),p&&($=new AV("FetchError",{data:N}),p($)),N instanceof Om)throw N;return c&&c("closed"),[2,k()];case 5:return[2,new Promise(function(q){var B=new w(E),z=!1,K=function(){B.readyState!==2&&(z=!0,B.close())};B.addEventListener("open",function(){c&&c("connected"),q(K)});var I=setInterval(function(){B.readyState===2&&(clearInterval(I),c&&c("closed"),z||k())},300);B.addEventListener("update",function(L){var F=JSON.parse(L.data);d(F)}),B.addEventListener("channelError",function(L){var F=JSON.parse(L.data);F.fatal&&(z=!0),f&&f(F),B.close()}),B.addEventListener("onerror",function(L){var F=L;p&&p(F),B.close()})})]}})})}Qn.subscribeToQuery=CT;(function(t){var e=it&&it.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=it&&it.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&e(o,r,i)};t.__esModule=!0,n(Qn,t)})(wT);var Ww=Object.prototype.hasOwnProperty;function Kw(t,e,n){for(n of t.keys())if(Ca(n,e))return n}function Ca(t,e){var n,r,o;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Ca(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(o=r,o&&typeof o=="object"&&(o=Kw(e,o),!o)||!e.has(o))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(o=r[0],o&&typeof o=="object"&&(o=Kw(e,o),!o)||!Ca(r[1],e.get(o)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Ww.call(t,n)&&++r&&!Ww.call(e,n)||!(n in e)||!Ca(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function IV(t){var e=_.useRef(t),n=_.useRef(0);return Ca(t,e.current)||(e.current=t,n.current+=1),_.useMemo(function(){return e.current},[n.current])}function PV(t,e){return _.useEffect(t,IV(e))}var RV=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},DV=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function jV(t){const{enabled:e,initialData:n}=t,r=DV(t,["enabled","initialData"]),[o,i]=_.useState(null),[s,a]=_.useState(null),[u,l]=_.useState(e?"connecting":"closed"),c=r;return PV(()=>{if(e===!1)return l("closed"),()=>{};let d;function f(){return RV(this,void 0,void 0,function*(){d=yield wT.subscribeToQuery(Object.assign(Object.assign({},c),{onStatusChange:p=>{l(p)},onUpdate:p=>{i(null),a(p.response.data)},onChannelError:p=>{a(null),i(p)}}))})}return f(),()=>{d&&d()}},[c]),{error:o,status:u,data:s||n}}function MT(t){return Object.values(t).find(e=>(e==null?void 0:e.attributes.api_key)===io)}function Gw(t){return Object.values(t).filter(e=>e!==void 0)}function OT(t){if(!t)return null;const n=t.attributes.icon;return typeof n=="string"?n:null}const LV=["token","unauthorized","401","403","authentication","forbidden"],BV=["network","fetch","connection","timeout","socket","econnrefused"],FV=["graphql","query","syntax","validation"];function wp(t,e){return e.some(n=>t.includes(n))}function $V(t){const e=t.message.toLowerCase();return wp(e,LV)?{type:"token_expired",message:"CDA token is invalid or expired. Please reconfigure in plugin settings."}:wp(e,BV)?{type:"network_error",message:"Connection lost. Attempting to reconnect..."}:wp(e,FV)?{type:"graphql_error",message:"Query error. Please refresh the page."}:{type:"unknown",message:"Sync error occurred. Please try again."}}function Dg(t){const e=t.message.toLowerCase();return e.includes("forbidden")||e.includes("401")||e.includes("403")?{type:"permission_denied",message:"Permission denied."}:e.includes("network")||e.includes("fetch")||e.includes("timeout")?{type:"network_error",message:"Network error. Check your connection."}:{type:"unknown",message:"Failed to load data."}}function NT(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){const e=t;if(typeof e.message=="string")return new Error(e.message)}return new Error(String(t))}const gd={CONNECTING:"connecting",CLOSED:"closed"};function zV({ctx:t,realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o,query:i,variables:s,filterParams:a,subscriptionEnabled:u,onCommentRecordIdChange:l}){const[c,d]=_.useState([]),[f,p]=_.useState(null),[h,m]=_.useState(null),[v,y]=_.useState(!0),w=_.useCallback(I=>{m(I),l==null||l(I)},[l]),[b,S]=_.useState(0),k=_.useRef(0),E=_.useRef(null),{data:x,status:T,error:O}=jV({query:i,variables:s,token:n??"",enabled:u&&!!n&&e,includeDrafts:!0,reconnectionPeriod:b>0?100:void 0});_.useEffect(()=>{T==="connected"&&(k.current=0)},[T]),_.useEffect(()=>{if(O){const I=O instanceof Error?O.message:String(O),L=E.current,F=L instanceof Error?L.message:String(L??"");(!L||I!==F)&&(k.current+=1,E.current=O)}else E.current=null},[O]);const N=_.useCallback(async()=>{if(e){const I=k.current,L=Math.min(1e3*Math.pow(2,I),3e4);I>0&&await new Promise(F=>setTimeout(F,L)),S(F=>F+1)}else B.current=0,P(null),q(I=>I+1)},[e]);_.useEffect(()=>{const I=MT(t.itemTypes);I&&p(I.id)},[t.itemTypes]),_.useEffect(()=>{if(!e)return;const I=x==null?void 0:x.allProjectComments[0];x&&y(!1),!(!I||!o)&&(w(I.id),d(gl(I.content)))},[x,o,e,w,d]);const[$,P]=_.useState(null),[D,q]=_.useState(0),B=_.useRef(0);_.useEffect(()=>{if(e)return;if(!r||!f||!a.recordId){y(!1);return}let I=!0,L=null,F=null;const Z=3e4,ie=3,ke=async(fe=0)=>{if(!I)return;y(!0),fe===0&&P(null);const Ne=new Promise((pe,Ae)=>{L=setTimeout(()=>{I&&Ae(new Error(`CMA fetch timed out after ${Z/1e3} seconds`))},Z)});try{const pe=r.items.list({filter:{type:io,fields:{model_id:{eq:a.modelId},record_id:{eq:a.recordId}}}}),Ae=await Promise.race([pe,Ne]);if(L!==null&&(clearTimeout(L),L=null),!I)return;if(B.current=0,Ae.length>0){const Ue=Ae[0];typeof Ue.id=="string"&&w(Ue.id),d(gl(Ue.content))}y(!1)}catch(pe){if(L!==null&&(clearTimeout(L),L=null),!I)return;const Ae=pe instanceof Error?pe:new Error(String(pe));if(fe<ie){B.current=fe+1;const Ue=Math.min(1e3*Math.pow(2,fe),8e3);Te(`CMA fetch failed (attempt ${fe+1}/${ie+1}), retrying in ${Ue}ms`,Ae,{modelId:a.modelId,recordId:a.recordId}),F=setTimeout(()=>{I&&ke(fe+1)},Ue);return}Te("Failed to fetch comments (CMA fallback) after max retries",Ae,{modelId:a.modelId,recordId:a.recordId,attempts:fe+1}),P(Ae),y(!1)}};return ke(),()=>{I=!1,L!==null&&(clearTimeout(L),L=null),F!==null&&(clearTimeout(F),F=null)}},[e,r,a.modelId,a.recordId,f,D,w,d]);const z=O?NT(O):$,K=z?{error:z,...$V(z),consecutiveCount:k.current}:null;return{comments:c,setComments:d,commentsModelId:f,commentRecordId:h,setCommentRecordId:w,isLoading:v,error:z,errorInfo:K,status:T,retry:N}}const UV="_indicator_1rjaa_1",VV="_spinner_1rjaa_29",qV="_icon_1rjaa_52",HV="_text_1rjaa_62",WV="_count_1rjaa_66",KV="_retryButton_1rjaa_70",Ht={indicator:UV,spinner:VV,icon:qV,text:HV,count:WV,retryButton:KV};function GV({subscriptionStatus:t,subscriptionError:e,retryState:n,onRetry:r}){return n.isRetrying?g.jsxs("div",{className:Ht.indicator,"data-status":"retrying",role:"status","aria-live":"polite","aria-atomic":"true",children:[g.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),g.jsxs("span",{className:Ht.text,children:[n.message,n.retryCount>1&&g.jsxs("span",{className:Ht.count,children:[" (attempt ",n.retryCount,")"]})]})]}):e?g.jsxs("div",{className:Ht.indicator,"data-status":"error",role:"alert","aria-live":"assertive",children:[g.jsx("span",{className:Ht.icon,"aria-hidden":"true",children:"!"}),g.jsx("span",{className:Ht.text,children:"Sync error"}),r&&g.jsx("button",{type:"button",className:Ht.retryButton,onClick:r,children:"Retry"})]}):t===gd.CONNECTING?g.jsxs("div",{className:Ht.indicator,"data-status":"connecting",role:"status","aria-live":"polite",children:[g.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),g.jsx("span",{className:Ht.text,children:"Connecting..."})]}):t===gd.CLOSED?g.jsxs("div",{className:Ht.indicator,"data-status":"disconnected",role:"status","aria-live":"polite",children:[g.jsx("span",{className:Ht.icon,"aria-hidden":"true",children:"●"}),g.jsx("span",{className:Ht.text,children:"Offline"})]}):null}const JV=_.memo(GV);function Nm(t,e){return t.find(n=>n.id===e)}function YV(t,e){var n;return(n=t.replies)==null?void 0:n.find(r=>r.id===e)}function jg(t,e,n,r){if(n){const i=Nm(t,n);if(!i)return`${r.operationName}${n}`,{success:!1,result:{comments:t,status:"failed_parent_missing",failureReason:r.parentMissingReason}};const s=YV(i,e);return s?{success:!0,isReply:!0,parent:i,target:s}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(`${r.operationName}${e}${n}`,{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}const o=Nm(t,e);return o?{success:!0,isReply:!1,target:o}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(`${r.operationName}${e}`,{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}function AT(t,e,n,r){return n?t.map(o=>{var i;return o.id===n?{...o,replies:(i=o.replies)==null?void 0:i.map(s=>s.id===e?r(s):s)}:o}):t.map(o=>o.id===e?r(o):o)}function bp(t,e){switch(e.type){case"ADD_COMMENT":return QV(t,e);case"DELETE_COMMENT":return XV(t,e);case"EDIT_COMMENT":return ZV(t,e);case"UPVOTE_COMMENT":return e9(t,e);case"ADD_REPLY":return t9(t,e)}}function QV(t,e){return t.some(n=>n.id===e.comment.id)?{comments:t,status:"no_op_idempotent"}:{comments:[e.comment,...t],status:"applied"}}function XV(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"DELETE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:"The comment was deleted by another user.",targetNotFoundIsIdempotent:!0});return n.success?n.isReply?{comments:t.map(o=>{var i;return o.id===e.parentCommentId?{...o,replies:(i=o.replies)==null?void 0:i.filter(s=>s.id!==e.id)}:o}),status:"applied"}:{comments:t.filter(r=>r.id!==e.id),status:"applied"}:n.result}function ZV(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"EDIT_COMMENT",parentMissingReason:"Your edit could not be saved because the comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply you were editing was deleted by another user.":"The comment you were editing was deleted by another user."});return n.success?{comments:AT(t,e.id,e.parentCommentId,o=>({...o,content:e.newContent})),status:"applied"}:n.result}function e9(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"UPVOTE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply was deleted by another user.":"The comment was deleted by another user."});if(!n.success)return n.result;const r=i=>{const s=i.some(a=>a.email===e.user.email);return e.action==="add"?s?i:[...i,e.user]:i.filter(a=>a.email!==e.user.email)};return{comments:AT(t,e.id,e.parentCommentId,i=>({...i,usersWhoUpvoted:r(i.usersWhoUpvoted)})),status:"applied"}}function t9(t,e){var o;const n=Nm(t,e.parentCommentId);return n?(o=n.replies)!=null&&o.some(i=>i.id===e.reply.id)?{comments:t,status:"no_op_idempotent"}:{comments:t.map(i=>i.id!==e.parentCommentId?i:{...i,replies:[e.reply,...i.replies??[]]}),status:"applied"}:(`${e.parentCommentId}`,{comments:t,status:"failed_parent_missing",failureReason:"Your reply could not be saved because the comment was deleted by another user."})}const IT=t=>new Promise(e=>setTimeout(e,t));function PT(t,e,n,r=!1){const o=e*Math.pow(2,t),i=r?Math.random()*100:0;return Math.min(o+i,n)}function _p(t){const e={type:t.type};switch(t.type){case"ADD_COMMENT":return{...e,commentId:t.comment.id};case"DELETE_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"EDIT_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"UPVOTE_COMMENT":return{...e,id:t.id,action:t.action,parentCommentId:t.parentCommentId};case"ADD_REPLY":return{...e,parentCommentId:t.parentCommentId,replyId:t.reply.id};default:return e}}function RT({client:t,commentRecordId:e,commentsModelId:n,modelId:r,recordId:o,ctx:i,onRecordCreated:s}){const a=_.useRef([]),[u,l]=_.useState(!1),[c,d]=_.useState(0),[f,p]=_.useState({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null}),h=_.useCallback(()=>{p({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null})},[]),m=_.useCallback((N,$)=>{p({isRetrying:!0,operationType:N,retryCount:$,message:Lt.VERSION_CONFLICT_RETRYING,wasTerminated:!1,terminationReason:null})},[]),[v,y]=_.useState(!1),w=_.useRef(null),b=_.useRef(e);b.current=e,_.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]);const S=_.useCallback(()=>{w.current&&clearTimeout(w.current),y(!0),w.current=setTimeout(()=>{y(!1),w.current=null},Iu.SYNC_COOLDOWN_MS)},[]),k=_.useCallback(async N=>{if(!t||!o)return;let $=0;const P=Date.now();for(;;)try{const D=b.current;if(!D){if(!n)return;const K=await t.items.list({filter:{type:n,fields:{model_id:{eq:r},record_id:{eq:o}}},page:{limit:1}});if(K.length>0){const F=K[0],Z=gl(F.content),ie=bp(Z,N);if(ie.status==="failed_parent_missing"||ie.status==="failed_target_missing"){ie.failureReason&&i.alert(ie.failureReason),h();return}await t.items.update(F.id,{content:JSON.stringify(ie.comments),meta:{current_version:F.meta.current_version}}),s(F.id),S(),h();return}const I=bp([],N),L=await t.items.create({item_type:{type:"item_type",id:n},model_id:r,record_id:o,content:JSON.stringify(I.comments)});s(L.id),S(),h();return}const q=await t.items.find(D),B=gl(q.content),z=bp(B,N);if(z.status==="failed_parent_missing"||z.status==="failed_target_missing"){z.failureReason&&i.alert(z.failureReason),h();return}await t.items.update(D,{content:JSON.stringify(z.comments),meta:{current_version:q.meta.current_version}}),S(),h();return}catch(D){if(D instanceof qi&&D.findError("STALE_ITEM_VERSION")){if($++,$>=Qv.MAX_ATTEMPTS){Te("Retry terminated: max attempts reached for version conflict:",_p(N),{attempt:$}),i.alert(Lt.MAX_RETRIES_EXCEEDED),p({isRetrying:!1,operationType:N.type,retryCount:$,message:Lt.MAX_RETRIES_EXCEEDED,wasTerminated:!0,terminationReason:"max_attempts"});return}if(Date.now()-P>=Qv.MAX_DURATION_MS){Te("Retry terminated: timeout reached for version conflict:",_p(N),{attempt:$,durationMs:Date.now()-P}),i.alert(Lt.OPERATION_TIMEOUT),p({isRetrying:!1,operationType:N.type,retryCount:$,message:Lt.OPERATION_TIMEOUT,wasTerminated:!0,terminationReason:"timeout"});return}m(N.type,$);const q=PT($,Iu.VERSION_CONFLICT_BACKOFF_BASE,Iu.VERSION_CONFLICT_BACKOFF_MAX);await IT(q);continue}Te("Failed to save comment operation:",D,{op:_p(N)}),i.alert(Lt.SAVE_FAILED),h();return}},[t,n,r,o,i,s,S,h,m]),E=_.useRef(!1),x=_.useCallback(async()=>{if(!(E.current||a.current.length===0||!t)){E.current=!0,l(!0);try{for(;a.current.length>0;){const N=a.current[0];await k(N),a.current.shift(),d(a.current.length)}}catch(N){Te("Unexpected error in processQueue - operation removed from queue:",N),a.current.shift(),d(a.current.length)}finally{E.current=!1,l(!1)}}},[t,k]);return{enqueue:_.useCallback(N=>{a.current.push(N),d(a.current.length),x()},[x]),pendingCount:c,isProcessing:u,isSyncAllowed:c===0&&!v,retryState:f}}function An(t){return typeof t=="string"?t:null}function of(t){const e=t.indexOf("@");return e>0?t.slice(0,e):t}function n9(t,e=48){return{id:t.id,email:t.attributes.email,name:t.attributes.full_name??of(t.attributes.email),avatarUrl:yr(t.attributes.email,e)}}function r9(t,e=48){const n=t.attributes.username,r=t.attributes.first_name??"",o=t.attributes.last_name??"",i=[r,o].filter(Boolean).join(" ")||of(n),a=n.includes("@")?yr(n,e):null;return{id:t.id,email:n,name:i,avatarUrl:a}}function o9(t,e=48){const n=t.attributes??{};if(t.type==="account"){const o=An(t.email)??An(n.email)??"",i=An(t.first_name)??An(n.first_name)??"",s=An(t.last_name)??An(n.last_name)??"",a=[i,s].filter(Boolean).join(" ")||of(o)||"Account Owner";return{id:String(t.id),email:o,name:a,avatarUrl:o?yr(o,e):null}}const r=An(t.name)??An(n.name)??"Organization";return{id:String(t.id),email:"",name:r,avatarUrl:null}}function DT(t){const e=t.attributes,n=An(e.email)??"unknown@email.com",r=An(e.full_name)??An(e.name)??of(n);return{email:n,name:r}}function Jw(t,e,n){const{enabled:r=!0,operationName:o,errorContext:i,onError:s,onSuccess:a}=n,[u,l]=_.useState(null),[c,d]=_.useState(!1),[f,p]=_.useState(null),[h,m]=_.useState(0),v=_.useRef(0),y=_.useCallback(()=>{p(null),m(w=>w+1)},[]);return _.useEffect(()=>{if(!r)return;const w=++v.current;let b=!0;return d(!0),t().then(S=>{if(b&&w===v.current&&(l(S),p(null),d(!1),a))try{a(S)}catch(k){Te(`onSuccess callback for "${o}" threw an error`,k,i)}}).catch(S=>{if(!b||w!==v.current)return;const k=NT(S),E=Dg(k);if(Te(`Failed to ${o}`,S,i),p({source:o,message:E.message}),d(!1),s)try{s(k)}catch(x){Te(`onError callback for "${o}" threw an error`,x,i)}}),()=>{b=!1}},[r,h,...e]),{data:u,isLoading:c,error:f,retry:y}}function Sp(t){return"itemType"in t}function jT(t,e={}){const{loadFields:n=!1}=e,r=_.useMemo(()=>Gw(t.itemTypes).map(k=>k.id).sort().join(","),[t.itemTypes]),o=_.useMemo(()=>Gw(t.itemTypes).map(k=>({id:k.id,apiKey:k.attributes.api_key,name:k.attributes.name,isBlockModel:k.attributes.modular_block})),[r]),i=Sp(t)?t.itemType.id:null,s=t.site.id,a=_.useCallback(async()=>Sp(t)?K7(t):[],[i]),{data:u,error:l,retry:c}=Jw(a,[i],{enabled:n&&Sp(t)&&i!==null,operationName:"load fields",errorContext:{itemTypeId:i}}),d=_.useCallback(async()=>{const S=await Promise.allSettled([t.loadUsers(),t.loadSsoUsers()]),k=S[0].status==="fulfilled"?S[0].value:[],E=S[1].status==="fulfilled"?S[1].value:[];if(S[0].status==="rejected"&&Te("Failed to load regular users",S[0].reason,{siteId:s}),S[1].status==="rejected"&&Te("Failed to load SSO users",S[1].reason,{siteId:s}),S[0].status==="rejected"&&S[1].status==="rejected")throw new Error("Failed to load users. Please check your connection and try again.");const x=[];for(const P of k){const D=n9(P,48);x.push({user:D,userType:"user"})}for(const P of E){const D=r9(P,48);x.push({user:D,userType:"sso"})}const T=o9(t.owner,48),O=t.owner.type==="organization"?"org":"account";return x.some(P=>P.user.id===T.id)||x.unshift({user:T,userType:O}),{allUsers:x.map(P=>P.user),typedUsers:x}},[s]),{data:f,error:p,retry:h}=Jw(d,[s],{enabled:!0,operationName:"load users",errorContext:{siteId:s}}),m=_.useCallback(()=>{c(),h()},[c,h]),v=l||p,y=_.useMemo(()=>(f==null?void 0:f.allUsers)??[],[f]),w=_.useMemo(()=>(f==null?void 0:f.typedUsers)??[],[f]),b=_.useMemo(()=>u??[],[u]);return{projectUsers:y,projectModels:o,modelFields:b,loadError:v,retry:m,typedUsers:w}}function LT({composerRef:t,canMentionModels:e=!0,handleAssetTrigger:n,handleRecordTrigger:r}){const o=_.useCallback(()=>{t.current&&(t.current.insertText("@"),t.current.focus())},[t]),i=_.useCallback(()=>{t.current&&(t.current.insertText("#"),t.current.focus())},[t]),s=_.useCallback(()=>{e&&t.current&&(t.current.insertText("$"),t.current.focus())},[t,e]),a=_.useCallback(()=>{n==null||n()},[n]),u=_.useCallback(()=>{r==null||r()},[r]);return{handleUserToolbarClick:o,handleFieldToolbarClick:i,handleModelToolbarClick:s,handleAssetToolbarClick:a,handleRecordToolbarClick:u}}const i9=`
|
|
234
|
+
`,sr)},SelectionSet:t=>"{"+(qn+=" ")+Ht(t.selections,qn,sr)+(qn=qn.slice(0,-2))+"}",Argument:t=>t.name.value+": "+sr(t.value),FragmentSpread(t){var e="..."+t.name.value;return t.directives&&t.directives.length&&(e+=" "+Ht(t.directives," ",Ye.Directive)),e},InlineFragment(t){var e="...";return t.typeCondition&&(e+=" on "+t.typeCondition.name.value),t.directives&&t.directives.length&&(e+=" "+Ht(t.directives," ",Ye.Directive)),e+=" "+Ye.SelectionSet(t.selectionSet)},FragmentDefinition(t){var e="";return t.description&&(e+=Ye.StringValue(t.description)+`
|
|
235
|
+
`),e+="fragment "+t.name.value,e+=" on "+t.typeCondition.name.value,t.directives&&t.directives.length&&(e+=" "+Ht(t.directives," ",Ye.Directive)),e+" "+Ye.SelectionSet(t.selectionSet)},Directive(t){var e="@"+t.name.value;return t.arguments&&t.arguments.length&&(e+="("+Ht(t.arguments,", ",Ye.Argument)+")"),e},NamedType:t=>t.name.value,ListType:t=>"["+sr(t.type)+"]",NonNullType:t=>sr(t.type)+"!"},sr=t=>Ye[t.kind](t);function Ta(t,e){switch(t.kind){case"NullValue":return null;case"IntValue":return parseInt(t.value,10);case"FloatValue":return parseFloat(t.value);case"StringValue":case"EnumValue":case"BooleanValue":return t.value;case"ListValue":for(var n=[],r=0,o=t.values.length;r<o;r++)n.push(Ta(t.values[r],e));return n;case"ObjectValue":for(var i=Object.create(null),s=0,a=t.fields.length;s<a;s++){var u=t.fields[s];i[u.name.value]=Ta(u.value,e)}return i;case"Variable":return e&&e[t.name.value]}}_t.BREAK=xi,_t.GraphQLError=bT,_t.Kind={NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType"},_t.OperationTypeNode={QUERY:"query",MUTATION:"mutation",SUBSCRIPTION:"subscription"},_t.Source=function(e,n,r){return{body:e,name:n,locationOffset:r||{line:1,column:1}}},_t.isSelectionNode=function(e){return e.kind==="Field"||e.kind==="FragmentSpread"||e.kind==="InlineFragment"},_t.parse=function(e,n){return ee=e.body?e.body:e,V=0,be(),n&&n.noLocation?{kind:"Document",definitions:Vw()}:{kind:"Document",definitions:Vw(),loc:{start:0,end:ee.length,startToken:void 0,endToken:void 0,source:{body:ee,name:"graphql.web",locationOffset:{line:1,column:1}}}}},_t.parseType=function(e,n){return ee=e.body?e.body:e,V=0,ST()},_t.parseValue=function(e,n){return ee=e.body?e.body:e,V=0,be(),ci(!1)},_t.print=function(e){return qn=`
|
|
236
|
+
`,Ye[e.kind]?Ye[e.kind](e):""},_t.printBlockString=xT,_t.printString=kT,_t.valueFromASTUntyped=Ta,_t.valueFromTypeNode=function t(e,n,r){if(e.kind==="Variable")return r?t(r[e.name.value],n,r):void 0;if(n.kind==="NonNullType")return e.kind!=="NullValue"?t(e,n,r):void 0;if(e.kind==="NullValue")return null;if(n.kind==="ListType"){if(e.kind==="ListValue"){for(var o=[],i=0,s=e.values.length;i<s;i++){var a=t(e.values[i],n.type,r);if(a===void 0)return;o.push(a)}return o}}else if(n.kind==="NamedType")switch(n.name.value){case"Int":case"Float":case"String":case"Bool":return n.name.value+"Value"===e.kind?Ta(e,r):void 0;default:return Ta(e,r)}},_t.visit=function(e,n){var r=[],o=[];try{var i=function s(a,u,l){var c=!1,d=n[a.kind]&&n[a.kind].enter||n[a.kind]||n.enter,f=d&&d.call(n,a,u,l,o,r);if(f===!1)return a;if(f===null)return null;if(f===xi)throw xi;f&&typeof f.kind=="string"&&(c=f!==a,a=f),l&&r.push(l);var p,h={...a};for(var m in a){o.push(m);var v=a[m];if(Array.isArray(v)){for(var y=[],w=0;w<v.length;w++)v[w]!=null&&typeof v[w].kind=="string"&&(r.push(a),o.push(w),p=s(v[w],w,v),o.pop(),r.pop(),p==null?c=!0:(c=c||p!==v[w],y.push(p)));v=y}else v!=null&&typeof v.kind=="string"&&(p=s(v,m,a))!==void 0&&(c=c||v!==p,v=p);o.pop(),c&&(h[m]=v)}l&&r.pop();var b=n[a.kind]&&n[a.kind].leave||n.leave,S=b&&b.call(n,a,u,l,o,r);if(S===xi)throw xi;return S!==void 0?S:f!==void 0?c?h:f:c?h:a}(e);return i!==void 0&&i!==!1?i:e}catch(s){if(s!==xi)throw s;return e}};var Rg=it&&it.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ao=it&&it.__assign||function(){return Ao=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Ao.apply(this,arguments)},qw=it&&it.__awaiter||function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},Hw=it&&it.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(c){return u([l,c])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(c){l=[6,c],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Qn.__esModule=!0;Qn.subscribeToQuery=Qn.InvalidResponseError=Qn.Response400Error=Qn.Response500Error=void 0;var OV=_t,NV=function(){function t(e,n){this.type=e,this.data=n==null?void 0:n.data}return t}(),AV=typeof MessageEvent<"u"?MessageEvent:NV,ET=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.Response500Error=ET;var Om=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.Response400Error=Om;var TT=function(t){Rg(e,t);function e(n,r){var o=t.call(this,n)||this;return Object.setPrototypeOf(o,e.prototype),o.response=r,o}return e}(Error);Qn.InvalidResponseError=TT;function CT(t){return qw(this,void 0,void 0,function(){var e,n,r,o,i,s,a,u,l,c,d,f,p,h,m,v,y,w,b,S,k,E,x,T,O,N,$,P=this;return Hw(this,function(D){switch(D.label){case 0:e=t.query,n=t.token,r=t.variables,o=t.preview,i=t.includeDrafts,s=t.excludeInvalid,a=t.environment,u=t.fetcher,l=t.eventSourceClass,c=t.onStatusChange,d=t.onUpdate,f=t.onChannelError,p=t.onError,h=t.onEvent,m=t.reconnectionPeriod,v=t.baseUrl,y=u||window.fetch,w=l||window.EventSource,b=Math.min(m||1e3,2e4),S=v||"https://graphql-listen.datocms.com",k=function(){return qw(P,void 0,void 0,function(){return Hw(this,function(q){switch(q.label){case 0:return[4,new Promise(function(B){return setTimeout(B,b)})];case 1:return q.sent(),[2,CT(Ao(Ao({},t),{reconnectionPeriod:b*2*(1+(Math.random()*.2-.1))}))]}})})},c&&c("connecting"),D.label=1;case 1:return D.trys.push([1,4,,5]),x=typeof e=="string"?e:(0,OV.print)(e),[4,y(S,{headers:Ao(Ao(Ao({Authorization:"Bearer ".concat(n),Accept:"application/json"},a?{"X-Environment":a}:{}),i||o?{"X-Include-Drafts":"true"}:{}),s?{"X-Exclude-Invalid":"true"}:{}),method:"POST",body:JSON.stringify({query:x,variables:r})})];case 2:if(T=D.sent(),T.status>=300&&T.status<500)throw new Om("Invalid status code: ".concat(T.status," ").concat(T.statusText),T);if(T.status>=500)throw new ET("Invalid status code: ".concat(T.status," ").concat(T.statusText),T);if(T.headers.get("Content-Type")!=="application/json")throw new TT("Invalid content type: ".concat(T.headers.get("Content-Type")),T);return[4,T.json()];case 3:return O=D.sent(),E=O.url,h&&h({status:"connecting",channelUrl:E,message:"Received channel URL",response:T}),[3,5];case 4:if(N=D.sent(),p&&($=new AV("FetchError",{data:N}),p($)),N instanceof Om)throw N;return c&&c("closed"),[2,k()];case 5:return[2,new Promise(function(q){var B=new w(E),z=!1,K=function(){B.readyState!==2&&(z=!0,B.close())};B.addEventListener("open",function(){c&&c("connected"),q(K)});var I=setInterval(function(){B.readyState===2&&(clearInterval(I),c&&c("closed"),z||k())},300);B.addEventListener("update",function(L){var F=JSON.parse(L.data);d(F)}),B.addEventListener("channelError",function(L){var F=JSON.parse(L.data);F.fatal&&(z=!0),f&&f(F),B.close()}),B.addEventListener("onerror",function(L){var F=L;p&&p(F),B.close()})})]}})})}Qn.subscribeToQuery=CT;(function(t){var e=it&&it.__createBinding||(Object.create?function(r,o,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(o,i);(!a||("get"in a?!o.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,s,a)}:function(r,o,i,s){s===void 0&&(s=i),r[s]=o[i]}),n=it&&it.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&e(o,r,i)};t.__esModule=!0,n(Qn,t)})(wT);var Ww=Object.prototype.hasOwnProperty;function Kw(t,e,n){for(n of t.keys())if(Ca(n,e))return n}function Ca(t,e){var n,r,o;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Ca(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(o=r,o&&typeof o=="object"&&(o=Kw(e,o),!o)||!e.has(o))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(o=r[0],o&&typeof o=="object"&&(o=Kw(e,o),!o)||!Ca(r[1],e.get(o)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(Ww.call(t,n)&&++r&&!Ww.call(e,n)||!(n in e)||!Ca(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function IV(t){var e=_.useRef(t),n=_.useRef(0);return Ca(t,e.current)||(e.current=t,n.current+=1),_.useMemo(function(){return e.current},[n.current])}function PV(t,e){return _.useEffect(t,IV(e))}var RV=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},DV=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n};function jV(t){const{enabled:e,initialData:n}=t,r=DV(t,["enabled","initialData"]),[o,i]=_.useState(null),[s,a]=_.useState(null),[u,l]=_.useState(e?"connecting":"closed"),c=r;return PV(()=>{if(e===!1)return l("closed"),()=>{};let d;function f(){return RV(this,void 0,void 0,function*(){d=yield wT.subscribeToQuery(Object.assign(Object.assign({},c),{onStatusChange:p=>{l(p)},onUpdate:p=>{i(null),a(p.response.data)},onChannelError:p=>{a(null),i(p)}}))})}return f(),()=>{d&&d()}},[c]),{error:o,status:u,data:s||n}}function MT(t){return Object.values(t).find(e=>(e==null?void 0:e.attributes.api_key)===io)}function Gw(t){return Object.values(t).filter(e=>e!==void 0)}function OT(t){if(!t)return null;const n=t.attributes.icon;return typeof n=="string"?n:null}const LV=["token","unauthorized","401","403","authentication","forbidden"],BV=["network","fetch","connection","timeout","socket","econnrefused"],FV=["graphql","query","syntax","validation"];function wp(t,e){return e.some(n=>t.includes(n))}function $V(t){const e=t.message.toLowerCase();return wp(e,LV)?{type:"token_expired",message:"CDA token is invalid or expired. Please reconfigure in plugin settings."}:wp(e,BV)?{type:"network_error",message:"Connection lost. Attempting to reconnect..."}:wp(e,FV)?{type:"graphql_error",message:"Query error. Please refresh the page."}:{type:"unknown",message:"Sync error occurred. Please try again."}}function Dg(t){const e=t.message.toLowerCase();return e.includes("forbidden")||e.includes("401")||e.includes("403")?{type:"permission_denied",message:"Permission denied."}:e.includes("network")||e.includes("fetch")||e.includes("timeout")?{type:"network_error",message:"Network error. Check your connection."}:{type:"unknown",message:"Failed to load data."}}function NT(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){const e=t;if(typeof e.message=="string")return new Error(e.message)}return new Error(String(t))}const gd={CONNECTING:"connecting",CLOSED:"closed"};function zV({ctx:t,realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o,query:i,variables:s,filterParams:a,subscriptionEnabled:u,onCommentRecordIdChange:l}){const[c,d]=_.useState([]),[f,p]=_.useState(null),[h,m]=_.useState(null),[v,y]=_.useState(!0),w=_.useCallback(I=>{m(I),l==null||l(I)},[l]),[b,S]=_.useState(0),k=_.useRef(0),E=_.useRef(null),{data:x,status:T,error:O}=jV({query:i,variables:s,token:n??"",enabled:u&&!!n&&e,includeDrafts:!0,reconnectionPeriod:b>0?100:void 0});_.useEffect(()=>{T==="connected"&&(k.current=0)},[T]),_.useEffect(()=>{if(O){const I=O instanceof Error?O.message:String(O),L=E.current,F=L instanceof Error?L.message:String(L??"");(!L||I!==F)&&(k.current+=1,E.current=O)}else E.current=null},[O]);const N=_.useCallback(async()=>{if(e){const I=k.current,L=Math.min(1e3*Math.pow(2,I),3e4);I>0&&await new Promise(F=>setTimeout(F,L)),S(F=>F+1)}else B.current=0,P(null),q(I=>I+1)},[e]);_.useEffect(()=>{const I=MT(t.itemTypes);I&&p(I.id)},[t.itemTypes]),_.useEffect(()=>{if(!e)return;const I=x==null?void 0:x.allProjectComments[0];x&&y(!1),!(!I||!o)&&(w(I.id),d(gl(I.content)))},[x,o,e,w,d]);const[$,P]=_.useState(null),[D,q]=_.useState(0),B=_.useRef(0);_.useEffect(()=>{if(e)return;if(!r||!f||!a.recordId){y(!1);return}let I=!0,L=null,F=null;const Z=3e4,ie=3,ke=async(fe=0)=>{if(!I)return;y(!0),fe===0&&P(null);const Ne=new Promise((pe,Ae)=>{L=setTimeout(()=>{I&&Ae(new Error(`CMA fetch timed out after ${Z/1e3} seconds`))},Z)});try{const pe=r.items.list({filter:{type:io,fields:{model_id:{eq:a.modelId},record_id:{eq:a.recordId}}}}),Ae=await Promise.race([pe,Ne]);if(L!==null&&(clearTimeout(L),L=null),!I)return;if(B.current=0,Ae.length>0){const Ue=Ae[0];typeof Ue.id=="string"&&w(Ue.id),d(gl(Ue.content))}y(!1)}catch(pe){if(L!==null&&(clearTimeout(L),L=null),!I)return;const Ae=pe instanceof Error?pe:new Error(String(pe));if(fe<ie){B.current=fe+1;const Ue=Math.min(1e3*Math.pow(2,fe),8e3);Te(`CMA fetch failed (attempt ${fe+1}/${ie+1}), retrying in ${Ue}ms`,Ae,{modelId:a.modelId,recordId:a.recordId}),F=setTimeout(()=>{I&&ke(fe+1)},Ue);return}Te("Failed to fetch comments (CMA fallback) after max retries",Ae,{modelId:a.modelId,recordId:a.recordId,attempts:fe+1}),P(Ae),y(!1)}};return ke(),()=>{I=!1,L!==null&&(clearTimeout(L),L=null),F!==null&&(clearTimeout(F),F=null)}},[e,r,a.modelId,a.recordId,f,D,w,d]);const z=O?NT(O):$,K=z?{error:z,...$V(z),consecutiveCount:k.current}:null;return{comments:c,setComments:d,commentsModelId:f,commentRecordId:h,setCommentRecordId:w,isLoading:v,error:z,errorInfo:K,status:T,retry:N}}const UV="_indicator_1rjaa_1",VV="_spinner_1rjaa_29",qV="_icon_1rjaa_52",HV="_text_1rjaa_62",WV="_count_1rjaa_66",KV="_retryButton_1rjaa_70",jt={indicator:UV,spinner:VV,icon:qV,text:HV,count:WV,retryButton:KV};function GV({subscriptionStatus:t,subscriptionError:e,retryState:n,onRetry:r,realTimeEnabled:o}){return n.isRetrying?g.jsxs("div",{className:jt.indicator,"data-status":"retrying",role:"status","aria-live":"polite","aria-atomic":"true",children:[g.jsx("span",{className:jt.spinner,"aria-hidden":"true"}),g.jsxs("span",{className:jt.text,children:[n.message,n.retryCount>1&&g.jsxs("span",{className:jt.count,children:[" (attempt ",n.retryCount,")"]})]})]}):e?g.jsxs("div",{className:jt.indicator,"data-status":"error",role:"alert","aria-live":"assertive",children:[g.jsx("span",{className:jt.icon,"aria-hidden":"true",children:"!"}),g.jsx("span",{className:jt.text,children:"Sync error"}),r&&g.jsx("button",{type:"button",className:jt.retryButton,onClick:r,children:"Retry"})]}):t===gd.CONNECTING?g.jsxs("div",{className:jt.indicator,"data-status":"connecting",role:"status","aria-live":"polite",children:[g.jsx("span",{className:jt.spinner,"aria-hidden":"true"}),g.jsx("span",{className:jt.text,children:"Connecting..."})]}):o&&t===gd.CLOSED?g.jsxs("div",{className:jt.indicator,"data-status":"error",role:"alert","aria-live":"assertive",children:[g.jsx("span",{className:jt.icon,"aria-hidden":"true",children:"!"}),g.jsx("span",{className:jt.text,children:"Connection lost"}),r&&g.jsx("button",{type:"button",className:jt.retryButton,onClick:r,children:"Retry"})]}):null}const JV=_.memo(GV);function Nm(t,e){return t.find(n=>n.id===e)}function YV(t,e){var n;return(n=t.replies)==null?void 0:n.find(r=>r.id===e)}function jg(t,e,n,r){if(n){const i=Nm(t,n);if(!i)return`${r.operationName}${n}`,{success:!1,result:{comments:t,status:"failed_parent_missing",failureReason:r.parentMissingReason}};const s=YV(i,e);return s?{success:!0,isReply:!0,parent:i,target:s}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(`${r.operationName}${e}${n}`,{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}const o=Nm(t,e);return o?{success:!0,isReply:!1,target:o}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(`${r.operationName}${e}`,{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}function AT(t,e,n,r){return n?t.map(o=>{var i;return o.id===n?{...o,replies:(i=o.replies)==null?void 0:i.map(s=>s.id===e?r(s):s)}:o}):t.map(o=>o.id===e?r(o):o)}function bp(t,e){switch(e.type){case"ADD_COMMENT":return QV(t,e);case"DELETE_COMMENT":return XV(t,e);case"EDIT_COMMENT":return ZV(t,e);case"UPVOTE_COMMENT":return e9(t,e);case"ADD_REPLY":return t9(t,e)}}function QV(t,e){return t.some(n=>n.id===e.comment.id)?{comments:t,status:"no_op_idempotent"}:{comments:[e.comment,...t],status:"applied"}}function XV(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"DELETE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:"The comment was deleted by another user.",targetNotFoundIsIdempotent:!0});return n.success?n.isReply?{comments:t.map(o=>{var i;return o.id===e.parentCommentId?{...o,replies:(i=o.replies)==null?void 0:i.filter(s=>s.id!==e.id)}:o}),status:"applied"}:{comments:t.filter(r=>r.id!==e.id),status:"applied"}:n.result}function ZV(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"EDIT_COMMENT",parentMissingReason:"Your edit could not be saved because the comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply you were editing was deleted by another user.":"The comment you were editing was deleted by another user."});return n.success?{comments:AT(t,e.id,e.parentCommentId,o=>({...o,content:e.newContent})),status:"applied"}:n.result}function e9(t,e){const n=jg(t,e.id,e.parentCommentId,{operationName:"UPVOTE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply was deleted by another user.":"The comment was deleted by another user."});if(!n.success)return n.result;const r=i=>{const s=i.some(a=>a.email===e.user.email);return e.action==="add"?s?i:[...i,e.user]:i.filter(a=>a.email!==e.user.email)};return{comments:AT(t,e.id,e.parentCommentId,i=>({...i,usersWhoUpvoted:r(i.usersWhoUpvoted)})),status:"applied"}}function t9(t,e){var o;const n=Nm(t,e.parentCommentId);return n?(o=n.replies)!=null&&o.some(i=>i.id===e.reply.id)?{comments:t,status:"no_op_idempotent"}:{comments:t.map(i=>i.id!==e.parentCommentId?i:{...i,replies:[e.reply,...i.replies??[]]}),status:"applied"}:(`${e.parentCommentId}`,{comments:t,status:"failed_parent_missing",failureReason:"Your reply could not be saved because the comment was deleted by another user."})}const IT=t=>new Promise(e=>setTimeout(e,t));function PT(t,e,n,r=!1){const o=e*Math.pow(2,t),i=r?Math.random()*100:0;return Math.min(o+i,n)}function _p(t){const e={type:t.type};switch(t.type){case"ADD_COMMENT":return{...e,commentId:t.comment.id};case"DELETE_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"EDIT_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"UPVOTE_COMMENT":return{...e,id:t.id,action:t.action,parentCommentId:t.parentCommentId};case"ADD_REPLY":return{...e,parentCommentId:t.parentCommentId,replyId:t.reply.id};default:return e}}function RT({client:t,commentRecordId:e,commentsModelId:n,modelId:r,recordId:o,ctx:i,onRecordCreated:s}){const a=_.useRef([]),[u,l]=_.useState(!1),[c,d]=_.useState(0),[f,p]=_.useState({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null}),h=_.useCallback(()=>{p({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null})},[]),m=_.useCallback((N,$)=>{p({isRetrying:!0,operationType:N,retryCount:$,message:Bt.VERSION_CONFLICT_RETRYING,wasTerminated:!1,terminationReason:null})},[]),[v,y]=_.useState(!1),w=_.useRef(null),b=_.useRef(e);b.current=e,_.useEffect(()=>()=>{w.current&&clearTimeout(w.current)},[]);const S=_.useCallback(()=>{w.current&&clearTimeout(w.current),y(!0),w.current=setTimeout(()=>{y(!1),w.current=null},Iu.SYNC_COOLDOWN_MS)},[]),k=_.useCallback(async N=>{if(!t||!o)return;let $=0;const P=Date.now();for(;;)try{const D=b.current;if(!D){if(!n)return;const K=await t.items.list({filter:{type:n,fields:{model_id:{eq:r},record_id:{eq:o}}},page:{limit:1}});if(K.length>0){const F=K[0],Z=gl(F.content),ie=bp(Z,N);if(ie.status==="failed_parent_missing"||ie.status==="failed_target_missing"){ie.failureReason&&i.alert(ie.failureReason),h();return}await t.items.update(F.id,{content:JSON.stringify(ie.comments),meta:{current_version:F.meta.current_version}}),s(F.id),S(),h();return}const I=bp([],N),L=await t.items.create({item_type:{type:"item_type",id:n},model_id:r,record_id:o,content:JSON.stringify(I.comments)});s(L.id),S(),h();return}const q=await t.items.find(D),B=gl(q.content),z=bp(B,N);if(z.status==="failed_parent_missing"||z.status==="failed_target_missing"){z.failureReason&&i.alert(z.failureReason),h();return}await t.items.update(D,{content:JSON.stringify(z.comments),meta:{current_version:q.meta.current_version}}),S(),h();return}catch(D){if(D instanceof qi&&D.findError("STALE_ITEM_VERSION")){if($++,$>=Qv.MAX_ATTEMPTS){Te("Retry terminated: max attempts reached for version conflict:",_p(N),{attempt:$}),i.alert(Bt.MAX_RETRIES_EXCEEDED),p({isRetrying:!1,operationType:N.type,retryCount:$,message:Bt.MAX_RETRIES_EXCEEDED,wasTerminated:!0,terminationReason:"max_attempts"});return}if(Date.now()-P>=Qv.MAX_DURATION_MS){Te("Retry terminated: timeout reached for version conflict:",_p(N),{attempt:$,durationMs:Date.now()-P}),i.alert(Bt.OPERATION_TIMEOUT),p({isRetrying:!1,operationType:N.type,retryCount:$,message:Bt.OPERATION_TIMEOUT,wasTerminated:!0,terminationReason:"timeout"});return}m(N.type,$);const q=PT($,Iu.VERSION_CONFLICT_BACKOFF_BASE,Iu.VERSION_CONFLICT_BACKOFF_MAX);await IT(q);continue}Te("Failed to save comment operation:",D,{op:_p(N)}),i.alert(Bt.SAVE_FAILED),h();return}},[t,n,r,o,i,s,S,h,m]),E=_.useRef(!1),x=_.useCallback(async()=>{if(!(E.current||a.current.length===0||!t)){E.current=!0,l(!0);try{for(;a.current.length>0;){const N=a.current[0];await k(N),a.current.shift(),d(a.current.length)}}catch(N){Te("Unexpected error in processQueue - operation removed from queue:",N),a.current.shift(),d(a.current.length)}finally{E.current=!1,l(!1)}}},[t,k]);return{enqueue:_.useCallback(N=>{a.current.push(N),d(a.current.length),x()},[x]),pendingCount:c,isProcessing:u,isSyncAllowed:c===0&&!v,retryState:f}}function An(t){return typeof t=="string"?t:null}function of(t){const e=t.indexOf("@");return e>0?t.slice(0,e):t}function n9(t,e=48){return{id:t.id,email:t.attributes.email,name:t.attributes.full_name??of(t.attributes.email),avatarUrl:yr(t.attributes.email,e)}}function r9(t,e=48){const n=t.attributes.username,r=t.attributes.first_name??"",o=t.attributes.last_name??"",i=[r,o].filter(Boolean).join(" ")||of(n),a=n.includes("@")?yr(n,e):null;return{id:t.id,email:n,name:i,avatarUrl:a}}function o9(t,e=48){const n=t.attributes??{};if(t.type==="account"){const o=An(t.email)??An(n.email)??"",i=An(t.first_name)??An(n.first_name)??"",s=An(t.last_name)??An(n.last_name)??"",a=[i,s].filter(Boolean).join(" ")||of(o)||"Account Owner";return{id:String(t.id),email:o,name:a,avatarUrl:o?yr(o,e):null}}const r=An(t.name)??An(n.name)??"Organization";return{id:String(t.id),email:"",name:r,avatarUrl:null}}function DT(t){const e=t.attributes,n=An(e.email)??"unknown@email.com",r=An(e.full_name)??An(e.name)??of(n);return{email:n,name:r}}function Jw(t,e,n){const{enabled:r=!0,operationName:o,errorContext:i,onError:s,onSuccess:a}=n,[u,l]=_.useState(null),[c,d]=_.useState(!1),[f,p]=_.useState(null),[h,m]=_.useState(0),v=_.useRef(0),y=_.useCallback(()=>{p(null),m(w=>w+1)},[]);return _.useEffect(()=>{if(!r)return;const w=++v.current;let b=!0;return d(!0),t().then(S=>{if(b&&w===v.current&&(l(S),p(null),d(!1),a))try{a(S)}catch(k){Te(`onSuccess callback for "${o}" threw an error`,k,i)}}).catch(S=>{if(!b||w!==v.current)return;const k=NT(S),E=Dg(k);if(Te(`Failed to ${o}`,S,i),p({source:o,message:E.message}),d(!1),s)try{s(k)}catch(x){Te(`onError callback for "${o}" threw an error`,x,i)}}),()=>{b=!1}},[r,h,...e]),{data:u,isLoading:c,error:f,retry:y}}function Sp(t){return"itemType"in t}function jT(t,e={}){const{loadFields:n=!1}=e,r=_.useMemo(()=>Gw(t.itemTypes).map(k=>k.id).sort().join(","),[t.itemTypes]),o=_.useMemo(()=>Gw(t.itemTypes).map(k=>({id:k.id,apiKey:k.attributes.api_key,name:k.attributes.name,isBlockModel:k.attributes.modular_block})),[r]),i=Sp(t)?t.itemType.id:null,s=t.site.id,a=_.useCallback(async()=>Sp(t)?K7(t):[],[i]),{data:u,error:l,retry:c}=Jw(a,[i],{enabled:n&&Sp(t)&&i!==null,operationName:"load fields",errorContext:{itemTypeId:i}}),d=_.useCallback(async()=>{const S=await Promise.allSettled([t.loadUsers(),t.loadSsoUsers()]),k=S[0].status==="fulfilled"?S[0].value:[],E=S[1].status==="fulfilled"?S[1].value:[];if(S[0].status==="rejected"&&Te("Failed to load regular users",S[0].reason,{siteId:s}),S[1].status==="rejected"&&Te("Failed to load SSO users",S[1].reason,{siteId:s}),S[0].status==="rejected"&&S[1].status==="rejected")throw new Error("Failed to load users. Please check your connection and try again.");const x=[];for(const P of k){const D=n9(P,48);x.push({user:D,userType:"user"})}for(const P of E){const D=r9(P,48);x.push({user:D,userType:"sso"})}const T=o9(t.owner,48),O=t.owner.type==="organization"?"org":"account";return x.some(P=>P.user.id===T.id)||x.unshift({user:T,userType:O}),{allUsers:x.map(P=>P.user),typedUsers:x}},[s]),{data:f,error:p,retry:h}=Jw(d,[s],{enabled:!0,operationName:"load users",errorContext:{siteId:s}}),m=_.useCallback(()=>{c(),h()},[c,h]),v=l||p,y=_.useMemo(()=>(f==null?void 0:f.allUsers)??[],[f]),w=_.useMemo(()=>(f==null?void 0:f.typedUsers)??[],[f]),b=_.useMemo(()=>u??[],[u]);return{projectUsers:y,projectModels:o,modelFields:b,loadError:v,retry:m,typedUsers:w}}function LT({composerRef:t,canMentionModels:e=!0,handleAssetTrigger:n,handleRecordTrigger:r}){const o=_.useCallback(()=>{t.current&&(t.current.insertText("@"),t.current.focus())},[t]),i=_.useCallback(()=>{t.current&&(t.current.insertText("#"),t.current.focus())},[t]),s=_.useCallback(()=>{e&&t.current&&(t.current.insertText("$"),t.current.focus())},[t,e]),a=_.useCallback(()=>{n==null||n()},[n]),u=_.useCallback(()=>{r==null||r()},[r]);return{handleUserToolbarClick:o,handleFieldToolbarClick:i,handleModelToolbarClick:s,handleAssetToolbarClick:a,handleRecordToolbarClick:u}}const i9=`
|
|
237
237
|
query GlobalCommentsQuery($modelId: String!, $recordId: String!) {
|
|
238
238
|
allProjectComments(
|
|
239
239
|
filter: {
|
|
@@ -246,6 +246,6 @@ ${p.slice(l+2)}`,d+=1;else break}e.push({indent:l,number:parseInt(a,10),content:
|
|
|
246
246
|
content
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
`;function s9(t){return t.context==="record"}function BT(t){var f,p;const{realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o}=t,i=s9(t);let s,a,u,l,c;i?(s=t.ctx.itemType.id,a=((f=t.ctx.item)==null?void 0:f.id)??"",u=pV,l=!!((p=t.ctx.item)!=null&&p.id),c=t.onCommentRecordIdChange):(s=jy,a=ak,u=i9,l=!0,c=void 0);const d=zV({ctx:t.ctx,realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o,query:u,variables:{modelId:s,recordId:a},filterParams:{modelId:s,recordId:a},subscriptionEnabled:l,onCommentRecordIdChange:c});return{comments:d.comments,setComments:d.setComments,isLoading:d.isLoading,error:d.error,errorInfo:d.errorInfo,status:d.status,retry:d.retry,fullResult:d}}function a9(t){return t.length===0?!0:!t.some(e=>e.type==="text"?e.content.trim().length>0:e.type==="mention")}function FT(t,e){return t.trim().length>0&&e.trim().length>0}function Yw(t,e,n){return n?t.filter(r=>r.email!==e.email):[...t,e]}function l9(t,e,n){return n?t.map(r=>{var o;return r.id===n?{...r,replies:(o=r.replies)==null?void 0:o.filter(i=>i.id!==e)}:r}):t.filter(r=>r.id!==e)}function u9(t,e,n,r){return r?t.map(o=>{var i;return o.id===r?{...o,replies:(i=o.replies)==null?void 0:i.map(s=>s.id===e?{...s,content:n}:s)}:o}):t.map(o=>o.id===e?{...o,content:n}:o)}function c9(t,e,n,r,o){return o?t.map(i=>{var s;return i.id===o?{...i,replies:(s=i.replies)==null?void 0:s.map(a=>a.id===e?{...a,usersWhoUpvoted:Yw(a.usersWhoUpvoted,n,r)}:a)}:i}):t.map(i=>i.id===e?{...i,usersWhoUpvoted:Yw(i.usersWhoUpvoted,n,r)}:i)}function Qw(t,e,n,r){if(!FT(e,n))throw new Error("Cannot create comment: author name and email are required");const o=crypto.randomUUID(),i=new Date().toISOString();return r?{id:o,dateISO:i,content:t,author:{name:e,email:n},usersWhoUpvoted:[],parentCommentId:r}:{id:o,dateISO:i,content:t,author:{name:e,email:n},usersWhoUpvoted:[],replies:[]}}function d9(t,e,n,r){var i,s;((i=t.current)==null?void 0:i.has(e))??!1?(s=t.current)==null||s.delete(e):r({type:"DELETE_COMMENT",id:e,parentCommentId:n})}function $T({userEmail:t,userName:e,setComments:n,enqueue:r,composerSegments:o,setComposerSegments:i,pendingNewReplies:s,insertPosition:a="prepend",ctx:u}){const l=_.useCallback(()=>{var m;if(a9(o))return;if(!FT(e,t)){u==null||u.alert(Lt.MISSING_USER_INFO);return}if(u&&!((m=u.item)!=null&&m.id)){u.alert(Lt.SAVE_RECORD_FIRST);return}const h=Qw(o,e,t);n(a==="prepend"?v=>[h,...v]:v=>[...v,h]),r({type:"ADD_COMMENT",comment:h}),i([])},[o,u,t,e,n,r,i,a]),c=_.useCallback((h,m)=>{n(v=>l9(v,h,m)),d9(s,h,m,r)},[n,r,s]),d=_.useCallback((h,m,v)=>{var w,b;const y=((w=s.current)==null?void 0:w.has(h))??!1;n(S=>u9(S,h,m,v)),y&&v?((b=s.current)==null||b.delete(h),n(S=>{var T;const k=S.find(O=>O.id===v),E=(T=k==null?void 0:k.replies)==null?void 0:T.find(O=>O.id===h),x=(E==null?void 0:E.dateISO)??new Date().toISOString();return r({type:"ADD_REPLY",parentCommentId:v,reply:{id:h,dateISO:x,content:m,author:{name:e,email:t},usersWhoUpvoted:[],parentCommentId:v}}),S})):r({type:"EDIT_COMMENT",id:h,newContent:m,parentCommentId:v})},[e,t,n,r,s]),f=_.useCallback((h,m,v)=>{const y={name:e,email:t};n(w=>c9(w,h,y,m,v)),r({type:"UPVOTE_COMMENT",id:h,action:m?"remove":"add",user:y,parentCommentId:v})},[t,e,n,r]),p=_.useCallback(h=>{var v;const m=Qw([],e,t,h);(v=s.current)==null||v.add(m.id),n(y=>y.map(w=>w.id!==h?w:a==="prepend"?{...w,replies:[m,...w.replies??[]]}:{...w,replies:[...w.replies??[],m]}))},[t,e,n,s,a]);return{submitNewComment:l,deleteComment:c,editComment:d,upvoteComment:f,replyComment:p}}function f9(t){const e=t.currentRole,n=t.environment,r=e.attributes.positive_upload_permissions||[],o=e.attributes.negative_upload_permissions||[];return r.some(a=>a.environment===n&&(a.action==="all"||a.action==="read"))?!o.some(a=>a.environment===n&&(a.action==="all"||a.action==="read")):!1}function p9(t){return t.currentRole.meta.final_permissions.can_edit_schema}function h9(t,e){const n=t.currentRole,r=t.environment,o=n.attributes.positive_item_type_permissions||[],i=n.attributes.negative_item_type_permissions||[];return o.some(u=>u.environment===r&&(u.action==="all"||u.action==="read")&&(u.item_type===null||u.item_type===e))?!i.some(u=>u.environment===r&&(u.action==="all"||u.action==="read")&&(u.item_type===null||u.item_type===e)):!1}function m9(t,e){return e.filter(n=>h9(t,n.id))}function zT(t,e){const n=_.useMemo(()=>f9(t),[t.currentRole,t.environment]),r=_.useMemo(()=>p9(t),[t.currentRole]),o=_.useMemo(()=>m9(t,e),[t.currentRole,t.environment,e]);return{canMentionAssets:n,canMentionModels:r,readableModels:o}}const UT=_.createContext(null);function VT({children:t,canMentionFields:e=!0,canMentionAssets:n=!1,canMentionModels:r=!0}){const o=_.useMemo(()=>({canMentionFields:e,canMentionAssets:n,canMentionModels:r}),[e,n,r]);return g.jsx(UT.Provider,{value:o,children:t})}function y9(){const t=_.useContext(UT);if(!t)throw new Error("useMentionPermissionsContext must be used within a MentionPermissionsProvider");return t}function g9(t){return t?Sd({apiToken:t}):null}function v9(t){return typeof t=="object"&&!!t&&"data"in t}function Xw({__itemTypeId:t,id:e,type:n,attributes:r,relationships:o,meta:i}){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t?{__itemTypeId:t}:{}),e?{id:e}:{}),n?{type:n}:{}),r||{}),o?Object.fromEntries(Object.entries(o).map(([s,a])=>[s,a==null?void 0:a.data])):{}),i?{meta:i}:{})}function tn(t){if(!v9(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(Xw):Xw(t.data)}function w9(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"link":return e.validators.item_item_type.item_types;case"links":return e.validators.items_item_type.item_types;case"structured_text":return e.validators.structured_text_links.item_types;default:return[]}}function kp(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"single_block":return e.validators.single_block_blocks.item_types;case"rich_text":return e.validators.rich_text_blocks.item_types;case"structured_text":return[...e.validators.structured_text_blocks.item_types,...e.validators.structured_text_inline_blocks?e.validators.structured_text_inline_blocks.item_types:[]];default:return[]}}var _e=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};class b9{constructor(e){this.itemTypesPromise=null,this.itemTypesByApiKey=new Map,this.itemTypesById=new Map,this.fieldsByItemType=new Map,this.fieldsetsByItemType=new Map,this.pluginsPromise=null,this.pluginsById=new Map,this.pluginsByPackageName=new Map,this.prefetchPromise=null,this.client=e}loadItemTypes(){return _e(this,void 0,void 0,function*(){return this.itemTypesPromise||(this.itemTypesPromise=_e(this,void 0,void 0,function*(){const{data:e}=yield this.client.itemTypes.rawList();for(const n of e)this.itemTypesByApiKey.set(n.attributes.api_key,n),this.itemTypesById.set(n.id,n);return e})),this.itemTypesPromise})}getAllItemTypes(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawItemTypes();return tn({data:e})})}getAllRawItemTypes(){return _e(this,void 0,void 0,function*(){return yield this.loadItemTypes()})}getAllModels(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawModels();return tn({data:e})})}getAllRawModels(){return _e(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>!n.attributes.modular_block)})}getAllBlockModels(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawBlockModels();return tn({data:e})})}getAllRawBlockModels(){return _e(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>n.attributes.modular_block)})}getItemTypeByApiKey(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeByApiKey(e);return tn({data:n})})}getRawItemTypeByApiKey(e){return _e(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesByApiKey.get(e);if(!n)throw new Error(`Item type with API key '${e}' not found`);return n})}getItemTypeById(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeById(e);return tn({data:n})})}getRawItemTypeById(e){return _e(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesById.get(e);if(!n)throw new Error(`Item type with ID '${e}' not found`);return n})}getItemTypeFields(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFields(e);return tn({data:n})})}getRawItemTypeFields(e){return _e(this,void 0,void 0,function*(){const n=this.fieldsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fields.rawList(e.id);return this.fieldsByItemType.set(e.id,r),r})}getItemTypeFieldsets(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFieldsets(e);return tn({data:n})})}getRawItemTypeFieldsets(e){return _e(this,void 0,void 0,function*(){const n=this.fieldsetsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fieldsets.rawList(e.id);return this.fieldsetsByItemType.set(e.id,r),r})}loadPlugins(){return _e(this,void 0,void 0,function*(){return this.pluginsPromise||(this.pluginsPromise=_e(this,void 0,void 0,function*(){const{data:e}=yield this.client.plugins.rawList();for(const n of e)this.pluginsById.set(n.id,n),n.attributes.package_name&&this.pluginsByPackageName.set(n.attributes.package_name,n);return e})),this.pluginsPromise})}getAllPlugins(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawPlugins();return tn({data:e})})}getAllRawPlugins(){return _e(this,void 0,void 0,function*(){return yield this.loadPlugins()})}getPluginById(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawPluginById(e);return tn({data:n})})}getRawPluginById(e){return _e(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsById.get(e);if(!n)throw new Error(`Plugin with ID '${e}' not found`);return n})}getPluginByPackageName(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawPluginByPackageName(e);return tn({data:n})})}getRawPluginByPackageName(e){return _e(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsByPackageName.get(e);if(!n)throw new Error(`Plugin with package name '${e}' not found`);return n})}prefetchAllModelsAndFields(){return _e(this,void 0,void 0,function*(){if(this.prefetchPromise)return this.prefetchPromise;const e=()=>_e(this,void 0,void 0,function*(){const{included:n}=yield this.client.site.rawFind({include:"item_types,item_types.fields"});if(!n)return;const r=n.filter(s=>s.type==="item_type"),o=n.filter(s=>s.type==="field");this.itemTypesPromise=Promise.resolve(r);for(const s of r)this.itemTypesByApiKey.set(s.attributes.api_key,s),this.itemTypesById.set(s.id,s);const i=new Map;for(const s of o){const a=s.relationships.item_type.data.id;i.has(a)||i.set(a,[]),i.get(a).push(s)}for(const[s,a]of i)this.fieldsByItemType.set(s,a)});return this.prefetchPromise=e(),this.prefetchPromise})}getRawModelsEmbeddingBlocks(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set(e.map(s=>s.id)),o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return!1;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=kp(l);if(c.some(f=>r.has(f)))return!0;const d=c.map(f=>n.find(p=>p.id===f));for(const f of d)if(yield i(f,new Set(a)))return!0}return!1});for(const s of n)(yield i(s))&&o.push(s);return o})}getModelsEmbeddingBlocks(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawModelsEmbeddingBlocks(e);return tn({data:n})})}getRawNestedBlocks(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=kp(l);for(const d of c)if(!r.has(d)){r.add(d);const f=n.find(p=>p.id===d);f&&(o.push(f),yield i(f,new Set(a)))}}});for(const s of e)yield i(s);return o})}getNestedBlocks(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawNestedBlocks(e);return tn({data:n})})}getRawNestedModels(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=w9(l);for(const f of c)if(!r.has(f)){r.add(f);const p=n.find(h=>h.id===f);p&&o.push(p)}const d=kp(l);for(const f of d){const p=n.find(h=>h.id===f);p&&(yield i(p,new Set(a)))}}});for(const s of e)yield i(s);return o})}getNestedModels(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawNestedModels(e);return tn({data:n})})}}function qT(t,e,n,r,o,i,s){const a=`Record #${t}`;if(s)return o;const u=n.presentationTitleFieldId??n.titleFieldId;if(!u)return a;const l=r.find(f=>f.id===u);if(!l)return a;const c=e[l.apiKey];if(c==null)return a;const d=nf(c,i);return d!==c&&d?String(d):typeof c=="object"&&!Array.isArray(c)?a:String(c)}let Zw=new WeakMap;function _9(t){let e=Zw.get(t);return e||(e=new b9(t),Zw.set(t,e)),e}async function S9(t,e,n){const r=new Map,o=new Map;for(const u of e)o.set(u.recordId,u);const i=new Map;for(const{recordId:u,modelId:l}of o.values()){const c=i.get(l)??[];c.push(u),i.set(l,c)}const s=_9(t),a=Array.from(i.entries()).map(async([u,l])=>{var c,d;try{const f=await s.getItemTypeById(u),p=f.name,h=f.singleton??!1;if(h){for(const b of l)r.set(b,{title:p,modelName:p,isSingleton:h});return}const v=(await s.getItemTypeFields(f)).map(b=>({id:b.id,apiKey:b.api_key})),y={presentationTitleFieldId:((c=f.presentation_title_field)==null?void 0:c.id)??null,titleFieldId:((d=f.title_field)==null?void 0:d.id)??null},w=100;for(let b=0;b<l.length;b+=w){const S=l.slice(b,b+w);try{const k=await t.items.list({filter:{type:u,ids:S.join(",")},page:{limit:w}}),E=new Map(k.map(x=>[x.id,x]));for(const x of S){const T=E.get(x);if(!T){r.set(x,{title:`Record #${x}`,modelName:p,isSingleton:!1});continue}const O=qT(x,T,y,v,p,n,h);r.set(x,{title:O,modelName:p,isSingleton:h})}}catch(k){Te("Failed to batch fetch records:",k,{modelId:u,batchIds:S});for(const E of S)r.set(E,{title:`Record #${E}`,modelName:p,isSingleton:!1})}}}catch(f){Te("Failed to process model for titles:",f,{modelId:u});for(const p of l)r.set(p,{title:`Record #${p}`,modelName:"Unknown",isSingleton:!1})}});return await Promise.all(a),r}function xp(t){return typeof t=="object"&&t!==null&&"upload_id"in t&&typeof t.upload_id=="string"}function k9(t,e,n,r,o){var u,l;if(!e)return`Record #${t.id}`;const i={presentationTitleFieldId:((u=e.relationships.presentation_title_field.data)==null?void 0:u.id)??null,titleFieldId:((l=e.relationships.title_field.data)==null?void 0:l.id)??null},s=n.map(c=>({id:c.id,apiKey:c.attributes.api_key})),a=e.attributes.singleton??!1;return qT(t.id,t.attributes,i,s,r,o,a)}function eb(t,e){if(t==null)return null;const r=!Array.isArray(t)&&xp(t)?t:nf(t,e);if(!r)return null;if(Array.isArray(r)){const o=r[0];return xp(o)?o.upload_id:null}return xp(r)?r.upload_id:null}async function tb(t,e){try{const n=await t.uploads.find(e),r=n.mime_type??"",o=n.url??"";return Ag(r,o,n.mux_playback_id)}catch(n){return Te("Failed to fetch thumbnail for upload:",n,{uploadId:e}),null}}async function x9(t,e,n,r,o){var d,f;if(!e||!o||e.attributes.collection_appearance==="compact")return null;const s=(d=e.relationships.presentation_image_field.data)==null?void 0:d.id,a=(f=e.relationships.image_preview_field.data)==null?void 0:f.id,u=s??a;if(u){const p=n.find(h=>h.id===u);if(p){const h=p.attributes.api_key,m=eb(t.attributes[h],r);if(m){const v=await tb(o,m);if(v)return v}}}const c=[...n].sort((p,h)=>(p.attributes.position??0)-(h.attributes.position??0)).find(p=>{const h=p.attributes.field_type;return h==="file"||h==="gallery"});if(c){const p=c.attributes.api_key,h=eb(t.attributes[p],r);if(h)return await tb(o,h)}return null}async function Lg(t,e,n,r,o,i,s){const a=(n==null?void 0:n.attributes.singleton)??!1,u=k9(t,n,r,e.name,o),l=await x9(t,n,r,o,i),c=s!==void 0?s:Jh(e.name).emoji;return{type:"record",id:t.id,title:u,modelId:e.id,modelApiKey:e.apiKey,modelName:e.name,modelEmoji:c,thumbnailUrl:l,isSingleton:a}}function E9(t){return"current"in t?t.current:t}async function nb(t,e,n){const{maxRetries:r=5,delayMs:o=100}={};for(let i=0;i<r;i++){await new Promise(s=>setTimeout(s,o));try{const s=E9(t);if(s)return s.focus(),s.insertMention(e),!0;i<r-1&&(i+1,`${r}`,e.type,void 0)}catch(s){if(i===r-1)throw Te("insertMentionWithRetry: all retry attempts failed",s,{mentionType:e.type,maxRetries:r}),s;i+1,`${r}`,e.type,s instanceof Error?s.message:String(s)}}return e.type,!1}const Gs={cdaToken:"",migrationCompleted:!1,realTimeUpdatesEnabled:!0,dashboardEnabled:!0};function sf(t){if(!t||typeof t!="object")return{...Gs};const e=t;return{cdaToken:typeof e.cdaToken=="string"?e.cdaToken:Gs.cdaToken,migrationCompleted:typeof e.migrationCompleted=="boolean"?e.migrationCompleted:Gs.migrationCompleted,realTimeUpdatesEnabled:typeof e.realTimeUpdatesEnabled=="boolean"?e.realTimeUpdatesEnabled:Gs.realTimeUpdatesEnabled,dashboardEnabled:typeof e.dashboardEnabled=="boolean"?e.dashboardEnabled:Gs.dashboardEnabled}}function T9(t){return typeof t.cdaToken=="string"&&t.cdaToken.length>0}const C9=({ctx:t})=>{var Y;const{email:e,name:n}=DT(t.currentUser),[r,o]=_.useState([]),i=_.useRef(null),s=_.useRef(new Set),[a,u]=_.useState(!1),[l,c]=_.useState(!1),[d,f]=_.useState(null),p=t.currentUserAccessToken,h=sf(t.plugin.attributes.parameters),m=h.realTimeUpdatesEnabled??!0,v=h.cdaToken,y=_.useMemo(()=>g9(p),[p]),{projectUsers:w,projectModels:b,modelFields:S,typedUsers:k}=jT(t,{loadFields:!0}),{canMentionAssets:E,canMentionModels:x,readableModels:T}=zT(t,b),O=_.useMemo(()=>{const te=MT(t.itemTypes);return(te==null?void 0:te.id)??null},[t.itemTypes]),[N,$]=_.useState(null),{enqueue:P,pendingCount:D,isSyncAllowed:q,retryState:B}=RT({client:y,commentRecordId:N,commentsModelId:O,modelId:t.itemType.id,recordId:(Y=t.item)==null?void 0:Y.id,ctx:t,onRecordCreated:$}),{comments:z,setComments:K,isLoading:I,error:L,errorInfo:F,status:Z,retry:ie}=BT({context:"record",ctx:t,realTimeEnabled:m,cdaToken:v,client:y,isSyncAllowed:q,onCommentRecordIdChange:$});_.useEffect(()=>{d===null&&z.length>0&&f(Math.max(0,z.length-Pu))},[z.length,d]);const ke=_.useMemo(()=>{const te=d??Math.max(0,z.length-Pu),ye=z.length-te;return z.slice(0,ye)},[z,d]),fe=(d??0)>0,{submitNewComment:Ne,deleteComment:pe,editComment:Ae,upvoteComment:Ue,replyComment:pt}=$T({ctx:t,userEmail:e,userName:n,setComments:K,enqueue:P,composerSegments:r,setComposerSegments:o,pendingNewReplies:s}),Ve=_.useCallback(async()=>{var te;if(E)try{const ye=await t.selectUpload({multiple:!1});if(!ye)return;const ae=Mm(ye);(te=i.current)==null||te.insertMention(ae)}catch(ye){Te("Asset picker error:",ye),t.alert(Lt.ASSET_PICKER_FAILED)}},[t,E]),Mn=_.useCallback(()=>{u(!0)},[]),_o=_.useCallback(()=>{var te;u(!1),c(!1),(te=se.current||i.current)==null||te.focus(),se.current=null},[]),se=_.useRef(null),Nr=_.useCallback(async(te,ye)=>{var ae;if(se.current=ye.current,c(!0),te==="asset"){if(!E){c(!1);return}try{const we=await t.selectUpload({multiple:!1});if(!we){(ae=se.current)==null||ae.focus(),c(!1);return}const Ce=Mm(we);await nb(se,Ce)}catch(we){Te("Asset picker error:",we),t.alert(Lt.ASSET_PICKER_FAILED)}finally{c(!1),se.current=null}}else te==="record"&&u(!0)},[t,E]),So=_.useCallback(async te=>{u(!1);const ye=se.current||i.current;if(!ye){c(!1),se.current=null;return}try{const ae=await t.selectItem(te.id,{multiple:!1});if(!ae){ye==null||ye.focus();return}const we=t.itemTypes[te.id];let Ce=[];if(we)try{Ce=await t.loadItemTypeFields(te.id)}catch(bt){Te("Failed to load item type fields for record mention",bt,{modelId:te.id})}const qe=t.site.attributes.locales[0],ut=await Lg({id:ae.id,attributes:ae.attributes},{id:te.id,apiKey:te.apiKey,name:te.name,isBlockModel:te.isBlockModel},we,Ce,qe,y);await nb(ye,ut)}catch(ae){Te("Record picker error:",ae),t.alert(Lt.RECORD_PICKER_FAILED)}finally{c(!1),se.current=null}},[t,y]),{handleUserToolbarClick:Ar,handleFieldToolbarClick:$n,handleModelToolbarClick:ge,handleAssetToolbarClick:lt,handleRecordToolbarClick:G}=LT({composerRef:i,canMentionModels:x,handleAssetTrigger:Ve,handleRecordTrigger:Mn}),le=_.useMemo(()=>Ig(r),[r]);if(m&&Z===gd.CONNECTING||!m&&I)return g.jsx(ma,{ctx:t,children:g.jsx("div",{className:He.loading,children:g.jsx(Ch,{})})});if(L){const te=Dg(L);return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:He.error,role:"alert",children:[g.jsx("p",{children:"Error loading comments"}),g.jsx("span",{children:te.message})]})})}return g.jsx(ma,{ctx:t,children:g.jsx(sk,{projectUsers:w,projectModels:b,modelFields:S,currentUserEmail:e,typedUsers:k,children:g.jsx(VT,{canMentionFields:!0,canMentionAssets:E,canMentionModels:x,children:g.jsxs("div",{className:He.container,children:[g.jsx("div",{className:He.header,children:g.jsx(JV,{subscriptionStatus:Z,subscriptionError:(F==null?void 0:F.message)??null,retryState:B,onRetry:ie})}),m&&!v&&g.jsxs("div",{className:He.warning,children:[g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-labelledby":"warningIconTitle",children:[g.jsx("title",{id:"warningIconTitle",children:"Warning"}),g.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})]}),g.jsx("span",{children:"Realtime updates disabled. Configure a CDA token in plugin settings."})]}),g.jsx("div",{className:He.composer,children:g.jsx(hd,{fallbackMessage:"Unable to load editor. Please refresh.",children:g.jsxs("div",{className:He.composerInputWrapper,children:[g.jsx(rf,{ref:i,segments:r,onSegmentsChange:o,onSubmit:Ne,placeholder:`Add a comment...
|
|
250
|
-
@ user, # field, & record, ^ asset, $ model`,projectUsers:w,modelFields:S,projectModels:b,canMentionAssets:E,canMentionModels:x,canMentionFields:!0,onAssetTrigger:Ve,onRecordTrigger:Mn,autoFocus:!1,ctx:t}),a&&g.jsx(Ah,{models:T,onSelect:So,onClose:_o}),g.jsx(Ay,{onUserClick:Ar,onFieldClick:$n,onRecordClick:G,onAssetClick:lt,onModelClick:ge,onSendClick:Ne,isSendDisabled:le||D>0,canMentionAssets:E,canMentionModels:x})]})})}),g.jsx(kV,{comments:ke,hasMoreComments:fe,onLoadMore:()=>f(te=>Math.max(0,(te??0)-Pu)),currentUserEmail:e,modelFields:S,projectUsers:w,projectModels:b,deleteComment:pe,editComment:Ae,upvoteComment:Ue,replyComment:pt,onPickerRequest:Nr,canMentionAssets:E,canMentionModels:x,ctx:t,isPickerActive:l,typedUsers:k})]})})})})},M9="_container_a1s2s_23",O9="_intro_a1s2s_29",N9="_successBox_a1s2s_36",A9="_successIcon_a1s2s_49",I9="_warningBox_a1s2s_63",P9="_warningIcon_a1s2s_76",R9="_formField_a1s2s_90",D9="_buttonRow_a1s2s_94",j9="_section_a1s2s_99",L9="_sectionTitle_a1s2s_103",B9="_description_a1s2s_112",F9="_code_a1s2s_118",$9="_migrationActions_a1s2s_131",z9="_migrationModels_a1s2s_137",U9="_migrationSubtitle_a1s2s_144",V9="_modelList_a1s2s_151",q9="_modelItem_a1s2s_157",H9="_modelName_a1s2s_169",W9="_modelApiKey_a1s2s_174",K9="_progressContainer_a1s2s_182",G9="_progressHeader_a1s2s_189",J9="_progressBar_a1s2s_197",Y9="_progressFill_a1s2s_204",Q9="_resultsContainer_a1s2s_213",X9="_resultsGrid_a1s2s_220",Z9="_resultItem_a1s2s_227",eq="_resultNumber_a1s2s_235",tq="_resultLabel_a1s2s_242",nq="_errorList_a1s2s_249",rq="_errorBox_a1s2s_276",oq="_errorIcon_a1s2s_289",iq="_dangerBox_a1s2s_305",sq="_dangerIcon_a1s2s_318",aq="_cleanupSection_a1s2s_325",lq="_confirmDialog_a1s2s_331",uq="_confirmActions_a1s2s_345",cq="_scanProgressContainer_a1s2s_352",dq="_scanProgressHeader_a1s2s_360",fq="_scanPhaseLabel_a1s2s_367",pq="_scanProgressCount_a1s2s_373",hq="_scanDetails_a1s2s_379",mq="_scanCurrentModel_a1s2s_388",yq="_scanFoundCounter_a1s2s_399",ne={container:M9,intro:O9,successBox:N9,successIcon:A9,warningBox:I9,warningIcon:P9,formField:R9,buttonRow:D9,section:j9,sectionTitle:L9,description:B9,code:F9,migrationActions:$9,migrationModels:z9,migrationSubtitle:U9,modelList:V9,modelItem:q9,modelName:H9,modelApiKey:W9,progressContainer:K9,progressHeader:G9,progressBar:J9,progressFill:Y9,resultsContainer:Q9,resultsGrid:X9,resultItem:Z9,resultNumber:eq,resultLabel:tq,errorList:nq,errorBox:rq,errorIcon:oq,dangerBox:iq,dangerIcon:sq,cleanupSection:aq,confirmDialog:lq,confirmActions:uq,scanProgressContainer:cq,scanProgressHeader:dq,scanPhaseLabel:fq,scanProgressCount:pq,scanDetails:hq,scanCurrentModel:mq,scanFoundCounter:yq};function gq(t){return!t||!Array.isArray(t)?[]:t.map(e=>{if(typeof e!="string")return e;const n=e;return{name:n.includes("@")?n.split("@")[0]:n,email:n}})}function HT(t){var r;const{parentCommentISO:e,...n}=t;return{...n,usersWhoUpvoted:gq(t.usersWhoUpvoted),replies:(r=t.replies)==null?void 0:r.map(HT),...e!==void 0&&{parentCommentId:e}}}function Am(t){return!t.id||t.id===t.dateISO?!0:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t.id)}function WT(t,e=new Map){var a;const n=t.id??t.dateISO,r=Am(t),o=r?crypto.randomUUID():n;r&&n&&e.set(n,o);let i=t.parentCommentId;t.parentCommentId&&e.has(t.parentCommentId)&&(i=e.get(t.parentCommentId));const s=(a=t.replies)==null?void 0:a.map(u=>{const l={...u,parentCommentId:u.parentCommentId===n?o:u.parentCommentId};return WT(l,e)});return{...t,id:o,...i!==void 0&&{parentCommentId:i},...s&&{replies:s}}}function vq(t){if(!t.some(o=>{var i;return Am(o)||((i=o.replies)==null?void 0:i.some(Am))}))return{comments:t,wasMigrated:!1};const n=new Map;return{comments:t.map(o=>WT(o,n)),wasMigrated:!0}}const wq=({ctx:t})=>{const e=sf(t.plugin.attributes.parameters),[n,r]=_.useState(e.cdaToken??""),[o,i]=_.useState(e.realTimeUpdatesEnabled??!0),[s,a]=_.useState(e.dashboardEnabled??!0),[u,l]=_.useState(!1),[c,d]=_.useState(e.migrationCompleted?"completed":"idle"),[f,p]=_.useState([]),[h,m]=_.useState(null),[v,y]=_.useState(null),[w,b]=_.useState(null),[S,k]=_.useState(!1),[E,x]=_.useState(!1),[T,O]=_.useState(null),N=async()=>{l(!0),await t.updatePluginParameters({...e,cdaToken:n,realTimeUpdatesEnabled:o,dashboardEnabled:s}),await t.notice("Settings saved successfully!"),l(!1)},$=_.useCallback(()=>t.currentUserAccessToken?Sd({apiToken:t.currentUserAccessToken}):null,[t.currentUserAccessToken]),P=_.useCallback(async()=>{d("scanning"),b(null),p([]),O({phase:"fetching-models",scannedModels:0,totalModels:0,foundCount:0});try{const z=Object.values(t.itemTypes).filter(F=>F!==void 0),K=[],I=z.filter(F=>F.attributes.api_key!==io);O({phase:"scanning-fields",scannedModels:0,totalModels:I.length,foundCount:0});let L=0;for(const F of I){O({phase:"scanning-fields",currentModel:F.attributes.name,scannedModels:L,totalModels:I.length,foundCount:K.length});try{const ie=(await t.loadItemTypeFields(F.id)).find(ke=>ke.attributes.api_key==="comment_log");ie&&K.push({modelId:F.id,modelName:F.attributes.name,modelApiKey:F.attributes.api_key,fieldId:ie.id})}catch(Z){`${F.attributes.name}`,F.id}L++,O({phase:"scanning-fields",currentModel:F.attributes.name,scannedModels:L,totalModels:I.length,foundCount:K.length})}p(K),O(null),K.length===0?(d("idle"),await t.notice("No legacy comment_log fields found. Nothing to migrate!")):(d("idle"),await t.notice(`Found ${K.length} model(s) with comment_log fields.`))}catch(z){d("error"),O(null),b(z instanceof Error?z.message:"Unknown error during scan")}},[t]),D=_.useCallback(async()=>{const z=$();if(!z){t.alert("Unable to access API. Please ensure you have proper permissions.");return}if(f.length===0){t.alert("No models to migrate. Please scan first.");return}d("migrating"),b(null),y(null);const K={success:0,skipped:0,failed:0,errors:[]};try{const I=Object.values(t.itemTypes).find(F=>(F==null?void 0:F.attributes.api_key)===io);if(!I)throw new Error("project_comment model not found. Please reload the plugin to create it.");let L=0;for(const F of f){m({currentModel:F.modelName,currentRecord:0,totalRecords:0,processedModels:L,totalModels:f.length});const Z=[];for await(const fe of z.items.listPagedIterator({filter:{type:F.modelApiKey}}))Z.push({id:fe.id,comment_log:fe.comment_log});let ie=0;const ke=Z.length;for(const fe of Z){ie++,m({currentModel:F.modelName,currentRecord:ie,totalRecords:ke,processedModels:L,totalModels:f.length});const Ne=fe.comment_log;if(!Ne)continue;let pe;if(typeof Ne=="string")try{const Ve=JSON.parse(Ne);if(!Array.isArray(Ve))continue;pe=Ve}catch(Ve){fe.id;continue}else if(Array.isArray(Ne))pe=Ne;else continue;if(pe.length===0)continue;const Ae=pe.map(HT),{comments:Ue}=vq(Ae);if((await z.items.list({filter:{type:io,fields:{model_id:{eq:F.modelId},record_id:{eq:fe.id}}}})).length>0){K.skipped++;continue}try{await z.items.create({item_type:{type:"item_type",id:I.id},model_id:F.modelId,record_id:fe.id,content:JSON.stringify(Ue)}),K.success++}catch(Ve){K.failed++,K.errors.push(`Record ${fe.id} in ${F.modelName}: ${Ve instanceof Error?Ve.message:"Unknown error"}`)}ie%10===0&&await new Promise(Ve=>setTimeout(Ve,100))}L++}y(K),m(null),K.failed===0?(d("completed"),await t.updatePluginParameters({...e,migrationCompleted:!0}),await t.notice("Migration completed successfully!")):(d("completed"),await t.notice(`Migration completed with ${K.failed} error(s). Check details below.`))}catch(I){d("error"),b(I instanceof Error?I.message:"Unknown error during migration"),m(null)}},[t,$,f,e]),q=_.useCallback(async()=>{const z=$();if(!z){t.alert("Unable to access API. Please ensure you have proper permissions.");return}k(!0),x(!1);try{for(const K of f)await z.fields.destroy(K.fieldId);p([]),await t.notice("Old comment_log fields have been deleted successfully!")}catch(K){t.alert(`Error deleting fields: ${K instanceof Error?K.message:"Unknown error"}`)}finally{k(!1)}},[t,$,f]),B=()=>g.jsxs("div",{className:ne.section,children:[g.jsx("h2",{className:ne.sectionTitle,children:"Migration from Legacy System"}),g.jsxs("p",{className:ne.description,children:["If you were using an older version of this plugin that stored comments in a"," ",g.jsx("code",{className:ne.code,children:"comment_log"})," field on each model, you can migrate those comments to the new centralized system."]}),c==="idle"&&f.length>0&&g.jsxs("div",{className:ne.warningBox,children:[g.jsx("div",{className:ne.warningIcon,children:"!"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Important:"})," Please ensure no one is editing comments during the migration process to avoid data loss."]})]}),c!=="completed"&&g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"muted",onClick:P,disabled:c==="scanning"||c==="migrating",children:c==="scanning"?g.jsxs(g.Fragment,{children:[g.jsx(Ch,{size:16})," Scanning..."]}):"Scan for Legacy Comments"})}),c==="scanning"&&T&&g.jsxs("div",{className:ne.scanProgressContainer,children:[g.jsxs("div",{className:ne.scanProgressHeader,children:[g.jsx("span",{className:ne.scanPhaseLabel,children:T.phase==="fetching-models"?"Loading models list...":"Checking model fields..."}),T.phase==="scanning-fields"&&g.jsxs("span",{className:ne.scanProgressCount,children:[T.scannedModels," / ",T.totalModels]})]}),T.phase==="scanning-fields"&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ne.progressBar,children:g.jsx("div",{className:ne.progressFill,style:{width:`${T.totalModels>0?T.scannedModels/T.totalModels*100:0}%`}})}),g.jsxs("div",{className:ne.scanDetails,children:[T.currentModel&&g.jsxs("span",{className:ne.scanCurrentModel,children:["Checking: ",g.jsx("strong",{children:T.currentModel})]}),g.jsxs("span",{className:ne.scanFoundCounter,children:[T.foundCount," legacy field",T.foundCount!==1?"s":""," found"]})]})]})]}),f.length>0&&c!=="migrating"&&g.jsxs("div",{className:ne.migrationModels,children:[g.jsxs("h3",{className:ne.migrationSubtitle,children:["Found ",f.length," model(s) with comment_log field:"]}),g.jsx("ul",{className:ne.modelList,children:f.map(z=>g.jsxs("li",{className:ne.modelItem,children:[g.jsx("span",{className:ne.modelName,children:z.modelName}),g.jsxs("span",{className:ne.modelApiKey,children:["(",z.modelApiKey,")"]})]},z.modelId))}),c!=="completed"&&g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"primary",onClick:D,children:"Start Migration"})})]}),c==="migrating"&&h&&g.jsxs("div",{className:ne.progressContainer,children:[g.jsxs("div",{className:ne.progressHeader,children:[g.jsxs("span",{children:["Migrating: ",h.currentModel," (",h.processedModels+1,"/",h.totalModels," models)"]}),g.jsxs("span",{children:["Record ",h.currentRecord,"/",h.totalRecords]})]}),g.jsx("div",{className:ne.progressBar,children:g.jsx("div",{className:ne.progressFill,style:{width:`${h.totalRecords>0?h.currentRecord/h.totalRecords*100:0}%`}})})]}),c==="error"&&w&&g.jsxs("div",{className:ne.errorBox,children:[g.jsx("div",{className:ne.errorIcon,children:"✕"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Error:"})," ",w]})]}),v&&g.jsxs("div",{className:ne.resultsContainer,children:[g.jsx("h3",{className:ne.migrationSubtitle,children:"Migration Results"}),g.jsxs("div",{className:ne.resultsGrid,children:[g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.success}),g.jsx("span",{className:ne.resultLabel,children:"Migrated"})]}),g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.skipped}),g.jsx("span",{className:ne.resultLabel,children:"Skipped (already migrated)"})]}),g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.failed}),g.jsx("span",{className:ne.resultLabel,children:"Failed"})]})]}),v.errors.length>0&&g.jsxs("div",{className:ne.errorList,children:[g.jsx("h4",{children:"Errors:"}),g.jsxs("ul",{children:[v.errors.slice(0,10).map(z=>g.jsx("li",{children:z},z)),v.errors.length>10&&g.jsxs("li",{children:["...and ",v.errors.length-10," more errors"]})]})]})]}),c==="completed"&&f.length>0&&g.jsxs("div",{className:ne.cleanupSection,children:[g.jsx("h3",{className:ne.migrationSubtitle,children:"Cleanup Old Fields"}),g.jsxs("p",{className:ne.description,children:["After verifying the migration was successful, you can optionally delete the old"," ",g.jsx("code",{className:ne.code,children:"comment_log"})," fields from your models."]}),g.jsxs("div",{className:ne.dangerBox,children:[g.jsx("div",{className:ne.dangerIcon,children:"⚠️"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Warning:"})," This action is irreversible. Only proceed if you have verified that all comments were migrated successfully."]})]}),E?g.jsxs("div",{className:ne.confirmDialog,children:[g.jsxs("p",{children:["Are you sure you want to delete ",f.length," comment_log field(s)?"]}),g.jsxs("div",{className:ne.confirmActions,children:[g.jsx(_i,{buttonType:"negative",onClick:q,disabled:S,children:S?g.jsxs(g.Fragment,{children:[g.jsx(Ch,{size:16})," Deleting..."]}):"Yes, Delete Fields"}),g.jsx(_i,{buttonType:"muted",onClick:()=>x(!1),disabled:S,children:"Cancel"})]})]}):g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"negative",onClick:()=>x(!0),disabled:S,children:"Delete Old comment_log Fields"})})]}),c==="completed"&&f.length===0&&g.jsxs("div",{className:ne.successBox,children:[g.jsx("div",{className:ne.successIcon,children:"✓"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Migration complete!"})," All comments have been migrated to the new system and old fields have been cleaned up."]})]})]});return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:ne.container,children:[g.jsxs("p",{className:ne.intro,children:["This plugin enables team collaboration through comments in two ways: a"," ",g.jsx("strong",{children:"sidebar panel"})," on every record for record-specific discussions, and a"," ",g.jsx("strong",{children:"project-wide Comments Dashboard"})," for general team conversations. Use rich mentions to reference users (@), fields (#), records (&), assets (^), and models ($) directly in your comments. The dashboard also shows your mentions and recent activity across the project."]}),g.jsxs("div",{className:ne.section,children:[g.jsx("h2",{className:ne.sectionTitle,children:"Configuration"}),g.jsx("p",{className:ne.description,children:"Configure how comments are synchronized across users. Real-time updates are recommended for the best collaborative experience."}),g.jsx("div",{className:ne.formField,children:g.jsx(ov,{id:"realtime-toggle",name:"realtime-toggle",label:"Enable Real-Time Updates (Recommended)",hint:"When enabled, comments update instantly across all users. Requires a Content Delivery API token.",value:o,onChange:z=>i(z)})}),o&&g.jsx("div",{className:ne.formField,children:g.jsx(F2,{id:"cda-token",name:"cda-token",label:"Content Delivery API Token",hint:"You can find this in Project Settings → API Tokens. Use a token with read access.",value:n,onChange:z=>r(z),textInputProps:{monospaced:!0}})}),g.jsx("div",{className:ne.formField,children:g.jsx(ov,{id:"dashboard-toggle",name:"dashboard-toggle",label:"Enable Comments Dashboard",hint:"When enabled, users can access the project-wide Comments Dashboard from the sidebar navigation. Disabling this hides the dashboard for all users.",value:s,onChange:z=>a(z)})}),g.jsx("div",{className:ne.buttonRow,children:g.jsx(_i,{buttonType:"primary",onClick:N,disabled:u||o&&!n,children:u?"Saving...":"Save Settings"})})]}),B()]})})};function bq({count:t,onClick:e,accentColor:n}){if(t===0)return null;const r=t===1?"comment":"comments";return g.jsxs("button",{type:"button",className:j.newCommentsIndicator,onClick:e,style:{"--accent-color":n},children:[g.jsx(zR,{"aria-label":"Scroll to new comments"}),t," new ",r]})}function _q({ctx:t,composerRef:e,canMentionAssets:n=!0}){const r=_.useCallback(async()=>{var o,i,s;if(n)try{const a=await t.selectUpload({multiple:!1});if(!a){(o=e.current)==null||o.focus();return}const u=a.attributes.mime_type??"application/octet-stream",l=a.attributes.url??"",c=Ag(u,l,a.attributes.mux_playback_id),d={type:"asset",id:a.id,filename:a.attributes.filename,url:l,thumbnailUrl:c,mimeType:u};(i=e.current)==null||i.insertMention(d)}catch(a){Te("Asset picker error",a),t.alert(Lt.ASSET_PICKER_FAILED),(s=e.current)==null||s.focus()}},[t,e,n]);return{handleAssetTrigger:r,handleAssetClick:r}}function Sq({ctx:t,client:e,composerRef:n}){const[r,o]=_.useState(!1),i=_.useRef(0),s=_.useCallback(()=>{o(!0)},[]),a=_.useCallback(async l=>{var d,f,p;o(!1),i.current+=1;const c=i.current;try{const h=await t.selectItem(l.id,{multiple:!1});if(c!==i.current)return;if(!h){(d=n.current)==null||d.focus();return}const m=t.itemTypes[l.id],v=m?await t.loadItemTypeFields(l.id):[],y=t.site.attributes.locales[0],w=OT(m),b=await Lg({id:h.id,attributes:h.attributes},{id:l.id,apiKey:l.apiKey,name:l.name,isBlockModel:l.isBlockModel},m,v,y,e,w);if(c!==i.current)return;(f=n.current)==null||f.insertMention(b)}catch(h){c===i.current&&(Te("Record picker error",h),t.alert(Lt.RECORD_PICKER_FAILED),(p=n.current)==null||p.focus())}},[t,e,n]),u=_.useCallback(()=>{var l;o(!1),(l=n.current)==null||l.focus()},[n]);return{isRecordModelSelectorOpen:r,setIsRecordModelSelectorOpen:o,handleRecordTrigger:s,handleRecordModelSelect:a,handleRecordModelSelectorClose:u}}function kq({containerRef:t,itemsCount:e,bottomThreshold:n=50}){const[r,o]=_.useState(!0),[i,s]=_.useState(0),a=_.useRef(!1),u=_.useRef(e),l=_.useRef(n);l.current=n;const c=_.useCallback(()=>{const f=t.current;if(!f)return;const{scrollTop:p,scrollHeight:h,clientHeight:m}=f,v=h-p-m<n;o(v),v&&s(0)},[t,n]),d=_.useCallback(()=>{const f=t.current;f&&f.scrollTo({top:f.scrollHeight,behavior:"smooth"}),s(0)},[t]);return _.useEffect(()=>{const f=e-u.current,p=t.current;f>0&&(r&&p?(a.current=!0,p.scrollTop=p.scrollHeight):r||s(h=>h+f)),u.current=e},[e,r,t]),_.useEffect(()=>{const f=t.current;if(!f)return;let p=!0;const h=new ResizeObserver(()=>{const v=t.current;if(!(!p||!v||!v.isConnected)&&a.current){const{scrollTop:y,scrollHeight:w,clientHeight:b}=v;w-y-b<l.current?v.scrollTop=w:a.current=!1}}),m=f.firstElementChild;return m&&h.observe(m),h.observe(f),()=>{p=!1,h.disconnect()}},[t]),{isAtBottom:r,newItemsCount:i,handleScroll:c,handleNewItemsClick:d}}function xq({items:t,pageSize:e=Pu,containerRef:n}){const[r,o]=_.useState(null),i=_.useRef(null);_.useEffect(()=>{r===null&&t.length>0&&o(Math.max(0,t.length-e))},[t.length,r,e]);const s=_.useMemo(()=>{const l=r??Math.max(0,t.length-e);return t.slice(l)},[t,r,e]),a=(r??0)>0,u=_.useCallback(()=>{const l=n.current;l&&(i.current=l.scrollHeight),o(c=>Math.max(0,(c??0)-e))},[n,e]);return _.useLayoutEffect(()=>{if(i.current===null)return;const l=n.current;if(!l)return;const d=l.scrollHeight-i.current;l.scrollTop+=d,i.current=null},[s,n]),{paginatedItems:s,hasMore:a,handleLoadEarlier:u}}const Eq=({ctx:t,client:e,userName:n,readableModels:r,accentColor:o,comments:i,filteredComments:s,setComments:a,commentsModelId:u,commentRecordId:l,setCommentRecordId:c,isLoading:d,error:f,status:p,isFiltering:h,onSyncAllowedChange:m})=>{const{projectUsers:v,projectModels:y,currentUserEmail:w,typedUsers:b}=Dy(),{canMentionAssets:S,canMentionModels:k}=y9(),[E,x]=_.useState([]),T=_.useRef(null),O=_.useRef(new Set),N=_.useRef(null),$=RT({client:e,commentRecordId:l,commentsModelId:u,modelId:jy,recordId:ak,ctx:t,onRecordCreated:c});_.useEffect(()=>{m($.isSyncAllowed)},[$.isSyncAllowed,m]);const{submitNewComment:P,deleteComment:D,editComment:q,upvoteComment:B,replyComment:z}=$T({userEmail:w,userName:n,setComments:a,enqueue:$.enqueue,composerSegments:E,setComposerSegments:x,pendingNewReplies:O,insertPosition:"append"}),{handleUserToolbarClick:K,handleFieldToolbarClick:I,handleModelToolbarClick:L}=LT({composerRef:T,canMentionModels:k}),{handleAssetTrigger:F,handleAssetClick:Z}=_q({ctx:t,composerRef:T,canMentionAssets:S}),{isRecordModelSelectorOpen:ie,handleRecordTrigger:ke,handleRecordModelSelect:fe,handleRecordModelSelectorClose:Ne}=Sq({ctx:t,client:e,composerRef:T}),pe=_.useRef(null),[Ae,Ue]=_.useState(!1),[pt,Ve]=_.useState(!1),Mn=_.useCallback(async(ae,we)=>{var Ce,qe,ut;if(!pt)if(pe.current=we.current,ae==="asset"){if(!S)return;Ve(!0);try{const bt=await t.selectUpload({multiple:!1});if(!bt){(Ce=pe.current)==null||Ce.focus();return}const zn=Mm(bt);(qe=pe.current)==null||qe.insertMention(zn)}catch(bt){Te("Reply asset picker error:",bt),t.alert(Lt.ASSET_PICKER_FAILED),(ut=pe.current)==null||ut.focus()}finally{Ve(!1)}}else ae==="record"&&Ue(!0)},[t,S,pt]),_o=_.useCallback(async ae=>{var we,Ce,qe;if(Ue(!1),!!pe.current){Ve(!0);try{const ut=await t.selectItem(ae.id,{multiple:!1});if(!ut){(we=pe.current)==null||we.focus();return}const bt=t.itemTypes[ae.id],zn=bt?await t.loadItemTypeFields(ae.id):[],Ee=t.site.attributes.locales[0],As=OT(bt),af=await Lg({id:ut.id,attributes:ut.attributes},{id:ae.id,apiKey:ae.apiKey,name:ae.name,isBlockModel:ae.isBlockModel},bt,zn,Ee,e,As);(Ce=pe.current)==null||Ce.insertMention(af)}catch(ut){Te("Reply record picker error:",ut),t.alert(Lt.RECORD_PICKER_FAILED),(qe=pe.current)==null||qe.focus()}finally{Ve(!1)}}},[t,e]),se=_.useCallback(()=>{var ae;Ue(!1),(ae=pe.current)==null||ae.focus()},[]),Nr=_.useMemo(()=>[...s].sort((ae,we)=>ae.dateISO.localeCompare(we.dateISO)),[s]),{newItemsCount:So,handleScroll:Ar,handleNewItemsClick:$n}=kq({containerRef:N,itemsCount:i.length}),{paginatedItems:ge,hasMore:lt,handleLoadEarlier:G}=xq({items:Nr,containerRef:N}),le=_.useMemo(()=>Ig(E),[E]);if(p===gd.CONNECTING||d)return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),g.jsx("div",{className:j.commentsListEmpty,role:"status","aria-live":"polite","aria-label":"Loading comments",children:g.jsx("div",{className:j.loadingSpinner})})]});if(f){const ae=Dg(f);return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),g.jsxs("div",{className:j.error,role:"alert",children:[g.jsx("p",{children:"Error loading comments"}),g.jsx("span",{children:ae.message})]})]})}const Y=i.length>0,te=ge.length>0,ye=Y&&Nr.length===0&&h;return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),te?g.jsxs("div",{ref:N,className:j.commentsList,onScroll:Ar,children:[lt&&g.jsx("div",{style:{padding:"12px 24px",textAlign:"center"},children:g.jsx("button",{type:"button",className:j.loadEarlierButton,onClick:G,children:"Load earlier messages"})}),ge.map(ae=>g.jsx("div",{style:{padding:"0 24px"},children:g.jsx(hd,{children:g.jsx(vT,{deleteComment:D,editComment:q,upvoteComment:B,replyComment:z,commentObject:ae,currentUserEmail:w,modelFields:[],projectUsers:v,projectModels:y,canMentionFields:!1,onPickerRequest:Mn,canMentionAssets:S,canMentionModels:k,isPickerActive:pt,typedUsers:b})})},ae.id))]}):ye?g.jsxs("div",{className:j.noResults,children:[g.jsx(FR,{className:j.noResultsIcon}),g.jsx("h3",{className:j.noResultsTitle,children:"No comments match your filters"}),g.jsx("p",{className:j.noResultsDescription,children:"Try adjusting your search or filter criteria."})]}):g.jsxs("div",{className:j.commentsListEmpty,children:[g.jsx($R,{className:j.emptyIcon}),g.jsx("h3",{className:j.emptyTitle,children:"Start the conversation"}),g.jsx("p",{className:j.emptyDescription,children:"Be the first to share an update or ask a question about this project."})]}),g.jsx(bq,{count:So,onClick:$n,accentColor:o}),g.jsx("div",{className:j.composer,children:g.jsx(hd,{fallbackMessage:"Unable to load editor. Please refresh the page.",children:g.jsxs(uk,{accentColor:o,children:[g.jsx(rf,{ref:T,segments:E,onSegmentsChange:x,onSubmit:P,placeholder:`Add a message...
|
|
249
|
+
`;function s9(t){return t.context==="record"}function BT(t){var f,p;const{realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o}=t,i=s9(t);let s,a,u,l,c;i?(s=t.ctx.itemType.id,a=((f=t.ctx.item)==null?void 0:f.id)??"",u=pV,l=!!((p=t.ctx.item)!=null&&p.id),c=t.onCommentRecordIdChange):(s=jy,a=ak,u=i9,l=!0,c=void 0);const d=zV({ctx:t.ctx,realTimeEnabled:e,cdaToken:n,client:r,isSyncAllowed:o,query:u,variables:{modelId:s,recordId:a},filterParams:{modelId:s,recordId:a},subscriptionEnabled:l,onCommentRecordIdChange:c});return{comments:d.comments,setComments:d.setComments,isLoading:d.isLoading,error:d.error,errorInfo:d.errorInfo,status:d.status,retry:d.retry,fullResult:d}}function a9(t){return t.length===0?!0:!t.some(e=>e.type==="text"?e.content.trim().length>0:e.type==="mention")}function FT(t,e){return t.trim().length>0&&e.trim().length>0}function Yw(t,e,n){return n?t.filter(r=>r.email!==e.email):[...t,e]}function l9(t,e,n){return n?t.map(r=>{var o;return r.id===n?{...r,replies:(o=r.replies)==null?void 0:o.filter(i=>i.id!==e)}:r}):t.filter(r=>r.id!==e)}function u9(t,e,n,r){return r?t.map(o=>{var i;return o.id===r?{...o,replies:(i=o.replies)==null?void 0:i.map(s=>s.id===e?{...s,content:n}:s)}:o}):t.map(o=>o.id===e?{...o,content:n}:o)}function c9(t,e,n,r,o){return o?t.map(i=>{var s;return i.id===o?{...i,replies:(s=i.replies)==null?void 0:s.map(a=>a.id===e?{...a,usersWhoUpvoted:Yw(a.usersWhoUpvoted,n,r)}:a)}:i}):t.map(i=>i.id===e?{...i,usersWhoUpvoted:Yw(i.usersWhoUpvoted,n,r)}:i)}function Qw(t,e,n,r){if(!FT(e,n))throw new Error("Cannot create comment: author name and email are required");const o=crypto.randomUUID(),i=new Date().toISOString();return r?{id:o,dateISO:i,content:t,author:{name:e,email:n},usersWhoUpvoted:[],parentCommentId:r}:{id:o,dateISO:i,content:t,author:{name:e,email:n},usersWhoUpvoted:[],replies:[]}}function d9(t,e,n,r){var i,s;((i=t.current)==null?void 0:i.has(e))??!1?(s=t.current)==null||s.delete(e):r({type:"DELETE_COMMENT",id:e,parentCommentId:n})}function $T({userEmail:t,userName:e,setComments:n,enqueue:r,composerSegments:o,setComposerSegments:i,pendingNewReplies:s,insertPosition:a="prepend",ctx:u}){const l=_.useCallback(()=>{var m;if(a9(o))return;if(!FT(e,t)){u==null||u.alert(Bt.MISSING_USER_INFO);return}if(u&&!((m=u.item)!=null&&m.id)){u.alert(Bt.SAVE_RECORD_FIRST);return}const h=Qw(o,e,t);n(a==="prepend"?v=>[h,...v]:v=>[...v,h]),r({type:"ADD_COMMENT",comment:h}),i([])},[o,u,t,e,n,r,i,a]),c=_.useCallback((h,m)=>{n(v=>l9(v,h,m)),d9(s,h,m,r)},[n,r,s]),d=_.useCallback((h,m,v)=>{var w,b;const y=((w=s.current)==null?void 0:w.has(h))??!1;n(S=>u9(S,h,m,v)),y&&v?((b=s.current)==null||b.delete(h),n(S=>{var T;const k=S.find(O=>O.id===v),E=(T=k==null?void 0:k.replies)==null?void 0:T.find(O=>O.id===h),x=(E==null?void 0:E.dateISO)??new Date().toISOString();return r({type:"ADD_REPLY",parentCommentId:v,reply:{id:h,dateISO:x,content:m,author:{name:e,email:t},usersWhoUpvoted:[],parentCommentId:v}}),S})):r({type:"EDIT_COMMENT",id:h,newContent:m,parentCommentId:v})},[e,t,n,r,s]),f=_.useCallback((h,m,v)=>{const y={name:e,email:t};n(w=>c9(w,h,y,m,v)),r({type:"UPVOTE_COMMENT",id:h,action:m?"remove":"add",user:y,parentCommentId:v})},[t,e,n,r]),p=_.useCallback(h=>{var v;const m=Qw([],e,t,h);(v=s.current)==null||v.add(m.id),n(y=>y.map(w=>w.id!==h?w:a==="prepend"?{...w,replies:[m,...w.replies??[]]}:{...w,replies:[...w.replies??[],m]}))},[t,e,n,s,a]);return{submitNewComment:l,deleteComment:c,editComment:d,upvoteComment:f,replyComment:p}}function f9(t){const e=t.currentRole,n=t.environment,r=e.attributes.positive_upload_permissions||[],o=e.attributes.negative_upload_permissions||[];return r.some(a=>a.environment===n&&(a.action==="all"||a.action==="read"))?!o.some(a=>a.environment===n&&(a.action==="all"||a.action==="read")):!1}function p9(t){return t.currentRole.meta.final_permissions.can_edit_schema}function h9(t,e){const n=t.currentRole,r=t.environment,o=n.attributes.positive_item_type_permissions||[],i=n.attributes.negative_item_type_permissions||[];return o.some(u=>u.environment===r&&(u.action==="all"||u.action==="read")&&(u.item_type===null||u.item_type===e))?!i.some(u=>u.environment===r&&(u.action==="all"||u.action==="read")&&(u.item_type===null||u.item_type===e)):!1}function m9(t,e){return e.filter(n=>h9(t,n.id))}function zT(t,e){const n=_.useMemo(()=>f9(t),[t.currentRole,t.environment]),r=_.useMemo(()=>p9(t),[t.currentRole]),o=_.useMemo(()=>m9(t,e),[t.currentRole,t.environment,e]);return{canMentionAssets:n,canMentionModels:r,readableModels:o}}const UT=_.createContext(null);function VT({children:t,canMentionFields:e=!0,canMentionAssets:n=!1,canMentionModels:r=!0}){const o=_.useMemo(()=>({canMentionFields:e,canMentionAssets:n,canMentionModels:r}),[e,n,r]);return g.jsx(UT.Provider,{value:o,children:t})}function y9(){const t=_.useContext(UT);if(!t)throw new Error("useMentionPermissionsContext must be used within a MentionPermissionsProvider");return t}function g9(t){return t?Sd({apiToken:t}):null}function v9(t){return typeof t=="object"&&!!t&&"data"in t}function Xw({__itemTypeId:t,id:e,type:n,attributes:r,relationships:o,meta:i}){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t?{__itemTypeId:t}:{}),e?{id:e}:{}),n?{type:n}:{}),r||{}),o?Object.fromEntries(Object.entries(o).map(([s,a])=>[s,a==null?void 0:a.data])):{}),i?{meta:i}:{})}function tn(t){if(!v9(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(Xw):Xw(t.data)}function w9(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"link":return e.validators.item_item_type.item_types;case"links":return e.validators.items_item_type.item_types;case"structured_text":return e.validators.structured_text_links.item_types;default:return[]}}function kp(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"single_block":return e.validators.single_block_blocks.item_types;case"rich_text":return e.validators.rich_text_blocks.item_types;case"structured_text":return[...e.validators.structured_text_blocks.item_types,...e.validators.structured_text_inline_blocks?e.validators.structured_text_inline_blocks.item_types:[]];default:return[]}}var _e=function(t,e,n,r){function o(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function a(c){try{l(r.next(c))}catch(d){s(d)}}function u(c){try{l(r.throw(c))}catch(d){s(d)}}function l(c){c.done?i(c.value):o(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};class b9{constructor(e){this.itemTypesPromise=null,this.itemTypesByApiKey=new Map,this.itemTypesById=new Map,this.fieldsByItemType=new Map,this.fieldsetsByItemType=new Map,this.pluginsPromise=null,this.pluginsById=new Map,this.pluginsByPackageName=new Map,this.prefetchPromise=null,this.client=e}loadItemTypes(){return _e(this,void 0,void 0,function*(){return this.itemTypesPromise||(this.itemTypesPromise=_e(this,void 0,void 0,function*(){const{data:e}=yield this.client.itemTypes.rawList();for(const n of e)this.itemTypesByApiKey.set(n.attributes.api_key,n),this.itemTypesById.set(n.id,n);return e})),this.itemTypesPromise})}getAllItemTypes(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawItemTypes();return tn({data:e})})}getAllRawItemTypes(){return _e(this,void 0,void 0,function*(){return yield this.loadItemTypes()})}getAllModels(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawModels();return tn({data:e})})}getAllRawModels(){return _e(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>!n.attributes.modular_block)})}getAllBlockModels(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawBlockModels();return tn({data:e})})}getAllRawBlockModels(){return _e(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>n.attributes.modular_block)})}getItemTypeByApiKey(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeByApiKey(e);return tn({data:n})})}getRawItemTypeByApiKey(e){return _e(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesByApiKey.get(e);if(!n)throw new Error(`Item type with API key '${e}' not found`);return n})}getItemTypeById(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeById(e);return tn({data:n})})}getRawItemTypeById(e){return _e(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesById.get(e);if(!n)throw new Error(`Item type with ID '${e}' not found`);return n})}getItemTypeFields(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFields(e);return tn({data:n})})}getRawItemTypeFields(e){return _e(this,void 0,void 0,function*(){const n=this.fieldsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fields.rawList(e.id);return this.fieldsByItemType.set(e.id,r),r})}getItemTypeFieldsets(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFieldsets(e);return tn({data:n})})}getRawItemTypeFieldsets(e){return _e(this,void 0,void 0,function*(){const n=this.fieldsetsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fieldsets.rawList(e.id);return this.fieldsetsByItemType.set(e.id,r),r})}loadPlugins(){return _e(this,void 0,void 0,function*(){return this.pluginsPromise||(this.pluginsPromise=_e(this,void 0,void 0,function*(){const{data:e}=yield this.client.plugins.rawList();for(const n of e)this.pluginsById.set(n.id,n),n.attributes.package_name&&this.pluginsByPackageName.set(n.attributes.package_name,n);return e})),this.pluginsPromise})}getAllPlugins(){return _e(this,void 0,void 0,function*(){const e=yield this.getAllRawPlugins();return tn({data:e})})}getAllRawPlugins(){return _e(this,void 0,void 0,function*(){return yield this.loadPlugins()})}getPluginById(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawPluginById(e);return tn({data:n})})}getRawPluginById(e){return _e(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsById.get(e);if(!n)throw new Error(`Plugin with ID '${e}' not found`);return n})}getPluginByPackageName(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawPluginByPackageName(e);return tn({data:n})})}getRawPluginByPackageName(e){return _e(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsByPackageName.get(e);if(!n)throw new Error(`Plugin with package name '${e}' not found`);return n})}prefetchAllModelsAndFields(){return _e(this,void 0,void 0,function*(){if(this.prefetchPromise)return this.prefetchPromise;const e=()=>_e(this,void 0,void 0,function*(){const{included:n}=yield this.client.site.rawFind({include:"item_types,item_types.fields"});if(!n)return;const r=n.filter(s=>s.type==="item_type"),o=n.filter(s=>s.type==="field");this.itemTypesPromise=Promise.resolve(r);for(const s of r)this.itemTypesByApiKey.set(s.attributes.api_key,s),this.itemTypesById.set(s.id,s);const i=new Map;for(const s of o){const a=s.relationships.item_type.data.id;i.has(a)||i.set(a,[]),i.get(a).push(s)}for(const[s,a]of i)this.fieldsByItemType.set(s,a)});return this.prefetchPromise=e(),this.prefetchPromise})}getRawModelsEmbeddingBlocks(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set(e.map(s=>s.id)),o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return!1;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=kp(l);if(c.some(f=>r.has(f)))return!0;const d=c.map(f=>n.find(p=>p.id===f));for(const f of d)if(yield i(f,new Set(a)))return!0}return!1});for(const s of n)(yield i(s))&&o.push(s);return o})}getModelsEmbeddingBlocks(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawModelsEmbeddingBlocks(e);return tn({data:n})})}getRawNestedBlocks(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=kp(l);for(const d of c)if(!r.has(d)){r.add(d);const f=n.find(p=>p.id===d);f&&(o.push(f),yield i(f,new Set(a)))}}});for(const s of e)yield i(s);return o})}getNestedBlocks(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawNestedBlocks(e);return tn({data:n})})}getRawNestedModels(e){return _e(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,o=[],i=(s,a=new Set)=>_e(this,void 0,void 0,function*(){if(a.has(s.id))return;a.add(s.id);const u=yield this.getRawItemTypeFields(s);for(const l of u){const c=w9(l);for(const f of c)if(!r.has(f)){r.add(f);const p=n.find(h=>h.id===f);p&&o.push(p)}const d=kp(l);for(const f of d){const p=n.find(h=>h.id===f);p&&(yield i(p,new Set(a)))}}});for(const s of e)yield i(s);return o})}getNestedModels(e){return _e(this,void 0,void 0,function*(){const n=yield this.getRawNestedModels(e);return tn({data:n})})}}function qT(t,e,n,r,o,i,s){const a=`Record #${t}`;if(s)return o;const u=n.presentationTitleFieldId??n.titleFieldId;if(!u)return a;const l=r.find(f=>f.id===u);if(!l)return a;const c=e[l.apiKey];if(c==null)return a;const d=nf(c,i);return d!==c&&d?String(d):typeof c=="object"&&!Array.isArray(c)?a:String(c)}let Zw=new WeakMap;function _9(t){let e=Zw.get(t);return e||(e=new b9(t),Zw.set(t,e)),e}async function S9(t,e,n){const r=new Map,o=new Map;for(const u of e)o.set(u.recordId,u);const i=new Map;for(const{recordId:u,modelId:l}of o.values()){const c=i.get(l)??[];c.push(u),i.set(l,c)}const s=_9(t),a=Array.from(i.entries()).map(async([u,l])=>{var c,d;try{const f=await s.getItemTypeById(u),p=f.name,h=f.singleton??!1;if(h){for(const b of l)r.set(b,{title:p,modelName:p,isSingleton:h});return}const v=(await s.getItemTypeFields(f)).map(b=>({id:b.id,apiKey:b.api_key})),y={presentationTitleFieldId:((c=f.presentation_title_field)==null?void 0:c.id)??null,titleFieldId:((d=f.title_field)==null?void 0:d.id)??null},w=100;for(let b=0;b<l.length;b+=w){const S=l.slice(b,b+w);try{const k=await t.items.list({filter:{type:u,ids:S.join(",")},page:{limit:w}}),E=new Map(k.map(x=>[x.id,x]));for(const x of S){const T=E.get(x);if(!T){r.set(x,{title:`Record #${x}`,modelName:p,isSingleton:!1});continue}const O=qT(x,T,y,v,p,n,h);r.set(x,{title:O,modelName:p,isSingleton:h})}}catch(k){Te("Failed to batch fetch records:",k,{modelId:u,batchIds:S});for(const E of S)r.set(E,{title:`Record #${E}`,modelName:p,isSingleton:!1})}}}catch(f){Te("Failed to process model for titles:",f,{modelId:u});for(const p of l)r.set(p,{title:`Record #${p}`,modelName:"Unknown",isSingleton:!1})}});return await Promise.all(a),r}function xp(t){return typeof t=="object"&&t!==null&&"upload_id"in t&&typeof t.upload_id=="string"}function k9(t,e,n,r,o){var u,l;if(!e)return`Record #${t.id}`;const i={presentationTitleFieldId:((u=e.relationships.presentation_title_field.data)==null?void 0:u.id)??null,titleFieldId:((l=e.relationships.title_field.data)==null?void 0:l.id)??null},s=n.map(c=>({id:c.id,apiKey:c.attributes.api_key})),a=e.attributes.singleton??!1;return qT(t.id,t.attributes,i,s,r,o,a)}function eb(t,e){if(t==null)return null;const r=!Array.isArray(t)&&xp(t)?t:nf(t,e);if(!r)return null;if(Array.isArray(r)){const o=r[0];return xp(o)?o.upload_id:null}return xp(r)?r.upload_id:null}async function tb(t,e){try{const n=await t.uploads.find(e),r=n.mime_type??"",o=n.url??"";return Ag(r,o,n.mux_playback_id)}catch(n){return Te("Failed to fetch thumbnail for upload:",n,{uploadId:e}),null}}async function x9(t,e,n,r,o){var d,f;if(!e||!o||e.attributes.collection_appearance==="compact")return null;const s=(d=e.relationships.presentation_image_field.data)==null?void 0:d.id,a=(f=e.relationships.image_preview_field.data)==null?void 0:f.id,u=s??a;if(u){const p=n.find(h=>h.id===u);if(p){const h=p.attributes.api_key,m=eb(t.attributes[h],r);if(m){const v=await tb(o,m);if(v)return v}}}const c=[...n].sort((p,h)=>(p.attributes.position??0)-(h.attributes.position??0)).find(p=>{const h=p.attributes.field_type;return h==="file"||h==="gallery"});if(c){const p=c.attributes.api_key,h=eb(t.attributes[p],r);if(h)return await tb(o,h)}return null}async function Lg(t,e,n,r,o,i,s){const a=(n==null?void 0:n.attributes.singleton)??!1,u=k9(t,n,r,e.name,o),l=await x9(t,n,r,o,i),c=s!==void 0?s:Jh(e.name).emoji;return{type:"record",id:t.id,title:u,modelId:e.id,modelApiKey:e.apiKey,modelName:e.name,modelEmoji:c,thumbnailUrl:l,isSingleton:a}}function E9(t){return"current"in t?t.current:t}async function nb(t,e,n){const{maxRetries:r=5,delayMs:o=100}={};for(let i=0;i<r;i++){await new Promise(s=>setTimeout(s,o));try{const s=E9(t);if(s)return s.focus(),s.insertMention(e),!0;i<r-1&&(i+1,`${r}`,e.type,void 0)}catch(s){if(i===r-1)throw Te("insertMentionWithRetry: all retry attempts failed",s,{mentionType:e.type,maxRetries:r}),s;i+1,`${r}`,e.type,s instanceof Error?s.message:String(s)}}return e.type,!1}const Gs={cdaToken:"",migrationCompleted:!1,realTimeUpdatesEnabled:!0,dashboardEnabled:!0};function sf(t){if(!t||typeof t!="object")return{...Gs};const e=t;return{cdaToken:typeof e.cdaToken=="string"?e.cdaToken:Gs.cdaToken,migrationCompleted:typeof e.migrationCompleted=="boolean"?e.migrationCompleted:Gs.migrationCompleted,realTimeUpdatesEnabled:typeof e.realTimeUpdatesEnabled=="boolean"?e.realTimeUpdatesEnabled:Gs.realTimeUpdatesEnabled,dashboardEnabled:typeof e.dashboardEnabled=="boolean"?e.dashboardEnabled:Gs.dashboardEnabled}}function T9(t){return typeof t.cdaToken=="string"&&t.cdaToken.length>0}const C9=({ctx:t})=>{var Y;const{email:e,name:n}=DT(t.currentUser),[r,o]=_.useState([]),i=_.useRef(null),s=_.useRef(new Set),[a,u]=_.useState(!1),[l,c]=_.useState(!1),[d,f]=_.useState(null),p=t.currentUserAccessToken,h=sf(t.plugin.attributes.parameters),m=h.realTimeUpdatesEnabled??!0,v=h.cdaToken,y=_.useMemo(()=>g9(p),[p]),{projectUsers:w,projectModels:b,modelFields:S,typedUsers:k}=jT(t,{loadFields:!0}),{canMentionAssets:E,canMentionModels:x,readableModels:T}=zT(t,b),O=_.useMemo(()=>{const te=MT(t.itemTypes);return(te==null?void 0:te.id)??null},[t.itemTypes]),[N,$]=_.useState(null),{enqueue:P,pendingCount:D,isSyncAllowed:q,retryState:B}=RT({client:y,commentRecordId:N,commentsModelId:O,modelId:t.itemType.id,recordId:(Y=t.item)==null?void 0:Y.id,ctx:t,onRecordCreated:$}),{comments:z,setComments:K,isLoading:I,error:L,errorInfo:F,status:Z,retry:ie}=BT({context:"record",ctx:t,realTimeEnabled:m,cdaToken:v,client:y,isSyncAllowed:q,onCommentRecordIdChange:$});_.useEffect(()=>{d===null&&z.length>0&&f(Math.max(0,z.length-Pu))},[z.length,d]);const ke=_.useMemo(()=>{const te=d??Math.max(0,z.length-Pu),ye=z.length-te;return z.slice(0,ye)},[z,d]),fe=(d??0)>0,{submitNewComment:Ne,deleteComment:pe,editComment:Ae,upvoteComment:Ue,replyComment:pt}=$T({ctx:t,userEmail:e,userName:n,setComments:K,enqueue:P,composerSegments:r,setComposerSegments:o,pendingNewReplies:s}),Ve=_.useCallback(async()=>{var te;if(E)try{const ye=await t.selectUpload({multiple:!1});if(!ye)return;const ae=Mm(ye);(te=i.current)==null||te.insertMention(ae)}catch(ye){Te("Asset picker error:",ye),t.alert(Bt.ASSET_PICKER_FAILED)}},[t,E]),Mn=_.useCallback(()=>{u(!0)},[]),_o=_.useCallback(()=>{var te;u(!1),c(!1),(te=se.current||i.current)==null||te.focus(),se.current=null},[]),se=_.useRef(null),Nr=_.useCallback(async(te,ye)=>{var ae;if(se.current=ye.current,c(!0),te==="asset"){if(!E){c(!1);return}try{const we=await t.selectUpload({multiple:!1});if(!we){(ae=se.current)==null||ae.focus(),c(!1);return}const Ce=Mm(we);await nb(se,Ce)}catch(we){Te("Asset picker error:",we),t.alert(Bt.ASSET_PICKER_FAILED)}finally{c(!1),se.current=null}}else te==="record"&&u(!0)},[t,E]),So=_.useCallback(async te=>{u(!1);const ye=se.current||i.current;if(!ye){c(!1),se.current=null;return}try{const ae=await t.selectItem(te.id,{multiple:!1});if(!ae){ye==null||ye.focus();return}const we=t.itemTypes[te.id];let Ce=[];if(we)try{Ce=await t.loadItemTypeFields(te.id)}catch(bt){Te("Failed to load item type fields for record mention",bt,{modelId:te.id})}const qe=t.site.attributes.locales[0],ut=await Lg({id:ae.id,attributes:ae.attributes},{id:te.id,apiKey:te.apiKey,name:te.name,isBlockModel:te.isBlockModel},we,Ce,qe,y);await nb(ye,ut)}catch(ae){Te("Record picker error:",ae),t.alert(Bt.RECORD_PICKER_FAILED)}finally{c(!1),se.current=null}},[t,y]),{handleUserToolbarClick:Ar,handleFieldToolbarClick:$n,handleModelToolbarClick:ge,handleAssetToolbarClick:lt,handleRecordToolbarClick:G}=LT({composerRef:i,canMentionModels:x,handleAssetTrigger:Ve,handleRecordTrigger:Mn}),le=_.useMemo(()=>Ig(r),[r]);if(m&&Z===gd.CONNECTING||!m&&I)return g.jsx(ma,{ctx:t,children:g.jsx("div",{className:He.loading,children:g.jsx(Ch,{})})});if(L){const te=Dg(L);return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:He.error,role:"alert",children:[g.jsx("p",{children:"Error loading comments"}),g.jsx("span",{children:te.message})]})})}return g.jsx(ma,{ctx:t,children:g.jsx(sk,{projectUsers:w,projectModels:b,modelFields:S,currentUserEmail:e,typedUsers:k,children:g.jsx(VT,{canMentionFields:!0,canMentionAssets:E,canMentionModels:x,children:g.jsxs("div",{className:He.container,children:[g.jsx("div",{className:He.header,children:g.jsx(JV,{subscriptionStatus:Z,subscriptionError:(F==null?void 0:F.message)??null,retryState:B,onRetry:ie,realTimeEnabled:m})}),m&&!v&&g.jsxs("div",{className:He.warning,children:[g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-labelledby":"warningIconTitle",children:[g.jsx("title",{id:"warningIconTitle",children:"Warning"}),g.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})]}),g.jsx("span",{children:"Realtime updates disabled. Configure a CDA token in plugin settings."})]}),g.jsx("div",{className:He.composer,children:g.jsx(hd,{fallbackMessage:"Unable to load editor. Please refresh.",children:g.jsxs("div",{className:He.composerInputWrapper,children:[g.jsx(rf,{ref:i,segments:r,onSegmentsChange:o,onSubmit:Ne,placeholder:`Add a comment...
|
|
250
|
+
@ user, # field, & record, ^ asset, $ model`,projectUsers:w,modelFields:S,projectModels:b,canMentionAssets:E,canMentionModels:x,canMentionFields:!0,onAssetTrigger:Ve,onRecordTrigger:Mn,autoFocus:!1,ctx:t}),a&&g.jsx(Ah,{models:T,onSelect:So,onClose:_o}),g.jsx(Ay,{onUserClick:Ar,onFieldClick:$n,onRecordClick:G,onAssetClick:lt,onModelClick:ge,onSendClick:Ne,isSendDisabled:le||D>0,canMentionAssets:E,canMentionModels:x})]})})}),g.jsx(kV,{comments:ke,hasMoreComments:fe,onLoadMore:()=>f(te=>Math.max(0,(te??0)-Pu)),currentUserEmail:e,modelFields:S,projectUsers:w,projectModels:b,deleteComment:pe,editComment:Ae,upvoteComment:Ue,replyComment:pt,onPickerRequest:Nr,canMentionAssets:E,canMentionModels:x,ctx:t,isPickerActive:l,typedUsers:k})]})})})})},M9="_container_a1s2s_23",O9="_intro_a1s2s_29",N9="_successBox_a1s2s_36",A9="_successIcon_a1s2s_49",I9="_warningBox_a1s2s_63",P9="_warningIcon_a1s2s_76",R9="_formField_a1s2s_90",D9="_buttonRow_a1s2s_94",j9="_section_a1s2s_99",L9="_sectionTitle_a1s2s_103",B9="_description_a1s2s_112",F9="_code_a1s2s_118",$9="_migrationActions_a1s2s_131",z9="_migrationModels_a1s2s_137",U9="_migrationSubtitle_a1s2s_144",V9="_modelList_a1s2s_151",q9="_modelItem_a1s2s_157",H9="_modelName_a1s2s_169",W9="_modelApiKey_a1s2s_174",K9="_progressContainer_a1s2s_182",G9="_progressHeader_a1s2s_189",J9="_progressBar_a1s2s_197",Y9="_progressFill_a1s2s_204",Q9="_resultsContainer_a1s2s_213",X9="_resultsGrid_a1s2s_220",Z9="_resultItem_a1s2s_227",eq="_resultNumber_a1s2s_235",tq="_resultLabel_a1s2s_242",nq="_errorList_a1s2s_249",rq="_errorBox_a1s2s_276",oq="_errorIcon_a1s2s_289",iq="_dangerBox_a1s2s_305",sq="_dangerIcon_a1s2s_318",aq="_cleanupSection_a1s2s_325",lq="_confirmDialog_a1s2s_331",uq="_confirmActions_a1s2s_345",cq="_scanProgressContainer_a1s2s_352",dq="_scanProgressHeader_a1s2s_360",fq="_scanPhaseLabel_a1s2s_367",pq="_scanProgressCount_a1s2s_373",hq="_scanDetails_a1s2s_379",mq="_scanCurrentModel_a1s2s_388",yq="_scanFoundCounter_a1s2s_399",ne={container:M9,intro:O9,successBox:N9,successIcon:A9,warningBox:I9,warningIcon:P9,formField:R9,buttonRow:D9,section:j9,sectionTitle:L9,description:B9,code:F9,migrationActions:$9,migrationModels:z9,migrationSubtitle:U9,modelList:V9,modelItem:q9,modelName:H9,modelApiKey:W9,progressContainer:K9,progressHeader:G9,progressBar:J9,progressFill:Y9,resultsContainer:Q9,resultsGrid:X9,resultItem:Z9,resultNumber:eq,resultLabel:tq,errorList:nq,errorBox:rq,errorIcon:oq,dangerBox:iq,dangerIcon:sq,cleanupSection:aq,confirmDialog:lq,confirmActions:uq,scanProgressContainer:cq,scanProgressHeader:dq,scanPhaseLabel:fq,scanProgressCount:pq,scanDetails:hq,scanCurrentModel:mq,scanFoundCounter:yq};function gq(t){return!t||!Array.isArray(t)?[]:t.map(e=>{if(typeof e!="string")return e;const n=e;return{name:n.includes("@")?n.split("@")[0]:n,email:n}})}function HT(t){var r;const{parentCommentISO:e,...n}=t;return{...n,usersWhoUpvoted:gq(t.usersWhoUpvoted),replies:(r=t.replies)==null?void 0:r.map(HT),...e!==void 0&&{parentCommentId:e}}}function Am(t){return!t.id||t.id===t.dateISO?!0:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t.id)}function WT(t,e=new Map){var a;const n=t.id??t.dateISO,r=Am(t),o=r?crypto.randomUUID():n;r&&n&&e.set(n,o);let i=t.parentCommentId;t.parentCommentId&&e.has(t.parentCommentId)&&(i=e.get(t.parentCommentId));const s=(a=t.replies)==null?void 0:a.map(u=>{const l={...u,parentCommentId:u.parentCommentId===n?o:u.parentCommentId};return WT(l,e)});return{...t,id:o,...i!==void 0&&{parentCommentId:i},...s&&{replies:s}}}function vq(t){if(!t.some(o=>{var i;return Am(o)||((i=o.replies)==null?void 0:i.some(Am))}))return{comments:t,wasMigrated:!1};const n=new Map;return{comments:t.map(o=>WT(o,n)),wasMigrated:!0}}const wq=({ctx:t})=>{const e=sf(t.plugin.attributes.parameters),[n,r]=_.useState(e.cdaToken??""),[o,i]=_.useState(e.realTimeUpdatesEnabled??!0),[s,a]=_.useState(e.dashboardEnabled??!0),[u,l]=_.useState(!1),[c,d]=_.useState(e.migrationCompleted?"completed":"idle"),[f,p]=_.useState([]),[h,m]=_.useState(null),[v,y]=_.useState(null),[w,b]=_.useState(null),[S,k]=_.useState(!1),[E,x]=_.useState(!1),[T,O]=_.useState(null),N=async()=>{l(!0);try{await t.updatePluginParameters({...e,cdaToken:n,realTimeUpdatesEnabled:o,dashboardEnabled:s}),t.notice("Settings saved successfully!")}catch(z){t.alert(`Failed to save settings: ${z instanceof Error?z.message:"Unknown error"}`)}finally{l(!1)}},$=_.useCallback(()=>t.currentUserAccessToken?Sd({apiToken:t.currentUserAccessToken}):null,[t.currentUserAccessToken]),P=_.useCallback(async()=>{d("scanning"),b(null),p([]),O({phase:"fetching-models",scannedModels:0,totalModels:0,foundCount:0});try{const z=Object.values(t.itemTypes).filter(F=>F!==void 0),K=[],I=z.filter(F=>F.attributes.api_key!==io);O({phase:"scanning-fields",scannedModels:0,totalModels:I.length,foundCount:0});let L=0;for(const F of I){O({phase:"scanning-fields",currentModel:F.attributes.name,scannedModels:L,totalModels:I.length,foundCount:K.length});try{const ie=(await t.loadItemTypeFields(F.id)).find(ke=>ke.attributes.api_key==="comment_log");ie&&K.push({modelId:F.id,modelName:F.attributes.name,modelApiKey:F.attributes.api_key,fieldId:ie.id})}catch(Z){`${F.attributes.name}`,F.id}L++,O({phase:"scanning-fields",currentModel:F.attributes.name,scannedModels:L,totalModels:I.length,foundCount:K.length})}p(K),O(null),K.length===0?(d("idle"),await t.notice("No legacy comment_log fields found. Nothing to migrate!")):(d("idle"),await t.notice(`Found ${K.length} model(s) with comment_log fields.`))}catch(z){d("error"),O(null),b(z instanceof Error?z.message:"Unknown error during scan")}},[t]),D=_.useCallback(async()=>{const z=$();if(!z){t.alert("Unable to access API. Please ensure you have proper permissions.");return}if(f.length===0){t.alert("No models to migrate. Please scan first.");return}d("migrating"),b(null),y(null);const K={success:0,skipped:0,failed:0,errors:[]};try{const I=Object.values(t.itemTypes).find(F=>(F==null?void 0:F.attributes.api_key)===io);if(!I)throw new Error("project_comment model not found. Please reload the plugin to create it.");let L=0;for(const F of f){m({currentModel:F.modelName,currentRecord:0,totalRecords:0,processedModels:L,totalModels:f.length});const Z=[];for await(const fe of z.items.listPagedIterator({filter:{type:F.modelApiKey}}))Z.push({id:fe.id,comment_log:fe.comment_log});let ie=0;const ke=Z.length;for(const fe of Z){ie++,m({currentModel:F.modelName,currentRecord:ie,totalRecords:ke,processedModels:L,totalModels:f.length});const Ne=fe.comment_log;if(!Ne)continue;let pe;if(typeof Ne=="string")try{const Ve=JSON.parse(Ne);if(!Array.isArray(Ve))continue;pe=Ve}catch(Ve){fe.id;continue}else if(Array.isArray(Ne))pe=Ne;else continue;if(pe.length===0)continue;const Ae=pe.map(HT),{comments:Ue}=vq(Ae);if((await z.items.list({filter:{type:io,fields:{model_id:{eq:F.modelId},record_id:{eq:fe.id}}}})).length>0){K.skipped++;continue}try{await z.items.create({item_type:{type:"item_type",id:I.id},model_id:F.modelId,record_id:fe.id,content:JSON.stringify(Ue)}),K.success++}catch(Ve){K.failed++,K.errors.push(`Record ${fe.id} in ${F.modelName}: ${Ve instanceof Error?Ve.message:"Unknown error"}`)}ie%10===0&&await new Promise(Ve=>setTimeout(Ve,100))}L++}y(K),m(null),K.failed===0?(d("completed"),await t.updatePluginParameters({...e,migrationCompleted:!0}),await t.notice("Migration completed successfully!")):(d("completed"),await t.notice(`Migration completed with ${K.failed} error(s). Check details below.`))}catch(I){d("error"),b(I instanceof Error?I.message:"Unknown error during migration"),m(null)}},[t,$,f,e]),q=_.useCallback(async()=>{const z=$();if(!z){t.alert("Unable to access API. Please ensure you have proper permissions.");return}k(!0),x(!1);try{for(const K of f)await z.fields.destroy(K.fieldId);p([]),await t.notice("Old comment_log fields have been deleted successfully!")}catch(K){t.alert(`Error deleting fields: ${K instanceof Error?K.message:"Unknown error"}`)}finally{k(!1)}},[t,$,f]),B=()=>g.jsxs("div",{className:ne.section,children:[g.jsx("h2",{className:ne.sectionTitle,children:"Migration from Legacy System"}),g.jsxs("p",{className:ne.description,children:["If you were using an older version of this plugin that stored comments in a"," ",g.jsx("code",{className:ne.code,children:"comment_log"})," field on each model, you can migrate those comments to the new centralized system."]}),c==="idle"&&f.length>0&&g.jsxs("div",{className:ne.warningBox,children:[g.jsx("div",{className:ne.warningIcon,children:"!"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Important:"})," Please ensure no one is editing comments during the migration process to avoid data loss."]})]}),c!=="completed"&&g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"muted",onClick:P,disabled:c==="scanning"||c==="migrating",children:c==="scanning"?g.jsxs(g.Fragment,{children:[g.jsx(Ch,{size:16})," Scanning..."]}):"Scan for Legacy Comments"})}),c==="scanning"&&T&&g.jsxs("div",{className:ne.scanProgressContainer,children:[g.jsxs("div",{className:ne.scanProgressHeader,children:[g.jsx("span",{className:ne.scanPhaseLabel,children:T.phase==="fetching-models"?"Loading models list...":"Checking model fields..."}),T.phase==="scanning-fields"&&g.jsxs("span",{className:ne.scanProgressCount,children:[T.scannedModels," / ",T.totalModels]})]}),T.phase==="scanning-fields"&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:ne.progressBar,children:g.jsx("div",{className:ne.progressFill,style:{width:`${T.totalModels>0?T.scannedModels/T.totalModels*100:0}%`}})}),g.jsxs("div",{className:ne.scanDetails,children:[T.currentModel&&g.jsxs("span",{className:ne.scanCurrentModel,children:["Checking: ",g.jsx("strong",{children:T.currentModel})]}),g.jsxs("span",{className:ne.scanFoundCounter,children:[T.foundCount," legacy field",T.foundCount!==1?"s":""," found"]})]})]})]}),f.length>0&&c!=="migrating"&&g.jsxs("div",{className:ne.migrationModels,children:[g.jsxs("h3",{className:ne.migrationSubtitle,children:["Found ",f.length," model(s) with comment_log field:"]}),g.jsx("ul",{className:ne.modelList,children:f.map(z=>g.jsxs("li",{className:ne.modelItem,children:[g.jsx("span",{className:ne.modelName,children:z.modelName}),g.jsxs("span",{className:ne.modelApiKey,children:["(",z.modelApiKey,")"]})]},z.modelId))}),c!=="completed"&&g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"primary",onClick:D,children:"Start Migration"})})]}),c==="migrating"&&h&&g.jsxs("div",{className:ne.progressContainer,children:[g.jsxs("div",{className:ne.progressHeader,children:[g.jsxs("span",{children:["Migrating: ",h.currentModel," (",h.processedModels+1,"/",h.totalModels," models)"]}),g.jsxs("span",{children:["Record ",h.currentRecord,"/",h.totalRecords]})]}),g.jsx("div",{className:ne.progressBar,children:g.jsx("div",{className:ne.progressFill,style:{width:`${h.totalRecords>0?h.currentRecord/h.totalRecords*100:0}%`}})})]}),c==="error"&&w&&g.jsxs("div",{className:ne.errorBox,children:[g.jsx("div",{className:ne.errorIcon,children:"✕"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Error:"})," ",w]})]}),v&&g.jsxs("div",{className:ne.resultsContainer,children:[g.jsx("h3",{className:ne.migrationSubtitle,children:"Migration Results"}),g.jsxs("div",{className:ne.resultsGrid,children:[g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.success}),g.jsx("span",{className:ne.resultLabel,children:"Migrated"})]}),g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.skipped}),g.jsx("span",{className:ne.resultLabel,children:"Skipped (already migrated)"})]}),g.jsxs("div",{className:ne.resultItem,children:[g.jsx("span",{className:ne.resultNumber,children:v.failed}),g.jsx("span",{className:ne.resultLabel,children:"Failed"})]})]}),v.errors.length>0&&g.jsxs("div",{className:ne.errorList,children:[g.jsx("h4",{children:"Errors:"}),g.jsxs("ul",{children:[v.errors.slice(0,10).map(z=>g.jsx("li",{children:z},z)),v.errors.length>10&&g.jsxs("li",{children:["...and ",v.errors.length-10," more errors"]})]})]})]}),c==="completed"&&f.length>0&&g.jsxs("div",{className:ne.cleanupSection,children:[g.jsx("h3",{className:ne.migrationSubtitle,children:"Cleanup Old Fields"}),g.jsxs("p",{className:ne.description,children:["After verifying the migration was successful, you can optionally delete the old"," ",g.jsx("code",{className:ne.code,children:"comment_log"})," fields from your models."]}),g.jsxs("div",{className:ne.dangerBox,children:[g.jsx("div",{className:ne.dangerIcon,children:"⚠️"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Warning:"})," This action is irreversible. Only proceed if you have verified that all comments were migrated successfully."]})]}),E?g.jsxs("div",{className:ne.confirmDialog,children:[g.jsxs("p",{children:["Are you sure you want to delete ",f.length," comment_log field(s)?"]}),g.jsxs("div",{className:ne.confirmActions,children:[g.jsx(_i,{buttonType:"negative",onClick:q,disabled:S,children:S?g.jsxs(g.Fragment,{children:[g.jsx(Ch,{size:16})," Deleting..."]}):"Yes, Delete Fields"}),g.jsx(_i,{buttonType:"muted",onClick:()=>x(!1),disabled:S,children:"Cancel"})]})]}):g.jsx("div",{className:ne.migrationActions,children:g.jsx(_i,{buttonType:"negative",onClick:()=>x(!0),disabled:S,children:"Delete Old comment_log Fields"})})]}),c==="completed"&&f.length===0&&g.jsxs("div",{className:ne.successBox,children:[g.jsx("div",{className:ne.successIcon,children:"✓"}),g.jsxs("div",{children:[g.jsx("strong",{children:"Migration complete!"})," All comments have been migrated to the new system and old fields have been cleaned up."]})]})]});return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:ne.container,children:[g.jsxs("p",{className:ne.intro,children:["This plugin enables team collaboration through comments in two ways: a"," ",g.jsx("strong",{children:"sidebar panel"})," on every record for record-specific discussions, and a"," ",g.jsx("strong",{children:"project-wide Comments Dashboard"})," for general team conversations. Use rich mentions to reference users (@), fields (#), records (&), assets (^), and models ($) directly in your comments. The dashboard also shows your mentions and recent activity across the project."]}),g.jsxs("div",{className:ne.section,children:[g.jsx("h2",{className:ne.sectionTitle,children:"Configuration"}),g.jsx("p",{className:ne.description,children:"Configure how comments are synchronized across users. Real-time updates are recommended for the best collaborative experience."}),g.jsx("div",{className:ne.formField,children:g.jsx(ov,{id:"realtime-toggle",name:"realtime-toggle",label:"Enable Real-Time Updates (Recommended)",hint:"When enabled, comments update instantly across all users. Requires a Content Delivery API token.",value:o,onChange:z=>i(z)})}),o&&g.jsx("div",{className:ne.formField,children:g.jsx(F2,{id:"cda-token",name:"cda-token",label:"Content Delivery API Token",hint:"You can find this in Project Settings → API Tokens. Use a token with read access.",value:n,onChange:z=>r(z),textInputProps:{monospaced:!0}})}),g.jsx("div",{className:ne.formField,children:g.jsx(ov,{id:"dashboard-toggle",name:"dashboard-toggle",label:"Enable Comments Dashboard",hint:"When enabled, users can access the project-wide Comments Dashboard from the sidebar navigation. Disabling this hides the dashboard for all users.",value:s,onChange:z=>a(z)})}),g.jsx("div",{className:ne.buttonRow,children:g.jsx(_i,{buttonType:"primary",onClick:N,disabled:u||o&&!n,children:u?"Saving...":"Save Settings"})})]}),B()]})})};function bq({count:t,onClick:e,accentColor:n}){if(t===0)return null;const r=t===1?"comment":"comments";return g.jsxs("button",{type:"button",className:j.newCommentsIndicator,onClick:e,style:{"--accent-color":n},children:[g.jsx(zR,{"aria-label":"Scroll to new comments"}),t," new ",r]})}function _q({ctx:t,composerRef:e,canMentionAssets:n=!0}){const r=_.useCallback(async()=>{var o,i,s;if(n)try{const a=await t.selectUpload({multiple:!1});if(!a){(o=e.current)==null||o.focus();return}const u=a.attributes.mime_type??"application/octet-stream",l=a.attributes.url??"",c=Ag(u,l,a.attributes.mux_playback_id),d={type:"asset",id:a.id,filename:a.attributes.filename,url:l,thumbnailUrl:c,mimeType:u};(i=e.current)==null||i.insertMention(d)}catch(a){Te("Asset picker error",a),t.alert(Bt.ASSET_PICKER_FAILED),(s=e.current)==null||s.focus()}},[t,e,n]);return{handleAssetTrigger:r,handleAssetClick:r}}function Sq({ctx:t,client:e,composerRef:n}){const[r,o]=_.useState(!1),i=_.useRef(0),s=_.useCallback(()=>{o(!0)},[]),a=_.useCallback(async l=>{var d,f,p;o(!1),i.current+=1;const c=i.current;try{const h=await t.selectItem(l.id,{multiple:!1});if(c!==i.current)return;if(!h){(d=n.current)==null||d.focus();return}const m=t.itemTypes[l.id],v=m?await t.loadItemTypeFields(l.id):[],y=t.site.attributes.locales[0],w=OT(m),b=await Lg({id:h.id,attributes:h.attributes},{id:l.id,apiKey:l.apiKey,name:l.name,isBlockModel:l.isBlockModel},m,v,y,e,w);if(c!==i.current)return;(f=n.current)==null||f.insertMention(b)}catch(h){c===i.current&&(Te("Record picker error",h),t.alert(Bt.RECORD_PICKER_FAILED),(p=n.current)==null||p.focus())}},[t,e,n]),u=_.useCallback(()=>{var l;o(!1),(l=n.current)==null||l.focus()},[n]);return{isRecordModelSelectorOpen:r,setIsRecordModelSelectorOpen:o,handleRecordTrigger:s,handleRecordModelSelect:a,handleRecordModelSelectorClose:u}}function kq({containerRef:t,itemsCount:e,bottomThreshold:n=50}){const[r,o]=_.useState(!0),[i,s]=_.useState(0),a=_.useRef(!1),u=_.useRef(e),l=_.useRef(n);l.current=n;const c=_.useCallback(()=>{const f=t.current;if(!f)return;const{scrollTop:p,scrollHeight:h,clientHeight:m}=f,v=h-p-m<n;o(v),v&&s(0)},[t,n]),d=_.useCallback(()=>{const f=t.current;f&&f.scrollTo({top:f.scrollHeight,behavior:"smooth"}),s(0)},[t]);return _.useEffect(()=>{const f=e-u.current,p=t.current;f>0&&(r&&p?(a.current=!0,p.scrollTop=p.scrollHeight):r||s(h=>h+f)),u.current=e},[e,r,t]),_.useEffect(()=>{const f=t.current;if(!f)return;let p=!0;const h=new ResizeObserver(()=>{const v=t.current;if(!(!p||!v||!v.isConnected)&&a.current){const{scrollTop:y,scrollHeight:w,clientHeight:b}=v;w-y-b<l.current?v.scrollTop=w:a.current=!1}}),m=f.firstElementChild;return m&&h.observe(m),h.observe(f),()=>{p=!1,h.disconnect()}},[t]),{isAtBottom:r,newItemsCount:i,handleScroll:c,handleNewItemsClick:d}}function xq({items:t,pageSize:e=Pu,containerRef:n}){const[r,o]=_.useState(null),i=_.useRef(null);_.useEffect(()=>{r===null&&t.length>0&&o(Math.max(0,t.length-e))},[t.length,r,e]);const s=_.useMemo(()=>{const l=r??Math.max(0,t.length-e);return t.slice(l)},[t,r,e]),a=(r??0)>0,u=_.useCallback(()=>{const l=n.current;l&&(i.current=l.scrollHeight),o(c=>Math.max(0,(c??0)-e))},[n,e]);return _.useLayoutEffect(()=>{if(i.current===null)return;const l=n.current;if(!l)return;const d=l.scrollHeight-i.current;l.scrollTop+=d,i.current=null},[s,n]),{paginatedItems:s,hasMore:a,handleLoadEarlier:u}}const Eq=({ctx:t,client:e,userName:n,readableModels:r,accentColor:o,comments:i,filteredComments:s,setComments:a,commentsModelId:u,commentRecordId:l,setCommentRecordId:c,isLoading:d,error:f,status:p,isFiltering:h,onSyncAllowedChange:m})=>{const{projectUsers:v,projectModels:y,currentUserEmail:w,typedUsers:b}=Dy(),{canMentionAssets:S,canMentionModels:k}=y9(),[E,x]=_.useState([]),T=_.useRef(null),O=_.useRef(new Set),N=_.useRef(null),$=RT({client:e,commentRecordId:l,commentsModelId:u,modelId:jy,recordId:ak,ctx:t,onRecordCreated:c});_.useEffect(()=>{m($.isSyncAllowed)},[$.isSyncAllowed,m]);const{submitNewComment:P,deleteComment:D,editComment:q,upvoteComment:B,replyComment:z}=$T({userEmail:w,userName:n,setComments:a,enqueue:$.enqueue,composerSegments:E,setComposerSegments:x,pendingNewReplies:O,insertPosition:"append"}),{handleUserToolbarClick:K,handleFieldToolbarClick:I,handleModelToolbarClick:L}=LT({composerRef:T,canMentionModels:k}),{handleAssetTrigger:F,handleAssetClick:Z}=_q({ctx:t,composerRef:T,canMentionAssets:S}),{isRecordModelSelectorOpen:ie,handleRecordTrigger:ke,handleRecordModelSelect:fe,handleRecordModelSelectorClose:Ne}=Sq({ctx:t,client:e,composerRef:T}),pe=_.useRef(null),[Ae,Ue]=_.useState(!1),[pt,Ve]=_.useState(!1),Mn=_.useCallback(async(ae,we)=>{var Ce,qe,ut;if(!pt)if(pe.current=we.current,ae==="asset"){if(!S)return;Ve(!0);try{const bt=await t.selectUpload({multiple:!1});if(!bt){(Ce=pe.current)==null||Ce.focus();return}const zn=Mm(bt);(qe=pe.current)==null||qe.insertMention(zn)}catch(bt){Te("Reply asset picker error:",bt),t.alert(Bt.ASSET_PICKER_FAILED),(ut=pe.current)==null||ut.focus()}finally{Ve(!1)}}else ae==="record"&&Ue(!0)},[t,S,pt]),_o=_.useCallback(async ae=>{var we,Ce,qe;if(Ue(!1),!!pe.current){Ve(!0);try{const ut=await t.selectItem(ae.id,{multiple:!1});if(!ut){(we=pe.current)==null||we.focus();return}const bt=t.itemTypes[ae.id],zn=bt?await t.loadItemTypeFields(ae.id):[],Ee=t.site.attributes.locales[0],As=OT(bt),af=await Lg({id:ut.id,attributes:ut.attributes},{id:ae.id,apiKey:ae.apiKey,name:ae.name,isBlockModel:ae.isBlockModel},bt,zn,Ee,e,As);(Ce=pe.current)==null||Ce.insertMention(af)}catch(ut){Te("Reply record picker error:",ut),t.alert(Bt.RECORD_PICKER_FAILED),(qe=pe.current)==null||qe.focus()}finally{Ve(!1)}}},[t,e]),se=_.useCallback(()=>{var ae;Ue(!1),(ae=pe.current)==null||ae.focus()},[]),Nr=_.useMemo(()=>[...s].sort((ae,we)=>ae.dateISO.localeCompare(we.dateISO)),[s]),{newItemsCount:So,handleScroll:Ar,handleNewItemsClick:$n}=kq({containerRef:N,itemsCount:i.length}),{paginatedItems:ge,hasMore:lt,handleLoadEarlier:G}=xq({items:Nr,containerRef:N}),le=_.useMemo(()=>Ig(E),[E]);if(p===gd.CONNECTING||d)return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),g.jsx("div",{className:j.commentsListEmpty,role:"status","aria-live":"polite","aria-label":"Loading comments",children:g.jsx("div",{className:j.loadingSpinner})})]});if(f){const ae=Dg(f);return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),g.jsxs("div",{className:j.error,role:"alert",children:[g.jsx("p",{children:"Error loading comments"}),g.jsx("span",{children:ae.message})]})]})}const Y=i.length>0,te=ge.length>0,ye=Y&&Nr.length===0&&h;return g.jsxs("div",{className:j.channelContainer,children:[g.jsx("div",{className:j.channelHeaderMinimal,children:g.jsx("span",{className:j.channelTitleMinimal,children:"Project Comments"})}),te?g.jsxs("div",{ref:N,className:j.commentsList,onScroll:Ar,children:[lt&&g.jsx("div",{style:{padding:"12px 24px",textAlign:"center"},children:g.jsx("button",{type:"button",className:j.loadEarlierButton,onClick:G,children:"Load earlier messages"})}),ge.map(ae=>g.jsx("div",{style:{padding:"0 24px"},children:g.jsx(hd,{children:g.jsx(vT,{deleteComment:D,editComment:q,upvoteComment:B,replyComment:z,commentObject:ae,currentUserEmail:w,modelFields:[],projectUsers:v,projectModels:y,canMentionFields:!1,onPickerRequest:Mn,canMentionAssets:S,canMentionModels:k,isPickerActive:pt,typedUsers:b})})},ae.id))]}):ye?g.jsxs("div",{className:j.noResults,children:[g.jsx(FR,{className:j.noResultsIcon}),g.jsx("h3",{className:j.noResultsTitle,children:"No comments match your filters"}),g.jsx("p",{className:j.noResultsDescription,children:"Try adjusting your search or filter criteria."})]}):g.jsxs("div",{className:j.commentsListEmpty,children:[g.jsx($R,{className:j.emptyIcon}),g.jsx("h3",{className:j.emptyTitle,children:"Start the conversation"}),g.jsx("p",{className:j.emptyDescription,children:"Be the first to share an update or ask a question about this project."})]}),g.jsx(bq,{count:So,onClick:$n,accentColor:o}),g.jsx("div",{className:j.composer,children:g.jsx(hd,{fallbackMessage:"Unable to load editor. Please refresh the page.",children:g.jsxs(uk,{accentColor:o,children:[g.jsx(rf,{ref:T,segments:E,onSegmentsChange:x,onSubmit:P,placeholder:`Add a message...
|
|
251
251
|
@ user, & record, ^ asset, $ model`,projectUsers:v,modelFields:[],projectModels:y,canMentionAssets:S,canMentionModels:k,canMentionFields:!1,onAssetTrigger:F,onRecordTrigger:ke,autoFocus:!1,large:!0,dropdownPosition:"above"}),ie&&g.jsx(Ah,{models:r,onSelect:fe,onClose:Ne,position:"above"}),Ae&&g.jsx(Ah,{models:r,onSelect:_o,onClose:se,position:"above"}),g.jsx(Ay,{onUserClick:K,onFieldClick:I,onRecordClick:ke,onAssetClick:Z,onModelClick:L,onSendClick:P,isSendDisabled:le||$.pendingCount>0,canMentionAssets:S,canMentionModels:k,canMentionFields:!1,large:!0,accentColor:o})]})})})]})};function Tq(t,e=80){const n=[];for(const o of t.content)if(o.type==="text")n.push(o.content);else if(o.type==="mention")switch(o.mention.type){case"user":n.push(`@${o.mention.name}`);break;case"field":n.push(`#${o.mention.apiKey}`);break;case"record":n.push(o.mention.title);break;case"asset":n.push(o.mention.filename);break;case"model":n.push(`$${o.mention.name}`);break}const r=n.join("").trim();return r.length<=e?r:`${r.slice(0,e)}…`}const Cq=({commentWithContext:t,onClick:e,showMentionBadge:n=!1})=>{const{comment:r,isGlobal:o,isReply:i}=t,s=yr(r.author.email,64),a=Tq(r);return g.jsxs("button",{type:"button",className:j.commentPreview,onClick:e,children:[g.jsx("img",{src:s,alt:r.author.name,className:j.previewAvatar,onError:u=>{const l=u.currentTarget;l.onerror=null,l.src=yr(r.author.email,64)}}),g.jsxs("div",{className:j.previewContent,children:[g.jsxs("div",{className:j.previewHeader,children:[g.jsx("span",{className:j.previewAuthor,children:r.author.name}),g.jsx("span",{className:j.previewTime,children:g.jsx(ol,{date:new Date(r.dateISO)})}),n&&g.jsx("span",{className:j.previewMentionBadge,children:g.jsx(UR,{"aria-label":"Mentioned you"})})]}),g.jsx("div",{className:j.previewText,children:a}),!o&&g.jsx("div",{className:j.previewContext,children:g.jsxs("span",{className:j.previewContextText,children:[i?"Reply in ":"In ",t.isSingleton?t.recordTitle??`Record #${t.recordId}`:`${t.modelName??"Record"} "${t.recordTitle??t.recordId}"`]})}),o&&g.jsxs("div",{className:j.previewContext,children:[g.jsx(VR,{className:j.previewContextIcon,"aria-label":"Project discussion"}),g.jsx("span",{className:j.previewContextText,children:i?"Reply in project discussion":"Project discussion"})]})]})]})},Mq=_.memo(Cq,(t,e)=>!(t.commentWithContext.comment.id!==e.commentWithContext.comment.id||t.showMentionBadge!==e.showMentionBadge||t.onClick!==e.onClick)),KT=({title:t,emptyMessage:e,items:n,isLoading:r,onNavigateToRecord:o,onScrollToGlobalComment:i})=>{const s=a=>{a.isGlobal&&i?i(a.comment.id):o(a.modelId,a.recordId)};return g.jsxs("div",{className:j.sidebarSection,children:[g.jsx("div",{className:j.sectionHeader,children:g.jsx("h3",{className:j.sectionTitle,children:t})}),g.jsx("div",{className:j.sectionContent,children:r?g.jsx("div",{className:j.loading,children:g.jsx("div",{className:j.loadingSpinner})}):n.length===0?g.jsx("div",{className:j.emptySmall,children:e}):n.map(a=>g.jsx(Mq,{commentWithContext:a,onClick:()=>s(a)},`${a.recordId}-${a.comment.id}`))})]})},Oq=({mentions:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r})=>g.jsx(KT,{title:"My Mentions",emptyMessage:"No mentions yet. When someone mentions you with @, it will appear here.",items:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r}),Nq=({comments:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r})=>g.jsx(KT,{title:"Recent Comments",emptyMessage:"No comments yet. Start a discussion to see recent activity.",items:t,isLoading:e,onNavigateToRecord:n,onScrollToGlobalComment:r});function Aq(t){return _.useMemo(()=>({authorOptions:t.authors.map(e=>({value:e.email,label:e.name})),recordOptions:t.mentionedRecords.map(e=>({value:e.id,label:e.title,sublabel:e.modelName})),assetOptions:t.mentionedAssets.map(e=>({value:e.id,label:e.filename})),modelOptions:t.mentionedModels.map(e=>({value:e.id,label:e.name})),userOptions:t.mentionedUsers.map(e=>({value:e.email,label:e.name}))}),[t])}const Js=({label:t,options:e,selectedValue:n,onSelect:r,placeholder:o="All",searchable:i=!0,disabled:s=!1,emptyMessage:a="No options available"})=>{const[u,l]=_.useState(!1),[c,d]=_.useState(""),[f,p]=_.useState(-1),h=_.useRef(null),m=_.useRef(null),v=_.useRef([]),y=_.useId();_.useEffect(()=>{const O=N=>{h.current&&!h.current.contains(N.target)&&(l(!1),d(""))};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]),_.useEffect(()=>{u&&(p(-1),i&&m.current&&m.current.focus())},[u,i]),_.useEffect(()=>{p(-1)},[c]),_.useEffect(()=>{var O;f>=0&&v.current[f]&&((O=v.current[f])==null||O.scrollIntoView({block:"nearest",behavior:"smooth"}))},[f]);const w=_.useMemo(()=>c?e.filter(O=>{var N;return O.label.toLowerCase().includes(c.toLowerCase())||((N=O.sublabel)==null?void 0:N.toLowerCase().includes(c.toLowerCase()))}):e,[c,e]),b=e.find(O=>O.value===n),S=()=>{s||(l(!u),u||d(""))},k=O=>{r(O),l(!1),d("")},E=e.length>0,x=E?1+w.length:0,T=O=>{if(u)switch(O.key){case"Escape":O.preventDefault(),l(!1),d("");break;case"ArrowDown":O.preventDefault(),x>0&&p(N=>N<x-1?N+1:N);break;case"ArrowUp":O.preventDefault(),p(N=>N>0?N-1:N);break;case"Enter":if(O.preventDefault(),f>=0&&E)if(f===0)k(null);else{const N=w[f-1];N&&k(N.value)}break;case"Tab":l(!1),d("");break}};return g.jsxs("div",{className:ot(j.filterDropdown,s&&j.filterDropdownDisabled),ref:h,onKeyDown:T,children:[g.jsxs("button",{type:"button",className:ot(j.filterDropdownTrigger,n&&j.filterDropdownActive),onClick:S,disabled:s,"aria-expanded":u,"aria-haspopup":"listbox","aria-controls":u?y:void 0,children:[g.jsx("span",{className:j.filterDropdownLabel,children:t}),b&&g.jsx("span",{className:j.filterDropdownValue,children:b.label}),g.jsxs("svg",{className:j.filterDropdownChevron,viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Toggle dropdown"}),g.jsx("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"})]})]}),u&&g.jsxs("div",{id:y,className:j.filterDropdownMenu,role:"listbox","aria-label":`${t} options`,children:[i&&e.length>5&&g.jsx("div",{className:j.filterDropdownSearch,children:g.jsx("input",{ref:m,type:"text",placeholder:"Search...",value:c,onChange:O=>d(O.target.value),className:j.filterDropdownSearchInput,"aria-label":`Search ${t} options`})}),g.jsx("div",{className:j.filterDropdownOptions,children:E?g.jsxs(g.Fragment,{children:[g.jsx("button",{ref:O=>{v.current[0]=O},type:"button",className:ot(j.filterDropdownOption,n===null&&j.filterDropdownOptionSelected,f===0&&j.filterDropdownOptionHighlighted),onClick:()=>k(null),onMouseEnter:()=>p(0),role:"option","aria-selected":n===null,children:g.jsx("span",{className:j.filterDropdownOptionLabel,children:o})}),w.map((O,N)=>{const $=N+1;return g.jsxs("button",{ref:P=>{v.current[$]=P},type:"button",className:ot(j.filterDropdownOption,n===O.value&&j.filterDropdownOptionSelected,f===$&&j.filterDropdownOptionHighlighted),onClick:()=>k(O.value),onMouseEnter:()=>p($),role:"option","aria-selected":n===O.value,children:[g.jsx("span",{className:j.filterDropdownOptionLabel,children:O.label}),O.sublabel&&g.jsx("span",{className:j.filterDropdownOptionSublabel,children:O.sublabel})]},O.value)}),w.length===0&&c&&g.jsx("div",{className:j.filterDropdownEmpty,children:"No matches found"})]}):g.jsx("div",{className:j.filterDropdownEmpty,children:a})})]})]})},Iq=({filters:t,filterOptions:e,onFiltersChange:n,onClearAll:r,onApply:o,isFiltering:i,hasUnappliedChanges:s,accentColor:a})=>{var h,m,v,y;const{authorOptions:u,recordOptions:l,assetOptions:c,modelOptions:d,userOptions:f}=Aq(e),p=(w,b)=>{n({...t,[w]:b})};return g.jsxs("div",{className:j.filterSidebar,children:[g.jsx("div",{className:j.filterSidebarHeader,children:g.jsx("h3",{className:j.filterSidebarTitle,children:"Filters"})}),g.jsxs("div",{className:j.filterSidebarContent,children:[g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Search"}),g.jsxs("div",{className:j.searchInputWrapperVertical,children:[g.jsxs("svg",{className:j.searchIcon,viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Search"}),g.jsx("path",{d:"M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"})]}),g.jsx("input",{type:"text",className:j.searchInputVertical,placeholder:"Search...",value:t.searchQuery,onChange:w=>p("searchQuery",w.target.value)}),t.searchQuery&&g.jsx("button",{type:"button",className:j.searchClear,onClick:()=>p("searchQuery",""),"aria-label":"Clear search",children:g.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Clear"}),g.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})]})})]})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Date Range"}),g.jsxs("div",{className:j.dateRangeVertical,children:[g.jsxs("div",{className:j.dateInputVerticalWrapper,children:[g.jsx("span",{className:j.dateInputVerticalLabel,children:"From"}),g.jsx("input",{type:"date",className:j.dateInputVertical,value:((h=t.dateRange.start)==null?void 0:h.toISOString().split("T")[0])??"",onChange:w=>{const b=w.target.value?new Date(w.target.value):null;p("dateRange",{...t.dateRange,start:b})},max:(m=t.dateRange.end)==null?void 0:m.toISOString().split("T")[0]})]}),g.jsxs("div",{className:j.dateInputVerticalWrapper,children:[g.jsx("span",{className:j.dateInputVerticalLabel,children:"To"}),g.jsx("input",{type:"date",className:j.dateInputVertical,value:((v=t.dateRange.end)==null?void 0:v.toISOString().split("T")[0])??"",onChange:w=>{const b=w.target.value?new Date(w.target.value):null;p("dateRange",{...t.dateRange,end:b})},min:(y=t.dateRange.start)==null?void 0:y.toISOString().split("T")[0]})]})]})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Author"}),g.jsx(Js,{label:"",options:u,selectedValue:t.authorEmail,onSelect:w=>p("authorEmail",w),placeholder:"All authors",emptyMessage:"No comments yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Mentioned Record"}),g.jsx(Js,{label:"",options:l,selectedValue:t.mentionedRecordId,onSelect:w=>p("mentionedRecordId",w),placeholder:"All records",emptyMessage:"No record mentions yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Mentioned Asset"}),g.jsx(Js,{label:"",options:c,selectedValue:t.mentionedAssetId,onSelect:w=>p("mentionedAssetId",w),placeholder:"All assets",emptyMessage:"No asset mentions yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"Mentioned Model"}),g.jsx(Js,{label:"",options:d,selectedValue:t.mentionedModelId,onSelect:w=>p("mentionedModelId",w),placeholder:"All models",emptyMessage:"No model mentions yet"})]}),g.jsxs("div",{className:j.filterSection,children:[g.jsx("label",{className:j.filterSectionLabel,children:"@Mentioned User"}),g.jsx(Js,{label:"",options:f,selectedValue:t.mentionedUserEmail,onSelect:w=>p("mentionedUserEmail",w),placeholder:"All users",emptyMessage:"No user mentions yet"})]})]}),g.jsxs("div",{className:j.filterSidebarFooter,children:[g.jsx("button",{type:"button",className:j.clearFiltersButton,onClick:r,disabled:!i&&!s,children:"Clear Filters"}),g.jsx("button",{type:"button",className:j.applyFiltersButton,onClick:o,disabled:!s,style:{"--accent-color":a},children:"Apply Filters"})]})]})},rb=3,Pq=500,Rq=8e3;async function Dq(t){let e=null;for(let n=0;n<=rb;n++)try{return await t()}catch(r){if(e=r instanceof Error?r:new Error(String(r)),n===rb)break;const o=PT(n,Pq,Rq,!0);await IT(o)}throw e??new Error("Fetch failed")}function jq(t,e){return t.type!=="mention"||t.mention.type!=="user"?!1:t.mention.email===e}function Lq(t,e){return t.some(n=>jq(n,e))}function Bq(t,e){return t.filter(n=>Lq(n.comment.content,e)).sort((n,r)=>new Date(r.comment.dateISO).getTime()-new Date(n.comment.dateISO).getTime())}function Fq(t,e){return t.filter(n=>!n.isGlobal).sort((n,r)=>new Date(r.comment.dateISO).getTime()-new Date(n.comment.dateISO).getTime()).slice(0,e)}function $q({client:t,mainLocale:e="en"}){const[n,r]=_.useState([]),[o,i]=_.useState(!0),[s,a]=_.useState(null),u=_.useRef(e);u.current=e;const l=_.useCallback(async()=>{if(!t){i(!1);return}try{const c=await Dq(()=>t.items.list({filter:{type:io},page:{limit:100}})),d=[],f=[];for(const p of c){const h=p.model_id,m=p.record_id;if(typeof h!="string"||typeof m!="string")continue;const v=h,y=m,w=gl(p.content),b=v===jy;b||f.push({recordId:y,modelId:v});for(const S of w)if(d.push({comment:S,modelId:v,recordId:y,commentRecordId:p.id,isGlobal:b,isReply:!1}),S.replies)for(const k of S.replies)d.push({comment:k,modelId:v,recordId:y,commentRecordId:p.id,isGlobal:b,isReply:!0,parentCommentId:S.id})}if(f.length>0){const p=await S9(t,f,u.current);for(const h of d)if(!h.isGlobal){const m=p.get(h.recordId);m&&(h.recordTitle=m.title,h.modelName=m.modelName,h.isSingleton=m.isSingleton)}}r(d),a(null)}catch(c){a(c instanceof Error?c:new Error(String(c)))}finally{i(!1)}},[t]);return _.useEffect(()=>{l()},[l]),_.useEffect(()=>{if(!t)return;const c=setInterval(l,Iu.POLLING_INTERVAL_MS);return()=>clearInterval(c)},[t,l]),{allComments:n,isLoading:o,error:s,refetch:l}}const yu={searchQuery:"",authorEmail:null,dateRange:{start:null,end:null},mentionedRecordId:null,mentionedAssetId:null,mentionedModelId:null,mentionedUserEmail:null};function zq(t){const e=[],n=[],r=[],o=[],i=[];for(const s of t)if(s.type==="text")i.push(s.content);else if(s.type==="mention")switch(s.mention.type){case"user":e.push(s.mention),i.push(s.mention.name);break;case"asset":n.push(s.mention),i.push(s.mention.filename);break;case"record":r.push(s.mention),i.push(s.mention.title);break;case"model":o.push(s.mention),i.push(s.mention.name);break;case"field":i.push(s.mention.label);break}return{userMentions:e,assetMentions:n,recordMentions:r,modelMentions:o,textParts:i}}function Uq(t,e){const n=new Set,r=new Set,o=new Set,i=new Set,s=new Set,a=[],{authorsMap:u,recordsMap:l,assetsMap:c,modelsMap:d,usersMap:f}=e;function p(h){s.add(h.author.email),a.push(h.author.name),u.has(h.author.email)||u.set(h.author.email,{email:h.author.email,name:h.author.name});const m=zq(h.content);for(const v of m.userMentions)n.add(v.email),f.has(v.email)||f.set(v.email,{email:v.email,name:v.name});for(const v of m.assetMentions)r.add(v.id),c.has(v.id)||c.set(v.id,{id:v.id,filename:v.filename});for(const v of m.recordMentions)o.add(v.id),l.has(v.id)||l.set(v.id,{id:v.id,title:v.title,modelName:v.modelName});for(const v of m.modelMentions)i.add(v.id),d.has(v.id)||d.set(v.id,{id:v.id,name:v.name});if(a.push(...m.textParts),h.replies)for(const v of h.replies)p(v)}return p(t),{comment:t,dateTimestamp:new Date(t.dateISO).getTime(),searchText:a.join(" ").toLowerCase(),userEmails:n,assetIds:r,recordIds:o,modelIds:i,authorEmails:s}}function Vq(t){const e={authorsMap:new Map,recordsMap:new Map,assetsMap:new Map,modelsMap:new Map,usersMap:new Map},n=[];for(const a of t){const u=Uq(a,e);n.push(u)}const r=(a,u)=>a.name.localeCompare(u.name),o=(a,u)=>a.filename.localeCompare(u.filename),i=(a,u)=>a.title.localeCompare(u.title),s={authors:[...e.authorsMap.values()].sort(r),mentionedRecords:[...e.recordsMap.values()].sort(i),mentionedAssets:[...e.assetsMap.values()].sort(o),mentionedModels:[...e.modelsMap.values()].sort(r),mentionedUsers:[...e.usersMap.values()].sort(r)};return{indexedComments:n,filterOptions:s}}function qq(t,e){var a;const n=e.searchQuery.toLowerCase().trim(),r=e.dateRange.start||e.dateRange.end,o=((a=e.dateRange.start)==null?void 0:a.getTime())??0,i=e.dateRange.end?new Date(e.dateRange.end).setHours(23,59,59,999):Number.MAX_SAFE_INTEGER,s=[];for(const u of t)r&&(u.dateTimestamp<o||u.dateTimestamp>i)||e.authorEmail&&!u.authorEmails.has(e.authorEmail)||e.mentionedUserEmail&&!u.userEmails.has(e.mentionedUserEmail)||e.mentionedAssetId&&!u.assetIds.has(e.mentionedAssetId)||e.mentionedRecordId&&!u.recordIds.has(e.mentionedRecordId)||e.mentionedModelId&&!u.modelIds.has(e.mentionedModelId)||n&&!u.searchText.includes(n)||s.push(u.comment);return s}function Hq(t){return t.searchQuery.trim()!==""||t.authorEmail!==null||t.dateRange.start!==null||t.dateRange.end!==null||t.mentionedRecordId!==null||t.mentionedAssetId!==null||t.mentionedModelId!==null||t.mentionedUserEmail!==null}function Wq(t,e){var n,r,o,i;return t.searchQuery===e.searchQuery&&t.authorEmail===e.authorEmail&&((n=t.dateRange.start)==null?void 0:n.getTime())===((r=e.dateRange.start)==null?void 0:r.getTime())&&((o=t.dateRange.end)==null?void 0:o.getTime())===((i=e.dateRange.end)==null?void 0:i.getTime())&&t.mentionedRecordId===e.mentionedRecordId&&t.mentionedAssetId===e.mentionedAssetId&&t.mentionedModelId===e.mentionedModelId&&t.mentionedUserEmail===e.mentionedUserEmail}function Kq(t){const[e,n]=_.useState(yu),[r,o]=_.useState(yu),{indexedComments:i,filterOptions:s}=_.useMemo(()=>Vq(t),[t]),a=_.useMemo(()=>qq(i,r),[i,r]),u=_.useMemo(()=>Hq(r),[r]),l=_.useMemo(()=>!Wq(e,r),[e,r]),c=_.useCallback(()=>{o(e)},[e]),d=_.useCallback(()=>{n(yu),o(yu)},[]),f=_.useCallback((p,h)=>{n(m=>({...m,[p]:h}))},[]);return{filters:e,setFilters:n,updateFilter:f,filterOptions:s,filteredComments:a,isFiltering:u,hasUnappliedChanges:l,applyFilters:c,clearFilters:d}}const Gq=({ctx:t})=>{const e=sf(t.plugin.attributes.parameters),n=e.cdaToken,r=T9(e),{email:o,name:i}=DT(t.currentUser),s=_.useMemo(()=>t.currentUserAccessToken?Sd({apiToken:t.currentUserAccessToken}):null,[t.currentUserAccessToken]),{projectUsers:a,projectModels:u,typedUsers:l}=jT(t),{canMentionAssets:c,canMentionModels:d,readableModels:f}=zT(t,u),p=t.site.attributes.locales[0],[h,m]=_.useState(!0),{comments:v,setComments:y,isLoading:w,error:b,status:S,fullResult:{commentsModelId:k,commentRecordId:E,setCommentRecordId:x}}=BT({context:"global",ctx:t,realTimeEnabled:r,cdaToken:n,client:s,isSyncAllowed:h}),{filters:T,setFilters:O,filterOptions:N,filteredComments:$,isFiltering:P,hasUnappliedChanges:D,applyFilters:q,clearFilters:B}=Kq(v),{allComments:z,isLoading:K}=$q({client:s,mainLocale:p}),I=_.useMemo(()=>Bq(z,o),[z,o]),L=_.useMemo(()=>Fq(z,20),[z]),F=_.useCallback((Ue,pt)=>{const Ve=`/editor/item_types/${Ue}/items/${pt}/edit`;t.navigateTo(Ve)},[t]),Z=_.useCallback(Ue=>{const pt=document.querySelector(`[data-comment-id="${Ue}"]`);pt&&(pt.scrollIntoView({behavior:"smooth",block:"center"}),pt.classList.add("highlight"),setTimeout(()=>pt.classList.remove("highlight"),2e3))},[]),ie=v.length>0,ke=t.theme.accentColor,[fe,Ne]=_.useState(!0),pe=[T.searchQuery.trim(),T.authorEmail,T.dateRange.start,T.dateRange.end,T.mentionedRecordId,T.mentionedAssetId,T.mentionedModelId,T.mentionedUserEmail].filter(Boolean).length,Ae=ie&&!fe;return g.jsx(ma,{ctx:t,children:g.jsxs("div",{className:j.dashboardContainer,children:[g.jsx("div",{className:j.mainChannel,children:g.jsx(sk,{projectUsers:a,projectModels:u,modelFields:[],currentUserEmail:o,typedUsers:l,children:g.jsx(VT,{canMentionFields:!1,canMentionAssets:c,canMentionModels:d,children:g.jsx(Eq,{ctx:t,client:s,userName:i,readableModels:f,accentColor:ke,comments:v,filteredComments:$,setComments:y,commentsModelId:k,commentRecordId:E,setCommentRecordId:x,isLoading:w,error:b,status:S,isFiltering:P,onSyncAllowedChange:m})})})}),g.jsxs("div",{className:j.sidebar,children:[Ae&&g.jsx("div",{className:j.filterColumn,children:g.jsx(Iq,{filters:T,filterOptions:N,onFiltersChange:O,onClearAll:B,onApply:q,isFiltering:P,hasUnappliedChanges:D,accentColor:ke})}),ie&&g.jsxs("button",{type:"button",className:`${j.filterToggleFab}${P?` ${j.filterToggleFabActive}`:""}${fe?"":` ${j.filterToggleFabExpanded}`}`,onClick:()=>Ne(!fe),style:{"--accent-color":ke},title:fe?"Show filters":"Hide filters",children:[g.jsxs("svg",{className:j.filterToggleFabIcon,viewBox:"0 0 16 16",fill:"currentColor",children:[g.jsx("title",{children:"Filters"}),g.jsx("path",{d:"M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2z"})]}),pe>0&&g.jsx("span",{className:j.filterToggleFabBadge,style:{backgroundColor:ke},children:pe})]}),g.jsxs("div",{className:j.sidebarInner,children:[g.jsx(Oq,{mentions:I,isLoading:K,onNavigateToRecord:F,onScrollToGlobalComment:Z}),g.jsx(Nq,{comments:L,isLoading:K,onNavigateToRecord:F,onScrollToGlobalComment:Z})]})]})]})})},Jq={locale:"en",long:{year:{previous:"last year",current:"this year",next:"next year",past:{one:"{0} year ago",other:"{0} years ago"},future:{one:"in {0} year",other:"in {0} years"}},quarter:{previous:"last quarter",current:"this quarter",next:"next quarter",past:{one:"{0} quarter ago",other:"{0} quarters ago"},future:{one:"in {0} quarter",other:"in {0} quarters"}},month:{previous:"last month",current:"this month",next:"next month",past:{one:"{0} month ago",other:"{0} months ago"},future:{one:"in {0} month",other:"in {0} months"}},week:{previous:"last week",current:"this week",next:"next week",past:{one:"{0} week ago",other:"{0} weeks ago"},future:{one:"in {0} week",other:"in {0} weeks"}},day:{previous:"yesterday",current:"today",next:"tomorrow",past:{one:"{0} day ago",other:"{0} days ago"},future:{one:"in {0} day",other:"in {0} days"}},hour:{current:"this hour",past:{one:"{0} hour ago",other:"{0} hours ago"},future:{one:"in {0} hour",other:"in {0} hours"}},minute:{current:"this minute",past:{one:"{0} minute ago",other:"{0} minutes ago"},future:{one:"in {0} minute",other:"in {0} minutes"}},second:{current:"now",past:{one:"{0} second ago",other:"{0} seconds ago"},future:{one:"in {0} second",other:"in {0} seconds"}}},short:{year:{previous:"last yr.",current:"this yr.",next:"next yr.",past:"{0} yr. ago",future:"in {0} yr."},quarter:{previous:"last qtr.",current:"this qtr.",next:"next qtr.",past:{one:"{0} qtr. ago",other:"{0} qtrs. ago"},future:{one:"in {0} qtr.",other:"in {0} qtrs."}},month:{previous:"last mo.",current:"this mo.",next:"next mo.",past:"{0} mo. ago",future:"in {0} mo."},week:{previous:"last wk.",current:"this wk.",next:"next wk.",past:"{0} wk. ago",future:"in {0} wk."},day:{previous:"yesterday",current:"today",next:"tomorrow",past:{one:"{0} day ago",other:"{0} days ago"},future:{one:"in {0} day",other:"in {0} days"}},hour:{current:"this hour",past:"{0} hr. ago",future:"in {0} hr."},minute:{current:"this minute",past:"{0} min. ago",future:"in {0} min."},second:{current:"now",past:"{0} sec. ago",future:"in {0} sec."}},narrow:{year:{previous:"last yr.",current:"this yr.",next:"next yr.",past:"{0}y ago",future:"in {0}y"},quarter:{previous:"last qtr.",current:"this qtr.",next:"next qtr.",past:"{0}q ago",future:"in {0}q"},month:{previous:"last mo.",current:"this mo.",next:"next mo.",past:"{0}mo ago",future:"in {0}mo"},week:{previous:"last wk.",current:"this wk.",next:"next wk.",past:"{0}w ago",future:"in {0}w"},day:{previous:"yesterday",current:"today",next:"tomorrow",past:"{0}d ago",future:"in {0}d"},hour:{current:"this hour",past:"{0}h ago",future:"in {0}h"},minute:{current:"this minute",past:"{0}m ago",future:"in {0}m"},second:{current:"now",past:"{0}s ago",future:"in {0}s"}},now:{now:{current:"now",future:"in a moment",past:"just now"}},mini:{year:"{0}yr",month:"{0}mo",week:"{0}wk",day:"{0}d",hour:"{0}h",minute:"{0}m",second:"{0}s",now:"now"},"short-time":{year:"{0} yr.",month:"{0} mo.",week:"{0} wk.",day:{one:"{0} day",other:"{0} days"},hour:"{0} hr.",minute:"{0} min.",second:"{0} sec."},"long-time":{year:{one:"{0} year",other:"{0} years"},month:{one:"{0} month",other:"{0} months"},week:{one:"{0} week",other:"{0} weeks"},day:{one:"{0} day",other:"{0} days"},hour:{one:"{0} hour",other:"{0} hours"},minute:{one:"{0} minute",other:"{0} minutes"},second:{one:"{0} second",other:"{0} seconds"}}};Sn.addDefaultLocale(Jq);async function Yq(t){if(!t.currentUserAccessToken)return;const e=Sd({apiToken:t.currentUserAccessToken});if((await e.itemTypes.list()).find(i=>i.api_key===io))return;const o=await e.itemTypes.create({name:"Project Comment",api_key:io,draft_mode_active:!1});await e.fields.create(o.id,{label:"Model ID",api_key:zf.MODEL_ID,field_type:"string",validators:{required:{}}}),await e.fields.create(o.id,{label:"Record ID",api_key:zf.RECORD_ID,field_type:"string",validators:{required:{},unique:{}}}),await e.fields.create(o.id,{label:"Content",api_key:zf.CONTENT,field_type:"json",validators:{required:{}}})}eM({async onBoot(t){try{await Yq(t)}catch(e){Te("Failed to ensure comments model exists during plugin boot",e,{hasAccessToken:!!t.currentUserAccessToken}),t.notice("Comments plugin initialization warning: Unable to verify comment storage. If this is your first time using the plugin, please check your permissions.")}},renderConfigScreen(t){jf(g.jsx(wq,{ctx:t}))},itemFormSidebars(){return[{id:Vs.SIDEBAR,label:"Comments"}]},renderItemFormSidebar(t,e){t===Vs.SIDEBAR&&jf(g.jsx(U5,{ctx:e,children:g.jsx(C9,{ctx:e})}))},contentAreaSidebarItems(t){return sf(t.plugin.attributes.parameters).dashboardEnabled?[{label:"Comments",icon:Vs.ICON,placement:["before","menuItems"],pointsTo:{pageId:Vs.PAGE}}]:[]},renderPage(t,e){t===Vs.PAGE&&jf(g.jsx(V5,{ctx:e,children:g.jsx(Gq,{ctx:e})}))}});
|