@valbuild/ui 0.74.0 → 0.75.0

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.
@@ -1,435 +0,0 @@
1
- var Z4=Object.defineProperty;var Lk=e=>{throw TypeError(e)};var Q4=(e,t,n)=>t in e?Z4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var zt=(e,t,n)=>Q4(e,typeof t!="symbol"?t+"":t,n),Fk=(e,t,n)=>t.has(e)||Lk("Cannot "+n);var me=(e,t,n)=>(Fk(e,t,"read from private field"),n?n.call(e):t.get(e)),Pn=(e,t,n)=>t.has(e)?Lk("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ze=(e,t,n,r)=>(Fk(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function e3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var t3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ka(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mT={exports:{}},Je={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var mp=Symbol.for("react.element"),n3=Symbol.for("react.portal"),r3=Symbol.for("react.fragment"),o3=Symbol.for("react.strict_mode"),i3=Symbol.for("react.profiler"),s3=Symbol.for("react.provider"),a3=Symbol.for("react.context"),l3=Symbol.for("react.forward_ref"),c3=Symbol.for("react.suspense"),u3=Symbol.for("react.memo"),d3=Symbol.for("react.lazy"),zk=Symbol.iterator;function f3(e){return e===null||typeof e!="object"?null:(e=zk&&e[zk]||e["@@iterator"],typeof e=="function"?e:null)}var gT={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vT=Object.assign,yT={};function mu(e,t,n){this.props=e,this.context=t,this.refs=yT,this.updater=n||gT}mu.prototype.isReactComponent={};mu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};mu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function xT(){}xT.prototype=mu.prototype;function fw(e,t,n){this.props=e,this.context=t,this.refs=yT,this.updater=n||gT}var pw=fw.prototype=new xT;pw.constructor=fw;vT(pw,mu.prototype);pw.isPureReactComponent=!0;var Bk=Array.isArray,bT=Object.prototype.hasOwnProperty,hw={current:null},wT={key:!0,ref:!0,__self:!0,__source:!0};function ST(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)bT.call(t,r)&&!wT.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:mp,type:e,key:i,ref:s,props:o,_owner:hw.current}}function p3(e,t){return{$$typeof:mp,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function mw(e){return typeof e=="object"&&e!==null&&e.$$typeof===mp}function h3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var $k=/\/+/g;function wy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?h3(""+e.key):t.toString(36)}function Dh(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case mp:case n3:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+wy(s,0):r,Bk(o)?(n="",e!=null&&(n=e.replace($k,"$&/")+"/"),Dh(o,t,n,"",function(c){return c})):o!=null&&(mw(o)&&(o=p3(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace($k,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",Bk(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+wy(i,a);s+=Dh(i,t,n,l,o)}else if(l=f3(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+wy(i,a++),s+=Dh(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function nh(e,t,n){if(e==null)return e;var r=[],o=0;return Dh(e,r,"","",function(i){return t.call(n,i,o++)}),r}function m3(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Zn={current:null},Lh={transition:null},g3={ReactCurrentDispatcher:Zn,ReactCurrentBatchConfig:Lh,ReactCurrentOwner:hw};function kT(){throw Error("act(...) is not supported in production builds of React.")}Je.Children={map:nh,forEach:function(e,t,n){nh(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return nh(e,function(){t++}),t},toArray:function(e){return nh(e,function(t){return t})||[]},only:function(e){if(!mw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Je.Component=mu;Je.Fragment=r3;Je.Profiler=i3;Je.PureComponent=fw;Je.StrictMode=o3;Je.Suspense=c3;Je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=g3;Je.act=kT;Je.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=vT({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=hw.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)bT.call(t,l)&&!wT.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:mp,type:e.type,key:o,ref:i,props:r,_owner:s}};Je.createContext=function(e){return e={$$typeof:a3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:s3,_context:e},e.Consumer=e};Je.createElement=ST;Je.createFactory=function(e){var t=ST.bind(null,e);return t.type=e,t};Je.createRef=function(){return{current:null}};Je.forwardRef=function(e){return{$$typeof:l3,render:e}};Je.isValidElement=mw;Je.lazy=function(e){return{$$typeof:d3,_payload:{_status:-1,_result:e},_init:m3}};Je.memo=function(e,t){return{$$typeof:u3,type:e,compare:t===void 0?null:t}};Je.startTransition=function(e){var t=Lh.transition;Lh.transition={};try{e()}finally{Lh.transition=t}};Je.unstable_act=kT;Je.useCallback=function(e,t){return Zn.current.useCallback(e,t)};Je.useContext=function(e){return Zn.current.useContext(e)};Je.useDebugValue=function(){};Je.useDeferredValue=function(e){return Zn.current.useDeferredValue(e)};Je.useEffect=function(e,t){return Zn.current.useEffect(e,t)};Je.useId=function(){return Zn.current.useId()};Je.useImperativeHandle=function(e,t,n){return Zn.current.useImperativeHandle(e,t,n)};Je.useInsertionEffect=function(e,t){return Zn.current.useInsertionEffect(e,t)};Je.useLayoutEffect=function(e,t){return Zn.current.useLayoutEffect(e,t)};Je.useMemo=function(e,t){return Zn.current.useMemo(e,t)};Je.useReducer=function(e,t,n){return Zn.current.useReducer(e,t,n)};Je.useRef=function(e){return Zn.current.useRef(e)};Je.useState=function(e){return Zn.current.useState(e)};Je.useSyncExternalStore=function(e,t,n){return Zn.current.useSyncExternalStore(e,t,n)};Je.useTransition=function(){return Zn.current.useTransition()};Je.version="18.3.1";mT.exports=Je;var g=mT.exports;const _e=ka(g),v3=e3({__proto__:null,default:_e},[g]);var gm={},ET={exports:{}},Lr={},CT={exports:{}},_T={};/**
10
- * @license React
11
- * scheduler.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */(function(e){function t(M,F){var L=M.length;M.push(F);e:for(;0<L;){var B=L-1>>>1,K=M[B];if(0<o(K,F))M[B]=F,M[L]=K,L=B;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var F=M[0],L=M.pop();if(L!==F){M[0]=L;e:for(var B=0,K=M.length,be=K>>>1;B<be;){var ae=2*(B+1)-1,le=M[ae],re=ae+1,$=M[re];if(0>o(le,L))re<K&&0>o($,le)?(M[B]=$,M[re]=L,B=re):(M[B]=le,M[ae]=L,B=ae);else if(re<K&&0>o($,L))M[B]=$,M[re]=L,B=re;else break e}}return F}function o(M,F){var L=M.sortIndex-F.sortIndex;return L!==0?L:M.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,d=null,p=3,h=!1,m=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(M){for(var F=n(c);F!==null;){if(F.callback===null)r(c);else if(F.startTime<=M)r(c),F.sortIndex=F.expirationTime,t(l,F);else break;F=n(c)}}function C(M){if(v=!1,k(M),!m)if(n(l)!==null)m=!0,I(_);else{var F=n(c);F!==null&&R(C,F.startTime-M)}}function _(M,F){m=!1,v&&(v=!1,x(j),j=-1),h=!0;var L=p;try{for(k(F),d=n(l);d!==null&&(!(d.expirationTime>F)||M&&!V());){var B=d.callback;if(typeof B=="function"){d.callback=null,p=d.priorityLevel;var K=B(d.expirationTime<=F);F=e.unstable_now(),typeof K=="function"?d.callback=K:d===n(l)&&r(l),k(F)}else r(l);d=n(l)}if(d!==null)var be=!0;else{var ae=n(c);ae!==null&&R(C,ae.startTime-F),be=!1}return be}finally{d=null,p=L,h=!1}}var O=!1,T=null,j=-1,A=5,D=-1;function V(){return!(e.unstable_now()-D<A)}function W(){if(T!==null){var M=e.unstable_now();D=M;var F=!0;try{F=T(!0,M)}finally{F?J():(O=!1,T=null)}}else O=!1}var J;if(typeof w=="function")J=function(){w(W)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,U=X.port2;X.port1.onmessage=W,J=function(){U.postMessage(null)}}else J=function(){b(W,0)};function I(M){T=M,O||(O=!0,J())}function R(M,F){j=b(function(){M(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_continueExecution=function(){m||h||(m=!0,I(_))},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(M){switch(p){case 1:case 2:case 3:var F=3;break;default:F=p}var L=p;p=F;try{return M()}finally{p=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(M,F){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var L=p;p=M;try{return F()}finally{p=L}},e.unstable_scheduleCallback=function(M,F,L){var B=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?B+L:B):L=B,M){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=L+K,M={id:u++,callback:F,priorityLevel:M,startTime:L,expirationTime:K,sortIndex:-1},L>B?(M.sortIndex=L,t(c,M),n(l)===null&&M===n(c)&&(v?(x(j),j=-1):v=!0,R(C,L-B))):(M.sortIndex=K,t(l,M),m||h||(m=!0,I(_))),M},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(M){var F=p;return function(){var L=p;p=F;try{return M.apply(this,arguments)}finally{p=L}}}})(_T);CT.exports=_T;var y3=CT.exports;/**
18
- * @license React
19
- * react-dom.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var x3=g,Rr=y3;function ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var NT=new Set,Qd={};function Rl(e,t){$c(e,t),$c(e+"Capture",t)}function $c(e,t){for(Qd[e]=t,e=0;e<t.length;e++)NT.add(t[e])}var Ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),G0=Object.prototype.hasOwnProperty,b3=/^[: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]*$/,Vk={},Uk={};function w3(e){return G0.call(Uk,e)?!0:G0.call(Vk,e)?!1:b3.test(e)?Uk[e]=!0:(Vk[e]=!0,!1)}function S3(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k3(e,t,n,r){if(t===null||typeof t>"u"||S3(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Qn(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var kn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kn[e]=new Qn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kn[t]=new Qn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kn[e]=new Qn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kn[e]=new Qn(e,2,!1,e,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(e){kn[e]=new Qn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kn[e]=new Qn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kn[e]=new Qn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kn[e]=new Qn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kn[e]=new Qn(e,5,!1,e.toLowerCase(),null,!1,!1)});var gw=/[\-:]([a-z])/g;function vw(e){return e[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(e){var t=e.replace(gw,vw);kn[t]=new Qn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(gw,vw);kn[t]=new Qn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(gw,vw);kn[t]=new Qn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kn[e]=new Qn(e,1,!1,e.toLowerCase(),null,!1,!1)});kn.xlinkHref=new Qn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kn[e]=new Qn(e,1,!1,e.toLowerCase(),null,!0,!0)});function yw(e,t,n,r){var o=kn.hasOwnProperty(t)?kn[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(k3(t,n,o,r)&&(n=null),r||o===null?w3(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var es=x3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,rh=Symbol.for("react.element"),lc=Symbol.for("react.portal"),cc=Symbol.for("react.fragment"),xw=Symbol.for("react.strict_mode"),Y0=Symbol.for("react.profiler"),TT=Symbol.for("react.provider"),OT=Symbol.for("react.context"),bw=Symbol.for("react.forward_ref"),J0=Symbol.for("react.suspense"),X0=Symbol.for("react.suspense_list"),ww=Symbol.for("react.memo"),Cs=Symbol.for("react.lazy"),MT=Symbol.for("react.offscreen"),Hk=Symbol.iterator;function Fu(e){return e===null||typeof e!="object"?null:(e=Hk&&e[Hk]||e["@@iterator"],typeof e=="function"?e:null)}var At=Object.assign,Sy;function nd(e){if(Sy===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Sy=t&&t[1]||""}return`
26
- `+Sy+e}var ky=!1;function Ey(e,t){if(!e||ky)return"";ky=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
27
- `),i=r.stack.split(`
28
- `),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 l=`
29
- `+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{ky=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?nd(e):""}function E3(e){switch(e.tag){case 5:return nd(e.type);case 16:return nd("Lazy");case 13:return nd("Suspense");case 19:return nd("SuspenseList");case 0:case 2:case 15:return e=Ey(e.type,!1),e;case 11:return e=Ey(e.type.render,!1),e;case 1:return e=Ey(e.type,!0),e;default:return""}}function Z0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case cc:return"Fragment";case lc:return"Portal";case Y0:return"Profiler";case xw:return"StrictMode";case J0:return"Suspense";case X0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case OT:return(e.displayName||"Context")+".Consumer";case TT:return(e._context.displayName||"Context")+".Provider";case bw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ww:return t=e.displayName||null,t!==null?t:Z0(e.type)||"Memo";case Cs:t=e._payload,e=e._init;try{return Z0(e(t))}catch{}}return null}function C3(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Z0(t);case 8:return t===xw?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ia(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function PT(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _3(e){var t=PT(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oh(e){e._valueTracker||(e._valueTracker=_3(e))}function jT(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=PT(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function vm(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Q0(e,t){var n=t.checked;return At({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Wk(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ia(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function RT(e,t){t=t.checked,t!=null&&yw(e,"checked",t,!1)}function ex(e,t){RT(e,t);var n=ia(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?tx(e,t.type,n):t.hasOwnProperty("defaultValue")&&tx(e,t.type,ia(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Kk(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function tx(e,t,n){(t!=="number"||vm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var rd=Array.isArray;function Sc(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ia(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function nx(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ee(91));return At({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function qk(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ee(92));if(rd(n)){if(1<n.length)throw Error(ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ia(n)}}function AT(e,t){var n=ia(t.value),r=ia(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Gk(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function IT(e){switch(e){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 rx(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?IT(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ih,DT=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ih=ih||document.createElement("div"),ih.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ih.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ef(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Id={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},N3=["Webkit","ms","Moz","O"];Object.keys(Id).forEach(function(e){N3.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Id[t]=Id[e]})});function LT(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Id.hasOwnProperty(e)&&Id[e]?(""+t).trim():t+"px"}function FT(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=LT(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var T3=At({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 ox(e,t){if(t){if(T3[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ee(62))}}function ix(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 sx=null;function Sw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ax=null,kc=null,Ec=null;function Yk(e){if(e=yp(e)){if(typeof ax!="function")throw Error(ee(280));var t=e.stateNode;t&&(t=Qg(t),ax(e.stateNode,e.type,t))}}function zT(e){kc?Ec?Ec.push(e):Ec=[e]:kc=e}function BT(){if(kc){var e=kc,t=Ec;if(Ec=kc=null,Yk(e),t)for(e=0;e<t.length;e++)Yk(t[e])}}function $T(e,t){return e(t)}function VT(){}var Cy=!1;function UT(e,t,n){if(Cy)return e(t,n);Cy=!0;try{return $T(e,t,n)}finally{Cy=!1,(kc!==null||Ec!==null)&&(VT(),BT())}}function tf(e,t){var n=e.stateNode;if(n===null)return null;var r=Qg(n);if(r===null)return null;n=r[t];e:switch(t){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)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ee(231,t,typeof n));return n}var lx=!1;if(Ui)try{var zu={};Object.defineProperty(zu,"passive",{get:function(){lx=!0}}),window.addEventListener("test",zu,zu),window.removeEventListener("test",zu,zu)}catch{lx=!1}function O3(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Dd=!1,ym=null,xm=!1,cx=null,M3={onError:function(e){Dd=!0,ym=e}};function P3(e,t,n,r,o,i,s,a,l){Dd=!1,ym=null,O3.apply(M3,arguments)}function j3(e,t,n,r,o,i,s,a,l){if(P3.apply(this,arguments),Dd){if(Dd){var c=ym;Dd=!1,ym=null}else throw Error(ee(198));xm||(xm=!0,cx=c)}}function Al(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function HT(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Jk(e){if(Al(e)!==e)throw Error(ee(188))}function R3(e){var t=e.alternate;if(!t){if(t=Al(e),t===null)throw Error(ee(188));return t!==e?null:e}for(var n=e,r=t;;){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 Jk(o),e;if(i===r)return Jk(o),t;i=i.sibling}throw Error(ee(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(ee(189))}}if(n.alternate!==r)throw Error(ee(190))}if(n.tag!==3)throw Error(ee(188));return n.stateNode.current===n?e:t}function WT(e){return e=R3(e),e!==null?KT(e):null}function KT(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=KT(e);if(t!==null)return t;e=e.sibling}return null}var qT=Rr.unstable_scheduleCallback,Xk=Rr.unstable_cancelCallback,A3=Rr.unstable_shouldYield,I3=Rr.unstable_requestPaint,Bt=Rr.unstable_now,D3=Rr.unstable_getCurrentPriorityLevel,kw=Rr.unstable_ImmediatePriority,GT=Rr.unstable_UserBlockingPriority,bm=Rr.unstable_NormalPriority,L3=Rr.unstable_LowPriority,YT=Rr.unstable_IdlePriority,Yg=null,ni=null;function F3(e){if(ni&&typeof ni.onCommitFiberRoot=="function")try{ni.onCommitFiberRoot(Yg,e,void 0,(e.current.flags&128)===128)}catch{}}var Mo=Math.clz32?Math.clz32:$3,z3=Math.log,B3=Math.LN2;function $3(e){return e>>>=0,e===0?32:31-(z3(e)/B3|0)|0}var sh=64,ah=4194304;function od(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=od(a):(i&=s,i!==0&&(r=od(i)))}else s=n&~o,s!==0?r=od(s):i!==0&&(r=od(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Mo(t),o=1<<n,r|=e[n],t&=~o;return r}function V3(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 U3(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Mo(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=V3(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function ux(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function JT(){var e=sh;return sh<<=1,!(sh&4194240)&&(sh=64),e}function _y(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function gp(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Mo(t),e[t]=n}function H3(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Mo(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Ew(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Mo(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var dt=0;function XT(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var ZT,Cw,QT,eO,tO,dx=!1,lh=[],Hs=null,Ws=null,Ks=null,nf=new Map,rf=new Map,Ms=[],W3="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 Zk(e,t){switch(e){case"focusin":case"focusout":Hs=null;break;case"dragenter":case"dragleave":Ws=null;break;case"mouseover":case"mouseout":Ks=null;break;case"pointerover":case"pointerout":nf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":rf.delete(t.pointerId)}}function Bu(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=yp(t),t!==null&&Cw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function K3(e,t,n,r,o){switch(t){case"focusin":return Hs=Bu(Hs,e,t,n,r,o),!0;case"dragenter":return Ws=Bu(Ws,e,t,n,r,o),!0;case"mouseover":return Ks=Bu(Ks,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return nf.set(i,Bu(nf.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,rf.set(i,Bu(rf.get(i)||null,e,t,n,r,o)),!0}return!1}function nO(e){var t=Ka(e.target);if(t!==null){var n=Al(t);if(n!==null){if(t=n.tag,t===13){if(t=HT(n),t!==null){e.blockedOn=t,tO(e.priority,function(){QT(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sx=r,n.target.dispatchEvent(r),sx=null}else return t=yp(n),t!==null&&Cw(t),e.blockedOn=n,!1;t.shift()}return!0}function Qk(e,t,n){Fh(e)&&n.delete(t)}function q3(){dx=!1,Hs!==null&&Fh(Hs)&&(Hs=null),Ws!==null&&Fh(Ws)&&(Ws=null),Ks!==null&&Fh(Ks)&&(Ks=null),nf.forEach(Qk),rf.forEach(Qk)}function $u(e,t){e.blockedOn===t&&(e.blockedOn=null,dx||(dx=!0,Rr.unstable_scheduleCallback(Rr.unstable_NormalPriority,q3)))}function of(e){function t(o){return $u(o,e)}if(0<lh.length){$u(lh[0],e);for(var n=1;n<lh.length;n++){var r=lh[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Hs!==null&&$u(Hs,e),Ws!==null&&$u(Ws,e),Ks!==null&&$u(Ks,e),nf.forEach(t),rf.forEach(t),n=0;n<Ms.length;n++)r=Ms[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ms.length&&(n=Ms[0],n.blockedOn===null);)nO(n),n.blockedOn===null&&Ms.shift()}var Cc=es.ReactCurrentBatchConfig,Sm=!0;function G3(e,t,n,r){var o=dt,i=Cc.transition;Cc.transition=null;try{dt=1,_w(e,t,n,r)}finally{dt=o,Cc.transition=i}}function Y3(e,t,n,r){var o=dt,i=Cc.transition;Cc.transition=null;try{dt=4,_w(e,t,n,r)}finally{dt=o,Cc.transition=i}}function _w(e,t,n,r){if(Sm){var o=fx(e,t,n,r);if(o===null)Dy(e,t,r,km,n),Zk(e,r);else if(K3(o,e,t,n,r))r.stopPropagation();else if(Zk(e,r),t&4&&-1<W3.indexOf(e)){for(;o!==null;){var i=yp(o);if(i!==null&&ZT(i),i=fx(e,t,n,r),i===null&&Dy(e,t,r,km,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Dy(e,t,r,null,n)}}var km=null;function fx(e,t,n,r){if(km=null,e=Sw(r),e=Ka(e),e!==null)if(t=Al(e),t===null)e=null;else if(n=t.tag,n===13){if(e=HT(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return km=e,null}function rO(e){switch(e){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(D3()){case kw:return 1;case GT:return 4;case bm:case L3:return 16;case YT:return 536870912;default:return 16}default:return 16}}var Fs=null,Nw=null,zh=null;function oO(){if(zh)return zh;var e,t=Nw,n=t.length,r,o="value"in Fs?Fs.value:Fs.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return zh=o.slice(e,1<r?1-r:void 0)}function Bh(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ch(){return!0}function eE(){return!1}function Fr(e){function t(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 e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ch:eE,this.isPropagationStopped=eE,this}return At(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ch)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ch)},persist:function(){},isPersistent:ch}),t}var gu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tw=Fr(gu),vp=At({},gu,{view:0,detail:0}),J3=Fr(vp),Ny,Ty,Vu,Jg=At({},vp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ow,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Vu&&(Vu&&e.type==="mousemove"?(Ny=e.screenX-Vu.screenX,Ty=e.screenY-Vu.screenY):Ty=Ny=0,Vu=e),Ny)},movementY:function(e){return"movementY"in e?e.movementY:Ty}}),tE=Fr(Jg),X3=At({},Jg,{dataTransfer:0}),Z3=Fr(X3),Q3=At({},vp,{relatedTarget:0}),Oy=Fr(Q3),eF=At({},gu,{animationName:0,elapsedTime:0,pseudoElement:0}),tF=Fr(eF),nF=At({},gu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rF=Fr(nF),oF=At({},gu,{data:0}),nE=Fr(oF),iF={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sF={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"},aF={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lF(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=aF[e])?!!t[e]:!1}function Ow(){return lF}var cF=At({},vp,{key:function(e){if(e.key){var t=iF[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sF[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ow,charCode:function(e){return e.type==="keypress"?Bh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),uF=Fr(cF),dF=At({},Jg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rE=Fr(dF),fF=At({},vp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ow}),pF=Fr(fF),hF=At({},gu,{propertyName:0,elapsedTime:0,pseudoElement:0}),mF=Fr(hF),gF=At({},Jg,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),vF=Fr(gF),yF=[9,13,27,32],Mw=Ui&&"CompositionEvent"in window,Ld=null;Ui&&"documentMode"in document&&(Ld=document.documentMode);var xF=Ui&&"TextEvent"in window&&!Ld,iO=Ui&&(!Mw||Ld&&8<Ld&&11>=Ld),oE=" ",iE=!1;function sO(e,t){switch(e){case"keyup":return yF.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var uc=!1;function bF(e,t){switch(e){case"compositionend":return aO(t);case"keypress":return t.which!==32?null:(iE=!0,oE);case"textInput":return e=t.data,e===oE&&iE?null:e;default:return null}}function wF(e,t){if(uc)return e==="compositionend"||!Mw&&sO(e,t)?(e=oO(),zh=Nw=Fs=null,uc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return iO&&t.locale!=="ko"?null:t.data;default:return null}}var SF={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 sE(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!SF[e.type]:t==="textarea"}function lO(e,t,n,r){zT(r),t=Em(t,"onChange"),0<t.length&&(n=new Tw("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Fd=null,sf=null;function kF(e){xO(e,0)}function Xg(e){var t=pc(e);if(jT(t))return e}function EF(e,t){if(e==="change")return t}var cO=!1;if(Ui){var My;if(Ui){var Py="oninput"in document;if(!Py){var aE=document.createElement("div");aE.setAttribute("oninput","return;"),Py=typeof aE.oninput=="function"}My=Py}else My=!1;cO=My&&(!document.documentMode||9<document.documentMode)}function lE(){Fd&&(Fd.detachEvent("onpropertychange",uO),sf=Fd=null)}function uO(e){if(e.propertyName==="value"&&Xg(sf)){var t=[];lO(t,sf,e,Sw(e)),UT(kF,t)}}function CF(e,t,n){e==="focusin"?(lE(),Fd=t,sf=n,Fd.attachEvent("onpropertychange",uO)):e==="focusout"&&lE()}function _F(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Xg(sf)}function NF(e,t){if(e==="click")return Xg(t)}function TF(e,t){if(e==="input"||e==="change")return Xg(t)}function OF(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ao=typeof Object.is=="function"?Object.is:OF;function af(e,t){if(Ao(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!G0.call(t,o)||!Ao(e[o],t[o]))return!1}return!0}function cE(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function uE(e,t){var n=cE(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cE(n)}}function dO(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?dO(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function fO(){for(var e=window,t=vm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=vm(e.document)}return t}function Pw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function MF(e){var t=fO(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dO(n.ownerDocument.documentElement,n)){if(r!==null&&Pw(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=uE(n,i);var s=uE(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var PF=Ui&&"documentMode"in document&&11>=document.documentMode,dc=null,px=null,zd=null,hx=!1;function dE(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hx||dc==null||dc!==vm(r)||(r=dc,"selectionStart"in r&&Pw(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}),zd&&af(zd,r)||(zd=r,r=Em(px,"onSelect"),0<r.length&&(t=new Tw("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=dc)))}function uh(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fc={animationend:uh("Animation","AnimationEnd"),animationiteration:uh("Animation","AnimationIteration"),animationstart:uh("Animation","AnimationStart"),transitionend:uh("Transition","TransitionEnd")},jy={},pO={};Ui&&(pO=document.createElement("div").style,"AnimationEvent"in window||(delete fc.animationend.animation,delete fc.animationiteration.animation,delete fc.animationstart.animation),"TransitionEvent"in window||delete fc.transitionend.transition);function Zg(e){if(jy[e])return jy[e];if(!fc[e])return e;var t=fc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in pO)return jy[e]=t[n];return e}var hO=Zg("animationend"),mO=Zg("animationiteration"),gO=Zg("animationstart"),vO=Zg("transitionend"),yO=new Map,fE="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 Ea(e,t){yO.set(e,t),Rl(t,[e])}for(var Ry=0;Ry<fE.length;Ry++){var Ay=fE[Ry],jF=Ay.toLowerCase(),RF=Ay[0].toUpperCase()+Ay.slice(1);Ea(jF,"on"+RF)}Ea(hO,"onAnimationEnd");Ea(mO,"onAnimationIteration");Ea(gO,"onAnimationStart");Ea("dblclick","onDoubleClick");Ea("focusin","onFocus");Ea("focusout","onBlur");Ea(vO,"onTransitionEnd");$c("onMouseEnter",["mouseout","mouseover"]);$c("onMouseLeave",["mouseout","mouseover"]);$c("onPointerEnter",["pointerout","pointerover"]);$c("onPointerLeave",["pointerout","pointerover"]);Rl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Rl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Rl("onBeforeInput",["compositionend","keypress","textInput","paste"]);Rl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Rl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Rl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var id="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(" "),AF=new Set("cancel close invalid load scroll toggle".split(" ").concat(id));function pE(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,j3(r,t,void 0,e),e.currentTarget=null}function xO(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;pE(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;pE(o,a,c),i=l}}}if(xm)throw e=cx,xm=!1,cx=null,e}function kt(e,t){var n=t[xx];n===void 0&&(n=t[xx]=new Set);var r=e+"__bubble";n.has(r)||(bO(t,e,2,!1),n.add(r))}function Iy(e,t,n){var r=0;t&&(r|=4),bO(n,e,r,t)}var dh="_reactListening"+Math.random().toString(36).slice(2);function lf(e){if(!e[dh]){e[dh]=!0,NT.forEach(function(n){n!=="selectionchange"&&(AF.has(n)||Iy(n,!1,e),Iy(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[dh]||(t[dh]=!0,Iy("selectionchange",!1,t))}}function bO(e,t,n,r){switch(rO(t)){case 1:var o=G3;break;case 4:o=Y3;break;default:o=_w}n=o.bind(null,t,n,e),o=void 0,!lx||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Dy(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&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 l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=Ka(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}UT(function(){var c=i,u=Sw(n),d=[];e:{var p=yO.get(e);if(p!==void 0){var h=Tw,m=e;switch(e){case"keypress":if(Bh(n)===0)break e;case"keydown":case"keyup":h=uF;break;case"focusin":m="focus",h=Oy;break;case"focusout":m="blur",h=Oy;break;case"beforeblur":case"afterblur":h=Oy;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":h=tE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Z3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=pF;break;case hO:case mO:case gO:h=tF;break;case vO:h=mF;break;case"scroll":h=J3;break;case"wheel":h=vF;break;case"copy":case"cut":case"paste":h=rF;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=rE}var v=(t&4)!==0,b=!v&&e==="scroll",x=v?p!==null?p+"Capture":null:p;v=[];for(var w=c,k;w!==null;){k=w;var C=k.stateNode;if(k.tag===5&&C!==null&&(k=C,x!==null&&(C=tf(w,x),C!=null&&v.push(cf(w,C,k)))),b)break;w=w.return}0<v.length&&(p=new h(p,m,null,n,u),d.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==sx&&(m=n.relatedTarget||n.fromElement)&&(Ka(m)||m[Hi]))break e;if((h||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,h?(m=n.relatedTarget||n.toElement,h=c,m=m?Ka(m):null,m!==null&&(b=Al(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(h=null,m=c),h!==m)){if(v=tE,C="onMouseLeave",x="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(v=rE,C="onPointerLeave",x="onPointerEnter",w="pointer"),b=h==null?p:pc(h),k=m==null?p:pc(m),p=new v(C,w+"leave",h,n,u),p.target=b,p.relatedTarget=k,C=null,Ka(u)===c&&(v=new v(x,w+"enter",m,n,u),v.target=k,v.relatedTarget=b,C=v),b=C,h&&m)t:{for(v=h,x=m,w=0,k=v;k;k=$l(k))w++;for(k=0,C=x;C;C=$l(C))k++;for(;0<w-k;)v=$l(v),w--;for(;0<k-w;)x=$l(x),k--;for(;w--;){if(v===x||x!==null&&v===x.alternate)break t;v=$l(v),x=$l(x)}v=null}else v=null;h!==null&&hE(d,p,h,v,!1),m!==null&&b!==null&&hE(d,b,m,v,!0)}}e:{if(p=c?pc(c):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var _=EF;else if(sE(p))if(cO)_=TF;else{_=_F;var O=CF}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(_=NF);if(_&&(_=_(e,c))){lO(d,_,n,u);break e}O&&O(e,p,c),e==="focusout"&&(O=p._wrapperState)&&O.controlled&&p.type==="number"&&tx(p,"number",p.value)}switch(O=c?pc(c):window,e){case"focusin":(sE(O)||O.contentEditable==="true")&&(dc=O,px=c,zd=null);break;case"focusout":zd=px=dc=null;break;case"mousedown":hx=!0;break;case"contextmenu":case"mouseup":case"dragend":hx=!1,dE(d,n,u);break;case"selectionchange":if(PF)break;case"keydown":case"keyup":dE(d,n,u)}var T;if(Mw)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else uc?sO(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(iO&&n.locale!=="ko"&&(uc||j!=="onCompositionStart"?j==="onCompositionEnd"&&uc&&(T=oO()):(Fs=u,Nw="value"in Fs?Fs.value:Fs.textContent,uc=!0)),O=Em(c,j),0<O.length&&(j=new nE(j,e,null,n,u),d.push({event:j,listeners:O}),T?j.data=T:(T=aO(n),T!==null&&(j.data=T)))),(T=xF?bF(e,n):wF(e,n))&&(c=Em(c,"onBeforeInput"),0<c.length&&(u=new nE("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=T))}xO(d,t)})}function cf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Em(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=tf(e,n),i!=null&&r.unshift(cf(e,i,o)),i=tf(e,t),i!=null&&r.push(cf(e,i,o))),e=e.return}return r}function $l(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function hE(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=tf(n,i),l!=null&&s.unshift(cf(n,l,a))):o||(l=tf(n,i),l!=null&&s.push(cf(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var IF=/\r\n?/g,DF=/\u0000|\uFFFD/g;function mE(e){return(typeof e=="string"?e:""+e).replace(IF,`
30
- `).replace(DF,"")}function fh(e,t,n){if(t=mE(t),mE(e)!==t&&n)throw Error(ee(425))}function Cm(){}var mx=null,gx=null;function vx(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var yx=typeof setTimeout=="function"?setTimeout:void 0,LF=typeof clearTimeout=="function"?clearTimeout:void 0,gE=typeof Promise=="function"?Promise:void 0,FF=typeof queueMicrotask=="function"?queueMicrotask:typeof gE<"u"?function(e){return gE.resolve(null).then(e).catch(zF)}:yx;function zF(e){setTimeout(function(){throw e})}function Ly(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),of(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);of(t)}function qs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function vE(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var vu=Math.random().toString(36).slice(2),Qo="__reactFiber$"+vu,uf="__reactProps$"+vu,Hi="__reactContainer$"+vu,xx="__reactEvents$"+vu,BF="__reactListeners$"+vu,$F="__reactHandles$"+vu;function Ka(e){var t=e[Qo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Hi]||n[Qo]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vE(e);e!==null;){if(n=e[Qo])return n;e=vE(e)}return t}e=n,n=e.parentNode}return null}function yp(e){return e=e[Qo]||e[Hi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function pc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ee(33))}function Qg(e){return e[uf]||null}var bx=[],hc=-1;function Ca(e){return{current:e}}function Et(e){0>hc||(e.current=bx[hc],bx[hc]=null,hc--)}function xt(e,t){hc++,bx[hc]=e.current,e.current=t}var sa={},Fn=Ca(sa),sr=Ca(!1),pl=sa;function Vc(e,t){var n=e.type.contextTypes;if(!n)return sa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ar(e){return e=e.childContextTypes,e!=null}function _m(){Et(sr),Et(Fn)}function yE(e,t,n){if(Fn.current!==sa)throw Error(ee(168));xt(Fn,t),xt(sr,n)}function wO(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ee(108,C3(e)||"Unknown",o));return At({},n,r)}function Nm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sa,pl=Fn.current,xt(Fn,e),xt(sr,sr.current),!0}function xE(e,t,n){var r=e.stateNode;if(!r)throw Error(ee(169));n?(e=wO(e,t,pl),r.__reactInternalMemoizedMergedChildContext=e,Et(sr),Et(Fn),xt(Fn,e)):Et(sr),xt(sr,n)}var Oi=null,ev=!1,Fy=!1;function SO(e){Oi===null?Oi=[e]:Oi.push(e)}function VF(e){ev=!0,SO(e)}function _a(){if(!Fy&&Oi!==null){Fy=!0;var e=0,t=dt;try{var n=Oi;for(dt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Oi=null,ev=!1}catch(o){throw Oi!==null&&(Oi=Oi.slice(e+1)),qT(kw,_a),o}finally{dt=t,Fy=!1}}return null}var mc=[],gc=0,Tm=null,Om=0,qr=[],Gr=0,hl=null,Ai=1,Ii="";function La(e,t){mc[gc++]=Om,mc[gc++]=Tm,Tm=e,Om=t}function kO(e,t,n){qr[Gr++]=Ai,qr[Gr++]=Ii,qr[Gr++]=hl,hl=e;var r=Ai;e=Ii;var o=32-Mo(r)-1;r&=~(1<<o),n+=1;var i=32-Mo(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,Ai=1<<32-Mo(t)+o|n<<o|r,Ii=i+e}else Ai=1<<i|n<<o|r,Ii=e}function jw(e){e.return!==null&&(La(e,1),kO(e,1,0))}function Rw(e){for(;e===Tm;)Tm=mc[--gc],mc[gc]=null,Om=mc[--gc],mc[gc]=null;for(;e===hl;)hl=qr[--Gr],qr[Gr]=null,Ii=qr[--Gr],qr[Gr]=null,Ai=qr[--Gr],qr[Gr]=null}var Mr=null,Tr=null,Ct=!1,So=null;function EO(e,t){var n=Jr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function bE(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Mr=e,Tr=qs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Mr=e,Tr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=hl!==null?{id:Ai,overflow:Ii}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Jr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Mr=e,Tr=null,!0):!1;default:return!1}}function wx(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Sx(e){if(Ct){var t=Tr;if(t){var n=t;if(!bE(e,t)){if(wx(e))throw Error(ee(418));t=qs(n.nextSibling);var r=Mr;t&&bE(e,t)?EO(r,n):(e.flags=e.flags&-4097|2,Ct=!1,Mr=e)}}else{if(wx(e))throw Error(ee(418));e.flags=e.flags&-4097|2,Ct=!1,Mr=e}}}function wE(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Mr=e}function ph(e){if(e!==Mr)return!1;if(!Ct)return wE(e),Ct=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!vx(e.type,e.memoizedProps)),t&&(t=Tr)){if(wx(e))throw CO(),Error(ee(418));for(;t;)EO(e,t),t=qs(t.nextSibling)}if(wE(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Tr=qs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Tr=null}}else Tr=Mr?qs(e.stateNode.nextSibling):null;return!0}function CO(){for(var e=Tr;e;)e=qs(e.nextSibling)}function Uc(){Tr=Mr=null,Ct=!1}function Aw(e){So===null?So=[e]:So.push(e)}var UF=es.ReactCurrentBatchConfig;function Uu(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ee(309));var r=n.stateNode}if(!r)throw Error(ee(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(ee(284));if(!n._owner)throw Error(ee(290,e))}return e}function hh(e,t){throw e=Object.prototype.toString.call(t),Error(ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function SE(e){var t=e._init;return t(e._payload)}function _O(e){function t(x,w){if(e){var k=x.deletions;k===null?(x.deletions=[w],x.flags|=16):k.push(w)}}function n(x,w){if(!e)return null;for(;w!==null;)t(x,w),w=w.sibling;return null}function r(x,w){for(x=new Map;w!==null;)w.key!==null?x.set(w.key,w):x.set(w.index,w),w=w.sibling;return x}function o(x,w){return x=Xs(x,w),x.index=0,x.sibling=null,x}function i(x,w,k){return x.index=k,e?(k=x.alternate,k!==null?(k=k.index,k<w?(x.flags|=2,w):k):(x.flags|=2,w)):(x.flags|=1048576,w)}function s(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,w,k,C){return w===null||w.tag!==6?(w=Wy(k,x.mode,C),w.return=x,w):(w=o(w,k),w.return=x,w)}function l(x,w,k,C){var _=k.type;return _===cc?u(x,w,k.props.children,C,k.key):w!==null&&(w.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Cs&&SE(_)===w.type)?(C=o(w,k.props),C.ref=Uu(x,w,k),C.return=x,C):(C=qh(k.type,k.key,k.props,null,x.mode,C),C.ref=Uu(x,w,k),C.return=x,C)}function c(x,w,k,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==k.containerInfo||w.stateNode.implementation!==k.implementation?(w=Ky(k,x.mode,C),w.return=x,w):(w=o(w,k.children||[]),w.return=x,w)}function u(x,w,k,C,_){return w===null||w.tag!==7?(w=rl(k,x.mode,C,_),w.return=x,w):(w=o(w,k),w.return=x,w)}function d(x,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Wy(""+w,x.mode,k),w.return=x,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case rh:return k=qh(w.type,w.key,w.props,null,x.mode,k),k.ref=Uu(x,null,w),k.return=x,k;case lc:return w=Ky(w,x.mode,k),w.return=x,w;case Cs:var C=w._init;return d(x,C(w._payload),k)}if(rd(w)||Fu(w))return w=rl(w,x.mode,k,null),w.return=x,w;hh(x,w)}return null}function p(x,w,k,C){var _=w!==null?w.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return _!==null?null:a(x,w,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case rh:return k.key===_?l(x,w,k,C):null;case lc:return k.key===_?c(x,w,k,C):null;case Cs:return _=k._init,p(x,w,_(k._payload),C)}if(rd(k)||Fu(k))return _!==null?null:u(x,w,k,C,null);hh(x,k)}return null}function h(x,w,k,C,_){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(k)||null,a(w,x,""+C,_);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case rh:return x=x.get(C.key===null?k:C.key)||null,l(w,x,C,_);case lc:return x=x.get(C.key===null?k:C.key)||null,c(w,x,C,_);case Cs:var O=C._init;return h(x,w,k,O(C._payload),_)}if(rd(C)||Fu(C))return x=x.get(k)||null,u(w,x,C,_,null);hh(w,C)}return null}function m(x,w,k,C){for(var _=null,O=null,T=w,j=w=0,A=null;T!==null&&j<k.length;j++){T.index>j?(A=T,T=null):A=T.sibling;var D=p(x,T,k[j],C);if(D===null){T===null&&(T=A);break}e&&T&&D.alternate===null&&t(x,T),w=i(D,w,j),O===null?_=D:O.sibling=D,O=D,T=A}if(j===k.length)return n(x,T),Ct&&La(x,j),_;if(T===null){for(;j<k.length;j++)T=d(x,k[j],C),T!==null&&(w=i(T,w,j),O===null?_=T:O.sibling=T,O=T);return Ct&&La(x,j),_}for(T=r(x,T);j<k.length;j++)A=h(T,x,j,k[j],C),A!==null&&(e&&A.alternate!==null&&T.delete(A.key===null?j:A.key),w=i(A,w,j),O===null?_=A:O.sibling=A,O=A);return e&&T.forEach(function(V){return t(x,V)}),Ct&&La(x,j),_}function v(x,w,k,C){var _=Fu(k);if(typeof _!="function")throw Error(ee(150));if(k=_.call(k),k==null)throw Error(ee(151));for(var O=_=null,T=w,j=w=0,A=null,D=k.next();T!==null&&!D.done;j++,D=k.next()){T.index>j?(A=T,T=null):A=T.sibling;var V=p(x,T,D.value,C);if(V===null){T===null&&(T=A);break}e&&T&&V.alternate===null&&t(x,T),w=i(V,w,j),O===null?_=V:O.sibling=V,O=V,T=A}if(D.done)return n(x,T),Ct&&La(x,j),_;if(T===null){for(;!D.done;j++,D=k.next())D=d(x,D.value,C),D!==null&&(w=i(D,w,j),O===null?_=D:O.sibling=D,O=D);return Ct&&La(x,j),_}for(T=r(x,T);!D.done;j++,D=k.next())D=h(T,x,j,D.value,C),D!==null&&(e&&D.alternate!==null&&T.delete(D.key===null?j:D.key),w=i(D,w,j),O===null?_=D:O.sibling=D,O=D);return e&&T.forEach(function(W){return t(x,W)}),Ct&&La(x,j),_}function b(x,w,k,C){if(typeof k=="object"&&k!==null&&k.type===cc&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case rh:e:{for(var _=k.key,O=w;O!==null;){if(O.key===_){if(_=k.type,_===cc){if(O.tag===7){n(x,O.sibling),w=o(O,k.props.children),w.return=x,x=w;break e}}else if(O.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Cs&&SE(_)===O.type){n(x,O.sibling),w=o(O,k.props),w.ref=Uu(x,O,k),w.return=x,x=w;break e}n(x,O);break}else t(x,O);O=O.sibling}k.type===cc?(w=rl(k.props.children,x.mode,C,k.key),w.return=x,x=w):(C=qh(k.type,k.key,k.props,null,x.mode,C),C.ref=Uu(x,w,k),C.return=x,x=C)}return s(x);case lc:e:{for(O=k.key;w!==null;){if(w.key===O)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(x,w.sibling),w=o(w,k.children||[]),w.return=x,x=w;break e}else{n(x,w);break}else t(x,w);w=w.sibling}w=Ky(k,x.mode,C),w.return=x,x=w}return s(x);case Cs:return O=k._init,b(x,w,O(k._payload),C)}if(rd(k))return m(x,w,k,C);if(Fu(k))return v(x,w,k,C);hh(x,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(x,w.sibling),w=o(w,k),w.return=x,x=w):(n(x,w),w=Wy(k,x.mode,C),w.return=x,x=w),s(x)):n(x,w)}return b}var Hc=_O(!0),NO=_O(!1),Mm=Ca(null),Pm=null,vc=null,Iw=null;function Dw(){Iw=vc=Pm=null}function Lw(e){var t=Mm.current;Et(Mm),e._currentValue=t}function kx(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function _c(e,t){Pm=e,Iw=vc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(rr=!0),e.firstContext=null)}function to(e){var t=e._currentValue;if(Iw!==e)if(e={context:e,memoizedValue:t,next:null},vc===null){if(Pm===null)throw Error(ee(308));vc=e,Pm.dependencies={lanes:0,firstContext:e}}else vc=vc.next=e;return t}var qa=null;function Fw(e){qa===null?qa=[e]:qa.push(e)}function TO(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Fw(t)):(n.next=o.next,o.next=n),t.interleaved=n,Wi(e,r)}function Wi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var _s=!1;function zw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function OO(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Bi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Gs(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,tt&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Wi(e,n)}return o=r.interleaved,o===null?(t.next=t,Fw(r)):(t.next=o.next,o.next=t),r.interleaved=t,Wi(e,n)}function $h(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ew(e,n)}}function kE(e,t){var n=e.updateQueue,r=e.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=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function jm(e,t,n,r){var o=e.updateQueue;_s=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==s&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=o.baseState;s=0,u=c=l=null,a=i;do{var p=a.lane,h=a.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,v=a;switch(p=t,h=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){d=m.call(h,d,p);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,p=typeof m=="function"?m.call(h,d,p):m,p==null)break e;d=At({},d,p);break e;case 2:_s=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[a]:p.push(a))}else h={eventTime:h,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=h,l=d):u=u.next=h,s|=p;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;p=a,a=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(u===null&&(l=d),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);gl|=s,e.lanes=s,e.memoizedState=d}}function EE(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(ee(191,o));o.call(r)}}}var xp={},ri=Ca(xp),df=Ca(xp),ff=Ca(xp);function Ga(e){if(e===xp)throw Error(ee(174));return e}function Bw(e,t){switch(xt(ff,t),xt(df,e),xt(ri,xp),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:rx(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=rx(t,e)}Et(ri),xt(ri,t)}function Wc(){Et(ri),Et(df),Et(ff)}function MO(e){Ga(ff.current);var t=Ga(ri.current),n=rx(t,e.type);t!==n&&(xt(df,e),xt(ri,n))}function $w(e){df.current===e&&(Et(ri),Et(df))}var Pt=Ca(0);function Rm(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var zy=[];function Vw(){for(var e=0;e<zy.length;e++)zy[e]._workInProgressVersionPrimary=null;zy.length=0}var Vh=es.ReactCurrentDispatcher,By=es.ReactCurrentBatchConfig,ml=0,Rt=null,Xt=null,cn=null,Am=!1,Bd=!1,pf=0,HF=0;function jn(){throw Error(ee(321))}function Uw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ao(e[n],t[n]))return!1;return!0}function Hw(e,t,n,r,o,i){if(ml=i,Rt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Vh.current=e===null||e.memoizedState===null?GF:YF,e=n(r,o),Bd){i=0;do{if(Bd=!1,pf=0,25<=i)throw Error(ee(301));i+=1,cn=Xt=null,t.updateQueue=null,Vh.current=JF,e=n(r,o)}while(Bd)}if(Vh.current=Im,t=Xt!==null&&Xt.next!==null,ml=0,cn=Xt=Rt=null,Am=!1,t)throw Error(ee(300));return e}function Ww(){var e=pf!==0;return pf=0,e}function Xo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Rt.memoizedState=cn=e:cn=cn.next=e,cn}function no(){if(Xt===null){var e=Rt.alternate;e=e!==null?e.memoizedState:null}else e=Xt.next;var t=cn===null?Rt.memoizedState:cn.next;if(t!==null)cn=t,Xt=e;else{if(e===null)throw Error(ee(310));Xt=e,e={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},cn===null?Rt.memoizedState=cn=e:cn=cn.next=e}return cn}function hf(e,t){return typeof t=="function"?t(e):t}function $y(e){var t=no(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=Xt,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,l=null,c=i;do{var u=c.lane;if((ml&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,s=r):l=l.next=d,Rt.lanes|=u,gl|=u}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Ao(r,t.memoizedState)||(rr=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Rt.lanes|=i,gl|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Vy(e){var t=no(),n=t.queue;if(n===null)throw Error(ee(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Ao(i,t.memoizedState)||(rr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function PO(){}function jO(e,t){var n=Rt,r=no(),o=t(),i=!Ao(r.memoizedState,o);if(i&&(r.memoizedState=o,rr=!0),r=r.queue,Kw(IO.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||cn!==null&&cn.memoizedState.tag&1){if(n.flags|=2048,mf(9,AO.bind(null,n,r,o,t),void 0,null),pn===null)throw Error(ee(349));ml&30||RO(n,t,o)}return o}function RO(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function AO(e,t,n,r){t.value=n,t.getSnapshot=r,DO(t)&&LO(e)}function IO(e,t,n){return n(function(){DO(t)&&LO(e)})}function DO(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ao(e,n)}catch{return!0}}function LO(e){var t=Wi(e,1);t!==null&&Po(t,e,1,-1)}function CE(e){var t=Xo();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:hf,lastRenderedState:e},t.queue=e,e=e.dispatch=qF.bind(null,Rt,e),[t.memoizedState,e]}function mf(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Rt.updateQueue,t===null?(t={lastEffect:null,stores:null},Rt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function FO(){return no().memoizedState}function Uh(e,t,n,r){var o=Xo();Rt.flags|=e,o.memoizedState=mf(1|t,n,void 0,r===void 0?null:r)}function tv(e,t,n,r){var o=no();r=r===void 0?null:r;var i=void 0;if(Xt!==null){var s=Xt.memoizedState;if(i=s.destroy,r!==null&&Uw(r,s.deps)){o.memoizedState=mf(t,n,i,r);return}}Rt.flags|=e,o.memoizedState=mf(1|t,n,i,r)}function _E(e,t){return Uh(8390656,8,e,t)}function Kw(e,t){return tv(2048,8,e,t)}function zO(e,t){return tv(4,2,e,t)}function BO(e,t){return tv(4,4,e,t)}function $O(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function VO(e,t,n){return n=n!=null?n.concat([e]):null,tv(4,4,$O.bind(null,t,e),n)}function qw(){}function UO(e,t){var n=no();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Uw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function HO(e,t){var n=no();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Uw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function WO(e,t,n){return ml&21?(Ao(n,t)||(n=JT(),Rt.lanes|=n,gl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,rr=!0),e.memoizedState=n)}function WF(e,t){var n=dt;dt=n!==0&&4>n?n:4,e(!0);var r=By.transition;By.transition={};try{e(!1),t()}finally{dt=n,By.transition=r}}function KO(){return no().memoizedState}function KF(e,t,n){var r=Js(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},qO(e))GO(t,n);else if(n=TO(e,t,n,r),n!==null){var o=Wn();Po(n,e,r,o),YO(n,t,r)}}function qF(e,t,n){var r=Js(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(qO(e))GO(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Ao(a,s)){var l=t.interleaved;l===null?(o.next=o,Fw(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=TO(e,t,o,r),n!==null&&(o=Wn(),Po(n,e,r,o),YO(n,t,r))}}function qO(e){var t=e.alternate;return e===Rt||t!==null&&t===Rt}function GO(e,t){Bd=Am=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function YO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ew(e,n)}}var Im={readContext:to,useCallback:jn,useContext:jn,useEffect:jn,useImperativeHandle:jn,useInsertionEffect:jn,useLayoutEffect:jn,useMemo:jn,useReducer:jn,useRef:jn,useState:jn,useDebugValue:jn,useDeferredValue:jn,useTransition:jn,useMutableSource:jn,useSyncExternalStore:jn,useId:jn,unstable_isNewReconciler:!1},GF={readContext:to,useCallback:function(e,t){return Xo().memoizedState=[e,t===void 0?null:t],e},useContext:to,useEffect:_E,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Uh(4194308,4,$O.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Uh(4194308,4,e,t)},useInsertionEffect:function(e,t){return Uh(4,2,e,t)},useMemo:function(e,t){var n=Xo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Xo();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=KF.bind(null,Rt,e),[r.memoizedState,e]},useRef:function(e){var t=Xo();return e={current:e},t.memoizedState=e},useState:CE,useDebugValue:qw,useDeferredValue:function(e){return Xo().memoizedState=e},useTransition:function(){var e=CE(!1),t=e[0];return e=WF.bind(null,e[1]),Xo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Rt,o=Xo();if(Ct){if(n===void 0)throw Error(ee(407));n=n()}else{if(n=t(),pn===null)throw Error(ee(349));ml&30||RO(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,_E(IO.bind(null,r,i,e),[e]),r.flags|=2048,mf(9,AO.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Xo(),t=pn.identifierPrefix;if(Ct){var n=Ii,r=Ai;n=(r&~(1<<32-Mo(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=pf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=HF++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},YF={readContext:to,useCallback:UO,useContext:to,useEffect:Kw,useImperativeHandle:VO,useInsertionEffect:zO,useLayoutEffect:BO,useMemo:HO,useReducer:$y,useRef:FO,useState:function(){return $y(hf)},useDebugValue:qw,useDeferredValue:function(e){var t=no();return WO(t,Xt.memoizedState,e)},useTransition:function(){var e=$y(hf)[0],t=no().memoizedState;return[e,t]},useMutableSource:PO,useSyncExternalStore:jO,useId:KO,unstable_isNewReconciler:!1},JF={readContext:to,useCallback:UO,useContext:to,useEffect:Kw,useImperativeHandle:VO,useInsertionEffect:zO,useLayoutEffect:BO,useMemo:HO,useReducer:Vy,useRef:FO,useState:function(){return Vy(hf)},useDebugValue:qw,useDeferredValue:function(e){var t=no();return Xt===null?t.memoizedState=e:WO(t,Xt.memoizedState,e)},useTransition:function(){var e=Vy(hf)[0],t=no().memoizedState;return[e,t]},useMutableSource:PO,useSyncExternalStore:jO,useId:KO,unstable_isNewReconciler:!1};function xo(e,t){if(e&&e.defaultProps){t=At({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ex(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:At({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var nv={isMounted:function(e){return(e=e._reactInternals)?Al(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wn(),o=Js(e),i=Bi(r,o);i.payload=t,n!=null&&(i.callback=n),t=Gs(e,i,o),t!==null&&(Po(t,e,o,r),$h(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wn(),o=Js(e),i=Bi(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Gs(e,i,o),t!==null&&(Po(t,e,o,r),$h(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wn(),r=Js(e),o=Bi(n,r);o.tag=2,t!=null&&(o.callback=t),t=Gs(e,o,r),t!==null&&(Po(t,e,r,n),$h(t,e,r))}};function NE(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!af(n,r)||!af(o,i):!0}function JO(e,t,n){var r=!1,o=sa,i=t.contextType;return typeof i=="object"&&i!==null?i=to(i):(o=ar(t)?pl:Fn.current,r=t.contextTypes,i=(r=r!=null)?Vc(e,o):sa),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=nv,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function TE(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&nv.enqueueReplaceState(t,t.state,null)}function Cx(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},zw(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=to(i):(i=ar(t)?pl:Fn.current,o.context=Vc(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ex(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&nv.enqueueReplaceState(o,o.state,null),jm(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Kc(e,t){try{var n="",r=t;do n+=E3(r),r=r.return;while(r);var o=n}catch(i){o=`
31
- Error generating stack: `+i.message+`
32
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function Uy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function _x(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var XF=typeof WeakMap=="function"?WeakMap:Map;function XO(e,t,n){n=Bi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Lm||(Lm=!0,Dx=r),_x(e,t)},n}function ZO(e,t,n){n=Bi(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){_x(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){_x(e,t),typeof r!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function OE(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new XF;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=d5.bind(null,e,t,n),t.then(e,e))}function ME(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function PE(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Bi(-1,1),t.tag=2,Gs(n,t,1))),n.lanes|=1),e)}var ZF=es.ReactCurrentOwner,rr=!1;function Un(e,t,n,r){t.child=e===null?NO(t,null,n,r):Hc(t,e.child,n,r)}function jE(e,t,n,r,o){n=n.render;var i=t.ref;return _c(t,o),r=Hw(e,t,n,r,i,o),n=Ww(),e!==null&&!rr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ki(e,t,o)):(Ct&&n&&jw(t),t.flags|=1,Un(e,t,r,o),t.child)}function RE(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!t1(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,QO(e,t,i,r,o)):(e=qh(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:af,n(s,r)&&e.ref===t.ref)return Ki(e,t,o)}return t.flags|=1,e=Xs(i,r),e.ref=t.ref,e.return=t,t.child=e}function QO(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(af(i,r)&&e.ref===t.ref)if(rr=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(rr=!0);else return t.lanes=e.lanes,Ki(e,t,o)}return Nx(e,t,n,r,o)}function eM(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xt(xc,Er),Er|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xt(xc,Er),Er|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,xt(xc,Er),Er|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,xt(xc,Er),Er|=r;return Un(e,t,o,n),t.child}function tM(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Nx(e,t,n,r,o){var i=ar(n)?pl:Fn.current;return i=Vc(t,i),_c(t,o),n=Hw(e,t,n,r,i,o),r=Ww(),e!==null&&!rr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ki(e,t,o)):(Ct&&r&&jw(t),t.flags|=1,Un(e,t,n,o),t.child)}function AE(e,t,n,r,o){if(ar(n)){var i=!0;Nm(t)}else i=!1;if(_c(t,o),t.stateNode===null)Hh(e,t),JO(t,n,r),Cx(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=to(c):(c=ar(n)?pl:Fn.current,c=Vc(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&TE(t,s,r,c),_s=!1;var p=t.memoizedState;s.state=p,jm(t,r,s,o),l=t.memoizedState,a!==r||p!==l||sr.current||_s?(typeof u=="function"&&(Ex(t,n,u,r),l=t.memoizedState),(a=_s||NE(t,n,a,r,p,l,c))?(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"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,OO(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:xo(t.type,a),s.props=c,d=t.pendingProps,p=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=to(l):(l=ar(n)?pl:Fn.current,l=Vc(t,l));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||p!==l)&&TE(t,s,r,l),_s=!1,p=t.memoizedState,s.state=p,jm(t,r,s,o);var m=t.memoizedState;a!==d||p!==m||sr.current||_s?(typeof h=="function"&&(Ex(t,n,h,r),m=t.memoizedState),(c=_s||NE(t,n,c,r,p,m,l)||!1)?(u||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Tx(e,t,n,r,i,o)}function Tx(e,t,n,r,o,i){tM(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&xE(t,n,!1),Ki(e,t,i);r=t.stateNode,ZF.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Hc(t,e.child,null,i),t.child=Hc(t,null,a,i)):Un(e,t,a,i),t.memoizedState=r.state,o&&xE(t,n,!0),t.child}function nM(e){var t=e.stateNode;t.pendingContext?yE(e,t.pendingContext,t.pendingContext!==t.context):t.context&&yE(e,t.context,!1),Bw(e,t.containerInfo)}function IE(e,t,n,r,o){return Uc(),Aw(o),t.flags|=256,Un(e,t,n,r),t.child}var Ox={dehydrated:null,treeContext:null,retryLane:0};function Mx(e){return{baseLanes:e,cachePool:null,transitions:null}}function rM(e,t,n){var r=t.pendingProps,o=Pt.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),xt(Pt,o&1),e===null)return Sx(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=iv(s,r,0,null),e=rl(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Mx(n),t.memoizedState=Ox,e):Gw(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return QF(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Xs(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Xs(a,i):(i=rl(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Mx(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Ox,r}return i=e.child,e=i.sibling,r=Xs(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Gw(e,t){return t=iv({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function mh(e,t,n,r){return r!==null&&Aw(r),Hc(t,e.child,null,n),e=Gw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function QF(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Uy(Error(ee(422))),mh(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=iv({mode:"visible",children:r.children},o,0,null),i=rl(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Hc(t,e.child,null,s),t.child.memoizedState=Mx(s),t.memoizedState=Ox,i);if(!(t.mode&1))return mh(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(ee(419)),r=Uy(i,r,void 0),mh(e,t,s,r)}if(a=(s&e.childLanes)!==0,rr||a){if(r=pn,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,Wi(e,o),Po(r,e,o,-1))}return e1(),r=Uy(Error(ee(421))),mh(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=f5.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Tr=qs(o.nextSibling),Mr=t,Ct=!0,So=null,e!==null&&(qr[Gr++]=Ai,qr[Gr++]=Ii,qr[Gr++]=hl,Ai=e.id,Ii=e.overflow,hl=t),t=Gw(t,r.children),t.flags|=4096,t)}function DE(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),kx(e.return,t,n)}function Hy(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function oM(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Un(e,t,r.children,n),r=Pt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&DE(e,n,t);else if(e.tag===19)DE(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(xt(Pt,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Rm(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Hy(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Rm(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Hy(t,!0,n,null,i);break;case"together":Hy(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ki(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gl|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ee(153));if(t.child!==null){for(e=t.child,n=Xs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function e5(e,t,n){switch(t.tag){case 3:nM(t),Uc();break;case 5:MO(t);break;case 1:ar(t.type)&&Nm(t);break;case 4:Bw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;xt(Mm,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(xt(Pt,Pt.current&1),t.flags|=128,null):n&t.child.childLanes?rM(e,t,n):(xt(Pt,Pt.current&1),e=Ki(e,t,n),e!==null?e.sibling:null);xt(Pt,Pt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return oM(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),xt(Pt,Pt.current),r)break;return null;case 22:case 23:return t.lanes=0,eM(e,t,n)}return Ki(e,t,n)}var iM,Px,sM,aM;iM=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Px=function(){};sM=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Ga(ri.current);var i=null;switch(n){case"input":o=Q0(e,o),r=Q0(e,r),i=[];break;case"select":o=At({},o,{value:void 0}),r=At({},r,{value:void 0}),i=[];break;case"textarea":o=nx(e,o),r=nx(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Cm)}ox(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Qd.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Qd.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&kt("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};aM=function(e,t,n,r){n!==r&&(t.flags|=4)};function Hu(e,t){if(!Ct)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Rn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function t5(e,t,n){var r=t.pendingProps;switch(Rw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rn(t),null;case 1:return ar(t.type)&&_m(),Rn(t),null;case 3:return r=t.stateNode,Wc(),Et(sr),Et(Fn),Vw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ph(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,So!==null&&(zx(So),So=null))),Px(e,t),Rn(t),null;case 5:$w(t);var o=Ga(ff.current);if(n=t.type,e!==null&&t.stateNode!=null)sM(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ee(166));return Rn(t),null}if(e=Ga(ri.current),ph(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Qo]=t,r[uf]=i,e=(t.mode&1)!==0,n){case"dialog":kt("cancel",r),kt("close",r);break;case"iframe":case"object":case"embed":kt("load",r);break;case"video":case"audio":for(o=0;o<id.length;o++)kt(id[o],r);break;case"source":kt("error",r);break;case"img":case"image":case"link":kt("error",r),kt("load",r);break;case"details":kt("toggle",r);break;case"input":Wk(r,i),kt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},kt("invalid",r);break;case"textarea":qk(r,i),kt("invalid",r)}ox(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&&fh(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&fh(r.textContent,a,e),o=["children",""+a]):Qd.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&kt("scroll",r)}switch(n){case"input":oh(r),Kk(r,i,!0);break;case"textarea":oh(r),Gk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Cm)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=IT(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Qo]=t,e[uf]=r,iM(e,t,!1,!1),t.stateNode=e;e:{switch(s=ix(n,r),n){case"dialog":kt("cancel",e),kt("close",e),o=r;break;case"iframe":case"object":case"embed":kt("load",e),o=r;break;case"video":case"audio":for(o=0;o<id.length;o++)kt(id[o],e);o=r;break;case"source":kt("error",e),o=r;break;case"img":case"image":case"link":kt("error",e),kt("load",e),o=r;break;case"details":kt("toggle",e),o=r;break;case"input":Wk(e,r),o=Q0(e,r),kt("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=At({},r,{value:void 0}),kt("invalid",e);break;case"textarea":qk(e,r),o=nx(e,r),kt("invalid",e);break;default:o=r}ox(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?FT(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&DT(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&ef(e,l):typeof l=="number"&&ef(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Qd.hasOwnProperty(i)?l!=null&&i==="onScroll"&&kt("scroll",e):l!=null&&yw(e,i,l,s))}switch(n){case"input":oh(e),Kk(e,r,!1);break;case"textarea":oh(e),Gk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ia(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Sc(e,!!r.multiple,i,!1):r.defaultValue!=null&&Sc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Cm)}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&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Rn(t),null;case 6:if(e&&t.stateNode!=null)aM(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ee(166));if(n=Ga(ff.current),Ga(ri.current),ph(t)){if(r=t.stateNode,n=t.memoizedProps,r[Qo]=t,(i=r.nodeValue!==n)&&(e=Mr,e!==null))switch(e.tag){case 3:fh(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&fh(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Qo]=t,t.stateNode=r}return Rn(t),null;case 13:if(Et(Pt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ct&&Tr!==null&&t.mode&1&&!(t.flags&128))CO(),Uc(),t.flags|=98560,i=!1;else if(i=ph(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ee(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ee(317));i[Qo]=t}else Uc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rn(t),i=!1}else So!==null&&(zx(So),So=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Pt.current&1?en===0&&(en=3):e1())),t.updateQueue!==null&&(t.flags|=4),Rn(t),null);case 4:return Wc(),Px(e,t),e===null&&lf(t.stateNode.containerInfo),Rn(t),null;case 10:return Lw(t.type._context),Rn(t),null;case 17:return ar(t.type)&&_m(),Rn(t),null;case 19:if(Et(Pt),i=t.memoizedState,i===null)return Rn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Hu(i,!1);else{if(en!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Rm(e),s!==null){for(t.flags|=128,Hu(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,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,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return xt(Pt,Pt.current&1|2),t.child}e=e.sibling}i.tail!==null&&Bt()>qc&&(t.flags|=128,r=!0,Hu(i,!1),t.lanes=4194304)}else{if(!r)if(e=Rm(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Hu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ct)return Rn(t),null}else 2*Bt()-i.renderingStartTime>qc&&n!==1073741824&&(t.flags|=128,r=!0,Hu(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Bt(),t.sibling=null,n=Pt.current,xt(Pt,r?n&1|2:n&1),t):(Rn(t),null);case 22:case 23:return Qw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Er&1073741824&&(Rn(t),t.subtreeFlags&6&&(t.flags|=8192)):Rn(t),null;case 24:return null;case 25:return null}throw Error(ee(156,t.tag))}function n5(e,t){switch(Rw(t),t.tag){case 1:return ar(t.type)&&_m(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wc(),Et(sr),Et(Fn),Vw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return $w(t),null;case 13:if(Et(Pt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ee(340));Uc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Et(Pt),null;case 4:return Wc(),null;case 10:return Lw(t.type._context),null;case 22:case 23:return Qw(),null;case 24:return null;default:return null}}var gh=!1,Dn=!1,r5=typeof WeakSet=="function"?WeakSet:Set,ye=null;function yc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){It(e,t,r)}else n.current=null}function jx(e,t,n){try{n()}catch(r){It(e,t,r)}}var LE=!1;function o5(e,t){if(mx=Sm,e=fO(),Pw(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.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,l=-1,c=0,u=0,d=e,p=null;t:for(;;){for(var h;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(h=d.firstChild)!==null;)p=d,d=h;for(;;){if(d===e)break t;if(p===n&&++c===o&&(a=s),p===i&&++u===r&&(l=s),(h=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(gx={focusedElem:e,selectionRange:n},Sm=!1,ye=t;ye!==null;)if(t=ye,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ye=e;else for(;ye!==null;){t=ye;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,b=m.memoizedState,x=t.stateNode,w=x.getSnapshotBeforeUpdate(t.elementType===t.type?v:xo(t.type,v),b);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ee(163))}}catch(C){It(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,ye=e;break}ye=t.return}return m=LE,LE=!1,m}function $d(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&jx(t,n,i)}o=o.next}while(o!==r)}}function rv(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Rx(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function lM(e){var t=e.alternate;t!==null&&(e.alternate=null,lM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qo],delete t[uf],delete t[xx],delete t[BF],delete t[$F])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function cM(e){return e.tag===5||e.tag===3||e.tag===4}function FE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cM(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ax(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Cm));else if(r!==4&&(e=e.child,e!==null))for(Ax(e,t,n),e=e.sibling;e!==null;)Ax(e,t,n),e=e.sibling}function Ix(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ix(e,t,n),e=e.sibling;e!==null;)Ix(e,t,n),e=e.sibling}var yn=null,wo=!1;function ds(e,t,n){for(n=n.child;n!==null;)uM(e,t,n),n=n.sibling}function uM(e,t,n){if(ni&&typeof ni.onCommitFiberUnmount=="function")try{ni.onCommitFiberUnmount(Yg,n)}catch{}switch(n.tag){case 5:Dn||yc(n,t);case 6:var r=yn,o=wo;yn=null,ds(e,t,n),yn=r,wo=o,yn!==null&&(wo?(e=yn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):yn.removeChild(n.stateNode));break;case 18:yn!==null&&(wo?(e=yn,n=n.stateNode,e.nodeType===8?Ly(e.parentNode,n):e.nodeType===1&&Ly(e,n),of(e)):Ly(yn,n.stateNode));break;case 4:r=yn,o=wo,yn=n.stateNode.containerInfo,wo=!0,ds(e,t,n),yn=r,wo=o;break;case 0:case 11:case 14:case 15:if(!Dn&&(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)&&jx(n,t,s),o=o.next}while(o!==r)}ds(e,t,n);break;case 1:if(!Dn&&(yc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){It(n,t,a)}ds(e,t,n);break;case 21:ds(e,t,n);break;case 22:n.mode&1?(Dn=(r=Dn)||n.memoizedState!==null,ds(e,t,n),Dn=r):ds(e,t,n);break;default:ds(e,t,n)}}function zE(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new r5),t.forEach(function(r){var o=p5.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function po(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:yn=a.stateNode,wo=!1;break e;case 3:yn=a.stateNode.containerInfo,wo=!0;break e;case 4:yn=a.stateNode.containerInfo,wo=!0;break e}a=a.return}if(yn===null)throw Error(ee(160));uM(i,s,o),yn=null,wo=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){It(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)dM(t,e),t=t.sibling}function dM(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(po(t,e),Yo(e),r&4){try{$d(3,e,e.return),rv(3,e)}catch(v){It(e,e.return,v)}try{$d(5,e,e.return)}catch(v){It(e,e.return,v)}}break;case 1:po(t,e),Yo(e),r&512&&n!==null&&yc(n,n.return);break;case 5:if(po(t,e),Yo(e),r&512&&n!==null&&yc(n,n.return),e.flags&32){var o=e.stateNode;try{ef(o,"")}catch(v){It(e,e.return,v)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&RT(o,i),ix(a,s);var c=ix(a,i);for(s=0;s<l.length;s+=2){var u=l[s],d=l[s+1];u==="style"?FT(o,d):u==="dangerouslySetInnerHTML"?DT(o,d):u==="children"?ef(o,d):yw(o,u,d,c)}switch(a){case"input":ex(o,i);break;case"textarea":AT(o,i);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Sc(o,!!i.multiple,h,!1):p!==!!i.multiple&&(i.defaultValue!=null?Sc(o,!!i.multiple,i.defaultValue,!0):Sc(o,!!i.multiple,i.multiple?[]:"",!1))}o[uf]=i}catch(v){It(e,e.return,v)}}break;case 6:if(po(t,e),Yo(e),r&4){if(e.stateNode===null)throw Error(ee(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){It(e,e.return,v)}}break;case 3:if(po(t,e),Yo(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{of(t.containerInfo)}catch(v){It(e,e.return,v)}break;case 4:po(t,e),Yo(e);break;case 13:po(t,e),Yo(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Xw=Bt())),r&4&&zE(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Dn=(c=Dn)||u,po(t,e),Dn=c):po(t,e),Yo(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(ye=e,u=e.child;u!==null;){for(d=ye=u;ye!==null;){switch(p=ye,h=p.child,p.tag){case 0:case 11:case 14:case 15:$d(4,p,p.return);break;case 1:yc(p,p.return);var m=p.stateNode;if(typeof m.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(v){It(r,n,v)}}break;case 5:yc(p,p.return);break;case 22:if(p.memoizedState!==null){$E(d);continue}}h!==null?(h.return=p,ye=h):$E(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{o=d.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=d.stateNode,l=d.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=LT("display",s))}catch(v){It(e,e.return,v)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(v){It(e,e.return,v)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:po(t,e),Yo(e),r&4&&zE(e);break;case 21:break;default:po(t,e),Yo(e)}}function Yo(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(cM(n)){var r=n;break e}n=n.return}throw Error(ee(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(ef(o,""),r.flags&=-33);var i=FE(e);Ix(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=FE(e);Ax(e,a,s);break;default:throw Error(ee(161))}}catch(l){It(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function i5(e,t,n){ye=e,fM(e)}function fM(e,t,n){for(var r=(e.mode&1)!==0;ye!==null;){var o=ye,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||gh;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Dn;a=gh;var c=Dn;if(gh=s,(Dn=l)&&!c)for(ye=o;ye!==null;)s=ye,l=s.child,s.tag===22&&s.memoizedState!==null?VE(o):l!==null?(l.return=s,ye=l):VE(o);for(;i!==null;)ye=i,fM(i),i=i.sibling;ye=o,gh=a,Dn=c}BE(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ye=i):BE(e)}}function BE(e){for(;ye!==null;){var t=ye;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Dn||rv(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Dn)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:xo(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&EE(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}EE(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&of(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ee(163))}Dn||t.flags&512&&Rx(t)}catch(p){It(t,t.return,p)}}if(t===e){ye=null;break}if(n=t.sibling,n!==null){n.return=t.return,ye=n;break}ye=t.return}}function $E(e){for(;ye!==null;){var t=ye;if(t===e){ye=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ye=n;break}ye=t.return}}function VE(e){for(;ye!==null;){var t=ye;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{rv(4,t)}catch(l){It(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){It(t,o,l)}}var i=t.return;try{Rx(t)}catch(l){It(t,i,l)}break;case 5:var s=t.return;try{Rx(t)}catch(l){It(t,s,l)}}}catch(l){It(t,t.return,l)}if(t===e){ye=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ye=a;break}ye=t.return}}var s5=Math.ceil,Dm=es.ReactCurrentDispatcher,Yw=es.ReactCurrentOwner,Xr=es.ReactCurrentBatchConfig,tt=0,pn=null,Kt=null,Sn=0,Er=0,xc=Ca(0),en=0,gf=null,gl=0,ov=0,Jw=0,Vd=null,nr=null,Xw=0,qc=1/0,Ni=null,Lm=!1,Dx=null,Ys=null,vh=!1,zs=null,Fm=0,Ud=0,Lx=null,Wh=-1,Kh=0;function Wn(){return tt&6?Bt():Wh!==-1?Wh:Wh=Bt()}function Js(e){return e.mode&1?tt&2&&Sn!==0?Sn&-Sn:UF.transition!==null?(Kh===0&&(Kh=JT()),Kh):(e=dt,e!==0||(e=window.event,e=e===void 0?16:rO(e.type)),e):1}function Po(e,t,n,r){if(50<Ud)throw Ud=0,Lx=null,Error(ee(185));gp(e,n,r),(!(tt&2)||e!==pn)&&(e===pn&&(!(tt&2)&&(ov|=n),en===4&&Ps(e,Sn)),lr(e,r),n===1&&tt===0&&!(t.mode&1)&&(qc=Bt()+500,ev&&_a()))}function lr(e,t){var n=e.callbackNode;U3(e,t);var r=wm(e,e===pn?Sn:0);if(r===0)n!==null&&Xk(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Xk(n),t===1)e.tag===0?VF(UE.bind(null,e)):SO(UE.bind(null,e)),FF(function(){!(tt&6)&&_a()}),n=null;else{switch(XT(r)){case 1:n=kw;break;case 4:n=GT;break;case 16:n=bm;break;case 536870912:n=YT;break;default:n=bm}n=bM(n,pM.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function pM(e,t){if(Wh=-1,Kh=0,tt&6)throw Error(ee(327));var n=e.callbackNode;if(Nc()&&e.callbackNode!==n)return null;var r=wm(e,e===pn?Sn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=zm(e,r);else{t=r;var o=tt;tt|=2;var i=mM();(pn!==e||Sn!==t)&&(Ni=null,qc=Bt()+500,nl(e,t));do try{c5();break}catch(a){hM(e,a)}while(!0);Dw(),Dm.current=i,tt=o,Kt!==null?t=0:(pn=null,Sn=0,t=en)}if(t!==0){if(t===2&&(o=ux(e),o!==0&&(r=o,t=Fx(e,o))),t===1)throw n=gf,nl(e,0),Ps(e,r),lr(e,Bt()),n;if(t===6)Ps(e,r);else{if(o=e.current.alternate,!(r&30)&&!a5(o)&&(t=zm(e,r),t===2&&(i=ux(e),i!==0&&(r=i,t=Fx(e,i))),t===1))throw n=gf,nl(e,0),Ps(e,r),lr(e,Bt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(ee(345));case 2:Fa(e,nr,Ni);break;case 3:if(Ps(e,r),(r&130023424)===r&&(t=Xw+500-Bt(),10<t)){if(wm(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Wn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=yx(Fa.bind(null,e,nr,Ni),t);break}Fa(e,nr,Ni);break;case 4:if(Ps(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Mo(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=Bt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*s5(r/1960))-r,10<r){e.timeoutHandle=yx(Fa.bind(null,e,nr,Ni),r);break}Fa(e,nr,Ni);break;case 5:Fa(e,nr,Ni);break;default:throw Error(ee(329))}}}return lr(e,Bt()),e.callbackNode===n?pM.bind(null,e):null}function Fx(e,t){var n=Vd;return e.current.memoizedState.isDehydrated&&(nl(e,t).flags|=256),e=zm(e,t),e!==2&&(t=nr,nr=n,t!==null&&zx(t)),e}function zx(e){nr===null?nr=e:nr.push.apply(nr,e)}function a5(e){for(var t=e;;){if(t.flags&16384){var n=t.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(!Ao(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ps(e,t){for(t&=~Jw,t&=~ov,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Mo(t),r=1<<n;e[n]=-1,t&=~r}}function UE(e){if(tt&6)throw Error(ee(327));Nc();var t=wm(e,0);if(!(t&1))return lr(e,Bt()),null;var n=zm(e,t);if(e.tag!==0&&n===2){var r=ux(e);r!==0&&(t=r,n=Fx(e,r))}if(n===1)throw n=gf,nl(e,0),Ps(e,t),lr(e,Bt()),n;if(n===6)throw Error(ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fa(e,nr,Ni),lr(e,Bt()),null}function Zw(e,t){var n=tt;tt|=1;try{return e(t)}finally{tt=n,tt===0&&(qc=Bt()+500,ev&&_a())}}function vl(e){zs!==null&&zs.tag===0&&!(tt&6)&&Nc();var t=tt;tt|=1;var n=Xr.transition,r=dt;try{if(Xr.transition=null,dt=1,e)return e()}finally{dt=r,Xr.transition=n,tt=t,!(tt&6)&&_a()}}function Qw(){Er=xc.current,Et(xc)}function nl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,LF(n)),Kt!==null)for(n=Kt.return;n!==null;){var r=n;switch(Rw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&_m();break;case 3:Wc(),Et(sr),Et(Fn),Vw();break;case 5:$w(r);break;case 4:Wc();break;case 13:Et(Pt);break;case 19:Et(Pt);break;case 10:Lw(r.type._context);break;case 22:case 23:Qw()}n=n.return}if(pn=e,Kt=e=Xs(e.current,null),Sn=Er=t,en=0,gf=null,Jw=ov=gl=0,nr=Vd=null,qa!==null){for(t=0;t<qa.length;t++)if(n=qa[t],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}qa=null}return e}function hM(e,t){do{var n=Kt;try{if(Dw(),Vh.current=Im,Am){for(var r=Rt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Am=!1}if(ml=0,cn=Xt=Rt=null,Bd=!1,pf=0,Yw.current=null,n===null||n.return===null){en=1,gf=t,Kt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Sn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=ME(s);if(h!==null){h.flags&=-257,PE(h,s,a,i,t),h.mode&1&&OE(i,c,t),t=h,l=c;var m=t.updateQueue;if(m===null){var v=new Set;v.add(l),t.updateQueue=v}else m.add(l);break e}else{if(!(t&1)){OE(i,c,t),e1();break e}l=Error(ee(426))}}else if(Ct&&a.mode&1){var b=ME(s);if(b!==null){!(b.flags&65536)&&(b.flags|=256),PE(b,s,a,i,t),Aw(Kc(l,a));break e}}i=l=Kc(l,a),en!==4&&(en=2),Vd===null?Vd=[i]:Vd.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=XO(i,l,t);kE(i,x);break e;case 1:a=l;var w=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Ys===null||!Ys.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=ZO(i,a,t);kE(i,C);break e}}i=i.return}while(i!==null)}vM(n)}catch(_){t=_,Kt===n&&n!==null&&(Kt=n=n.return);continue}break}while(!0)}function mM(){var e=Dm.current;return Dm.current=Im,e===null?Im:e}function e1(){(en===0||en===3||en===2)&&(en=4),pn===null||!(gl&268435455)&&!(ov&268435455)||Ps(pn,Sn)}function zm(e,t){var n=tt;tt|=2;var r=mM();(pn!==e||Sn!==t)&&(Ni=null,nl(e,t));do try{l5();break}catch(o){hM(e,o)}while(!0);if(Dw(),tt=n,Dm.current=r,Kt!==null)throw Error(ee(261));return pn=null,Sn=0,en}function l5(){for(;Kt!==null;)gM(Kt)}function c5(){for(;Kt!==null&&!A3();)gM(Kt)}function gM(e){var t=xM(e.alternate,e,Er);e.memoizedProps=e.pendingProps,t===null?vM(e):Kt=t,Yw.current=null}function vM(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=n5(n,t),n!==null){n.flags&=32767,Kt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{en=6,Kt=null;return}}else if(n=t5(n,t,Er),n!==null){Kt=n;return}if(t=t.sibling,t!==null){Kt=t;return}Kt=t=e}while(t!==null);en===0&&(en=5)}function Fa(e,t,n){var r=dt,o=Xr.transition;try{Xr.transition=null,dt=1,u5(e,t,n,r)}finally{Xr.transition=o,dt=r}return null}function u5(e,t,n,r){do Nc();while(zs!==null);if(tt&6)throw Error(ee(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ee(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(H3(e,i),e===pn&&(Kt=pn=null,Sn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||vh||(vh=!0,bM(bm,function(){return Nc(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Xr.transition,Xr.transition=null;var s=dt;dt=1;var a=tt;tt|=4,Yw.current=null,o5(e,n),dM(n,e),MF(gx),Sm=!!mx,gx=mx=null,e.current=n,i5(n),I3(),tt=a,dt=s,Xr.transition=i}else e.current=n;if(vh&&(vh=!1,zs=e,Fm=o),i=e.pendingLanes,i===0&&(Ys=null),F3(n.stateNode),lr(e,Bt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Lm)throw Lm=!1,e=Dx,Dx=null,e;return Fm&1&&e.tag!==0&&Nc(),i=e.pendingLanes,i&1?e===Lx?Ud++:(Ud=0,Lx=e):Ud=0,_a(),null}function Nc(){if(zs!==null){var e=XT(Fm),t=Xr.transition,n=dt;try{if(Xr.transition=null,dt=16>e?16:e,zs===null)var r=!1;else{if(e=zs,zs=null,Fm=0,tt&6)throw Error(ee(331));var o=tt;for(tt|=4,ye=e.current;ye!==null;){var i=ye,s=i.child;if(ye.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ye=c;ye!==null;){var u=ye;switch(u.tag){case 0:case 11:case 15:$d(8,u,i)}var d=u.child;if(d!==null)d.return=u,ye=d;else for(;ye!==null;){u=ye;var p=u.sibling,h=u.return;if(lM(u),u===c){ye=null;break}if(p!==null){p.return=h,ye=p;break}ye=h}}}var m=i.alternate;if(m!==null){var v=m.child;if(v!==null){m.child=null;do{var b=v.sibling;v.sibling=null,v=b}while(v!==null)}}ye=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ye=s;else e:for(;ye!==null;){if(i=ye,i.flags&2048)switch(i.tag){case 0:case 11:case 15:$d(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,ye=x;break e}ye=i.return}}var w=e.current;for(ye=w;ye!==null;){s=ye;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,ye=k;else e:for(s=w;ye!==null;){if(a=ye,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:rv(9,a)}}catch(_){It(a,a.return,_)}if(a===s){ye=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,ye=C;break e}ye=a.return}}if(tt=o,_a(),ni&&typeof ni.onPostCommitFiberRoot=="function")try{ni.onPostCommitFiberRoot(Yg,e)}catch{}r=!0}return r}finally{dt=n,Xr.transition=t}}return!1}function HE(e,t,n){t=Kc(n,t),t=XO(e,t,1),e=Gs(e,t,1),t=Wn(),e!==null&&(gp(e,1,t),lr(e,t))}function It(e,t,n){if(e.tag===3)HE(e,e,n);else for(;t!==null;){if(t.tag===3){HE(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ys===null||!Ys.has(r))){e=Kc(n,e),e=ZO(t,e,1),t=Gs(t,e,1),e=Wn(),t!==null&&(gp(t,1,e),lr(t,e));break}}t=t.return}}function d5(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Wn(),e.pingedLanes|=e.suspendedLanes&n,pn===e&&(Sn&n)===n&&(en===4||en===3&&(Sn&130023424)===Sn&&500>Bt()-Xw?nl(e,0):Jw|=n),lr(e,t)}function yM(e,t){t===0&&(e.mode&1?(t=ah,ah<<=1,!(ah&130023424)&&(ah=4194304)):t=1);var n=Wn();e=Wi(e,t),e!==null&&(gp(e,t,n),lr(e,n))}function f5(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),yM(e,n)}function p5(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ee(314))}r!==null&&r.delete(t),yM(e,n)}var xM;xM=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||sr.current)rr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return rr=!1,e5(e,t,n);rr=!!(e.flags&131072)}else rr=!1,Ct&&t.flags&1048576&&kO(t,Om,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hh(e,t),e=t.pendingProps;var o=Vc(t,Fn.current);_c(t,n),o=Hw(null,t,r,e,o,n);var i=Ww();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ar(r)?(i=!0,Nm(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,zw(t),o.updater=nv,t.stateNode=o,o._reactInternals=t,Cx(t,r,e,n),t=Tx(null,t,r,!0,i,n)):(t.tag=0,Ct&&i&&jw(t),Un(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hh(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=m5(r),e=xo(r,e),o){case 0:t=Nx(null,t,r,e,n);break e;case 1:t=AE(null,t,r,e,n);break e;case 11:t=jE(null,t,r,e,n);break e;case 14:t=RE(null,t,r,xo(r.type,e),n);break e}throw Error(ee(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:xo(r,o),Nx(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:xo(r,o),AE(e,t,r,o,n);case 3:e:{if(nM(t),e===null)throw Error(ee(387));r=t.pendingProps,i=t.memoizedState,o=i.element,OO(e,t),jm(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Kc(Error(ee(423)),t),t=IE(e,t,r,n,o);break e}else if(r!==o){o=Kc(Error(ee(424)),t),t=IE(e,t,r,n,o);break e}else for(Tr=qs(t.stateNode.containerInfo.firstChild),Mr=t,Ct=!0,So=null,n=NO(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Uc(),r===o){t=Ki(e,t,n);break e}Un(e,t,r,n)}t=t.child}return t;case 5:return MO(t),e===null&&Sx(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,vx(r,o)?s=null:i!==null&&vx(r,i)&&(t.flags|=32),tM(e,t),Un(e,t,s,n),t.child;case 6:return e===null&&Sx(t),null;case 13:return rM(e,t,n);case 4:return Bw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hc(t,null,r,n):Un(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:xo(r,o),jE(e,t,r,o,n);case 7:return Un(e,t,t.pendingProps,n),t.child;case 8:return Un(e,t,t.pendingProps.children,n),t.child;case 12:return Un(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,xt(Mm,r._currentValue),r._currentValue=s,i!==null)if(Ao(i.value,s)){if(i.children===o.children&&!sr.current){t=Ki(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Bi(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),kx(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(ee(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),kx(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Un(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,_c(t,n),o=to(o),r=r(o),t.flags|=1,Un(e,t,r,n),t.child;case 14:return r=t.type,o=xo(r,t.pendingProps),o=xo(r.type,o),RE(e,t,r,o,n);case 15:return QO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:xo(r,o),Hh(e,t),t.tag=1,ar(r)?(e=!0,Nm(t)):e=!1,_c(t,n),JO(t,r,o),Cx(t,r,o,n),Tx(null,t,r,!0,e,n);case 19:return oM(e,t,n);case 22:return eM(e,t,n)}throw Error(ee(156,t.tag))};function bM(e,t){return qT(e,t)}function h5(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Jr(e,t,n,r){return new h5(e,t,n,r)}function t1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function m5(e){if(typeof e=="function")return t1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===bw)return 11;if(e===ww)return 14}return 2}function Xs(e,t){var n=e.alternate;return n===null?(n=Jr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function qh(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")t1(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case cc:return rl(n.children,o,i,t);case xw:s=8,o|=8;break;case Y0:return e=Jr(12,n,t,o|2),e.elementType=Y0,e.lanes=i,e;case J0:return e=Jr(13,n,t,o),e.elementType=J0,e.lanes=i,e;case X0:return e=Jr(19,n,t,o),e.elementType=X0,e.lanes=i,e;case MT:return iv(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case TT:s=10;break e;case OT:s=9;break e;case bw:s=11;break e;case ww:s=14;break e;case Cs:s=16,r=null;break e}throw Error(ee(130,e==null?e:typeof e,""))}return t=Jr(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function rl(e,t,n,r){return e=Jr(7,e,r,t),e.lanes=n,e}function iv(e,t,n,r){return e=Jr(22,e,r,t),e.elementType=MT,e.lanes=n,e.stateNode={isHidden:!1},e}function Wy(e,t,n){return e=Jr(6,e,null,t),e.lanes=n,e}function Ky(e,t,n){return t=Jr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function g5(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_y(0),this.expirationTimes=_y(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_y(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function n1(e,t,n,r,o,i,s,a,l){return e=new g5(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Jr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zw(i),e}function v5(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:lc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function wM(e){if(!e)return sa;e=e._reactInternals;e:{if(Al(e)!==e||e.tag!==1)throw Error(ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ar(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ee(171))}if(e.tag===1){var n=e.type;if(ar(n))return wO(e,n,t)}return t}function SM(e,t,n,r,o,i,s,a,l){return e=n1(n,r,!0,e,o,i,s,a,l),e.context=wM(null),n=e.current,r=Wn(),o=Js(n),i=Bi(r,o),i.callback=t??null,Gs(n,i,o),e.current.lanes=o,gp(e,o,r),lr(e,r),e}function sv(e,t,n,r){var o=t.current,i=Wn(),s=Js(o);return n=wM(n),t.context===null?t.context=n:t.pendingContext=n,t=Bi(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Gs(o,t,s),e!==null&&(Po(e,o,s,i),$h(e,o,s)),s}function Bm(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function WE(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function r1(e,t){WE(e,t),(e=e.alternate)&&WE(e,t)}function y5(){return null}var kM=typeof reportError=="function"?reportError:function(e){console.error(e)};function o1(e){this._internalRoot=e}av.prototype.render=o1.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ee(409));sv(e,t,null,null)};av.prototype.unmount=o1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vl(function(){sv(null,e,null,null)}),t[Hi]=null}};function av(e){this._internalRoot=e}av.prototype.unstable_scheduleHydration=function(e){if(e){var t=eO();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ms.length&&t!==0&&t<Ms[n].priority;n++);Ms.splice(n,0,e),n===0&&nO(e)}};function i1(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function lv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function KE(){}function x5(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=Bm(s);i.call(c)}}var s=SM(t,r,e,0,null,!1,!1,"",KE);return e._reactRootContainer=s,e[Hi]=s.current,lf(e.nodeType===8?e.parentNode:e),vl(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=Bm(l);a.call(c)}}var l=n1(e,0,!1,null,null,!1,!1,"",KE);return e._reactRootContainer=l,e[Hi]=l.current,lf(e.nodeType===8?e.parentNode:e),vl(function(){sv(t,l,n,r)}),l}function cv(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var l=Bm(s);a.call(l)}}sv(t,s,e,o)}else s=x5(n,t,e,o,r);return Bm(s)}ZT=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=od(t.pendingLanes);n!==0&&(Ew(t,n|1),lr(t,Bt()),!(tt&6)&&(qc=Bt()+500,_a()))}break;case 13:vl(function(){var r=Wi(e,1);if(r!==null){var o=Wn();Po(r,e,1,o)}}),r1(e,1)}};Cw=function(e){if(e.tag===13){var t=Wi(e,134217728);if(t!==null){var n=Wn();Po(t,e,134217728,n)}r1(e,134217728)}};QT=function(e){if(e.tag===13){var t=Js(e),n=Wi(e,t);if(n!==null){var r=Wn();Po(n,e,t,r)}r1(e,t)}};eO=function(){return dt};tO=function(e,t){var n=dt;try{return dt=e,t()}finally{dt=n}};ax=function(e,t,n){switch(t){case"input":if(ex(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Qg(r);if(!o)throw Error(ee(90));jT(r),ex(r,o)}}}break;case"textarea":AT(e,n);break;case"select":t=n.value,t!=null&&Sc(e,!!n.multiple,t,!1)}};$T=Zw;VT=vl;var b5={usingClientEntryPoint:!1,Events:[yp,pc,Qg,zT,BT,Zw]},Wu={findFiberByHostInstance:Ka,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},w5={bundleType:Wu.bundleType,version:Wu.version,rendererPackageName:Wu.rendererPackageName,rendererConfig:Wu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:es.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=WT(e),e===null?null:e.stateNode},findFiberByHostInstance:Wu.findFiberByHostInstance||y5,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 yh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yh.isDisabled&&yh.supportsFiber)try{Yg=yh.inject(w5),ni=yh}catch{}}Lr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=b5;Lr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!i1(t))throw Error(ee(200));return v5(e,t,null,n)};Lr.createRoot=function(e,t){if(!i1(e))throw Error(ee(299));var n=!1,r="",o=kM;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=n1(e,1,!1,null,null,n,!1,r,o),e[Hi]=t.current,lf(e.nodeType===8?e.parentNode:e),new o1(t)};Lr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ee(188)):(e=Object.keys(e).join(","),Error(ee(268,e)));return e=WT(t),e=e===null?null:e.stateNode,e};Lr.flushSync=function(e){return vl(e)};Lr.hydrate=function(e,t,n){if(!lv(t))throw Error(ee(200));return cv(null,e,t,!0,n)};Lr.hydrateRoot=function(e,t,n){if(!i1(e))throw Error(ee(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=kM;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=SM(t,null,e,1,n??null,o,!1,i,s),e[Hi]=t.current,lf(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new av(t)};Lr.render=function(e,t,n){if(!lv(t))throw Error(ee(200));return cv(null,e,t,!1,n)};Lr.unmountComponentAtNode=function(e){if(!lv(e))throw Error(ee(40));return e._reactRootContainer?(vl(function(){cv(null,null,e,!1,function(){e._reactRootContainer=null,e[Hi]=null})}),!0):!1};Lr.unstable_batchedUpdates=Zw;Lr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!lv(n))throw Error(ee(200));if(e==null||e._reactInternals===void 0)throw Error(ee(38));return cv(e,t,n,!1,r)};Lr.version="18.3.1-next-f1338f8080-20240426";function EM(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(EM)}catch(e){console.error(e)}}EM(),ET.exports=Lr;var Or=ET.exports;const S5=ka(Or);var qE=Or;gm.createRoot=qE.createRoot,gm.hydrateRoot=qE.hydrateRoot;var CM={exports:{}},uv={};/**
33
- * @license React
34
- * react-jsx-runtime.production.min.js
35
- *
36
- * Copyright (c) Facebook, Inc. and its affiliates.
37
- *
38
- * This source code is licensed under the MIT license found in the
39
- * LICENSE file in the root directory of this source tree.
40
- */var k5=g,E5=Symbol.for("react.element"),C5=Symbol.for("react.fragment"),_5=Object.prototype.hasOwnProperty,N5=k5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,T5={key:!0,ref:!0,__self:!0,__source:!0};function _M(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)_5.call(t,r)&&!T5.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:E5,type:e,key:i,ref:s,props:o,_owner:N5.current}}uv.Fragment=C5;uv.jsx=_M;uv.jsxs=_M;CM.exports=uv;var f=CM.exports;function Bx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s1(e,t){if(e){if(typeof e=="string")return Bx(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bx(e,t):void 0}}function Gh(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=s1(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
41
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function O5(e){return e.length>0}var a1=Object.freeze({kind:"ok",value:void 0});function cr(e){return e===void 0?a1:{kind:"ok",value:e}}function Io(e){return{kind:"err",error:e}}function dv(e){return e===a1||e.kind==="ok"}function M5(e){return e!==a1&&e.kind==="err"}function NM(e,t){return function(n){for(var r=cr(t),o=0;o<n.length&&dv(r);++o)r=e(r.value,n[o],o);return r}}function ko(e){return function(t){return dv(t)?cr(e(t.value)):t}}function Gc(e){return function(t){return dv(t)?e(t.value):t}}var l1=function(t,n){return function(r){return dv(r)?t(r.value)?r:Io(n(r.value)):r}};function P5(e){if(Array.isArray(e))return e}function j5(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function R5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qn(e,t){return P5(e)||j5(e,t)||s1(e,t)||R5()}function A5(e){if(Array.isArray(e))return Bx(e)}function I5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function D5(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
43
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bc(e){return A5(e)||I5(e)||s1(e)||D5()}function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function L5(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TM(e){var t=L5(e,"string");return typeof t=="symbol"?t:t+""}function H(e,t,n){return(t=TM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $t(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GE(Object(n),!0).forEach(function(r){H(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F5(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,TM(r.key),r)}}function Nn(e,t,n){return t&&F5(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $m(e){return $m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$m(e)}function OM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OM=function(){return!!e})()}function z5(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B5(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return z5(e)}function zr(e,t,n){return t=$m(t),B5(e,OM()?Reflect.construct(t,[],$m(e).constructor):t.apply(e,n))}function $x(e,t){return $x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},$x(e,t)}function Br(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$x(e,t)}var $r=function(){function e(){_n(this,e)}return Nn(e,[{key:"appendValidationError",value:function(n,r,o,i){return n?(n[r]?n[r].push({message:o,value:i}):n[r]=[{message:o,value:i}],n):H({},r,[{message:o,value:i}])}}])}(),MM=Symbol("GetSchema"),PM=Symbol("Path"),$5=Symbol("GetSource");function V5(e){return e[MM]}var qe="_type",bt="_ref",Vx="_tag";function U5(e){return he(e)==="object"&&e!==null&&qe in e&&e[qe]==="file"&&bt in e&&typeof e[bt]=="string"}var H5=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return _n(this,t),r=zr(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Br(t,e),Nn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return H({},r,[{message:"Non-optional file was null or undefined.",value:o}]);if(typeof o[bt]!="string")return H({},r,[{message:"File did not have a file reference string. Got: ".concat(he(o[bt])),value:o}]);if(this.isRemote&&o[qe]!=="remote")return H({},r,[{message:"Expected a remote file, but got a local file.",value:o,fixes:["file:upload-remote"]}]);if(this.isRemote&&o[qe]==="remote")return H({},r,[{message:"Remote file was not checked.",value:o,fixes:["file:check-remote"]}]);if(!this.isRemote&&o[qe]==="remote")return H({},r,[{message:"Expected locale file, but found remote.",value:o,fixes:["file:download-remote"]}]);if(o[qe]!=="file")return H({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[qe]),value:o,fixes:["file:change-extension","file:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return H({},r,[{message:"Invalid mime type format. Got: ".concat(l),value:o,fixes:["file:change-extension","file:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(p){return p.trim()}),u=c.some(function(p){if(p==="*/*")return!0;if(p.endsWith("/*")){var h=p.slice(0,-2);return l.startsWith(h)}return p===l});if(!u)return H({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])}var d=de.filenameToMimeType(o[bt]);return d?d!==l?H({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}]):o.metadata?H({},r,[{message:"Found metadata, but it could not be validated. File metadata must be an object with the mimeType.",value:o,fixes:["file:check-metadata"]}]):H({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}]):H({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[bt]),value:o,fixes:["file:change-extension","file:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:he(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected object, got '".concat(he(o),"'"),typeError:!0}])}:bt in o?qe in o&&o[qe]==="file"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"file",options:this.options,opt:this.opt,remote:this.isRemote}}}])}($r),W5=function(t){return new H5(t)};function K5(e){return e[bt].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[bt]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[bt].slice(7),metadata:e.metadata}:{url:e[bt]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function q5(e){return he(e)==="object"&&e!==null&&e!==void 0&&PM in e&&"val"in e}function jM(e){return e[PM]}function vf(e,t){if(he(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(de.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(de.ModuleFilePathSep).concat(JSON.stringify(t))}function Jo(e,t){if(he(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(!e)throw Error("Cannot create val path of array item of empty or missing path: ".concat(e,". Item: ").concat(t));return e.includes(de.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(de.ModuleFilePathSep).concat(JSON.stringify(t))}var c1=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.items=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?H({},r,[{message:"Expected 'object', got 'null'"}]):he(o)!=="object"?H({},r,[{message:"Expected 'object', got '".concat(he(o),"'")}]):Array.isArray(o)?H({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=qn(a,2),c=l[0],u=l[1],d=vf(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(c),o);else{var p=u.validate(d,o[c]);p&&s?s=$t($t({},p),s):p&&(s=p)}}),s)}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(he(o)!=="object")return{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(he(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])};for(var i=[],s=0,a=Object.keys(this.items);s<a.length;s++){var l=a[s],c=vf(r,l);c?l in o||i.push({message:"Expected key '".concat(l,"' not found in object"),typeError:!0}):i.push({message:"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(l),internalError:!0})}return i.length>0?{success:!1,errors:H({},r,i)}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.items,!0)}},{key:"serialize",value:function(){return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(r){var o=qn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}])}($r),G5=function(t){return new c1(t)},RM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.item=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return i.errors;if(i.data===null)return!1;for(var s={},a=0,l=Object.entries(i.data);a<l.length;a++){var c=qn(l[a],2),u=c[0],d=c[1],p=Jo(r,Number(u)),h=this.item.validate(p,d);h&&(s=$t($t({},h),s))}return Object.keys(s).length===0?!1:s}},{key:"assert",value:function(r,o){return o===null&&this.opt?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:he(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(he(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected object of type 'array'",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"array",item:this.item.serialize(),opt:this.opt}}}])}($r),Y5=function(t){return new RM(t)},sd=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.value=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?H({},r,[{message:"Expected 'string', got '".concat(he(o),"'"),value:o}]):o!==this.value?H({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"serialize",value:function(){return{type:"literal",value:this.value,opt:this.opt}}}])}($r),J5=function(t){return new sd(t)},AM=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return _n(this,t),o=zr(this,t),o.key=n,o.items=r,o.opt=i,o}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){var i=o,s=!1;if(this.opt&&i===null)return!1;if(!this.key)return H({},r,[{message:"Missing required first argument in union",schemaError:!0}]);var a=this.key;if(!Array.isArray(this.items))return H({},r,[{message:"A union schema must take more than 1 schema arguments",schemaError:!0}]);if(typeof a=="string"){if(this.items.some(function(j){return!(j instanceof c1)}))return H({},r,[{message:"Key is a string, so all schema items must be objects",schemaError:!0}]);var l=this.items,c=l.map(function(j){return j.serialize()}),u=c.filter(function(j){return j.type!=="object"||j.items[a].type!=="literal"});if(u.length>0)return H({},r,[{message:"All schema items must be objects with a key: ".concat(a," that is a literal schema. Found: ").concat(JSON.stringify(u,null,2)),schemaError:!0}]);var d=c,p=d.filter(function(j){return j.items[a].opt});if(p.length>1)return H({},r,[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]);if(he(i)!=="object")return H({},r,[{message:"Expected an object",typeError:!0}]);var h=i;if(h[a]===void 0)return H({},r,[{message:"Missing required key: ".concat(a),typeError:!0}]);var m=[],v=Gh(d),b;try{for(v.s();!(b=v.n()).done;){var x=b.value,w=x.items[a];if(w.type==="literal")if(!m.includes(w.value))m.push(w.value);else return H({},r,[{message:"Found duplicate key in schema: ".concat(w.value),schemaError:!0}])}}catch(j){v.e(j)}finally{v.f()}var k=l.find(function(j){return!j.items[a].validate(r,h[a])});if(!k){var C=vf(r,a);if(!C)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return H({},C,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(h[a],'". Valid values: ').concat(d.map(function(j){var A=j.items[a];if(A.type==="literal"&&A.value)return'"'.concat(A.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(A,null,2)))}).join(", "))}])}var _=k.validate(r,h);if(_)return _}else if(a instanceof sd){if(this.items.some(function(j){return!(j instanceof sd)}))return H({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var O=[a].concat(bc(this.items));if(typeof i=="string"){var T=O.some(function(j){return!j.validate(r,i)});if(!T)return H({},r,[{message:"Union must match one of the following: ".concat(O.map(function(j){return'"'.concat(j.value,'"')}).join(", "))}])}}else return H({},r,[{message:"Expected a string or literal"}]);return s}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:H({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:H({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])};if(this.key instanceof sd){var i,s=!1,a={},l=Gh((i=[this.key]).concat.apply(i,bc(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof sd))return{success:!1,errors:H({},r,[{message:"Schema of value is a union of string, so all schema items must be literals",schemaError:!0}])};if(typeof o!="string"){a[r]=[{message:"Expected 'string', got '".concat(he(o),"'"),typeError:!0}];continue}var d=u.assert(r,o);if(d.success){s=!0;break}else for(var p=0,h=Object.entries(d.errors);p<h.length;p++){var m,v=qn(h[p],2),b=v[0],x=v[1];a[b]||(a[b]=[]),(m=a[b]).push.apply(m,bc(x))}}}catch(X){l.e(X)}finally{l.f()}return s?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var w=!1,k={},C=Gh(this.items),_;try{for(C.s();!(_=C.n()).done;){var O=_.value,T=O.assert(r,o);if(T.success){w=!0;break}else for(var j=0,A=Object.entries(T.errors);j<A.length;j++){var D,V=qn(A[j],2),W=V[0],J=V[1];k[W]||(k[W]=[]),(D=k[W]).push.apply(D,bc(J))}}}catch(X){C.e(X)}finally{C.f()}return w?{success:!0,data:o}:{success:!1,errors:k}}else return{success:!1,errors:H({},r,[{message:"The schema of this value is wrong. Schema is neither a union of literals nor a tagged union (of objects)",schemaError:!0}])}}},{key:"nullable",value:function(){return new t(this.key,this.items,!0)}},{key:"serialize",value:function(){return typeof this.key=="string"?{type:"union",key:this.key,items:this.items.map(function(r){return r.serialize()}),opt:this.opt}:{type:"union",key:this.key.serialize(),items:this.items.map(function(r){return r.serialize()}),opt:this.opt}}}])}($r),X5=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new AM(t,r)},u1=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return _n(this,t),r=zr(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Br(t,e),Nn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(o==null)return H({},r,[{message:"Non-optional image was null or undefined.",value:o}]);if(this.isRemote&&o[qe]!=="remote")return H({},r,[{message:"Expected a remote image, but got a local image.",value:o,fixes:["image:upload-remote"]}]);if(this.isRemote&&o[qe]==="remote")return H({},r,[{message:"Remote image was not checked.",value:o,fixes:["image:check-remote"]}]);if(!this.isRemote&&o[qe]==="remote")return H({},r,[{message:"Expected locale image, but found remote.",value:o,fixes:["image:download-remote"]}]);if(typeof o[bt]!="string")return H({},r,[{message:"Image did not have a file reference string. Got: ".concat(he(o[bt])),value:o}]);if(o[qe]!=="file")return H({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[qe]),value:o,fixes:["image:change-extension","image:check-metadata"]}]);var i=this.options||{},s=i.accept,a=o.metadata||{},l=a.mimeType;if(s&&l&&!l.includes("/"))return H({},r,[{message:"Invalid mime type format. Got: '".concat(l,"'"),value:o,fixes:["image:check-metadata"]}]);if(s&&l&&l.includes("/")){var c=s.split(",").map(function(p){return p.trim()}),u=c.some(function(p){if(p==="*/*")return!0;if(p.endsWith("/*")){var h=p.slice(0,-2);return l.startsWith(h)}return p===l});if(!u)return H({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["image:check-metadata"]}])}var d=de.filenameToMimeType(o[bt]);return d?d&&l&&d!==l?H({},r,[{message:"Mime type and file extension not matching. Mime type is '".concat(l,"' but file extension is '").concat(d,"'"),value:o,fixes:["image:check-metadata"]}]):o.metadata?o.metadata.hotspot&&(he(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?H({},r,[{message:"Hotspot must be an object with x and y as numbers.",value:o}]):H({},r,[{message:"Found metadata, but it could not be validated. Image metadata must be an object with the required props: width (positive number), height (positive number) and the mime type.",value:o,fixes:["image:check-metadata"]}]):H({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}]):H({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[bt]),value:o,fixes:["image:check-metadata"]}])}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:he(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(he(o),"'"),typeError:!0}])}:bt in o?qe in o&&o[qe]==="file"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:H({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_ref_prop)",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"image",options:this.options,opt:this.opt,remote:this.isRemote}}}])}($r),Z5=function(t){return new u1(t)},IM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.options=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"maxLength",value:function(r){return new t($t($t({},this.options),{},{maxLength:r}),this.opt)}},{key:"minLength",value:function(r){return new t($t($t({},this.options),{},{minLength:r}),this.opt)}},{key:"validate",value:function(r,o){var i=this.assert(r,o);if(!i.success)return H({},r,i.errors[r]);var s=i.data;if(s===null&&this.opt)return!1;if(s===null)return H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}]);var a={},l=this.internalValidate(r,s,a);return l||(Object.keys(a).length>0?a:!1)}},{key:"internalValidate",value:function(r,o,i){var s=this,a=0,l=function(m,v,b){var x=function(P,z,G){b[P]||(b[P]=[]),b[P].push({message:z,typeError:G})},w=Gh(v),k;try{for(w.s();!(k=w.n()).done;){var C,_,O,T,j,A,D,V,W,J,X,U=k.value,I=Jo(m,v.indexOf(U));if(typeof U=="string"){a+=U.length;continue}if(he(U)!=="object")return H({},I,[{message:"Expected nodes of type 'object' or 'string', got '".concat(he(U),"'"),typeError:!0}]);if(U===null)return H({},I,[{message:"Expected nodes of type 'object' or 'string', got 'null'",typeError:!0}]);if(!("tag"in U))return H({},I,[{message:"Expected node to either have 'tag' or be of type 'string'",typeError:!0}]);if(typeof U.tag!="string")return H({},I,[{message:"Expected 'string', got '".concat(he(U.tag),"'"),typeError:!0}]);if(U.tag==="h1"&&!((C=s.options.block)!==null&&C!==void 0&&C.h1)&&x(I,"'h' block is not valid",!1),U.tag==="h2"&&!((_=s.options.block)!==null&&_!==void 0&&_.h2)&&x(I,"'h2' block is not valid",!1),U.tag==="h3"&&!((O=s.options.block)!==null&&O!==void 0&&O.h3)&&x(I,"'h3' block is not valid",!1),U.tag==="h4"&&!((T=s.options.block)!==null&&T!==void 0&&T.h4)&&x(I,"'h4' block is not valid",!1),U.tag==="h5"&&!((j=s.options.block)!==null&&j!==void 0&&j.h5)&&x(I,"'h5' block is not valid",!1),U.tag==="h6"&&!((A=s.options.block)!==null&&A!==void 0&&A.h6)&&x(I,"'h6' block is not valid",!1),U.tag==="ol"&&!((D=s.options.block)!==null&&D!==void 0&&D.ol)&&x(I,"'ol' block is not valid",!1),U.tag==="ul"&&!((V=s.options.block)!==null&&V!==void 0&&V.ul)&&x(I,"'ul' block is not valid",!1),U.tag==="li"&&!((W=s.options.block)!==null&&W!==void 0&&W.ul)&&!((J=s.options.block)!==null&&J!==void 0&&J.ol)&&x(I,"'li' tag is invalid since neither 'ul' nor 'ol' block is not valid",!1),U.tag==="a"&&!((X=s.options.inline)!==null&&X!==void 0&&X.a)&&x(I,"'a' inline is not valid",!1),U.tag==="img"){var R,M;if(!((R=s.options.inline)!==null&&R!==void 0&&R.img))x(I,"'img' inline is not valid",!1);else if((M=s.options.inline)!==null&&M!==void 0&&M.img){var F,L;if(!("src"in U))return H({},I,[{message:"Expected 'src' in 'img'",typeError:!0}]);var B=Jo(I,"src"),K=he((F=s.options.inline)===null||F===void 0?void 0:F.img)==="object"?(L=s.options.inline)===null||L===void 0?void 0:L.img.validate(B,U.src):new u1({},!1,!1).validate(B,U.src);if(K)for(var be in K){var ae,le=be;b[le]||(b[le]=[]),(ae=b[le]).push.apply(ae,bc(K[le]))}}}if("styles"in U&&U.tag!=="span")return H({},I,[{message:"Cannot have styles on '".concat(U.tag,"'. This is only allowed on 'span'"),typeError:!0}]);if("styles"in U){if(!Array.isArray(U.styles))return H({},I,[{message:"Expected 'array', got '".concat(he(U.styles),"'"),typeError:!0}]);for(var re=Jo(I,"styles"),$=0;$<U.styles.length;$++){var Y,ne,te,we=U.styles[$],ce=Jo(re,$);if(typeof we!="string")return H({},ce,[{message:"Expected 'string', got '".concat(he(we),"'"),typeError:!0}]);we==="bold"&&!((Y=s.options.style)!==null&&Y!==void 0&&Y.bold)&&x(ce,"Style 'bold' is not valid",!1),we==="italic"&&!((ne=s.options.style)!==null&&ne!==void 0&&ne.italic)&&x(ce,"Style 'italic' is not valid",!1),we==="lineThrough"&&!((te=s.options.style)!==null&&te!==void 0&&te.lineThrough)&&x(ce,"Style 'lineThrough' is not valid",!1)}}if("children"in U){if(!Array.isArray(U.children))return H({},I,[{message:"Expected 'array', got '".concat(he(U.children),"'"),typeError:!0}]);for(var ze=U.children,je=0;je<ze.length;je++){var mt=ze[je];if(he(mt)==="object"){var N=Jo(I,"children"),S=l(N,[mt],b);if(S)return S}else if(typeof mt=="string"){a+=mt.length;continue}else return H({},I,[{message:"Expected 'object' or 'string', got '".concat(he(mt),"'"),typeError:!0}])}}}}catch(E){w.e(E)}finally{w.f()}return!1},c=l(r,o,i),u=[];if(this.options.maxLength&&a>this.options.maxLength&&u.push({message:"Maximum length of ".concat(this.options.maxLength," exceeded (current length: ").concat(a,")"),typeError:!1}),this.options.minLength&&a<this.options.minLength&&u.push({message:"Minimum length of ".concat(this.options.minLength," not met (current length: ").concat(a,")"),typeError:!1}),c){if(u.length>0){var d;c[r]||(c[r]=[]),(d=c[r]).push.apply(d,u)}return c}if(Object.keys(i).length>0){if(u.length>0){var p;i[r]||(i[r]=[]),(p=i[r]).push.apply(p,u)}return i}return u.length>0?H({},r,u):!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null&&!this.opt)return{success:!1,errors:H({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])};if(!Array.isArray(o))return{success:!1,errors:H({},r,[{message:"Expected 'array', got '".concat(he(o),"'"),typeError:!0}])};for(var i={},s=0;s<o.length;s++)this.recursiveAssert(Jo(r,s),o[s],i);return Object.keys(i).length>0?{success:!1,errors:i}:{success:!0,data:o}}},{key:"recursiveAssert",value:function(r,o,i){if(he(o)!=="object"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got '".concat(he(o),"'"),typeError:!0});return}if(Array.isArray(o)){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'array'",typeError:!0});return}if(o===null){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got 'null'",typeError:!0});return}if("tag"in o&&typeof o.tag!="string"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'string', got '".concat(he(o.tag),"'"),typeError:!0});return}if("children"in o)if(Array.isArray(o.children))for(var s=0;s<o.children.length;s++){var a=o.children[s],l=Jo(Jo(r,"children"),s);if(he(a)==="object")this.recursiveAssert(l,a,i);else{if(typeof a=="string")continue;i[l]||(i[l]=[]),i[l].push({message:"Expected 'object' or 'string', got '".concat(he(a),"'"),typeError:!0})}}else{i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(he(o.children),"'"),typeError:!0});return}if("styles"in o)if(!Array.isArray(o.styles))i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(he(o.styles),"'"),typeError:!0});else for(var c=0;c<o.styles.length;c++){var u=o.styles[c];if(typeof u!="string"){var d=Jo(r,c);i[d]||(i[d]=[]),i[d].push({message:"Expected 'string', got '".concat(he(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){var r={style:this.options.style,block:this.options.block,inline:this.options.inline&&{a:this.options.inline.a,img:this.options.inline.img&&he(this.options.inline.img)==="object"?this.options.inline.img.serialize():this.options.inline.img}};return{type:"richtext",opt:this.opt,options:r}}}])}($r),Q5=function(t){return new IM(t??{})},DM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.item=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?H({},r,[{message:"Expected 'object', got 'null'"}]):he(o)!=="object"?H({},r,[{message:"Expected 'object', got '".concat(he(o),"'")}]):Array.isArray(o)?H({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=qn(a,2),c=l[0],u=l[1],d=vf(r,c);if(!d)s=i.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(u),o);else{var p=i.item.validate(d,u);p&&s?s=$t($t({},p),s):p&&(s=p)}}),s)}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:he(o)!=="object"?{success:!1,errors:H({},r,[{message:"Expected 'object', got '".concat(he(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:H({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"serialize",value:function(){return{type:"record",item:this.item.serialize(),opt:this.opt}}}])}($r),ez=function(t){return new DM(t)};function tz(e){var t=e[$5],n=t;return n}function LM(e){var t=e.indexOf(aa);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+aa.length)]}function FM(e,t){return t===""?e:"".concat(e).concat(aa).concat(t)}function nz(e){return e instanceof c1||he(e)==="object"&&"type"in e&&e.type==="object"}function rz(e){return e instanceof DM||he(e)==="object"&&"type"in e&&e.type==="record"}function oz(e){return e instanceof RM||he(e)==="object"&&"type"in e&&e.type==="array"}function iz(e){return e instanceof AM||he(e)==="object"&&"type"in e&&e.type==="union"}function sz(e){return e instanceof IM||he(e)==="object"&&"type"in e&&e.type==="richtext"}function az(e){return e instanceof u1||he(e)==="object"&&"type"in e&&e.type==="image"}function lz(e,t,n){for(var r=Vm(e),o=bc(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(oz(i)){if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(i)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(he(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(he(s)));s=s[u],i=i.item}else if(rz(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(he(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(he(s)));if(!s[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));s=s[u],i=i.item}else if(nz(i)){if(he(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(he(s)));if(s!==null&&s[u]===void 0)throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));s=s===null?s:s[u],i=i.items[u]}else{if(az(i))return{v:{path:o.slice(0,o.length-r.length-1).map(function(b){return JSON.stringify(b)}).join("."),schema:i,source:s}};if(iz(i)){var d=i.key;if(typeof d!="string")return{v:{path:o.map(function(b){return Number.isNaN(Number(b))?JSON.stringify(b):b}).join("."),schema:i,source:s}};var p=s[d];if(!p)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(d," in path: ").concat(e));var h=i.items.find(function(b){var x;return(b==null||(x=b.items)===null||x===void 0||(x=x[d])===null||x===void 0?void 0:x.value)===p});if(!h)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(d," of value ").concat(p," in path: ").concat(e));i=h.items[u],s=s[u]}else if(sz(i)){if("src"in s&&"tag"in s&&s.tag==="img"&&r.length===0){var m,v;i=(m=i.options)!==null&&m!==void 0&&(m=m.inline)!==null&&m!==void 0&&m.img&&typeof((v=i.options)===null||v===void 0||(v=v.inline)===null||v===void 0?void 0:v.img)!="boolean"?i.options.inline.img:i}s=s[u]}else throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(i)))}},l;r.length>0;)if(l=a(),l)return l.v;if(r.length>0)throw Error("Invalid path: ".concat(r.join(".")," is not a valid path"));return{path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:i,source:s}}function cz(e){var t=e.split("/").slice(1);return t}function Vm(e){for(var t=[],n=0;n<e.length;){var r="";if(e[n]==='"'){for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"&&e[n+1]==='"'?(r+='"',n++):r+=e[n],n++;if(e[n]!=='"'){var o;throw new Error("Invalid input (".concat(JSON.stringify(e),"): Missing closing double quote: ").concat((o=e[n])!==null&&o!==void 0?o:"at end of string"," (char: ").concat(n,"; length: ").concat(e.length,")"))}}else for(;n<e.length&&e[n]!==".";)r+=e[n],n++;r!==""&&t.push(r),n++}return t}function uz(e){return e.split(",")}function dz(e){var t=LM(e),n=qn(t,2),r=n[0],o=n[1],i=Vm(o).slice(0,-1);return i.length>0?FM(r,zM(i)):r}function zM(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var fz=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.options=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?H({},r,[{message:"Expected 'number', got '".concat(he(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected 'number', got '".concat(he(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"number",options:this.options,opt:this.opt}}}])}($r),pz=function(t){return new fz(t)},hz=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return _n(this,t),r=zr(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return Br(t,e),Nn(t,[{key:"min",value:function(r){return this.minLength(r)}},{key:"minLength",value:function(r){return new t($t($t({},this.options),{},{minLength:r}),this.opt,this.isRaw)}},{key:"max",value:function(r){return this.maxLength(r)}},{key:"maxLength",value:function(r){return new t($t($t({},this.options),{},{maxLength:r}),this.opt,this.isRaw)}},{key:"regexp",value:function(r){return new t($t($t({},this.options),{},{regexp:r}),this.opt,this.isRaw)}},{key:"validate",value:function(r,o){var i,s,a;if(this.opt&&o==null)return!1;if(typeof o!="string")return H({},r,[{message:"Expected 'string', got '".concat(he(o),"'"),value:o}]);var l=[];return(i=this.options)!==null&&i!==void 0&&i.maxLength&&o.length>this.options.maxLength&&l.push({message:"Expected string to be at most ".concat(this.options.maxLength," characters long, got ").concat(o.length),value:o}),(s=this.options)!==null&&s!==void 0&&s.minLength&&o.length<this.options.minLength&&l.push({message:"Expected string to be at least ".concat(this.options.minLength," characters long, got ").concat(o.length),value:o}),(a=this.options)!==null&&a!==void 0&&a.regexp&&!this.options.regexp.test(o)&&l.push({message:"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?H({},r,l):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:typeof o=="string"?{success:!0,data:o}:{success:!1,errors:H({},r,[{message:"Expected 'string', got '".concat(he(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRaw)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0)}},{key:"serialize",value:function(){var r,o,i;return{type:"string",options:{maxLength:(r=this.options)===null||r===void 0?void 0:r.maxLength,minLength:(o=this.options)===null||o===void 0?void 0:o.minLength,regexp:((i=this.options)===null||i===void 0?void 0:i.regexp)&&{source:this.options.regexp.source,flags:this.options.regexp.flags}},opt:this.opt,raw:this.isRaw}}}])}($r),mz=function(t){return new hz(t)},gz=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return _n(this,t),n=zr(this,t),n.opt=r,n}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?H({},r,[{message:"Expected 'boolean', got '".concat(he(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:H({},r,[{message:"Expected 'boolean', got '".concat(he(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(!0)}},{key:"serialize",value:function(){return{type:"boolean",opt:this.opt}}}])}($r),vz=function(){return new gz},yz=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return _n(this,t),o=zr(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return H({},r,[{message:"Schema not found for module. keyOf must be used with a Val Module"}]);var i=this.schema;if(!(i.type==="object"||i.type==="record"))return H({},r,[{message:"Schema in keyOf must be an 'object' or 'record'. Found '".concat(i.type,"'")}]);if(i.opt&&o==null)return!1;if(i.type==="record"&&typeof o!="string")return H({},r,[{message:"Type of value in keyof (record) must be 'string'"}]);if(i.type==="object"){var s=Object.keys(i.items);if(!s.includes(o))return H({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return i.type==="record"?typeof o!="string"?H({},r,[{message:"Value of keyOf (record) must be 'string'. Found: ".concat(he(o))}]):H({},r,[{fixes:["keyof:check-keys"],message:"Did not validate keyOf (record). This error (keyof:check-keys) should typically be processed by Val internally. Seeing this error most likely means you have a Val version mismatch.",value:{key:o,sourcePath:this.sourcePath}}]):!1}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var i=this.schema;if(!i)return{success:!1,errors:H({},r,[{message:"Neither key nor schema was found. keyOf is missing an argument.",typeError:!0}])};var s=i;if(!(s.type==="object"||s.type==="record"))return{success:!1,errors:H({},r,[{message:"Schema of first argument must be either: 'array', 'object' or 'record'. Found '".concat(s.type,"'"),typeError:!0}])};if(s.type==="record"&&typeof o!="string")return{success:!1,errors:H({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(he(o),"'"),typeError:!0}])};if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return{success:!1,errors:H({},r,[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o),typeError:!0}])}}return{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.schema,this.sourcePath,!0)}},{key:"serialize",value:function(){var r=this.sourcePath;if(!r)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");var o=this.schema;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(o.type){case"record":i="string";break;case"object":i=Object.keys(o.items);break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(o.type,"'. keyOf must be used with a Val Module."))}return{type:"keyOf",path:r,schema:o,opt:this.opt,values:i}}}])}($r),xz=function(t){var n;return new yz(t==null||(n=t[MM])===null||n===void 0?void 0:n.serialize(),jM(t))},bz=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _n(this,t),r=zr(this,t),r.options=n,r.opt=o,r}return Br(t,e),Nn(t,[{key:"validate",value:function(r,o){var i,s,a,l;if(this.opt&&o==null)return!1;if(typeof o!="string")return H({},r,[{message:"Expected 'string', got '".concat(he(o),"'"),value:o}]);if((i=this.options)!==null&&i!==void 0&&i.from&&(s=this.options)!==null&&s!==void 0&&s.to){if(this.options.from>this.options.to)return H({},r,[{message:"From date ".concat(this.options.from," is after to date ").concat(this.options.to),value:o,typeError:!0}]);if(o<this.options.from||o>this.options.to)return H({},r,[{message:"Date is not between ".concat(this.options.from," and ").concat(this.options.to),value:o}])}else if((a=this.options)!==null&&a!==void 0&&a.from){if(o<this.options.from)return H({},r,[{message:"Date is before the minimum date ".concat(this.options.from),value:o}])}else if((l=this.options)!==null&&l!==void 0&&l.to&&o>this.options.to)return H({},r,[{message:"Date is after the maximum date ".concat(this.options.to),value:o}]);return!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:H({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:H({},r,[{message:"Expected 'string', got '".concat(he(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"from",value:function(r){return new t($t($t({},this.options),{},{from:r}),this.opt)}},{key:"to",value:function(r){return new t($t($t({},this.options),{},{to:r}),this.opt)}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){return{type:"date",opt:this.opt,options:this.options}}}])}($r),wz=function(t){return new bz(t)};function Sz(){return{string:mz,boolean:vz,array:Y5,object:G5,number:pz,union:X5,richtext:Q5,image:Z5,literal:J5,keyOf:xz,record:ez,file:W5,date:wz}}function kz(e,t){var n=t.publicProjectId,r=t.coreVersion,o=t.validationHash,i=t.fileHash,s=t.filePath,a=t.bucket;return"".concat(e,"/file/p/").concat(n,"/b/").concat(a,"/v/").concat(r,"/h/").concat(o,"/f/").concat(i,"/p/").concat(s)}var Ez=/^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;function BM(e){var t=e.match(Ez);return t?t[7].indexOf("public/val/")!==0?{status:"error",error:"Invalid remote ref: "+e}:{status:"success",remoteHost:t[1],projectId:t[2],bucket:t[3],version:t[4],validationHash:t[5],fileHash:t[6],filePath:t[7]}:{status:"error",error:"Invalid remote ref: "+e}}var YE="https://remote.val.build";function Cz(e){if(e!=null&&e.patch_id){var t=BM(e[bt]);if(t.status==="success")return{url:"/api/val/files/"+t.filePath+"?patch_id=".concat(e.patch_id,"&remote=true"),metadata:e.metadata};console.warn("Internal Val error: failed to split remote ref: ".concat(e[bt],". The data format is different than what is expected. Check Val versions for mismatches."),t.error)}return{url:e[bt],metadata:e.metadata}}var Ar=Nn(function e(t){_n(this,e),this.message=t}),_z=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],pt=function(e){return e[e.inputBytes=64]="inputBytes",e[e.inputWords=16]="inputWords",e[e.highIndex=14]="highIndex",e[e.lowIndex=15]="lowIndex",e[e.workWords=64]="workWords",e[e.allocBytes=80]="allocBytes",e[e.allocWords=20]="allocWords",e[e.allocTotal=8e3]="allocTotal",e}(pt||{});function Nz(e){return new Tz}var Tz=function(){function e(){_n(this,e),H(this,"A",1779033703),H(this,"B",-1150833019),H(this,"C",1013904242),H(this,"D",-1521486534),H(this,"E",1359893119),H(this,"F",-1694144372),H(this,"G",528734635),H(this,"H",1541459225),H(this,"_size",0),H(this,"_sp",0),(!xh||Ku>=pt.allocTotal)&&(xh=new ArrayBuffer(pt.allocTotal),Ku=0),this._byte=new Uint8Array(xh,Ku,pt.allocBytes),this._word=new Int32Array(xh,Ku,pt.allocWords),Ku+=pt.allocBytes}return Nn(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+he(n));var r=n.byteOffset,o=n.byteLength,i=o/pt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%pt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*pt.inputWords);i--;)this._int32(a,s>>2),s+=pt.inputBytes;this._size+=s}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+s,o-s);return this._uint8(c)}return s===o?this:this._uint8(n,s)}},{key:"_uint8",value:function(n,r){var o=this._byte,i=this._word,s=n.length;for(r=r|0;r<s;){for(var a=this._size%pt.inputBytes,l=a;r<s&&l<pt.inputBytes;)o[l++]=n[r++];l>=pt.inputBytes&&this._int32(i),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,i=n.length,s=this._sp,a=0;a<i;){for(var l=this._size%pt.inputBytes,c=l;a<i&&c<pt.inputBytes;){var u=n.charCodeAt(a++)|0;u<128?r[c++]=u:u<2048?(r[c++]=192|u>>>6,r[c++]=128|u&63):u<55296||u>57343?(r[c++]=224|u>>>12,r[c++]=128|u>>>6&63,r[c++]=128|u&63):s?(u=((s&1023)<<10)+(u&1023)+65536,r[c++]=240|u>>>18,r[c++]=128|u>>>12&63,r[c++]=128|u>>>6&63,r[c++]=128|u&63,s=0):s=u}c>=pt.inputBytes&&(this._int32(o),o[0]=o[pt.inputWords]),this._size+=c-l}return this._sp=s,this}},{key:"_int32",value:function(n,r){var o=this.A,i=this.B,s=this.C,a=this.D,l=this.E,c=this.F,u=this.G,d=this.H,p=0;for(r=r|0;p<pt.inputWords;)Ia[p++]=ho(n[r++]);for(p=pt.inputWords;p<pt.workWords;p++)Ia[p]=Dz(Ia[p-2])+Ia[p-7]+Iz(Ia[p-15])+Ia[p-16]|0;for(p=0;p<pt.workWords;p++){var h=d+Az(l)+Pz(l,c,u)+_z[p]+Ia[p]|0,m=Rz(o)+jz(o,i,s)|0;d=u,u=c,c=l,l=a+h|0,a=s,s=i,i=o,o=h+m|0}this.A=o+this.A|0,this.B=i+this.B|0,this.C=s+this.C|0,this.D=a+this.D|0,this.E=l+this.E|0,this.F=c+this.F|0,this.G=u+this.G|0,this.H=d+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,i=this._size%pt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>pt.highIndex){for(;i<pt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<pt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[pt.highIndex]=ho(l)),a&&(o[pt.lowIndex]=ho(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H;return fs(n)+fs(r)+fs(o)+fs(i)+fs(s)+fs(a)+fs(l)+fs(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,i=this.D,s=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,d=this._word;return d[0]=ho(n),d[1]=ho(r),d[2]=ho(o),d[3]=ho(i),d[4]=ho(s),d[5]=ho(a),d[6]=ho(l),d[7]=ho(c),u.slice(0,32)}}])}(),Ia=new Int32Array(pt.workWords),xh,Ku=0,fs=function(t){return(t+4294967296).toString(16).substr(-8)},Oz=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},Mz=function(t){return t},ho=Lz()?Mz:Oz,Pz=function(t,n,r){return r^t&(n^r)},jz=function(t,n,r){return t&n|r&(t|n)},Rz=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},Az=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},Iz=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},Dz=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function Lz(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var d1=function(t){return Nz().update(t).digest("hex")},f1={x3d:"application/vnd.hzn-3d-crossword","3gp":"video/3gpp","3g2":"video/3gpp2",mseq:"application/vnd.mseq",pwn:"application/vnd.3m.post-it-notes",plb:"application/vnd.3gpp.pic-bw-large",psb:"application/vnd.3gpp.pic-bw-small",pvb:"application/vnd.3gpp.pic-bw-var",tcap:"application/vnd.3gpp2.tcap","7z":"application/x-7z-compressed",abw:"application/x-abiword",ace:"application/x-ace-compressed",acc:"application/vnd.americandynamics.acc",acu:"application/vnd.acucobol",atc:"application/vnd.acucorp",adp:"audio/adpcm",aab:"application/x-authorware-bin",aam:"application/x-authorware-map",aas:"application/x-authorware-seg",air:"application/vnd.adobe.air-application-installer-package+zip",swf:"application/x-shockwave-flash",fxp:"application/vnd.adobe.fxp",pdf:"application/pdf",ppd:"application/vnd.cups-ppd",dir:"application/x-director",xdp:"application/vnd.adobe.xdp+xml",xfdf:"application/vnd.adobe.xfdf",aac:"audio/x-aac",ahead:"application/vnd.ahead.space",azf:"application/vnd.airzip.filesecure.azf",azs:"application/vnd.airzip.filesecure.azs",azw:"application/vnd.amazon.ebook",ami:"application/vnd.amiga.ami","N/A":"application/andrew-inset",apk:"application/vnd.android.package-archive",cii:"application/vnd.anser-web-certificate-issue-initiation",fti:"application/vnd.anser-web-funds-transfer-initiation",atx:"application/vnd.antix.game-component",dmg:"application/x-apple-diskimage",mpkg:"application/vnd.apple.installer+xml",aw:"application/applixware",mp3:"audio/mpeg",les:"application/vnd.hhe.lesson-player",swi:"application/vnd.aristanetworks.swi",s:"text/x-asm",atomcat:"application/atomcat+xml",atomsvc:"application/atomsvc+xml",atom:"application/atom+xml",ac:"application/pkix-attr-cert",aif:"audio/x-aiff",avi:"video/x-msvideo",aep:"application/vnd.audiograph",dxf:"image/vnd.dxf",dwf:"model/vnd.dwf",par:"text/plain-bas",bcpio:"application/x-bcpio",bin:"application/octet-stream",bmp:"image/bmp",torrent:"application/x-bittorrent",cod:"application/vnd.rim.cod",mpm:"application/vnd.blueice.multipass",bmi:"application/vnd.bmi",sh:"application/x-sh",btif:"image/prs.btif",rep:"application/vnd.businessobjects",bz:"application/x-bzip",bz2:"application/x-bzip2",csh:"application/x-csh",c:"text/x-c",cdxml:"application/vnd.chemdraw+xml",css:"text/css",cdx:"chemical/x-cdx",cml:"chemical/x-cml",csml:"chemical/x-csml",cdbcmsg:"application/vnd.contact.cmsg",cla:"application/vnd.claymore",c4g:"application/vnd.clonk.c4group",sub:"image/vnd.dvb.subtitle",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",c11amc:"application/vnd.cluetrust.cartomobile-config",c11amz:"application/vnd.cluetrust.cartomobile-config-pkg",ras:"image/x-cmu-raster",dae:"model/vnd.collada+xml",csv:"text/csv",cpt:"application/mac-compactpro",wmlc:"application/vnd.wap.wmlc",cgm:"image/cgm",ice:"x-conference/x-cooltalk",cmx:"image/x-cmx",xar:"application/vnd.xara",cmc:"application/vnd.cosmocaller",cpio:"application/x-cpio",clkx:"application/vnd.crick.clicker",clkk:"application/vnd.crick.clicker.keyboard",clkp:"application/vnd.crick.clicker.palette",clkt:"application/vnd.crick.clicker.template",clkw:"application/vnd.crick.clicker.wordbank",wbs:"application/vnd.criticaltools.wbs+xml",cryptonote:"application/vnd.rig.cryptonote",cif:"chemical/x-cif",cmdf:"chemical/x-cmdf",cu:"application/cu-seeme",cww:"application/prs.cww",curl:"text/vnd.curl",dcurl:"text/vnd.curl.dcurl",mcurl:"text/vnd.curl.mcurl",scurl:"text/vnd.curl.scurl",car:"application/vnd.curl.car",pcurl:"application/vnd.curl.pcurl",cmp:"application/vnd.yellowriver-custom-menu",dssc:"application/dssc+der",xdssc:"application/dssc+xml",deb:"application/x-debian-package",uva:"audio/vnd.dece.audio",uvi:"image/vnd.dece.graphic",uvh:"video/vnd.dece.hd",uvm:"video/vnd.dece.mobile",uvu:"video/vnd.uvvu.mp4",uvp:"video/vnd.dece.pd",uvs:"video/vnd.dece.sd",uvv:"video/vnd.dece.video",dvi:"application/x-dvi",seed:"application/vnd.fdsn.seed",dtb:"application/x-dtbook+xml",res:"application/x-dtbresource+xml",ait:"application/vnd.dvb.ait",svc:"application/vnd.dvb.service",eol:"audio/vnd.digital-winds",djvu:"image/vnd.djvu",dtd:"application/xml-dtd",mlp:"application/vnd.dolby.mlp",wad:"application/x-doom",dpg:"application/vnd.dpgraph",dra:"audio/vnd.dra",dfac:"application/vnd.dreamfactory",dts:"audio/vnd.dts",dtshd:"audio/vnd.dts.hd",dwg:"image/vnd.dwg",geo:"application/vnd.dynageo",es:"application/ecmascript",mag:"application/vnd.ecowin.chart",mmr:"image/vnd.fujixerox.edmics-mmr",rlc:"image/vnd.fujixerox.edmics-rlc",exi:"application/exi",mgz:"application/vnd.proteus.magazine",epub:"application/epub+zip",eml:"message/rfc822",nml:"application/vnd.enliven",xpr:"application/vnd.is-xpr",xif:"image/vnd.xiff",xfdl:"application/vnd.xfdl",emma:"application/emma+xml",ez2:"application/vnd.ezpix-album",ez3:"application/vnd.ezpix-package",fst:"image/vnd.fst",fvt:"video/vnd.fvt",fbs:"image/vnd.fastbidsheet",fe_launch:"application/vnd.denovo.fcselayout-link",f4v:"video/x-f4v",flv:"video/x-flv",fpx:"image/vnd.fpx",npx:"image/vnd.net-fpx",flx:"text/vnd.fmi.flexstor",fli:"video/x-fli",ftc:"application/vnd.fluxtime.clip",fdf:"application/vnd.fdf",f:"text/x-fortran",mif:"application/vnd.mif",fm:"application/vnd.framemaker",fh:"image/x-freehand",fsc:"application/vnd.fsc.weblaunch",fnc:"application/vnd.frogans.fnc",ltf:"application/vnd.frogans.ltf",ddd:"application/vnd.fujixerox.ddd",xdw:"application/vnd.fujixerox.docuworks",xbd:"application/vnd.fujixerox.docuworks.binder",oas:"application/vnd.fujitsu.oasys",oa2:"application/vnd.fujitsu.oasys2",oa3:"application/vnd.fujitsu.oasys3",fg5:"application/vnd.fujitsu.oasysgp",bh2:"application/vnd.fujitsu.oasysprs",spl:"application/x-futuresplash",fzs:"application/vnd.fuzzysheet",g3:"image/g3fax",gmx:"application/vnd.gmx",gtw:"model/vnd.gtw",txd:"application/vnd.genomatix.tuxedo",ggb:"application/vnd.geogebra.file",ggt:"application/vnd.geogebra.tool",gdl:"model/vnd.gdl",gex:"application/vnd.geometry-explorer",gxt:"application/vnd.geonext",g2w:"application/vnd.geoplan",g3w:"application/vnd.geospace",gsf:"application/x-font-ghostscript",bdf:"application/x-font-bdf",gtar:"application/x-gtar",texinfo:"application/x-texinfo",gnumeric:"application/x-gnumeric",kml:"application/vnd.google-earth.kml+xml",kmz:"application/vnd.google-earth.kmz",gqf:"application/vnd.grafeq",gif:"image/gif",gv:"text/vnd.graphviz",gac:"application/vnd.groove-account",ghf:"application/vnd.groove-help",gim:"application/vnd.groove-identity-message",grv:"application/vnd.groove-injector",gtm:"application/vnd.groove-tool-message",tpl:"application/vnd.groove-tool-template",vcg:"application/vnd.groove-vcard",h261:"video/h261",h263:"video/h263",h264:"video/h264",hpid:"application/vnd.hp-hpid",hps:"application/vnd.hp-hps",hdf:"application/x-hdf",rip:"audio/vnd.rip",hbci:"application/vnd.hbci",jlt:"application/vnd.hp-jlyt",pcl:"application/vnd.hp-pcl",hpgl:"application/vnd.hp-hpgl",hvs:"application/vnd.yamaha.hv-script",hvd:"application/vnd.yamaha.hv-dic",hvp:"application/vnd.yamaha.hv-voice","sfd-hdstx":"application/vnd.hydrostatix.sof-data",stk:"application/hyperstudio",hal:"application/vnd.hal+xml",html:"text/html",irm:"application/vnd.ibm.rights-management",sc:"application/vnd.ibm.secure-container",ics:"text/calendar",icc:"application/vnd.iccprofile",ico:"image/x-icon",igl:"application/vnd.igloader",ief:"image/ief",ivp:"application/vnd.immervision-ivp",ivu:"application/vnd.immervision-ivu",rif:"application/reginfo+xml","3dml":"text/vnd.in3d.3dml",spot:"text/vnd.in3d.spot",igs:"model/iges",i2g:"application/vnd.intergeo",cdy:"application/vnd.cinderella",xpw:"application/vnd.intercon.formnet",fcs:"application/vnd.isac.fcs",ipfix:"application/ipfix",cer:"application/pkix-cert",pki:"application/pkixcmp",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",igm:"application/vnd.insors.igm",rcprofile:"application/vnd.ipunplugged.rcprofile",irp:"application/vnd.irepository.package+xml",jad:"text/vnd.sun.j2me.app-descriptor",jar:"application/java-archive",class:"application/java-vm",jnlp:"application/x-java-jnlp-file",ser:"application/java-serialized-object",java:"text/x-java-source,java",js:"application/javascript",json:"application/json",joda:"application/vnd.joost.joda-archive",jpm:"video/jpm",jpeg:"image/jpeg",jpg:"image/jpeg",pjpeg:"image/pjpeg",jpgv:"video/jpeg",ktz:"application/vnd.kahootz",mmd:"application/vnd.chipnuts.karaoke-mmd",karbon:"application/vnd.kde.karbon",chrt:"application/vnd.kde.kchart",kfo:"application/vnd.kde.kformula",flw:"application/vnd.kde.kivio",kon:"application/vnd.kde.kontour",kpr:"application/vnd.kde.kpresenter",ksp:"application/vnd.kde.kspread",kwd:"application/vnd.kde.kword",htke:"application/vnd.kenameaapp",kia:"application/vnd.kidspiration",kne:"application/vnd.kinar",sse:"application/vnd.kodak-descriptor",lasxml:"application/vnd.las.las+xml",latex:"application/x-latex",lbd:"application/vnd.llamagraphics.life-balance.desktop",lbe:"application/vnd.llamagraphics.life-balance.exchange+xml",jam:"application/vnd.jam",123:"application/vnd.lotus-1-2-3",apr:"application/vnd.lotus-approach",pre:"application/vnd.lotus-freelance",nsf:"application/vnd.lotus-notes",org:"application/vnd.lotus-organizer",scm:"application/vnd.lotus-screencam",lwp:"application/vnd.lotus-wordpro",lvp:"audio/vnd.lucent.voice",m3u:"audio/x-mpegurl",m4v:"video/x-m4v",hqx:"application/mac-binhex40",portpkg:"application/vnd.macports.portpkg",mgp:"application/vnd.osgeo.mapguide.package",mrc:"application/marc",mrcx:"application/marcxml+xml",mxf:"application/mxf",nbp:"application/vnd.wolfram.player",ma:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mc1:"application/vnd.medcalcdata",mscml:"application/mediaservercontrol+xml",cdkey:"application/vnd.mediastation.cdkey",mwf:"application/vnd.mfer",mfm:"application/vnd.mfmp",msh:"model/mesh",mads:"application/mads+xml",mets:"application/mets+xml",mods:"application/mods+xml",meta4:"application/metalink4+xml",mcd:"application/vnd.mcd",flo:"application/vnd.micrografx.flo",igx:"application/vnd.micrografx.igx",es3:"application/vnd.eszigno3+xml",mdb:"application/x-msaccess",asf:"video/x-ms-asf",exe:"application/x-msdownload",cil:"application/vnd.ms-artgalry",cab:"application/vnd.ms-cab-compressed",ims:"application/vnd.ms-ims",application:"application/x-ms-application",clp:"application/x-msclip",mdi:"image/vnd.ms-modi",eot:"application/vnd.ms-fontobject",xls:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xltm:"application/vnd.ms-excel.template.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",chm:"application/vnd.ms-htmlhelp",crd:"application/x-mscardfile",lrm:"application/vnd.ms-lrm",mvb:"application/x-msmediaview",mny:"application/x-msmoney",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",sldx:"application/vnd.openxmlformats-officedocument.presentationml.slide",ppsx:"application/vnd.openxmlformats-officedocument.presentationml.slideshow",potx:"application/vnd.openxmlformats-officedocument.presentationml.template",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",obd:"application/x-msbinder",thmx:"application/vnd.ms-officetheme",onetoc:"application/onenote",pya:"audio/vnd.ms-playready.media.pya",pyv:"video/vnd.ms-playready.media.pyv",ppt:"application/vnd.ms-powerpoint",ppam:"application/vnd.ms-powerpoint.addin.macroenabled.12",sldm:"application/vnd.ms-powerpoint.slide.macroenabled.12",pptm:"application/vnd.ms-powerpoint.presentation.macroenabled.12",ppsm:"application/vnd.ms-powerpoint.slideshow.macroenabled.12",potm:"application/vnd.ms-powerpoint.template.macroenabled.12",mpp:"application/vnd.ms-project",pub:"application/x-mspublisher",scd:"application/x-msschedule",xap:"application/x-silverlight-app",stl:"application/vnd.ms-pki.stl",cat:"application/vnd.ms-pki.seccat",vsd:"application/vnd.visio",vsdx:"application/vnd.visio2013",wm:"video/x-ms-wm",wma:"audio/x-ms-wma",wax:"audio/x-ms-wax",wmx:"video/x-ms-wmx",wmd:"application/x-ms-wmd",wpl:"application/vnd.ms-wpl",wmz:"application/x-ms-wmz",wmv:"video/x-ms-wmv",wvx:"video/x-ms-wvx",wmf:"application/x-msmetafile",trm:"application/x-msterminal",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",dotm:"application/vnd.ms-word.template.macroenabled.12",wri:"application/x-mswrite",wps:"application/vnd.ms-works",xbap:"application/x-ms-xbap",xps:"application/vnd.ms-xpsdocument",mid:"audio/midi",mpy:"application/vnd.ibm.minipay",afp:"application/vnd.ibm.modcap",rms:"application/vnd.jcp.javame.midlet-rms",tmo:"application/vnd.tmobile-livetv",prc:"application/x-mobipocket-ebook",mbk:"application/vnd.mobius.mbk",dis:"application/vnd.mobius.dis",plc:"application/vnd.mobius.plc",mqy:"application/vnd.mobius.mqy",msl:"application/vnd.mobius.msl",txf:"application/vnd.mobius.txf",daf:"application/vnd.mobius.daf",fly:"text/vnd.fly",mpc:"application/vnd.mophun.certificate",mpn:"application/vnd.mophun.application",mj2:"video/mj2",mpga:"audio/mpeg",mxu:"video/vnd.mpegurl",mpeg:"video/mpeg",m21:"application/mp21",mp4a:"audio/mp4",mp4:"video/mp4",m3u8:"application/vnd.apple.mpegurl",mus:"application/vnd.musician",msty:"application/vnd.muvee.style",mxml:"application/xv+xml",ngdat:"application/vnd.nokia.n-gage.data","n-gage":"application/vnd.nokia.n-gage.symbian.install",ncx:"application/x-dtbncx+xml",nc:"application/x-netcdf",nlu:"application/vnd.neurolanguage.nlu",dna:"application/vnd.dna",nnd:"application/vnd.noblenet-directory",nns:"application/vnd.noblenet-sealer",nnw:"application/vnd.noblenet-web",rpst:"application/vnd.nokia.radio-preset",rpss:"application/vnd.nokia.radio-presets",n3:"text/n3",edm:"application/vnd.novadigm.edm",edx:"application/vnd.novadigm.edx",ext:"application/vnd.novadigm.ext",gph:"application/vnd.flographit",ecelp4800:"audio/vnd.nuera.ecelp4800",ecelp7470:"audio/vnd.nuera.ecelp7470",ecelp9600:"audio/vnd.nuera.ecelp9600",oda:"application/oda",ogx:"application/ogg",oga:"audio/ogg",ogv:"video/ogg",dd2:"application/vnd.oma.dd2+xml",oth:"application/vnd.oasis.opendocument.text-web",opf:"application/oebps-package+xml",qbo:"application/vnd.intu.qbo",oxt:"application/vnd.openofficeorg.extension",osf:"application/vnd.yamaha.openscoreformat",weba:"audio/webm",webm:"video/webm",odc:"application/vnd.oasis.opendocument.chart",otc:"application/vnd.oasis.opendocument.chart-template",odb:"application/vnd.oasis.opendocument.database",odf:"application/vnd.oasis.opendocument.formula",odft:"application/vnd.oasis.opendocument.formula-template",odg:"application/vnd.oasis.opendocument.graphics",otg:"application/vnd.oasis.opendocument.graphics-template",odi:"application/vnd.oasis.opendocument.image",oti:"application/vnd.oasis.opendocument.image-template",odp:"application/vnd.oasis.opendocument.presentation",otp:"application/vnd.oasis.opendocument.presentation-template",ods:"application/vnd.oasis.opendocument.spreadsheet",ots:"application/vnd.oasis.opendocument.spreadsheet-template",odt:"application/vnd.oasis.opendocument.text",odm:"application/vnd.oasis.opendocument.text-master",ott:"application/vnd.oasis.opendocument.text-template",ktx:"image/ktx",sxc:"application/vnd.sun.xml.calc",stc:"application/vnd.sun.xml.calc.template",sxd:"application/vnd.sun.xml.draw",std:"application/vnd.sun.xml.draw.template",sxi:"application/vnd.sun.xml.impress",sti:"application/vnd.sun.xml.impress.template",sxm:"application/vnd.sun.xml.math",sxw:"application/vnd.sun.xml.writer",sxg:"application/vnd.sun.xml.writer.global",stw:"application/vnd.sun.xml.writer.template",otf:"application/x-font-otf",osfpvg:"application/vnd.yamaha.openscoreformat.osfpvg+xml",dp:"application/vnd.osgi.dp",pdb:"application/vnd.palm",p:"text/x-pascal",paw:"application/vnd.pawaafile",pclxl:"application/vnd.hp-pclxl",efif:"application/vnd.picsel",pcx:"image/x-pcx",psd:"image/vnd.adobe.photoshop",prf:"application/pics-rules",pic:"image/x-pict",chat:"application/x-chat",p10:"application/pkcs10",p12:"application/x-pkcs12",p7m:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p7r:"application/x-pkcs7-certreqresp",p7b:"application/x-pkcs7-certificates",p8:"application/pkcs8",plf:"application/vnd.pocketlearn",pnm:"image/x-portable-anymap",pbm:"image/x-portable-bitmap",pcf:"application/x-font-pcf",pfr:"application/font-tdpfr",pgn:"application/x-chess-pgn",pgm:"image/x-portable-graymap",png:"image/png",ppm:"image/x-portable-pixmap",pskcxml:"application/pskc+xml",pml:"application/vnd.ctc-posml",ai:"application/postscript",pfa:"application/x-font-type1",pbd:"application/vnd.powerbuilder6",pgp:"application/pgp-signature",box:"application/vnd.previewsystems.box",ptid:"application/vnd.pvi.ptid1",pls:"application/pls+xml",str:"application/vnd.pg.format",ei6:"application/vnd.pg.osasli",dsc:"text/prs.lines.tag",psf:"application/x-font-linux-psf",qps:"application/vnd.publishare-delta-tree",wg:"application/vnd.pmi.widget",qxd:"application/vnd.quark.quarkxpress",esf:"application/vnd.epson.esf",msf:"application/vnd.epson.msf",ssf:"application/vnd.epson.ssf",qam:"application/vnd.epson.quickanime",qfx:"application/vnd.intu.qfx",qt:"video/quicktime",rar:"application/x-rar-compressed",ram:"audio/x-pn-realaudio",rmp:"audio/x-pn-realaudio-plugin",rsd:"application/rsd+xml",rm:"application/vnd.rn-realmedia",bed:"application/vnd.realvnc.bed",mxl:"application/vnd.recordare.musicxml",musicxml:"application/vnd.recordare.musicxml+xml",rnc:"application/relax-ng-compact-syntax",rdz:"application/vnd.data-vision.rdz",rdf:"application/rdf+xml",rp9:"application/vnd.cloanto.rp9",jisp:"application/vnd.jisp",rtf:"application/rtf",rtx:"text/richtext",link66:"application/vnd.route66.link66+xml",rss:"application/rss+xml",shf:"application/shf+xml",st:"application/vnd.sailingtracker.track",svg:"image/svg+xml",sus:"application/vnd.sus-calendar",sru:"application/sru+xml",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",sema:"application/vnd.sema",semd:"application/vnd.semd",semf:"application/vnd.semf",see:"application/vnd.seemail",snf:"application/x-font-snf",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",sdp:"application/sdp",etx:"text/x-setext",movie:"video/x-sgi-movie",ifm:"application/vnd.shana.informed.formdata",itp:"application/vnd.shana.informed.formtemplate",iif:"application/vnd.shana.informed.interchange",ipk:"application/vnd.shana.informed.package",tfi:"application/thraud+xml",shar:"application/x-shar",rgb:"image/x-rgb",slt:"application/vnd.epson.salt",aso:"application/vnd.accpac.simply.aso",imp:"application/vnd.accpac.simply.imp",twd:"application/vnd.simtech-mindmapper",csp:"application/vnd.commonspace",saf:"application/vnd.yamaha.smaf-audio",mmf:"application/vnd.smaf",spf:"application/vnd.yamaha.smaf-phrase",teacher:"application/vnd.smart.teacher",svd:"application/vnd.svd",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",ssml:"application/ssml+xml",skp:"application/vnd.koan",sgml:"text/sgml",sdc:"application/vnd.stardivision.calc",sda:"application/vnd.stardivision.draw",sdd:"application/vnd.stardivision.impress",smf:"application/vnd.stardivision.math",sdw:"application/vnd.stardivision.writer",sgl:"application/vnd.stardivision.writer-global",sm:"application/vnd.stepmania.stepchart",sit:"application/x-stuffit",sitx:"application/x-stuffitx",sdkm:"application/vnd.solent.sdkm+xml",xo:"application/vnd.olpc-sugar",au:"audio/basic",wqd:"application/vnd.wqd",sis:"application/vnd.symbian.install",smi:"application/smil+xml",xsm:"application/vnd.syncml+xml",bdm:"application/vnd.syncml.dm+wbxml",xdm:"application/vnd.syncml.dm+xml",sv4cpio:"application/x-sv4cpio",sv4crc:"application/x-sv4crc",sbml:"application/sbml+xml",tsv:"text/tab-separated-values",tiff:"image/tiff",tao:"application/vnd.tao.intent-module-archive",tar:"application/x-tar",tcl:"application/x-tcl",tex:"application/x-tex",tfm:"application/x-tex-tfm",tei:"application/tei+xml",txt:"text/plain",dxp:"application/vnd.spotfire.dxp",sfs:"application/vnd.spotfire.sfs",tsd:"application/timestamped-data",tpt:"application/vnd.trid.tpt",mxs:"application/vnd.triscape.mxs",t:"text/troff",tra:"application/vnd.trueapp",ttf:"application/x-font-ttf",ttl:"text/turtle",umj:"application/vnd.umajin",uoml:"application/vnd.uoml+xml",unityweb:"application/vnd.unity",ufd:"application/vnd.ufdl",uri:"text/uri-list",utz:"application/vnd.uiq.theme",ustar:"application/x-ustar",uu:"text/x-uuencode",vcs:"text/x-vcalendar",vcf:"text/x-vcard",vcd:"application/x-cdlink",vsf:"application/vnd.vsf",wrl:"model/vrml",vcx:"application/vnd.vcx",mts:"model/vnd.mts",vtu:"model/vnd.vtu",vis:"application/vnd.visionary",viv:"video/vnd.vivo",ccxml:"application/ccxml+xml,",vxml:"application/voicexml+xml",src:"application/x-wais-source",wbxml:"application/vnd.wap.wbxml",wbmp:"image/vnd.wap.wbmp",wav:"audio/x-wav",davmount:"application/davmount+xml",woff:"application/x-font-woff",wspolicy:"application/wspolicy+xml",webp:"image/webp",wtb:"application/vnd.webturbo",wgt:"application/widget",hlp:"application/winhlp",wml:"text/vnd.wap.wml",wmls:"text/vnd.wap.wmlscript",wmlsc:"application/vnd.wap.wmlscriptc",wpd:"application/vnd.wordperfect",stf:"application/vnd.wt.stf",wsdl:"application/wsdl+xml",xbm:"image/x-xbitmap",xpm:"image/x-xpixmap",xwd:"image/x-xwindowdump",der:"application/x-x509-ca-cert",fig:"application/x-xfig",xhtml:"application/xhtml+xml",xml:"application/xml",xdf:"application/xcap-diff+xml",xenc:"application/xenc+xml",xer:"application/patch-ops-error+xml",rl:"application/resource-lists+xml",rs:"application/rls-services+xml",rld:"application/resource-lists-diff+xml",xslt:"application/xslt+xml",xop:"application/xop+xml",xpi:"application/x-xpinstall",xspf:"application/xspf+xml",xul:"application/vnd.mozilla.xul+xml",xyz:"chemical/x-xyz",yaml:"text/yaml",yang:"application/yang",yin:"application/yin+xml",zir:"application/vnd.zul",zip:"application/zip",zmm:"application/vnd.handheld-entertainment+xml",zaz:"application/vnd.zzazz.deck+xml"},$M=Object.fromEntries(Object.entries(f1).map(function(e){var t=qn(e,2),n=t[0],r=t[1];return[r,n]})),Fz=/^data:(.*?);base64,/;function zz(e){var t=Fz.exec(e);if(t&&t[1])return t[1]}function Bz(e){var t=$M[e];return t||e.split("/")[1]}function $z(e){var t=e.split(".").pop(),n=t&&f1[t];if(n)return n}function VM(e,t,n,r,o){var i="".concat((r==null?void 0:r.width)||"").concat((r==null?void 0:r.height)||"").concat(r==null?void 0:r.mimeType),s={type:t.type,opt:t.opt,options:$t({},t.options)};return e+JSON.stringify(s)+n+i+o}function Vz(e,t,n,r,o,i){return d1(i.encode(VM(e,t,n,r,o))).slice(0,4)}function UM(e){return e.slice(0,12)}function Uz(e){return UM(d1(new Uint8Array(e)))}var aa="?p=",de={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:K5,convertRemoteSource:Cz,getSchema:V5,getValPath:jM,getSource:tz,resolvePath:lz,splitModuleFilePathAndModulePath:LM,joinModuleFilePathAndModulePath:FM,remote:{createRemoteRef:kz,getValidationBasis:VM,getValidationHash:Vz,getFileHash:Uz,hashToRemoteFileHash:UM,splitRemoteRef:BM},isVal:q5,isFile:U5,createValPathOfItem:vf,getSHA256Hash:d1,initSchema:Sz,getMimeType:zz,mimeTypeToFileExt:Bz,filenameToMimeType:$z,EXT_TO_MIME_TYPES:f1,MIME_TYPES_TO_EXT:$M,ModuleFilePathSep:aa,notFileOp:function(t){return t.op!=="file"},isFileOp:function(t){return t.op==="file"&&typeof t.filePath=="string"},createPatchJSONPath:function(t){return"/".concat(t.split(".").map(function(n){return n&&Hz(n)}).join("/"))},createPatchPath:function(t){return Vm(t)},splitModulePath:Vm,splitModuleFilePath:cz,splitJoinedSourcePaths:uz,parentOfSourcePath:dz,patchPathToModulePath:zM,VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session",createFilename:function(t,n,r,o){var i,s;if(!r||!t)return n;var a=o.slice(0,5),l=(i=de.getMimeType(t))!==null&&i!==void 0?i:"unknown",c=(s=de.mimeTypeToFileExt(l))!==null&&s!==void 0?s:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,d=u.lastIndexOf("_"),p=u.slice(d+1,u.length);p===a&&(u=u.slice(0,d));var h=encodeURIComponent(u).replace(/%[0-9A-Fa-f]{2}/g,"").toLowerCase();return"".concat(h,"_").concat(a,".").concat(c)}return"".concat(o,".").concat(c)}};function Hz(e){try{return JSON.parse(e)}catch{return e}}function Bs(e){return Array.isArray(e)}function Yc(e){"@babel/helpers - typeof";return Yc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yc(e)}function gn(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Oe(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function We(e){Oe(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Yc(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Hn(e,t){Oe(2,arguments);var n=We(e),r=gn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Do(e,t){Oe(2,arguments);var n=We(e),r=gn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());i.setMonth(n.getMonth()+r+1,0);var s=i.getDate();return o>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}function Wz(e,t){Oe(2,arguments);var n=We(e).getTime(),r=gn(t);return new Date(n+r)}var Kz={};function Na(){return Kz}function si(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=Na(),d=gn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=We(e),h=p.getDay(),m=(h<d?7:0)+h-d;return p.setDate(p.getDate()-m),p.setHours(0,0,0,0),p}function yl(e){return Oe(1,arguments),si(e,{weekStartsOn:1})}function qz(e){Oe(1,arguments);var t=We(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=yl(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var s=yl(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function Gz(e){Oe(1,arguments);var t=qz(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=yl(n);return r}function yf(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function Jc(e){Oe(1,arguments);var t=We(e);return t.setHours(0,0,0,0),t}var Yz=864e5;function Di(e,t){Oe(2,arguments);var n=Jc(e),r=Jc(t),o=n.getTime()-yf(n),i=r.getTime()-yf(r);return Math.round((o-i)/Yz)}function Ux(e,t){Oe(2,arguments);var n=gn(t),r=n*7;return Hn(e,r)}function Jz(e,t){Oe(2,arguments);var n=gn(t);return Do(e,n*12)}function Xz(e){Oe(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(Yc(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=We(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function Zz(e){Oe(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(Yc(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=We(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function or(e,t){Oe(2,arguments);var n=Jc(e),r=Jc(t);return n.getTime()===r.getTime()}function p1(e){return Oe(1,arguments),e instanceof Date||Yc(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Qz(e){if(Oe(1,arguments),!p1(e)&&typeof e!="number")return!1;var t=We(e);return!isNaN(Number(t))}function xf(e,t){Oe(2,arguments);var n=We(e),r=We(t),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}var e6=6048e5;function t6(e,t,n){Oe(2,arguments);var r=si(e,n),o=si(t,n),i=r.getTime()-yf(r),s=o.getTime()-yf(o);return Math.round((i-s)/e6)}function h1(e){Oe(1,arguments);var t=We(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function ur(e){Oe(1,arguments);var t=We(e);return t.setDate(1),t.setHours(0,0,0,0),t}function n6(e){Oe(1,arguments);var t=We(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function m1(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=Na(),d=gn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=We(e),h=p.getDay(),m=(h<d?-7:0)+6-(h-d);return p.setDate(p.getDate()+m),p.setHours(23,59,59,999),p}function HM(e){return Oe(1,arguments),m1(e,{weekStartsOn:1})}function r6(e,t){Oe(2,arguments);var n=gn(t);return Wz(e,-n)}var o6=864e5;function i6(e){Oe(1,arguments);var t=We(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),o=n-r;return Math.floor(o/o6)+1}function Um(e){Oe(1,arguments);var t=1,n=We(e),r=n.getUTCDay(),o=(r<t?7:0)+r-t;return n.setUTCDate(n.getUTCDate()-o),n.setUTCHours(0,0,0,0),n}function WM(e){Oe(1,arguments);var t=We(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Um(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=Um(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function s6(e){Oe(1,arguments);var t=WM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Um(n);return r}var a6=6048e5;function l6(e){Oe(1,arguments);var t=We(e),n=Um(t).getTime()-s6(t).getTime();return Math.round(n/a6)+1}function Hm(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=Na(),d=gn((n=(r=(o=(i=t==null?void 0:t.weekStartsOn)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.weekStartsOn)!==null&&o!==void 0?o:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=We(e),h=p.getUTCDay(),m=(h<d?7:0)+h-d;return p.setUTCDate(p.getUTCDate()-m),p.setUTCHours(0,0,0,0),p}function KM(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=We(e),d=u.getUTCFullYear(),p=Na(),h=gn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:p.firstWeekContainsDate)!==null&&r!==void 0?r:(l=p.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,h),m.setUTCHours(0,0,0,0);var v=Hm(m,t),b=new Date(0);b.setUTCFullYear(d,0,h),b.setUTCHours(0,0,0,0);var x=Hm(b,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=x.getTime()?d:d-1}function c6(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=Na(),d=gn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),p=KM(e,t),h=new Date(0);h.setUTCFullYear(p,0,d),h.setUTCHours(0,0,0,0);var m=Hm(h,t);return m}var u6=6048e5;function d6(e,t){Oe(1,arguments);var n=We(e),r=Hm(n,t).getTime()-c6(n,t).getTime();return Math.round(r/u6)+1}function ut(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var ps={y:function(t,n){var r=t.getUTCFullYear(),o=r>0?r:1-r;return ut(n==="yy"?o%100:o,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):ut(r+1,2)},d:function(t,n){return ut(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return ut(t.getUTCHours()%12||12,n.length)},H:function(t,n){return ut(t.getUTCHours(),n.length)},m:function(t,n){return ut(t.getUTCMinutes(),n.length)},s:function(t,n){return ut(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,o=t.getUTCMilliseconds(),i=Math.floor(o*Math.pow(10,r-3));return ut(i,n.length)}},Vl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},f6={G:function(t,n,r){var o=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(o,{width:"abbreviated"});case"GGGGG":return r.era(o,{width:"narrow"});case"GGGG":default:return r.era(o,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var o=t.getUTCFullYear(),i=o>0?o:1-o;return r.ordinalNumber(i,{unit:"year"})}return ps.y(t,n)},Y:function(t,n,r,o){var i=KM(t,o),s=i>0?i:1-i;if(n==="YY"){var a=s%100;return ut(a,2)}return n==="Yo"?r.ordinalNumber(s,{unit:"year"}):ut(s,n.length)},R:function(t,n){var r=WM(t);return ut(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return ut(r,n.length)},Q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(o);case"QQ":return ut(o,2);case"Qo":return r.ordinalNumber(o,{unit:"quarter"});case"QQQ":return r.quarter(o,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(o,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(o,{width:"wide",context:"formatting"})}},q:function(t,n,r){var o=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(o);case"qq":return ut(o,2);case"qo":return r.ordinalNumber(o,{unit:"quarter"});case"qqq":return r.quarter(o,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(o,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(o,{width:"wide",context:"standalone"})}},M:function(t,n,r){var o=t.getUTCMonth();switch(n){case"M":case"MM":return ps.M(t,n);case"Mo":return r.ordinalNumber(o+1,{unit:"month"});case"MMM":return r.month(o,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(o,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(o,{width:"wide",context:"formatting"})}},L:function(t,n,r){var o=t.getUTCMonth();switch(n){case"L":return String(o+1);case"LL":return ut(o+1,2);case"Lo":return r.ordinalNumber(o+1,{unit:"month"});case"LLL":return r.month(o,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(o,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(o,{width:"wide",context:"standalone"})}},w:function(t,n,r,o){var i=d6(t,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):ut(i,n.length)},I:function(t,n,r){var o=l6(t);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):ut(o,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):ps.d(t,n)},D:function(t,n,r){var o=i6(t);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):ut(o,n.length)},E:function(t,n,r){var o=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(o,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(o,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(o,{width:"short",context:"formatting"});case"EEEE":default:return r.day(o,{width:"wide",context:"formatting"})}},e:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(s);case"ee":return ut(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});case"eeee":default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,r,o){var i=t.getUTCDay(),s=(i-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(s);case"cc":return ut(s,n.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});case"cccc":default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,r){var o=t.getUTCDay(),i=o===0?7:o;switch(n){case"i":return String(i);case"ii":return ut(i,n.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(o,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(o,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(o,{width:"short",context:"formatting"});case"iiii":default:return r.day(o,{width:"wide",context:"formatting"})}},a:function(t,n,r){var o=t.getUTCHours(),i=o/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,n,r){var o=t.getUTCHours(),i;switch(o===12?i=Vl.noon:o===0?i=Vl.midnight:i=o/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,n,r){var o=t.getUTCHours(),i;switch(o>=17?i=Vl.evening:o>=12?i=Vl.afternoon:o>=4?i=Vl.morning:i=Vl.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var o=t.getUTCHours()%12;return o===0&&(o=12),r.ordinalNumber(o,{unit:"hour"})}return ps.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):ps.H(t,n)},K:function(t,n,r){var o=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):ut(o,n.length)},k:function(t,n,r){var o=t.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):ut(o,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):ps.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):ps.s(t,n)},S:function(t,n){return ps.S(t,n)},X:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();if(s===0)return"Z";switch(n){case"X":return XE(s);case"XXXX":case"XX":return za(s);case"XXXXX":case"XXX":default:return za(s,":")}},x:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"x":return XE(s);case"xxxx":case"xx":return za(s);case"xxxxx":case"xxx":default:return za(s,":")}},O:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+JE(s,":");case"OOOO":default:return"GMT"+za(s,":")}},z:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+JE(s,":");case"zzzz":default:return"GMT"+za(s,":")}},t:function(t,n,r,o){var i=o._originalDate||t,s=Math.floor(i.getTime()/1e3);return ut(s,n.length)},T:function(t,n,r,o){var i=o._originalDate||t,s=i.getTime();return ut(s,n.length)}};function JE(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(i===0)return n+String(o);var s=t;return n+String(o)+s+ut(i,2)}function XE(e,t){if(e%60===0){var n=e>0?"-":"+";return n+ut(Math.abs(e)/60,2)}return za(e,t)}function za(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e),i=ut(Math.floor(o/60),2),s=ut(o%60,2);return r+i+n+s}var ZE=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},qM=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},p6=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return ZE(t,n);var s;switch(o){case"P":s=n.dateTime({width:"short"});break;case"PP":s=n.dateTime({width:"medium"});break;case"PPP":s=n.dateTime({width:"long"});break;case"PPPP":default:s=n.dateTime({width:"full"});break}return s.replace("{{date}}",ZE(o,n)).replace("{{time}}",qM(i,n))},h6={p:qM,P:p6},m6=["D","DD"],g6=["YY","YYYY"];function v6(e){return m6.indexOf(e)!==-1}function y6(e){return g6.indexOf(e)!==-1}function QE(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var x6={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},b6=function(t,n,r){var o,i=x6[t];return typeof i=="string"?o=i:n===1?o=i.one:o=i.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o};function qy(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var w6={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},S6={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},k6={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},E6={date:qy({formats:w6,defaultWidth:"full"}),time:qy({formats:S6,defaultWidth:"full"}),dateTime:qy({formats:k6,defaultWidth:"full"})},C6={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},_6=function(t,n,r,o){return C6[t]};function qu(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):i;o=e.formattingValues[s]||e.formattingValues[i]}else{var a=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[l]||e.values[a]}var c=e.argumentCallback?e.argumentCallback(t):t;return o[c]}}var N6={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},T6={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},O6={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},M6={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},P6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},j6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},R6=function(t,n){var r=Number(t),o=r%100;if(o>20||o<10)switch(o%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},A6={ordinalNumber:R6,era:qu({values:N6,defaultWidth:"wide"}),quarter:qu({values:T6,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:qu({values:O6,defaultWidth:"wide"}),day:qu({values:M6,defaultWidth:"wide"}),dayPeriod:qu({values:P6,defaultWidth:"wide",formattingValues:j6,defaultFormattingWidth:"wide"})};function Gu(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(o);if(!i)return null;var s=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?D6(a,function(d){return d.test(s)}):I6(a,function(d){return d.test(s)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(s.length);return{value:c,rest:u}}}function I6(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function D6(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function L6(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var s=e.valueCallback?e.valueCallback(i[0]):i[0];s=n.valueCallback?n.valueCallback(s):s;var a=t.slice(o.length);return{value:s,rest:a}}}var F6=/^(\d+)(th|st|nd|rd)?/i,z6=/\d+/i,B6={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$6={any:[/^b/i,/^(a|c)/i]},V6={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},U6={any:[/1/i,/2/i,/3/i,/4/i]},H6={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},W6={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},K6={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},q6={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},G6={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Y6={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},J6={ordinalNumber:L6({matchPattern:F6,parsePattern:z6,valueCallback:function(t){return parseInt(t,10)}}),era:Gu({matchPatterns:B6,defaultMatchWidth:"wide",parsePatterns:$6,defaultParseWidth:"any"}),quarter:Gu({matchPatterns:V6,defaultMatchWidth:"wide",parsePatterns:U6,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:Gu({matchPatterns:H6,defaultMatchWidth:"wide",parsePatterns:W6,defaultParseWidth:"any"}),day:Gu({matchPatterns:K6,defaultMatchWidth:"wide",parsePatterns:q6,defaultParseWidth:"any"}),dayPeriod:Gu({matchPatterns:G6,defaultMatchWidth:"any",parsePatterns:Y6,defaultParseWidth:"any"})},GM={code:"en-US",formatDistance:b6,formatLong:E6,formatRelative:_6,localize:A6,match:J6,options:{weekStartsOn:0,firstWeekContainsDate:1}},X6=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Z6=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Q6=/^'([^]*?)'?$/,eB=/''/g,tB=/[a-zA-Z]/;function ts(e,t,n){var r,o,i,s,a,l,c,u,d,p,h,m,v,b,x,w,k,C;Oe(2,arguments);var _=String(t),O=Na(),T=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:O.locale)!==null&&r!==void 0?r:GM,j=gn((i=(s=(a=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:O.firstWeekContainsDate)!==null&&s!==void 0?s:(d=O.locale)===null||d===void 0||(p=d.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var A=gn((h=(m=(v=(b=n==null?void 0:n.weekStartsOn)!==null&&b!==void 0?b:n==null||(x=n.locale)===null||x===void 0||(w=x.options)===null||w===void 0?void 0:w.weekStartsOn)!==null&&v!==void 0?v:O.weekStartsOn)!==null&&m!==void 0?m:(k=O.locale)===null||k===void 0||(C=k.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&h!==void 0?h:0);if(!(A>=0&&A<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!T.localize)throw new RangeError("locale must contain localize property");if(!T.formatLong)throw new RangeError("locale must contain formatLong property");var D=We(e);if(!Qz(D))throw new RangeError("Invalid time value");var V=yf(D),W=r6(D,V),J={firstWeekContainsDate:j,weekStartsOn:A,locale:T,_originalDate:D},X=_.match(Z6).map(function(U){var I=U[0];if(I==="p"||I==="P"){var R=h6[I];return R(U,T.formatLong)}return U}).join("").match(X6).map(function(U){if(U==="''")return"'";var I=U[0];if(I==="'")return nB(U);var R=f6[I];if(R)return!(n!=null&&n.useAdditionalWeekYearTokens)&&y6(U)&&QE(U,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&v6(U)&&QE(U,t,String(e)),R(W,U,T.localize,J);if(I.match(tB))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return U}).join("");return X}function nB(e){var t=e.match(Q6);return t?t[1].replace(eB,"'"):e}function rB(e){Oe(1,arguments);var t=We(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}var oB=6048e5;function iB(e){Oe(1,arguments);var t=We(e),n=yl(t).getTime()-Gz(t).getTime();return Math.round(n/oB)+1}function sB(e){Oe(1,arguments);var t=We(e),n=t.getTime();return n}function aB(e){return Oe(1,arguments),Math.floor(sB(e)/1e3)}function lB(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=We(e),d=u.getFullYear(),p=Na(),h=gn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:p.firstWeekContainsDate)!==null&&r!==void 0?r:(l=p.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(d+1,0,h),m.setHours(0,0,0,0);var v=si(m,t),b=new Date(0);b.setFullYear(d,0,h),b.setHours(0,0,0,0);var x=si(b,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=x.getTime()?d:d-1}function cB(e,t){var n,r,o,i,s,a,l,c;Oe(1,arguments);var u=Na(),d=gn((n=(r=(o=(i=t==null?void 0:t.firstWeekContainsDate)!==null&&i!==void 0?i:t==null||(s=t.locale)===null||s===void 0||(a=s.options)===null||a===void 0?void 0:a.firstWeekContainsDate)!==null&&o!==void 0?o:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),p=lB(e,t),h=new Date(0);h.setFullYear(p,0,d),h.setHours(0,0,0,0);var m=si(h,t);return m}var uB=6048e5;function dB(e,t){Oe(1,arguments);var n=We(e),r=si(n,t).getTime()-cB(n,t).getTime();return Math.round(r/uB)+1}function fB(e){Oe(1,arguments);var t=We(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function pB(e,t){return Oe(1,arguments),t6(fB(e),ur(e),t)+1}function Hx(e,t){Oe(2,arguments);var n=We(e),r=We(t);return n.getTime()>r.getTime()}function YM(e,t){Oe(2,arguments);var n=We(e),r=We(t);return n.getTime()<r.getTime()}function g1(e,t){Oe(2,arguments);var n=We(e),r=We(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function hB(e,t){Oe(2,arguments);var n=We(e),r=We(t);return n.getFullYear()===r.getFullYear()}function Gy(e,t){Oe(2,arguments);var n=gn(t);return Hn(e,-n)}function Yy(e,t){Oe(2,arguments);var n=We(e),r=gn(t),o=n.getFullYear(),i=n.getDate(),s=new Date(0);s.setFullYear(o,r,15),s.setHours(0,0,0,0);var a=rB(s);return n.setMonth(r,Math.min(i,a)),n}function eC(e,t){Oe(2,arguments);var n=We(e),r=gn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var Ie=function(){return Ie=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ie.apply(this,arguments)};function mB(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function JM(e,t,n){for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function bp(e){return e.mode==="multiple"}function wp(e){return e.mode==="range"}function fv(e){return e.mode==="single"}var gB={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function vB(e,t){return ts(e,"LLLL y",t)}function yB(e,t){return ts(e,"d",t)}function xB(e,t){return ts(e,"LLLL",t)}function bB(e){return"".concat(e)}function wB(e,t){return ts(e,"cccccc",t)}function SB(e,t){return ts(e,"yyyy",t)}var kB=Object.freeze({__proto__:null,formatCaption:vB,formatDay:yB,formatMonthCaption:xB,formatWeekNumber:bB,formatWeekdayName:wB,formatYearCaption:SB}),EB=function(e,t,n){return ts(e,"do MMMM (EEEE)",n)},CB=function(){return"Month: "},_B=function(){return"Go to next month"},NB=function(){return"Go to previous month"},TB=function(e,t){return ts(e,"cccc",t)},OB=function(e){return"Week n. ".concat(e)},MB=function(){return"Year: "},PB=Object.freeze({__proto__:null,labelDay:EB,labelMonthDropdown:CB,labelNext:_B,labelPrevious:NB,labelWeekNumber:OB,labelWeekday:TB,labelYearDropdown:MB});function jB(){var e="buttons",t=gB,n=GM,r={},o={},i=1,s={},a=new Date;return{captionLayout:e,classNames:t,formatters:kB,labels:PB,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function RB(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,s=e.toDate;return r?i=ur(r):t&&(i=new Date(t,0,1)),o?s=h1(o):n&&(s=new Date(n,11,31)),{fromDate:i?Jc(i):void 0,toDate:s?Jc(s):void 0}}var XM=g.createContext(void 0);function ZM(e){var t,n=e.initialProps,r=jB(),o=RB(n),i=o.fromDate,s=o.toDate,a=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;a!=="buttons"&&(!i||!s)&&(a="buttons");var l;(fv(n)||bp(n)||wp(n))&&(l=n.onSelect);var c=Ie(Ie(Ie({},r),n),{captionLayout:a,classNames:Ie(Ie({},r.classNames),n.classNames),components:Ie({},n.components),formatters:Ie(Ie({},r.formatters),n.formatters),fromDate:i,labels:Ie(Ie({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Ie(Ie({},r.modifiers),n.modifiers),modifiersClassNames:Ie(Ie({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:Ie(Ie({},r.styles),n.styles),toDate:s});return f.jsx(XM.Provider,{value:c,children:e.children})}function wt(){var e=g.useContext(XM);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function QM(e){var t=wt(),n=t.locale,r=t.classNames,o=t.styles,i=t.formatters.formatCaption;return f.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function AB(e){return f.jsx("svg",Ie({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:f.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function eP(e){var t,n,r=e.onChange,o=e.value,i=e.children,s=e.caption,a=e.className,l=e.style,c=wt(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:AB;return f.jsxs("div",{className:a,style:l,children:[f.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),f.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:r,children:i}),f.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,f.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function IB(e){var t,n=wt(),r=n.fromDate,o=n.toDate,i=n.styles,s=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return f.jsx(f.Fragment,{});if(!o)return f.jsx(f.Fragment,{});var d=[];if(hB(r,o))for(var p=ur(r),h=r.getMonth();h<=o.getMonth();h++)d.push(Yy(p,h));else for(var p=ur(new Date),h=0;h<=11;h++)d.push(Yy(p,h));var m=function(b){var x=Number(b.target.value),w=Yy(ur(e.displayMonth),x);e.onChange(w)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:eP;return f.jsx(v,{name:"months","aria-label":u(),className:l.dropdown_month,style:i.dropdown_month,onChange:m,value:e.displayMonth.getMonth(),caption:a(e.displayMonth,{locale:s}),children:d.map(function(b){return f.jsx("option",{value:b.getMonth(),children:a(b,{locale:s})},b.getMonth())})})}function DB(e){var t,n=e.displayMonth,r=wt(),o=r.fromDate,i=r.toDate,s=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,d=r.labels.labelYearDropdown,p=[];if(!o)return f.jsx(f.Fragment,{});if(!i)return f.jsx(f.Fragment,{});for(var h=o.getFullYear(),m=i.getFullYear(),v=h;v<=m;v++)p.push(eC(n6(new Date),v));var b=function(w){var k=eC(ur(n),Number(w.target.value));e.onChange(k)},x=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:eP;return f.jsx(x,{name:"years","aria-label":d(),className:l.dropdown_year,style:a.dropdown_year,onChange:b,value:n.getFullYear(),caption:u(n,{locale:s}),children:p.map(function(w){return f.jsx("option",{value:w.getFullYear(),children:u(w,{locale:s})},w.getFullYear())})})}function LB(e,t){var n=g.useState(e),r=n[0],o=n[1],i=t===void 0?r:t;return[i,o]}function FB(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,i=e.toDate,s=e.fromDate,a=e.numberOfMonths,l=a===void 0?1:a;if(i&&xf(i,o)<0){var c=-1*(l-1);o=Do(i,c)}return s&&xf(o,s)<0&&(o=s),ur(o)}function zB(){var e=wt(),t=FB(e),n=LB(t,e.month),r=n[0],o=n[1],i=function(s){var a;if(!e.disableNavigation){var l=ur(s);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,i]}function BB(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=ur(e),i=ur(Do(o,r)),s=xf(i,o),a=[],l=0;l<s;l++){var c=Do(o,l);a.push(c)}return n&&(a=a.reverse()),a}function $B(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=ur(e);if(!n)return Do(a,s);var l=xf(n,e);if(!(l<i))return Do(a,s)}}function VB(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,i=o===void 0?1:o,s=r?i:1,a=ur(e);if(!n)return Do(a,-s);var l=xf(a,n);if(!(l<=0))return Do(a,-s)}}var tP=g.createContext(void 0);function UB(e){var t=wt(),n=zB(),r=n[0],o=n[1],i=BB(r,t),s=$B(r,t),a=VB(r,t),l=function(d){return i.some(function(p){return g1(d,p)})},c=function(d,p){l(d)||(p&&YM(d,p)?o(Do(d,1+t.numberOfMonths*-1)):o(d))},u={currentMonth:r,displayMonths:i,goToMonth:o,goToDate:c,previousMonth:a,nextMonth:s,isDateDisplayed:l};return f.jsx(tP.Provider,{value:u,children:e.children})}function Sp(){var e=g.useContext(tP);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function tC(e){var t,n=wt(),r=n.classNames,o=n.styles,i=n.components,s=Sp().goToMonth,a=function(u){s(Do(u,e.displayIndex?-e.displayIndex:0))},l=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:QM,c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth});return f.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[f.jsx("div",{className:r.vhidden,children:c}),f.jsx(IB,{onChange:a,displayMonth:e.displayMonth}),f.jsx(DB,{onChange:a,displayMonth:e.displayMonth})]})}function HB(e){return f.jsx("svg",Ie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:f.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function WB(e){return f.jsx("svg",Ie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:f.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Wm=g.forwardRef(function(e,t){var n=wt(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var s=i.join(" "),a=Ie(Ie({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),f.jsx("button",Ie({},e,{ref:t,type:"button",className:s,style:a}))});function KB(e){var t,n,r=wt(),o=r.dir,i=r.locale,s=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,d=r.components;if(!e.nextMonth&&!e.previousMonth)return f.jsx(f.Fragment,{});var p=c(e.previousMonth,{locale:i}),h=[s.nav_button,s.nav_button_previous].join(" "),m=u(e.nextMonth,{locale:i}),v=[s.nav_button,s.nav_button_next].join(" "),b=(t=d==null?void 0:d.IconRight)!==null&&t!==void 0?t:WB,x=(n=d==null?void 0:d.IconLeft)!==null&&n!==void 0?n:HB;return f.jsxs("div",{className:s.nav,style:a.nav,children:[!e.hidePrevious&&f.jsx(Wm,{name:"previous-month","aria-label":p,className:h,style:a.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?f.jsx(b,{className:s.nav_icon,style:a.nav_icon}):f.jsx(x,{className:s.nav_icon,style:a.nav_icon})}),!e.hideNext&&f.jsx(Wm,{name:"next-month","aria-label":m,className:v,style:a.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?f.jsx(x,{className:s.nav_icon,style:a.nav_icon}):f.jsx(b,{className:s.nav_icon,style:a.nav_icon})})]})}function nC(e){var t=wt().numberOfMonths,n=Sp(),r=n.previousMonth,o=n.nextMonth,i=n.goToMonth,s=n.displayMonths,a=s.findIndex(function(m){return g1(e.displayMonth,m)}),l=a===0,c=a===s.length-1,u=t>1&&(l||!c),d=t>1&&(c||!l),p=function(){r&&i(r)},h=function(){o&&i(o)};return f.jsx(KB,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:d,nextMonth:o,previousMonth:r,onPreviousClick:p,onNextClick:h})}function qB(e){var t,n=wt(),r=n.classNames,o=n.disableNavigation,i=n.styles,s=n.captionLayout,a=n.components,l=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:QM,c;return o?c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?c=f.jsx(tC,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?c=f.jsxs(f.Fragment,{children:[f.jsx(tC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),f.jsx(nC,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=f.jsxs(f.Fragment,{children:[f.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(nC,{displayMonth:e.displayMonth,id:e.id})]}),f.jsx("div",{className:r.caption,style:i.caption,children:c})}function GB(e){var t=wt(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?f.jsx("tfoot",{className:o,style:r.tfoot,children:f.jsx("tr",{children:f.jsx("td",{colSpan:8,children:n})})}):f.jsx(f.Fragment,{})}function YB(e,t,n){for(var r=n?yl(new Date):si(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var s=Hn(r,i);o.push(s)}return o}function JB(){var e=wt(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,i=e.weekStartsOn,s=e.ISOWeek,a=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,c=YB(o,i,s);return f.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&f.jsx("td",{style:n.head_cell,className:t.head_cell}),c.map(function(u,d){return f.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":l(u,{locale:o}),children:a(u,{locale:o})},d)})]})}function XB(){var e,t=wt(),n=t.classNames,r=t.styles,o=t.components,i=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:JB;return f.jsx("thead",{style:r.head,className:n.head,children:f.jsx(i,{})})}function ZB(e){var t=wt(),n=t.locale,r=t.formatters.formatDay;return f.jsx(f.Fragment,{children:r(e.date,{locale:n})})}var v1=g.createContext(void 0);function QB(e){if(!bp(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return f.jsx(v1.Provider,{value:t,children:e.children})}return f.jsx(e8,{initialProps:e.initialProps,children:e.children})}function e8(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,i=t.max,s=function(c,u,d){var p,h;(p=t.onDayClick)===null||p===void 0||p.call(t,c,u,d);var m=!!(u.selected&&o&&(r==null?void 0:r.length)===o);if(!m){var v=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!v){var b=r?JM([],r):[];if(u.selected){var x=b.findIndex(function(w){return or(c,w)});b.splice(x,1)}else b.push(c);(h=t.onSelect)===null||h===void 0||h.call(t,b,c,u,d)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=i&&r.length>i-1,d=r.some(function(p){return or(p,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return f.jsx(v1.Provider,{value:l,children:n})}function y1(){var e=g.useContext(v1);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function t8(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?or(o,e)&&or(r,e)?void 0:or(o,e)?{from:o,to:void 0}:or(r,e)?void 0:Hx(r,e)?{from:e,to:o}:{from:r,to:e}:o?Hx(e,o)?{from:o,to:e}:{from:e,to:o}:r?YM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var x1=g.createContext(void 0);function n8(e){if(!wp(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return f.jsx(x1.Provider,{value:t,children:e.children})}return f.jsx(r8,{initialProps:e.initialProps,children:e.children})}function r8(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},i=o.from,s=o.to,a=t.min,l=t.max,c=function(h,m,v){var b,x;(b=t.onDayClick)===null||b===void 0||b.call(t,h,m,v);var w=t8(h,r);(x=t.onSelect)===null||x===void 0||x.call(t,w,h,m,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],s?(u.range_end=[s],or(i,s)||(u.range_middle=[{after:i,before:s}])):u.range_end=[i]):s&&(u.range_start=[s],u.range_end=[s]),a&&(i&&!s&&u.disabled.push({after:Gy(i,a-1),before:Hn(i,a-1)}),i&&s&&u.disabled.push({after:i,before:Hn(i,a-1)}),!i&&s&&u.disabled.push({after:Gy(s,a-1),before:Hn(s,a-1)})),l){if(i&&!s&&(u.disabled.push({before:Hn(i,-l+1)}),u.disabled.push({after:Hn(i,l-1)})),i&&s){var d=Di(s,i)+1,p=l-d;u.disabled.push({before:Gy(i,p)}),u.disabled.push({after:Hn(s,p)})}!i&&s&&(u.disabled.push({before:Hn(s,-l+1)}),u.disabled.push({after:Hn(s,l-1)}))}return f.jsx(x1.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function b1(){var e=g.useContext(x1);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Yh(e){return Array.isArray(e)?JM([],e):e!==void 0?[e]:[]}function o8(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=Yh(o)}),t}var Lo;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Lo||(Lo={}));var i8=Lo.Selected,xi=Lo.Disabled,s8=Lo.Hidden,a8=Lo.Today,Jy=Lo.RangeEnd,Xy=Lo.RangeMiddle,Zy=Lo.RangeStart,l8=Lo.Outside;function c8(e,t,n){var r,o=(r={},r[i8]=Yh(e.selected),r[xi]=Yh(e.disabled),r[s8]=Yh(e.hidden),r[a8]=[e.today],r[Jy]=[],r[Xy]=[],r[Zy]=[],r[l8]=[],r);return e.fromDate&&o[xi].push({before:e.fromDate}),e.toDate&&o[xi].push({after:e.toDate}),bp(e)?o[xi]=o[xi].concat(t.modifiers[xi]):wp(e)&&(o[xi]=o[xi].concat(n.modifiers[xi]),o[Zy]=n.modifiers[Zy],o[Xy]=n.modifiers[Xy],o[Jy]=n.modifiers[Jy]),o}var nP=g.createContext(void 0);function u8(e){var t=wt(),n=y1(),r=b1(),o=c8(t,n,r),i=o8(t.modifiers),s=Ie(Ie({},o),i);return f.jsx(nP.Provider,{value:s,children:e.children})}function rP(){var e=g.useContext(nP);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function d8(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function f8(e){return!!(e&&typeof e=="object"&&"from"in e)}function p8(e){return!!(e&&typeof e=="object"&&"after"in e)}function h8(e){return!!(e&&typeof e=="object"&&"before"in e)}function m8(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function g8(e,t){var n,r=t.from,o=t.to;if(r&&o){var i=Di(o,r)<0;i&&(n=[o,r],r=n[0],o=n[1]);var s=Di(e,r)>=0&&Di(o,e)>=0;return s}return o?or(o,e):r?or(r,e):!1}function v8(e){return p1(e)}function y8(e){return Array.isArray(e)&&e.every(p1)}function x8(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(v8(n))return or(e,n);if(y8(n))return n.includes(e);if(f8(n))return g8(e,n);if(m8(n))return n.dayOfWeek.includes(e.getDay());if(d8(n)){var r=Di(n.before,e),o=Di(n.after,e),i=r>0,s=o<0,a=Hx(n.before,n.after);return a?s&&i:i||s}return p8(n)?Di(e,n.after)>0:h8(n)?Di(n.before,e)>0:typeof n=="function"?n(e):!1})}function w1(e,t,n){var r=Object.keys(t).reduce(function(i,s){var a=t[s];return x8(e,a)&&i.push(s),i},[]),o={};return r.forEach(function(i){return o[i]=!0}),n&&!g1(e,n)&&(o.outside=!0),o}function b8(e,t){for(var n=ur(e[0]),r=h1(e[e.length-1]),o,i,s=n;s<=r;){var a=w1(s,t),l=!a.disabled&&!a.hidden;if(!l){s=Hn(s,1);continue}if(a.selected)return s;a.today&&!i&&(i=s),o||(o=s),s=Hn(s,1)}return i||o}var w8=365;function oP(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,s=t.retry,a=s===void 0?{count:0,lastFocused:e}:s,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,p={day:Hn,week:Ux,month:Do,year:Jz,startOfWeek:function(b){return o.ISOWeek?yl(b):si(b,{locale:d,weekStartsOn:l})},endOfWeek:function(b){return o.ISOWeek?HM(b):m1(b,{locale:d,weekStartsOn:l})}},h=p[n](e,r==="after"?1:-1);r==="before"&&c?h=Xz([c,h]):r==="after"&&u&&(h=Zz([u,h]));var m=!0;if(i){var v=w1(h,i);m=!v.disabled&&!v.hidden}return m?h:a.count>w8?a.lastFocused:oP(h,{moveBy:n,direction:r,context:o,modifiers:i,retry:Ie(Ie({},a),{count:a.count+1})})}var iP=g.createContext(void 0);function S8(e){var t=Sp(),n=rP(),r=g.useState(),o=r[0],i=r[1],s=g.useState(),a=s[0],l=s[1],c=b8(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,d=function(){l(o),i(void 0)},p=function(b){i(b)},h=wt(),m=function(b,x){if(o){var w=oP(o,{moveBy:b,direction:x,context:h,modifiers:n});or(o,w)||(t.goToDate(w,o),p(w))}},v={focusedDay:o,focusTarget:u,blur:d,focus:p,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return f.jsx(iP.Provider,{value:v,children:e.children})}function S1(){var e=g.useContext(iP);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function k8(e,t){var n=rP(),r=w1(e,n,t);return r}var k1=g.createContext(void 0);function E8(e){if(!fv(e.initialProps)){var t={selected:void 0};return f.jsx(k1.Provider,{value:t,children:e.children})}return f.jsx(C8,{initialProps:e.initialProps,children:e.children})}function C8(e){var t=e.initialProps,n=e.children,r=function(i,s,a){var l,c,u;if((l=t.onDayClick)===null||l===void 0||l.call(t,i,s,a),s.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,i,s,a);return}(u=t.onSelect)===null||u===void 0||u.call(t,i,i,s,a)},o={selected:t.selected,onDayClick:r};return f.jsx(k1.Provider,{value:o,children:n})}function sP(){var e=g.useContext(k1);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function _8(e,t){var n=wt(),r=sP(),o=y1(),i=b1(),s=S1(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,p=s.focus,h=s.focusMonthBefore,m=s.focusMonthAfter,v=s.focusYearBefore,b=s.focusYearAfter,x=s.focusStartOfWeek,w=s.focusEndOfWeek,k=function(R){var M,F,L,B;fv(n)?(M=r.onDayClick)===null||M===void 0||M.call(r,e,t,R):bp(n)?(F=o.onDayClick)===null||F===void 0||F.call(o,e,t,R):wp(n)?(L=i.onDayClick)===null||L===void 0||L.call(i,e,t,R):(B=n.onDayClick)===null||B===void 0||B.call(n,e,t,R)},C=function(R){var M;p(e),(M=n.onDayFocus)===null||M===void 0||M.call(n,e,t,R)},_=function(R){var M;d(),(M=n.onDayBlur)===null||M===void 0||M.call(n,e,t,R)},O=function(R){var M;(M=n.onDayMouseEnter)===null||M===void 0||M.call(n,e,t,R)},T=function(R){var M;(M=n.onDayMouseLeave)===null||M===void 0||M.call(n,e,t,R)},j=function(R){var M;(M=n.onDayPointerEnter)===null||M===void 0||M.call(n,e,t,R)},A=function(R){var M;(M=n.onDayPointerLeave)===null||M===void 0||M.call(n,e,t,R)},D=function(R){var M;(M=n.onDayTouchCancel)===null||M===void 0||M.call(n,e,t,R)},V=function(R){var M;(M=n.onDayTouchEnd)===null||M===void 0||M.call(n,e,t,R)},W=function(R){var M;(M=n.onDayTouchMove)===null||M===void 0||M.call(n,e,t,R)},J=function(R){var M;(M=n.onDayTouchStart)===null||M===void 0||M.call(n,e,t,R)},X=function(R){var M;(M=n.onDayKeyUp)===null||M===void 0||M.call(n,e,t,R)},U=function(R){var M;switch(R.key){case"ArrowLeft":R.preventDefault(),R.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":R.preventDefault(),R.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":R.preventDefault(),R.stopPropagation(),c();break;case"ArrowUp":R.preventDefault(),R.stopPropagation(),u();break;case"PageUp":R.preventDefault(),R.stopPropagation(),R.shiftKey?v():h();break;case"PageDown":R.preventDefault(),R.stopPropagation(),R.shiftKey?b():m();break;case"Home":R.preventDefault(),R.stopPropagation(),x();break;case"End":R.preventDefault(),R.stopPropagation(),w();break}(M=n.onDayKeyDown)===null||M===void 0||M.call(n,e,t,R)},I={onClick:k,onFocus:C,onBlur:_,onKeyDown:U,onKeyUp:X,onMouseEnter:O,onMouseLeave:T,onPointerEnter:j,onPointerLeave:A,onTouchCancel:D,onTouchEnd:V,onTouchMove:W,onTouchStart:J};return I}function N8(){var e=wt(),t=sP(),n=y1(),r=b1(),o=fv(e)?t.selected:bp(e)?n.selected:wp(e)?r.selected:void 0;return o}function T8(e){return Object.values(Lo).includes(e)}function O8(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(r){var o=e.modifiersClassNames[r];if(o)n.push(o);else if(T8(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function M8(e,t){var n=Ie({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=Ie(Ie({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function P8(e,t,n){var r,o,i,s=wt(),a=S1(),l=k8(e,t),c=_8(e,l),u=N8(),d=!!(s.onDayClick||s.mode!=="default");g.useEffect(function(){var O;l.outside||a.focusedDay&&d&&or(a.focusedDay,e)&&((O=n.current)===null||O===void 0||O.focus())},[a.focusedDay,e,n,d,l.outside]);var p=O8(s,l).join(" "),h=M8(s,l),m=!!(l.outside&&!s.showOutsideDays||l.hidden),v=(i=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&i!==void 0?i:ZB,b=f.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),x={style:h,className:p,children:b,role:"gridcell"},w=a.focusTarget&&or(a.focusTarget,e)&&!l.outside,k=a.focusedDay&&or(a.focusedDay,e),C=Ie(Ie(Ie({},x),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=k||w?0:-1,r)),c),_={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:C,divProps:x};return _}function j8(e){var t=g.useRef(null),n=P8(e.date,e.displayMonth,t);return n.isHidden?f.jsx("div",{role:"gridcell"}):n.isButton?f.jsx(Wm,Ie({name:"day",ref:t},n.buttonProps)):f.jsx("div",Ie({},n.divProps))}function R8(e){var t=e.number,n=e.dates,r=wt(),o=r.onWeekNumberClick,i=r.styles,s=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(t),{locale:a});if(!o)return f.jsx("span",{className:s.weeknumber,style:i.weeknumber,children:u});var d=l(Number(t),{locale:a}),p=function(h){o(t,n,h)};return f.jsx(Wm,{name:"week-number","aria-label":d,className:s.weeknumber,style:i.weeknumber,onClick:p,children:u})}function A8(e){var t,n,r=wt(),o=r.styles,i=r.classNames,s=r.showWeekNumber,a=r.components,l=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:j8,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:R8,u;return s&&(u=f.jsx("td",{className:i.cell,style:o.cell,children:f.jsx(c,{number:e.weekNumber,dates:e.dates})})),f.jsxs("tr",{className:i.row,style:o.row,children:[u,e.dates.map(function(d){return f.jsx("td",{className:i.cell,style:o.cell,role:"presentation",children:f.jsx(l,{displayMonth:e.displayMonth,date:d})},aB(d))})]})}function rC(e,t,n){for(var r=n!=null&&n.ISOWeek?HM(t):m1(t,n),o=n!=null&&n.ISOWeek?yl(e):si(e,n),i=Di(r,o),s=[],a=0;a<=i;a++)s.push(Hn(o,a));var l=s.reduce(function(c,u){var d=n!=null&&n.ISOWeek?iB(u):dB(u,n),p=c.find(function(h){return h.weekNumber===d});return p?(p.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function I8(e,t){var n=rC(ur(e),h1(e),t);if(t!=null&&t.useFixedWeeks){var r=pB(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],s=Ux(i,6-r),a=rC(Ux(i,1),s,t);n.push.apply(n,a)}}return n}function D8(e){var t,n,r,o=wt(),i=o.locale,s=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,d=o.weekStartsOn,p=o.firstWeekContainsDate,h=o.ISOWeek,m=I8(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:h,locale:i,weekStartsOn:d,firstWeekContainsDate:p}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:XB,b=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:A8,x=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:GB;return f.jsxs("table",{id:e.id,className:s.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&f.jsx(v,{}),f.jsx("tbody",{className:s.tbody,style:a.tbody,children:m.map(function(w){return f.jsx(b,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),f.jsx(x,{displayMonth:e.displayMonth})]})}function L8(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var F8=L8()?g.useLayoutEffect:g.useEffect,Qy=!1,z8=0;function oC(){return"react-day-picker-".concat(++z8)}function B8(e){var t,n=e??(Qy?oC():null),r=g.useState(n),o=r[0],i=r[1];return F8(function(){o===null&&i(oC())},[]),g.useEffect(function(){Qy===!1&&(Qy=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function $8(e){var t,n,r=wt(),o=r.dir,i=r.classNames,s=r.styles,a=r.components,l=Sp().displayMonths,c=B8(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,d=[i.month],p=s.month,h=e.displayIndex===0,m=e.displayIndex===l.length-1,v=!h&&!m;o==="rtl"&&(t=[h,m],m=t[0],h=t[1]),h&&(d.push(i.caption_start),p=Ie(Ie({},p),s.caption_start)),m&&(d.push(i.caption_end),p=Ie(Ie({},p),s.caption_end)),v&&(d.push(i.caption_between),p=Ie(Ie({},p),s.caption_between));var b=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:qB;return f.jsxs("div",{className:d.join(" "),style:p,children:[f.jsx(b,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(D8,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function V8(e){var t=wt(),n=t.classNames,r=t.styles;return f.jsx("div",{className:n.months,style:r.months,children:e.children})}function U8(e){var t,n,r=e.initialProps,o=wt(),i=S1(),s=Sp(),a=g.useState(!1),l=a[0],c=a[1];g.useEffect(function(){o.initialFocus&&i.focusTarget&&(l||(i.focus(i.focusTarget),c(!0)))},[o.initialFocus,l,i.focus,i.focusTarget,i]);var u=[o.classNames.root,o.className];o.numberOfMonths>1&&u.push(o.classNames.multiple_months),o.showWeekNumber&&u.push(o.classNames.with_weeknumber);var d=Ie(Ie({},o.styles.root),o.style),p=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var b;return Ie(Ie({},m),(b={},b[v]=r[v],b))},{}),h=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:V8;return f.jsx("div",Ie({className:u.join(" "),style:d,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},p,{children:f.jsx(h,{children:s.displayMonths.map(function(m,v){return f.jsx($8,{displayIndex:v,displayMonth:m},v)})})}))}function H8(e){var t=e.children,n=mB(e,["children"]);return f.jsx(ZM,{initialProps:n,children:f.jsx(UB,{children:f.jsx(E8,{initialProps:n,children:f.jsx(QB,{initialProps:n,children:f.jsx(n8,{initialProps:n,children:f.jsx(u8,{children:f.jsx(S8,{children:t})})})})})})})}function W8(e){return f.jsx(H8,Ie({},e,{children:f.jsx(U8,{initialProps:e})}))}function dn(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];t=a(t)}return t}function aP(e){return O5(e)}function Wx(e,t){if(e===t)return!0;if(he(e)==="object"&&he(t)==="object"&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!Wx(e[n],t[n]))return!1;return!0}else if(!Array.isArray(e)&&!Array.isArray(t)){var r=Object.entries(e);if(r.length!==Object.keys(t).length)return!1;for(var o=0,i=r;o<i.length;o++){var s=qn(i[o],2),a=s[0],l=s[1],c=t[a];if(c===void 0||!Wx(l,c))return!1}return!0}}return!1}function Km(e){return Array.isArray(e)?e.map(Km):he(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=qn(t,2),r=n[0],o=n[1];return[r,Km(o)]})):e}function E1(e){return/^(0|[1-9][0-9]*)$/g.test(e)?cr(Number(e)):Io(new Ar('Invalid array index "'.concat(e,'"')))}function K8(e,t){return e==="-"?cr(t.length):dn(E1(e),l1(function(n){return n<=t.length},function(){return new Ar("Array index out of bounds")}))}function lP(e,t){return dn(E1(e),l1(function(n){return n<t.length},function(){return new Ar("Array index out of bounds")}))}function q8(e,t,n){if(Array.isArray(e))return dn(lP(t,e),ko(function(o){var i=e[o];return e[o]=n,i}));if(he(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,cr(r)}else return Io(new Ar("Cannot replace object element which does not exist"));return Io(new Ar("Cannot replace in non-object/array"))}function G8(e,t,n){return aP(t)?dn(C1(e,t),Gc(function(r){var o=qn(r,2),i=o[0],s=o[1];return q8(i,s,n)}),ko(function(r){return[e,r]})):cr([n,e])}function cP(e,t){return Array.isArray(e)?dn(E1(t),Gc(function(n){return n>=e.length?Io(new Ar("Array index out of bounds")):cr(e[n])})):he(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?cr(e[t]):cr(void 0):Io(new Ar("Cannot access non-object/array"))}function C1(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var i=cP(n,r);if(M5(i))return i;if(i.value===void 0)return Io(new Ar("Path refers to non-existing object/array"));n=i.value}return cr([n,r])}function e0(e,t){return dn(t,NM(function(n,r){return dn(cP(n,r),l1(function(o){return o!==void 0},function(){return new Ar("Path refers to non-existing object/array")}))},e))}function Y8(e,t){if(Array.isArray(e))return dn(lP(t,e),ko(function(r){var o=e.splice(r,1),i=qn(o,1),s=i[0];return s}));if(he(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],cr(n)}return Io(new Ar("Cannot remove from non-object/array"))}function iC(e,t){return dn(C1(e,t),Gc(function(n){var r=qn(n,2),o=r[0],i=r[1];return Y8(o,i)}))}function J8(e,t,n){if(Array.isArray(e))return dn(K8(t,e),ko(function(o){e.splice(o,0,n)}));if(he(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,cr(r)}return Io(new Ar("Cannot add to non-object/array"))}function t0(e,t,n){return aP(t)?dn(C1(e,t),Gc(function(r){var o=qn(r,2),i=o[0],s=o[1];return J8(i,s,n)}),ko(function(r){return[e,r]})):cr([n,e])}function bh(e){var t=qn(e,1),n=t[0];return n}var X8=function(){function e(){_n(this,e)}return Nn(e,[{key:"get",value:function(n,r){return e0(n,r)}},{key:"add",value:function(n,r,o){return dn(t0(n,r,o),ko(bh))}},{key:"remove",value:function(n,r){return dn(iC(n,r),ko(function(){return n}))}},{key:"replace",value:function(n,r,o){return dn(G8(n,r,o),ko(bh))}},{key:"move",value:function(n,r,o){return dn(iC(n,r),Gc(function(i){return t0(n,o,i)}),ko(bh))}},{key:"copy",value:function(n,r,o){return dn(e0(n,r),Gc(function(i){return t0(n,o,Km(i))}),ko(bh))}},{key:"test",value:function(n,r,o){return dn(e0(n,r),ko(function(i){return Wx(o,i)}))}}])}();function Z8(e,t,n){switch(n.op){case"add":return t.add(e,n.path,n.value);case"remove":return t.remove(e,n.path);case"replace":return t.replace(e,n.path,n.value);case"move":return t.move(e,n.from,n.path);case"copy":return t.copy(e,n.from,n.path);case"test":return t.test(e,n.path,n.value)?cr(e):Io(new Ar("Test failed"));case"file":return Io(new Ar("Cannot apply a file patch here"))}}function Q8(e,t,n){return dn(n,NM(function(r,o){return Z8(r,t,o)},e))}function e$(e){var r;const t=Object.keys(e);if(t.length===0)return[];const n=[];for(const o of t){const s=e[o].sort((a,l)=>a.seqNumber-l.seqNumber);for(let a=0;a<s.length;a++){const{patch:l}=s[a];if(l.length===1&&l[0].op==="replace"){const c=(r=s[a+1])==null?void 0:r.patch;if(c&&c.length===1&&c[0].op==="replace"&&c[0].path.join("/")===l[0].path.join("/"))continue}n.push({patch:l,path:o})}}return n}var et;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(et||(et={}));var Kx;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Kx||(Kx={}));const ve=et.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),js=e=>{switch(typeof e){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return isNaN(e)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(e)?ve.array:e===null?ve.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ve.promise:typeof Map<"u"&&e instanceof Map?ve.map:typeof Set<"u"&&e instanceof Set?ve.set:typeof Date<"u"&&e instanceof Date?ve.date:ve.object;default:return ve.unknown}},Z=et.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),t$=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Pr extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof Pr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,et.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Pr.create=e=>new Pr(e);const Xc=(e,t)=>{let n;switch(e.code){case Z.invalid_type:e.received===ve.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Z.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,et.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:n=`Unrecognized key(s) in object: ${et.joinValues(e.keys,", ")}`;break;case Z.invalid_union:n="Invalid input";break;case Z.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${et.joinValues(e.options)}`;break;case Z.invalid_enum_value:n=`Invalid enum value. Expected ${et.joinValues(e.options)}, received '${e.received}'`;break;case Z.invalid_arguments:n="Invalid function arguments";break;case Z.invalid_return_type:n="Invalid function return type";break;case Z.invalid_date:n="Invalid date";break;case Z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:et.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Z.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Z.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Z.custom:n="Invalid input";break;case Z.invalid_intersection_types:n="Intersection results could not be merged";break;case Z.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Z.not_finite:n="Number must be finite";break;default:n=t.defaultError,et.assertNever(e)}return{message:n}};let uP=Xc;function n$(e){uP=e}function qm(){return uP}const Gm=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},r$=[];function ge(e,t){const n=qm(),r=Gm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Xc?void 0:Xc].filter(o=>!!o)});e.common.issues.push(r)}class zn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return De;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return zn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return De;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const De=Object.freeze({status:"aborted"}),wc=e=>({status:"dirty",value:e}),Gn=e=>({status:"valid",value:e}),qx=e=>e.status==="aborted",Gx=e=>e.status==="dirty",bf=e=>e.status==="valid",wf=e=>typeof Promise<"u"&&e instanceof Promise;function Ym(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function dP(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Ee;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ee||(Ee={}));var ad,ld;class ai{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const sC=(e,t)=>{if(bf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Pr(e.common.issues);return this._error=n,this._error}}};function Be(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{var l,c;const{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class Ve{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return js(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:js(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new zn,ctx:{common:t.parent.common,data:t.data,parsedType:js(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(wf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:js(t)},i=this._parseSync({data:t,path:o.path,parent:o});return sC(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:js(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(wf(o)?o:Promise.resolve(o));return sC(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),a=()=>i.addIssue({code:Z.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Fo({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return oi.create(this,this._def)}nullable(){return da.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jo.create(this,this._def)}promise(){return Qc.create(this,this._def)}or(t){return Cf.create([this,t],this._def)}and(t){return _f.create(this,t,this._def)}transform(t){return new Fo({...Be(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Pf({...Be(this._def),innerType:this,defaultValue:n,typeName:Re.ZodDefault})}brand(){return new _1({typeName:Re.ZodBranded,type:this,...Be(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new jf({...Be(this._def),innerType:this,catchValue:n,typeName:Re.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return kp.create(this,t)}readonly(){return Rf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const o$=/^c[^\s-]{8,}$/i,i$=/^[0-9a-z]+$/,s$=/^[0-9A-HJKMNP-TV-Z]{26}$/,a$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,l$=/^[a-z0-9_-]{21}$/i,c$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,u$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,d$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let n0;const f$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,p$=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,h$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fP="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",m$=new RegExp(`^${fP}$`);function pP(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function g$(e){return new RegExp(`^${pP(e)}$`)}function hP(e){let t=`${fP}T${pP(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function v$(e,t){return!!((t==="v4"||!t)&&f$.test(e)||(t==="v6"||!t)&&p$.test(e))}class To extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ve.string){const i=this._getOrReturnCtx(t);return ge(i,{code:Z.invalid_type,expected:ve.string,received:i.parsedType}),De}const r=new zn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?ge(o,{code:Z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&ge(o,{code:Z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")u$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"email",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")n0||(n0=new RegExp(d$,"u")),n0.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"emoji",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")a$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"uuid",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")l$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"nanoid",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")o$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"cuid",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")i$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"cuid2",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")s$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"ulid",code:Z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),ge(o,{validation:"url",code:Z.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"regex",code:Z.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?hP(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?m$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?g$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?c$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"duration",code:Z.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?v$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"ip",code:Z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?h$.test(t.data)||(o=this._getOrReturnCtx(t,o),ge(o,{validation:"base64",code:Z.invalid_string,message:i.message}),r.dirty()):et.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Z.invalid_string,...Ee.errToObj(r)})}_addCheck(t){return new To({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ee.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ee.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ee.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ee.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ee.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ee.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ee.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ee.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ee.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ee.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...Ee.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ee.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ee.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ee.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ee.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ee.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ee.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ee.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ee.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ee.errToObj(n)})}nonempty(t){return this.min(1,Ee.errToObj(t))}trim(){return new To({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new To({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new To({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}To.create=e=>{var t;return new To({checks:[],typeName:Re.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Be(e)})};function y$(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class la extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ve.number){const i=this._getOrReturnCtx(t);return ge(i,{code:Z.invalid_type,expected:ve.number,received:i.parsedType}),De}let r;const o=new zn;for(const i of this._def.checks)i.kind==="int"?et.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?y$(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.not_finite,message:i.message}),o.dirty()):et.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ee.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ee.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ee.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ee.toString(n))}setLimit(t,n,r,o){return new la({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ee.toString(o)}]})}_addCheck(t){return new la({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ee.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ee.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ee.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ee.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ee.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ee.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&et.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}la.create=e=>new la({checks:[],typeName:Re.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class ca extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ve.bigint){const i=this._getOrReturnCtx(t);return ge(i,{code:Z.invalid_type,expected:ve.bigint,received:i.parsedType}),De}let r;const o=new zn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ge(r,{code:Z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):et.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ee.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ee.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ee.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ee.toString(n))}setLimit(t,n,r,o){return new ca({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ee.toString(o)}]})}_addCheck(t){return new ca({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ee.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ee.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ee.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ee.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ee.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}ca.create=e=>{var t;return new ca({checks:[],typeName:Re.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Be(e)})};class Sf extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ve.boolean){const r=this._getOrReturnCtx(t);return ge(r,{code:Z.invalid_type,expected:ve.boolean,received:r.parsedType}),De}return Gn(t.data)}}Sf.create=e=>new Sf({typeName:Re.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Be(e)});class xl extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ve.date){const i=this._getOrReturnCtx(t);return ge(i,{code:Z.invalid_type,expected:ve.date,received:i.parsedType}),De}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return ge(i,{code:Z.invalid_date}),De}const r=new zn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),ge(o,{code:Z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):et.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new xl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ee.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ee.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}xl.create=e=>new xl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Re.ZodDate,...Be(e)});class Jm extends Ve{_parse(t){if(this._getType(t)!==ve.symbol){const r=this._getOrReturnCtx(t);return ge(r,{code:Z.invalid_type,expected:ve.symbol,received:r.parsedType}),De}return Gn(t.data)}}Jm.create=e=>new Jm({typeName:Re.ZodSymbol,...Be(e)});class kf extends Ve{_parse(t){if(this._getType(t)!==ve.undefined){const r=this._getOrReturnCtx(t);return ge(r,{code:Z.invalid_type,expected:ve.undefined,received:r.parsedType}),De}return Gn(t.data)}}kf.create=e=>new kf({typeName:Re.ZodUndefined,...Be(e)});class Ef extends Ve{_parse(t){if(this._getType(t)!==ve.null){const r=this._getOrReturnCtx(t);return ge(r,{code:Z.invalid_type,expected:ve.null,received:r.parsedType}),De}return Gn(t.data)}}Ef.create=e=>new Ef({typeName:Re.ZodNull,...Be(e)});class Zc extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Gn(t.data)}}Zc.create=e=>new Zc({typeName:Re.ZodAny,...Be(e)});class ol extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Gn(t.data)}}ol.create=e=>new ol({typeName:Re.ZodUnknown,...Be(e)});class qi extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return ge(n,{code:Z.invalid_type,expected:ve.never,received:n.parsedType}),De}}qi.create=e=>new qi({typeName:Re.ZodNever,...Be(e)});class Xm extends Ve{_parse(t){if(this._getType(t)!==ve.undefined){const r=this._getOrReturnCtx(t);return ge(r,{code:Z.invalid_type,expected:ve.void,received:r.parsedType}),De}return Gn(t.data)}}Xm.create=e=>new Xm({typeName:Re.ZodVoid,...Be(e)});class jo extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==ve.array)return ge(n,{code:Z.invalid_type,expected:ve.array,received:n.parsedType}),De;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(ge(n,{code:s?Z.too_big:Z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(ge(n,{code:Z.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(ge(n,{code:Z.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new ai(n,s,n.path,a)))).then(s=>zn.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new ai(n,s,n.path,a)));return zn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new jo({...this._def,minLength:{value:t,message:Ee.toString(n)}})}max(t,n){return new jo({...this._def,maxLength:{value:t,message:Ee.toString(n)}})}length(t,n){return new jo({...this._def,exactLength:{value:t,message:Ee.toString(n)}})}nonempty(t){return this.min(1,t)}}jo.create=(e,t)=>new jo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...Be(t)});function ec(e){if(e instanceof Mt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=oi.create(ec(r))}return new Mt({...e._def,shape:()=>t})}else return e instanceof jo?new jo({...e._def,type:ec(e.element)}):e instanceof oi?oi.create(ec(e.unwrap())):e instanceof da?da.create(ec(e.unwrap())):e instanceof li?li.create(e.items.map(t=>ec(t))):e}class Mt extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=et.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ve.object){const c=this._getOrReturnCtx(t);return ge(c,{code:Z.invalid_type,expected:ve.object,received:c.parsedType}),De}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof qi&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ai(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof qi){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(ge(o,{code:Z.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ai(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>zn.mergeObjectSync(r,c)):zn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Ee.errToObj,new Mt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,a;const l=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=Ee.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Mt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Mt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Re.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Mt({...this._def,catchall:t})}pick(t){const n={};return et.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}omit(t){const n={};return et.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}deepPartial(){return ec(this)}partial(t){const n={};return et.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Mt({...this._def,shape:()=>n})}required(t){const n={};return et.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof oi;)i=i._def.innerType;n[r]=i}}),new Mt({...this._def,shape:()=>n})}keyof(){return mP(et.objectKeys(this.shape))}}Mt.create=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strip",catchall:qi.create(),typeName:Re.ZodObject,...Be(t)});Mt.strictCreate=(e,t)=>new Mt({shape:()=>e,unknownKeys:"strict",catchall:qi.create(),typeName:Re.ZodObject,...Be(t)});Mt.lazycreate=(e,t)=>new Mt({shape:e,unknownKeys:"strip",catchall:qi.create(),typeName:Re.ZodObject,...Be(t)});class Cf extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new Pr(a.ctx.common.issues));return ge(n,{code:Z.invalid_union,unionErrors:s}),De}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new Pr(l));return ge(n,{code:Z.invalid_union,unionErrors:a}),De}}get options(){return this._def.options}}Cf.create=(e,t)=>new Cf({options:e,typeName:Re.ZodUnion,...Be(t)});const Ei=e=>e instanceof Tf?Ei(e.schema):e instanceof Fo?Ei(e.innerType()):e instanceof Of?[e.value]:e instanceof ua?e.options:e instanceof Mf?et.objectValues(e.enum):e instanceof Pf?Ei(e._def.innerType):e instanceof kf?[void 0]:e instanceof Ef?[null]:e instanceof oi?[void 0,...Ei(e.unwrap())]:e instanceof da?[null,...Ei(e.unwrap())]:e instanceof _1||e instanceof Rf?Ei(e.unwrap()):e instanceof jf?Ei(e._def.innerType):[];class pv extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.object)return ge(n,{code:Z.invalid_type,expected:ve.object,received:n.parsedType}),De;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(ge(n,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),De)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=Ei(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new pv({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Be(r)})}}function Yx(e,t){const n=js(e),r=js(t);if(e===t)return{valid:!0,data:e};if(n===ve.object&&r===ve.object){const o=et.objectKeys(t),i=et.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=Yx(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===ve.array&&r===ve.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const s=e[i],a=t[i],l=Yx(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ve.date&&r===ve.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class _f extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(qx(i)||qx(s))return De;const a=Yx(i.value,s.value);return a.valid?((Gx(i)||Gx(s))&&n.dirty(),{status:n.value,value:a.data}):(ge(r,{code:Z.invalid_intersection_types}),De)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}_f.create=(e,t,n)=>new _f({left:e,right:t,typeName:Re.ZodIntersection,...Be(n)});class li extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.array)return ge(r,{code:Z.invalid_type,expected:ve.array,received:r.parsedType}),De;if(r.data.length<this._def.items.length)return ge(r,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),De;!this._def.rest&&r.data.length>this._def.items.length&&(ge(r,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new ai(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>zn.mergeArray(n,s)):zn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new li({...this._def,rest:t})}}li.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new li({items:e,typeName:Re.ZodTuple,rest:null,...Be(t)})};class Nf extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.object)return ge(r,{code:Z.invalid_type,expected:ve.object,received:r.parsedType}),De;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new ai(r,a,r.path,a)),value:s._parse(new ai(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?zn.mergeObjectAsync(n,o):zn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new Nf({keyType:t,valueType:n,typeName:Re.ZodRecord,...Be(r)}):new Nf({keyType:To.create(),valueType:t,typeName:Re.ZodRecord,...Be(n)})}}class Zm extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.map)return ge(r,{code:Z.invalid_type,expected:ve.map,received:r.parsedType}),De;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new ai(r,a,r.path,[c,"key"])),value:i._parse(new ai(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return De;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return De;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Zm.create=(e,t,n)=>new Zm({valueType:t,keyType:e,typeName:Re.ZodMap,...Be(n)});class bl extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.set)return ge(r,{code:Z.invalid_type,expected:ve.set,received:r.parsedType}),De;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(ge(r,{code:Z.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(ge(r,{code:Z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return De;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new ai(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new bl({...this._def,minSize:{value:t,message:Ee.toString(n)}})}max(t,n){return new bl({...this._def,maxSize:{value:t,message:Ee.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}bl.create=(e,t)=>new bl({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...Be(t)});class Tc extends Ve{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.function)return ge(n,{code:Z.invalid_type,expected:ve.function,received:n.parsedType}),De;function r(a,l){return Gm({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qm(),Xc].filter(c=>!!c),issueData:{code:Z.invalid_arguments,argumentsError:l}})}function o(a,l){return Gm({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,qm(),Xc].filter(c=>!!c),issueData:{code:Z.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Qc){const a=this;return Gn(async function(...l){const c=new Pr([]),u=await a._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(o(d,h)),c})})}else{const a=this;return Gn(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new Pr([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,i);if(!d.success)throw new Pr([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Tc({...this._def,args:li.create(t).rest(ol.create())})}returns(t){return new Tc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Tc({args:t||li.create([]).rest(ol.create()),returns:n||ol.create(),typeName:Re.ZodFunction,...Be(r)})}}class Tf extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Tf.create=(e,t)=>new Tf({getter:e,typeName:Re.ZodLazy,...Be(t)});class Of extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ge(n,{received:n.data,code:Z.invalid_literal,expected:this._def.value}),De}return{status:"valid",value:t.data}}get value(){return this._def.value}}Of.create=(e,t)=>new Of({value:e,typeName:Re.ZodLiteral,...Be(t)});function mP(e,t){return new ua({values:e,typeName:Re.ZodEnum,...Be(t)})}class ua extends Ve{constructor(){super(...arguments),ad.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ge(n,{expected:et.joinValues(r),received:n.parsedType,code:Z.invalid_type}),De}if(Ym(this,ad)||dP(this,ad,new Set(this._def.values)),!Ym(this,ad).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ge(n,{received:n.data,code:Z.invalid_enum_value,options:r}),De}return Gn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ua.create(t,{...this._def,...n})}exclude(t,n=this._def){return ua.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}ad=new WeakMap;ua.create=mP;class Mf extends Ve{constructor(){super(...arguments),ld.set(this,void 0)}_parse(t){const n=et.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ve.string&&r.parsedType!==ve.number){const o=et.objectValues(n);return ge(r,{expected:et.joinValues(o),received:r.parsedType,code:Z.invalid_type}),De}if(Ym(this,ld)||dP(this,ld,new Set(et.getValidEnumValues(this._def.values))),!Ym(this,ld).has(t.data)){const o=et.objectValues(n);return ge(r,{received:r.data,code:Z.invalid_enum_value,options:o}),De}return Gn(t.data)}get enum(){return this._def.values}}ld=new WeakMap;Mf.create=(e,t)=>new Mf({values:e,typeName:Re.ZodNativeEnum,...Be(t)});class Qc extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.promise&&n.common.async===!1)return ge(n,{code:Z.invalid_type,expected:ve.promise,received:n.parsedType}),De;const r=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return Gn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Qc.create=(e,t)=>new Qc({type:e,typeName:Re.ZodPromise,...Be(t)});class Fo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{ge(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return De;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?De:l.status==="dirty"||n.value==="dirty"?wc(l.value):l});{if(n.value==="aborted")return De;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?De:a.status==="dirty"||n.value==="dirty"?wc(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?De:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?De:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!bf(s))return s;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>bf(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);et.assertNever(o)}}Fo.create=(e,t,n)=>new Fo({schema:e,typeName:Re.ZodEffects,effect:t,...Be(n)});Fo.createWithPreprocess=(e,t,n)=>new Fo({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...Be(n)});class oi extends Ve{_parse(t){return this._getType(t)===ve.undefined?Gn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}oi.create=(e,t)=>new oi({innerType:e,typeName:Re.ZodOptional,...Be(t)});class da extends Ve{_parse(t){return this._getType(t)===ve.null?Gn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}da.create=(e,t)=>new da({innerType:e,typeName:Re.ZodNullable,...Be(t)});class Pf extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Pf.create=(e,t)=>new Pf({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Be(t)});class jf extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return wf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Pr(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Pr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}jf.create=(e,t)=>new jf({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Be(t)});class Qm extends Ve{_parse(t){if(this._getType(t)!==ve.nan){const r=this._getOrReturnCtx(t);return ge(r,{code:Z.invalid_type,expected:ve.nan,received:r.parsedType}),De}return{status:"valid",value:t.data}}}Qm.create=e=>new Qm({typeName:Re.ZodNaN,...Be(e)});const x$=Symbol("zod_brand");class _1 extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class kp extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?De:i.status==="dirty"?(n.dirty(),wc(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?De:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new kp({in:t,out:n,typeName:Re.ZodPipeline})}}class Rf extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=o=>(bf(o)&&(o.value=Object.freeze(o.value)),o);return wf(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Rf.create=(e,t)=>new Rf({innerType:e,typeName:Re.ZodReadonly,...Be(t)});function gP(e,t={},n){return e?Zc.create().superRefine((r,o)=>{var i,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(i=a.fatal)!==null&&i!==void 0?i:n)!==null&&s!==void 0?s:!0,c=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...c,fatal:l})}}):Zc.create()}const b$={object:Mt.lazycreate};var Re;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Re||(Re={}));const w$=(e,t={message:`Input not instance of ${e.name}`})=>gP(n=>n instanceof e,t),vP=To.create,yP=la.create,S$=Qm.create,k$=ca.create,xP=Sf.create,E$=xl.create,C$=Jm.create,_$=kf.create,N$=Ef.create,T$=Zc.create,O$=ol.create,M$=qi.create,P$=Xm.create,j$=jo.create,R$=Mt.create,A$=Mt.strictCreate,I$=Cf.create,D$=pv.create,L$=_f.create,F$=li.create,z$=Nf.create,B$=Zm.create,$$=bl.create,V$=Tc.create,U$=Tf.create,H$=Of.create,W$=ua.create,K$=Mf.create,q$=Qc.create,aC=Fo.create,G$=oi.create,Y$=da.create,J$=Fo.createWithPreprocess,X$=kp.create,Z$=()=>vP().optional(),Q$=()=>yP().optional(),eV=()=>xP().optional(),tV={string:e=>To.create({...e,coerce:!0}),number:e=>la.create({...e,coerce:!0}),boolean:e=>Sf.create({...e,coerce:!0}),bigint:e=>ca.create({...e,coerce:!0}),date:e=>xl.create({...e,coerce:!0})},nV=De;var y=Object.freeze({__proto__:null,defaultErrorMap:Xc,setErrorMap:n$,getErrorMap:qm,makeIssue:Gm,EMPTY_PATH:r$,addIssueToContext:ge,ParseStatus:zn,INVALID:De,DIRTY:wc,OK:Gn,isAborted:qx,isDirty:Gx,isValid:bf,isAsync:wf,get util(){return et},get objectUtil(){return Kx},ZodParsedType:ve,getParsedType:js,ZodType:Ve,datetimeRegex:hP,ZodString:To,ZodNumber:la,ZodBigInt:ca,ZodBoolean:Sf,ZodDate:xl,ZodSymbol:Jm,ZodUndefined:kf,ZodNull:Ef,ZodAny:Zc,ZodUnknown:ol,ZodNever:qi,ZodVoid:Xm,ZodArray:jo,ZodObject:Mt,ZodUnion:Cf,ZodDiscriminatedUnion:pv,ZodIntersection:_f,ZodTuple:li,ZodRecord:Nf,ZodMap:Zm,ZodSet:bl,ZodFunction:Tc,ZodLazy:Tf,ZodLiteral:Of,ZodEnum:ua,ZodNativeEnum:Mf,ZodPromise:Qc,ZodEffects:Fo,ZodTransformer:Fo,ZodOptional:oi,ZodNullable:da,ZodDefault:Pf,ZodCatch:jf,ZodNaN:Qm,BRAND:x$,ZodBranded:_1,ZodPipeline:kp,ZodReadonly:Rf,custom:gP,Schema:Ve,ZodSchema:Ve,late:b$,get ZodFirstPartyTypeKind(){return Re},coerce:tV,any:T$,array:j$,bigint:k$,boolean:xP,date:E$,discriminatedUnion:D$,effect:aC,enum:W$,function:V$,instanceof:w$,intersection:L$,lazy:U$,literal:H$,map:B$,nan:S$,nativeEnum:K$,never:M$,null:N$,nullable:Y$,number:yP,object:R$,oboolean:eV,onumber:Q$,optional:G$,ostring:Z$,pipeline:X$,preprocess:J$,promise:q$,record:z$,set:$$,strictObject:A$,string:vP,symbol:C$,transformer:aC,tuple:F$,undefined:_$,union:I$,unknown:O$,void:P$,NEVER:nV,ZodIssueCode:Z,quotelessJson:t$,ZodError:Pr});const bP=y.string().uuid().refine(e=>!0),rV=y.union([y.object({type:y.literal("patches"),patches:y.array(bP)}),y.object({type:y.literal("deployment"),deployment:y.object({deployment_id:y.string(),deployment_state:y.string(),created_at:y.string(),updated_at:y.string()})}),y.object({type:y.literal("subscribed")}),y.object({type:y.literal("error"),message:y.string(),reconnect:y.boolean().optional()})]);y.object({type:y.union([y.literal("did-change"),y.literal("no-change"),y.literal("request-again"),y.literal("use-websocket")]),config:y.object({project:y.string().optional(),files:y.object({directory:y.string()}).optional()}),schemaSha:y.string(),baseSha:y.string(),patches:y.array(bP),deployments:y.array(y.object({deployment_id:y.string(),deployment_state:y.string(),created_at:y.string(),updated_at:y.string()})).optional(),mode:y.union([y.literal("fs"),y.literal("http"),y.literal("unknown")])});function oV(e){const[t,n]=g.useState({status:"not-asked"}),r=g.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:i,setIsAuthenticated:s}=iV(),[a,l]=g.useState(),c=g.useRef(0);return g.useEffect(()=>{if(t.status==="updated-request-again"||t.status==="error")if(t.wait===0)console.debug("Executing stat immediately",t.status,t.status==="error"?t.error:"no error"),r0(e,r,c,t,n,i,s,l);else{console.debug("Executing stat in ",t.wait," status: ",t.status);const u=setTimeout(()=>{r0(e,r,c,t,n,i,s,l)},t.wait);return()=>clearTimeout(u)}},[e,t]),g.useEffect(()=>{t.status==="not-asked"&&(n({status:"initializing"}),console.debug("Initializing stat"),r0(e,r,c,t,n,i,s,l))},[e,t.status]),[t,n,o,i,s,a]}const lC=10*1e3;async function r0(e,t,n,r,o,i,s,a){const l=++n.current;let c=null;return"data"in r&&r.data&&(c={schemaSha:r.data.schemaSha,baseSha:r.data.baseSha,patches:r.data.patches}),i(),e("/stat","POST",{body:c}).then(u=>{if(u.status===401){s("login-required");return}else s("authorized");if(u.status===503){a(!0),o(d=>({status:"error",error:"Service unavailable",retries:("retries"in d?d.retries:0)+1,wait:5e3}));return}if(a(!1),!(n.current!==0&&n.current!==l))if(u.status===200){if(u.json.type==="did-change"||u.json.type==="no-change"||u.json.type==="request-again")o({status:"updated-request-again",data:u.json,wait:t.current?lC:0});else if(u.json.type==="use-websocket"){o(m=>({...m,status:"updated-request-again",data:u.json,wait:lC})),t.current&&(console.debug("Closing existing WebSocket"),t.current.close());const d=u.json.url;console.debug("Connecting to WebSocket",d),t.current=new WebSocket(d);const p=u.json.nonce;t.current.onopen=()=>{var m;(m=t.current)==null||m.send(JSON.stringify({nonce:p,type:"subscribe"}))},t.current.onmessage=m=>{try{const v=rV.safeParse(JSON.parse(m.data));if(!v.success){console.error("Could not parse WebSocket message",v.error);return}const b=v.data;b.type==="error"?o(x=>Yu(x,b.message)):b.type==="patches"?o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,patches:b.patches}}:x):b.type==="subscribed"?console.debug("Subscribed!"):b.type==="deployment"?(console.debug("Deployment",b.deployment),o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,deployments:(x.data.deployments||[]).concat(b.deployment)}}:x)):console.warn("Unknown WebSocket message",b)}catch(v){console.error("Could not parse WebSocket message",v)}};const h=t.current;t.current.onclose=()=>{h===t.current&&(console.debug("WebSocket closed"),o(m=>Yu(m,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(m=>Yu(m,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(d=>Yu(d,u.json.message))}).catch(u=>{n.current!==0&&n.current!==l||o(d=>Yu(d,u.message))})}function Yu(e,t){const n="retries"in e?e.retries+1:0,r=e.status==="error"&&e.retries>1?Math.min(500,e.retries*50+Math.floor(Math.random()*100))*10:0;return{status:"error",error:t,data:"data"in e?e.data:void 0,retries:n,wait:r}}function iV(){const[e,t]=g.useState("not-asked"),n=g.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}const cC=10,sV=new X8;function aV(e,t){var F;const[n,r]=g.useState([]),[o,i]=g.useState({status:"not-asked"}),[s,a]=g.useState({}),[l,c]=g.useState({}),[u,d]=g.useState({}),[p,h,m,v,b,x]=oV(e),[w,k]=g.useState({}),C=g.useRef({}),_=g.useCallback((L,B)=>{const K=B.length===1?B[0]:void 0;r([]),O(B);const be={...V.current};for(const le of B)be[le]=L;V.current={...be};const ae=K===void 0;v(),c(le=>{const re={...le};for(const $ of B)delete re[$];return re}),e("/sources/~","PUT",{path:K,query:{validate_sources:!0,validate_all:ae,validate_binary_files:!1}}).then(le=>{var re,$,Y,ne,te;if(le.status===401){b("login-required");return}else b("authorized");if(le.status===400&&!("errors"in le.json)){a(Object.fromEntries(B.map(we=>[we,{status:"error",errors:[{message:le.json.message}]}])));return}if(le.status===200){k(we=>{var ze;const ce=ae?{}:{...we};for(const[je,mt]of Object.entries(le.json.modules||{})){const N=je;if(mt)for(const[S,E]of Object.entries(((ze=le.json.modules[N])==null?void 0:ze.validationErrors)||{})){const P=S;E&&(ce[P]=E)}}return ce});for(const we of B){const ce=we;if(be[ce]!==V.current[ce])continue;const ze=(re=le.json.modules[ce])==null?void 0:re.source,je=(Y=($=le.json.modules[ce])==null?void 0:$.patches)==null?void 0:Y.skipped,mt=(te=(ne=le.json.modules[ce])==null?void 0:ne.patches)==null?void 0:te.errors;ze!==void 0&&T([ce],le.json.modules),(mt||je)&&c(N=>{const S={...N};for(const E of je||[]){(!S[ce]||S[ce].status!=="error")&&(S[ce]={status:"error",errors:[]});const P=S[ce];P.status==="error"&&P.errors.push({skipped:!0,patchId:E,message:"Patch skipped"})}for(const[E,P]of Object.entries(mt||{})){const z=E;(!S[ce]||S[ce].status!=="error")&&(S[ce]={status:"error",errors:[]});const G=S[ce];G.status==="error"&&P&&G.errors.push({patchId:z,message:P.message})}return S})}}else if(le.status===400){const we={};for(const ce of B){const ze=ce;we[ze]={status:"error",errors:[{message:le.json.message}]}}a(we)}}).catch(le=>{const re=le instanceof Error?le.message:JSON.stringify(le);T(B,{},Object.fromEntries(B.map($=>[$,[{error:{message:re}}]])))})},[]),O=g.useCallback(L=>{a(B=>{var ae;const K={...B};let be=!1;for(const le of L){const re=le;((ae=K[re])==null?void 0:ae.status)!=="loading"&&(K[re]={status:"loading"},be=!0)}return be?K:B})},[u]),T=g.useCallback((L,B,K)=>{d(be=>{var re,$;const ae={...be},le=L;a(Y=>{var te;const ne={...Y};for(const we of le)K&&K[we]?ne[we]={status:"error",errors:((te=K[we])==null?void 0:te.map(ce=>({...ce.error,...ce})))??[]}:delete ne[we];return ne});for(const Y of le){const ne=Y;C.current[ne]||B[ne]!==void 0&&((re=B[ne])==null?void 0:re.source)!==void 0&&(ae[ne]=($=B[ne])==null?void 0:$.source)}return r(Y=>{const ne=Y.filter(te=>le.includes(te));return ne.length!==Y.length?ne:Y}),ae})},[]),j="data"in p&&((F=p.data)!=null&&F.schemaSha)?p.data.schemaSha:void 0;g.useEffect(()=>{j&&(i({status:"loading"}),v(),e("/schema","GET",{}).then(L=>{if(L.status===401){b("login-required");return}else b("authorized");if(L.status===200)if(L.json.schemaSha===j){const B={};for(const K in L.json.schemas){const be=K,ae=L.json.schemas[be];ae&&(B[be]=ae)}i({status:"success",data:B})}else i({status:"error",error:"Schema (different checksums) mismatch"}),h(B=>({...B,schemaSha:j}));else i({status:"error",error:L.json.message})}))},[j]),g.useEffect(()=>{p.status==="error"&&(o.status==="loading"||o.status==="not-asked")&&i({status:"error",error:p.error})},[p,o]),g.useEffect(()=>{if(t)for(const L in u){const B=L;u[B]!==void 0&&window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:B,source:u[B]}}))}},[t,u]),g.useEffect(()=>{o.status==="success"&&r(Object.keys(o.data))},[o]);const{currentPatchIds:A,sourceState:D}=g.useMemo(()=>{if("data"in p&&p.data){const L=p.data.baseSha+p.data.patches.join(",");return{currentPatchIds:p.data.patches,sourceState:L}}return{currentPatchIds:[]}},[p]),V=g.useRef({}),W=g.useRef(0),J=g.useCallback((L,B)=>{d(K=>{if(K[L]!==void 0){const be=K[L];if(be!==void 0){const ae=B.filter(re=>re.op!=="file"),le=Q8(Km(be),sV,ae);if(le.kind==="ok"){t&&window.dispatchEvent(new CustomEvent("val-provider-overlay",{detail:{type:"source-update",detail:{moduleFilePath:L,source:le.value}}})),C.current={...C.current,[L]:[...C.current[L]??[],{patch:B,seqNumber:W.current++}]},c($=>{const Y={...$};return Y[L]={status:"created-patch",createdAt:new Date().toISOString()},Y}),a($=>{const Y={...$};return Y[L]={status:"loading"},Y});const re={...K};return re[L]=le.value,re}else console.error("Could not apply patch",le.error),c(re=>{const $={...re};return $[L]={status:"error",errors:[le.error]},$})}}else console.warn("Trying to patch a module that is not loaded",L,B),C.current={...C.current,[L]:[...C.current[L]??[],{patch:B,seqNumber:W.current++}]};return K})},[u,A,D,t]),X=g.useCallback(async L=>{const B=await e("/patches","DELETE",{query:{id:L}});return B.status===200?(r([]),{status:"ok"}):{status:"error",error:B.json.message}},[e]);g.useEffect(()=>{if(D!==void 0)if(n.length===0){const L=[];for(const B in V.current){const K=B;V.current[K]&&V.current[K]!==D&&L.push(K)}L.length>0&&_(D,L)}else _(D,n)},[n,D,A]);const U=g.useRef(null),I=g.useCallback(()=>{const L={...C.current};if(Object.keys(L).length===0)return[];const B=e$(L),K=new Set;for(const ae in L){const le=ae;for(const{seqNumber:re}of L[le])K.add(re)}if(c(ae=>{const le={};for(const re in L){const $=re;let Y;const ne=ae[$];ne&&"createdAt"in ne?Y=ne.createdAt:Y=new Date().toISOString(),le[$]={status:"uploading-patch",createdAt:Y,updatedAt:new Date().toISOString()}}return le}),v(),!("data"in p)||!p.data){console.error("Cannot add patches without stat data");return}const be=A.length>0?{type:"patch",patchId:A[A.length-1]}:{type:"head",headBaseSha:p.data.baseSha};e("/patches","PUT",{body:{patches:B,parentRef:be}}).then(ae=>{if(ae.status===401){b("login-required");return}else b("authorized");if(ae.status===409)!U.current||U.current<cC?(console.warn("Conflict! Retrying. Attempts left: ",cC-(U.current||1)),U.current=(U.current??1)+1):(C.current={},a(le=>{const re={};for(const $ in L){const Y=$;re[Y]={status:"error",errors:[{message:"Cannot apply changes. Val is online, but it could not get the latest set of changes from the server (i.e. there's a conflict). Try reloading."}]}}return re}));else if(!(ae.status===null&&ae.json.type==="network_error"&&ae.json.retryable)){U.current=null;for(const le in C.current){const re=le;for(const $ of C.current[re])K.has($.seqNumber)&&delete C.current[re]}c(le=>{const re={};if("errors"in ae.json)for(const $ in L){const Y=$,ne=ae.json.errors[Y];ne&&(re[Y]={status:"error",errors:ne.map(te=>({...te.error,...te.error}))})}else if(ae.status!==200)for(const $ in L){const Y=$;re[Y]={status:"error",errors:[{message:ae.json.message}]}}return re})}}).catch(ae=>{console.error("Could not sync patches",ae)})},[A,p.status,"data"in p&&p.data]),R=g.useRef(-1),M=g.useRef(-1);return g.useEffect(()=>{if(M.current=Date.now(),R.current!==-1&&Date.now()-R.current>2e3)R.current=Date.now(),I();else{const L=setTimeout(()=>{R.current=Date.now(),I()},500);return()=>{clearTimeout(L)}}},[u,I]),g.useEffect(()=>{const L=setInterval(()=>{Date.now()-M.current>5e3&&Object.keys(C.current).length>0&&I()},5e3);return()=>{clearInterval(L)}},[I]),{stat:p,authenticationState:m,schemas:o,schemaSha:j,sources:u,addPatch:J,deletePatches:X,patchesStatus:l,sourcesSyncStatus:s,validationErrors:w,patchIds:A,serviceUnavailable:x}}const vt=_e.createContext(new Proxy({},{get:()=>{throw new Error("Cannot use ValContext outside of ValProvider")}}));function wP({children:e,client:t,dispatchValEvents:n}){const{addPatch:r,deletePatches:o,authenticationState:i,schemas:s,schemaSha:a,stat:l,sources:c,validationErrors:u,sourcesSyncStatus:d,patchesStatus:p,patchIds:h,serviceUnavailable:m}=aV(t,n),[v,b]=g.useState({});g.useEffect(()=>{(async()=>{const Y=await t("/profiles","GET",{});if(Y.status===200){const ne={};for(const te of Y.json.profiles)ne[te.profileId]={fullName:te.fullName,avatar:te.avatar};b(ne)}else console.error("Could not get profiles",Y.json)})()},["data"in l&&l.data&&l.data.baseSha]);const x=g.useRef({});g.useEffect(()=>{setInterval(()=>{if(Object.keys(x.current).length!==0){for(const[$,Y]of Object.entries(x.current)){const ne=$,[te]=de.splitModuleFilePathAndModulePath(ne);for(const we of Y)r(te,we())}x.current={}}},200)},[r]);const w=g.useCallback(($,Y)=>{x.current[Y]||(x.current[Y]=[]),x.current[Y].push($)},[]),k="data"in l&&l.data?l.data.config:void 0,C="error"in l?l.error:void 0,[_,O]=g.useState();g.useEffect(()=>{if(_===void 0||_===!0)if(m){const $=setTimeout(()=>{O(m)},2e3);return()=>{clearTimeout($)}}else m||O(!1)},[m,_]);const[T,j]=g.useState(null);g.useEffect(()=>{try{const $=localStorage.getItem("val-theme-"+((k==null?void 0:k.project)||"unknown"));if($)if($==="light"||$==="dark")j($);else throw new Error(`Invalid Val theme: ${$}`);else C&&j("dark")}catch($){console.error("Error getting theme from local storage",$)}},[k,C]),g.useEffect(()=>{k!=null&&k.defaultTheme&&T===null?(k==null?void 0:k.defaultTheme)==="dark"||(k==null?void 0:k.defaultTheme)==="light"?j(k.defaultTheme):console.warn(`Invalid config default theme: ${k.defaultTheme}`):k!==void 0&&T===null&&j("dark")},[T,k]);const[A,D]=g.useState(!1),[V,W]=g.useState(null),[J,X]=g.useState(null),U=g.useCallback(()=>{D(!0),t("/save","POST",{body:{message:(J==null?void 0:J.commitSummary)??void 0,patchIds:h}}).then($=>{$.status===200?(D(!1),W(null)):(console.error("Error publishing",$.json),W($.json.message),D(!1))}).catch($=>{W($.message),D(!1)})},[t,h]),I=g.useCallback(()=>{W(null)},[]),R=g.useCallback(async $=>{const Y=await t("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:$}});if(Y.status===200){const ne={};for(const te of Y.json.patches)ne[te.patchId]=te;return{status:"ok",data:ne}}return{status:"error",error:Y.json.message}},[t]),M=g.useRef(null),F="data"in l&&l.data?l.data.baseSha:void 0,L=g.useCallback(async()=>{const $=h.join(",");if(J&&F===J.baseSha&&$===J.patchIdsString)return{commitSummary:J.commitSummary};const Y=await t("/commit-summary","GET",{query:{patch_id:h}});return Y.status===200?(X({baseSha:F,patchIdsString:$,commitSummary:Y.json.commitSummary}),{commitSummary:Y.json.commitSummary}):{error:Y.json.message}},[t,F,h]),[B,K]=g.useState([]),be=g.useRef(new Set);g.useEffect(()=>{var $;"data"in l&&l.data&&($=l.data)!=null&&$.deployments&&K(Y=>{var ne,te,we;if((ne=l.data)!=null&&ne.deployments&&((we=(te=l.data)==null?void 0:te.deployments)==null?void 0:we.length)>0){const ce={};for(const je of l.data.deployments)be.current.has(je.deployment_id)||(ce[je.deployment_id]||(ce[je.deployment_id]={deploymentId:je.deployment_id,deploymentState:je.deployment_state,createdAt:je.created_at,updatedAt:je.updated_at}),je.updated_at>ce[je.deployment_id].updatedAt&&(ce[je.deployment_id].updatedAt=je.updated_at,ce[je.deployment_id].deploymentState=je.deployment_state));return Object.values(ce).sort((je,mt)=>je.updatedAt>mt.updatedAt?-1:1)}return Y})},["data"in l&&l.data]);const ae=g.useCallback($=>{K(Y=>Y.filter(ne=>ne.deploymentId!==$)),be.current.add($)},[]),[le,re]=g.useState({status:"not-asked"});return g.useEffect(()=>{let $=0;function Y(){$++,le.status!=="ready"&&$<10&&t("/remote/settings","GET",{}).then(ne=>{ne.status===200?re({status:"ready",coreVersion:ne.json.coreVersion,buckets:ne.json.remoteFileBuckets.map(te=>te.bucket),publicProjectId:ne.json.publicProjectId}):("errorCode"in ne.json&&ne.json.errorCode?re({status:"inactive",reason:ne.json.errorCode}):re({status:"inactive",reason:"unknown-error"}),setTimeout(Y,5e3))}).catch(ne=>{console.error("Error getting remote settings",ne),re({status:"inactive",reason:"unknown-error"}),setTimeout(Y,5e3)})}re({status:"loading"}),Y()},[]),f.jsx(vt.Provider,{value:{mode:"data"in l&&l.data?l.data.mode:"unknown",serviceUnavailable:_,baseSha:F,deployments:B,dismissDeployment:ae,getCommitSummary:L,portalRef:M.current,authenticationState:i,addPatch:r,getPatches:R,deletePatches:o,addDebouncedPatch:w,theme:T,setTheme:$=>{if($==="dark"||$==="light"){try{localStorage.setItem("val-theme-"+((k==null?void 0:k.project)||"unknown"),$),localStorage.setItem("val-theme-unknown",$)}catch(Y){console.error("Error setting theme in local storage",Y)}j($)}else console.warn(`Cannot set invalid theme theme: ${$}`)},publish:U,isPublishing:A,publishError:V,resetPublishError:I,config:k,schemas:s,schemaSha:a,sources:c,validationErrors:u,sourcesSyncStatus:d,patchesStatus:p,patchIds:h,profiles:v,remoteFiles:le},children:f.jsxs(ZM,{initialProps:{mode:"default"},children:[f.jsx("div",{"data-val-portal":"true",ref:M,...T?{"data-mode":T}:{}}),e]})})}function so(){return g.useContext(vt).portalRef}function hv(){const{theme:e,setTheme:t}=g.useContext(vt);return{theme:e,setTheme:t}}function Ep(){const{config:e}=g.useContext(vt),t=g.useRef(e&&{...e,remoteHost:YE});return g.useEffect(()=>{e&&(t.current={...e,remoteHost:YE})},[e]),t.current}function N1(){const{remoteFiles:e}=g.useContext(vt);return e}function T1(){const{remoteFiles:e}=g.useContext(vt),[t,n]=g.useState(null);function r(o){return Math.floor(Math.random()*o)}return g.useEffect(()=>{e.status==="ready"&&e.buckets.length>0&&t===null&&n(e.buckets[r(e.buckets.length)])},[e]),t}function SP(){const{authenticationState:e}=g.useContext(vt);return e}function lV(){const{serviceUnavailable:e}=g.useContext(vt);return e===!0?"service-unavailable":"connected"}function Tn(e){const{addPatch:t,addDebouncedPatch:n}=g.useContext(vt),[r,o]=de.splitModuleFilePathAndModulePath(e),i=g.useMemo(()=>de.createPatchPath(o),[o]),s=g.useCallback(a=>{t(r,a)},[t,e]);return{patchPath:i,addPatch:s,addModuleFilePatch:t,addDebouncedPatch:n}}function cV(){const{deletePatches:e}=g.useContext(vt);return{deletePatches:e}}function kP(){const{getPatches:e}=g.useContext(vt);return{getPatches:e}}function uV(){const{deployments:e,dismissDeployment:t}=g.useContext(vt);return{deployments:e,dismissDeployment:t}}function EP(){const{getPatches:e}=kP(),{isPublishing:t,patchIds:n}=g.useContext(vt),[r,o]=g.useState(new Set);return g.useEffect(()=>{t?o(new Set(n)):e(n).then(i=>{if(i.status==="ok"){const s=new Set;for(const[a,l]of Object.entries(i.data))l!=null&&l.appliedAt&&s.add(a);o(s)}})},[t,n.join(",")]),r}function O1(){const{patchIds:e}=g.useContext(vt);return e}function Cp(){const{mode:e}=g.useContext(vt);return e}function dV(){const{getCommitSummary:e}=g.useContext(vt);return{getCommitSummary:e}}function CP(){const{sourcesSyncStatus:e}=g.useContext(vt);return g.useMemo(()=>Object.values(e).some(t=>t.status==="loading")?"loading":Object.values(e).some(t=>t.status==="error")?"error":"success",[e])}function fV(){const{sourcesSyncStatus:e}=g.useContext(vt);return e}function yu(){const{publish:e,isPublishing:t,publishError:n,resetPublishError:r}=g.useContext(vt),o=O1(),{globalErrors:i}=mi(),s=M1(),a=EP(),l=o.filter(u=>!a.has(u)),c=s!=="success"||t||l.length===0||i.length>0;return{publish:e,isPublishing:t,publishError:n,resetPublishError:r,publishDisabled:c}}function M1(){const e=fV(),[t,n]=g.useState("not-asked");return g.useEffect(()=>{let r="success";for(const o of Object.values(e))if(o.status==="error"){r="error";break}else if(o.status==="loading"){r="loading";break}if(r==="success"){const o=setTimeout(()=>{n(r)},100);return()=>{clearTimeout(o)}}else n(r)},[e]),t}function Lt(e){const{schemas:t,sources:n}=g.useContext(vt),r=g.useCallback(()=>{const[o,i]=de.splitModuleFilePathAndModulePath(e),s=n[o];if(t.status==="error")return t;if(t.status==="not-asked")return{status:"loading"};if(t.status==="loading")return{status:"loading"};if(s===void 0)return{status:"not-found"};const a=t.data[o];try{const{schema:l}=de.resolvePath(i,s,a);return l===void 0?{status:"not-found"}:{status:"success",data:l}}catch(l){return{status:"error",error:l instanceof Error?l.message:"Unknown error: "+JSON.stringify(l)}}},[e,n,t]);return g.useMemo(r,[n,e,t])}function mv(){return g.useContext(vt).schemas}function pV(){return g.useContext(vt).schemaSha}function mi(){const{sourcesSyncStatus:e,schemas:t,patchesStatus:n,validationErrors:r}=g.useContext(vt),o=[],i={},s={};t.status==="error"&&o.push(t.error);for(const[a,l]of Object.entries(e))if(l.status==="error")for(const c of l.errors)c.patchId?(c.skipped&&(s[c.patchId]=!0),i[c.patchId]||(i[c.patchId]=[]),i[c.patchId].push(c.message)):o.push(`Error syncing ${a}: ${c.message}`);for(const[a,l]of Object.entries(r))for(const c of l)o.push(`Error validating ${a}: ${c.message}`);for(const[a,l]of Object.entries(n)){const c=a;if(l.status==="error")for(const u of l.errors)u.patchId?(u.skipped&&(s[u.patchId]=!0),i[u.patchId]||(i[u.patchId]=[]),i[u.patchId].push(u.message)):o.push(`Error patching ${c}: ${u.message}`)}return{globalErrors:o,patchErrors:i,skippedPatches:s,validationErrors:r}}function _P(){const{profiles:e}=g.useContext(vt);return e}function st(e,t){const{sources:n,sourcesSyncStatus:r}=g.useContext(vt);if(e===void 0)return{status:"loading"};const[o,i]=de.splitModuleFilePathAndModulePath(e),s=g.useMemo(()=>{const l=n[o];return l!==void 0&&t!==void 0?mV(o,i,t,l):{status:"not-found"}},[n[o],e,t]),a=g.useMemo(()=>r[o],[o,r]);return"data"in s&&(a==null?void 0:a.status)==="loading"?{status:"loading",data:s.data}:(a==null?void 0:a.status)==="error"?{status:"error",data:"data"in s?s.data:void 0,error:a.errors.map(l=>l.message).join(", ")}:s}function hV(){return g.useContext(vt).sources}function NP(e){const{sources:t}=g.useContext(vt),[n,r]=de.splitModuleFilePathAndModulePath(e);return TP(r,t[n])}function TP(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of de.splitModulePath(e)){if(n===null)return{status:"error",error:`Expected object at ${e}, got null`};if(n===void 0)return{status:"error",error:`Expected object at ${e}, got undefined`};if(typeof n!="object")return{status:"error",error:`Expected object at ${e}, got ${JSON.stringify(n)}`};if(Bs(n)){const o=Number(r);if(Number.isNaN(o))return{status:"error",error:`Expected number at ${e}, got ${r}`};n=n[o]}else n=n[r]}return n===void 0?{status:"error",error:`Expected object at ${e}, got undefined`}:{status:"success",data:n}}function mV(e,t,n,r){const o=TP(t,r);return"data"in o&&o.data!==void 0?gV(e,t,n,o.data):o}function gV(e,t,n,r){if(r===null)return{status:"success",data:null};const o=n;if(o==="object"||o==="record"){if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Bs(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=o0(e,t,s);return{status:"success",data:i}}else if(o==="array"){if(typeof r!="object"||!Bs(r))return{status:"error",error:`Expected array, got ${typeof r}`};const i=[];for(let s=0;s<r.length;s++)i.push(o0(e,t,s));return{status:"success",data:i}}else{if(o==="boolean")return typeof r!="boolean"&&r!==null?{status:"error",error:`Expected boolean, got ${typeof r}`}:{status:"success",data:r};if(o==="number")return typeof r!="number"&&r!==null?{status:"error",error:`Expected number, got ${typeof r}`}:{status:"success",data:r};if(o==="richtext")return typeof r!="object"||!Bs(r)?{status:"error",error:`Expected richtext (i.e. array), got ${typeof r}`}:{status:"success",data:r};if(o==="date"||o==="string"||o==="literal")return typeof r!="string"&&r!==null?{status:"error",error:`Expected string, got ${typeof r}: ${JSON.stringify(r)}`}:{status:"success",data:r};if(o==="file"||o==="image")return typeof r!="object"||!(bt in r)||r[bt]===void 0?{status:"error",error:`Expected object with ${bt} property, got ${typeof r}`}:"metadata"in r&&r.metatadata&&typeof r.metatadata!="object"?{status:"error",error:`Expected metadata of ${o} to be an object, got ${typeof r.metadata}`}:{status:"success",data:r};if(o==="keyOf")return typeof r!="string"?{status:"error",error:`Expected string, got ${typeof r}`}:{status:"success",data:r};if(o==="union"){if(typeof r=="string")return{status:"success",data:r};if(typeof r!="object")return{status:"error",error:`Expected object, got ${typeof r}`};if(Bs(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=o0(e,t,s);return{status:"success",data:i}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function o0(e,t,n){return t?e+aa+t+"."+JSON.stringify(n):e+aa+n}var OP={exports:{}};/*!
44
- Copyright (c) 2018 Jed Watson.
45
- Licensed under the MIT License (MIT), see
46
- http://jedwatson.github.io/classnames
47
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(OP);var vV=OP.exports;const Ne=ka(vV);/**
48
- * @license lucide-react v0.379.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const yV=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MP=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
53
- * @license lucide-react v0.379.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */var xV={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
58
- * @license lucide-react v0.379.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const bV=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>g.createElement("svg",{ref:l,...xV,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:MP("lucide",o),...a},[...s.map(([c,u])=>g.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
63
- * @license lucide-react v0.379.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const Ae=(e,t)=>{const n=g.forwardRef(({className:r,...o},i)=>g.createElement(bV,{ref:i,iconNode:t,className:MP(`lucide-${yV(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
68
- * @license lucide-react v0.379.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const wV=Ae("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
73
- * @license lucide-react v0.379.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const SV=Ae("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
78
- * @license lucide-react v0.379.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const kV=Ae("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
83
- * @license lucide-react v0.379.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const _p=Ae("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
88
- * @license lucide-react v0.379.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const Np=Ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
93
- * @license lucide-react v0.379.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const EV=Ae("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
98
- * @license lucide-react v0.379.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const gv=Ae("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
103
- * @license lucide-react v0.379.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const CV=Ae("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
108
- * @license lucide-react v0.379.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const _V=Ae("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
113
- * @license lucide-react v0.379.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const i0=Ae("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
118
- * @license lucide-react v0.379.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const PP=Ae("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
123
- * @license lucide-react v0.379.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const NV=Ae("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
128
- * @license lucide-react v0.379.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const jP=Ae("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
133
- * @license lucide-react v0.379.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const RP=Ae("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
138
- * @license lucide-react v0.379.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const TV=Ae("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
143
- * @license lucide-react v0.379.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const uC=Ae("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
148
- * @license lucide-react v0.379.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const dC=Ae("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
153
- * @license lucide-react v0.379.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const fC=Ae("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
158
- * @license lucide-react v0.379.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const pC=Ae("Heading4",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v4h4",key:"13sv97"}],["path",{d:"M21 10v8",key:"1kdml4"}]]);/**
163
- * @license lucide-react v0.379.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const hC=Ae("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/**
168
- * @license lucide-react v0.379.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const mC=Ae("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/**
173
- * @license lucide-react v0.379.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const OV=Ae("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
178
- * @license lucide-react v0.379.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const MV=Ae("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
183
- * @license lucide-react v0.379.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const PV=Ae("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
188
- * @license lucide-react v0.379.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const jV=Ae("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
193
- * @license lucide-react v0.379.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const RV=Ae("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
198
- * @license lucide-react v0.379.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const xu=Ae("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
203
- * @license lucide-react v0.379.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const AV=Ae("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
208
- * @license lucide-react v0.379.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const IV=Ae("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
213
- * @license lucide-react v0.379.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const DV=Ae("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
218
- * @license lucide-react v0.379.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const LV=Ae("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
223
- * @license lucide-react v0.379.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const eg=Ae("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
228
- * @license lucide-react v0.379.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const FV=Ae("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
233
- * @license lucide-react v0.379.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const zV=Ae("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
238
- * @license lucide-react v0.379.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const gC=Ae("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/**
243
- * @license lucide-react v0.379.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const AP=Ae("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
248
- * @license lucide-react v0.379.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const BV=Ae("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
253
- * @license lucide-react v0.379.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const $V=Ae("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/**
258
- * @license lucide-react v0.379.0 - ISC
259
- *
260
- * This source code is licensed under the ISC license.
261
- * See the LICENSE file in the root directory of this source tree.
262
- */const VV=Ae("SquareDashedMousePointer",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"m12 12 4 10 1.7-4.3L22 16Z",key:"64ilsv"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/**
263
- * @license lucide-react v0.379.0 - ISC
264
- *
265
- * This source code is licensed under the ISC license.
266
- * See the LICENSE file in the root directory of this source tree.
267
- */const UV=Ae("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
268
- * @license lucide-react v0.379.0 - ISC
269
- *
270
- * This source code is licensed under the ISC license.
271
- * See the LICENSE file in the root directory of this source tree.
272
- */const HV=Ae("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
273
- * @license lucide-react v0.379.0 - ISC
274
- *
275
- * This source code is licensed under the ISC license.
276
- * See the LICENSE file in the root directory of this source tree.
277
- */const WV=Ae("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/**
278
- * @license lucide-react v0.379.0 - ISC
279
- *
280
- * This source code is licensed under the ISC license.
281
- * See the LICENSE file in the root directory of this source tree.
282
- */const KV=Ae("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
283
- * @license lucide-react v0.379.0 - ISC
284
- *
285
- * This source code is licensed under the ISC license.
286
- * See the LICENSE file in the root directory of this source tree.
287
- */const qV=Ae("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
288
- * @license lucide-react v0.379.0 - ISC
289
- *
290
- * This source code is licensed under the ISC license.
291
- * See the LICENSE file in the root directory of this source tree.
292
- */const GV=Ae("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11",key:"llx8ln"}]]);/**
293
- * @license lucide-react v0.379.0 - ISC
294
- *
295
- * This source code is licensed under the ISC license.
296
- * See the LICENSE file in the root directory of this source tree.
297
- */const YV=Ae("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/**
298
- * @license lucide-react v0.379.0 - ISC
299
- *
300
- * This source code is licensed under the ISC license.
301
- * See the LICENSE file in the root directory of this source tree.
302
- */const P1=Ae("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
303
- * @license lucide-react v0.379.0 - ISC
304
- *
305
- * This source code is licensed under the ISC license.
306
- * See the LICENSE file in the root directory of this source tree.
307
- */const IP=Ae("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
308
- * @license lucide-react v0.379.0 - ISC
309
- *
310
- * This source code is licensed under the ISC license.
311
- * See the LICENSE file in the root directory of this source tree.
312
- */const Af=Ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function JV(e){const t={"/":{name:"/",fullPath:"/",isDirectory:!0,children:[]}};for(const n of e){const r=n.split("/");if(r[0]!=="")throw new Error("Expected path to start with '/'");for(let o=1;o<r.length;o++){const i=r.slice(0,o).join("/"),s=[i,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[s]){const l={name:a,fullPath:s,children:[]};o<r.length-1&&(l.isDirectory=!0),t[s]=l,t[i||"/"].children.push(t[s])}}}return t["/"]}function If({isOpen:e,children:t,duration:n=.3}){return f.jsx("div",{style:{transition:`grid-template-rows ${n}s`},className:Ne("grid overflow-hidden",{"grid-rows-[0fr]":!e,"grid-rows-[1fr]":e}),children:f.jsx("div",{style:{transition:`visibility ${n}s`},className:Ne("min-h-0",{visible:e,invisible:!e}),children:t})})}function vv(e){let t="",n=!1;for(let r=0;r<e.length;r++){const o=e[r]===e[r].toUpperCase();r===0?(t+=e[r].toUpperCase(),n=!1):n&&o?(n=!1,t+=" "+e[r].toUpperCase()):(t+=e[r].toLowerCase(),n=!0)}return t=t.replace(/[-–—]/g,""),t}function fa(e){return vv(e.split(".")[0])}const DP=_e.createContext(new Proxy({},{get:()=>{throw Error("ValRouter context not provided")}})),s0="/val/~";function LP({children:e,overlay:t}){const[n,r]=g.useState(!1),[o,i]=g.useState(""),s=g.useRef([]);g.useEffect(()=>{const l=()=>{const c=location.pathname.indexOf(s0);if(c>-1){const u=new URLSearchParams(location.search).get("p"),p=location.pathname.slice(c+s0.length)+(u?`?p=${u}`:"");i(p);const h=s.current.pop();setTimeout(()=>{var v,b;const m=(b=(v=document.getElementById("val-shadow-root"))==null?void 0:v.shadowRoot)==null?void 0:b.getElementById("val-content-area");h&&(m==null||m.scrollTo(0,h))},50)}r(!0)};return l(),window.addEventListener("popstate",l),()=>{window.removeEventListener("popstate",l)}},[]);const a=g.useCallback((l,c)=>{var d,p;const u=`${s0}${l}`;if(i(l),t)window.location.href=u;else{const h=(p=(d=document.getElementById("val-shadow-root"))==null?void 0:d.shadowRoot)==null?void 0:p.getElementById("val-content-area"),m=h==null?void 0:h.scrollTop;h==null||h.scrollTo(0,0),m!==void 0&&s.current.push(m),c!=null&&c.replace?window.history.replaceState(null,"",u):window.history.pushState(null,"",u)}},[t]);return f.jsx(DP.Provider,{value:{hardLink:!!t,currentSourcePath:o,navigate:a,ready:n},children:e})}function hr(){const{navigate:e,currentSourcePath:t,ready:n}=g.useContext(DP);return{navigate:e,currentSourcePath:t,ready:n}}function XV(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function yv(...e){return t=>e.forEach(n=>XV(n,t))}function Ue(...e){return g.useCallback(yv(...e),e)}var Gi=g.forwardRef((e,t)=>{const{children:n,...r}=e,o=g.Children.toArray(n),i=o.find(QV);if(i){const s=i.props.children,a=o.map(l=>l===i?g.Children.count(s)>1?g.Children.only(null):g.isValidElement(s)?s.props.children:null:l);return f.jsx(Jx,{...r,ref:t,children:g.isValidElement(s)?g.cloneElement(s,void 0,a):null})}return f.jsx(Jx,{...r,ref:t,children:n})});Gi.displayName="Slot";var Jx=g.forwardRef((e,t)=>{const{children:n,...r}=e;if(g.isValidElement(n)){const o=t9(n);return g.cloneElement(n,{...e9(r,n.props),ref:t?yv(t,o):o})}return g.Children.count(n)>1?g.Children.only(null):null});Jx.displayName="SlotClone";var ZV=({children:e})=>f.jsx(f.Fragment,{children:e});function QV(e){return g.isValidElement(e)&&e.type===ZV}function e9(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function t9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var n9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Pe=n9.reduce((e,t)=>{const n=g.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Gi:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function FP(e,t){e&&Or.flushSync(()=>e.dispatchEvent(t))}var En=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{};function r9(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var On=e=>{const{present:t,children:n}=e,r=o9(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=Ue(r.ref,i9(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};On.displayName="Presence";function o9(e){const[t,n]=g.useState(),r=g.useRef({}),o=g.useRef(e),i=g.useRef("none"),s=e?"mounted":"unmounted",[a,l]=r9(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=wh(r.current);i.current=a==="mounted"?c:"none"},[a]),En(()=>{const c=r.current,u=o.current;if(u!==e){const p=i.current,h=wh(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),En(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const v=wh(r.current).includes(h.animationName);if(h.target===t&&v&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},p=h=>{h.target===t&&(i.current=wh(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function wh(e){return(e==null?void 0:e.animationName)||"none"}function i9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function s9(e,t){const n=g.createContext(t),r=i=>{const{children:s,...a}=i,l=g.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=g.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Wo(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];const c=d=>{var x;const{scope:p,children:h,...m}=d,v=((x=p==null?void 0:p[e])==null?void 0:x[l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:h})};c.displayName=i+"Provider";function u(d,p){var v;const h=((v=p==null?void 0:p[e])==null?void 0:v[l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,a9(o,...t)]}function a9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Qt(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var l9=g.createContext(void 0);function Tp(e){const t=g.useContext(l9);return e||t||"ltr"}function Xx(e,[t,n]){return Math.min(n,Math.max(t,e))}function se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function c9(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var j1="ScrollArea",[zP,jpe]=Wo(j1),[u9,ao]=zP(j1),BP=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,l]=g.useState(null),[c,u]=g.useState(null),[d,p]=g.useState(null),[h,m]=g.useState(null),[v,b]=g.useState(null),[x,w]=g.useState(0),[k,C]=g.useState(0),[_,O]=g.useState(!1),[T,j]=g.useState(!1),A=Ue(t,V=>l(V)),D=Tp(o);return f.jsx(u9,{scope:n,type:r,dir:D,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:p,scrollbarX:h,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:O,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:T,onScrollbarYEnabledChange:j,onCornerWidthChange:w,onCornerHeightChange:C,children:f.jsx(Pe.div,{dir:D,...s,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});BP.displayName=j1;var $P="ScrollAreaViewport",VP=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=ao($P,n),a=g.useRef(null),l=Ue(t,a,s.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),f.jsx(Pe.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:f.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});VP.displayName=$P;var gi="ScrollAreaScrollbar",R1=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ao(gi,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return g.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?f.jsx(d9,{...r,ref:t,forceMount:n}):o.type==="scroll"?f.jsx(f9,{...r,ref:t,forceMount:n}):o.type==="auto"?f.jsx(UP,{...r,ref:t,forceMount:n}):o.type==="always"?f.jsx(A1,{...r,ref:t}):null});R1.displayName=gi;var d9=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ao(gi,e.__scopeScrollArea),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},u=()=>{l=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[o.scrollArea,o.scrollHideDelay]),f.jsx(On,{present:n||i,children:f.jsx(UP,{"data-state":i?"visible":"hidden",...r,ref:t})})}),f9=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ao(gi,e.__scopeScrollArea),i=e.orientation==="horizontal",s=bv(()=>l("SCROLL_END"),100),[a,l]=c9("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),g.useEffect(()=>{const c=o.viewport,u=i?"scrollLeft":"scrollTop";if(c){let d=c[u];const p=()=>{const h=c[u];d!==h&&(l("SCROLL"),s()),d=h};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[o.viewport,i,l,s]),f.jsx(On,{present:n||a!=="hidden",children:f.jsx(A1,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:se(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:se(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),UP=g.forwardRef((e,t)=>{const n=ao(gi,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=g.useState(!1),a=e.orientation==="horizontal",l=bv(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return eu(n.viewport,l),eu(n.content,l),f.jsx(On,{present:r||i,children:f.jsx(A1,{"data-state":i?"visible":"hidden",...o,ref:t})})}),A1=g.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=ao(gi,e.__scopeScrollArea),i=g.useRef(null),s=g.useRef(0),[a,l]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=GP(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>i.current=p,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:p=>s.current=p};function d(p,h){return y9(p,s.current,a,h)}return n==="horizontal"?f.jsx(p9,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollLeft,h=vC(p,a,o.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=d(p,o.dir))}}):n==="vertical"?f.jsx(h9,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollTop,h=vC(p,a);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=d(p))}}):null}),p9=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=ao(gi,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Ue(t,l,i.onScrollbarXChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(WP,{"data-orientation":"horizontal",...o,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xv(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(i.viewport){const p=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),JP(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ng(s.paddingLeft),paddingEnd:ng(s.paddingRight)}})}})}),h9=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=ao(gi,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Ue(t,l,i.onScrollbarYChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(WP,{"data-orientation":"vertical",...o,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xv(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(i.viewport){const p=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),JP(p,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ng(s.paddingTop),paddingEnd:ng(s.paddingBottom)}})}})}),[m9,HP]=zP(gi),WP=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...p}=e,h=ao(gi,n),[m,v]=g.useState(null),b=Ue(t,A=>v(A)),x=g.useRef(null),w=g.useRef(""),k=h.viewport,C=r.content-r.viewport,_=Qt(u),O=Qt(l),T=bv(d,10);function j(A){if(x.current){const D=A.clientX-x.current.left,V=A.clientY-x.current.top;c({x:D,y:V})}}return g.useEffect(()=>{const A=D=>{const V=D.target;(m==null?void 0:m.contains(V))&&_(D,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[k,m,C,_]),g.useEffect(O,[r,O]),eu(m,T),eu(h.content,T),f.jsx(m9,{scope:n,scrollbar:m,hasThumb:o,onThumbChange:Qt(i),onThumbPointerUp:Qt(s),onThumbPositionChange:O,onThumbPointerDown:Qt(a),children:f.jsx(Pe.div,{...p,ref:b,style:{position:"absolute",...p.style},onPointerDown:se(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),x.current=m.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),j(A))}),onPointerMove:se(e.onPointerMove,j),onPointerUp:se(e.onPointerUp,A=>{const D=A.target;D.hasPointerCapture(A.pointerId)&&D.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),x.current=null})})})}),tg="ScrollAreaThumb",KP=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=HP(tg,e.__scopeScrollArea);return f.jsx(On,{present:n||o.hasThumb,children:f.jsx(g9,{ref:t,...r})})}),g9=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=ao(tg,n),s=HP(tg,n),{onThumbPositionChange:a}=s,l=Ue(t,d=>s.onThumbChange(d)),c=g.useRef(),u=bv(()=>{c.current&&(c.current(),c.current=void 0)},100);return g.useEffect(()=>{const d=i.viewport;if(d){const p=()=>{if(u(),!c.current){const h=x9(d,a);c.current=h,a()}};return a(),d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[i.viewport,u,a]),f.jsx(Pe.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:se(e.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,v=d.clientY-h.top;s.onThumbPointerDown({x:m,y:v})}),onPointerUp:se(e.onPointerUp,s.onThumbPointerUp)})});KP.displayName=tg;var I1="ScrollAreaCorner",qP=g.forwardRef((e,t)=>{const n=ao(I1,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.jsx(v9,{...e,ref:t}):null});qP.displayName=I1;var v9=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=ao(I1,n),[i,s]=g.useState(0),[a,l]=g.useState(0),c=!!(i&&a);return eu(o.scrollbarX,()=>{var d;const u=((d=o.scrollbarX)==null?void 0:d.offsetHeight)||0;o.onCornerHeightChange(u),l(u)}),eu(o.scrollbarY,()=>{var d;const u=((d=o.scrollbarY)==null?void 0:d.offsetWidth)||0;o.onCornerWidthChange(u),s(u)}),c?f.jsx(Pe.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ng(e){return e?parseInt(e,10):0}function GP(e,t){const n=e/t;return isNaN(n)?0:n}function xv(e){const t=GP(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function y9(e,t,n,r="ltr"){const o=xv(n),i=o/2,s=t||i,a=o-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,d=r==="ltr"?[0,u]:[u*-1,0];return YP([l,c],d)(e)}function vC(e,t,n="ltr"){const r=xv(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,s]:[s*-1,0],c=Xx(e,l);return YP([0,s],[0,a])(c)}function YP(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function JP(e,t){return e>0&&e<t}var x9=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function bv(e,t){const n=Qt(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function eu(e,t){const n=Qt(t);En(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var XP=BP,b9=VP,w9=qP;function ZP(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=ZP(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function QP(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ZP(e))&&(r&&(r+=" "),r+=t);return r}const D1="-",S9=e=>{const t=E9(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(D1);return a[0]===""&&a.length!==1&&a.shift(),ej(a,t)||k9(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},ej=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?ej(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(D1);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},yC=/^\[(.+)\]$/,k9=e=>{if(yC.test(e)){const t=yC.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},E9=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return _9(Object.entries(e.classGroups),n).forEach(([i,s])=>{Zx(s,r,i,t)}),r},Zx=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:xC(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(C9(o)){Zx(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Zx(s,xC(t,i),n,r)})})},xC=(e,t)=>{let n=e;return t.split(D1).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},C9=e=>e.isThemeGetter,_9=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,N9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},tj="!",T9=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let x=a[b];if(c===0){if(x===o&&(r||a.slice(b,b+i)===t)){l.push(a.slice(u,b)),u=b+i;continue}if(x==="/"){d=b;continue}}x==="["?c++:x==="]"&&c--}const p=l.length===0?a:a.substring(u),h=p.startsWith(tj),m=h?p.substring(1):p,v=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},O9=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},M9=e=>({cache:N9(e.cacheSize),parseClassName:T9(e),...S9(e)}),P9=/\s+/,j9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(P9);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:h}=n(c);let m=!!h,v=r(m?p.substring(0,h):p);if(!v){if(!m){a=c+(a.length>0?" "+a:a);continue}if(v=r(p),!v){a=c+(a.length>0?" "+a:a);continue}m=!1}const b=O9(u).join(":"),x=d?b+tj:b,w=x+v;if(i.includes(w))continue;i.push(w);const k=o(v,m);for(let C=0;C<k.length;++C){const _=k[C];i.push(x+_)}a=c+(a.length>0?" "+a:a)}return a};function R9(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=nj(t))&&(r&&(r+=" "),r+=n);return r}const nj=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=nj(e[r]))&&(n&&(n+=" "),n+=t);return n};function A9(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=M9(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=j9(l,n);return o(l,u),u}return function(){return i(R9.apply(null,arguments))}}const St=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},rj=/^\[(?:([a-z-]+):)?(.+)\]$/i,I9=/^\d+\/\d+$/,D9=new Set(["px","full","screen"]),L9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,F9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,z9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,B9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bi=e=>Oc(e)||D9.has(e)||I9.test(e),hs=e=>bu(e,"length",Y9),Oc=e=>!!e&&!Number.isNaN(Number(e)),a0=e=>bu(e,"number",Oc),Ju=e=>!!e&&Number.isInteger(Number(e)),V9=e=>e.endsWith("%")&&Oc(e.slice(0,-1)),$e=e=>rj.test(e),ms=e=>L9.test(e),U9=new Set(["length","size","percentage"]),H9=e=>bu(e,U9,oj),W9=e=>bu(e,"position",oj),K9=new Set(["image","url"]),q9=e=>bu(e,K9,X9),G9=e=>bu(e,"",J9),Xu=()=>!0,bu=(e,t,n)=>{const r=rj.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Y9=e=>F9.test(e)&&!z9.test(e),oj=()=>!1,J9=e=>B9.test(e),X9=e=>$9.test(e),Z9=()=>{const e=St("colors"),t=St("spacing"),n=St("blur"),r=St("brightness"),o=St("borderColor"),i=St("borderRadius"),s=St("borderSpacing"),a=St("borderWidth"),l=St("contrast"),c=St("grayscale"),u=St("hueRotate"),d=St("invert"),p=St("gap"),h=St("gradientColorStops"),m=St("gradientColorStopPositions"),v=St("inset"),b=St("margin"),x=St("opacity"),w=St("padding"),k=St("saturate"),C=St("scale"),_=St("sepia"),O=St("skew"),T=St("space"),j=St("translate"),A=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto",$e,t],W=()=>[$e,t],J=()=>["",bi,hs],X=()=>["auto",Oc,$e],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],R=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",$e],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[Oc,$e];return{cacheSize:500,separator:":",theme:{colors:[Xu],spacing:[bi,hs],blur:["none","",ms,$e],brightness:B(),borderColor:[e],borderRadius:["none","","full",ms,$e],borderSpacing:W(),borderWidth:J(),contrast:B(),grayscale:F(),hueRotate:B(),invert:F(),gap:W(),gradientColorStops:[e],gradientColorStopPositions:[V9,hs],inset:V(),margin:V(),opacity:B(),padding:W(),saturate:B(),scale:B(),sepia:F(),skew:B(),space:W(),translate:W()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[ms]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),$e]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ju,$e]}],basis:[{basis:V()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$e]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Ju,$e]}],"grid-cols":[{"grid-cols":[Xu]}],"col-start-end":[{col:["auto",{span:["full",Ju,$e]},$e]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[Xu]}],"row-start-end":[{row:["auto",{span:[Ju,$e]},$e]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$e]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$e]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$e,t]}],"min-w":[{"min-w":[$e,t,"min","max","fit"]}],"max-w":[{"max-w":[$e,t,"none","full","min","max","fit","prose",{screen:[ms]},ms]}],h:[{h:[$e,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$e,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$e,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$e,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ms,hs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",a0]}],"font-family":[{font:[Xu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",$e]}],"line-clamp":[{"line-clamp":["none",Oc,a0]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bi,$e]}],"list-image":[{"list-image":["none",$e]}],"list-style-type":[{list:["none","disc","decimal",$e]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bi,hs]}],"underline-offset":[{"underline-offset":["auto",bi,$e]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:W()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",$e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),W9]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",H9]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},q9]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...I(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:I()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...I()]}],"outline-offset":[{"outline-offset":[bi,$e]}],"outline-w":[{outline:[bi,hs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[bi,hs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ms,G9]}],"shadow-color":[{shadow:[Xu]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...R(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":R()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ms,$e]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[k]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",$e]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",$e]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[Ju,$e]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$e]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",$e]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":W()}],"scroll-mx":[{"scroll-mx":W()}],"scroll-my":[{"scroll-my":W()}],"scroll-ms":[{"scroll-ms":W()}],"scroll-me":[{"scroll-me":W()}],"scroll-mt":[{"scroll-mt":W()}],"scroll-mr":[{"scroll-mr":W()}],"scroll-mb":[{"scroll-mb":W()}],"scroll-ml":[{"scroll-ml":W()}],"scroll-p":[{"scroll-p":W()}],"scroll-px":[{"scroll-px":W()}],"scroll-py":[{"scroll-py":W()}],"scroll-ps":[{"scroll-ps":W()}],"scroll-pe":[{"scroll-pe":W()}],"scroll-pt":[{"scroll-pt":W()}],"scroll-pr":[{"scroll-pr":W()}],"scroll-pb":[{"scroll-pb":W()}],"scroll-pl":[{"scroll-pl":W()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",$e]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[bi,hs,a0]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Q9=A9(Z9);function Ke(...e){return Q9(QP(e))}const Ya=g.forwardRef(({className:e,children:t,innerRef:n,viewportId:r,...o},i)=>f.jsxs(XP,{ref:i,className:Ke("relative overflow-hidden",e),...o,children:[f.jsx(b9,{className:"h-full w-full rounded-[inherit]",ref:n,id:r,children:t}),f.jsx(ij,{}),f.jsx(w9,{})]}));Ya.displayName=XP.displayName;const ij=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>f.jsx(R1,{ref:r,orientation:t,className:Ke("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:f.jsx(KP,{className:Ke("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));ij.displayName=R1.displayName;function eU(e,t=globalThis==null?void 0:globalThis.document){const n=Qt(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tU="DismissableLayer",Qx="dismissableLayer.update",nU="dismissableLayer.pointerDownOutside",rU="dismissableLayer.focusOutside",bC,sj=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wu=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=g.useContext(sj),[u,d]=g.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=g.useState({}),m=Ue(t,T=>d(T)),v=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(b),w=u?v.indexOf(u):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,C=w>=x,_=sU(T=>{const j=T.target,A=[...c.branches].some(D=>D.contains(j));!C||A||(o==null||o(T),s==null||s(T),T.defaultPrevented||a==null||a())},p),O=aU(T=>{const j=T.target;[...c.branches].some(D=>D.contains(j))||(i==null||i(T),s==null||s(T),T.defaultPrevented||a==null||a())},p);return eU(T=>{w===c.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&a&&(T.preventDefault(),a()))},p),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(bC=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),wC(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=bC)}},[u,p,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),wC())},[u,c]),g.useEffect(()=>{const T=()=>h({});return document.addEventListener(Qx,T),()=>document.removeEventListener(Qx,T)},[]),f.jsx(Pe.div,{...l,ref:m,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:se(e.onFocusCapture,O.onFocusCapture),onBlurCapture:se(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:se(e.onPointerDownCapture,_.onPointerDownCapture)})});wu.displayName=tU;var oU="DismissableLayerBranch",iU=g.forwardRef((e,t)=>{const n=g.useContext(sj),r=g.useRef(null),o=Ue(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),f.jsx(Pe.div,{...e,ref:o})});iU.displayName=oU;function sU(e,t=globalThis==null?void 0:globalThis.document){const n=Qt(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){aj(nU,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function aU(e,t=globalThis==null?void 0:globalThis.document){const n=Qt(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&aj(rU,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function wC(){const e=new CustomEvent(Qx);document.dispatchEvent(e)}function aj(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?FP(o,i):o.dispatchEvent(i)}var l0=0;function wv(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??SC()),document.body.insertAdjacentElement("beforeend",e[1]??SC()),l0++,()=>{l0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),l0--}},[])}function SC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var c0="focusScope.autoFocusOnMount",u0="focusScope.autoFocusOnUnmount",kC={bubbles:!1,cancelable:!0},lU="FocusScope",Op=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=g.useState(null),c=Qt(o),u=Qt(i),d=g.useRef(null),p=Ue(t,v=>l(v)),h=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let v=function(k){if(h.paused||!a)return;const C=k.target;a.contains(C)?d.current=C:bs(d.current,{select:!0})},b=function(k){if(h.paused||!a)return;const C=k.relatedTarget;C!==null&&(a.contains(C)||bs(d.current,{select:!0}))},x=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&bs(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const w=new MutationObserver(x);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),w.disconnect()}}},[r,a,h.paused]),g.useEffect(()=>{if(a){CC.add(h);const v=document.activeElement;if(!a.contains(v)){const x=new CustomEvent(c0,kC);a.addEventListener(c0,c),a.dispatchEvent(x),x.defaultPrevented||(cU(hU(lj(a)),{select:!0}),document.activeElement===v&&bs(a))}return()=>{a.removeEventListener(c0,c),setTimeout(()=>{const x=new CustomEvent(u0,kC);a.addEventListener(u0,u),a.dispatchEvent(x),x.defaultPrevented||bs(v??document.body,{select:!0}),a.removeEventListener(u0,u),CC.remove(h)},0)}}},[a,c,u,h]);const m=g.useCallback(v=>{if(!n&&!r||h.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(b&&x){const w=v.currentTarget,[k,C]=uU(w);k&&C?!v.shiftKey&&x===C?(v.preventDefault(),n&&bs(k,{select:!0})):v.shiftKey&&x===k&&(v.preventDefault(),n&&bs(C,{select:!0})):x===w&&v.preventDefault()}},[n,r,h.paused]);return f.jsx(Pe.div,{tabIndex:-1,...s,ref:p,onKeyDown:m})});Op.displayName=lU;function cU(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(bs(r,{select:t}),document.activeElement!==n)return}function uU(e){const t=lj(e),n=EC(t,e),r=EC(t.reverse(),e);return[n,r]}function lj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function EC(e,t){for(const n of e)if(!dU(n,{upTo:t}))return n}function dU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function fU(e){return e instanceof HTMLInputElement&&"select"in e}function bs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fU(e)&&t&&e.select()}}var CC=pU();function pU(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=_C(e,t),e.unshift(t)},remove(t){var n;e=_C(e,t),(n=e[0])==null||n.resume()}}}function _C(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hU(e){return e.filter(t=>t.tagName!=="A")}var mU=v3.useId||(()=>{}),gU=0;function Zr(e){const[t,n]=g.useState(mU());return En(()=>{n(r=>r??String(gU++))},[e]),t?`radix-${t}`:""}const vU=["top","right","bottom","left"],pa=Math.min,Cr=Math.max,rg=Math.round,Sh=Math.floor,ii=e=>({x:e,y:e}),yU={left:"right",right:"left",bottom:"top",top:"bottom"},xU={start:"end",end:"start"};function eb(e,t,n){return Cr(e,pa(t,n))}function Yi(e,t){return typeof e=="function"?e(t):e}function Ji(e){return e.split("-")[0]}function Su(e){return e.split("-")[1]}function L1(e){return e==="x"?"y":"x"}function F1(e){return e==="y"?"height":"width"}function ha(e){return["top","bottom"].includes(Ji(e))?"y":"x"}function z1(e){return L1(ha(e))}function bU(e,t,n){n===void 0&&(n=!1);const r=Su(e),o=z1(e),i=F1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=og(s)),[s,og(s)]}function wU(e){const t=og(e);return[tb(e),t,tb(t)]}function tb(e){return e.replace(/start|end/g,t=>xU[t])}function SU(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function kU(e,t,n,r){const o=Su(e);let i=SU(Ji(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(tb)))),i}function og(e){return e.replace(/left|right|bottom|top/g,t=>yU[t])}function EU(e){return{top:0,right:0,bottom:0,left:0,...e}}function cj(e){return typeof e!="number"?EU(e):{top:e,right:e,bottom:e,left:e}}function ig(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function NC(e,t,n){let{reference:r,floating:o}=e;const i=ha(t),s=z1(t),a=F1(s),l=Ji(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}switch(Su(t)){case"start":h[s]-=p*(n&&c?-1:1);break;case"end":h[s]+=p*(n&&c?-1:1);break}return h}const CU=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=NC(c,r,l),p=r,h={},m=0;for(let v=0;v<a.length;v++){const{name:b,fn:x}=a[v],{x:w,y:k,data:C,reset:_}=await x({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:e,floating:t}});u=w??u,d=k??d,h={...h,[b]:{...h[b],...C}},_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(p=_.placement),_.rects&&(c=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:u,y:d}=NC(c,p,l)),v=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:h}};async function Df(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=Yi(t,e),m=cj(h),b=a[p?d==="floating"?"reference":"floating":d],x=ig(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),w=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},_=ig(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:k,strategy:l}):w);return{top:(x.top-_.top+m.top)/C.y,bottom:(_.bottom-x.bottom+m.bottom)/C.y,left:(x.left-_.left+m.left)/C.x,right:(_.right-x.right+m.right)/C.x}}const _U=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Yi(e,t)||{};if(c==null)return{};const d=cj(u),p={x:n,y:r},h=z1(o),m=F1(h),v=await s.getDimensions(c),b=h==="y",x=b?"top":"left",w=b?"bottom":"right",k=b?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[h]-p[h]-i.floating[m],_=p[h]-i.reference[h],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let T=O?O[k]:0;(!T||!await(s.isElement==null?void 0:s.isElement(O)))&&(T=a.floating[k]||i.floating[m]);const j=C/2-_/2,A=T/2-v[m]/2-1,D=pa(d[x],A),V=pa(d[w],A),W=D,J=T-v[m]-V,X=T/2-v[m]/2+j,U=eb(W,X,J),I=!l.arrow&&Su(o)!=null&&X!==U&&i.reference[m]/2-(X<W?D:V)-v[m]/2<0,R=I?X<W?X-W:X-J:0;return{[h]:p[h]+R,data:{[h]:U,centerOffset:X-U-R,...I&&{alignmentOffset:R}},reset:I}}}),NU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...b}=Yi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=Ji(o),w=ha(a),k=Ji(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=p||(k||!v?[og(a)]:wU(a)),O=m!=="none";!p&&O&&_.push(...kU(a,v,m,C));const T=[a,..._],j=await Df(t,b),A=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(j[x]),d){const X=bU(o,s,C);A.push(j[X[0]],j[X[1]])}if(D=[...D,{placement:o,overflows:A}],!A.every(X=>X<=0)){var V,W;const X=(((V=i.flip)==null?void 0:V.index)||0)+1,U=T[X];if(U)return{data:{index:X,overflows:D},reset:{placement:U}};let I=(W=D.filter(R=>R.overflows[0]<=0).sort((R,M)=>R.overflows[1]-M.overflows[1])[0])==null?void 0:W.placement;if(!I)switch(h){case"bestFit":{var J;const R=(J=D.filter(M=>{if(O){const F=ha(M.placement);return F===w||F==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(F=>F>0).reduce((F,L)=>F+L,0)]).sort((M,F)=>M[1]-F[1])[0])==null?void 0:J[0];R&&(I=R);break}case"initialPlacement":I=a;break}if(o!==I)return{reset:{placement:I}}}return{}}}};function TC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function OC(e){return vU.some(t=>e[t]>=0)}const TU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Yi(e,t);switch(r){case"referenceHidden":{const i=await Df(t,{...o,elementContext:"reference"}),s=TC(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:OC(s)}}}case"escaped":{const i=await Df(t,{...o,altBoundary:!0}),s=TC(i,n.floating);return{data:{escapedOffsets:s,escaped:OC(s)}}}default:return{}}}}};async function OU(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ji(n),a=Su(n),l=ha(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=Yi(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(h=a==="end"?m*-1:m),l?{x:h*u,y:p*c}:{x:p*c,y:h*u}}const MU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await OU(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},PU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:b=>{let{x,y:w}=b;return{x,y:w}}},...l}=Yi(e,t),c={x:n,y:r},u=await Df(t,l),d=ha(Ji(o)),p=L1(d);let h=c[p],m=c[d];if(i){const b=p==="y"?"top":"left",x=p==="y"?"bottom":"right",w=h+u[b],k=h-u[x];h=eb(w,h,k)}if(s){const b=d==="y"?"top":"left",x=d==="y"?"bottom":"right",w=m+u[b],k=m-u[x];m=eb(w,m,k)}const v=a.fn({...t,[p]:h,[d]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[d]:s}}}}}},jU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Yi(e,t),u={x:n,y:r},d=ha(o),p=L1(d);let h=u[p],m=u[d];const v=Yi(a,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const k=p==="y"?"height":"width",C=i.reference[p]-i.floating[k]+b.mainAxis,_=i.reference[p]+i.reference[k]-b.mainAxis;h<C?h=C:h>_&&(h=_)}if(c){var x,w;const k=p==="y"?"width":"height",C=["top","left"].includes(Ji(o)),_=i.reference[d]-i.floating[k]+(C&&((x=s.offset)==null?void 0:x[d])||0)+(C?0:b.crossAxis),O=i.reference[d]+i.reference[k]+(C?0:((w=s.offset)==null?void 0:w[d])||0)-(C?b.crossAxis:0);m<_?m=_:m>O&&(m=O)}return{[p]:h,[d]:m}}}},RU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Yi(e,t),u=await Df(t,c),d=Ji(o),p=Su(o),h=ha(o)==="y",{width:m,height:v}=i.floating;let b,x;d==="top"||d==="bottom"?(b=d,x=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(x=d,b=p==="end"?"top":"bottom");const w=v-u.top-u.bottom,k=m-u.left-u.right,C=pa(v-u[b],w),_=pa(m-u[x],k),O=!t.middlewareData.shift;let T=C,j=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(j=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=w),O&&!p){const D=Cr(u.left,0),V=Cr(u.right,0),W=Cr(u.top,0),J=Cr(u.bottom,0);h?j=m-2*(D!==0||V!==0?D+V:Cr(u.left,u.right)):T=v-2*(W!==0||J!==0?W+J:Cr(u.top,u.bottom))}await l({...t,availableWidth:j,availableHeight:T});const A=await s.getDimensions(a.floating);return m!==A.width||v!==A.height?{reset:{rects:!0}}:{}}}};function Sv(){return typeof window<"u"}function ku(e){return uj(e)?(e.nodeName||"").toLowerCase():"#document"}function jr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vi(e){var t;return(t=(uj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uj(e){return Sv()?e instanceof Node||e instanceof jr(e).Node:!1}function zo(e){return Sv()?e instanceof Element||e instanceof jr(e).Element:!1}function ci(e){return Sv()?e instanceof HTMLElement||e instanceof jr(e).HTMLElement:!1}function MC(e){return!Sv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jr(e).ShadowRoot}function Mp(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Bo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function AU(e){return["table","td","th"].includes(ku(e))}function kv(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function B1(e){const t=$1(),n=zo(e)?Bo(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function IU(e){let t=ma(e);for(;ci(t)&&!tu(t);){if(B1(t))return t;if(kv(t))return null;t=ma(t)}return null}function $1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function tu(e){return["html","body","#document"].includes(ku(e))}function Bo(e){return jr(e).getComputedStyle(e)}function Ev(e){return zo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ma(e){if(ku(e)==="html")return e;const t=e.assignedSlot||e.parentNode||MC(e)&&e.host||vi(e);return MC(t)?t.host:t}function dj(e){const t=ma(e);return tu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ci(t)&&Mp(t)?t:dj(t)}function Lf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=dj(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=jr(o);if(i){const a=nb(s);return t.concat(s,s.visualViewport||[],Mp(o)?o:[],a&&n?Lf(a):[])}return t.concat(o,Lf(o,[],n))}function nb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fj(e){const t=Bo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ci(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=rg(n)!==i||rg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function V1(e){return zo(e)?e:e.contextElement}function Mc(e){const t=V1(e);if(!ci(t))return ii(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fj(t);let s=(i?rg(n.width):n.width)/r,a=(i?rg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const DU=ii(0);function pj(e){const t=jr(e);return!$1()||!t.visualViewport?DU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function LU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jr(e)?!1:t}function wl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=V1(e);let s=ii(1);t&&(r?zo(r)&&(s=Mc(r)):s=Mc(e));const a=LU(i,n,r)?pj(i):ii(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const p=jr(i),h=r&&zo(r)?jr(r):r;let m=p,v=nb(m);for(;v&&r&&h!==m;){const b=Mc(v),x=v.getBoundingClientRect(),w=Bo(v),k=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,C=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,d*=b.y,l+=k,c+=C,m=jr(v),v=nb(m)}}return ig({width:u,height:d,x:l,y:c})}function U1(e,t){const n=Ev(e).scrollLeft;return t?t.left+n:wl(vi(e)).left+n}function hj(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:U1(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function FU(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=vi(r),a=t?kv(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ii(1);const u=ii(0),d=ci(r);if((d||!d&&!i)&&((ku(r)!=="body"||Mp(s))&&(l=Ev(r)),ci(r))){const h=wl(r);c=Mc(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const p=s&&!d&&!i?hj(s,l,!0):ii(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function zU(e){return Array.from(e.getClientRects())}function BU(e){const t=vi(e),n=Ev(e),r=e.ownerDocument.body,o=Cr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Cr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+U1(e);const a=-n.scrollTop;return Bo(r).direction==="rtl"&&(s+=Cr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function $U(e,t){const n=jr(e),r=vi(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=$1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function VU(e,t){const n=wl(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ci(e)?Mc(e):ii(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function PC(e,t,n){let r;if(t==="viewport")r=$U(e,n);else if(t==="document")r=BU(vi(e));else if(zo(t))r=VU(t,n);else{const o=pj(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ig(r)}function mj(e,t){const n=ma(e);return n===t||!zo(n)||tu(n)?!1:Bo(n).position==="fixed"||mj(n,t)}function UU(e,t){const n=t.get(e);if(n)return n;let r=Lf(e,[],!1).filter(a=>zo(a)&&ku(a)!=="body"),o=null;const i=Bo(e).position==="fixed";let s=i?ma(e):e;for(;zo(s)&&!tu(s);){const a=Bo(s),l=B1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Mp(s)&&!l&&mj(e,s))?r=r.filter(u=>u!==s):o=a,s=ma(s)}return t.set(e,r),r}function HU(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?kv(t)?[]:UU(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=PC(t,u,o);return c.top=Cr(d.top,c.top),c.right=pa(d.right,c.right),c.bottom=pa(d.bottom,c.bottom),c.left=Cr(d.left,c.left),c},PC(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function WU(e){const{width:t,height:n}=fj(e);return{width:t,height:n}}function KU(e,t,n){const r=ci(t),o=vi(t),i=n==="fixed",s=wl(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ii(0);if(r||!r&&!i)if((ku(t)!=="body"||Mp(o))&&(a=Ev(t)),r){const p=wl(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else o&&(l.x=U1(o));const c=o&&!r&&!i?hj(o,a):ii(0),u=s.left+a.scrollLeft-l.x-c.x,d=s.top+a.scrollTop-l.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function d0(e){return Bo(e).position==="static"}function jC(e,t){if(!ci(e)||Bo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return vi(e)===n&&(n=n.ownerDocument.body),n}function gj(e,t){const n=jr(e);if(kv(e))return n;if(!ci(e)){let o=ma(e);for(;o&&!tu(o);){if(zo(o)&&!d0(o))return o;o=ma(o)}return n}let r=jC(e,t);for(;r&&AU(r)&&d0(r);)r=jC(r,t);return r&&tu(r)&&d0(r)&&!B1(r)?n:r||IU(e)||n}const qU=async function(e){const t=this.getOffsetParent||gj,n=this.getDimensions,r=await n(e.floating);return{reference:KU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function GU(e){return Bo(e).direction==="rtl"}const YU={convertOffsetParentRelativeRectToViewportRelativeRect:FU,getDocumentElement:vi,getClippingRect:HU,getOffsetParent:gj,getElementRects:qU,getClientRects:zU,getDimensions:WU,getScale:Mc,isElement:zo,isRTL:GU};function JU(e,t){let n=null,r;const o=vi(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(a||t(),!d||!p)return;const h=Sh(u),m=Sh(o.clientWidth-(c+d)),v=Sh(o.clientHeight-(u+p)),b=Sh(c),w={rootMargin:-h+"px "+-m+"px "+-v+"px "+-b+"px",threshold:Cr(0,pa(1,l))||1};let k=!0;function C(_){const O=_[0].intersectionRatio;if(O!==l){if(!k)return s();O?s(!1,O):r=setTimeout(()=>{s(!1,1e-7)},1e3)}k=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return s(!0),i}function XU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=V1(e),u=o||i?[...c?Lf(c):[],...Lf(t)]:[];u.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const d=c&&a?JU(c,n):null;let p=-1,h=null;s&&(h=new ResizeObserver(x=>{let[w]=x;w&&w.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let m,v=l?wl(e):null;l&&b();function b(){const x=wl(e);v&&(x.x!==v.x||x.y!==v.y||x.width!==v.width||x.height!==v.height)&&n(),v=x,m=requestAnimationFrame(b)}return n(),()=>{var x;u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(x=h)==null||x.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const ZU=MU,QU=PU,eH=NU,tH=RU,nH=TU,RC=_U,rH=jU,oH=(e,t,n)=>{const r=new Map,o={platform:YU,...n},i={...o.platform,_c:r};return CU(e,t,{...o,platform:i})};var Jh=typeof document<"u"?g.useLayoutEffect:g.useEffect;function sg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!sg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!sg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function vj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function AC(e,t){const n=vj(e);return Math.round(t*n)/n}function f0(e){const t=g.useRef(e);return Jh(()=>{t.current=e}),t}function iH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=g.useState(r);sg(p,r)||h(r);const[m,v]=g.useState(null),[b,x]=g.useState(null),w=g.useCallback(M=>{M!==O.current&&(O.current=M,v(M))},[]),k=g.useCallback(M=>{M!==T.current&&(T.current=M,x(M))},[]),C=i||m,_=s||b,O=g.useRef(null),T=g.useRef(null),j=g.useRef(u),A=l!=null,D=f0(l),V=f0(o),W=f0(c),J=g.useCallback(()=>{if(!O.current||!T.current)return;const M={placement:t,strategy:n,middleware:p};V.current&&(M.platform=V.current),oH(O.current,T.current,M).then(F=>{const L={...F,isPositioned:W.current!==!1};X.current&&!sg(j.current,L)&&(j.current=L,Or.flushSync(()=>{d(L)}))})},[p,t,n,V,W]);Jh(()=>{c===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,d(M=>({...M,isPositioned:!1})))},[c]);const X=g.useRef(!1);Jh(()=>(X.current=!0,()=>{X.current=!1}),[]),Jh(()=>{if(C&&(O.current=C),_&&(T.current=_),C&&_){if(D.current)return D.current(C,_,J);J()}},[C,_,J,D,A]);const U=g.useMemo(()=>({reference:O,floating:T,setReference:w,setFloating:k}),[w,k]),I=g.useMemo(()=>({reference:C,floating:_}),[C,_]),R=g.useMemo(()=>{const M={position:n,left:0,top:0};if(!I.floating)return M;const F=AC(I.floating,u.x),L=AC(I.floating,u.y);return a?{...M,transform:"translate("+F+"px, "+L+"px)",...vj(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:L}},[n,a,I.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:J,refs:U,elements:I,floatingStyles:R}),[u,J,U,I,R])}const sH=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?RC({element:r.current,padding:o}).fn(n):{}:r?RC({element:r,padding:o}).fn(n):{}}}},aH=(e,t)=>({...ZU(e),options:[e,t]}),lH=(e,t)=>({...QU(e),options:[e,t]}),cH=(e,t)=>({...rH(e),options:[e,t]}),uH=(e,t)=>({...eH(e),options:[e,t]}),dH=(e,t)=>({...tH(e),options:[e,t]}),fH=(e,t)=>({...nH(e),options:[e,t]}),pH=(e,t)=>({...sH(e),options:[e,t]});var hH="Arrow",yj=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return f.jsx(Pe.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});yj.displayName=hH;var mH=yj;function gH(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:p,children:h,...m}=d,v=(p==null?void 0:p[e][l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:h})}function u(d,p){const h=(p==null?void 0:p[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,vH(o,...t)]}function vH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function H1(e){const[t,n]=g.useState(void 0);return En(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var W1="Popper",[xj,Ta]=gH(W1),[yH,bj]=xj(W1),wj=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return f.jsx(yH,{scope:t,anchor:r,onAnchorChange:o,children:n})};wj.displayName=W1;var Sj="PopperAnchor",kj=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=bj(Sj,n),s=g.useRef(null),a=Ue(t,s);return g.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.jsx(Pe.div,{...o,ref:a})});kj.displayName=Sj;var K1="PopperContent",[xH,bH]=xj(K1),Ej=g.forwardRef((e,t)=>{var $,Y,ne,te,we,ce;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:m,...v}=e,b=bj(K1,n),[x,w]=g.useState(null),k=Ue(t,ze=>w(ze)),[C,_]=g.useState(null),O=H1(C),T=(O==null?void 0:O.width)??0,j=(O==null?void 0:O.height)??0,A=r+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},V=Array.isArray(c)?c:[c],W=V.length>0,J={padding:D,boundary:V.filter(SH),altBoundary:W},{refs:X,floatingStyles:U,placement:I,isPositioned:R,middlewareData:M}=iH({strategy:"fixed",placement:A,whileElementsMounted:(...ze)=>XU(...ze,{animationFrame:h==="always"}),elements:{reference:b.anchor},middleware:[aH({mainAxis:o+j,alignmentAxis:s}),l&&lH({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cH():void 0,...J}),l&&uH({...J}),dH({...J,apply:({elements:ze,rects:je,availableWidth:mt,availableHeight:N})=>{const{width:S,height:E}=je.reference,P=ze.floating.style;P.setProperty("--radix-popper-available-width",`${mt}px`),P.setProperty("--radix-popper-available-height",`${N}px`),P.setProperty("--radix-popper-anchor-width",`${S}px`),P.setProperty("--radix-popper-anchor-height",`${E}px`)}}),C&&pH({element:C,padding:a}),kH({arrowWidth:T,arrowHeight:j}),p&&fH({strategy:"referenceHidden",...J})]}),[F,L]=Nj(I),B=Qt(m);En(()=>{R&&(B==null||B())},[R,B]);const K=($=M.arrow)==null?void 0:$.x,be=(Y=M.arrow)==null?void 0:Y.y,ae=((ne=M.arrow)==null?void 0:ne.centerOffset)!==0,[le,re]=g.useState();return En(()=>{x&&re(window.getComputedStyle(x).zIndex)},[x]),f.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:R?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(te=M.transformOrigin)==null?void 0:te.x,(we=M.transformOrigin)==null?void 0:we.y].join(" "),...((ce=M.hide)==null?void 0:ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(xH,{scope:n,placedSide:F,onArrowChange:_,arrowX:K,arrowY:be,shouldHideArrow:ae,children:f.jsx(Pe.div,{"data-side":F,"data-align":L,...v,ref:k,style:{...v.style,animation:R?void 0:"none"}})})})});Ej.displayName=K1;var Cj="PopperArrow",wH={top:"bottom",right:"left",bottom:"top",left:"right"},_j=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=bH(Cj,r),s=wH[i.placedSide];return f.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:f.jsx(mH,{...o,ref:n,style:{...o.style,display:"block"}})})});_j.displayName=Cj;function SH(e){return e!==null}var kH=e=>({name:"transformOrigin",options:e,fn(t){var b,x,w;const{placement:n,rects:r,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Nj(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,h=(((w=o.arrow)==null?void 0:w.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=s?d:`${p}px`,v=`${-l}px`):c==="top"?(m=s?d:`${p}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=s?d:`${h}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=s?d:`${h}px`),{data:{x:m,y:v}}}});function Nj(e){const[t,n="center"]=e.split("-");return[t,n]}var Cv=wj,Pp=kj,_v=Ej,Nv=_j,EH="Portal",jp=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=g.useState(!1);En(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?S5.createPortal(f.jsx(Pe.div,{...r,ref:t}),s):null});jp.displayName=EH;function ro({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=CH({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Qt(n),l=g.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function CH({defaultProp:e,onChange:t}){const n=g.useState(e),[r]=n,o=g.useRef(r),i=Qt(t);return g.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var _H=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ul=new WeakMap,kh=new WeakMap,Eh={},p0=0,Tj=function(e){return e&&(e.host||Tj(e.parentNode))},NH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Tj(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},TH=function(e,t,n,r){var o=NH(t,Array.isArray(e)?e:[e]);Eh[n]||(Eh[n]=new WeakMap);var i=Eh[n],s=[],a=new Set,l=new Set(o),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(p){if(a.has(p))u(p);else try{var h=p.getAttribute(r),m=h!==null&&h!=="false",v=(Ul.get(p)||0)+1,b=(i.get(p)||0)+1;Ul.set(p,v),i.set(p,b),s.push(p),v===1&&m&&kh.set(p,!0),b===1&&p.setAttribute(n,"true"),m||p.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",p,x)}})};return u(t),a.clear(),p0++,function(){s.forEach(function(d){var p=Ul.get(d)-1,h=i.get(d)-1;Ul.set(d,p),i.set(d,h),p||(kh.has(d)||d.removeAttribute(r),kh.delete(d)),h||d.removeAttribute(n)}),p0--,p0||(Ul=new WeakMap,Ul=new WeakMap,kh=new WeakMap,Eh={})}},Tv=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=_H(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),TH(r,o,n,"aria-hidden")):function(){return null}},ei=function(){return ei=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ei.apply(this,arguments)};function Oj(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function OH(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Xh="right-scroll-bar-position",Zh="width-before-scroll-bar",MH="with-scroll-bars-hidden",PH="--removed-body-scroll-bar-size";function h0(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function jH(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var RH=typeof window<"u"?g.useLayoutEffect:g.useEffect,IC=new WeakMap;function AH(e,t){var n=jH(null,function(r){return e.forEach(function(o){return h0(o,r)})});return RH(function(){var r=IC.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||h0(a,null)}),i.forEach(function(a){o.has(a)||h0(a,s)})}IC.set(n,e)},[e]),n}function IH(e){return e}function DH(e,t){t===void 0&&(t=IH);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var l=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function LH(e){e===void 0&&(e={});var t=DH(null);return t.options=ei({async:!0,ssr:!1},e),t}var Mj=function(e){var t=e.sideCar,n=Oj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,ei({},n))};Mj.isSideCarExport=!0;function FH(e,t){return e.useMedium(t),Mj}var Pj=LH(),m0=function(){},Ov=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:m0,onWheelCapture:m0,onTouchMoveCapture:m0}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,h=e.noIsolation,m=e.inert,v=e.allowPinchZoom,b=e.as,x=b===void 0?"div":b,w=e.gapMode,k=Oj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,_=AH([n,t]),O=ei(ei({},k),o);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Pj,removeScrollBar:c,shards:d,noIsolation:h,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),s?g.cloneElement(g.Children.only(a),ei(ei({},O),{ref:_})):g.createElement(x,ei({},O,{className:l,ref:_}),a))});Ov.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ov.classNames={fullWidth:Zh,zeroRight:Xh};var zH=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function BH(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=zH();return t&&e.setAttribute("nonce",t),e}function $H(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function VH(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var UH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=BH())&&($H(t,n),VH(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},HH=function(){var e=UH();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jj=function(){var e=HH(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},WH={left:0,top:0,right:0,gap:0},g0=function(e){return parseInt(e||"",10)||0},KH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[g0(n),g0(r),g0(o)]},qH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return WH;var t=KH(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},GH=jj(),Pc="data-scroll-locked",YH=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
313
- .`.concat(MH,` {
314
- overflow: hidden `).concat(r,`;
315
- padding-right: `).concat(a,"px ").concat(r,`;
316
- }
317
- body[`).concat(Pc,`] {
318
- overflow: hidden `).concat(r,`;
319
- overscroll-behavior: contain;
320
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
321
- padding-left: `.concat(o,`px;
322
- padding-top: `).concat(i,`px;
323
- padding-right: `).concat(s,`px;
324
- margin-left:0;
325
- margin-top:0;
326
- margin-right: `).concat(a,"px ").concat(r,`;
327
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
328
- }
329
-
330
- .`).concat(Xh,` {
331
- right: `).concat(a,"px ").concat(r,`;
332
- }
333
-
334
- .`).concat(Zh,` {
335
- margin-right: `).concat(a,"px ").concat(r,`;
336
- }
337
-
338
- .`).concat(Xh," .").concat(Xh,` {
339
- right: 0 `).concat(r,`;
340
- }
341
-
342
- .`).concat(Zh," .").concat(Zh,` {
343
- margin-right: 0 `).concat(r,`;
344
- }
345
-
346
- body[`).concat(Pc,`] {
347
- `).concat(PH,": ").concat(a,`px;
348
- }
349
- `)},DC=function(){var e=parseInt(document.body.getAttribute(Pc)||"0",10);return isFinite(e)?e:0},JH=function(){g.useEffect(function(){return document.body.setAttribute(Pc,(DC()+1).toString()),function(){var e=DC()-1;e<=0?document.body.removeAttribute(Pc):document.body.setAttribute(Pc,e.toString())}},[])},XH=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;JH();var i=g.useMemo(function(){return qH(o)},[o]);return g.createElement(GH,{styles:YH(i,!t,o,n?"":"!important")})},rb=!1;if(typeof window<"u")try{var Ch=Object.defineProperty({},"passive",{get:function(){return rb=!0,!0}});window.addEventListener("test",Ch,Ch),window.removeEventListener("test",Ch,Ch)}catch{rb=!1}var Hl=rb?{passive:!1}:!1,ZH=function(e){return e.tagName==="TEXTAREA"},Rj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ZH(e)&&n[t]==="visible")},QH=function(e){return Rj(e,"overflowY")},eW=function(e){return Rj(e,"overflowX")},LC=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Aj(e,r);if(o){var i=Ij(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},nW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Aj=function(e,t){return e==="v"?QH(t):eW(t)},Ij=function(e,t){return e==="v"?tW(t):nW(t)},rW=function(e,t){return e==="h"&&t==="rtl"?-1:1},oW=function(e,t,n,r,o){var i=rW(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,d=0,p=0;do{var h=Ij(e,a),m=h[0],v=h[1],b=h[2],x=v-b-i*m;(m||x)&&Aj(e,a)&&(d+=x,p+=m),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(d)<1||!o)||!u&&(Math.abs(p)<1||!o))&&(c=!0),c},_h=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},FC=function(e){return[e.deltaX,e.deltaY]},zC=function(e){return e&&"current"in e?e.current:e},iW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sW=function(e){return`
350
- .block-interactivity-`.concat(e,` {pointer-events: none;}
351
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
352
- `)},aW=0,Wl=[];function lW(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(aW++)[0],i=g.useState(jj)[0],s=g.useRef(e);g.useEffect(function(){s.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=OH([e.lockRef.current],(e.shards||[]).map(zC),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var x=_h(v),w=n.current,k="deltaX"in v?v.deltaX:w[0]-x[0],C="deltaY"in v?v.deltaY:w[1]-x[1],_,O=v.target,T=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in v&&T==="h"&&O.type==="range")return!1;var j=LC(T,O);if(!j)return!0;if(j?_=T:(_=T==="v"?"h":"v",j=LC(T,O)),!j)return!1;if(!r.current&&"changedTouches"in v&&(k||C)&&(r.current=_),!_)return!0;var A=r.current||_;return oW(A,b,v,A==="h"?k:C,!0)},[]),l=g.useCallback(function(v){var b=v;if(!(!Wl.length||Wl[Wl.length-1]!==i)){var x="deltaY"in b?FC(b):_h(b),w=t.current.filter(function(_){return _.name===b.type&&(_.target===b.target||b.target===_.shadowParent)&&iW(_.delta,x)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var k=(s.current.shards||[]).map(zC).filter(Boolean).filter(function(_){return _.contains(b.target)}),C=k.length>0?a(b,k[0]):!s.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),c=g.useCallback(function(v,b,x,w){var k={name:v,delta:b,target:x,should:w,shadowParent:cW(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),u=g.useCallback(function(v){n.current=_h(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,FC(v),v.target,a(v,e.lockRef.current))},[]),p=g.useCallback(function(v){c(v.type,_h(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return Wl.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Hl),document.addEventListener("touchmove",l,Hl),document.addEventListener("touchstart",u,Hl),function(){Wl=Wl.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,Hl),document.removeEventListener("touchmove",l,Hl),document.removeEventListener("touchstart",u,Hl)}},[]);var h=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:sW(o)}):null,h?g.createElement(XH,{gapMode:e.gapMode}):null)}function cW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const uW=FH(Pj,lW);var Rp=g.forwardRef(function(e,t){return g.createElement(Ov,ei({},e,{ref:t,sideCar:uW}))});Rp.classNames=Ov.classNames;var q1="Popover",[Dj,Rpe]=Wo(q1,[Ta]),Ap=Ta(),[dW,Oa]=Dj(q1),Lj=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=Ap(t),l=g.useRef(null),[c,u]=g.useState(!1),[d=!1,p]=ro({prop:r,defaultProp:o,onChange:i});return f.jsx(Cv,{...a,children:f.jsx(dW,{scope:t,contentId:Zr(),triggerRef:l,open:d,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(h=>!h),[p]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};Lj.displayName=q1;var Fj="PopoverAnchor",fW=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Oa(Fj,n),i=Ap(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),f.jsx(Pp,{...i,...r,ref:t})});fW.displayName=Fj;var zj="PopoverTrigger",Ff=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Oa(zj,n),i=Ap(n),s=Ue(t,o.triggerRef),a=f.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Hj(o.open),...r,ref:s,onClick:se(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:f.jsx(Pp,{asChild:!0,...i,children:a})});Ff.displayName=zj;var G1="PopoverPortal",[pW,hW]=Dj(G1,{forceMount:void 0}),Bj=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Oa(G1,t);return f.jsx(pW,{scope:t,forceMount:n,children:f.jsx(On,{present:n||i.open,children:f.jsx(jp,{asChild:!0,container:o,children:r})})})};Bj.displayName=G1;var nu="PopoverContent",$j=g.forwardRef((e,t)=>{const n=hW(nu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Oa(nu,e.__scopePopover);return f.jsx(On,{present:r||i.open,children:i.modal?f.jsx(mW,{...o,ref:t}):f.jsx(gW,{...o,ref:t})})});$j.displayName=nu;var mW=g.forwardRef((e,t)=>{const n=Oa(nu,e.__scopePopover),r=g.useRef(null),o=Ue(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return Tv(s)},[]),f.jsx(Rp,{as:Gi,allowPinchZoom:!0,children:f.jsx(Vj,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:se(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:se(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:se(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),gW=g.forwardRef((e,t)=>{const n=Oa(nu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return f.jsx(Vj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Vj=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,p=Oa(nu,n),h=Ap(n);return wv(),f.jsx(Op,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx(wu,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:f.jsx(_v,{"data-state":Hj(p.open),role:"dialog",id:p.contentId,...h,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Uj="PopoverClose",Y1=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Oa(Uj,n);return f.jsx(Pe.button,{type:"button",...r,ref:t,onClick:se(e.onClick,()=>o.onOpenChange(!1))})});Y1.displayName=Uj;var vW="PopoverArrow",yW=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ap(n);return f.jsx(Nv,{...o,...r,ref:t})});yW.displayName=vW;function Hj(e){return e?"open":"closed"}var xW=Lj,bW=Ff,wW=Bj,Wj=$j;const ga=xW,Ip=bW,Xi=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>f.jsx(wW,{container:r.container,children:f.jsx(Wj,{ref:o,align:t,sideOffset:n,className:Ke("z-50 w-72 rounded-md border bg-bg-secondary_alt p-4 text-text-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));Xi.displayName=Wj.displayName;function J1(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var X1="Switch",[SW,Ape]=Wo(X1),[kW,EW]=SW(X1),Kj=g.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[p,h]=g.useState(null),m=Ue(t,k=>h(k)),v=g.useRef(!1),b=p?u||!!p.closest("form"):!0,[x=!1,w]=ro({prop:o,defaultProp:i,onChange:c});return f.jsxs(kW,{scope:n,checked:x,disabled:a,children:[f.jsx(Pe.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":Yj(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onClick:se(e.onClick,k=>{w(C=>!C),b&&(v.current=k.isPropagationStopped(),v.current||k.stopPropagation())})}),b&&f.jsx(CW,{control:p,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});Kj.displayName=X1;var qj="SwitchThumb",Gj=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=EW(qj,n);return f.jsx(Pe.span,{"data-state":Yj(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});Gj.displayName=qj;var CW=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=g.useRef(null),s=J1(n),a=H1(t);return g.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&d){const p=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(p)}},[s,n,r]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Yj(e){return e?"checked":"unchecked"}var Jj=Kj,_W=Gj;const Z1=g.forwardRef(({className:e,...t},n)=>f.jsx(Jj,{className:Ke("peer inline-flex h-[22px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:bg-bg-quartenary disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-bg-brand-secondary data-[state=unchecked]:bg-bg-secondary-solid",e),...t,ref:n,children:f.jsx(_W,{className:Ke("pointer-events-none block h-[18px] w-5 rounded-full bg-bg-primary-solid shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Z1.displayName=Jj.displayName;const Xj=1280;function NW(){const e=Ep(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function u(){let d=!1;const p=async h=>{if(!d)try{(await fetch(h)).ok&&(d=!0,n(h))}catch{}};await p("/favicon.ico"),await p("/favicon.svg"),await p("/favicon.png"),await p("/apple-touch-icon.png"),await p("https://valbuild.com/favicon.ico")}if(u(),e!=null&&e.project)o(e.project);else try{let d=new URL(location.origin).hostname;if(d!=="localhost"){const p=d.split(".");p.length>=2&&(d=p.slice(1,-1).join(".")),o(vv(d))}else o("Dev mode")}catch{o("Studio")}},[e]);const i=mv(),s=so(),{theme:a,setTheme:l}=hv(),{navMenu:c}=yy();return f.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[f.jsxs("div",{className:"flex items-center justify-between h-16 gap-4 p-4 pr-6 border-b border-border-primary",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[t?f.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):f.jsx("div",{className:"w-4 h-4"}),f.jsx("span",{className:"truncate",children:r})]}),f.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:f.jsx(eg,{size:16,className:Ne("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&f.jsx("div",{className:Ne("py-4 pl-2",{}),children:f.jsx(Ya,{children:f.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)]",children:f.jsx(OW,{})})})}),f.jsx("div",{className:"h-6 p-4"}),f.jsxs("div",{className:"absolute bottom-0 left-0 flex items-center justify-between w-full p-4 pr-6 border-t border-border-primary",children:[f.jsx("span",{}),f.jsxs(ga,{children:[f.jsx(Ff,{children:f.jsx(PP,{size:16})}),f.jsx(Xi,{container:s,children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{children:"Dark mode"}),f.jsx(Z1,{checked:a!=="light",onClick:u=>{u.stopPropagation()},onCheckedChange:u=>{l(u?"dark":"light")}})]})})]})]})]})}function TW(){const e=mv();return g.useMemo(()=>{if(e.status==="success"){const t=Object.keys(e.data);return{status:e.status,data:JV(t)}}return e},[e])}function OW({title:e}){const t=TW();if(t.status==="error")return console.error(t.error),null;if(t.status!=="success")return f.jsx(MW,{});const n=t.data;return f.jsxs("div",{className:"pl-0 pr-4",children:[e&&f.jsx("div",{className:"py-2",children:e}),f.jsx("div",{children:n.children.sort(Zj).map((r,o)=>g.createElement(Qj,{...r,name:r.name,key:o}))})]})}function MW(){return null}function Zj(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function Qj({name:e,fullPath:t,isDirectory:n,children:r}){const{navigate:o,currentSourcePath:i}=hr(),{navMenu:s}=yy(),[a,l]=g.useState(!0),{validationErrors:c}=mi(),u=g.useMemo(()=>{let p=!1;for(const h in c)if(h.startsWith(t)){p=!0;break}return p},[c,t]),d=g.useMemo(()=>{if(n){if(!a)return u}else if(!n)return u;return!1},[u,a,n]);return f.jsxs("div",{className:"w-full text-sm",children:[f.jsxs("button",{className:Ne("relative flex justify-between w-full p-2",{underline:i.startsWith(t)}),onClick:()=>{n?l(!a):(window.innerWidth<Xj&&s.setOpen(!1),o(t))},children:[f.jsxs("div",{className:"flex items-center pr-2",children:[n?f.jsx(WV,{}):f.jsx(RP,{className:"pr-2"}),f.jsx("span",{children:fa(e)}),d&&f.jsx("div",{className:"w-2 h-2 ml-2 rounded-full bg-bg-error-primary"})]}),f.jsx(gv,{size:16,className:Ne("transform",{"rotate-90":a,hidden:!r.length})})]}),f.jsx("div",{className:"pl-2",children:f.jsx(If,{isOpen:a,children:r.sort(Zj).map((p,h)=>g.createElement(Qj,{...p,key:h}))})})]})}var Q1="Checkbox",[PW,Ipe]=Wo(Q1),[jW,RW]=PW(Q1),eR=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[p,h]=g.useState(null),m=Ue(t,C=>h(C)),v=g.useRef(!1),b=p?u||!!p.closest("form"):!0,[x=!1,w]=ro({prop:o,defaultProp:i,onChange:c}),k=g.useRef(x);return g.useEffect(()=>{const C=p==null?void 0:p.form;if(C){const _=()=>w(k.current);return C.addEventListener("reset",_),()=>C.removeEventListener("reset",_)}},[p,w]),f.jsxs(jW,{scope:n,state:x,disabled:a,children:[f.jsx(Pe.button,{type:"button",role:"checkbox","aria-checked":Zs(x)?"mixed":x,"aria-required":s,"data-state":rR(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onKeyDown:se(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:se(e.onClick,C=>{w(_=>Zs(_)?!0:!_),b&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),b&&f.jsx(AW,{control:p,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:Zs(i)?!1:i})]})});eR.displayName=Q1;var tR="CheckboxIndicator",nR=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=RW(tR,n);return f.jsx(On,{present:r||Zs(i.state)||i.state===!0,children:f.jsx(Pe.span,{"data-state":rR(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});nR.displayName=tR;var AW=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=J1(n),l=H1(t);g.useEffect(()=>{const u=s.current,d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&h){const m=new Event("click",{bubbles:r});u.indeterminate=Zs(n),h.call(u,Zs(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(Zs(n)?!1:n);return f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Zs(e){return e==="indeterminate"}function rR(e){return Zs(e)?"indeterminate":e?"checked":"unchecked"}var oR=eR,IW=nR;const Dp=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),f.jsx(oR,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:Ke("peer h-4 w-4 shrink-0 rounded-sm bg-bg-primary border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:f.jsxs(IW,{className:Ke("flex items-center justify-center text-current"),children:[r===!0&&f.jsx(_p,{size:12}),r==="indeterminate"&&f.jsx(IV,{size:12})]})})});Dp.displayName=oR.displayName;function tc(e,t){if(!t||t.length===0)return new Set([e.type]);const n=new Set;let r=e,o=-1;for(const i of t){if(o++,!r)break;if(r.type==="array")r=r.item;else if(r.type==="record")r=r.item;else if(r.type==="object")r=r.items[i];else if(r.type==="union")if(typeof r.key=="string"){const s=r.items;for(const a of s){const l=tc(a,t.slice(o));for(const c of Array.from(l.values()))n.add(c)}return n}else{if(o!==t.length-1)throw new Error("Found string union (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else if(r.type==="boolean"||r.type==="number"||r.type==="string"||r.type==="date"||r.type==="file"||r.type==="image"||r.type==="keyOf"||r.type==="literal"||r.type==="richtext"){if((r.type==="image"||r.type==="file")&&t[o]==="metadata")break;if(o!==t.length-1)throw new Error("Found "+r.type+" (primitive), but path has more parts: "+t.join("/")+" at "+i);break}else{const a=r.type;return console.error(`Unexecpted resolved schema type: ${a} in ${t.join("/")} at ${i}`),new Set([a])}}return r&&(n.add(r.type),r.type==="union"&&(typeof r.key=="string"?n.add("object"):n.add("string"))),n}class Nh{constructor(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}reset(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}insertPath(t,n,r,o,i,s,a,l){let c=n.length>0?`${t}?${n.join("/")}`:t;const u=[];for(let d=this.orderedInsertKeys.length-1;d>=0;d--){const p=this.orderedInsertKeys[d];c!==p?c.startsWith(p)?(c=p,this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c)):p.startsWith(c)&&u.push(d):(this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c))}for(const d of u){const p=this.orderedInsertKeys[d];this.orderedInsertKeys.splice(d,1);const h=this.patchSetMetadata[p];if(this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:Array.from(a),lastUpdated:o,lastUpdatedBy:i}),h)for(const m of h.patches.slice())this.patchSetMetadata[c].patches.unshift(m),m.author!==null&&this.patchSetMetadata[c].authors.unshift(m.author),this.patchSetMetadata[c].opTypes.unshift(m.opType);else throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${p}`);p!==c&&delete this.patchSetMetadata[p]}this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:a,lastUpdated:o,lastUpdatedBy:i}),i!==null&&!this.patchSetMetadata[c].authors.includes(i)&&this.patchSetMetadata[c].authors.unshift(i),this.patchSetMetadata[c].lastUpdatedBy=i,this.patchSetMetadata[c].lastUpdated=o,this.patchSetMetadata[c].opTypes.includes(s)||this.patchSetMetadata[c].opTypes.unshift(s),this.patchSetMetadata[c].patches.unshift({patchPath:l,patchId:r,author:i,createdAt:o,opType:s,schemaTypes:a}),this.orderedInsertKeys.includes(c)||this.orderedInsertKeys.unshift(c)}insert(t,n,r,o,i,s){if(!this.insertedPatches.has(o)){if(!n){this.insertPath(t,[],o,i,s,r.op,[],r.path);return}if(this.insertedPatches.add(o),!(r.op==="file"||r.op==="test"))try{if(r.op==="replace"){const a=tc(n,r.path);this.insertPath(t,r.path,o,i,s,r.op,Array.from(a),r.path)}else if(r.op==="add"||r.op==="remove"||r.op==="move"||r.op==="copy"){const a=r.path.slice(0,-1),l=tc(n,a);if(l.size===1&&l.has("array")){if(this.insertPath(t,a,o,i,s,r.op,Array.from(l),r.path),r.op==="move"){const c=r.from.slice(0,-1),u=tc(n,c);this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path)}}else if(l.size===1&&l.has("record")){const c=r.path,u=tc(n,c);if(this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path),r.op==="move"){const d=r.from,p=tc(n,d);this.insertPath(t,d,o,i,s,r.op,Array.from(p),r.path)}}else{if(l.size===1&&!(l.has("image")||l.has("file")))throw new Error(`Cannot perform op: '${r.op}' on non-array or non-record schema. Type: ${l.values().next().value}`);this.insertPath(t,a,o,i,s,r.op,[n.type],r.path)}}else{const a=r;throw new Error("Unreachable op: "+a)}}catch(a){a instanceof Error?console.error("Could not resolve path while creating patch set",a.message):console.error("Could not resolve path while creating patch set",a),this.insertPath(t,[],o,i,s,r.op,[n.type],r.path)}}}isInserted(t){return this.insertedPatches.has(t)}serialize(){return this.orderedInsertKeys.map(t=>{if(t in this.patchSetMetadata)return this.patchSetMetadata[t];throw new Error(`Could not find patch set metadata or patch metadata for (inserted) patch set path: ${t}`)})}}function ob(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),i=Math.floor(o/60),s=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":i<60?`${i}m ago`:s<24?`${s}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}const BC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$C=QP,DW=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return $C(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],d=i==null?void 0:i[c];if(u===null)return null;const p=BC(u)||BC(d);return o[c][p]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,p]=u;return p===void 0||(c[d]=p),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:p,...h}=u;return Object.entries(h).every(m=>{let[v,b]=m;return Array.isArray(b)?b.includes({...i,...a}[v]):{...i,...a}[v]===b})?[...c,d,p]:c},[]);return $C(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},ib=DW("inline-flex items-center justify-center whitespace-nowrap rounded-md text-fg-primary text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:text-text-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-bg-brand-primary text-fg-primary hover:bg-bg-secondary_hover/90 disabled:bg-bg-primary disabled:text-text-disabled disabled:border disabled:border-border-primary",destructive:"bg-bg-error text-text-error-pimary hover:bg-bg-error_hover/90",outline:"border border-input bg-bg-background hover:bg-bg-brand-solid_hover hover:text-secondary_hover",secondary:"bg-bg-secondary text-fg-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-bg-secondary_hover hover:text-fg-secondary",link:"text-fg-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),nn=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Gi:"button";return f.jsx(s,{className:Ke(ib({variant:t,size:n,className:e})),ref:i,...o})});nn.displayName="Button";var v0,eS="HoverCard",[iR,Dpe]=Wo(eS,[Ta]),Mv=Ta(),[LW,tS]=iR(eS),sR=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Mv(t),c=g.useRef(0),u=g.useRef(0),d=g.useRef(!1),p=g.useRef(!1),[h=!1,m]=ro({prop:r,defaultProp:o,onChange:i}),v=g.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>m(!0),s)},[s,m]),b=g.useCallback(()=>{clearTimeout(c.current),!d.current&&!p.current&&(u.current=window.setTimeout(()=>m(!1),a))},[a,m]),x=g.useCallback(()=>m(!1),[m]);return g.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),f.jsx(LW,{scope:t,open:h,onOpenChange:m,onOpen:v,onClose:b,onDismiss:x,hasSelectionRef:d,isPointerDownOnContentRef:p,children:f.jsx(Cv,{...l,children:n})})};sR.displayName=eS;var aR="HoverCardTrigger",nS=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=tS(aR,n),i=Mv(n);return f.jsx(Pp,{asChild:!0,...i,children:f.jsx(Pe.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:se(e.onPointerEnter,lg(o.onOpen)),onPointerLeave:se(e.onPointerLeave,lg(o.onClose)),onFocus:se(e.onFocus,o.onOpen),onBlur:se(e.onBlur,o.onClose),onTouchStart:se(e.onTouchStart,s=>s.preventDefault())})})});nS.displayName=aR;var FW="HoverCardPortal",[Lpe,zW]=iR(FW,{forceMount:void 0}),ag="HoverCardContent",rS=g.forwardRef((e,t)=>{const n=zW(ag,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=tS(ag,e.__scopeHoverCard);return f.jsx(On,{present:r||i.open,children:f.jsx(BW,{"data-state":i.open?"open":"closed",...o,onPointerEnter:se(e.onPointerEnter,lg(i.onOpen)),onPointerLeave:se(e.onPointerLeave,lg(i.onClose)),ref:t})})});rS.displayName=ag;var BW=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=tS(ag,n),c=Mv(n),u=g.useRef(null),d=Ue(t,u),[p,h]=g.useState(!1);return g.useEffect(()=>{if(p){const m=document.body;return v0=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=v0,m.style.webkitUserSelect=v0}}},[p]),g.useEffect(()=>{if(u.current){const m=()=>{h(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())==null?void 0:b.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",m),()=>{document.removeEventListener("pointerup",m),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),g.useEffect(()=>{u.current&&UW(u.current).forEach(v=>v.setAttribute("tabindex","-1"))}),f.jsx(wu,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:se(i,m=>{m.preventDefault()}),onDismiss:l.onDismiss,children:f.jsx(_v,{...c,...a,onPointerDown:se(a.onPointerDown,m=>{m.currentTarget.contains(m.target)&&h(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...a.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),$W="HoverCardArrow",VW=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Mv(n);return f.jsx(Nv,{...o,...r,ref:t})});VW.displayName=$W;function lg(e){return t=>t.pointerType==="touch"?void 0:e()}function UW(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var HW=sR,WW=nS,lR=rS;const il=HW,jc=WW,sl=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>f.jsx(lR,{ref:o,align:t,sideOffset:n,className:Ke("z-50 w-64 text-xs rounded-md border bg-bg-secondary p-4 text-text-secondary shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));sl.displayName=lR.displayName;function cR({className:e,loadingStatus:t}){const{getPatches:n}=kP(),r=mv(),o=pV(),i=O1(),{getCommitSummary:s}=dV(),[a,l]=g.useState({status:"not-asked"});g.useEffect(()=>{l({status:"not-asked"})},[JSON.stringify(i)]);const c=Cp(),u=g.useRef(null),d=g.useRef(null),p=g.useRef([]),h=EP(),{publishDisabled:m}=yu(),[v,b]=g.useState(null),[x,w]=g.useState({status:"not-asked"}),k=g.useRef(new Set);g.useEffect(()=>{async function A(){u.current!==o&&(d.current=new Nh,k.current=new Set),u.current=o??null,d.current||(d.current=new Nh,k.current=new Set);for(const X of Array.from(k.current))if(!i.includes(X)){d.current=new Nh,k.current=new Set,p.current=[];break}const D=[];for(const X of i)k.current.has(X)||D.push(X);for(const X of Array.from(k.current.values()))if(!i.includes(X)){d.current=new Nh;break}if(i.length>0&&D.length===0)return;if(r.status==="error"){b(r.error);return}if(!("data"in r))return;const V=d.current,W=r.data;p.current=D,b(null);const J=await n(i.length===D.length?[]:D);if(!(p.current.length!==D.length||p.current.some((X,U)=>X!==D[U])||u.current!==o))if(J.status==="ok"){const X=J.data;for(const[U,I]of Object.entries(X)){const R=U;if(I)for(const M of I.patch||[]){const F=I.path,L=W[F];k.current.add(R),V.insert(I.path,L,M,R,I.createdAt,I.authorId)}}w({status:"success",data:V.serialize()})}else b(J.error)}A().catch(D=>{b(D.message)})},[i,n,r,o]);const C=so(),{deployments:_,dismissDeployment:O}=uV(),[T,j]=g.useState(!1);return f.jsxs("div",{className:Ne("text-sm",e),children:[_.length>0&&f.jsxs("div",{className:"p-4 border-b border-border-primary",children:[f.jsx("div",{className:"flex flex-col gap-2",children:_.slice().sort((A,D)=>A.createdAt>D.createdAt?-1:1).slice(0,T?void 0:2).map(A=>f.jsx(KW,{deployment:A,onDismiss:()=>{O(A.deploymentId)}},A.deploymentId))}),_.length>2&&!T&&f.jsx("div",{className:"flex items-center justify-center mt-4",children:f.jsx("button",{className:"p-2 text-xs border rounded border-border-primary",onClick:()=>{j(!0)},children:"View all deployments"})})]}),h.size>0&&f.jsx("div",{className:"flex items-center gap-2 p-4 border-b border-border-primary",children:f.jsxs("span",{className:"font-bold",children:["Published ",h.size,h.size===1?" change":" changes","..."]})}),f.jsx("div",{className:"p-4 z-5",children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("span",{className:"font-bold",children:[i.length-h.size<=0?"No":i.length-h.size===1?"1":i.length-h.size," ","change",i.length-h.size===1?"":"s"]}),(t==="loading"||t==="not-asked")&&f.jsx("span",{children:f.jsx(xu,{size:16,className:"animate-spin"})})]}),c==="http"&&f.jsxs(ga,{onOpenChange:A=>{A&&!("data"in a&&a.data)&&(l({status:"loading"}),s().then(D=>{if(typeof D.commitSummary=="string"){const V=D.commitSummary.split(`
353
- `),W=V[0],J=V.slice(1).join(`
354
- `);l({status:"success",data:{title:W,description:J}})}else l({status:"error",error:"Could not get commit summary string"})}).catch(D=>{l({status:"error",error:D.message})}))},children:[f.jsx(Ip,{asChild:!0,children:f.jsxs(nn,{disabled:m,variant:"outline",className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{children:"Summary"}),f.jsx(BV,{size:14})]})}),f.jsxs(Xi,{container:C,align:"end",className:"z-[9001] hover:w-[min(100vw,500px)] transition-[width] ease-in-out duration-200 flex flex-col gap-4",children:[a.status==="loading"&&f.jsx("div",{className:"p-4 text-center",children:"Generating summary..."}),a.status==="error"&&f.jsx("div",{children:a.error}),a.status==="success"&&f.jsxs("div",{className:"text-sm",children:[f.jsx("div",{className:"p-2 mb-2 font-bold",children:a.data.title}),f.jsx("div",{className:"p-2 border rounded border-border-primary",children:a.data.description.split(`
355
- `).map((A,D)=>f.jsx("p",{className:"py-1",children:A},D))})]}),f.jsx(Y1,{asChild:!0,children:f.jsx("div",{className:"self-end",children:f.jsx(nn,{children:"Close"})})})]})]})]})}),v!==null&&f.jsx("div",{className:"p-4 bg-bg-tertiary text-text-error-primary",children:v}),f.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in x&&x.data.map(A=>f.jsx(GW,{appliedPatchIds:h,patchSet:A},A.moduleFilePath+":"+A.patchPath.join("/")))})]})}function KW({deployment:{deploymentId:e,deploymentState:t,updatedAt:n},onDismiss:r}){const[o,i]=g.useState(new Date);g.useEffect(()=>{const a=setInterval(()=>{i(new Date)},6e4);return()=>{clearInterval(a)}},[]);const s=t==="error"||t==="failure";return f.jsxs("div",{className:"relative py-4 border-b border-border-primary",children:[f.jsx("button",{className:Ne("absolute top-0 right-0 rounded-full"),onClick:r,children:f.jsx(Af,{size:16})}),f.jsxs("div",{className:"grid grid-cols-[1fr,auto,auto] gap-2 py-2 pr-2",children:[f.jsxs("div",{className:"font-bold",children:["Deployment ",t]}),f.jsx("div",{className:Ne("rounded-full h-3 w-3 mt-1",{"bg-bg-brand-primary animate-pulse":t==="pending"||t==="created","bg-bg-success-primary":t==="success","bg-bg-error-solid":s})}),f.jsx("div",{children:ob(o,n)})]})]},e)}function qW({moduleFilePath:e,patchMetadata:t,appliedPatchIds:n}){var u;const r=uR([t.opType],t.createdAt),o=_P(),{patchErrors:i,skippedPatches:s}=mi(),[a,l]=g.useMemo(()=>[i[t.patchId]||[],!!s[t.patchId]],[t.patchId,i[t.patchId],s[t.patchId]]);let c=[];if(t.author){const d=o[t.author];if(d){const p=((u=d==null?void 0:d.avatar)==null?void 0:u.url)??null;c=[{fullName:d.fullName,url:p}]}}return f.jsx(sb,{path:e.split("/").map(fa).slice(1).concat(t.patchPath),changeDescription:l?"Skipped":r,authors:c,errors:a,skipped:l,isApplied:n.has(t.patchId)})}function uR(e,t){const[n,r]=g.useState(new Date);if(g.useEffect(()=>{const s=setInterval(()=>{r(new Date)},6e4);return()=>{clearInterval(s)}},[]),e.length>1)return"Updated "+ob(n,t);const o=e[0];let i=o;return o==="add"?i="Added":o==="remove"?i="Removed":o==="replace"?i="Replaced":o==="move"?i="Moved":o==="copy"?i="Copied":o==="test"?i="Tested":o==="file"?i="Updated":console.warn("Unexpected op type: ",o),i+" "+ob(n,t)}function GW({patchSet:e,appliedPatchIds:t}){const[n,r]=g.useState(!1),o=g.useRef(null),[i,s]=g.useState(!1);g.useEffect(()=>{const v=new IntersectionObserver(b=>{b[0].isIntersecting&&s(!0)},{threshold:0});return o.current&&v.observe(o.current),()=>{v.disconnect()}},[]);const{patchErrors:a,skippedPatches:l}=mi(),{deletePatches:c}=cV(),u=g.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),d=g.useMemo(()=>{const v=[];for(const b of u)for(const x of a[b]||[])l[b]||v.unshift(x);return v},[u,a,l]),p=uR(e.opTypes,e.lastUpdated),h=_P(),m=e.patches.every(v=>t.has(v.patchId));return i?f.jsxs(f.Fragment,{children:[f.jsx(sb,{path:e.moduleFilePath.split("/").map(fa).slice(1).concat(e.patchPath),isApplied:m,authors:e.authors.reduce((v,b)=>v.includes(b)?v:v.concat(b),[]).flatMap(v=>{var x;const b=h[v];if(b){const w=((x=b==null?void 0:b.avatar)==null?void 0:x.url)??null;return[{fullName:b.fullName,url:w}]}return[]}),changeDescription:p,isOpen:n,setOpen:r,errors:d,onDelete:()=>{c(u)},amount:new Set(u).size}),f.jsx(If,{isOpen:n,children:e.patches.map((v,b)=>f.jsx(qW,{appliedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+b))})]}):f.jsx(sb,{ref:o,isApplied:m})}const sb=g.forwardRef(({path:e,changeDescription:t,authors:n,isOpen:r,setOpen:o,isSelected:i,setSelected:s,errors:a,skipped:l,onDelete:c,amount:u,isApplied:d},p)=>f.jsxs("div",{ref:p,className:Ne("p-6",{"bg-bg-secondary":!r,"bg-bg-quartenary":r,"opacity-50":d}),children:[f.jsxs("div",{className:"relative",children:[f.jsx("span",{title:(e==null?void 0:e.join("/"))+"/",className:Ne("inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 overflow-y-hidden h-6 text-left",{"animate-pulse bg-bg-disabled rounded-3xl":e===void 0,"text-text-disabled":l}),dir:"rtl",children:e!==void 0&&e.join("/")+"/"}),i===void 0&&f.jsx("span",{className:Ne("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":e===void 0})}),i!==void 0&&!d&&f.jsx(Dp,{checked:i,onCheckedChange:h=>{s&&s(h)}}),c&&!d&&f.jsxs("button",{onClick:c,title:"Revert change",className:"relative ml-5",children:[u&&f.jsx("span",{className:"absolute px-2 text-xs rounded-full -top-6 -right-5 bg-bg-quartenary",children:u>10?"10+":u}),f.jsx(GV,{size:16,className:"inline"})]})]}),a&&a.length>0&&!l&&f.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-text-primary",children:[a.slice(0,1).map((h,m)=>f.jsx("div",{title:h,className:"truncate",children:h},m)),a.length>1&&f.jsxs("div",{className:"truncate",children:["+",a.length-1," more"]})]}),(!a||a.length===0)&&l&&f.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-text-primary",children:f.jsx("div",{className:"truncate",children:"Skipped"})}),f.jsxs("div",{className:"flex items-center justify-between pt-2",children:[f.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[n!==void 0&&n.length>0&&f.jsxs("span",{className:"flex gap-1 mr-2",children:[n.slice(0,2).map((h,m)=>{if(h.url)return f.jsxs(il,{children:[f.jsx(jc,{className:"flex-shrink-0 w-6 h-6 ",children:f.jsx("img",{src:h.url,alt:h.fullName,className:Ne("rounded-full",{"-ml-3":n.length>2&&m>0})})}),f.jsx(sl,{children:f.jsx("div",{children:h.fullName})})]},h.url);const v=YW(h.fullName);return f.jsxs(il,{children:[f.jsx(jc,{className:Ne({"-ml-3":n.length>2&&m>0}),children:f.jsx("span",{className:Ne("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-quartenary text-fg-primary"),"aria-label":"Initials for: "+h.fullName,children:v})}),f.jsx(sl,{children:f.jsx("div",{children:h.fullName})})]},h.fullName+h.url)}),n.length>2&&f.jsxs(il,{children:[f.jsx(jc,{className:Ne({"-ml-3":n.length>2}),children:f.jsxs("span",{className:"flex items-center justify-center w-6 h-6 -ml-3 text-xs font-semibold rounded-full bg-bg-quartenary text-fg-primary",children:["+",n.length-2]})}),f.jsx(sl,{className:"grid grid-cols-[auto,1fr] gap-2",children:n.slice(2).map(h=>f.jsxs(g.Fragment,{children:[h.url?f.jsx("img",{src:h.url,alt:h.fullName,title:h.fullName,className:Ne("w-6 h-6 rounded-full")},h.url):f.jsx("div",{}),f.jsx("div",{children:h.fullName})]},h.fullName+h.url))})]})]}),n===void 0&&f.jsx("span",{className:Ne("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":n===void 0})}),t&&f.jsx("span",{className:Ne({"text-text-disabled":l}),children:t})]}),r!==void 0&&f.jsx("button",{className:"flex-shrink-0 inline-block",onClick:()=>{o&&o(!r)},children:f.jsx(Np,{size:16,className:Ne("transform",{"rotate-180":r})})})]})]}));function YW(e){return!e||typeof e!="string"?"":e.trim().normalize("NFC").split(/\s+/).filter(r=>r.length>0).map(r=>/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(r)?r[0]:r[0].toLocaleUpperCase()).join("")}var oS="Dialog",[dR,Fpe]=Wo(oS),[JW,Ko]=dR(oS),fR=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=g.useRef(null),l=g.useRef(null),[c=!1,u]=ro({prop:r,defaultProp:o,onChange:i});return f.jsx(JW,{scope:t,triggerRef:a,contentRef:l,contentId:Zr(),titleId:Zr(),descriptionId:Zr(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};fR.displayName=oS;var pR="DialogTrigger",XW=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ko(pR,n),i=Ue(t,o.triggerRef);return f.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":lS(o.open),...r,ref:i,onClick:se(e.onClick,o.onOpenToggle)})});XW.displayName=pR;var iS="DialogPortal",[ZW,hR]=dR(iS,{forceMount:void 0}),mR=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Ko(iS,t);return f.jsx(ZW,{scope:t,forceMount:n,children:g.Children.map(r,s=>f.jsx(On,{present:n||i.open,children:f.jsx(jp,{asChild:!0,container:o,children:s})}))})};mR.displayName=iS;var cg="DialogOverlay",gR=g.forwardRef((e,t)=>{const n=hR(cg,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Ko(cg,e.__scopeDialog);return i.modal?f.jsx(On,{present:r||i.open,children:f.jsx(QW,{...o,ref:t})}):null});gR.displayName=cg;var QW=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ko(cg,n);return f.jsx(Rp,{as:Gi,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(Pe.div,{"data-state":lS(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Sl="DialogContent",vR=g.forwardRef((e,t)=>{const n=hR(Sl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Ko(Sl,e.__scopeDialog);return f.jsx(On,{present:r||i.open,children:i.modal?f.jsx(e7,{...o,ref:t}):f.jsx(t7,{...o,ref:t})})});vR.displayName=Sl;var e7=g.forwardRef((e,t)=>{const n=Ko(Sl,e.__scopeDialog),r=g.useRef(null),o=Ue(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Tv(i)},[]),f.jsx(yR,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:se(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:se(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:se(e.onFocusOutside,i=>i.preventDefault())})}),t7=g.forwardRef((e,t)=>{const n=Ko(Sl,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return f.jsx(yR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),yR=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=Ko(Sl,n),l=g.useRef(null),c=Ue(t,l);return wv(),f.jsxs(f.Fragment,{children:[f.jsx(Op,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx(wu,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":lS(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(n7,{titleId:a.titleId}),f.jsx(o7,{contentRef:l,descriptionId:a.descriptionId})]})]})}),sS="DialogTitle",aS=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ko(sS,n);return f.jsx(Pe.h2,{id:o.titleId,...r,ref:t})});aS.displayName=sS;var xR="DialogDescription",bR=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ko(xR,n);return f.jsx(Pe.p,{id:o.descriptionId,...r,ref:t})});bR.displayName=xR;var wR="DialogClose",SR=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ko(wR,n);return f.jsx(Pe.button,{type:"button",...r,ref:t,onClick:se(e.onClick,()=>o.onOpenChange(!1))})});SR.displayName=wR;function lS(e){return e?"open":"closed"}var kR="DialogTitleWarning",[zpe,ER]=s9(kR,{contentName:Sl,titleName:sS,docsSlug:"dialog"}),n7=({titleId:e})=>{const t=ER(kR),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
356
-
357
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
358
-
359
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},r7="DialogDescriptionWarning",o7=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ER(r7).contentName}}.`;return g.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},i7=fR,s7=mR,CR=gR,_R=vR,NR=aS,TR=bR,a7=SR;const OR=i7,l7=s7,MR=g.forwardRef(({className:e,...t},n)=>f.jsx(CR,{ref:n,className:Ke("fixed inset-0 z-50 bg-bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));MR.displayName=CR.displayName;const cS=g.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},i)=>f.jsxs(l7,{container:n,children:[f.jsx(MR,{}),f.jsxs(_R,{ref:i,className:Ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-bg-background text-text-primary p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...o,children:[t,r?null:f.jsxs(a7,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-bg-brand-primary data-[state=open]:text-primary_on-brand",children:[f.jsx(Af,{className:"w-4 h-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));cS.displayName=_R.displayName;const PR=({className:e,...t})=>f.jsx("div",{className:Ke("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});PR.displayName="DialogHeader";const c7=g.forwardRef(({className:e,...t},n)=>f.jsx(NR,{ref:n,className:Ke("text-lg font-semibold leading-none tracking-tight",e),...t}));c7.displayName=NR.displayName;const jR=g.forwardRef(({className:e,...t},n)=>f.jsx(TR,{ref:n,className:Ke("text-sm text-text-primary",e),...t}));jR.displayName=TR.displayName;function RR(){const{publishError:e,resetPublishError:t}=yu(),n=so();return f.jsx(OR,{open:!!e,onOpenChange:r=>{r||t()},children:f.jsxs(cS,{container:n,className:"bg-bg-primary text-text-primary",children:[f.jsx("div",{className:"text-xl font-bold text-text-error-primary",children:"Could not publish"}),f.jsx("div",{children:e})]})})}var Pv={},jv={};jv.byteLength=f7;jv.toByteArray=h7;jv.fromByteArray=v7;var ti=[],Hr=[],u7=typeof Uint8Array<"u"?Uint8Array:Array,y0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Kl=0,d7=y0.length;Kl<d7;++Kl)ti[Kl]=y0[Kl],Hr[y0.charCodeAt(Kl)]=Kl;Hr[45]=62;Hr[95]=63;function AR(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function f7(e){var t=AR(e),n=t[0],r=t[1];return(n+r)*3/4-r}function p7(e,t,n){return(t+n)*3/4-n}function h7(e){var t,n=AR(e),r=n[0],o=n[1],i=new u7(p7(e,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)t=Hr[e.charCodeAt(l)]<<18|Hr[e.charCodeAt(l+1)]<<12|Hr[e.charCodeAt(l+2)]<<6|Hr[e.charCodeAt(l+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=Hr[e.charCodeAt(l)]<<2|Hr[e.charCodeAt(l+1)]>>4,i[s++]=t&255),o===1&&(t=Hr[e.charCodeAt(l)]<<10|Hr[e.charCodeAt(l+1)]<<4|Hr[e.charCodeAt(l+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function m7(e){return ti[e>>18&63]+ti[e>>12&63]+ti[e>>6&63]+ti[e&63]}function g7(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),o.push(m7(r));return o.join("")}function v7(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;s<a;s+=i)o.push(g7(e,s,s+i>a?a:s+i));return r===1?(t=e[n-1],o.push(ti[t>>2]+ti[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(ti[t>>10]+ti[t>>4&63]+ti[t<<2&63]+"=")),o.join("")}var uS={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */uS.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,d=n?o-1:0,p=n?-1:1,h=e[t+d];for(d+=p,i=h&(1<<-u)-1,h>>=-u,u+=a;u>0;i=i*256+e[t+d],d+=p,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+e[t+d],d+=p,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(h?-1:1)*s*Math.pow(2,i-r)};uS.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<<c)-1,d=u>>1,p=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,m=r?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?t+=p/l:t+=p*Math.pow(2,1-d),t*l>=2&&(s++,l/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*l-1)*Math.pow(2,o),s=s+d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+h]=a&255,h+=m,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+h]=s&255,h+=m,s/=256,c-=8);e[n+h-m]|=v*128};/*!
360
- * The buffer module from node.js, for the browser.
361
- *
362
- * @author Feross Aboukhadijeh <https://feross.org>
363
- * @license MIT
364
- */(function(e){var t=jv,n=uS,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=w,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var N=new Uint8Array(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,Uint8Array.prototype),Object.setPrototypeOf(N,S),N.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(N){if(N>o)throw new RangeError('The value "'+N+'" is invalid for option "size"');var S=new Uint8Array(N);return Object.setPrototypeOf(S,a.prototype),S}function a(N,S,E){if(typeof N=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(N)}return l(N,S,E)}a.poolSize=8192;function l(N,S,E){if(typeof N=="string")return p(N,S);if(ArrayBuffer.isView(N))return m(N);if(N==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof N);if(ze(N,ArrayBuffer)||N&&ze(N.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ze(N,SharedArrayBuffer)||N&&ze(N.buffer,SharedArrayBuffer)))return v(N,S,E);if(typeof N=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var P=N.valueOf&&N.valueOf();if(P!=null&&P!==N)return a.from(P,S,E);var z=b(N);if(z)return z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof N[Symbol.toPrimitive]=="function")return a.from(N[Symbol.toPrimitive]("string"),S,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof N)}a.from=function(N,S,E){return l(N,S,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(N){if(typeof N!="number")throw new TypeError('"size" argument must be of type number');if(N<0)throw new RangeError('The value "'+N+'" is invalid for option "size"')}function u(N,S,E){return c(N),N<=0?s(N):S!==void 0?typeof E=="string"?s(N).fill(S,E):s(N).fill(S):s(N)}a.alloc=function(N,S,E){return u(N,S,E)};function d(N){return c(N),s(N<0?0:x(N)|0)}a.allocUnsafe=function(N){return d(N)},a.allocUnsafeSlow=function(N){return d(N)};function p(N,S){if((typeof S!="string"||S==="")&&(S="utf8"),!a.isEncoding(S))throw new TypeError("Unknown encoding: "+S);var E=k(N,S)|0,P=s(E),z=P.write(N,S);return z!==E&&(P=P.slice(0,z)),P}function h(N){for(var S=N.length<0?0:x(N.length)|0,E=s(S),P=0;P<S;P+=1)E[P]=N[P]&255;return E}function m(N){if(ze(N,Uint8Array)){var S=new Uint8Array(N);return v(S.buffer,S.byteOffset,S.byteLength)}return h(N)}function v(N,S,E){if(S<0||N.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(N.byteLength<S+(E||0))throw new RangeError('"length" is outside of buffer bounds');var P;return S===void 0&&E===void 0?P=new Uint8Array(N):E===void 0?P=new Uint8Array(N,S):P=new Uint8Array(N,S,E),Object.setPrototypeOf(P,a.prototype),P}function b(N){if(a.isBuffer(N)){var S=x(N.length)|0,E=s(S);return E.length===0||N.copy(E,0,0,S),E}if(N.length!==void 0)return typeof N.length!="number"||je(N.length)?s(0):h(N);if(N.type==="Buffer"&&Array.isArray(N.data))return h(N.data)}function x(N){if(N>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return N|0}function w(N){return+N!=N&&(N=0),a.alloc(+N)}a.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==a.prototype},a.compare=function(S,E){if(ze(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),ze(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(S)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===E)return 0;for(var P=S.length,z=E.length,G=0,Q=Math.min(P,z);G<Q;++G)if(S[G]!==E[G]){P=S[G],z=E[G];break}return P<z?-1:z<P?1:0},a.isEncoding=function(S){switch(String(S).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(S,E){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return a.alloc(0);var P;if(E===void 0)for(E=0,P=0;P<S.length;++P)E+=S[P].length;var z=a.allocUnsafe(E),G=0;for(P=0;P<S.length;++P){var Q=S[P];if(ze(Q,Uint8Array))G+Q.length>z.length?a.from(Q).copy(z,G):Uint8Array.prototype.set.call(z,Q,G);else if(a.isBuffer(Q))Q.copy(z,G);else throw new TypeError('"list" argument must be an Array of Buffers');G+=Q.length}return z};function k(N,S){if(a.isBuffer(N))return N.length;if(ArrayBuffer.isView(N)||ze(N,ArrayBuffer))return N.byteLength;if(typeof N!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof N);var E=N.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&E===0)return 0;for(var z=!1;;)switch(S){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Y(N).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return we(N).length;default:if(z)return P?-1:Y(N).length;S=(""+S).toLowerCase(),z=!0}}a.byteLength=k;function C(N,S,E){var P=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,S>>>=0,E<=S))return"";for(N||(N="utf8");;)switch(N){case"hex":return F(this,S,E);case"utf8":case"utf-8":return X(this,S,E);case"ascii":return R(this,S,E);case"latin1":case"binary":return M(this,S,E);case"base64":return J(this,S,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,S,E);default:if(P)throw new TypeError("Unknown encoding: "+N);N=(N+"").toLowerCase(),P=!0}}a.prototype._isBuffer=!0;function _(N,S,E){var P=N[S];N[S]=N[E],N[E]=P}a.prototype.swap16=function(){var S=this.length;if(S%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<S;E+=2)_(this,E,E+1);return this},a.prototype.swap32=function(){var S=this.length;if(S%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<S;E+=4)_(this,E,E+3),_(this,E+1,E+2);return this},a.prototype.swap64=function(){var S=this.length;if(S%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<S;E+=8)_(this,E,E+7),_(this,E+1,E+6),_(this,E+2,E+5),_(this,E+3,E+4);return this},a.prototype.toString=function(){var S=this.length;return S===0?"":arguments.length===0?X(this,0,S):C.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(S){if(!a.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:a.compare(this,S)===0},a.prototype.inspect=function(){var S="",E=e.INSPECT_MAX_BYTES;return S=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(S+=" ... "),"<Buffer "+S+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(S,E,P,z,G){if(ze(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),!a.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(E===void 0&&(E=0),P===void 0&&(P=S?S.length:0),z===void 0&&(z=0),G===void 0&&(G=this.length),E<0||P>S.length||z<0||G>this.length)throw new RangeError("out of range index");if(z>=G&&E>=P)return 0;if(z>=G)return-1;if(E>=P)return 1;if(E>>>=0,P>>>=0,z>>>=0,G>>>=0,this===S)return 0;for(var Q=G-z,Xe=P-E,at=Math.min(Q,Xe),yt=this.slice(z,G),sn=S.slice(E,P),ct=0;ct<at;++ct)if(yt[ct]!==sn[ct]){Q=yt[ct],Xe=sn[ct];break}return Q<Xe?-1:Xe<Q?1:0};function O(N,S,E,P,z){if(N.length===0)return-1;if(typeof E=="string"?(P=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,je(E)&&(E=z?0:N.length-1),E<0&&(E=N.length+E),E>=N.length){if(z)return-1;E=N.length-1}else if(E<0)if(z)E=0;else return-1;if(typeof S=="string"&&(S=a.from(S,P)),a.isBuffer(S))return S.length===0?-1:T(N,S,E,P,z);if(typeof S=="number")return S=S&255,typeof Uint8Array.prototype.indexOf=="function"?z?Uint8Array.prototype.indexOf.call(N,S,E):Uint8Array.prototype.lastIndexOf.call(N,S,E):T(N,[S],E,P,z);throw new TypeError("val must be string, number or Buffer")}function T(N,S,E,P,z){var G=1,Q=N.length,Xe=S.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(N.length<2||S.length<2)return-1;G=2,Q/=2,Xe/=2,E/=2}function at(ss,Au){return G===1?ss[Au]:ss.readUInt16BE(Au*G)}var yt;if(z){var sn=-1;for(yt=E;yt<Q;yt++)if(at(N,yt)===at(S,sn===-1?0:yt-sn)){if(sn===-1&&(sn=yt),yt-sn+1===Xe)return sn*G}else sn!==-1&&(yt-=yt-sn),sn=-1}else for(E+Xe>Q&&(E=Q-Xe),yt=E;yt>=0;yt--){for(var ct=!0,fo=0;fo<Xe;fo++)if(at(N,yt+fo)!==at(S,fo)){ct=!1;break}if(ct)return yt}return-1}a.prototype.includes=function(S,E,P){return this.indexOf(S,E,P)!==-1},a.prototype.indexOf=function(S,E,P){return O(this,S,E,P,!0)},a.prototype.lastIndexOf=function(S,E,P){return O(this,S,E,P,!1)};function j(N,S,E,P){E=Number(E)||0;var z=N.length-E;P?(P=Number(P),P>z&&(P=z)):P=z;var G=S.length;P>G/2&&(P=G/2);for(var Q=0;Q<P;++Q){var Xe=parseInt(S.substr(Q*2,2),16);if(je(Xe))return Q;N[E+Q]=Xe}return Q}function A(N,S,E,P){return ce(Y(S,N.length-E),N,E,P)}function D(N,S,E,P){return ce(ne(S),N,E,P)}function V(N,S,E,P){return ce(we(S),N,E,P)}function W(N,S,E,P){return ce(te(S,N.length-E),N,E,P)}a.prototype.write=function(S,E,P,z){if(E===void 0)z="utf8",P=this.length,E=0;else if(P===void 0&&typeof E=="string")z=E,P=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(P)?(P=P>>>0,z===void 0&&(z="utf8")):(z=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var G=this.length-E;if((P===void 0||P>G)&&(P=G),S.length>0&&(P<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");z||(z="utf8");for(var Q=!1;;)switch(z){case"hex":return j(this,S,E,P);case"utf8":case"utf-8":return A(this,S,E,P);case"ascii":case"latin1":case"binary":return D(this,S,E,P);case"base64":return V(this,S,E,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,S,E,P);default:if(Q)throw new TypeError("Unknown encoding: "+z);z=(""+z).toLowerCase(),Q=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(N,S,E){return S===0&&E===N.length?t.fromByteArray(N):t.fromByteArray(N.slice(S,E))}function X(N,S,E){E=Math.min(N.length,E);for(var P=[],z=S;z<E;){var G=N[z],Q=null,Xe=G>239?4:G>223?3:G>191?2:1;if(z+Xe<=E){var at,yt,sn,ct;switch(Xe){case 1:G<128&&(Q=G);break;case 2:at=N[z+1],(at&192)===128&&(ct=(G&31)<<6|at&63,ct>127&&(Q=ct));break;case 3:at=N[z+1],yt=N[z+2],(at&192)===128&&(yt&192)===128&&(ct=(G&15)<<12|(at&63)<<6|yt&63,ct>2047&&(ct<55296||ct>57343)&&(Q=ct));break;case 4:at=N[z+1],yt=N[z+2],sn=N[z+3],(at&192)===128&&(yt&192)===128&&(sn&192)===128&&(ct=(G&15)<<18|(at&63)<<12|(yt&63)<<6|sn&63,ct>65535&&ct<1114112&&(Q=ct))}}Q===null?(Q=65533,Xe=1):Q>65535&&(Q-=65536,P.push(Q>>>10&1023|55296),Q=56320|Q&1023),P.push(Q),z+=Xe}return I(P)}var U=4096;function I(N){var S=N.length;if(S<=U)return String.fromCharCode.apply(String,N);for(var E="",P=0;P<S;)E+=String.fromCharCode.apply(String,N.slice(P,P+=U));return E}function R(N,S,E){var P="";E=Math.min(N.length,E);for(var z=S;z<E;++z)P+=String.fromCharCode(N[z]&127);return P}function M(N,S,E){var P="";E=Math.min(N.length,E);for(var z=S;z<E;++z)P+=String.fromCharCode(N[z]);return P}function F(N,S,E){var P=N.length;(!S||S<0)&&(S=0),(!E||E<0||E>P)&&(E=P);for(var z="",G=S;G<E;++G)z+=mt[N[G]];return z}function L(N,S,E){for(var P=N.slice(S,E),z="",G=0;G<P.length-1;G+=2)z+=String.fromCharCode(P[G]+P[G+1]*256);return z}a.prototype.slice=function(S,E){var P=this.length;S=~~S,E=E===void 0?P:~~E,S<0?(S+=P,S<0&&(S=0)):S>P&&(S=P),E<0?(E+=P,E<0&&(E=0)):E>P&&(E=P),E<S&&(E=S);var z=this.subarray(S,E);return Object.setPrototypeOf(z,a.prototype),z};function B(N,S,E){if(N%1!==0||N<0)throw new RangeError("offset is not uint");if(N+S>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(S,E,P){S=S>>>0,E=E>>>0,P||B(S,E,this.length);for(var z=this[S],G=1,Q=0;++Q<E&&(G*=256);)z+=this[S+Q]*G;return z},a.prototype.readUintBE=a.prototype.readUIntBE=function(S,E,P){S=S>>>0,E=E>>>0,P||B(S,E,this.length);for(var z=this[S+--E],G=1;E>0&&(G*=256);)z+=this[S+--E]*G;return z},a.prototype.readUint8=a.prototype.readUInt8=function(S,E){return S=S>>>0,E||B(S,1,this.length),this[S]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(S,E){return S=S>>>0,E||B(S,2,this.length),this[S]|this[S+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(S,E){return S=S>>>0,E||B(S,2,this.length),this[S]<<8|this[S+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(S,E){return S=S>>>0,E||B(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(S,E){return S=S>>>0,E||B(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},a.prototype.readIntLE=function(S,E,P){S=S>>>0,E=E>>>0,P||B(S,E,this.length);for(var z=this[S],G=1,Q=0;++Q<E&&(G*=256);)z+=this[S+Q]*G;return G*=128,z>=G&&(z-=Math.pow(2,8*E)),z},a.prototype.readIntBE=function(S,E,P){S=S>>>0,E=E>>>0,P||B(S,E,this.length);for(var z=E,G=1,Q=this[S+--z];z>0&&(G*=256);)Q+=this[S+--z]*G;return G*=128,Q>=G&&(Q-=Math.pow(2,8*E)),Q},a.prototype.readInt8=function(S,E){return S=S>>>0,E||B(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},a.prototype.readInt16LE=function(S,E){S=S>>>0,E||B(S,2,this.length);var P=this[S]|this[S+1]<<8;return P&32768?P|4294901760:P},a.prototype.readInt16BE=function(S,E){S=S>>>0,E||B(S,2,this.length);var P=this[S+1]|this[S]<<8;return P&32768?P|4294901760:P},a.prototype.readInt32LE=function(S,E){return S=S>>>0,E||B(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},a.prototype.readInt32BE=function(S,E){return S=S>>>0,E||B(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},a.prototype.readFloatLE=function(S,E){return S=S>>>0,E||B(S,4,this.length),n.read(this,S,!0,23,4)},a.prototype.readFloatBE=function(S,E){return S=S>>>0,E||B(S,4,this.length),n.read(this,S,!1,23,4)},a.prototype.readDoubleLE=function(S,E){return S=S>>>0,E||B(S,8,this.length),n.read(this,S,!0,52,8)},a.prototype.readDoubleBE=function(S,E){return S=S>>>0,E||B(S,8,this.length),n.read(this,S,!1,52,8)};function K(N,S,E,P,z,G){if(!a.isBuffer(N))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>z||S<G)throw new RangeError('"value" argument is out of bounds');if(E+P>N.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(S,E,P,z){if(S=+S,E=E>>>0,P=P>>>0,!z){var G=Math.pow(2,8*P)-1;K(this,S,E,P,G,0)}var Q=1,Xe=0;for(this[E]=S&255;++Xe<P&&(Q*=256);)this[E+Xe]=S/Q&255;return E+P},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(S,E,P,z){if(S=+S,E=E>>>0,P=P>>>0,!z){var G=Math.pow(2,8*P)-1;K(this,S,E,P,G,0)}var Q=P-1,Xe=1;for(this[E+Q]=S&255;--Q>=0&&(Xe*=256);)this[E+Q]=S/Xe&255;return E+P},a.prototype.writeUint8=a.prototype.writeUInt8=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,1,255,0),this[E]=S&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,2,65535,0),this[E]=S&255,this[E+1]=S>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,2,65535,0),this[E]=S>>>8,this[E+1]=S&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,4,4294967295,0),this[E+3]=S>>>24,this[E+2]=S>>>16,this[E+1]=S>>>8,this[E]=S&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,4,4294967295,0),this[E]=S>>>24,this[E+1]=S>>>16,this[E+2]=S>>>8,this[E+3]=S&255,E+4},a.prototype.writeIntLE=function(S,E,P,z){if(S=+S,E=E>>>0,!z){var G=Math.pow(2,8*P-1);K(this,S,E,P,G-1,-G)}var Q=0,Xe=1,at=0;for(this[E]=S&255;++Q<P&&(Xe*=256);)S<0&&at===0&&this[E+Q-1]!==0&&(at=1),this[E+Q]=(S/Xe>>0)-at&255;return E+P},a.prototype.writeIntBE=function(S,E,P,z){if(S=+S,E=E>>>0,!z){var G=Math.pow(2,8*P-1);K(this,S,E,P,G-1,-G)}var Q=P-1,Xe=1,at=0;for(this[E+Q]=S&255;--Q>=0&&(Xe*=256);)S<0&&at===0&&this[E+Q+1]!==0&&(at=1),this[E+Q]=(S/Xe>>0)-at&255;return E+P},a.prototype.writeInt8=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,1,127,-128),S<0&&(S=255+S+1),this[E]=S&255,E+1},a.prototype.writeInt16LE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,2,32767,-32768),this[E]=S&255,this[E+1]=S>>>8,E+2},a.prototype.writeInt16BE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,2,32767,-32768),this[E]=S>>>8,this[E+1]=S&255,E+2},a.prototype.writeInt32LE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,4,2147483647,-2147483648),this[E]=S&255,this[E+1]=S>>>8,this[E+2]=S>>>16,this[E+3]=S>>>24,E+4},a.prototype.writeInt32BE=function(S,E,P){return S=+S,E=E>>>0,P||K(this,S,E,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[E]=S>>>24,this[E+1]=S>>>16,this[E+2]=S>>>8,this[E+3]=S&255,E+4};function be(N,S,E,P,z,G){if(E+P>N.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function ae(N,S,E,P,z){return S=+S,E=E>>>0,z||be(N,S,E,4),n.write(N,S,E,P,23,4),E+4}a.prototype.writeFloatLE=function(S,E,P){return ae(this,S,E,!0,P)},a.prototype.writeFloatBE=function(S,E,P){return ae(this,S,E,!1,P)};function le(N,S,E,P,z){return S=+S,E=E>>>0,z||be(N,S,E,8),n.write(N,S,E,P,52,8),E+8}a.prototype.writeDoubleLE=function(S,E,P){return le(this,S,E,!0,P)},a.prototype.writeDoubleBE=function(S,E,P){return le(this,S,E,!1,P)},a.prototype.copy=function(S,E,P,z){if(!a.isBuffer(S))throw new TypeError("argument should be a Buffer");if(P||(P=0),!z&&z!==0&&(z=this.length),E>=S.length&&(E=S.length),E||(E=0),z>0&&z<P&&(z=P),z===P||S.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(z<0)throw new RangeError("sourceEnd out of bounds");z>this.length&&(z=this.length),S.length-E<z-P&&(z=S.length-E+P);var G=z-P;return this===S&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,P,z):Uint8Array.prototype.set.call(S,this.subarray(P,z),E),G},a.prototype.fill=function(S,E,P,z){if(typeof S=="string"){if(typeof E=="string"?(z=E,E=0,P=this.length):typeof P=="string"&&(z=P,P=this.length),z!==void 0&&typeof z!="string")throw new TypeError("encoding must be a string");if(typeof z=="string"&&!a.isEncoding(z))throw new TypeError("Unknown encoding: "+z);if(S.length===1){var G=S.charCodeAt(0);(z==="utf8"&&G<128||z==="latin1")&&(S=G)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(E<0||this.length<E||this.length<P)throw new RangeError("Out of range index");if(P<=E)return this;E=E>>>0,P=P===void 0?this.length:P>>>0,S||(S=0);var Q;if(typeof S=="number")for(Q=E;Q<P;++Q)this[Q]=S;else{var Xe=a.isBuffer(S)?S:a.from(S,z),at=Xe.length;if(at===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(Q=0;Q<P-E;++Q)this[Q+E]=Xe[Q%at]}return this};var re=/[^+/0-9A-Za-z-_]/g;function $(N){if(N=N.split("=")[0],N=N.trim().replace(re,""),N.length<2)return"";for(;N.length%4!==0;)N=N+"=";return N}function Y(N,S){S=S||1/0;for(var E,P=N.length,z=null,G=[],Q=0;Q<P;++Q){if(E=N.charCodeAt(Q),E>55295&&E<57344){if(!z){if(E>56319){(S-=3)>-1&&G.push(239,191,189);continue}else if(Q+1===P){(S-=3)>-1&&G.push(239,191,189);continue}z=E;continue}if(E<56320){(S-=3)>-1&&G.push(239,191,189),z=E;continue}E=(z-55296<<10|E-56320)+65536}else z&&(S-=3)>-1&&G.push(239,191,189);if(z=null,E<128){if((S-=1)<0)break;G.push(E)}else if(E<2048){if((S-=2)<0)break;G.push(E>>6|192,E&63|128)}else if(E<65536){if((S-=3)<0)break;G.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((S-=4)<0)break;G.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return G}function ne(N){for(var S=[],E=0;E<N.length;++E)S.push(N.charCodeAt(E)&255);return S}function te(N,S){for(var E,P,z,G=[],Q=0;Q<N.length&&!((S-=2)<0);++Q)E=N.charCodeAt(Q),P=E>>8,z=E%256,G.push(z),G.push(P);return G}function we(N){return t.toByteArray($(N))}function ce(N,S,E,P){for(var z=0;z<P&&!(z+E>=S.length||z>=N.length);++z)S[z+E]=N[z];return z}function ze(N,S){return N instanceof S||N!=null&&N.constructor!=null&&N.constructor.name!=null&&N.constructor.name===S.name}function je(N){return N!==N}var mt=function(){for(var N="0123456789abcdef",S=new Array(256),E=0;E<16;++E)for(var P=E*16,z=0;z<16;++z)S[P+z]=N[E]+N[z];return S}()})(Pv);function dS(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var ab=class extends Error{constructor(n,r){super(n,r);zt(this,"name");zt(this,"details");this.name="ZodValidationError",this.details=y7(r)}toString(){return this.message}};function y7(e){if(e){const t=e.cause;if(dS(t))return t.issues}return[]}function IR(e){return e.length!==0}var x7=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function b7(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+w7(n)+'"]';if(!x7.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function w7(e){return e.replace(/"/g,'\\"')}var S7="; ",k7=99,DR="Validation error",E7=": ",C7=", or ";function _7(e={}){const{issueSeparator:t=S7,unionSeparator:n=C7,prefixSeparator:r=E7,prefix:o=DR,includePath:i=!0,maxIssuesInMessage:s=k7}=e;return a=>{const l=a.slice(0,s).map(c=>Qh({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return N7(l,o,r)}}function Qh(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===Z.invalid_union)return t.unionErrors.reduce((i,s)=>{const a=s.issues.map(l=>Qh({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return i.includes(a)||i.push(a),i},[]).join(r);if(t.code===Z.invalid_arguments)return[t.message,...t.argumentsError.issues.map(i=>Qh({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===Z.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(i=>Qh({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&IR(t.path)){if(t.path.length===1){const i=t.path[0];if(typeof i=="number")return`${t.message} at index ${i}`}return`${t.message} at "${b7(t.path)}"`}return t.message}function N7(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:DR}function VC(e,t={}){if(!dS(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${M7.name}" method instead?`);return LR(e,t)}function LR(e,t={}){const n=e.errors;let r;return IR(n)?r=T7(t)(n):r=e.message,new ab(r,{cause:e})}function T7(e){return"messageBuilder"in e?e.messageBuilder:_7(e)}var O7=(e={})=>t=>dS(t)?LR(t,e):t instanceof Error?new ab(t.message,{cause:t}):new ab("Unknown error");function M7(e,t={}){return O7(t)(e)}function P7(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function j7(e){var t=P7(e,"string");return typeof t=="symbol"?t:t+""}function gt(e,t,n){return(t=j7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Mi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UC(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function lb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fS(e,t){if(e){if(typeof e=="string")return lb(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lb(e,t):void 0}}function pS(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=fS(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
365
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return s=l.done,l},e:function(l){a=!0,i=l},f:function(){try{s||n.return==null||n.return()}finally{if(a)throw i}}}}function R7(e,t,n){var r={},o=[],i=0,s=pS((e==null?void 0:e.content)||[]),a;try{for(s.s();!(a=s.n()).done;){var l=a.value,c=A7([(i++).toString()],l,r,t,n);o.push(c)}}catch(u){s.e(u)}finally{s.f()}return{blocks:o,files:r}}function A7(e,t,n,r,o){if(t.type==="heading"){var i,s,a=((i=t.attrs)===null||i===void 0?void 0:i.level)||1;if(Number.isNaN(a))throw new Error("Invalid header depth");return{tag:"h".concat(a),children:((s=t.content)===null||s===void 0?void 0:s.map(function(c,u){return I7(e.concat("children",u.toString()),c,n,r,o)}))||[]}}else{if(t.type==="paragraph")return FR(e,t,n,r,o);if(t.type==="bulletList")return $R(e,t,n,r,o);if(t.type==="orderedList")return VR(e,t,n,r,o);var l=t;throw new Error("Unhandled node type: ".concat("type"in l?"exhaustiveCheck.type":"unknown"))}}function I7(e,t,n,r,o){if(t.type==="text")return zR(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return UR(e,t,n,r,o);var i=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(i,null,2)))}function FR(e,t,n,r,o){var i;return{tag:"p",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="text")return zR(s);if(s.type==="hardBreak")return{tag:"br"};if(s.type==="image")return UR(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected paragraph child type: ".concat(JSON.stringify(l,null,2)))}))||[]}}function zR(e){if(e.type==="text"){var t,n,r=((t=e.marks)===null||t===void 0?void 0:t.flatMap(function(a){return a.type!=="link"?a.type==="strike"?["line-through"]:[a.type]:[]}))||[];if((n=e.marks)!==null&&n!==void 0&&n.some(function(a){return a.type==="link"})){var o;if(r.length>0){var i;return{tag:"a",href:((i=e.marks.find(function(a){return a.type==="link"}))===null||i===void 0?void 0:i.attrs.href)||"",children:[{tag:"span",styles:r,children:[e.text]}]}}return{tag:"a",href:((o=e.marks.find(function(a){return a.type==="link"}))===null||o===void 0?void 0:o.attrs.href)||"",children:[e.text]}}return r.length>0?{tag:"span",styles:r,children:[e.text]}:e.text}else{var s=e.type;throw new Error("Unexpected node type: ".concat(s))}}function BR(e,t,n,r,o){var i;return{tag:"li",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="paragraph")return FR(e.concat("children",a.toString()),s,n,r,o);if(s.type==="bulletList")return $R(e.concat("children",a.toString()),s,n,r,o);if(s.type==="orderedList")return VR(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected list child type: ".concat(l))}))||[]}}function $R(e,t,n,r,o){var i;return{tag:"ul",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return BR(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected bullet list child type: ".concat(l))}))||[]}}function VR(e,t,n,r,o){var i;return{tag:"ol",children:((i=t.content)===null||i===void 0?void 0:i.map(function(s,a){if(s.type==="listItem")return BR(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected ordered list child type: ".concat(l))}))||[]}}var D7=new TextEncoder;function UR(e,t,n,r,o){if(t.attrs&&t.attrs.src.startsWith("data:")){var i=Pv.Buffer.from(t.attrs.src.split(",")[1],"base64"),s=de.getSHA256Hash(new Uint8Array(i)),a=de.getMimeType(t.attrs.src);if(a===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var l=de.createFilename(t.attrs.src,t.attrs.fileName||"",{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a},s),c=r!=null&&r.endsWith("/")?r:"".concat(r,"/"),u="".concat(c).concat(l),d=n[u],p=e.concat("src");d?d.patchPaths.push(p):n[u]={value:t.attrs.src,patchPaths:[p]};var h=de.remote.hashToRemoteFileHash(s),m=o?de.remote.createRemoteRef(o.remoteHost,Mi(Mi({},o),{},{fileHash:h,validationHash:de.remote.getValidationHash(o.coreVersion,o.schema,a,{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0},h,D7),filePath:u.slice(1)})):u;return{tag:"img",src:Mi(Mi(gt({},bt,m),o?gt({},qe,"remote"):gt(gt({},qe,"file"),Vx,"image")),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:a}})}}else if(t.attrs){var v=t.attrs.src,b=HC("patch_id",v),x=v.split("?")[0],w=!1;b?(w=HC("remote",v)==="true",x.startsWith("/api/val/files/public")?x=x.slice(14):console.error("Patched image URL does not start with /api/val/files: "+v)):o&&x.startsWith(o.remoteHost)?w=!0:x.startsWith("/public")?console.error("Unpatched image URL starts with /public: "+v):x="/public".concat(x);var k={tag:"img",src:Mi(Mi({},gt(w?gt({},qe,"remote"):gt(gt({},qe,"file"),Vx,"image"),bt,x)),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:x&&de.filenameToMimeType(x)||""}},b?{patch_id:b}:{})};return k}else throw new Error("Invalid image node (no attrs): "+JSON.stringify(t))}function HC(e,t){var n=t.split("?");if(!(n.length<2)){var r=n[1],o=new URLSearchParams(r);if(o.has(e))return o.get(e)}}var HR=y.object({type:y.union([y.literal("bold"),y.literal("strike"),y.literal("italic")])}),L7=y.object({type:y.literal("link"),attrs:y.object({href:y.string(),target:y.union([y.literal("_blank"),y.null()]),auto:y.boolean()})}),WR=y.intersection(y.object({type:y.literal("text"),text:y.string()}),y.object({marks:y.array(y.union([HR,L7]))}).partial()),KR=y.intersection(y.object({type:y.literal("hardBreak")}),y.object({marks:y.array(HR)}).partial()),qR=y.intersection(y.object({type:y.literal("image")}),y.object({attrs:y.intersection(y.object({src:y.string()}),y.object({align:y.union([y.literal("center"),y.literal("end"),y.literal("justify"),y.literal("left"),y.literal("match-parent"),y.literal("right"),y.literal("start"),y.null()]),alt:y.union([y.string(),y.null()]),height:y.union([y.string(),y.number(),y.null()]),width:y.union([y.string(),y.number(),y.null()]),rotate:y.union([y.string(),y.null()]),title:y.union([y.string(),y.null()]),fileName:y.union([y.string(),y.null()])}).partial())}).partial()),F7=y.intersection(y.object({type:y.literal("heading")}),y.object({attrs:y.object({level:y.number()}),content:y.array(y.union([WR,qR,KR]))}).partial()),GR=y.lazy(function(){return y.intersection(y.object({type:y.literal("bulletList")}),y.object({content:y.array(JR)}).partial())}),YR=y.lazy(function(){return y.intersection(y.object({type:y.literal("orderedList")}),y.object({content:y.array(JR)}).partial())}),JR=y.lazy(function(){return y.intersection(y.object({type:y.literal("listItem")}),y.object({attrs:y.object({closed:y.boolean(),nested:y.boolean()}).partial().optional(),content:y.array(y.union([XR,GR,YR]))}).partial())}),XR=y.lazy(function(){return y.intersection(y.object({type:y.literal("paragraph")}),y.object({content:y.array(y.union([WR,qR,KR]))}).partial())});y.object({type:y.literal("doc"),content:y.array(y.union([XR,F7,GR,YR]))});function z7(e){if(Array.isArray(e))return lb(e)}function B7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
366
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function V7(e){return z7(e)||B7(e)||fS(e)||$7()}function U7(e){return{type:"doc",content:e.map(function(t){return H7(t)})}}function H7(e){switch(e.tag){case"h1":return ql(1,e.children);case"h2":return ql(2,e.children);case"h3":return ql(3,e.children);case"h4":return ql(4,e.children);case"h5":return ql(5,e.children);case"h6":return ql(6,e.children);case"p":return eA(e.children);case"ul":return oA(e);case"ol":return iA(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function ql(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(ZR)}}function Rv(e){return{type:"text",text:e}}function ZR(e){return typeof e=="string"?[Rv(e)]:e.tag==="img"?[rA(e)]:e.tag==="br"?[tA()]:e.tag==="a"?nA(e):QR(e)}function QR(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Rv(e.children[0])];throw Error("Unexpected amount of children in span node: "+JSON.stringify(e,null,2))}var t=Array.from(new Set(e.styles));return e.children.map(function(n){return{type:"text",text:n,marks:t.map(function(r){switch(r){case"bold":return{type:"bold"};case"italic":return{type:"italic"};case"line-through":return{type:"strike"};default:{var o=r;throw Error("Unexpected span class: "+o)}}})}})}function eA(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Rv(t)];switch(t.tag){case"span":return QR(t);case"a":return nA(t);case"img":return[rA(t)];case"br":return[tA()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function tA(){return{type:"hardBreak",marks:[]}}function nA(e){return e.children.flatMap(ZR).map(function(t){return t.type!=="text"?t:Mi(Mi({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function rA(e){var t,n,r=e.src;if(!(qe in r)||r[qe]!=="file"&&r[qe]!=="remote")throw Error("Expected file source in image node");var o;return r[qe]==="remote"?o=de.convertRemoteSource(r):o=de.convertFileSource(r),{type:"image",attrs:{height:(t=r.metadata)===null||t===void 0?void 0:t.height,width:(n=r.metadata)===null||n===void 0?void 0:n.width,src:o.url}}}function oA(e){return{type:"bulletList",content:e.children.map(sA)}}function iA(e){return{type:"orderedList",content:e.children.map(sA)}}function sA(e){return{type:"listItem",content:W7(e.children)}}function W7(e){var t=[],n=pS(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,i=t[t.length-1];i||(i={type:"paragraph",content:[]},t.push(i));var s=i.content;if(typeof o=="string")s.push(Rv(o));else switch(o.tag){case"ol":{t.push(iA(o));break}case"ul":{t.push(oA(o));break}case"p":{var a=eA(o.children);i.type==="paragraph"&&a.type==="paragraph"?a.content&&s.push.apply(s,V7(a.content)):t.push(a);break}default:{var l=o;throw Error("Unexpected list item child: "+JSON.stringify(l))}}}}catch(c){n.e(c)}finally{n.f()}return t}var Da=de.VAL_SESSION_COOKIE,Zu=de.VAL_STATE_COOKIE,Qu=de.VAL_ENABLE_COOKIE_NAME;function cd(){cd=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(I,R,M){I[R]=M.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(I,R,M){return Object.defineProperty(I,R,{value:M,enumerable:!0,configurable:!0,writable:!0}),I[R]}try{c({},"")}catch{c=function(R,M,F){return R[M]=F}}function u(I,R,M,F){var L=R&&R.prototype instanceof x?R:x,B=Object.create(L.prototype),K=new X(F||[]);return o(B,"_invoke",{value:D(I,M,K)}),B}function d(I,R,M){try{return{type:"normal",arg:I.call(R,M)}}catch(F){return{type:"throw",arg:F}}}t.wrap=u;var p="suspendedStart",h="suspendedYield",m="executing",v="completed",b={};function x(){}function w(){}function k(){}var C={};c(C,s,function(){return this});var _=Object.getPrototypeOf,O=_&&_(_(U([])));O&&O!==n&&r.call(O,s)&&(C=O);var T=k.prototype=x.prototype=Object.create(C);function j(I){["next","throw","return"].forEach(function(R){c(I,R,function(M){return this._invoke(R,M)})})}function A(I,R){function M(L,B,K,be){var ae=d(I[L],I,B);if(ae.type!=="throw"){var le=ae.arg,re=le.value;return re&&typeof re=="object"&&r.call(re,"__await")?R.resolve(re.__await).then(function($){M("next",$,K,be)},function($){M("throw",$,K,be)}):R.resolve(re).then(function($){le.value=$,K(le)},function($){return M("throw",$,K,be)})}be(ae.arg)}var F;o(this,"_invoke",{value:function(L,B){function K(){return new R(function(be,ae){M(L,B,be,ae)})}return F=F?F.then(K,K):K()}})}function D(I,R,M){var F=p;return function(L,B){if(F===m)throw Error("Generator is already running");if(F===v){if(L==="throw")throw B;return{value:e,done:!0}}for(M.method=L,M.arg=B;;){var K=M.delegate;if(K){var be=V(K,M);if(be){if(be===b)continue;return be}}if(M.method==="next")M.sent=M._sent=M.arg;else if(M.method==="throw"){if(F===p)throw F=v,M.arg;M.dispatchException(M.arg)}else M.method==="return"&&M.abrupt("return",M.arg);F=m;var ae=d(I,R,M);if(ae.type==="normal"){if(F=M.done?v:h,ae.arg===b)continue;return{value:ae.arg,done:M.done}}ae.type==="throw"&&(F=v,M.method="throw",M.arg=ae.arg)}}}function V(I,R){var M=R.method,F=I.iterator[M];if(F===e)return R.delegate=null,M==="throw"&&I.iterator.return&&(R.method="return",R.arg=e,V(I,R),R.method==="throw")||M!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+M+"' method")),b;var L=d(F,I.iterator,R.arg);if(L.type==="throw")return R.method="throw",R.arg=L.arg,R.delegate=null,b;var B=L.arg;return B?B.done?(R[I.resultName]=B.value,R.next=I.nextLoc,R.method!=="return"&&(R.method="next",R.arg=e),R.delegate=null,b):B:(R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,b)}function W(I){var R={tryLoc:I[0]};1 in I&&(R.catchLoc=I[1]),2 in I&&(R.finallyLoc=I[2],R.afterLoc=I[3]),this.tryEntries.push(R)}function J(I){var R=I.completion||{};R.type="normal",delete R.arg,I.completion=R}function X(I){this.tryEntries=[{tryLoc:"root"}],I.forEach(W,this),this.reset(!0)}function U(I){if(I||I===""){var R=I[s];if(R)return R.call(I);if(typeof I.next=="function")return I;if(!isNaN(I.length)){var M=-1,F=function L(){for(;++M<I.length;)if(r.call(I,M))return L.value=I[M],L.done=!1,L;return L.value=e,L.done=!0,L};return F.next=F}}throw new TypeError(typeof I+" is not iterable")}return w.prototype=k,o(T,"constructor",{value:k,configurable:!0}),o(k,"constructor",{value:w,configurable:!0}),w.displayName=c(k,l,"GeneratorFunction"),t.isGeneratorFunction=function(I){var R=typeof I=="function"&&I.constructor;return!!R&&(R===w||(R.displayName||R.name)==="GeneratorFunction")},t.mark=function(I){return Object.setPrototypeOf?Object.setPrototypeOf(I,k):(I.__proto__=k,c(I,l,"GeneratorFunction")),I.prototype=Object.create(T),I},t.awrap=function(I){return{__await:I}},j(A.prototype),c(A.prototype,a,function(){return this}),t.AsyncIterator=A,t.async=function(I,R,M,F,L){L===void 0&&(L=Promise);var B=new A(u(I,R,M,F),L);return t.isGeneratorFunction(R)?B:B.next().then(function(K){return K.done?K.value:B.next()})},j(T),c(T,l,"Generator"),c(T,s,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),t.keys=function(I){var R=Object(I),M=[];for(var F in R)M.push(F);return M.reverse(),function L(){for(;M.length;){var B=M.pop();if(B in R)return L.value=B,L.done=!1,L}return L.done=!0,L}},t.values=U,X.prototype={constructor:X,reset:function(I){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(J),!I)for(var R in this)R.charAt(0)==="t"&&r.call(this,R)&&!isNaN(+R.slice(1))&&(this[R]=e)},stop:function(){this.done=!0;var I=this.tryEntries[0].completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(I){if(this.done)throw I;var R=this;function M(ae,le){return B.type="throw",B.arg=I,R.next=ae,le&&(R.method="next",R.arg=e),!!le}for(var F=this.tryEntries.length-1;F>=0;--F){var L=this.tryEntries[F],B=L.completion;if(L.tryLoc==="root")return M("end");if(L.tryLoc<=this.prev){var K=r.call(L,"catchLoc"),be=r.call(L,"finallyLoc");if(K&&be){if(this.prev<L.catchLoc)return M(L.catchLoc,!0);if(this.prev<L.finallyLoc)return M(L.finallyLoc)}else if(K){if(this.prev<L.catchLoc)return M(L.catchLoc,!0)}else{if(!be)throw Error("try statement without catch or finally");if(this.prev<L.finallyLoc)return M(L.finallyLoc)}}}},abrupt:function(I,R){for(var M=this.tryEntries.length-1;M>=0;--M){var F=this.tryEntries[M];if(F.tryLoc<=this.prev&&r.call(F,"finallyLoc")&&this.prev<F.finallyLoc){var L=F;break}}L&&(I==="break"||I==="continue")&&L.tryLoc<=R&&R<=L.finallyLoc&&(L=null);var B=L?L.completion:{};return B.type=I,B.arg=R,L?(this.method="next",this.next=L.finallyLoc,b):this.complete(B)},complete:function(I,R){if(I.type==="throw")throw I.arg;return I.type==="break"||I.type==="continue"?this.next=I.arg:I.type==="return"?(this.rval=this.arg=I.arg,this.method="return",this.next="end"):I.type==="normal"&&R&&(this.next=R),b},finish:function(I){for(var R=this.tryEntries.length-1;R>=0;--R){var M=this.tryEntries[R];if(M.finallyLoc===I)return this.complete(M.completion,M.afterLoc),J(M),b}},catch:function(I){for(var R=this.tryEntries.length-1;R>=0;--R){var M=this.tryEntries[R];if(M.tryLoc===I){var F=M.completion;if(F.type==="throw"){var L=F.arg;J(M)}return L}}throw Error("illegal catch attempt")},delegateYield:function(I,R,M){return this.delegate={iterator:U(I),resultName:R,nextLoc:M},this.method==="next"&&(this.arg=e),b}},t}function WC(e,t,n,r,o,i,s){try{var a=e[i](s),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,o)}function KC(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){WC(i,r,o,s,a,"next",l)}function a(l){WC(i,r,o,s,a,"throw",l)}s(void 0)})}}var Qs=y.lazy(function(){return y.union([y.string(),y.number(),y.boolean(),y.null(),y.array(Qs),y.record(Qs)])}),K7=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.string(),value:Qs}).strict(),y.object({op:y.literal("remove"),path:y.string()}).strict(),y.object({op:y.literal("replace"),path:y.string(),value:Qs}).strict(),y.object({op:y.literal("move"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("copy"),from:y.string(),path:y.string()}).strict(),y.object({op:y.literal("test"),path:y.string(),value:Qs}).strict(),y.object({op:y.literal("file"),path:y.string(),filePath:y.string(),value:y.string(),remote:y.boolean()}).strict()]);y.array(K7);var q7=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.array(y.string()),value:Qs}).strict(),y.object({op:y.literal("remove"),path:y.array(y.string()).nonempty()}).strict(),y.object({op:y.literal("replace"),path:y.array(y.string()),value:Qs}).strict(),y.object({op:y.literal("move"),from:y.array(y.string()).nonempty(),path:y.array(y.string())}).strict(),y.object({op:y.literal("copy"),from:y.array(y.string()),path:y.array(y.string())}).strict(),y.object({op:y.literal("test"),path:y.array(y.string()),value:Qs}).strict(),y.object({op:y.literal("file"),path:y.array(y.string()),filePath:y.string(),nestedFilePath:y.array(y.string()).optional(),value:y.string(),remote:y.boolean()}).strict()]),cb=y.array(q7),an=y.string().refine(function(e){return!0}),G7=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:an})]);y.object({patch:cb,parentRef:G7});var Y7=y.string().transform(function(e){return e}),J7=y.object({type:y.literal("string"),options:y.object({maxLength:y.number().optional(),minLength:y.number().optional(),regexp:y.object({source:y.string(),flags:y.string()}).optional()}).optional(),opt:y.boolean(),raw:y.boolean()}),ub=y.object({type:y.literal("literal"),value:y.string(),opt:y.boolean()}),X7=y.object({type:y.literal("boolean"),opt:y.boolean()}),Z7=y.object({type:y.literal("number"),options:y.object({max:y.number().optional(),min:y.number().optional()}).optional(),opt:y.boolean()}),aA=y.lazy(function(){return y.object({type:y.literal("object"),items:y.record(Lp),opt:y.boolean()})}),Q7=y.lazy(function(){return y.object({type:y.literal("array"),item:Lp,opt:y.boolean()})}),eK=y.lazy(function(){return y.union([y.object({type:y.literal("union"),key:ub,items:y.array(ub),opt:y.boolean()}),y.object({type:y.literal("union"),key:y.string(),items:y.array(aA),opt:y.boolean()})])}),tK=y.object({ext:y.union([y.tuple([y.literal("jpg")]),y.tuple([y.literal("webp")])]).optional(),directory:y.string().optional(),prefix:y.string().optional(),accept:y.string().optional()}),lA=y.object({type:y.literal("image"),options:tK.optional(),opt:y.boolean()}),nK=y.object({style:y.object({bold:y.boolean().optional(),italic:y.boolean().optional(),lineThrough:y.boolean().optional()}).optional(),block:y.object({h1:y.boolean().optional(),h2:y.boolean().optional(),h3:y.boolean().optional(),h4:y.boolean().optional(),h5:y.boolean().optional(),h6:y.boolean().optional(),ul:y.boolean().optional(),ol:y.boolean().optional()}).optional(),inline:y.object({a:y.boolean().optional(),img:y.union([y.boolean(),lA]).optional()}).optional()}),rK=y.object({type:y.literal("richtext"),options:nK.optional(),opt:y.boolean()}),oK=y.lazy(function(){return y.object({type:y.literal("record"),item:Lp,opt:y.boolean()})}),iK=y.lazy(function(){return y.object({type:y.literal("keyOf"),path:Y7,schema:Lp,values:y.union([y.literal("string"),y.array(y.string())]),opt:y.boolean()})}),sK=y.object({accept:y.string().optional()}),aK=y.object({type:y.literal("file"),options:sK.optional(),opt:y.boolean()}),lK=y.object({type:y.literal("date"),opt:y.boolean()}),Lp=y.union([J7,ub,X7,Z7,aA,Q7,eK,rK,oK,iK,aK,lK,lA]),Ba=y.string().refine(function(e){return!0}),qC=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:an})]),GC=y.object({project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.string()}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional()}),cK=y.union([y.literal("image:change-extension"),y.literal("image:add-metadata"),y.literal("image:check-metadata"),y.literal("image:check-remote"),y.literal("image:upload-remote"),y.literal("image:download-remote"),y.literal("file:change-extension"),y.literal("file:add-metadata"),y.literal("file:check-metadata"),y.literal("file:check-remote"),y.literal("file:upload-remote"),y.literal("file:download-remote"),y.literal("keyof:check-keys")]),uK=y.object({message:y.string(),value:y.unknown().optional(),fatal:y.boolean().optional(),fixes:y.array(cK).optional()}),wi=y.object({status:y.literal(401),json:y.object({message:y.string()})}),dK=y.object({status:y.literal(404),json:y.object({message:y.string()})}),Gt=y.object({message:y.string()}),YC=y.union([y.object({patchId:an,message:y.string()}),y.object({parentPatchId:y.string(),message:y.string()})]),x0=y.object({message:y.string(),path:Ba.optional()});y.union([y.literal("val_session"),y.literal("val_enable"),y.literal("val_state")]);var Th=y.object({value:y.literal("true"),options:y.object({httpOnly:y.literal(!1),sameSite:y.literal("lax")})}),fK={"/draft/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:gt({},Da,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:gt({},Da,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(302),redirectTo:y.string()}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/draft/stat":{GET:{req:{cookies:gt({},Da,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(200),json:y.object({draftMode:y.boolean()})})])}},"/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:gt({},Da,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(gt(gt({},Qu,Th),Zu,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(gt({},Qu,Th))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:gt({},Da,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(gt({},Qu,y.object({value:y.literal("false")})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/authorize":{GET:{req:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(gt(gt({},Qu,Th),Zu,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("lax"),expires:y.instanceof(Date)})})))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/callback":{GET:{req:{query:{code:y.string().optional(),state:y.string().optional()},cookies:gt({},Zu,y.string())},res:y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(gt(gt(gt({},Zu,y.object({value:y.literal(null)})),Qu,Th.optional()),Da,y.object({value:y.string(),options:y.object({httpOnly:y.literal(!0),sameSite:y.literal("strict"),path:y.string(),secure:y.literal(!0),expires:y.instanceof(Date)}).optional()}).optional()))})}},"/session":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({mode:y.union([y.literal("local"),y.literal("proxy")]),enabled:y.boolean()})}),y.object({status:y.union([y.literal(400),y.literal(401),y.literal(403),y.literal(404),y.literal(500),y.literal(501)]),json:y.object({message:y.string()})}),y.object({status:y.literal(401),json:y.object({message:y.string(),details:y.union([y.string(),y.object({reason:y.string()}),y.object({sub:y.string(),exp:y.number(),token:y.string(),org:y.string(),project:y.string()})])})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/logout":{GET:{req:{},res:y.object({status:y.literal(200),cookies:y.object(gt(gt({},Da,y.object({value:y.literal(null)})),Zu,y.object({value:y.literal(null)})))})}},"/remote/settings":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(200),json:y.object({publicProjectId:y.string(),coreVersion:y.string(),remoteFileBuckets:y.array(y.object({bucket:y.string()}))})}),y.object({status:y.literal(400),json:y.object({errorCode:y.union([y.literal("project-not-configured"),y.literal("error-could-not-get-settings"),y.literal("project-not-configured"),y.literal("pat-error"),y.literal("api-key-missing")]),message:y.string()})}),y.object({status:y.literal(401),json:y.object({errorCode:y.literal("unauthorized").optional(),message:y.string()})}),y.object({status:y.literal(500),json:y.object({message:y.string()})})])}},"/stat":{POST:{req:{body:y.object({schemaSha:y.string(),baseSha:y.string(),patches:y.array(y.string()).optional()}).nullable(),cookies:{val_session:y.string().optional()}},res:y.union([y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(500),json:Gt}),y.object({status:y.literal(503),json:Gt}),y.object({status:y.literal(200),json:y.union([y.object({type:y.union([y.literal("request-again"),y.literal("no-change"),y.literal("did-change")]),baseSha:y.string(),schemaSha:y.string(),patches:y.array(an),config:GC,mode:y.union([y.literal("http"),y.literal("fs"),y.literal("unknown")])}),y.object({type:y.literal("use-websocket"),url:y.string(),nonce:y.string(),baseSha:y.string(),schemaSha:y.string(),commitSha:y.string(),patches:y.array(an),config:GC,mode:y.union([y.literal("http"),y.literal("fs"),y.literal("unknown")])})])})])}},"/patches":{DELETE:{req:{query:{id:y.array(an)},cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(500),json:y.object({message:y.string(),errors:y.array(YC)})}),y.object({status:y.literal(200),json:y.array(an)})])},PUT:{req:{body:y.object({parentRef:qC,patches:y.array(y.object({path:Ba,patch:cb}))}),cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(409),json:y.object({type:y.literal("patch-head-conflict"),message:y.string()})}),y.object({status:y.literal(400),json:y.object({type:y.literal("patch-error"),message:y.string(),errors:y.record(Ba,y.array(y.object({error:Gt})))})}),y.object({status:y.literal(200),json:y.object({newPatchIds:y.array(an),parentRef:qC})})])},GET:{req:{query:{patch_id:y.array(an).optional(),exclude_patch_ops:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(500),json:y.object({message:y.string(),patchErrors:y.array(YC)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),error:Gt})}),y.object({status:y.literal(200),json:y.object({patches:y.array(y.object({path:Ba,patch:cb.optional(),patchId:an,createdAt:y.string(),authorId:y.string().nullable(),appliedAt:y.object({commitSha:y.string()}).nullable()})),baseSha:y.string(),error:Gt.optional(),errors:y.record(an,Gt).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(x0)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Gt)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),schemas:y.record(Ba,Lp)})})])}},"/sources/~":{PUT:{req:{path:y.string().optional(),query:{validate_all:y.boolean().optional(),validate_sources:y.boolean().optional(),validate_binary_files:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(401),json:Gt}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.union([y.array(x0),Gt])})}),y.object({status:y.literal(409),json:y.object({message:y.string()})}),y.object({status:y.literal(400),json:y.object({message:y.string(),details:y.array(x0)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),modules:y.record(Ba,y.object({source:y.any(),patches:y.object({applied:y.array(an),skipped:y.array(an).optional(),errors:y.record(an,Gt).optional()}).optional(),validationErrors:y.record(y.string(),y.array(uK)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(200),json:y.object({profiles:y.array(y.object({profileId:y.string(),fullName:y.string(),avatar:y.object({url:y.string()}).nullable()}))})})])}},"/commit-summary":{GET:{req:{query:{patch_id:y.array(an)},cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(400),json:y.object({message:y.string()})}),y.object({status:y.literal(200),json:y.object({patchIds:y.array(an),baseSha:y.string(),commitSummary:y.string().nullable()})})])}},"/save":{POST:{req:{body:y.object({message:y.string().optional(),patchIds:y.array(an)}),cookies:{val_session:y.string().optional()}},res:y.union([wi,y.object({status:y.literal(200),json:y.object({})}),y.object({status:y.literal(409),json:y.object({message:y.string(),isNotFastForward:y.literal(!0)})}),y.object({status:y.literal(400),json:y.union([y.object({message:y.string(),details:y.union([y.object({sourceFilePatchErrors:y.record(Ba,y.array(Gt)),binaryFilePatchErrors:y.record(Gt)}),y.array(Gt)])}),y.object({message:y.string(),errorCode:y.union([y.literal("project-not-configured"),y.literal("pat-error")])})])})])}},"/files":{GET:{req:{path:y.string(),query:{patch_id:an.optional(),remote:y.string().optional()}},res:y.union([wi,dK,y.object({status:y.literal(200),body:y.instanceof(ReadableStream)})])}}},cA=function(t){var n=fK;return function(){var r=KC(cd().mark(function o(i,s,a){var l,c,u,d,p,h,m,v,b,x,w,k,C,_,O,T,j;return cd().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:if(u=a,d=i,u!=null&&u.path&&u.path.length>0&&(d+=u.path),u.query){for(p=[],h=0,m=Object.keys(u.query);h<m.length;h++)if(b=m[h],Array.isArray((v=u.query)===null||v===void 0?void 0:v[b])){w=pS(((x=u.query)===null||x===void 0?void 0:x[b])||[]);try{for(w.s();!(k=w.n()).done;)C=k.value,p.push([b,C.toString()])}catch(V){w.e(V)}finally{w.f()}}else p.push([b,u==null||(_=u.query)===null||_===void 0?void 0:_[b]]);u!=null&&u.query&&p.length>0&&(d+="?".concat(new URLSearchParams(p).toString()))}if(O=n==null||(l=n[i])===null||l===void 0?void 0:l[s],O){D.next=7;break}return D.abrupt("return",{status:null,json:{message:"Invalid route ".concat(i," with method ").concat(s,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(i," with method ").concat(s," not found."),data:{routes:Object.keys(n||{}),methods:Object.keys((n==null?void 0:n[i])||{}),route:i,method:s}}}});case 7:if(T=(c=O.req.body)===null||c===void 0?void 0:c.safeParse(u.body),!(T&&!T.success)){D.next=11;break}return console.error("Invalid request body",{body:u.body,error:T.error}),D.abrupt("return",{status:null,json:{message:"Invalid request body. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:VC(T.error).toString(),data:u.body}}});case 11:return D.prev=11,D.next=14,fetch("".concat(t).concat(d),{method:s,headers:{"Content-Type":"application/json"},body:u.body!==void 0?JSON.stringify(u.body):void 0}).then(function(){var V=KC(cd().mark(function W(J){var X,U,I,R,M;return cd().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(U=J.headers.get("content-type"),U!=null&&U.includes("application/json")){L.next=3;break}return L.abrupt("return",{status:null,json:{type:"client_side_validation_error",message:"Invalid response (expected JSON, but got something else). This could be a result of mismatched Val versions or a transient error. ".concat(J.status),details:{validationError:"Invalid content type",data:{status:J.status,contentType:U}}}});case 3:return L.next=5,J.json();case 5:if(I=L.sent,R={status:J.status,json:I},J.status!==500){L.next=10;break}return console.log("Server responded with an error",I),L.abrupt("return",{status:500,json:Mi({type:"unknown",message:I.message},I)});case 10:if(M=(X=O.res)===null||X===void 0?void 0:X.safeParse(R),!(M&&!M.success)){L.next=13;break}return L.abrupt("return",{status:null,json:{message:"Response could not be validated. This could also be a result of mismatched Val versions.",type:"client_side_validation_error",details:{validationError:VC(M.error).toString(),data:R}}});case 13:return L.abrupt("return",{status:J.status,json:I});case 14:case"end":return L.stop()}},W)}));return function(W){return V.apply(this,arguments)}}());case 14:return j=D.sent,D.abrupt("return",j);case 18:return D.prev=18,D.t0=D.catch(11),D.abrupt("return",{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:pK(D.t0),details:D.t0 instanceof Error?D.t0.message:JSON.stringify(D.t0)}});case 21:case"end":return D.stop()}},o,null,[[11,18]])}));return function(o,i,s){return r.apply(this,arguments)}}()};function pK(e){if(e instanceof TypeError)return!0;if(e instanceof Error&&"code"in e){var t=e.code,n=["ECONNRESET","ETIMEDOUT","ENOTFOUND","EAI_AGAIN"];return n.includes(t)}return!1}function hK(e){if(Array.isArray(e))return e}function mK(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function gK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
367
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vK(e,t){return hK(e)||mK(e,t)||fS(e,t)||gK()}var ug=function(){var t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1];if(n){var r=Object.entries(n).flatMap(function(i){var s=vK(i,2),a=s[0],l=s[1];return l?[[a,l.toString()]]:[]}),o=new URLSearchParams(r);return"".concat(t+"?"+o.toString())}return"".concat(t)};function yK(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:p,children:h,...m}=d,v=(p==null?void 0:p[e][l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:h})}function u(d,p){const h=(p==null?void 0:p[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,xK(o,...t)]}function xK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Av(e){const t=e+"CollectionProvider",[n,r]=yK(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:m,children:v}=h,b=_e.useRef(null),x=_e.useRef(new Map).current;return f.jsx(o,{scope:m,itemMap:x,collectionRef:b,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=_e.forwardRef((h,m)=>{const{scope:v,children:b}=h,x=i(a,v),w=Ue(m,x.collectionRef);return f.jsx(Gi,{ref:w,children:b})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=_e.forwardRef((h,m)=>{const{scope:v,children:b,...x}=h,w=_e.useRef(null),k=Ue(m,w),C=i(c,v);return _e.useEffect(()=>(C.itemMap.set(w,{ref:w,...x}),()=>void C.itemMap.delete(w))),f.jsx(Gi,{[u]:"",ref:k,children:b})});d.displayName=c;function p(h){const m=i(e+"CollectionConsumer",h);return _e.useCallback(()=>{const b=m.collectionRef.current;if(!b)return[];const x=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((C,_)=>x.indexOf(C.ref.current)-x.indexOf(_.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},p,r]}var hS="Collapsible",[bK,uA]=Wo(hS),[wK,mS]=bK(hS),dA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=ro({prop:r,defaultProp:o,onChange:s});return f.jsx(wK,{scope:n,disabled:i,contentId:Zr(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:f.jsx(Pe.div,{"data-state":vS(l),"data-disabled":i?"":void 0,...a,ref:t})})});dA.displayName=hS;var fA="CollapsibleTrigger",pA=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=mS(fA,n);return f.jsx(Pe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":vS(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:se(e.onClick,o.onOpenToggle)})});pA.displayName=fA;var gS="CollapsibleContent",hA=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=mS(gS,e.__scopeCollapsible);return f.jsx(On,{present:n||o.open,children:({present:i})=>f.jsx(SK,{...r,ref:t,present:i})})});hA.displayName=gS;var SK=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=mS(gS,n),[a,l]=g.useState(r),c=g.useRef(null),u=Ue(t,c),d=g.useRef(0),p=d.current,h=g.useRef(0),m=h.current,v=s.open||a,b=g.useRef(v),x=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(w)},[]),En(()=>{const w=c.current;if(w){x.current=x.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const k=w.getBoundingClientRect();d.current=k.height,h.current=k.width,b.current||(w.style.transitionDuration=x.current.transitionDuration,w.style.animationName=x.current.animationName),l(r)}},[s.open,r]),f.jsx(Pe.div,{"data-state":vS(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function vS(e){return e?"open":"closed"}var kK=dA,EK=pA,CK=hA,ns="Accordion",_K=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[yS,NK,TK]=Av(ns),[Iv,$pe]=Wo(ns,[TK,uA]),xS=uA(),bS=_e.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return f.jsx(yS.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?f.jsx(jK,{...i,ref:t}):f.jsx(PK,{...o,ref:t})})});bS.displayName=ns;var[mA,OK]=Iv(ns),[gA,MK]=Iv(ns,{collapsible:!1}),PK=_e.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=ro({prop:n,defaultProp:r,onChange:o});return f.jsx(mA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:_e.useCallback(()=>i&&l(""),[i,l]),children:f.jsx(gA,{scope:e.__scopeAccordion,collapsible:i,children:f.jsx(vA,{...s,ref:t})})})}),jK=_e.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=ro({prop:n,defaultProp:r,onChange:o}),l=_e.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=_e.useCallback(u=>a((d=[])=>d.filter(p=>p!==u)),[a]);return f.jsx(mA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:f.jsx(gA,{scope:e.__scopeAccordion,collapsible:!0,children:f.jsx(vA,{...i,ref:t})})})}),[RK,Dv]=Iv(ns),vA=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=_e.useRef(null),l=Ue(a,t),c=NK(n),d=Tp(o)==="ltr",p=se(e.onKeyDown,h=>{var j;if(!_K.includes(h.key))return;const m=h.target,v=c().filter(A=>{var D;return!((D=A.ref.current)!=null&&D.disabled)}),b=v.findIndex(A=>A.ref.current===m),x=v.length;if(b===-1)return;h.preventDefault();let w=b;const k=0,C=x-1,_=()=>{w=b+1,w>C&&(w=k)},O=()=>{w=b-1,w<k&&(w=C)};switch(h.key){case"Home":w=k;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(d?_():O());break;case"ArrowDown":i==="vertical"&&_();break;case"ArrowLeft":i==="horizontal"&&(d?O():_());break;case"ArrowUp":i==="vertical"&&O();break}const T=w%x;(j=v[T].ref.current)==null||j.focus()});return f.jsx(RK,{scope:n,disabled:r,direction:o,orientation:i,children:f.jsx(yS.Slot,{scope:n,children:f.jsx(Pe.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:p})})})}),dg="AccordionItem",[AK,wS]=Iv(dg),yA=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Dv(dg,n),s=OK(dg,n),a=xS(n),l=Zr(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return f.jsx(AK,{scope:n,open:c,disabled:u,triggerId:l,children:f.jsx(kK,{"data-orientation":i.orientation,"data-state":EA(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:d=>{d?s.onItemOpen(r):s.onItemClose(r)}})})});yA.displayName=dg;var xA="AccordionHeader",bA=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Dv(ns,n),i=wS(xA,n);return f.jsx(Pe.h3,{"data-orientation":o.orientation,"data-state":EA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});bA.displayName=xA;var db="AccordionTrigger",wA=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Dv(ns,n),i=wS(db,n),s=MK(db,n),a=xS(n);return f.jsx(yS.ItemSlot,{scope:n,children:f.jsx(EK,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});wA.displayName=db;var SA="AccordionContent",kA=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Dv(ns,n),i=wS(SA,n),s=xS(n);return f.jsx(CK,{role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation,...s,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});kA.displayName=SA;function EA(e){return e?"open":"closed"}var IK=bS,DK=yA,LK=bA,CA=wA,_A=kA;const fb=IK,zf=g.forwardRef(({className:e,...t},n)=>f.jsx(DK,{ref:n,className:Ke("border-b",e),...t}));zf.displayName="AccordionItem";const Bf=g.forwardRef(({className:e,children:t,...n},r)=>f.jsx(LK,{className:"flex",children:f.jsxs(CA,{ref:r,className:Ke("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,f.jsx(Np,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));Bf.displayName=CA.displayName;const $f=g.forwardRef(({className:e,children:t,...n},r)=>f.jsx(_A,{ref:r,className:Ke("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:f.jsx("div",{className:"pt-0 pb-4",children:t})}));$f.displayName=_A.displayName;function FK(){const e=M1(),{isPublishing:t}=yu(),{globalErrors:n,validationErrors:r}=mi(),o=Cp(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in r){const[u]=de.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[r]);return f.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",children:[f.jsx("div",{className:"h-16 border-b border-border-primary",children:f.jsx($K,{})}),t&&f.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 text-right border-t bg-bg-tertiary text-text-primary border-border-primary",children:[f.jsx("span",{children:"Publishing changes "}),f.jsx(xu,{size:16,className:"animate-spin"})]}),f.jsx(Ya,{children:f.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[f.jsx(RR,{}),n&&n.length>0&&n.length!==s&&f.jsx(fb,{type:"single",collapsible:!0,children:f.jsxs(zf,{value:"global-errors",children:[f.jsxs(Bf,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-text-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",n==null?void 0:n.length," errors in all."," ",n.length-s," were non-validation errors. A developer might need to fix these issues."]}),f.jsx($f,{children:f.jsx(Ya,{children:f.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[320px]",children:n==null?void 0:n.map((a,l)=>f.jsx(BK,{error:a},l))})})})]})}),(n==null?void 0:n.length)===s&&i.length>0&&f.jsx(fb,{type:"single",collapsible:!0,children:f.jsxs(zf,{value:"global-errors",children:[f.jsx(Bf,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-text-error-primary",children:f.jsxs("div",{children:[f.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),f.jsx("div",{children:"Found errors in modules"})]})}),f.jsx($f,{children:f.jsx(Ya,{children:f.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[320px]",children:i==null?void 0:i.map((a,l)=>f.jsx(zK,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&f.jsx("div",{className:Ne("",{}),children:f.jsx(Ya,{children:f.jsx("div",{className:"max-h-[calc(100svh-128px)] border-b border-border-primary",children:f.jsx(cR,{loadingStatus:e})})})})]})})]})}function zK({moduleFilePath:e}){const t=de.splitModuleFilePath(e),n=hr();return f.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-text-error-primary border-border-error",children:f.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:Ke("text-text-brand-secondary",{"ml-1":o>0}),children:"/"}),f.jsx("span",{children:fa(r)})]},o))})})}function BK({error:e}){const[t,n]=g.useState(!1);return f.jsx("div",{className:Ke("px-1 py-2 bg-bg-error-primary text-text-error-primary border-b border-border-error",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function $K(){const{publish:e,publishDisabled:t}=yu(),n=Cp(),{navMenu:r,toolsMenu:o}=yy();return f.jsx("div",{className:"flex flex-col",children:f.jsxs("div",{className:"flex items-center justify-between w-full gap-2 p-4",children:[f.jsx("button",{className:"lg:hidden",onClick:()=>{o.setOpen(!o.isOpen)},children:f.jsx(eg,{size:16,className:Ne("transform",{"rotate-180":!r.isOpen})})}),f.jsxs("div",{className:"flex items-center justify-end w-full gap-2",children:[f.jsxs(nn,{className:"flex items-center gap-2",variant:"outline",onClick:()=>{window.location.href=ug("/api/val/enable",{redirect_to:window.origin})},children:[f.jsx("span",{children:"Preview"}),f.jsx(jP,{size:16})]}),f.jsxs(nn,{className:"flex items-center gap-2",disabled:t,onClick:()=>{e()},children:[f.jsx("span",{children:n==="fs"?"Save":"Publish"}),f.jsx(P1,{size:16})]})]})]})})}function qt({error:e}){return f.jsx("div",{children:f.jsx("div",{className:"p-4 bg-bg-error-primary text-text-error-primary",children:e})})}function ht({path:e,type:t}){return f.jsx("div",{className:Ne("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:f.jsx(xu,{size:t==="module"?24:16,className:"animate-spin"})})}function Cn({path:e,type:t}){const[n,r]=g.useState(!1);return g.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?f.jsx("div",{className:"pt-6",children:f.jsx("div",{children:"Could not get data"})}):f.jsx(ht,{path:e,type:t})}function mr({actualType:e,expectedType:t}){return f.jsx("div",{children:f.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function rt({error:e}){return f.jsx("div",{children:f.jsxs("div",{className:"p-4 rounded bg-bg-error-primary text-text-primary",children:["Source error: ",e]})})}function VK(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const Lv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Eu(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function SS(e){return"nodeType"in e}function gr(e){var t,n;return e?Eu(e)?e:SS(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function kS(e){const{Document:t}=gr(e);return e instanceof t}function Fp(e){return Eu(e)?!1:e instanceof gr(e).HTMLElement}function NA(e){return e instanceof gr(e).SVGElement}function Cu(e){return e?Eu(e)?e.document:SS(e)?kS(e)?e:Fp(e)||NA(e)?e.ownerDocument:document:document:document}const ui=Lv?g.useLayoutEffect:g.useEffect;function ES(e){const t=g.useRef(e);return ui(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function UK(){const e=g.useRef(null),t=g.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Vf(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ui(()=>{n.current!==e&&(n.current=e)},t),n}function zp(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function fg(e){const t=ES(e),n=g.useRef(null),r=g.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function pb(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let b0={};function Bp(e,t){return g.useMemo(()=>{if(t)return t;const n=b0[e]==null?0:b0[e]+1;return b0[e]=n,e+"-"+n},[e,t])}function TA(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const Rc=TA(1),Uf=TA(-1);function HK(e){return"clientX"in e&&"clientY"in e}function CS(e){if(!e)return!1;const{KeyboardEvent:t}=gr(e.target);return t&&e instanceof t}function WK(e){if(!e)return!1;const{TouchEvent:t}=gr(e.target);return t&&e instanceof t}function hb(e){if(WK(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return HK(e)?{x:e.clientX,y:e.clientY}:null}const Hf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Hf.Translate.toString(e),Hf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),JC="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function KK(e){return e.matches(JC)?e:e.querySelector(JC)}const qK={display:"none"};function GK(e){let{id:t,value:n}=e;return _e.createElement("div",{id:t,style:qK},n)}function YK(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return _e.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function JK(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const OA=g.createContext(null);function XK(e){const t=g.useContext(OA);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ZK(){const[e]=g.useState(()=>new Set),t=g.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[g.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const QK={draggable:`
368
- To pick up a draggable item, press the space bar.
369
- While dragging, use the arrow keys to move the item.
370
- Press space again to drop the item in its new position, or press escape to cancel.
371
- `},eq={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tq(e){let{announcements:t=eq,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=QK}=e;const{announce:i,announcement:s}=JK(),a=Bp("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),XK(g.useMemo(()=>({onDragStart(d){let{active:p}=d;i(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:h}=d;t.onDragMove&&i(t.onDragMove({active:p,over:h}))},onDragOver(d){let{active:p,over:h}=d;i(t.onDragOver({active:p,over:h}))},onDragEnd(d){let{active:p,over:h}=d;i(t.onDragEnd({active:p,over:h}))},onDragCancel(d){let{active:p,over:h}=d;i(t.onDragCancel({active:p,over:h}))}}),[i,t])),!l)return null;const u=_e.createElement(_e.Fragment,null,_e.createElement(GK,{id:r,value:o.draggable}),_e.createElement(YK,{id:a,announcement:s}));return n?Or.createPortal(u,n):u}var Zt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Zt||(Zt={}));function pg(){}function w0(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function nq(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const $o=Object.freeze({x:0,y:0});function MA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function PA(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function rq(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function XC(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function jA(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ZC(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const oq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ZC(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=MA(ZC(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(PA)},iq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=XC(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=XC(l),u=o.reduce((p,h,m)=>p+MA(c[m],h),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(PA)};function sq(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const aq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=sq(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(rq)};function lq(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function RA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$o}function cq(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const uq=cq(1);function dq(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function fq(e,t,n){const r=dq(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const pq={ignoreTransform:!1};function _u(e,t){t===void 0&&(t=pq);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=gr(e).getComputedStyle(e);c&&(n=fq(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function QC(e){return _u(e,{ignoreTransform:!0})}function hq(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function mq(e,t){return t===void 0&&(t=gr(e).getComputedStyle(e)),t.position==="fixed"}function gq(e,t){t===void 0&&(t=gr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Fv(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(kS(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Fp(o)||NA(o)||n.includes(o))return n;const i=gr(e).getComputedStyle(o);return o!==e&&gq(o,i)&&n.push(o),mq(o,i)?n:r(o.parentNode)}return e?r(e):n}function AA(e){const[t]=Fv(e,1);return t??null}function S0(e){return!Lv||!e?null:Eu(e)?e:SS(e)?kS(e)||e===Cu(e).scrollingElement?window:Fp(e)?e:null:null}function IA(e){return Eu(e)?e.scrollX:e.scrollLeft}function DA(e){return Eu(e)?e.scrollY:e.scrollTop}function mb(e){return{x:IA(e),y:DA(e)}}var un;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(un||(un={}));function LA(e){return!Lv||!e?!1:e===document.scrollingElement}function FA(e){const t={x:0,y:0},n=LA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const vq={x:.2,y:.2};function yq(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=vq);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=FA(e),h={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(h.y=un.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(h.y=un.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!p&&a>=t.right-v.width?(h.x=un.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=un.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:m}}function xq(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function zA(e){return e.reduce((t,n)=>Rc(t,mb(n)),$o)}function bq(e){return e.reduce((t,n)=>t+IA(n),0)}function wq(e){return e.reduce((t,n)=>t+DA(n),0)}function Sq(e,t){if(t===void 0&&(t=_u),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);AA(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const kq=[["x",["left","right"],bq],["y",["top","bottom"],wq]];class _S{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Fv(n),o=zA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of kq)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Hd{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Eq(e){const{EventTarget:t}=gr(e);return e instanceof t?e:Cu(e)}function k0(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Wr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Wr||(Wr={}));function e_(e){e.preventDefault()}function Cq(e){e.stopPropagation()}var Qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Qe||(Qe={}));const BA={start:[Qe.Space,Qe.Enter],cancel:[Qe.Esc],end:[Qe.Space,Qe.Enter,Qe.Tab]},_q=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Qe.Right:return{...n,x:n.x+25};case Qe.Left:return{...n,x:n.x-25};case Qe.Down:return{...n,y:n.y+25};case Qe.Up:return{...n,y:n.y-25}}};class NS{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Hd(Cu(n)),this.windowListeners=new Hd(gr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Wr.Resize,this.handleCancel),this.windowListeners.add(Wr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Wr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Sq(r),n($o)}handleKeyDown(t){if(CS(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=BA,coordinateGetter:s=_q,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:$o;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=Uf(d,u),h={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const b=t.code,{isTop:x,isRight:w,isLeft:k,isBottom:C,maxScroll:_,minScroll:O}=FA(v),T=xq(v),j={x:Math.min(b===Qe.Right?T.right-T.width/2:T.right,Math.max(b===Qe.Right?T.left:T.left+T.width/2,d.x)),y:Math.min(b===Qe.Down?T.bottom-T.height/2:T.bottom,Math.max(b===Qe.Down?T.top:T.top+T.height/2,d.y))},A=b===Qe.Right&&!w||b===Qe.Left&&!k,D=b===Qe.Down&&!C||b===Qe.Up&&!x;if(A&&j.x!==d.x){const V=v.scrollLeft+p.x,W=b===Qe.Right&&V<=_.x||b===Qe.Left&&V>=O.x;if(W&&!p.y){v.scrollTo({left:V,behavior:a});return}W?h.x=v.scrollLeft-V:h.x=b===Qe.Right?v.scrollLeft-_.x:v.scrollLeft-O.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(D&&j.y!==d.y){const V=v.scrollTop+p.y,W=b===Qe.Down&&V<=_.y||b===Qe.Up&&V>=O.y;if(W&&!p.x){v.scrollTo({top:V,behavior:a});return}W?h.y=v.scrollTop-V:h.y=b===Qe.Down?v.scrollTop-_.y:v.scrollTop-O.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,Rc(Uf(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}NS.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=BA,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function t_(e){return!!(e&&"distance"in e)}function n_(e){return!!(e&&"delay"in e)}class TS{constructor(t,n,r){var o;r===void 0&&(r=Eq(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=Cu(s),this.documentListeners=new Hd(this.document),this.listeners=new Hd(r),this.windowListeners=new Hd(gr(s)),this.initialCoordinates=(o=hb(i))!=null?o:$o,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Wr.Resize,this.handleCancel),this.windowListeners.add(Wr.DragStart,e_),this.windowListeners.add(Wr.VisibilityChange,this.handleCancel),this.windowListeners.add(Wr.ContextMenu,e_),this.documentListeners.add(Wr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(n_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(t_(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Wr.Click,Cq,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Wr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=hb(t))!=null?n:$o,c=Uf(o,l);if(!r&&a){if(t_(a)){if(a.tolerance!=null&&k0(c,a.tolerance))return this.handleCancel();if(k0(c,a.distance))return this.handleStart()}if(n_(a)&&k0(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Nq={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $A extends TS{constructor(t){const{event:n}=t,r=Cu(n.target);super(t,Nq,r)}}$A.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Tq={move:{name:"mousemove"},end:{name:"mouseup"}};var gb;(function(e){e[e.RightClick=2]="RightClick"})(gb||(gb={}));class VA extends TS{constructor(t){super(t,Tq,Cu(t.event.target))}}VA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===gb.RightClick?!1:(r==null||r({event:n}),!0)}}];const E0={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class UA extends TS{constructor(t){super(t,E0)}static setup(){return window.addEventListener(E0.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(E0.move.name,t)};function t(){}}}UA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Wd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Wd||(Wd={}));var hg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hg||(hg={}));function Oq(e){let{acceleration:t,activator:n=Wd.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=hg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const h=Pq({delta:d,disabled:!i}),[m,v]=UK(),b=g.useRef({x:0,y:0}),x=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case Wd.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Wd.DraggableRect:return o}},[n,o,l]),k=g.useRef(null),C=g.useCallback(()=>{const O=k.current;if(!O)return;const T=b.current.x*x.current.x,j=b.current.y*x.current.y;O.scrollBy(T,j)},[]),_=g.useMemo(()=>a===hg.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const O of _){if((r==null?void 0:r(O))===!1)continue;const T=c.indexOf(O),j=u[T];if(!j)continue;const{direction:A,speed:D}=yq(O,j,w,t,p);for(const V of["x","y"])h[V][A[V]]||(D[V]=0,A[V]=0);if(D.x>0||D.y>0){v(),k.current=O,m(C,s),b.current=D,x.current=A;return}}b.current={x:0,y:0},x.current={x:0,y:0},v()},[t,C,r,v,i,s,JSON.stringify(w),JSON.stringify(h),m,c,_,u,JSON.stringify(p)])}const Mq={x:{[un.Backward]:!1,[un.Forward]:!1},y:{[un.Backward]:!1,[un.Forward]:!1}};function Pq(e){let{delta:t,disabled:n}=e;const r=pb(t);return zp(o=>{if(n||!r||!o)return Mq;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[un.Backward]:o.x[un.Backward]||i.x===-1,[un.Forward]:o.x[un.Forward]||i.x===1},y:{[un.Backward]:o.y[un.Backward]||i.y===-1,[un.Forward]:o.y[un.Forward]||i.y===1}}},[n,t,r])}function jq(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return zp(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Rq(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Wf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Wf||(Wf={}));var vb;(function(e){e.Optimized="optimized"})(vb||(vb={}));const r_=new Map;function Aq(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),d=b(),p=Vf(d),h=g.useCallback(function(x){x===void 0&&(x=[]),!p.current&&s(w=>w===null?x:w.concat(x.filter(k=>!w.includes(k))))},[p]),m=g.useRef(null),v=zp(x=>{if(d&&!n)return r_;if(!x||x===r_||u.current!==e||i!=null){const w=new Map;for(let k of e){if(!k)continue;if(i&&i.length>0&&!i.includes(k.id)&&k.rect.current){w.set(k.id,k.rect.current);continue}const C=k.node.current,_=C?new _S(l(C),C):null;k.rect.current=_,_&&w.set(k.id,_)}return w}return x},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||h()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{h(),m.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function b(){switch(c){case Wf.Always:return!1;case Wf.BeforeDragging:return n;default:return!n}}}function HA(e,t){return zp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Iq(e,t){return HA(e,t)}function Dq(e){let{callback:t,disabled:n}=e;const r=ES(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function zv(e){let{callback:t,disabled:n}=e;const r=ES(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Lq(e){return new _S(_u(e),e)}function o_(e,t,n){t===void 0&&(t=Lq);const[r,o]=g.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Dq({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=zv({callback:i});return ui(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function Fq(e){const t=HA(e);return RA(e,t)}const i_=[];function zq(e){const t=g.useRef(e),n=zp(r=>e?r&&r!==i_&&e&&t.current&&e.parentNode===t.current.parentNode?r:Fv(e):i_,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function Bq(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=S0(i.target);s&&n(a=>a?(a.set(s,mb(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=S0(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,mb(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=S0(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Rc(i,s),$o):zA(e):$o,[e,t])}function s_(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==$o;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Uf(e,n.current):$o}function $q(e){g.useEffect(()=>{if(!Lv)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Vq(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function WA(e){return g.useMemo(()=>e?hq(e):null,[e])}const a_=[];function Uq(e,t){t===void 0&&(t=_u);const[n]=e,r=WA(n?gr(n):null),[o,i]=g.useState(a_);function s(){i(()=>e.length?e.map(l=>LA(l)?r:new _S(t(l),l)):a_)}const a=zv({callback:s});return ui(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function Hq(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Fp(t)?t:e}function Wq(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(Fp(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),i=zv({callback:o}),s=g.useCallback(c=>{const u=Hq(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=fg(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Kq=[{sensor:$A,options:{}},{sensor:NS,options:{}}],qq={current:{}},em={draggable:{measure:QC},droppable:{measure:QC,strategy:Wf.WhileDragging,frequency:vb.Optimized},dragOverlay:{measure:_u}};class Kd extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Gq={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Kd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:em,measureDroppableContainers:pg,windowRect:null,measuringScheduled:!1},Yq={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:pg,draggableNodes:new Map,over:null,measureDroppableContainers:pg},Bv=g.createContext(Yq),KA=g.createContext(Gq);function Jq(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Kd}}}function Xq(e,t){switch(t.type){case Zt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Zt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Zt.DragEnd:case Zt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zt.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Kd(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Zt.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Kd(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case Zt.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Kd(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Zq(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(Bv),i=pb(r),s=pb(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!CS(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=KK(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function Qq(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function eG(e){return g.useMemo(()=>({draggable:{...em.draggable,...e==null?void 0:e.draggable},droppable:{...em.droppable,...e==null?void 0:e.droppable},dragOverlay:{...em.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function tG(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ui(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=RA(u,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=AA(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const qA=g.createContext({...$o,scaleX:1,scaleY:1});var Ns;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ns||(Ns={}));const nG=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Kq,collisionDetection:d=aq,measuring:p,modifiers:h,...m}=t;const v=g.useReducer(Xq,void 0,Jq),[b,x]=v,[w,k]=ZK(),[C,_]=g.useState(Ns.Uninitialized),O=C===Ns.Initialized,{draggable:{active:T,nodes:j,translate:A},droppable:{containers:D}}=b,V=T!=null?j.get(T):null,W=g.useRef({initial:null,translated:null}),J=g.useMemo(()=>{var Mn;return T!=null?{id:T,data:(Mn=V==null?void 0:V.data)!=null?Mn:qq,rect:W}:null},[T,V]),X=g.useRef(null),[U,I]=g.useState(null),[R,M]=g.useState(null),F=Vf(m,Object.values(m)),L=Bp("DndDescribedBy",s),B=g.useMemo(()=>D.getEnabled(),[D]),K=eG(p),{droppableRects:be,measureDroppableContainers:ae,measuringScheduled:le}=Aq(B,{dragging:O,dependencies:[A.x,A.y],config:K.droppable}),re=jq(j,T),$=g.useMemo(()=>R?hb(R):null,[R]),Y=X4(),ne=Iq(re,K.draggable.measure);tG({activeNode:T!=null?j.get(T):null,config:Y.layoutShiftCompensation,initialRect:ne,measure:K.draggable.measure});const te=o_(re,K.draggable.measure,ne),we=o_(re?re.parentElement:null),ce=g.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:be,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ze=D.getNodeFor((n=ce.current.over)==null?void 0:n.id),je=Wq({measure:K.dragOverlay.measure}),mt=(r=je.nodeRef.current)!=null?r:re,N=O?(o=je.rect)!=null?o:te:null,S=!!(je.nodeRef.current&&je.rect),E=Fq(S?null:te),P=WA(mt?gr(mt):null),z=zq(O?ze??re:null),G=Uq(z),Q=Qq(h,{transform:{x:A.x-E.x,y:A.y-E.y,scaleX:1,scaleY:1},activatorEvent:R,active:J,activeNodeRect:te,containerNodeRect:we,draggingNodeRect:N,over:ce.current.over,overlayNodeRect:je.rect,scrollableAncestors:z,scrollableAncestorRects:G,windowRect:P}),Xe=$?Rc($,A):null,at=Bq(z),yt=s_(at),sn=s_(at,[te]),ct=Rc(Q,yt),fo=N?uq(N,Q):null,ss=J&&fo?d({active:J,collisionRect:fo,droppableRects:be,droppableContainers:B,pointerCoordinates:Xe}):null,Au=jA(ss,"id"),[as,Ak]=g.useState(null),K4=S?Q:Rc(Q,sn),q4=lq(K4,(i=as==null?void 0:as.rect)!=null?i:null,te),xy=g.useRef(null),Ik=g.useCallback((Mn,yr)=>{let{sensor:xr,options:ls}=yr;if(X.current==null)return;const Ur=j.get(X.current);if(!Ur)return;const br=Mn.nativeEvent,qo=new xr({active:X.current,activeNode:Ur,event:br,options:ls,context:ce,onAbort(vn){if(!j.get(vn))return;const{onDragAbort:Go}=F.current,yi={id:vn};Go==null||Go(yi),w({type:"onDragAbort",event:yi})},onPending(vn,cs,Go,yi){if(!j.get(vn))return;const{onDragPending:Du}=F.current,us={id:vn,constraint:cs,initialCoordinates:Go,offset:yi};Du==null||Du(us),w({type:"onDragPending",event:us})},onStart(vn){const cs=X.current;if(cs==null)return;const Go=j.get(cs);if(!Go)return;const{onDragStart:yi}=F.current,Iu={activatorEvent:br,active:{id:cs,data:Go.data,rect:W}};Or.unstable_batchedUpdates(()=>{yi==null||yi(Iu),_(Ns.Initializing),x({type:Zt.DragStart,initialCoordinates:vn,active:cs}),w({type:"onDragStart",event:Iu}),I(xy.current),M(br)})},onMove(vn){x({type:Zt.DragMove,coordinates:vn})},onEnd:Bl(Zt.DragEnd),onCancel:Bl(Zt.DragCancel)});xy.current=qo;function Bl(vn){return async function(){const{active:Go,collisions:yi,over:Iu,scrollAdjustedTranslate:Du}=ce.current;let us=null;if(Go&&Du){const{cancelDrop:Lu}=F.current;us={activatorEvent:br,active:Go,collisions:yi,delta:Du,over:Iu},vn===Zt.DragEnd&&typeof Lu=="function"&&await Promise.resolve(Lu(us))&&(vn=Zt.DragCancel)}X.current=null,Or.unstable_batchedUpdates(()=>{x({type:vn}),_(Ns.Uninitialized),Ak(null),I(null),M(null),xy.current=null;const Lu=vn===Zt.DragEnd?"onDragEnd":"onDragCancel";if(us){const by=F.current[Lu];by==null||by(us),w({type:Lu,event:us})}})}}},[j]),G4=g.useCallback((Mn,yr)=>(xr,ls)=>{const Ur=xr.nativeEvent,br=j.get(ls);if(X.current!==null||!br||Ur.dndKit||Ur.defaultPrevented)return;const qo={active:br};Mn(xr,yr.options,qo)===!0&&(Ur.dndKit={capturedBy:yr.sensor},X.current=ls,Ik(xr,yr))},[j,Ik]),Dk=Rq(u,G4);$q(u),ui(()=>{te&&C===Ns.Initializing&&_(Ns.Initialized)},[te,C]),g.useEffect(()=>{const{onDragMove:Mn}=F.current,{active:yr,activatorEvent:xr,collisions:ls,over:Ur}=ce.current;if(!yr||!xr)return;const br={active:yr,activatorEvent:xr,collisions:ls,delta:{x:ct.x,y:ct.y},over:Ur};Or.unstable_batchedUpdates(()=>{Mn==null||Mn(br),w({type:"onDragMove",event:br})})},[ct.x,ct.y]),g.useEffect(()=>{const{active:Mn,activatorEvent:yr,collisions:xr,droppableContainers:ls,scrollAdjustedTranslate:Ur}=ce.current;if(!Mn||X.current==null||!yr||!Ur)return;const{onDragOver:br}=F.current,qo=ls.get(Au),Bl=qo&&qo.rect.current?{id:qo.id,rect:qo.rect.current,data:qo.data,disabled:qo.disabled}:null,vn={active:Mn,activatorEvent:yr,collisions:xr,delta:{x:Ur.x,y:Ur.y},over:Bl};Or.unstable_batchedUpdates(()=>{Ak(Bl),br==null||br(vn),w({type:"onDragOver",event:vn})})},[Au]),ui(()=>{ce.current={activatorEvent:R,active:J,activeNode:re,collisionRect:fo,collisions:ss,droppableRects:be,draggableNodes:j,draggingNode:mt,draggingNodeRect:N,droppableContainers:D,over:as,scrollableAncestors:z,scrollAdjustedTranslate:ct},W.current={initial:N,translated:fo}},[J,re,ss,fo,j,mt,N,be,D,as,z,ct]),Oq({...Y,delta:A,draggingRect:fo,pointerCoordinates:Xe,scrollableAncestors:z,scrollableAncestorRects:G});const Y4=g.useMemo(()=>({active:J,activeNode:re,activeNodeRect:te,activatorEvent:R,collisions:ss,containerNodeRect:we,dragOverlay:je,draggableNodes:j,droppableContainers:D,droppableRects:be,over:as,measureDroppableContainers:ae,scrollableAncestors:z,scrollableAncestorRects:G,measuringConfiguration:K,measuringScheduled:le,windowRect:P}),[J,re,te,R,ss,we,je,j,D,be,as,ae,z,G,K,le,P]),J4=g.useMemo(()=>({activatorEvent:R,activators:Dk,active:J,activeNodeRect:te,ariaDescribedById:{draggable:L},dispatch:x,draggableNodes:j,over:as,measureDroppableContainers:ae}),[R,Dk,J,te,x,L,j,as,ae]);return _e.createElement(OA.Provider,{value:k},_e.createElement(Bv.Provider,{value:J4},_e.createElement(KA.Provider,{value:Y4},_e.createElement(qA.Provider,{value:q4},c)),_e.createElement(Zq,{disabled:(a==null?void 0:a.restoreFocus)===!1})),_e.createElement(tq,{...a,hiddenTextDescribedById:L}));function X4(){const Mn=(U==null?void 0:U.autoScrollEnabled)===!1,yr=typeof l=="object"?l.enabled===!1:l===!1,xr=O&&!Mn&&!yr;return typeof l=="object"?{...l,enabled:xr}:{enabled:xr}}}),rG=g.createContext(null),l_="button",oG="Draggable";function iG(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Bp(oG),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=g.useContext(Bv),{role:h=l_,roleDescription:m="draggable",tabIndex:v=0}=o??{},b=(l==null?void 0:l.id)===t,x=g.useContext(b?qA:rG),[w,k]=fg(),[C,_]=fg(),O=Vq(s,t),T=Vf(n);ui(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:C,data:T}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const j=g.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&h===l_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,h,v,b,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:j,isDragging:b,listeners:r?void 0:O,node:w,over:p,setNodeRef:k,setActivatorNodeRef:_,transform:x}}function sG(){return g.useContext(KA)}const aG="Droppable",lG={timeout:25};function cG(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Bp(aG),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(Bv),u=g.useRef({disabled:n}),d=g.useRef(!1),p=g.useRef(null),h=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:b}={...lG,...o},x=Vf(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),h.current=null},b)},[b]),k=zv({callback:w,disabled:m||!s}),C=g.useCallback((j,A)=>{k&&(A&&(k.unobserve(A),d.current=!1),j&&k.observe(j))},[k]),[_,O]=fg(C),T=Vf(t);return g.useEffect(()=>{!k||!_.current||(k.disconnect(),d.current=!1,k.observe(_.current))},[_,k]),g.useEffect(()=>(a({type:Zt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:p,data:T}}),()=>a({type:Zt.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:Zt.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:p,isOver:(l==null?void 0:l.id)===r,node:_,over:l,setNodeRef:O}}function OS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function uG(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Oh(e){return e!==null&&e>=0}function dG(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function fG(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const GA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=OS(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Mh={scaleX:1,scaleY:1},pG=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...Mh}:null}const l=hG(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Mh}:o<n&&o>=s?{x:0,y:a.height+l,...Mh}:{x:0,y:0,...Mh}};function hG(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const YA="Sortable",JA=_e.createContext({activeIndex:-1,containerId:YA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:GA,disabled:{draggable:!1,droppable:!1}});function mG(e){let{children:t,id:n,items:r,strategy:o=GA,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=sG(),d=Bp(YA,n),p=a.rect!==null,h=g.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),m=s!=null,v=s?h.indexOf(s.id):-1,b=c?h.indexOf(c.id):-1,x=g.useRef(h),w=!dG(h,x.current),k=b!==-1&&v===-1||w,C=fG(i);ui(()=>{w&&m&&u(h)},[w,h,m,u]),g.useEffect(()=>{x.current=h},[h]);const _=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:C,disableTransforms:k,items:h,overIndex:b,useDragOverlay:p,sortedRects:uG(h,l),strategy:o}),[v,d,C.draggable,C.droppable,k,h,b,l,p,o]);return _e.createElement(JA.Provider,{value:_},t)}const gG=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return OS(n,r,o).indexOf(t)},vG=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},yG={duration:200,easing:"ease"},XA="transform",xG=Hf.Transition.toString({property:XA,duration:0,easing:"linear"}),bG={roleDescription:"sortable"};function wG(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return ui(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=_u(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function SG(e){let{animateLayoutChanges:t=vG,attributes:n,disabled:r,data:o,getNewIndex:i=gG,id:s,strategy:a,resizeObserverConfig:l,transition:c=yG}=e;const{items:u,containerId:d,activeIndex:p,disabled:h,disableTransforms:m,sortedRects:v,overIndex:b,useDragOverlay:x,strategy:w}=g.useContext(JA),k=kG(r,h),C=u.indexOf(s),_=g.useMemo(()=>({sortable:{containerId:d,index:C,items:u},...o}),[d,o,C,u]),O=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:T,node:j,isOver:A,setNodeRef:D}=cG({id:s,data:_,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:V,activatorEvent:W,activeNodeRect:J,attributes:X,setNodeRef:U,listeners:I,isDragging:R,over:M,setActivatorNodeRef:F,transform:L}=iG({id:s,data:_,attributes:{...bG,...n},disabled:k.draggable}),B=VK(D,U),K=!!V,be=K&&!m&&Oh(p)&&Oh(b),ae=!x&&R,le=ae&&be?L:null,$=be?le??(a??w)({rects:v,activeNodeRect:J,activeIndex:p,overIndex:b,index:C}):null,Y=Oh(p)&&Oh(b)?i({id:s,items:u,activeIndex:p,overIndex:b}):C,ne=V==null?void 0:V.id,te=g.useRef({activeId:ne,items:u,newIndex:Y,containerId:d}),we=u!==te.current.items,ce=t({active:V,containerId:d,isDragging:R,isSorting:K,id:s,index:C,items:u,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:c,wasDragging:te.current.activeId!=null}),ze=wG({disabled:!ce,index:C,node:j,rect:T});return g.useEffect(()=>{K&&te.current.newIndex!==Y&&(te.current.newIndex=Y),d!==te.current.containerId&&(te.current.containerId=d),u!==te.current.items&&(te.current.items=u)},[K,Y,d,u]),g.useEffect(()=>{if(ne===te.current.activeId)return;if(ne&&!te.current.activeId){te.current.activeId=ne;return}const mt=setTimeout(()=>{te.current.activeId=ne},50);return()=>clearTimeout(mt)},[ne]),{active:V,activeIndex:p,attributes:X,data:_,rect:T,index:C,newIndex:Y,items:u,isOver:A,isSorting:K,isDragging:R,listeners:I,node:j,overIndex:b,over:M,setNodeRef:B,setActivatorNodeRef:F,setDroppableNodeRef:D,setDraggableNodeRef:U,transform:ze??$,transition:je()};function je(){if(ze||we&&te.current.newIndex===C)return xG;if(!(ae&&!CS(W)||!c)&&(K||ce))return Hf.Transition.toString({...c,property:XA})}}function kG(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function mg(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const EG=[Qe.Down,Qe.Right,Qe.Up,Qe.Left],CG=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(EG.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=o.get(d.id);if(p)switch(e.code){case Qe.Down:r.top<p.top&&l.push(d);break;case Qe.Up:r.top>p.top&&l.push(d);break;case Qe.Left:r.left>p.left&&l.push(d);break;case Qe.Right:r.left<p.left&&l.push(d);break}});const c=iq({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=jA(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),p=i.get(u),h=p?o.get(p.id):null,m=p==null?void 0:p.node.current;if(m&&h&&d&&p){const b=Fv(m).some((O,T)=>a[T]!==O),x=ZA(d,p),w=_G(d,p),k=b||!x?{x:0,y:0}:{x:w?r.width-h.width:0,y:w?r.height-h.height:0},C={x:h.left,y:h.top};return k.x&&k.y?C:Uf(C,k)}}}};function ZA(e,t){return!mg(e)||!mg(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function _G(e,t){return!mg(e)||!mg(t)||!ZA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Nu=g.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:Ke("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Nu.displayName="Input";function Ir({path:e}){const{validationErrors:t}=mi(),n=hr(),r=[];for(const o in t)o.startsWith(e)&&r.push(...t[o].map(i=>({...i,path:o})));return r.length===0?null:r.length===1?f.jsxs("div",{className:"p-4 font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx("div",{children:r[0].message}),e!==r[0].path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at"," ",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(r[0].path)},children:r[0].path})]})]}):f.jsx(bS,{type:"single",collapsible:!0,children:f.jsxs(zf,{value:"validation-errors",className:"font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx(Bf,{className:"p-4",children:f.jsxs("div",{className:"flex justify-between w-full",children:[f.jsx("span",{className:"truncate",children:"Multiple validation errors"}),f.jsxs("span",{className:"pr-4",children:["(",r.length,")"]})]})}),f.jsx($f,{children:r.map(o=>f.jsxs("div",{className:"px-4",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]},o.path))})]})})}function QA({path:e,autoFocus:t}){const n="string",r=Lt(e),o=st(e,n),{patchPath:i,addDebouncedPatch:s}=Tn(e),[a,l]=g.useState(!1),[c,u]=g.useState(null);return g.useEffect(()=>{!a&&"data"in o&&o.data!==void 0&&u(o.data)},["data"in o&&o.data,a]),g.useEffect(()=>{if("data"in o&&o.data!==void 0&&c!==null&&o.data!==c){const d=setTimeout(()=>{console.warn(`Mis-matched strings: '${o.data}' and '${c}'. Patching...`),s(()=>[{op:"replace",path:i,value:c}],e)},3e3);return()=>{clearTimeout(d)}}},["data"in o&&o.data,c]),r.status==="error"?f.jsx(qt,{path:e,error:r.error,type:n}):o.status==="error"?f.jsx(rt,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?f.jsx(Cn,{path:e,type:n}):r.status==="loading"?f.jsx(ht,{path:e,type:n}):!("data"in o)||o.data===void 0?f.jsx(ht,{path:e,type:n}):r.data.type!==n?f.jsx(mr,{path:e,expectedType:n,actualType:r.data.type}):f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsxs("div",{className:"relative w-full",children:[f.jsx(Nu,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,onFocus:()=>{l(!0)},onBlur:()=>{l(!1)},value:c||"",onChange:d=>{u(d.target.value),s(()=>[{op:"replace",path:i,value:d.target.value}],e)}}),f.jsx("span",{className:Ne("absolute right-0 -translate-x-full top-4 duration-1000",{"opacity-0":o.data===c,"opacity-100":o.data!==c}),children:f.jsx(xu,{className:"transition-opacity animate-spin",size:12})})]})]})}function NG({path:e}){const t=st(e,"string");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function TG({path:e}){const t="boolean",n=Lt(e),r=st(e,t),{patchPath:o,addPatch:i}=Tn(e);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(rt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(n.status==="loading")return f.jsx(ht,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(ht,{path:e,type:t});if(n.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx(Dp,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}])}})]})}function OG({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=Tn(e);return typeof t!="boolean"&&t!==null?f.jsx(rt,{path:e,error:"Expected boolean",type:"boolean"}):f.jsx(Dp,{disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}])}})}function MG({path:e}){const t=st(e,"boolean");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):t.data===!0?f.jsx("div",{className:"flex items-center justify-center w-4 h-4 border rounded border-text-primary",children:f.jsx(_p,{className:"w-3 h-3"})}):t.data===!1?f.jsx("div",{className:"w-4 h-4 border rounded border-text-primary"}):(console.warn("Unexpected value for boolean field",t.data),f.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function PG({path:e}){const t="number",n=Lt(e),r=st(e,t),{patchPath:o,addPatch:i}=Tn(e);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(rt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(n.status==="loading")return f.jsx(ht,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(ht,{path:e,type:t});if(n.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx(Nu,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}])}})]})}function jG({path:e}){const t=st(e,"number");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}var RG="VisuallyHidden",e2=g.forwardRef((e,t)=>f.jsx(Pe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));e2.displayName=RG;var AG=[" ","Enter","ArrowUp","ArrowDown"],IG=[" ","Enter"],$p="Select",[$v,Vv,DG]=Av($p),[Tu,Vpe]=Wo($p,[DG,Ta]),Uv=Ta(),[LG,Ma]=Tu($p),[FG,zG]=Tu($p),t2=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:h,form:m}=e,v=Uv(t),[b,x]=g.useState(null),[w,k]=g.useState(null),[C,_]=g.useState(!1),O=Tp(c),[T=!1,j]=ro({prop:r,defaultProp:o,onChange:i}),[A,D]=ro({prop:s,defaultProp:a,onChange:l}),V=g.useRef(null),W=b?m||!!b.closest("form"):!0,[J,X]=g.useState(new Set),U=Array.from(J).map(I=>I.props.value).join(";");return f.jsx(Cv,{...v,children:f.jsxs(LG,{required:h,scope:t,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:_,contentId:Zr(),value:A,onValueChange:D,open:T,onOpenChange:j,dir:O,triggerPointerDownPosRef:V,disabled:p,children:[f.jsx($v.Provider,{scope:t,children:f.jsx(FG,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(I=>{X(R=>new Set(R).add(I))},[]),onNativeOptionRemove:g.useCallback(I=>{X(R=>{const M=new Set(R);return M.delete(I),M})},[]),children:n})}),W?f.jsxs(E2,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:A,onChange:I=>D(I.target.value),disabled:p,form:m,children:[A===void 0?f.jsx("option",{value:""}):null,Array.from(J)]},U):null]})})};t2.displayName=$p;var n2="SelectTrigger",r2=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Uv(n),s=Ma(n2,n),a=s.disabled||r,l=Ue(t,s.onTriggerChange),c=Vv(n),u=g.useRef("touch"),[d,p,h]=C2(v=>{const b=c().filter(k=>!k.disabled),x=b.find(k=>k.value===s.value),w=_2(b,v,x);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),h()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return f.jsx(Pp,{asChild:!0,...i,children:f.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":k2(s.value)?"":void 0,...o,ref:l,onClick:se(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:se(o.onPointerDown,v=>{u.current=v.pointerType;const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:se(o.onKeyDown,v=>{const b=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&p(v.key),!(b&&v.key===" ")&&AG.includes(v.key)&&(m(),v.preventDefault())})})})});r2.displayName=n2;var o2="SelectValue",i2=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Ma(o2,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Ue(t,l.onValueNodeChange);return En(()=>{c(u)},[c,u]),f.jsx(Pe.span,{...a,ref:d,style:{pointerEvents:"none"},children:k2(l.value)?f.jsx(f.Fragment,{children:s}):i})});i2.displayName=o2;var BG="SelectIcon",s2=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(Pe.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});s2.displayName=BG;var $G="SelectPortal",a2=e=>f.jsx(jp,{asChild:!0,...e});a2.displayName=$G;var kl="SelectContent",l2=g.forwardRef((e,t)=>{const n=Ma(kl,e.__scopeSelect),[r,o]=g.useState();if(En(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Or.createPortal(f.jsx(c2,{scope:e.__scopeSelect,children:f.jsx($v.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),i):null}return f.jsx(u2,{...e,ref:t})});l2.displayName=kl;var yo=10,[c2,Pa]=Tu(kl),VG="SelectContentImpl",u2=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:b,...x}=e,w=Ma(kl,n),[k,C]=g.useState(null),[_,O]=g.useState(null),T=Ue(t,$=>C($)),[j,A]=g.useState(null),[D,V]=g.useState(null),W=Vv(n),[J,X]=g.useState(!1),U=g.useRef(!1);g.useEffect(()=>{if(k)return Tv(k)},[k]),wv();const I=g.useCallback($=>{const[Y,...ne]=W().map(ce=>ce.ref.current),[te]=ne.slice(-1),we=document.activeElement;for(const ce of $)if(ce===we||(ce==null||ce.scrollIntoView({block:"nearest"}),ce===Y&&_&&(_.scrollTop=0),ce===te&&_&&(_.scrollTop=_.scrollHeight),ce==null||ce.focus(),document.activeElement!==we))return},[W,_]),R=g.useCallback(()=>I([j,k]),[I,j,k]);g.useEffect(()=>{J&&R()},[J,R]);const{onOpenChange:M,triggerPointerDownPosRef:F}=w;g.useEffect(()=>{if(k){let $={x:0,y:0};const Y=te=>{var we,ce;$={x:Math.abs(Math.round(te.pageX)-(((we=F.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(te.pageY)-(((ce=F.current)==null?void 0:ce.y)??0))}},ne=te=>{$.x<=10&&$.y<=10?te.preventDefault():k.contains(te.target)||M(!1),document.removeEventListener("pointermove",Y),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",Y),document.addEventListener("pointerup",ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",ne,{capture:!0})}}},[k,M,F]),g.useEffect(()=>{const $=()=>M(!1);return window.addEventListener("blur",$),window.addEventListener("resize",$),()=>{window.removeEventListener("blur",$),window.removeEventListener("resize",$)}},[M]);const[L,B]=C2($=>{const Y=W().filter(we=>!we.disabled),ne=Y.find(we=>we.ref.current===document.activeElement),te=_2(Y,$,ne);te&&setTimeout(()=>te.ref.current.focus())}),K=g.useCallback(($,Y,ne)=>{const te=!U.current&&!ne;(w.value!==void 0&&w.value===Y||te)&&(A($),te&&(U.current=!0))},[w.value]),be=g.useCallback(()=>k==null?void 0:k.focus(),[k]),ae=g.useCallback(($,Y,ne)=>{const te=!U.current&&!ne;(w.value!==void 0&&w.value===Y||te)&&V($)},[w.value]),le=r==="popper"?yb:d2,re=le===yb?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:b}:{};return f.jsx(c2,{scope:n,content:k,viewport:_,onViewportChange:O,itemRefCallback:K,selectedItem:j,onItemLeave:be,itemTextRefCallback:ae,focusSelectedItem:R,selectedItemText:D,position:r,isPositioned:J,searchRef:L,children:f.jsx(Rp,{as:Gi,allowPinchZoom:!0,children:f.jsx(Op,{asChild:!0,trapped:w.open,onMountAutoFocus:$=>{$.preventDefault()},onUnmountAutoFocus:se(o,$=>{var Y;(Y=w.trigger)==null||Y.focus({preventScroll:!0}),$.preventDefault()}),children:f.jsx(wu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:$=>$.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(le,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:$=>$.preventDefault(),...x,...re,onPlaced:()=>X(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:se(x.onKeyDown,$=>{const Y=$.ctrlKey||$.altKey||$.metaKey;if($.key==="Tab"&&$.preventDefault(),!Y&&$.key.length===1&&B($.key),["ArrowUp","ArrowDown","Home","End"].includes($.key)){let te=W().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes($.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes($.key)){const we=$.target,ce=te.indexOf(we);te=te.slice(ce+1)}setTimeout(()=>I(te)),$.preventDefault()}})})})})})})});u2.displayName=VG;var UG="SelectItemAlignedPosition",d2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Ma(kl,n),s=Pa(kl,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=Ue(t,T=>u(T)),p=Vv(n),h=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:x,focusSelectedItem:w}=s,k=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&b&&x){const T=i.trigger.getBoundingClientRect(),j=c.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),D=x.getBoundingClientRect();if(i.dir!=="rtl"){const we=D.left-j.left,ce=A.left-we,ze=T.left-ce,je=T.width+ze,mt=Math.max(je,j.width),N=window.innerWidth-yo,S=Xx(ce,[yo,Math.max(yo,N-mt)]);a.style.minWidth=je+"px",a.style.left=S+"px"}else{const we=j.right-D.right,ce=window.innerWidth-A.right-we,ze=window.innerWidth-T.right-ce,je=T.width+ze,mt=Math.max(je,j.width),N=window.innerWidth-yo,S=Xx(ce,[yo,Math.max(yo,N-mt)]);a.style.minWidth=je+"px",a.style.right=S+"px"}const V=p(),W=window.innerHeight-yo*2,J=v.scrollHeight,X=window.getComputedStyle(c),U=parseInt(X.borderTopWidth,10),I=parseInt(X.paddingTop,10),R=parseInt(X.borderBottomWidth,10),M=parseInt(X.paddingBottom,10),F=U+I+J+M+R,L=Math.min(b.offsetHeight*5,F),B=window.getComputedStyle(v),K=parseInt(B.paddingTop,10),be=parseInt(B.paddingBottom,10),ae=T.top+T.height/2-yo,le=W-ae,re=b.offsetHeight/2,$=b.offsetTop+re,Y=U+I+$,ne=F-Y;if(Y<=ae){const we=V.length>0&&b===V[V.length-1].ref.current;a.style.bottom="0px";const ce=c.clientHeight-v.offsetTop-v.offsetHeight,ze=Math.max(le,re+(we?be:0)+ce+R),je=Y+ze;a.style.height=je+"px"}else{const we=V.length>0&&b===V[0].ref.current;a.style.top="0px";const ze=Math.max(ae,U+v.offsetTop+(we?K:0)+re)+ne;a.style.height=ze+"px",v.scrollTop=Y-ae+v.offsetTop}a.style.margin=`${yo}px 0`,a.style.minHeight=L+"px",a.style.maxHeight=W+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,a,c,v,b,x,i.dir,r]);En(()=>k(),[k]);const[C,_]=g.useState();En(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const O=g.useCallback(T=>{T&&m.current===!0&&(k(),w==null||w(),m.current=!1)},[k,w]);return f.jsx(WG,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:O,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:f.jsx(Pe.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});d2.displayName=UG;var HG="SelectPopperPosition",yb=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=yo,...i}=e,s=Uv(n);return f.jsx(_v,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});yb.displayName=HG;var[WG,MS]=Tu(kl,{}),xb="SelectViewport",f2=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Pa(xb,n),s=MS(xb,n),a=Ue(t,i.onViewportChange),l=g.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx($v.Slot,{scope:n,children:f.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:se(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=s;if(p!=null&&p.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const m=window.innerHeight-yo*2,v=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),x=Math.max(v,b);if(x<m){const w=x+h,k=Math.min(m,w),C=w-k;d.style.height=k+"px",d.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});f2.displayName=xb;var p2="SelectGroup",[KG,qG]=Tu(p2),GG=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Zr();return f.jsx(KG,{scope:n,id:o,children:f.jsx(Pe.div,{role:"group","aria-labelledby":o,...r,ref:t})})});GG.displayName=p2;var h2="SelectLabel",m2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=qG(h2,n);return f.jsx(Pe.div,{id:o.id,...r,ref:t})});m2.displayName=h2;var gg="SelectItem",[YG,g2]=Tu(gg),v2=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Ma(gg,n),l=Pa(gg,n),c=a.value===r,[u,d]=g.useState(i??""),[p,h]=g.useState(!1),m=Ue(t,w=>{var k;return(k=l.itemRefCallback)==null?void 0:k.call(l,w,r,o)}),v=Zr(),b=g.useRef("touch"),x=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(YG,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(k=>k||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx($v.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(Pe.div,{role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:se(s.onFocus,()=>h(!0)),onBlur:se(s.onBlur,()=>h(!1)),onClick:se(s.onClick,()=>{b.current!=="mouse"&&x()}),onPointerUp:se(s.onPointerUp,()=>{b.current==="mouse"&&x()}),onPointerDown:se(s.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:se(s.onPointerMove,w=>{var k;b.current=w.pointerType,o?(k=l.onItemLeave)==null||k.call(l):b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:se(s.onPointerLeave,w=>{var k;w.currentTarget===document.activeElement&&((k=l.onItemLeave)==null||k.call(l))}),onKeyDown:se(s.onKeyDown,w=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&w.key===" "||(IG.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})})})})});v2.displayName=gg;var ud="SelectItemText",y2=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Ma(ud,n),a=Pa(ud,n),l=g2(ud,n),c=zG(ud,n),[u,d]=g.useState(null),p=Ue(t,x=>d(x),l.onItemTextChange,x=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,x,l.value,l.disabled)}),h=u==null?void 0:u.textContent,m=g.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=c;return En(()=>(v(m),()=>b(m)),[v,b,m]),f.jsxs(f.Fragment,{children:[f.jsx(Pe.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Or.createPortal(i.children,s.valueNode):null]})});y2.displayName=ud;var x2="SelectItemIndicator",b2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return g2(x2,n).isSelected?f.jsx(Pe.span,{"aria-hidden":!0,...r,ref:t}):null});b2.displayName=x2;var bb="SelectScrollUpButton",JG=g.forwardRef((e,t)=>{const n=Pa(bb,e.__scopeSelect),r=MS(bb,e.__scopeSelect),[o,i]=g.useState(!1),s=Ue(t,r.onScrollButtonChange);return En(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx(w2,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});JG.displayName=bb;var wb="SelectScrollDownButton",XG=g.forwardRef((e,t)=>{const n=Pa(wb,e.__scopeSelect),r=MS(wb,e.__scopeSelect),[o,i]=g.useState(!1),s=Ue(t,r.onScrollButtonChange);return En(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx(w2,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});XG.displayName=wb;var w2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Pa("SelectScrollButton",n),s=g.useRef(null),a=Vv(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),En(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),f.jsx(Pe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:se(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:se(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:se(o.onPointerLeave,()=>{l()})})}),ZG="SelectSeparator",S2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(Pe.div,{"aria-hidden":!0,...r,ref:t})});S2.displayName=ZG;var Sb="SelectArrow",QG=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Uv(n),i=Ma(Sb,n),s=Pa(Sb,n);return i.open&&s.position==="popper"?f.jsx(Nv,{...o,...r,ref:t}):null});QG.displayName=Sb;function k2(e){return e===""||e===void 0}var E2=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=Ue(t,o),s=J1(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const d=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(d)}},[s,n]),f.jsx(e2,{asChild:!0,children:f.jsx("select",{...r,ref:i,defaultValue:n})})});E2.displayName="BubbleSelect";function C2(e){const t=Qt(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function _2(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=eY(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function eY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var N2=t2,PS=r2,tY=i2,nY=s2,rY=a2,jS=l2,T2=f2,O2=m2,RS=v2,M2=y2,oY=b2,P2=S2;const AS=N2,IS=tY,Hv=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(PS,{ref:r,className:Ke("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-bg-primary px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(nY,{asChild:!0,children:f.jsx(Np,{className:"w-4 h-4 opacity-50"})})]}));Hv.displayName=PS.displayName;const Wv=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>f.jsx(rY,{container:r,children:f.jsx(jS,{ref:i,className:Ke("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:f.jsx(T2,{className:Ke("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));Wv.displayName=jS.displayName;const iY=g.forwardRef(({className:e,...t},n)=>f.jsx(O2,{ref:n,className:Ke("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));iY.displayName=O2.displayName;const Kv=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(RS,{ref:r,className:Ke("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-text-primary outline-none focus:bg-bg-brand-primary_alt focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(oY,{children:f.jsx(_p,{className:"w-4 h-4"})})}),f.jsx(M2,{children:t})]}));Kv.displayName=RS.displayName;const sY=g.forwardRef(({className:e,...t},n)=>f.jsx(P2,{ref:n,className:Ke("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));sY.displayName=P2.displayName;function ru(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,ru(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?ru(e.items[0]):e.key.value;if(e.type==="date")return ts(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function al(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function aY(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function lY({children:e}){return f.jsx("div",{children:aY(e)})}function j2(e){const[t,n]=de.splitModuleFilePathAndModulePath(e),r=de.joinModuleFilePathAndModulePath(t,de.splitModulePath(n).slice(0,-1).join(".")),o=Lt(r);return{path:r,schema:"data"in o?o.data:void 0}}const c_=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",cY=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",uY=e=>(e==null?void 0:e.type)==="record",dY=e=>(e==null?void 0:e.type)==="array";function fY(e,t,n,r){if(!t[n])return console.error(`Source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,d)=>{var p;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof d=="string"&&d===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(d_(d)||R2(d))for(const h in d){const m=d==null?void 0:d[h],v=u.type==="object"?(p=u.items)==null?void 0:p[h]:u.item;m&&l(u_(c,h),v,m)}}else if(u.type==="array"){if(pY(d)){let h=0;for(const m of d)l(u_(c,h),u.item,m),h++}}else if(u.type==="union"){const h=u.key;if(typeof h=="string"&&d_(d)){const m=d[h];if(typeof m=="string"){const v=u.items.filter(b=>b.type==="object").find(b=>{const x=b.items[h];if((x==null?void 0:x.type)==="literal")return x.value===m});v&&l(c,v,d)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function u_(e,t){return e.includes(aa)?`${e}.${JSON.stringify(t)}`:`${e}${aa}${JSON.stringify(t)}`}function d_(e){return R2(e)}function R2(e){return typeof e=="object"&&!!e&&!Bs(e)}function pY(e){return typeof e=="object"&&!!e&&Bs(e)}function DS({path:e,disabled:t}){const[n,r]=de.splitModuleFilePathAndModulePath(e),o=de.splitModuleFilePath(n),i=de.splitModulePath(r),{navigate:s}=hr();return f.jsxs("div",{className:"w-full",children:[f.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>f.jsxs(g.Fragment,{children:[l===0&&f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:Ne({"text-muted":!(i.length===0&&l===o.length-1)}),children:fa(a)}),l>0&&l<o.length-1&&f.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),f.jsx("button",{type:"button",disabled:t,title:de.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(de.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:Ne({"text-muted":l===i.length-2}),children:fa(a)})]},`${a}-${l}`))})]})}function A2({path:e,variant:t}){const n=Lt(e),{path:r,schema:o}=j2(e),i=I2(e),s=i[i.length-1],a=vY(r,c_(e,r,o)?s==null?void 0:s.part:void 0);return f.jsxs("span",{className:"inline-flex items-center gap-2",children:[c_(e,r,o)&&f.jsxs(f.Fragment,{children:[f.jsx(f_,{refs:a,variant:t}),f.jsx(gY,{defaultValue:s.text,path:e,parentPath:r,variant:t,refs:a}),f.jsx(mY,{path:e,parentPath:r,variant:t,refs:a})]}),dY("data"in n?n.data:void 0)&&f.jsx(hY,{path:e,variant:t}),uY("data"in n?n.data:void 0)&&f.jsxs(f.Fragment,{children:[f.jsx(f_,{refs:a,variant:t}),f.jsx(yY,{path:e,variant:t})]})]})}function f_({refs:e,variant:t}){const n=so();return e.length===0?null:f.jsxs(ga,{children:[f.jsxs(il,{children:[f.jsx(jc,{children:f.jsx(nn,{asChild:!0,size:Vp(t),variant:Up(t),children:f.jsx(Ip,{children:f.jsx(IP,{size:qv(t)})})})}),f.jsx(sl,{side:"top",children:"References to this record"})]}),f.jsx(Xi,{container:n,children:f.jsx("div",{className:"text-sm",children:f.jsx("ul",{children:e.map(r=>f.jsx("li",{children:f.jsx(DS,{path:r})},r))})})})]})}function qv(e){return e==="module"?16:12}function Vp(e){return"icon"}function Up(e){return e==="module"?"outline":"ghost"}function hY({path:e,variant:t}){const{navigate:n}=hr(),{addPatch:r,patchPath:o}=Tn(e),i=Lt(e),s=st(e,"array"),[a]=de.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return f.jsx(nn,{title:"Add",size:Vp(t),variant:Up(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:ru(l.item)}]),l.item.type!=="string"&&n(de.joinModuleFilePathAndModulePath(a,de.patchPathToModulePath(u)))},children:f.jsx(AP,{size:qv(t)})})}function mY({path:e,parentPath:t,variant:n,refs:r}){const{navigate:o}=hr(),{addPatch:i,patchPath:s}=Tn(e),a=st(t,"record");return!("data"in a)||a.data===void 0||a.data===null?(console.error("Parent source not found",a,{path:e}),null):f.jsxs(il,{children:[f.jsx(jc,{children:f.jsx(nn,{size:Vp(n),variant:Up(n),disabled:r.length>0,onClick:()=>{i([{op:"remove",path:s}]),o(t)},children:f.jsx(qV,{size:qv(n)})})}),f.jsx(sl,{side:"top",children:r.length>0?f.jsxs("div",{children:[f.jsx("p",{children:"Cannot delete record."}),f.jsxs("p",{children:["You must change the following references"," ",f.jsx(IP,{size:10,className:"inline"})," to be able to delete:"]}),f.jsx("ul",{children:r.map(l=>f.jsx("li",{children:f.jsx(DS,{path:l})},l))})]}):f.jsx("p",{children:"Delete record"})})]})}function gY({defaultValue:e,path:t,parentPath:n,variant:r,refs:o}){const[i,s]=de.splitModuleFilePathAndModulePath(n),{navigate:a}=hr(),{addPatch:l,addModuleFilePatch:c}=Tn(t),u=st(n,"record"),[d,p]=g.useState(e),[h,m]=g.useState(!1),v=so();g.useEffect(()=>{const w=k=>{k.key==="Escape"&&m(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const b=de.createPatchPath(s);if(!("data"in u)||u.data===void 0||u.data===null)return console.error("Parent source not found",u,{path:t}),null;const x=d===e||d===""||d in u.data;return f.jsxs(ga,{open:h,children:[f.jsxs(il,{children:[f.jsx(jc,{children:f.jsx(nn,{asChild:!0,size:Vp(r),variant:Up(r),children:f.jsx(Ip,{onClick:()=>{m(!0)},children:f.jsx(UV,{size:16})})})}),f.jsx(sl,{side:"top",children:"Change name"})]}),f.jsx(Xi,{container:v,className:"text-text-primary",children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:w=>{w.preventDefault();const k=[{op:"move",from:b.concat(e),path:b.concat(d)}];l(k);for(const C of o){const[_,O]=de.splitModuleFilePathAndModulePath(C),T=de.createPatchPath(O);c(_,[{op:"replace",path:T,value:d}])}a(de.joinModuleFilePathAndModulePath(i,de.patchPathToModulePath(b.concat(d))),{replace:!0}),m(!1)},children:[f.jsx(Nu,{type:"text",value:d,onChange:w=>{p(w.target.value)}}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(nn,{disabled:x,variant:"outline",type:"submit",children:"Update"}),f.jsx(nn,{variant:"ghost",type:"reset",onClick:()=>{m(!1),p(e)},children:"Cancel"})]})]})})]})}function vY(e,t){const n=mv(),r=CP(),o=hV();return g.useMemo(()=>o[e]!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?fY(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}function yY({path:e,variant:t}){const n=st(e,"record"),r=Lt(e),o=so(),{addPatch:i}=Tn(e),[s,a]=g.useState(""),{navigate:l}=hr(),[c,u]=g.useState(!1);if(g.useEffect(()=>{const v=b=>{b.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[]),!("data"in n)||n.data===void 0||n.data===null)return console.error("Source not found",n,{path:e}),null;if(!("data"in r)||r.data===void 0)return console.error("Schema not found",n,{path:e}),null;const d=r.data;if(d.type!=="record")return console.error("Schema is not a record",r,{path:e}),null;const p=s===""||s in n.data,[h,m]=de.splitModuleFilePathAndModulePath(e);return f.jsxs(ga,{open:c,children:[f.jsx(nn,{asChild:!0,size:Vp(t),variant:Up(t),children:f.jsx(Ip,{onClick:()=>{u(!0)},title:"Add",children:f.jsx(AP,{size:qv(t)})})}),f.jsx(Xi,{container:o,children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const b=de.createPatchPath(m).concat(s);i([{op:"add",path:b,value:ru(d.item)}]),l(de.joinModuleFilePathAndModulePath(h,de.patchPathToModulePath(b))),u(!1)},children:[f.jsx(Nu,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),f.jsx("div",{children:f.jsx(nn,{type:"submit",disabled:p,variant:"outline",children:"Add"})})]})})]})}function I2(e){const[t,n]=de.splitModuleFilePathAndModulePath(e),r=de.splitModuleFilePath(t).map(a=>({text:fa(a),part:a,sourcePath:t}));if(!n)return r;const o=de.splitModulePath(n),i=[];let s="";for(let a=0;a<o.length;a++){let l=(s?s+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(s?s+".":"")+o[a]),s=l,i.push({text:o[a],part:o[a],sourcePath:de.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function D2({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var k,C,_;const s=CP(),{validationErrors:a}=mi(),{patchPath:l,addPatch:c}=Tn(n),u=Lt(n),d=st(n,o),[p,h]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var O,T;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((O=u.data)==null?void 0:O.type)==="image"||((T=u.data)==null?void 0:T.type)==="file")&&v(!0)},[d,u]);const b="data"in d?d.data:void 0,x="data"in u&&((k=u.data)==null?void 0:k.type)==="boolean",w="data"in u&&((C=u.data)==null?void 0:C.opt)===!0;return f.jsxs("div",{className:Ne("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":((_=a[n])==null?void 0:_.length)>0}),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[!x&&w&&f.jsx(Dp,{disabled:s==="loading",checked:b!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&b===null?v(!0):c(b===null?[{op:"replace",path:l,value:ru({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}])}}),x&&f.jsx(OG,{path:n,isNullable:w,loadingStatus:s,source:b}),typeof e=="string"&&f.jsx(lY,{children:e}),e&&typeof e!="string"&&e]}),f.jsxs("div",{className:"flex items-center gap-2",children:[b!==null&&f.jsx(A2,{path:n,variant:"field"}),b!==null&&!x&&f.jsxs("button",{onClick:()=>h(O=>!O),className:Ne("transform transition-transform",{"rotate-180":p}),children:[i==="1"&&f.jsx(Np,{size:16}),i==="2"&&f.jsx(CV,{size:16})]})]})]}),!x&&f.jsx(If,{isOpen:p&&(b!==null||m),children:(b!==null||m)&&f.jsx("div",{className:"flex flex-col gap-6 pt-6",children:t})})]})}function xY({path:e}){const t="object",n=Lt(e),r=st(e,t);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(rt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(n.status==="loading")return f.jsx(ht,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(ht,{path:e,type:t});if(n.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=al(e,i);return f.jsx(D2,{label:i,path:a,type:s.type,children:f.jsx(vy,{path:a,schema:s},a)},a)})})]})}function bY({path:e}){const t="object",n=Lt(e);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(n.status==="loading")return f.jsx(ht,{path:e,type:t});if(n.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(n.data.type!=="object")return f.jsx(mr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return f.jsx(L2,{path:e,schema:r})}function L2({path:e,schema:t}){return f.jsx("div",{className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=al(e,n);return f.jsx(wY,{label:n,children:f.jsx(Rk,{path:r})},n)})})}function wY({label:e,children:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:vv(e)}),t]})}function kb(e){return typeof e.key!="string"}function SY({path:e}){const t="union",n=Lt(e),r=st(e,t);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(rt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(n.status==="loading")return f.jsx(ht,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(ht,{path:e,type:t});if(n.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(kb(n.data))return typeof o!="string"&&o!==null?f.jsx(rt,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx(EY,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!kb(n.data))return typeof o!="object"?f.jsx(rt,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?f.jsx(rt,{path:e,error:"Expected source to be an object, but found an array",type:t}):f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx(kY,{path:e,schema:n.data})]})}function kY({path:e,schema:t}){const n=NP(e),{addPatch:r,patchPath:o}=Tn(e),i=so(),s=al(e,t.key),a=st(s,"literal");if(!("data"in a)||a.data===void 0)return f.jsx(ht,{path:e,type:"union"});const l=t.items.find(d=>{var h;const p=(h=d.items)==null?void 0:h[t.key];return p.type==="literal"?p.value===a.data:(console.error("Expected literal schema in object union",p),!1)});if((l==null?void 0:l.items)===void 0)return f.jsx(ht,{path:e,type:"union"});const c=t.items.flatMap(d=>{var h;const p=(h=d.items)==null?void 0:h[t.key];return p.type==="literal"?[p.value]:(console.error("Expected literal schema in object union",p),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),f.jsxs("div",{className:"grid gap-4",children:[f.jsxs(AS,{value:a.data??void 0,onValueChange:d=>{const p=t.items.find(m=>{var b;const v=(b=m.items)==null?void 0:b[t.key];return v.type==="literal"?v.value===d:(console.error("Expected literal schema in object union",v),!1)});if((p==null?void 0:p.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const h=u.current[e][d]||ru(p);h[t.key]=d,r([{op:"replace",path:o,value:h}])},children:[f.jsx(Hv,{children:f.jsx(IS,{children:a.data})}),f.jsx(Wv,{container:i,className:"w-32",children:c==null?f.jsx(F2,{}):c.map(d=>f.jsx(Kv,{value:d,children:d},d))})]}),Object.keys(l==null?void 0:l.items).filter(d=>d!==(t==null?void 0:t.key)).map(d=>{var h,m,v;const p=al(e,d);return f.jsx(D2,{path:p,foldLevel:"1",transparent:!0,label:d,type:(m=(h=l==null?void 0:l.items)==null?void 0:h[d])==null?void 0:m.type,children:f.jsx(vy,{path:p,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},p)})]})}function EY({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=Tn(e),i=so();return f.jsxs(AS,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}])},children:[f.jsx(Hv,{children:f.jsx(IS,{children:t})}),f.jsx(Wv,{className:"w-32",container:i,children:n==null?f.jsx(F2,{}):n.map(s=>f.jsx(Kv,{value:s,children:s},s))})]})}function F2(){return f.jsx("div",{children:"Loading..."})}function CY({path:e}){const t="union",n=NP(e),r=Lt(e);if(n.status==="error")return f.jsx(rt,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return f.jsx(fr,{path:e});if(!("data"in r)||r.data===void 0)return f.jsx(fr,{path:e});if(n.data===null)return f.jsx(pr,{path:e});if(r.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(kb(o))return typeof n.data!="string"?f.jsx(rt,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,type:t}):f.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return f.jsx(pr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return f.jsx(rt,{path:e,error:"Expected source to be an object, but found: "+typeof i,type:t});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!Bs(i))return l.value===i[o.key]});return s?f.jsx(L2,{path:e,schema:s}):f.jsx(rt,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}function z2(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=Pv.Buffer.from(s.split(",")[1],"base64"),c=de.getSHA256Hash(l);if(a.naturalWidth&&a.naturalHeight){const u=de.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,fileHash:c,mimeType:u,fileExt:u&&de.mimeTypeToFileExt(u)})}else t({src:s,filename:r==null?void 0:r.name,fileHash:c})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function _Y(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=Pv.Buffer.from(s.split(",")[1],"base64"),l=de.getSHA256Hash(a),c=de.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,fileHash:l,mimeType:c,fileExt:c&&de.mimeTypeToFileExt(c)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function NY(e){return e.split(".").pop()||""}const TY=new TextEncoder;async function B2(e,t,n,r,o,i,s,a="/public/val"){const l=de.createFilename(t,n,o,r);if(!l||!o)return[];const c=`${a}/${l}`,u=de.remote.hashToRemoteFileHash(r),d=s?de.remote.createRemoteRef(s.remoteHost,{publicProjectId:s.publicProjectId,coreVersion:s.coreVersion,bucket:s.bucket,validationHash:de.remote.getValidationHash(s.coreVersion,s.schema,NY(l),o,u,TY),fileHash:u,filePath:`${a.slice(1)}/${l}`}):c;return[{value:{[bt]:d,[qe]:s?"remote":"file",...i!=="file"?{[Vx]:i}:{},metadata:o},op:"replace",path:e},{value:t,op:"file",path:e,filePath:d,remote:s!==null}]}function OY({path:e}){var v;const t="file",n=Ep(),r=T1(),o=N1(),i=Lt(e),s=st(e,t),{patchPath:a,addPatch:l}=Tn(e),[c,u]=g.useState(null);if(i.status==="error")return f.jsx(qt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(rt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(i.status==="loading")return f.jsx(ht,{path:e,type:t});if(n===void 0)return f.jsx(ht,{path:e,type:t});if(i.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:i.data.type});const d=s.data;if(d===void 0)return f.jsx(Cn,{path:e,type:t});const h=i.data.type==="file"&&i.data.remote&&o.status!=="ready",m=i.data.remote&&o.status==="ready"&&r?{publicProjectId:o.publicProjectId,coreVersion:o.coreVersion,bucket:r,schema:i.data,remoteHost:n.remoteHost}:null;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),c&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:c}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(nn,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`img_input:${e}`,children:"Update"})}),d&&f.jsxs("a",{className:"flex items-center gap-2",href:qe in d&&d[qe]==="remote"?de.convertRemoteSource({...d,[qe]:"remote"}).url:de.convertFileSource({...d,[qe]:"file"}).url,children:[" ",f.jsx("span",{children:" Open file"}),f.jsx($V,{})]}),f.jsx("input",{disabled:h,hidden:!0,id:`img_input:${e}`,type:"file",accept:(v=i.data.options)==null?void 0:v.accept,onChange:b=>{_Y(b).then(x=>{var C;const w={src:x.src,filename:x.filename};let k;x.mimeType&&(k={mimeType:x.mimeType}),u(null),B2(a,w.src,w.filename??null,x.fileHash,k,"file",m,(C=n.files)==null?void 0:C.directory).then(l).catch(_=>{console.error("Failed to create file patch",_),u("Could not upload file. Please try again later")})})}})]})]})}function MY({path:e}){const t=st(e,"image");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx(RP,{size:12})}function PY({path:e}){var x,w,k,C;const t="image",n=Ep(),r=N1(),o=T1(),i=Lt(e),s=st(e,t),{patchPath:a,addPatch:l}=Tn(e),[c,u]=g.useState(void 0),[d,p]=g.useState(null);if(g.useEffect(()=>{if("data"in s&&s.data)if(s.data.metadata){const _=s.data.metadata;if(typeof _.width!="number"||typeof _.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof _.width} and height was: ${typeof _.height}`);return}if("hotspot"in _){if(typeof _.hotspot=="object"&&_.hotspot&&"x"in _.hotspot&&"y"in _.hotspot){const{x:O,y:T}=_.hotspot;typeof O=="number"&&typeof T=="number"?u({x:O,y:T}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof O} and y: ${typeof T}`)}}else u(void 0)}else u(void 0)},["data"in s&&s.data]),i.status==="error")return f.jsx(qt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(rt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(i.status==="loading")return f.jsx(ht,{path:e,type:t});if(n===void 0)return f.jsx(ht,{path:e,type:t});if(i.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:i.data.type});const h=s.data;if(h===void 0)return f.jsx(Cn,{path:e,type:t});const v=i.data.type==="image"&&i.data.remote&&r.status!=="ready",b=i.data.remote&&r.status==="ready"&&o?{publicProjectId:r.publicProjectId,bucket:o,coreVersion:r.coreVersion,schema:i.data,remoteHost:n.remoteHost}:null;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),d&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:d}),i.data.type==="image"&&i.data.remote&&r.status==="inactive"&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:jY(r.reason)}),h&&f.jsxs("div",{className:"py-2",children:[f.jsx("span",{children:"Alt text"}),f.jsx(Nu,{value:(x=h.metadata)!=null&&x.alt&&typeof((w=h.metadata)==null?void 0:w.alt)=="string"?(k=h.metadata)==null?void 0:k.alt:"",disabled:v,onChange:_=>{const O=_.target.value;h.metadata&&"alt"in h.metadata?l([{op:"replace",value:O,path:a.concat(["metadata","alt"])}]):h.metadata&&!("alt"in h.metadata)?l([{op:"add",value:O,path:a.concat(["metadata","alt"])}]):h.metadata===void 0?l([{op:"add",value:{...c?{hotspot:c}:{},alt:O},path:a.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof h.metadata}`)}})]}),h&&f.jsxs("div",{className:"relative",children:[f.jsx("img",{src:qe in h&&h[qe]==="remote"?de.convertRemoteSource({...h,[qe]:"remote"}).url:de.convertFileSource({...h,[qe]:"file"}).url,draggable:!1,className:"object-contain w-full max-h-[500px] rounded-t-lg",style:{cursor:"crosshair"},onClick:_=>{const{width:O,height:T,left:j,top:A}=_.currentTarget.getBoundingClientRect(),D={x:Math.max((_.clientX-6-j)/O,0),y:Math.max((_.clientY-6-A)/T,0)};h.metadata&&"hotspot"in h.metadata?l([{op:"replace",path:a.concat(["metadata","hotspot"]),value:D}]):h.metadata?l([{op:"add",path:a.concat(["metadata","hotspot"]),value:D}]):h.metadata===void 0?l([{op:"add",value:{...D?{hotspot:D}:{}},path:a.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof h.metadata}`)}}),c&&f.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-solid border-2 absolute pointer-events-none",style:{top:`${c.y*100}%`,left:`${c.x*100}%`}})]}),f.jsx("div",{children:f.jsx("label",{htmlFor:`img_input:${e}`,className:Ne("block px-1 py-2 mt-4 text-sm text-center rounded-lg cursor-pointer bg-bg-primary text-text-secondary"),children:"Update"})}),f.jsx("input",{disabled:s.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((C=i.data.options)==null?void 0:C.accept)||"image/*",onChange:_=>{z2(_).then(O=>{var A;const T={src:O.src,filename:O.filename};let j;O.width&&O.height&&O.mimeType&&(j={width:O.width,height:O.height,mimeType:O.mimeType}),p(null),B2(a,T.src,T.filename??null,O.fileHash,j,"image",b,(A=n.files)==null?void 0:A.directory).then(l).catch(D=>{console.error("Failed to create file patch",D),p("Could not upload file. Please try again later")})})}})]})}function jY(e){switch(e){case"api-key-missing":return"Val is running in production mode. To upload remote files and images, the VAL_API_KEY env must be set. Contact a developer to fix this issue.";case"error-could-not-get-settings":return`Could not get settings from the Val remote server. This means that updating or changing certain types of files and images might not work. Check your internet connection and try again. (Error code: ${e})`;case"no-internet-connection":return"Cannot upload remote files and images, since this requires an internet connection";case"pat-error":return"Val is running in development mode. To upload remote files and images, you must either login (by running `npx -p @valbuild/cli val login`) or set the VAL_API_KEY env";case"project-not-configured":return"Project is not configured. To upload remote files and images, the val.config must contain a project id that is obtained from https://app.val.build. Contact a developer to fix this issue.";case"unauthorized":return"Cannot upload remote files and images since you are unauthorized";case"unauthorized-personal-access-token-error":return"Cannot upload remote files and images since the personal access token is unauthorized. Try to login again by running `npx -p @valbuild/cli val login`";case"unknown-error":return"Unknown error";default:return e}}function RY({path:e}){const t=st(e,"image");if(t.status==="error")return f.jsx(rt,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return f.jsx(fr,{path:e});if(t.data===null)return f.jsx(pr,{path:e});const n=t.data;return f.jsx("img",{src:qe in n&&n[qe]==="remote"?de.convertRemoteSource({...n,[qe]:"remote"}).url:de.convertFileSource({...n,[qe]:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function AY({path:e}){const t="keyOf",{navigate:n}=hr(),r=Lt(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:r.data.schema.type,path:r.data.path}:void 0,i=st(o==null?void 0:o.path,o==null?void 0:o.type),s=st(e,t),{patchPath:a,addPatch:l}=Tn(e),c=so();if(r.status==="error")return f.jsx(qt,{path:e,error:r.error,type:t});if(s.status==="error")return f.jsx(rt,{path:e,error:s.error,type:t});if(i.status==="error")return f.jsx(rt,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return f.jsx(qt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return f.jsx(qt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return f.jsx(ht,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return f.jsx(qt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return f.jsx(qt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,d=s.data;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),u&&u.length>0&&d!==null&&!u.includes(d)&&f.jsx("div",{className:"flex flex-col gap-2 p-4 rounded bg-bg-error-primary text-text-error-primary",children:f.jsxs("span",{children:["Value must be one of: ",u.join(", ")]})}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(AS,{value:d??"",onValueChange:p=>{l([{op:"replace",path:a,value:p}])},children:[f.jsx(Hv,{children:f.jsx(IS,{children:d})}),f.jsx(Wv,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?f.jsx(IY,{}):u.map(p=>f.jsx(Kv,{value:p,children:p},p))})]}),d&&(o==null?void 0:o.path)&&f.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(de.createValPathOfItem(o.path,d))},children:f.jsx(wV,{size:16})})]})]})}function IY(){return f.jsx("span",{children:"Loading..."})}function DY({path:e}){const t=st(e,"keyOf");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function $2({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return f.jsx(W8,{showOutsideDays:r,captionLayout:n,className:Ke("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:Ke(ib({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Ke(ib({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>f.jsx(EV,{className:"w-4 h-4"}),IconRight:()=>f.jsx(gv,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=d=>{c&&c({target:{value:d}})};return f.jsx("div",{className:"flex flex-row space-x-2",children:f.jsxs(N2,{onValueChange:u,value:String(l),children:[f.jsx(PS,{asChild:!0,children:f.jsxs(nn,{variant:"ghost",size:"sm",children:[s,f.jsx(Np,{className:"w-4 h-4"})]})}),f.jsx(jS,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:f.jsx(T2,{className:"pb-4 pr-4 overflow-y-auto rounded-md shadow-lg max-h-48 bg-bg-tertiary text-text-tertiary",children:g.Children.map(a,d=>{if(g.isValidElement(d)){const{value:p,children:h}=d.props;return f.jsx(RS,{value:String(p),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:f.jsx(M2,{children:h})},p)}return null})})})]})})}},...o})}$2.displayName="Calendar";function LY({path:e}){var p,h;const t="date",n=Lt(e),r=st(e,t),{patchPath:o,addPatch:i}=Tn(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=so();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(rt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(n.status==="loading")return f.jsx(ht,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(ht,{path:e,type:t});if(n.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsxs(ga,{open:l,onOpenChange:m=>{c(m)},children:[f.jsx(Ip,{asChild:!0,onClick:()=>{c(!0)},children:f.jsxs(nn,{variant:"outline",className:Ne("w-[280px] justify-start text-left font-normal bg-bg-primary",!s&&"text-muted-foreground"),children:[f.jsx(kV,{className:"w-4 h-4 mr-2"}),s?ts(s,"PPP"):f.jsx("span",{children:"Pick a date"})]})}),f.jsx(Xi,{className:"w-auto p-0",container:u,children:f.jsx($2,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(p=d.options)!=null&&p.from?new Date(d.options.from):void 0,toDate:(h=d.options)!=null&&h.to?new Date(d.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString().slice(0,10),path:o}]),c(!1))}})})]})]})}function FY({path:e}){const t=st(e,"date");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function zY({path:e}){const t=st(e,"literal");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function V2(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function U2(){return f.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-primary"})}function BY({path:e}){const t="record",{validationErrors:n}=mi(),{navigate:r}=hr(),o=Lt(e),i=st(e,t);if(o.status==="error")return f.jsx(qt,{path:e,error:o.error,type:t});if(i.status==="error")return f.jsx(rt,{path:e,error:i.error,type:t});if(i.status=="not-found"||o.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(o.status==="loading")return f.jsx(ht,{path:e,type:t});if(!("data"in i)||i.data===void 0)return f.jsx(ht,{path:e,type:t});if(o.data.type!==t)return f.jsx(mr,{path:e,expectedType:t,actualType:o.data.type});const s=i.data;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx("div",{className:"grid grid-cols-1 gap-4",children:s&&Object.entries(s).map(([a])=>f.jsxs("div",{onClick:()=>r(al(e,a)),className:"bg-primary-foreground cursor-pointer hover:bg-primary-foreground/50 min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4",children:[f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("div",{className:"pb-4 font-semibold text-md",children:a}),V2(al(e,a),n)&&f.jsx(U2,{})]}),f.jsx("div",{children:f.jsx(Rk,{path:al(e,a)})})]},a))})]})}function $Y({path:e}){const t=st(e,"record");if(t.status==="error")return f.jsx(rt,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return f.jsx(fr,{path:e});if(t.data===null)return f.jsx(pr,{path:e});const n=Object.keys(t.data);return f.jsxs("div",{className:"text-left",children:[f.jsx("span",{className:"text-fg-brand-primary",children:n.length}),f.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let Gv=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var Eb={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var p=u.stack;return r(this,"stack",{configurable:!0,value:p,writable:!0}),p},set:function(p){r(c,"stack",{configurable:!0,value:p,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}t=e.exports=a,t.BaseError=i})(Eb,Eb.exports);var H2=Eb.exports,p_="ProseMirror-selectednode",W2="",$s="\0",h_="__state_override__",VY={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},He=VY,Zi=Symbol.for("__remirror__"),hn=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(hn||{}),ft=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(ft||{}),tr=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(tr||{}),ie=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(ie||{}),oe=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(oe||{}),UY=function(t){return HY(t)&&!WY(t)};function HY(e){return!!e&&typeof e=="object"}function WY(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||GY(e)}var KY=typeof Symbol=="function"&&Symbol.for,qY=KY?Symbol.for("react.element"):60103;function GY(e){return e.$$typeof===qY}function YY(e){return Array.isArray(e)?[]:{}}function Kf(e,t){return t.clone!==!1&&t.isMergeableObject(e)?ou(YY(e),e,t):e}function JY(e,t,n){return e.concat(t).map(function(r){return Kf(r,n)})}function XY(e,t){if(!t.customMerge)return ou;var n=t.customMerge(e);return typeof n=="function"?n:ou}function ZY(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function m_(e){return Object.keys(e).concat(ZY(e))}function K2(e,t){try{return t in e}catch{return!1}}function QY(e,t){return K2(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function eJ(e,t,n){var r={};return n.isMergeableObject(e)&&m_(e).forEach(function(o){r[o]=Kf(e[o],n)}),m_(t).forEach(function(o){QY(e,o)||(K2(e,o)&&n.isMergeableObject(t[o])?r[o]=XY(o,n)(e[o],t[o],n):r[o]=Kf(t[o],n))}),r}function ou(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||JY,n.isMergeableObject=n.isMergeableObject||UY,n.cloneUnlessOtherwiseSpecified=Kf;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):eJ(e,t,n):Kf(t,n)}ou.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return ou(r,o,n)},{})};var tJ=ou,nJ=tJ;const rJ=ka(nJ);/*!
372
- * isobject <https://github.com/jonschlinkert/isobject>
373
- *
374
- * Copyright (c) 2014-2017, Jon Schlinkert.
375
- * Released under the MIT License.
376
- */var q2=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
377
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
378
- *
379
- * Copyright (c) 2014-2017, Jon Schlinkert.
380
- * Released under the MIT License.
381
- */var oJ=q2;function g_(e){return oJ(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var iJ=function(t){var n,r;return!(g_(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,g_(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*!
382
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
383
- *
384
- * Copyright (c) 2015-2017, Jon Schlinkert.
385
- * Released under the MIT License.
386
- */var sJ=iJ,aJ=function(t){return sJ(t)||typeof t=="function"||Array.isArray(t)};/*!
387
- * object.omit <https://github.com/jonschlinkert/object.omit>
388
- *
389
- * Copyright (c) 2014-2017, Jon Schlinkert.
390
- * Released under the MIT License.
391
- */var lJ=aJ,cJ=function(t,n,r){if(!lJ(t))return{};typeof n=="function"&&(r=n,n=[]),typeof n=="string"&&(n=[n]);for(var o=typeof r=="function",i=Object.keys(t),s={},a=0;a<i.length;a++){var l=i[a],c=t[l];(!n||n.indexOf(l)===-1&&(!o||r(c,l,t)))&&(s[l]=c)}return s};const LS=ka(cJ);/*!
392
- * object.pick <https://github.com/jonschlinkert/object.pick>
393
- *
394
- * Copyright (c) 2014-2015 Jon Schlinkert, contributors.
395
- * Licensed under the MIT License
396
- */var uJ=q2,dJ=function(t,n){if(!uJ(t)&&typeof t!="function")return{};var r={};if(typeof n=="string")return n in t&&(r[n]=t[n]),r;for(var o=n.length,i=-1;++i<o;){var s=n[i];s in t&&(r[s]=t[s])}return r};const Cb=ka(dJ),G2=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,fJ=/\S+/g;function pJ(e,t){const n={parts:[],prefixes:[]},r=e.matchAll(t);let o=0;for(const s of r){if(typeof s.index!="number")continue;const a=s[0];n.parts.push(a);const l=e.slice(o,s.index).trim();n.prefixes.push(l),o=s.index+a.length}const i=e.slice(o).trim();return i&&(n.parts.push(""),n.prefixes.push(i)),n}function Y2(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},i=e.trim().normalize("NFC"),s=i.includes(" "),l=pJ(i,s?fJ:G2);return l.parts.map((c,u)=>{let d=l.prefixes[u]||"",p=c;return n===!1&&(r&&(p=p.normalize("NFD").replace(new RegExp(`[^a-zA-ZØßø0-9${r.join("")}]`,"g"),"")),r||(p=p.normalize("NFD").replace(/[^a-zA-ZØßø0-9]/g,""),d="")),r&&(d=d.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?d+p:!d&&!p?"":s&&!d&&o.match(/\s/)?" "+p:(d||o)+p}).filter(Boolean)}function hJ(e){const t=e.matchAll(G2).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function J2(e,t){return Y2(e,t).reduce((n,r)=>n+hJ(r),"")}function v_(e,t){return Y2(e,{...t,prefix:"-"}).join("").toLowerCase()}function _b(e,t,n,r){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function l(){a(),i=!0}typeof t!="boolean"&&(r=n,n=t,t=void 0);function c(){for(var u=arguments.length,d=new Array(u),p=0;p<u;p++)d[p]=arguments[p];var h=this,m=Date.now()-s;if(i)return;function v(){s=Date.now(),n.apply(h,d)}function b(){o=void 0}r&&!o&&v(),a(),r===void 0&&m>e?v():t!==!0&&(o=setTimeout(r?b:v,r===void 0?e-m:e))}return c.cancel=l,c}function mJ(e,t,n){return n===void 0?_b(e,t,!1):_b(e,n,t!==!1)}function jt(e,t,n){const r=e[t];return X2(!Jv(r),n),r}function X2(e,t){if(!e)throw new gJ(t)}var gJ=class extends H2.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function tn(e){return Object.entries(e)}function qf(e){return Object.keys(e)}function Yv(e){return Object.values(e)}function Vo(e,t,n){return e.includes(t,n)}function Ce(e){return Object.assign(Object.create(null),e)}function Z2(e){return Object.prototype.toString.call(e)}function Q2(e){return Z2(e).slice(8,-1)}function Hp(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function FS(e){return t=>Q2(t)===e}var Jv=Hp("undefined"),Le=Hp("string"),Dr=Hp("number",e=>!Number.isNaN(e)),Nt=Hp("function");function vJ(e){return e===null}function yJ(e){return e===!0||e===!1}function Il(e){if(Q2(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})}function xJ(e){return e==null||/^[bns]/.test(typeof e)}function va(e){return vJ(e)||Jv(e)}function Bn(e){return!va(e)&&(Nt(e)||Hp("object")(e))}var bJ=FS("RegExp");function wJ(e){return FS("Map")(e)}function SJ(e){return FS("Set")(e)}function vg(e){return Bn(e)&&!wJ(e)&&!SJ(e)&&Object.keys(e).length===0}var rn=Array.isArray;function ya(e){return rn(e)&&e.length===0}function y_(e){return rn(e)&&e.length>0}function Xv(e,t,n=r=>!!r){t.lastIndex=0;const r=[],o=t.flags;let i;o.includes("g")||(t=new RegExp(t.source,`g${o}`));do i=t.exec(e),i&&r.push(i);while(n(i));return t.lastIndex=0,r}function yg(){const e=Date.now(),t=yg.last||e;return yg.last=e>t?e:t+1}yg.last=0;function xg(e=""){return`${e}${yg().toString(36)}`}function kJ(e){return LS(e,t=>!Jv(t))}function EJ(e){if(!Il(e))throw new Error("An invalid value was passed into this clone utility. Expected a plain object");return{...e}}function Gf(e,t=!1){const n=t?[...e].reverse():e,r=new Set(n);return t?[...r].reverse():[...r]}function eI(){}function CJ(...e){return rJ.all(e,{isMergeableObject:Il})}function _J({min:e,max:t,value:n}){return n<e?e:n>t?t:n}function NJ(e){return e[e.length-1]}function El(e,t){return[...e].map((n,r)=>({value:n,index:r})).sort((n,r)=>t(n.value,r.value)||n.index-r.index).map(({value:n})=>n)}function TJ(e,t,n){try{if(Le(t)&&t in e)return e[t];rn(t)&&(t=`['${t.join("']['")}']`);let r=e;return t.replace(/\[\s*(["'])(.*?)\1\s*]|^\s*(\w+)\s*(?=\.|\[|$)|\.\s*(\w*)\s*(?=\.|\[|$)|\[\s*(-?\d+)\s*]/g,(o,i,s,a,l,c)=>(r=r[s||a||l||c],"")),r===void 0?n:r}catch{return n}}function OJ(e,t){const n=EJ(t);let r=n;for(const[o,i]of e.entries()){const s=o>=e.length-1;let a=r[i];if(s){if(rn(r)){const l=Number.parseInt(i.toString(),10);Dr(l)&&r.splice(l,1)}else Reflect.deleteProperty(r,i);return n}if(xJ(a))return n;a=rn(a)?[...a]:{...a},r[i]=a,r=a}return n}function MJ(e){return t=>TJ(t,e)}function tI(e,t,n=!1){const r=[],o=new Set,i=Nt(t)?t:MJ(t),s=n?[...e].reverse():e;for(const a of s){const l=i(a);o.has(l)||(o.add(l),r.push(a))}return n?r.reverse():r}function nI(e,t){const n=rn(e)?e[0]:e;return Dr(t)?n<=t?Array.from({length:t+1-n},(r,o)=>o+n):Array.from({length:n+1-t},(r,o)=>-1*o+n):Array.from({length:Math.abs(n)},(r,o)=>(n<0?-1:1)*o)}function x_(e,...t){const n=t.filter(Dr);return e>=Math.min(...n)&&e<=Math.max(...n)}function rI(e){return Nt(e)?e():e}var oI="https://remirror.io/docs/errors",PJ={[oe.UNKNOWN]:"An error occurred but we're not quite sure why. 🧐",[oe.INVALID_COMMAND_ARGUMENTS]:"The arguments passed to the command method were invalid.",[oe.CUSTOM]:"This is a custom error, possibly thrown by an external library.",[oe.CORE_HELPERS]:"An error occurred in a function called from the `@remirror/core-helpers` library.",[oe.MUTATION]:"Mutation of immutable value detected.",[oe.INTERNAL]:"This is an error which should not occur and is internal to the remirror codebase.",[oe.MISSING_REQUIRED_EXTENSION]:"Your editor is missing a required extension.",[oe.MANAGER_PHASE_ERROR]:"This occurs when accessing a method or property before it is available.",[oe.INVALID_GET_EXTENSION]:"The user requested an invalid extension from the getExtensions method. Please check the `createExtensions` return method is returning an extension with the defined constructor.",[oe.INVALID_MANAGER_ARGUMENTS]:"Invalid value(s) passed into `Manager` constructor. Only `Presets` and `Extensions` are supported.",[oe.SCHEMA]:"There is a problem with the schema or you are trying to access a node / mark that doesn't exists.",[oe.HELPERS_CALLED_IN_OUTER_SCOPE]:"The `helpers` method which is passed into the ``create*` method should only be called within returned method since it relies on an active view (not present in the outer scope).",[oe.INVALID_MANAGER_EXTENSION]:"You requested an invalid extension from the manager.",[oe.DUPLICATE_COMMAND_NAMES]:"Command method names must be unique within the editor.",[oe.DUPLICATE_HELPER_NAMES]:"Helper method names must be unique within the editor.",[oe.NON_CHAINABLE_COMMAND]:"Attempted to chain a non chainable command.",[oe.INVALID_EXTENSION]:"The provided extension is invalid.",[oe.INVALID_CONTENT]:"The content provided to the editor is not supported.",[oe.INVALID_NAME]:"An invalid name was used for the extension.",[oe.EXTENSION]:"An error occurred within an extension. More details should be made available.",[oe.EXTENSION_SPEC]:"The spec was defined without calling the `defaults`, `parse` or `dom` methods.",[oe.EXTENSION_EXTRA_ATTRIBUTES]:"Extra attributes must either be a string or an object.",[oe.INVALID_SET_EXTENSION_OPTIONS]:"A call to `extension.setOptions` was made with invalid keys.",[oe.REACT_PROVIDER_CONTEXT]:"`useRemirrorContext` was called outside of the `remirror` context. It can only be used within an active remirror context created by the `<Remirror />`.",[oe.REACT_GET_ROOT_PROPS]:"`getRootProps` has been attached to the DOM more than once. It should only be attached to the dom once per editor.",[oe.REACT_EDITOR_VIEW]:"A problem occurred adding the editor view to the dom.",[oe.REACT_CONTROLLED]:"There is a problem with your controlled editor setup.",[oe.REACT_NODE_VIEW]:"Something went wrong with your custom ReactNodeView Component.",[oe.REACT_GET_CONTEXT]:"You attempted to call `getContext` provided by the `useRemirror` prop during the first render of the editor. This is not possible and should only be after the editor first mounts.",[oe.REACT_COMPONENTS]:"An error occurred within a remirror component.",[oe.REACT_HOOKS]:"An error occurred within a remirror hook.",[oe.I18N_CONTEXT]:"You called `useI18n()` outside of an `I18nProvider` context."};function jJ(e){return Le(e)&&Vo(Yv(oe),e)}function RJ(e,t){const n=PJ[e],r=n?`${n}
397
-
398
- `:"",o=t?`${t}
399
-
400
- `:"";return`${r}${o}For more information visit ${oI}#${e.toLowerCase()}`}var iI=class extends H2.BaseError{constructor({code:e,message:t,disableLogging:n=!1}={}){const r=jJ(e)?e:oe.CUSTOM;super(RJ(r,t)),this.errorCode=r,this.url=`${oI}#${r.toLowerCase()}`,n||console.error(this.message)}static create(e={}){return new iI(e)}};function Te(e,t){if(!e)throw iI.create(t)}function Ja(e,t={}){return e}function xn(e){this.content=e}xn.prototype={constructor:xn,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return o==-1?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new xn(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new xn(n)},addToStart:function(e,t){return new xn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new xn(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(i==-1?o.length:i,0,t,n),new xn(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=xn.from(e),e.size?new xn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=xn.from(e),e.size?new xn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=xn.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};xn.from=function(e){if(e instanceof xn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new xn(t)};function sI(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=sI(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function aI(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let c=0,u=Math.min(s.text.length,a.text.length);for(;c<u&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let c=aI(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class q{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,i){for(let s=0,a=0;a<n;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,o+a,i||null,s)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,o+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,o){let i="",s=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new q(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let i=0,s=0;s<n;i++){let a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new q(r,o)}cutByIndex(t,n){return t==n?q.empty:t==0&&n==this.content.length?this:new q(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new q(o,i)}addToStart(t){return new q([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new q(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return sI(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return aI(this,t,n,r)}findIndex(t,n=-1){if(t==0)return Ph(0,t);if(t==this.size)return Ph(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=t)return s==t||n>0?Ph(r+1,s):Ph(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return q.empty;let n,r=0;for(let o=0;o<t.length;o++){let i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new q(n||t,r)}static from(t){if(!t)return q.empty;if(t instanceof q)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new q([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const C0={index:0,offset:0};function Ph(e,t){return C0.index=e,C0.offset=t,C0}function bg(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!bg(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!bg(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class nt{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let i=t[o];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,o));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&bg(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let o=r.create(n.attrs);return r.checkAttrs(o.attrs),o}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return nt.none;if(t instanceof nt)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}nt.none=[];class wg extends Error{}class fe{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=cI(this.content,t+this.openStart,n);return r&&new fe(r,this.openStart,this.openEnd)}removeBetween(t,n){return new fe(lI(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return fe.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fe(q.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new fe(t,r,o)}}fe.empty=new fe(q.empty,0,0);function lI(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(lI(i.content,t-o-1,n-o-1)))}function cI(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return e.cut(0,t).append(n).append(e.cut(t));let a=cI(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function AJ(e,t,n){if(n.openStart>e.depth)throw new wg("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new wg("Inconsistent open depths");return uI(e,t,n,0)}function uI(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=uI(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let s=e.parent,a=s.content;return cl(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=IJ(n,e);return cl(i,fI(e,s,a,t,r))}else return cl(i,Sg(e,t,r))}function dI(e,t){if(!t.type.compatibleContent(e.type))throw new wg("Cannot join "+t.type.name+" onto "+e.type.name)}function Nb(e,t,n){let r=e.node(n);return dI(r,t.node(n)),r}function ll(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function qd(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(ll(e.nodeAfter,r),i++));for(let a=i;a<s;a++)ll(o.child(a),r);t&&t.depth==n&&t.textOffset&&ll(t.nodeBefore,r)}function cl(e,t){return e.type.checkContent(t),e.copy(t)}function fI(e,t,n,r,o){let i=e.depth>o&&Nb(e,t,o+1),s=r.depth>o&&Nb(n,r,o+1),a=[];return qd(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(dI(i,s),ll(cl(i,fI(e,t,n,r,o+1)),a)):(i&&ll(cl(i,Sg(e,t,o+1)),a),qd(t,n,o,a),s&&ll(cl(s,Sg(n,r,o+1)),a)),qd(r,null,o,a),new q(a)}function Sg(e,t,n){let r=[];if(qd(null,e,n,r),e.depth>n){let o=Nb(e,t,n+1);ll(cl(o,Sg(e,t,n+1)),r)}return qd(t,null,n,r),new q(r)}function IJ(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)o=t.node(i).copy(q.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class iu{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=t.child(n);return r?t.child(n).cut(r):o}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)o+=r.child(i).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return nt.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),o=t.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Cl(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(i),c=i-l;if(r.push(s,a,o+l),!c||(s=s.child(a),s.isText))break;i=c-1,o+=l+1}return new iu(n,r,i)}static resolveCached(t,n){let r=b_.get(t);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else b_.set(t,r=new DJ);let o=r.elts[r.i]=iu.resolve(t,n);return r.i=(r.i+1)%LJ,o}}class DJ{constructor(){this.elts=[],this.i=0}}const LJ=12,b_=new WeakMap;class Cl{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const FJ=Object.create(null);let ea=class Tb{constructor(t,n,r,o=nt.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||q.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&bg(this.attrs,n||t.defaultAttrs||FJ)&&nt.sameSet(this.marks,r||nt.none)}copy(t=null){return t==this.content?this:new Tb(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Tb(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return fe.empty;let o=this.resolve(t),i=this.resolve(n),s=r?0:o.sharedDepth(n),a=o.start(s),c=o.node(s).content.cut(o.pos-a,i.pos-a);return new fe(c,o.depth-s,i.depth-s)}replace(t,n,r){return AJ(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(o==t||n.isText)return n;t-=o+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(t){return iu.resolveCached(this,t)}resolveNoCache(t){return iu.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),pI(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=q.empty,o=0,i=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(t).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=nt.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!nt.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=q.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};ea.prototype.text=void 0;class kg extends ea{constructor(t,n,r,o){if(super(t,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pI(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new kg(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new kg(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function pI(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class _l{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new zJ(t,n);if(r.next==null)return _l.empty;let o=hI(r);r.next&&r.err("Unexpected trailing text");let i=KJ(WJ(o));return qJ(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(t.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let o=[this];function i(s,a){let l=s.matchFragment(t,r);if(l&&(!n||l.validEnd))return q.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let p=i(d,a.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(t)){let s=[];for(let a=o;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:a,next:l}=i.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let o=0;o<r.next.length;o++)t.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),t.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return i}).join(`
401
- `)}}_l.empty=new _l(!0);class zJ{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function hI(e){let t=[];do t.push(BJ(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function BJ(e){let t=[];do t.push($J(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function $J(e){let t=HJ(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=VJ(e,t);else break;return t}function w_(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function VJ(e,t){let n=w_(e),r=n;return e.eat(",")&&(e.next!="}"?r=w_(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function UJ(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(t)&&o.push(s)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function HJ(e){if(e.eat("(")){let t=hI(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=UJ(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function WJ(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(s,a,l){let c={term:l,to:a};return t[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function mI(e,t){return t-e}function S_(e,t){let n=[];return r(t),n.sort(mI);function r(o){let i=e[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function KJ(e){let t=Object.create(null);return n(S_(e,0));function n(r){let o=[];r.forEach(s=>{e[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);S_(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new _l(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(mI);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}}function qJ(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function gI(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function vI(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let i=e[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function yI(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let i=e[o];i.validate&&i.validate(t[o])}}function xI(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new YJ(e,r,t[r]);return n}let Ob=class bI{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=xI(t,r.attrs),this.defaultAttrs=gI(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==_l.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:vI(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ea(this,this.computeAttrs(t),q.from(n),nt.setFrom(r))}createChecked(t=null,n,r){return n=q.from(n),this.checkContent(n),new ea(this,this.computeAttrs(t),n,nt.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=q.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(q.empty,!0);return i?new ea(this,t,n.append(i),nt.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){yI(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:nt.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new bI(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function GJ(e,t,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class YJ{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?GJ(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Wp{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=xI(t,o.attrs),this.excluded=null;let i=gI(this.attrs);this.instance=i?new nt(this,i):null}create(t=null){return!t&&this.instance?this.instance:new nt(this,vI(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new Wp(i,o++,n,s)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){yI(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class JJ{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in t)n[o]=t[o];n.nodes=xn.from(t.nodes),n.marks=xn.from(t.marks||{}),this.nodes=Ob.compile(this.spec.nodes,this),this.marks=Wp.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=_l.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?k_(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:k_(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,o){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Ob){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,o)}text(t,n){let r=this.nodes.text;return new kg(r,r.defaultAttrs,t,nt.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return ea.fromJSON(this,t)}markFromJSON(t){return nt.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function k_(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let a in e.marks){let l=e.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function XJ(e){return e.tag!=null}function ZJ(e){return e.style!=null}class su{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(XJ(o))this.tags.push(o);else if(ZJ(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=t.nodes[o.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new C_(this,n,!1);return r.addAll(t,nt.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new C_(this,n,!0);return r.addAll(t,nt.none,n.from,n.to),fe.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(tX(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(t);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(t,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in t.marks){let i=t.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=__(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in t.nodes){let i=t.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=__(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new su(t,su.schemaRules(t)))}}const wI={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},QJ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},SI={ol:!0,ul:!0},Eg=1,Cg=2,Gd=4;function E_(e,t,n){return t!=null?(t?Eg:0)|(t==="full"?Cg:0):e&&e.whitespace=="pre"?Eg|Cg:n&~Gd}class jh{constructor(t,n,r,o,i,s){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=nt.none,this.match=i||(s&Gd?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(q.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Eg)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=q.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!wI.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class C_{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=E_(null,n.preserveWhitespace,0)|(r?Gd:0);o?i=new jh(o.type,o.attrs,nt.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new jh(null,null,nt.none,!0,null,s):i=new jh(t.schema.topNodeType,null,nt.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,o=this.top;if(o.options&Cg||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o.options&Eg)o.options&Cg?r=r.replace(/\r\n?/g,`
402
- `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let i=o.content[o.content.length-1],s=t.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=t.nodeName.toLowerCase(),i;SI.hasOwnProperty(o)&&this.parser.normalizeLists&&eX(t);let s=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,r));if(s?s.ignore:QJ.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(t=s.skip);let a,l=this.top,c=this.needsBlock;if(wI.hasOwnProperty(o))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);return}let u=s&&s.skip?n:this.readStyles(t,n);u&&this.addAll(t,u),a&&this.sync(l),this.needsBlock=c}else{let a=this.readStyles(t,n);a&&this.addElementByRule(t,s,a,s.consuming===!1?i:void 0)}}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
403
- `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(t,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(t,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(o)this.addElement(t,r,o);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}i&&this.sync(a)&&this.open--}addAll(t,n,r,o){let i=r||0;for(let s=r?t.childNodes[r]:t.firstChild,a=o==null?null:t.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,n);this.findAtPoint(t,i)}findPlace(t,n){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],a=s.findWrapping(t);if(a&&(!r||r.length>a.length)&&(r=a,o=s,!a.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)n=this.enterInner(r[i],null,n,!1);return n}insertNode(t,n){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let r=this.findPlace(t,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let i=nt.none;for(let s of r.concat(t.marks))(o.type?o.type.allowsMarkType(s.type):N_(s.type,t.type))&&(i=s.addToSet(i));return o.content.push(t.mark(i)),!0}return!1}enter(t,n,r,o){let i=this.findPlace(t.create(n),r);return i&&(i=this.enterInner(t,n,r,!0,o)),i}enterInner(t,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let a=E_(t,i,s.options);s.options&Gd&&s.content.length==0&&(a|=Gd);let l=nt.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):N_(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new jh(t,n,l,o,null,a)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)t+=r[o].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&t.nodeType==1&&t.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function eX(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&SI.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function tX(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function __(e){let t={};for(let n in e)t[n]=e[n];return t}function N_(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}class ja{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=_0(n).createDocumentFragment());let o=r,i=[];return t.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=tm(_0(n),this.nodes[t.type.name](t),null,t.attrs);if(o){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,o)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let o=t.marks.length-1;o>=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&tm(_0(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return tm(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ja(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=T_(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return T_(t.marks)}}function T_(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function _0(e){return e.document||window.document}const O_=new WeakMap;function nX(e){let t=O_.get(e);return t===void 0&&O_.set(e,t=rX(e)),t}function rX(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(e),t}function tm(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=nX(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?e.createElementNS(n,o):e.createElement(o),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let p=t[d];if(p===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:m}=tm(e,p,n,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const kI=65535,EI=Math.pow(2,16);function oX(e,t){return e+t*EI}function M_(e){return e&kI}function iX(e){return(e-(e&kI))/EI}const CI=1,_I=2,nm=4,NI=8;class Mb{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&NI)>0}get deletedBefore(){return(this.delInfo&(CI|nm))>0}get deletedAfter(){return(this.delInfo&(_I|nm))>0}get deletedAcross(){return(this.delInfo&nm)>0}}class Nr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Nr.empty)return Nr.empty}recover(t){let n=0,r=M_(t);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+iX(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>t)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(t<=d){let p=c?t==l?-1:t==d?1:n:n,h=l+o+(p<0?0:u);if(r)return h;let m=t==(n<0?l:d)?null:oX(a/3,t-l),v=t==l?_I:t==d?CI:nm;return(n<0?t!=l:t!=d)&&(v|=NI),new Mb(h,v,m)}o+=u-c}return r?t+o:new Mb(t+o,0,null)}touches(t,n){let r=0,o=M_(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+i],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];t(a,a+c,l,l+u),i+=u-c}}invert(){return new Nr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Nr.empty:new Nr(t<0?[0,-t,0]:[0,0,t])}}Nr.empty=new Nr([]);class Ac{constructor(t=[],n,r=0,o=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=o}slice(t=0,n=this.maps.length){return new Ac(this.maps,this.mirror,t,n)}copy(){return new Ac(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let o=t.getMirror(n);this.appendMap(t.maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let o=t.getMirror(n);this.appendMap(t.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let t=new Ac;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this.maps[i],a=s.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,t=this.maps[l].recover(a.recover);continue}}o|=a.delInfo,t=a.pos}return r?t:new Mb(t,o,null)}}const N0=Object.create(null);class on{getMap(){return Nr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=N0[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in N0)throw new RangeError("Duplicate use of step JSON ID "+t);return N0[t]=n,n.prototype.jsonID=t,n}}class Vt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Vt(t,null)}static fail(t){return new Vt(null,t)}static fromReplace(t,n,r,o){try{return Vt.ok(t.replace(n,r,o))}catch(i){if(i instanceof wg)return Vt.fail(i.message);throw i}}}function zS(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(zS(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return q.fromArray(r)}class Li extends on{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new fe(zS(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return Vt.fromReplace(t,this.from,this.to,i)}invert(){return new Oo(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Li(n.pos,r.pos,this.mark)}merge(t){return t instanceof Li&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Li(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Li(n.from,n.to,t.markFromJSON(n.mark))}}on.jsonID("addMark",Li);class Oo extends on{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new fe(zS(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return Vt.fromReplace(t,this.from,this.to,r)}invert(){return new Li(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Oo(n.pos,r.pos,this.mark)}merge(t){return t instanceof Oo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Oo(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Oo(n.from,n.to,t.markFromJSON(n.mark))}}on.jsonID("removeMark",Oo);class Vs extends on{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vt.fromReplace(t,this.pos,this.pos+1,new fe(q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Vs(this.pos,n.marks[o]);return new Vs(this.pos,this.mark)}}return new au(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Vs(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Vs(n.pos,t.markFromJSON(n.mark))}}on.jsonID("addNodeMark",Vs);class au extends on{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Vt.fromReplace(t,this.pos,this.pos+1,new fe(q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Vs(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new au(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new au(n.pos,t.markFromJSON(n.mark))}}on.jsonID("removeNodeMark",au);class fn extends on{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&Pb(t,this.from,this.to)?Vt.fail("Structure replace would overwrite content"):Vt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Nr([this.from,this.to-this.from,this.slice.size])}invert(t){return new fn(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new fn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof fn)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?fe.empty:new fe(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new fn(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?fe.empty:new fe(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new fn(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new fn(n.from,n.to,fe.fromJSON(t,n.slice),!!n.structure)}}on.jsonID("replace",fn);class Ut extends on{constructor(t,n,r,o,i,s,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(t){if(this.structure&&(Pb(t,this.from,this.gapFrom)||Pb(t,this.gapTo,this.to)))return Vt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Vt.fromReplace(t,this.from,this.to,r):Vt.fail("Content does not fit in gap")}getMap(){return new Nr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Ut(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new Ut(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ut(n.from,n.to,n.gapFrom,n.gapTo,fe.fromJSON(t,n.slice),n.insert,!!n.structure)}}on.jsonID("replaceAround",Ut);function Pb(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function sX(e,t,n,r){let o=[],i=[],s,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let p=Math.max(c,t),h=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let v=0;v<d.length;v++)d[v].isInSet(m)||(s&&s.to==p&&s.mark.eq(d[v])?s.to=h:o.push(s=new Oo(p,h,d[v])));a&&a.to==p?a.to=h:i.push(a=new Li(p,h,r))}}),o.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function aX(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Wp){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],p;for(let h=0;h<o.length;h++){let m=o[h];m.step==i-1&&d.eq(o[h].style)&&(p=m)}p?(p.to=c,p.step=i):o.push({style:d,from:Math.max(a,t),to:c,step:i})}}}),o.forEach(s=>e.step(new Oo(s.from,s.to,s.style)))}function BS(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new fn(a,u,fe.empty));else{r=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||e.step(new Oo(a,u,c.marks[p]));if(o&&c.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(c.text);)m||(m=new fe(q.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new fn(a+p.index,a+p.index+p[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(q.empty,!0);e.replace(a,a,new fe(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function lX(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ou(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let o=e.$from.node(r),i=e.$from.index(r),s=e.$to.indexAfter(r);if(r<e.depth&&o.canReplace(i,s,n))return r;if(r==0||o.type.spec.isolating||!lX(o,i,s))break}return null}function cX(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=q.empty,d=0;for(let m=i,v=!1;m>n;m--)v||r.index(m)>0?(v=!0,u=q.from(r.node(m).copy(u)),d++):l--;let p=q.empty,h=0;for(let m=i,v=!1;m>n;m--)v||o.after(m+1)<o.end(m)?(v=!0,p=q.from(o.node(m).copy(p)),h++):c++;e.step(new Ut(l,c,s,a,new fe(u.append(p),d,h),u.size-d,!0))}function $S(e,t,n=null,r=e){let o=uX(e,t),i=o&&dX(r,t);return i?o.map(P_).concat({type:t,attrs:n}).concat(i.map(P_)):null}function P_(e){return{type:e,attrs:null}}function uX(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}function dX(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function fX(e,t,n){let r=q.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=q.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new Ut(o,i,o,i,new fe(r,0,0),n.length,!0))}function pX(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&hX(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&OI(e,s,a,i),BS(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),d=u.map(a,1),p=u.map(a+s.nodeSize,1);return e.step(new Ut(d,p,d+1,p-1,new fe(q.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&TI(e,s,a,i),!1}})}function TI(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function OI(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text(`
404
- `))}})}function hX(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function mX(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Ut(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new fe(q.from(s),0,0),1,!0))}function Ic(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),p=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(p,d.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let v=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!v.type.validContent(h))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function gX(e,t,n=1,r){let o=e.doc.resolve(t),i=q.empty,s=q.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=q.from(o.node(a).copy(i));let u=r&&r[c];s=q.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}e.step(new fn(t,t,new fe(i.append(s),n,n),!0))}function Kp(e,t){let n=e.resolve(t),r=n.index();return yX(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function vX(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function yX(e,t){return!!(e&&t&&!e.isLeaf&&vX(e,t))}function xX(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);OI(e,u.node(),u.before(),a)}s.inlineContent&&BS(e,t+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new fn(c,l.map(t+n,-1),fe.empty,!0)),r===!0){let u=e.doc.resolve(c);TI(e,u.node(),u.before(),e.steps.length)}return e}function MI(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function PI(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function VS(e,t,n=t,r=fe.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return jI(o,i,r)?new fn(t,n,r):new bX(o,i,r).fit()}function jI(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class bX{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=q.empty;for(let o=0;o<=t.depth;o++){let i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(let o=t.depth;o>0;o--)this.placed=q.from(t.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new fe(i,s,a);return t>-1?new Ut(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new fn(r.pos,o.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=T0(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(q.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=T0(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new fe(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=T0(t,n);if(o.childCount<=1&&n>0){let i=t.size-n<=n+o.size;this.unplaced=new fe(dd(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new fe(dd(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let v=0;v<i.length;v++)this.openFrontierNode(i[v]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,c=0,u=[],{match:d,type:p}=this.frontier[n];if(o){for(let v=0;v<o.childCount;v++)u.push(o.child(v));d=d.matchFragment(o)}let h=a.size+t-(s.content.size-s.openEnd);for(;c<a.childCount;){let v=a.child(c),b=d.matchType(v.type);if(!b)break;c++,(c>1||l==0||v.content.size)&&(d=b,u.push(RI(v.mark(p.allowedMarks(v.marks)),c==1?l:0,c==a.childCount?h:-1)))}let m=c==a.childCount;m||(h=-1),this.placed=fd(this.placed,n,q.from(u)),this.frontier[n].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,b=a;v<h;v++){let x=b.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),b=x.content}this.unplaced=m?t==0?fe.empty:new fe(dd(s.content,t-1,1),t-1,h<0?s.openEnd:t-1):new fe(dd(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!O0(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),s=O0(t,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=O0(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=fd(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let o=t.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,i)}return t}openFrontierNode(t,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=fd(this.placed,this.depth,q.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(q.empty,!0);n.childCount&&(this.placed=fd(this.placed,this.frontier.length,n))}}function dd(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(dd(e.firstChild.content,t-1,n)))}function fd(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(fd(e.lastChild.content,t-1,n)))}function T0(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function RI(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,RI(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(q.empty,!0)))),e.copy(r)}function O0(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!wX(n,i.content,s)?a:null}function wX(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function SX(e){return e.spec.defining||e.spec.definingForContent}function kX(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(jI(o,i,r))return e.step(new fn(t,n,r));let s=II(o,e.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let p=o.depth,h=o.pos-1;p>0;p--,h--){let m=o.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==h&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,h=0;;h++){let m=p.firstChild;if(c.push(m),h==r.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=c[p],m=SX(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+u+1)%(r.openStart+1),m=c[h];if(m)for(let v=0;v<s.length;v++){let b=s[(v+l)%s.length],x=!0;b<0&&(x=!1,b=-b);let w=o.node(b-1),k=o.index(b-1);if(w.canReplaceWith(k,k,m.type,m.marks))return e.replace(o.before(b),x?i.after(b):n,new fe(AI(r.content,0,r.openStart,h),h,r.openEnd))}}let d=e.steps.length;for(let p=s.length-1;p>=0&&(e.replace(t,n,r),!(e.steps.length>d));p--){let h=s[p];h<0||(t=o.before(h),n=i.after(h))}}function AI(e,t,n,r,o){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(AI(i.content,t+1,n,r,i)))}if(t>r){let i=o.contentMatchAt(0),s=i.fillBefore(e).append(e);e=s.append(i.matchFragment(s).fillBefore(q.empty,!0))}return e}function EX(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=MI(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new fe(q.from(r),0,0))}function CX(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=II(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return e.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return e.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}function II(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let i=e.start(o);if(i<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(i==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==i-1)&&n.push(o)}return n}class Dc extends on{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Vt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Vt.fromReplace(t,this.pos,this.pos+1,new fe(q.from(o),0,n.isLeaf?0:1))}getMap(){return Nr.empty}invert(t){return new Dc(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Dc(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Dc(n.pos,n.attr,n.value)}}on.jsonID("attr",Dc);class Yf extends on{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Vt.ok(r)}getMap(){return Nr.empty}invert(t){return new Yf(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Yf(n.attr,n.value)}}on.jsonID("docAttr",Yf);let lu=class extends Error{};lu=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};lu.prototype=Object.create(Error.prototype);lu.prototype.constructor=lu;lu.prototype.name="TransformError";class _X{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Ac}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new lu(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=fe.empty){let o=VS(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new fe(q.from(r),0,0))}delete(t,n){return this.replace(t,n,fe.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return kX(this,t,n,r),this}replaceRangeWith(t,n,r){return EX(this,t,n,r),this}deleteRange(t,n){return CX(this,t,n),this}lift(t,n){return cX(this,t,n),this}join(t,n=1){return xX(this,t,n),this}wrap(t,n){return fX(this,t,n),this}setBlockType(t,n=t,r,o=null){return pX(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return mX(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new Dc(t,n,r)),this}setDocAttribute(t,n){return this.step(new Yf(t,n)),this}addNodeMark(t,n){return this.step(new Vs(t,n)),this}removeNodeMark(t,n){if(!(n instanceof nt)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n=n.isInSet(r.marks),!n)return this}return this.step(new au(t,n)),this}split(t,n=1,r){return gX(this,t,n,r),this}addMark(t,n,r){return sX(this,t,n,r),this}removeMark(t,n,r){return aX(this,t,n,r),this}clearIncompatible(t,n,r){return BS(this,t,n,r),this}}const M0=Object.create(null);class Ge{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new NX(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=fe.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=t.mapping.slice(i);t.replaceRange(u.map(l.pos),u.map(c.pos),a?fe.empty:n),a==0&&A_(t,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=t.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),A_(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new Fe(t):nc(t.node(0),t.parent,t.pos,t.index(),n,r);if(o)return o;for(let i=t.depth-1;i>=0;i--){let s=n<0?nc(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):nc(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(s)return s}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Kn(t.node(0))}static atStart(t){return nc(t,t,0,0,1)||new Kn(t)}static atEnd(t){return nc(t,t,t.content.size,t.childCount,-1)||new Kn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=M0[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in M0)throw new RangeError("Duplicate use of selection JSON ID "+t);return M0[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Fe.between(this.$anchor,this.$head).getBookmark()}}Ge.prototype.visible=!0;class NX{constructor(t,n){this.$from=t,this.$to=n}}let j_=!1;function R_(e){!j_&&!e.parent.inlineContent&&(j_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Fe extends Ge{constructor(t,n=t){R_(t),R_(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ge.near(r);let o=t.resolve(n.map(this.anchor));return new Fe(o.parent.inlineContent?o:r,r)}replace(t,n=fe.empty){if(super.replace(t,n),n==fe.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Fe&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Zv(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Fe(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let o=t.resolve(n);return new this(o,r==n?o:t.resolve(r))}static between(t,n,r){let o=t.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Ge.findFrom(n,r,!0)||Ge.findFrom(n,-r,!0);if(i)n=i.$head;else return Ge.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(Ge.findFrom(t,-r,!0)||Ge.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new Fe(t,n)}}Ge.jsonID("text",Fe);class Zv{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Zv(t.map(this.anchor),t.map(this.head))}resolve(t){return Fe.between(t.resolve(this.anchor),t.resolve(this.head))}}class Me extends Ge{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=t.resolve(o);return r?Ge.near(i):new Me(i)}content(){return new fe(q.from(this.node),0,0)}eq(t){return t instanceof Me&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new US(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Me(t.resolve(n.anchor))}static create(t,n){return new Me(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Me.prototype.visible=!1;Ge.jsonID("node",Me);class US{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Zv(r,r):new US(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Me.isSelectable(r)?new Me(n):Ge.near(n)}}class Kn extends Ge{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=fe.empty){if(n==fe.empty){t.delete(0,t.doc.content.size);let r=Ge.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Kn(t)}map(t){return new Kn(t)}eq(t){return t instanceof Kn}getBookmark(){return TX}}Ge.jsonID("all",Kn);const TX={map(){return this},resolve(e){return new Kn(e)}};function nc(e,t,n,r,o,i=!1){if(t.inlineContent)return Fe.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let a=t.child(s);if(a.isAtom){if(!i&&Me.isSelectable(a))return Me.create(e,n-(o<0?a.nodeSize:0))}else{let l=nc(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function A_(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof fn||o instanceof Ut))return;let i=e.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),e.setSelection(Ge.near(e.doc.resolve(s),n))}const I_=1,Rh=2,D_=4;class OX extends _X{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|I_)&~Rh,this.storedMarks=null,this}get selectionSet(){return(this.updated&I_)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Rh,this}ensureMarks(t){return nt.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Rh)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Rh,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||nt.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let o=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(t,i)),this.selection.empty||this.setSelection(Ge.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=D_,this}get scrolledIntoView(){return(this.updated&D_)>0}}function L_(e,t){return!t||!e?e:e.bind(t)}class pd{constructor(t,n,r){this.name=t,this.init=L_(n.init,r),this.apply=L_(n.apply,r)}}const MX=[new pd("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new pd("selection",{init(e,t){return e.selection||Ge.atStart(t.doc)},apply(e){return e.selection}}),new pd("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new pd("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class P0{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=MX.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new pd(r.key,r.spec.state,r))})}}class Xa{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Xa(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new OX(this)}static create(t){let n=new P0(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Xa(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}reconfigure(t){let n=new P0(this.schema,t.plugins),r=n.fields,o=new Xa(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(t,o)}return o}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let o=new P0(t.schema,t.plugins),i=new Xa(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=ea.fromJSON(t.schema,n.doc);else if(s.name=="selection")i.selection=Ge.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,t,n[a],i);return}}i[s.name]=s.init(t,i)}}),i}}function DI(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=DI(o,t,{})),n[r]=o}return n}class rs{constructor(t){this.spec=t,this.props={},t.props&&DI(t.props,this,this.props),this.key=t.key?t.key.key:LI("plugin")}getState(t){return t[this.key]}}const j0=Object.create(null);function LI(e){return e in j0?e+"$"+ ++j0[e]:(j0[e]=0,e+"$")}class Mu{constructor(t="key"){this.key=LI(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function FI(){return typeof document<"u"?document:null}function zI(e,t){if(typeof e!="string")return[e];var n=[e];typeof t=="string"||Array.isArray(t)?t={brackets:t}:t||(t={});var r=t.brackets?Array.isArray(t.brackets)?t.brackets:[t.brackets]:["{}","[]","()"],o=t.escape||"___",i=!!t.flat;r.forEach(function(l){var c=new RegExp(["\\",l[0],"[^\\",l[0],"\\",l[1],"]*\\",l[1]].join("")),u=[];function d(p,h,m){var v=n.push(p.slice(l[0].length,-l[1].length))-1;return u.push(v),o+v+o}n.forEach(function(p,h){for(var m,v=0;p!=m;)if(m=p,p=p.replace(c,d),v++>1e4)throw Error("References have circular dependency. Please, check them.");n[h]=p}),u=u.reverse(),n=n.map(function(p){return u.forEach(function(h){p=p.replace(new RegExp("(\\"+o+h+"\\"+o+")","g"),l[0]+"$1"+l[1])}),p})});var s=new RegExp("\\"+o+"([0-9]+)\\"+o);function a(l,c,u){for(var d=[],p,h=0;p=s.exec(l);){if(h++>1e4)throw Error("Circular references in parenthesis");d.push(l.slice(0,p.index)),d.push(a(c[p[1]],c)),l=l.slice(p.index+p[0].length)}return d.push(l),d}return i?n:a(n[0],n)}function BI(e,t){if(t&&t.flat){var n=t&&t.escape||"___",r=e[0],o;if(!r)return"";for(var i=new RegExp("\\"+n+"([0-9]+)\\"+n),s=0;r!=o;){if(s++>1e4)throw Error("Circular references in "+e);o=r,r=r.replace(i,a)}return r}return e.reduce(function l(c,u){return Array.isArray(u)&&(u=u.reduce(l,"")),c+u},"");function a(l,c){if(e[c]==null)throw Error("Reference "+c+"is undefined");return e[c]}}function $I(e,t){return Array.isArray(e)?BI(e,t):zI(e,t)}$I.parse=zI;$I.stringify=BI;const PX={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},jX={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},RX={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},AX={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},IX={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},DX={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},LX={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},FX={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var xa=Object.freeze({__proto__:null,COPY_DESCRIPTION:jX,COPY_LABEL:PX,CUT_DESCRIPTION:AX,CUT_LABEL:RX,PASTE_DESCRIPTION:DX,PASTE_LABEL:IX,SELECT_ALL_DESCRIPTION:FX,SELECT_ALL_LABEL:LX});const zX={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},BX={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var F_=Object.freeze({__proto__:null,DESCRIPTION:BX,LABEL:zX});const $X={id:"extension.command.toggle-heading.label",message:`{level, select, 1 {Heading 1}
405
- 2 {Heading 2}
406
- 3 {Heading 3}
407
- 4 {Heading 4}
408
- 5 {Heading 5}
409
- 6 {Heading 6}
410
- other {Heading}}`,comment:"Label for heading command with support for levels."};var VX=Object.freeze({__proto__:null,LABEL:$X});const UX={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},HX={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},WX={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},KX={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var _g=Object.freeze({__proto__:null,REDO_DESCRIPTION:KX,REDO_LABEL:WX,UNDO_DESCRIPTION:HX,UNDO_LABEL:UX});const qX={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},GX={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var z_=Object.freeze({__proto__:null,DESCRIPTION:GX,LABEL:qX});const YX={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},JX={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},XX={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var HS=Object.freeze({__proto__:null,BULLET_LIST_LABEL:JX,ORDERED_LIST_LABEL:YX,TASK_LIST_LABEL:XX});const ZX={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},QX={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},eZ={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},tZ={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var Ng=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:tZ,CONVERT_LABEL:eZ,INSERT_DESCRIPTION:QX,INSERT_LABEL:ZX});const nZ={id:"extension.command.toggle-strike.label",message:"Strikethrough",comment:"Label for strike formatting command."},rZ={id:"extension.command.toggle-strike.description",message:"Strikethrough the selected text",comment:"Description for strike formatting command."};var B_=Object.freeze({__proto__:null,DESCRIPTION:rZ,LABEL:nZ});class lo{constructor(t,n,r={}){this.match=t,this.match=t,this.handler=typeof n=="string"?oZ(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1}}function oZ(e){return function(t,n,r,o){let i=e;if(n[1]){let s=n[0].lastIndexOf(n[1]);i+=n[0].slice(s+n[1].length),r+=s;let a=r-o;a>0&&(i=n[0].slice(s-a,s)+i,r=o)}return t.tr.insertText(i,r,o)}}const iZ=500;function sZ({rules:e}){let t=new rs({state:{init(){return null},apply(n,r){let o=n.getMeta(this);return o||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,o,i){return $_(n,r,o,i,e,t)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&$_(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function $_(e,t,n,r,o,i){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t),l=a.parent.textBetween(Math.max(0,a.parentOffset-iZ),a.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let u=o[c];if(a.parent.type.spec.code){if(!u.inCode)continue}else if(u.inCode==="only")continue;let d=u.match.exec(l),p=d&&u.handler(s,d,t-(d[0].length-r.length),n);if(p)return u.undoable&&p.setMeta(i,{transform:p,from:t,to:n,text:r}),e.dispatch(p),!0}return!1}const aZ=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o=n[r],i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let s=e.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l--)s.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,e.schema.text(i.text,l))}else s.delete(i.from,i.to);t(s)}return!0}}return!1};new lo(/--$/,"—");new lo(/\.\.\.$/,"…");new lo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“");new lo(/"$/,"”");new lo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘");new lo(/'$/,"’");function WS(e,t,n=null,r){return new lo(e,(o,i,s,a)=>{let l=n instanceof Function?n(i):n,c=o.tr.delete(s,a),u=c.doc.resolve(s),d=u.blockRange(),p=d&&$S(d,t,l);if(!p)return null;c.wrap(d,p);let h=c.doc.resolve(s-1).nodeBefore;return h&&h.type==t&&Kp(c.doc,s-1)&&(!r||r(i,h))&&c.join(s-1),c})}function lZ(e,t,n=null){return new lo(e,(r,o,i,s)=>{let a=r.doc.resolve(i),l=n instanceof Function?n(o):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?r.tr.delete(i,s).setBlockType(i,i,t,l):null})}const bn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Jf=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let jb=null;const Ti=function(e,t,n){let r=jb||(jb=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},cZ=function(){jb=null},Nl=function(e,t,n,r){return n&&(V_(e,t,n,r,-1)||V_(e,t,n,r,1))},uZ=/^(img|br|input|textarea|hr)$/i;function V_(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Yr(e))){let i=e.parentNode;if(!i||i.nodeType!=1||qp(e)||uZ.test(e.nodeName)||e.contentEditable=="false")return!1;t=bn(e)+(o<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(o<0?-1:0)],e.contentEditable=="false")return!1;t=o<0?Yr(e):0}else return!1}}function Yr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function dZ(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Yr(e)}else if(e.parentNode&&!qp(e))t=bn(e),e=e.parentNode;else return null}}function fZ(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!qp(e))t=bn(e)+1,e=e.parentNode;else return null}}function pZ(e,t,n){for(let r=t==0,o=t==Yr(e);r||o;){if(e==n)return!0;let i=bn(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==Yr(e)}}function qp(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Qv=function(e){return e.focusNode&&Nl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Wa(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function hZ(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function mZ(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Yr(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Yr(r.startContainer),r.startOffset)}}}const di=typeof navigator<"u"?navigator:null,U_=typeof document<"u"?document:null,Ra=di&&di.userAgent||"",Rb=/Edge\/(\d+)/.exec(Ra),VI=/MSIE \d/.exec(Ra),Ab=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ra),dr=!!(VI||Ab||Rb),ta=VI?document.documentMode:Ab?+Ab[1]:Rb?+Rb[1]:0,Uo=!dr&&/gecko\/(\d+)/i.test(Ra);Uo&&+(/Firefox\/(\d+)/.exec(Ra)||[0,0])[1];const Ib=!dr&&/Chrome\/(\d+)/.exec(Ra),Ln=!!Ib,UI=Ib?+Ib[1]:0,Yn=!dr&&!!di&&/Apple Computer/.test(di.vendor),cu=Yn&&(/Mobile\/\w+/.test(Ra)||!!di&&di.maxTouchPoints>2),Kr=cu||(di?/Mac/.test(di.platform):!1),gZ=di?/Win/.test(di.platform):!1,Eo=/Android \d/.test(Ra),Gp=!!U_&&"webkitFontSmoothing"in U_.documentElement.style,vZ=Gp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yZ(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Si(e,t){return typeof e=="number"?e:e[t]}function xZ(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function H_(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;s=Jf(s)){if(s.nodeType!=1)continue;let a=s,l=a==i.body,c=l?yZ(i):xZ(a),u=0,d=0;if(t.top<c.top+Si(r,"top")?d=-(c.top-t.top+Si(o,"top")):t.bottom>c.bottom-Si(r,"bottom")&&(d=t.bottom-t.top>c.bottom-c.top?t.top+Si(o,"top")-c.top:t.bottom-c.bottom+Si(o,"bottom")),t.left<c.left+Si(r,"left")?u=-(c.left-t.left+Si(o,"left")):t.right>c.right-Si(r,"right")&&(u=t.right-c.right+Si(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-p,v=a.scrollTop-h;t={left:t.left-m,top:t.top-v,right:t.right-m,bottom:t.bottom-v}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function bZ(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let i=(t.left+t.right)/2,s=n+1;s<Math.min(innerHeight,t.bottom);s+=5){let a=e.root.elementFromPoint(i,s);if(!a||a==e.dom||!e.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:HI(e.dom)}}function HI(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Jf(r));return t}function wZ({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;WI(n,r==0?0:r-t)}function WI(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Gl=null;function SZ(e){if(e.setActive)return e.setActive();if(Gl)return e.focus(Gl);let t=HI(e);e.focus(Gl==null?{get preventScroll(){return Gl={preventScroll:!0},!0}}:void 0),Gl||(Gl=!1,WI(t,0))}function KI(e,t){let n,r=2e8,o,i=0,s=t.top,a=t.top,l,c;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Ti(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let v=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(v<r){n=u,r=v,o=v&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,u.nodeType==1&&v&&(i=d+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(i=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?kZ(n,o):!n||r&&n.nodeType==1?{node:e,offset:i}:KI(n,o)}function kZ(e,t){let n=e.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let i=ws(r,1);if(i.top!=i.bottom&&KS(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function KS(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function EZ(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function CZ(e,t,n){let{node:r,offset:o}=KI(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}function _Z(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let a=e.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText)return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter}i=a.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function qI(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=e.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(KS(t,c))return qI(s,t,c)}}if((i=(i+1)%r)==o)break}return e}function NZ(e,t){let n=e.dom.ownerDocument,r,o=0,i=mZ(n,t.left,t.top);i&&({node:r,offset:o}=i);let s=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),a;if(!s||!e.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=e.dom.getBoundingClientRect();if(!KS(t,c)||(s=qI(e.dom,t,c),!s))return null}if(Yn)for(let c=s;r&&c;c=Jf(c))c.draggable&&(r=void 0);if(s=EZ(s,t),r){if(Uo&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}let c;Gp&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&o--,r==e.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=_Z(e,r,o,t))}a==null&&(a=CZ(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function W_(e){return e.top<e.bottom||e.left<e.right}function ws(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(W_(r))return r}return Array.prototype.find.call(n,W_)||e.getBoundingClientRect()}const TZ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function GI(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Gp||Uo;if(r.nodeType==3)if(s&&(TZ.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=ws(Ti(r,o,o),n);if(Uo&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=ws(Ti(r,o-1,o-1),-1);if(c.top==l.top){let u=ws(Ti(r,o,o+1),-1);if(u.top!=l.top)return ed(u,u.left<c.left)}}return l}else{let l=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(l--,u=1):n<0?l--:c++,ed(ws(Ti(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Yr(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return R0(l.getBoundingClientRect(),!1)}if(i==null&&o<Yr(r)){let l=r.childNodes[o];if(l.nodeType==1)return R0(l.getBoundingClientRect(),!0)}return R0(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Yr(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Ti(l,Yr(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return ed(ws(c,1),!1)}if(i==null&&o<Yr(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Ti(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return ed(ws(c,-1),!0)}return ed(ws(r.nodeType==3?Ti(r):r,-n),n>=0)}function ed(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function R0(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function YI(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}function OZ(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return YI(e,t,()=>{let{node:i}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=GI(e,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Ti(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const MZ=/[\u0590-\u08ac]/;function PZ(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?!MZ.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:YI(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=e.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:v}=e.domSelectionRange(),b=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==v;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return p!=null&&(a.caretBidiLevel=p),b}):r.pos==r.start()||r.pos==r.end()}let K_=null,q_=null,G_=!1;function jZ(e,t,n){return K_==t&&q_==n?G_:(K_=t,q_=n,G_=n=="up"||n=="down"?OZ(e,t,n):PZ(e,t,n))}const Qr=0,Y_=1,Za=2,fi=3;class Yp{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Qr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==t)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,s;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>bn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,o=t;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==t&&i!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(t<i)return o.descAt(t-r-o.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>t||s instanceof XI){o=t-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof JI&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?bn(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?bn(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&t<=c){let u=s+l.border;if(t>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,u);t=s;for(let d=a;d>0;d--){let p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=bn(p.dom)+1;break}t-=p.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=bn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,o=!1){let i=Math.min(t,n),s=Math.max(t,n);for(let h=0,m=0;h<this.children.length;h++){let v=this.children[h],b=m+v.size;if(i>m&&s<b)return v.setSelection(t-m-v.border,n-m-v.border,r,o);m=b}let a=this.domFromPos(t,t?-1:1),l=n==t?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Uo||Yn)&&t==n){let{node:h,offset:m}=a;if(h.nodeType==3){if(d=!!(m&&h.nodeValue[m-1]==`
411
- `),d&&m==h.nodeValue.length)for(let v=h,b;v;v=v.parentNode){if(b=v.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:bn(b)+1});break}let x=v.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let v=h.childNodes[m-1];d=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Uo&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&Yn)&&Nl(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Nl(l.node,l.offset,u.focusNode,u.focusOffset))return;let p=!1;if((c.extend||t==n)&&!d){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(t>n){let m=a;a=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?t<=s&&n>=r:t<s&&n>r){let a=r+i.border,l=s-i.border;if(t>=a&&n<=l){this.dirty=t==r||n==s?Za:Y_,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=fi:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Za:fi}r=s}this.dirty=Za}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?Za:Y_;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(t){return!1}}class JI extends Yp{constructor(t,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(t,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==Qr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class RZ extends Yp{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Tl extends Yp{constructor(t,n,r,o,i){super(t,[],r,o),this.mark=n,this.spec=i}static create(t,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=ja.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Tl(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&fi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=fi&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Qr}}slice(t,n,r){let o=Tl.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Lb(i,n,s,r)),t>0&&(i=Lb(i,0,t,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class na extends Yp{constructor(t,n,r,o,i,s,a,l,c){super(t,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(t,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=ja.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=eD(u,r,n),c?l=new AZ(t,n,r,o,u,d||null,p,c,i,s+1):n.isText?new ey(t,n,r,o,u,p,i):new na(t,n,r,o,u,d||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>q.empty)}return t}matchesNode(t,n,r){return this.dirty==Qr&&t.eq(this.node)&&Tg(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,o=n,i=t.composing?this.localCompositionInfo(t,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new DZ(this,s&&s.node,t);zZ(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?nt.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,o)},(c,u,d,p)=>{l.syncToMarks(c.marks,r,t);let h;l.findNodeMatch(c,u,d,p)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,h,t)||l.updateNextNode(c,u,d,t,p,o)||l.addNode(c,u,d,t,o),o+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Za)&&(s&&this.protectLocalComposition(t,s),ZI(this.contentDOM,this.children,t),cu&&BZ(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof Fe)||r<n||o>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=$Z(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(t,{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 RZ(this,i,n,o);t.input.compositionNodes.push(s),this.children=Lb(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==fi||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,o),!0)}updateInner(t,n,r,o){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Qr}updateOuterDeco(t){if(Tg(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=QI(this.dom,this.nodeDOM,Db(this.outerDeco,this.node,n),Db(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function J_(e,t,n,r,o){eD(r,t,e);let i=new na(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class ey extends na{constructor(t,n,r,o,i,s,a){super(t,n,r,o,i,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,o){return this.dirty==fi||this.dirty!=Qr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=Qr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let o=this.node.cut(t,n),i=document.createTextNode(o.text);return new ey(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=fi)}get domAtom(){return!1}isText(t){return this.node.text==t}}class XI extends Yp{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Qr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class AZ extends na{constructor(t,n,r,o,i,s,a,l,c,u){super(t,n,r,o,i,s,a,c,u),this.spec=l}update(t,n,r,o){if(this.dirty==fi)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,o),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,o){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function ZI(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=X_(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Tl){let l=r?r.previousSibling:e.lastChild;ZI(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=X_(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Yd=function(e){e&&(this.nodeName=e)};Yd.prototype=Object.create(null);const Qa=[new Yd];function Db(e,t,n){if(e.length==0)return Qa;let r=n?Qa[0]:new Yd,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Yd(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Yd(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function QI(e,t,n,r){if(n==Qa&&r==Qa)return t;let o=t;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=Qa[0]),o=l}IZ(o,a||Qa[0],s)}return o}function IZ(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&e.classList.add(o[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(t.style);)e.style.removeProperty(o[1])}n.style&&(e.style.cssText+=n.style)}}function eD(e,t,n){return QI(e,e,Qa,Db(t,n,e.nodeType!=1))}function Tg(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function X_(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class DZ{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=LZ(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,t.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Qr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(t[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Tl.create(this.top,t[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(t,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(t,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,o,i){let s=this.top.children[o];return s.dirty==fi&&s.dom==s.contentDOM&&(s.dirty=Za),s.update(t,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}t=n}}updateNextNode(t,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof na){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,p=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=fi&&Tg(n,l.outerDeco));if(!p&&l.update(t,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(d=this.recreateWrapper(l,t,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Za,d.updateChildren(o,s+1),d.dirty=Qr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,i,s){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!Tg(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=na.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,n,r,o,i){let s=na.create(this.top,t,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(t)&&(t==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new JI(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof Tl;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof ey)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Yn||Ln)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new XI(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function LZ(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Tl)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function FZ(e,t){return e.type.side-t.type.side}function zZ(e,t,n,r){let o=t.locals(e),i=0;if(o.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,o,t.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let b=o[s++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(FZ);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let p,h;if(l)h=-1,p=l,l=null;else if(c<e.childCount)h=c,p=e.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let m=i+p.nodeSize;if(p.isText){let b=m;s<o.length&&o[s].from<b&&(b=o[s].from);for(let x=0;x<a.length;x++)a[x].to<b&&(b=a[x].to);b<m&&(l=p.cut(b-i),p=p.cut(0,b-i),m=b,h=-1)}else for(;s<o.length&&o[s].to<m;)s++;let v=p.isInline&&!p.isLeaf?a.filter(b=>!b.inline):a.slice();r(p,v,t.forChild(i,p),h),i=m}}function BZ(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function $Z(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=n)return a+c;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function Lb(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function qS(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Qv(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Me.isSelectable(d)&&o.parent&&!(d.isInline&&pZ(n.focusNode,n.focusOffset,o.dom))){let p=o.posBefore;c=new Me(s==p?a:r.resolve(p))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,s]=p==e.state.selection.anchor?[p,d]:[d,p],a=r.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;c=GS(e,u,a,d)}return c}function tD(e){return e.editable?e.hasFocus():rD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function $i(e,t=!1){let n=e.state.selection;if(nD(e,n),!!tD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Ln){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Nl(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)UZ(e);else{let{anchor:r,head:o}=n,i,s;Z_&&!(n instanceof Fe)&&(n.$from.parent.inlineContent||(i=Q_(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Q_(e,n.to))),e.docView.setSelection(r,o,e,t),Z_&&(i&&eN(i),s&&eN(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&VZ(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Z_=Yn||Ln&&UI<63;function Q_(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Yn&&o&&o.contentEditable=="false")return A0(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return A0(o);if(i)return A0(i)}}function A0(e){return e.contentEditable="true",Yn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function eN(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function VZ(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!tD(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function UZ(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let r=e.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,bn(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&dr&&ta<=11&&(r.disabled=!0,r.disabled=!1)}function nD(e,t){if(t instanceof Me){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(tN(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else tN(e)}function tN(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function GS(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Fe.between(t,n,r)}function nN(e){return e.editable&&!e.hasFocus()?!1:rD(e)}function rD(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function HZ(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Nl(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Fb(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Ge.findFrom(i,t)}function Ts(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function rN(e,t,n){let r=e.state.selection;if(r instanceof Fe)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=e.state.doc.resolve(o.pos+i.nodeSize*(t<0?-1:1));return Ts(e,new Fe(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=Fb(e.state,t);return o&&o instanceof Me?Ts(e,o):!1}else if(!(Kr&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=t<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=e.docView.descAt(a))&&!s.contentDOM?Me.isSelectable(i)?Ts(e,new Me(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):Gp?Ts(e,new Fe(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Me&&r.node.isInline)return Ts(e,new Fe(t>0?r.$to:r.$from));{let o=Fb(e.state,t);return o?Ts(e,o):!1}}}function Og(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Jd(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Yl(e,t){return t<0?WZ(e):KZ(e)}function WZ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(Uo&&n.nodeType==1&&r<Og(n)&&Jd(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Jd(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(oD(n))break;{let a=n.previousSibling;for(;a&&Jd(a,-1);)o=n.parentNode,i=bn(a),a=a.previousSibling;if(a)n=a,r=Og(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?zb(e,n,r):o&&zb(e,o,i)}function KZ(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=Og(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Jd(a,1))i=n,s=++r;else break}else{if(oD(n))break;{let a=n.nextSibling;for(;a&&Jd(a,1);)i=a.parentNode,s=bn(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=Og(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&zb(e,i,s)}function oD(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function qZ(e,t){for(;e&&t==e.childNodes.length&&!qp(e);)t=bn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function GZ(e,t){for(;e&&!t&&!qp(e);)t=bn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function zb(e,t,n){if(t.nodeType!=3){let i,s;(s=qZ(t,n))?(t=s,n=0):(i=GZ(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Qv(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&$i(e)},50)}function oN(e,t){let n=e.state.doc.resolve(t);if(!(Ln||gZ)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-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(t<n.end()){let i=e.coordsAtPos(t+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(e.dom).direction=="rtl"?"rtl":"ltr"}function iN(e,t,n){let r=e.state.selection;if(r instanceof Fe&&!r.empty||n.indexOf("s")>-1||Kr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=Fb(e.state,t);if(s&&s instanceof Me)return Ts(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,a=r instanceof Kn?Ge.near(s,t):Ge.findFrom(s,t);return a?Ts(e,a):!1}return!1}function sN(e,t){if(!(e.state.selection instanceof Fe))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=e.state.tr;return t<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),e.dispatch(s),!0}return!1}function aN(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function YZ(e){if(!Yn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;aN(e,r,"true"),setTimeout(()=>aN(e,r,"false"),20)}return!1}function JZ(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function XZ(e,t){let n=t.keyCode,r=JZ(t);if(n==8||Kr&&n==72&&r=="c")return sN(e,-1)||Yl(e,-1);if(n==46&&!t.shiftKey||Kr&&n==68&&r=="c")return sN(e,1)||Yl(e,1);if(n==13||n==27)return!0;if(n==37||Kr&&n==66&&r=="c"){let o=n==37?oN(e,e.state.selection.from)=="ltr"?-1:1:-1;return rN(e,o,r)||Yl(e,o)}else if(n==39||Kr&&n==70&&r=="c"){let o=n==39?oN(e,e.state.selection.from)=="ltr"?1:-1:1;return rN(e,o,r)||Yl(e,o)}else{if(n==38||Kr&&n==80&&r=="c")return iN(e,-1,r)||Yl(e,-1);if(n==40||Kr&&n==78&&r=="c")return YZ(e)||iN(e,1,r)||Yl(e,1);if(r==(Kr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function iD(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=e.someProp("clipboardSerializer")||ja.fromSchema(e.state.schema),a=dD(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=uD[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let p=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
412
-
413
- `);return{dom:l,text:p,slice:t}}function sD(e,t,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!t)return null;let l=t&&(r||i||!n);if(l){if(e.someProp("transformPastedText",p=>{t=p(t,i||r,e)}),i)return t?new fe(q.from(e.state.schema.text(t.replace(/\r\n?/g,`
414
- `))),0,0):fe.empty;let d=e.someProp("clipboardTextParser",p=>p(t,o,r,e));if(d)a=d;else{let p=o.marks(),{schema:h}=e.state,m=ja.fromSchema(h);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let b=s.appendChild(document.createElement("p"));v&&b.appendChild(m.serializeNode(h.text(v,p)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=tQ(n),Gp&&nQ(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||su.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!ZZ.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)a=rQ(lN(a,+u[1],+u[2]),u[4]);else if(a=fe.maxOpen(QZ(a.content,o),!0),a.openStart||a.openEnd){let d=0,p=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;p<a.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);a=lN(a,d,p)}return e.someProp("transformPasted",d=>{a=d(a,e)}),a}const ZZ=/^(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 QZ(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o=t.node(n).contentMatchAt(t.index(n)),i,s=[];if(e.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&i.length&&lD(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=cD(s[s.length-1],i.length));let u=aD(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return q.from(s)}return e}function aD(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function lD(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=lD(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(q.from(aD(n,e,o+1))))}}function cD(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,cD(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function Bb(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=Bb(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function lN(e,t,n){return t<e.openStart&&(e=new fe(Bb(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new fe(Bb(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const uD={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 cN=null;function dD(){return cN||(cN=document.implementation.createHTMLDocument("title"))}let I0=null;function eQ(e){let t=window.trustedTypes;return t?(I0||(I0=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),I0.createHTML(e)):e}function tQ(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=dD().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&uD[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eQ(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function nQ(e){let t=e.querySelectorAll(Ln?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function rQ(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:o,openStart:i,openEnd:s}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=q.from(l.create(r[a+1],o)),i++,s++}return new fe(o,i,s)}const Jn={},Xn={},oQ={touchstart:!0,touchmove:!0};class iQ{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=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 sQ(e){for(let t in Jn){let n=Jn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{lQ(e,r)&&!YS(e,r)&&(e.editable||!(r.type in Xn))&&n(e,r)},oQ[t]?{passive:!0}:void 0)}Yn&&e.dom.addEventListener("input",()=>null),$b(e)}function Us(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function aQ(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function $b(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>YS(e,r))})}function YS(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function lQ(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function cQ(e,t){!YS(e,t)&&Jn[t.type]&&(e.editable||!(t.type in Xn))&&Jn[t.type](e,t)}Xn.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!pD(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Eo&&Ln&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),cu&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",o=>o(e,Wa(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||XZ(e,n)?n.preventDefault():Us(e,"key")};Xn.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Xn.keypress=(e,t)=>{let n=t;if(pD(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Kr&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Fe)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,o))&&e.dispatch(e.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function ty(e){return{left:e.clientX,top:e.clientY}}function uQ(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function JS(e,t,n,r,o){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,a=>s>i.depth?a(e,n,i.nodeAfter,i.before(s),o,!0):a(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Lc(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function dQ(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Me.isSelectable(r)?(Lc(e,new Me(n)),!0):!1}function fQ(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof Me&&(r=n.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(Me.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?(Lc(e,Me.create(e.state.doc,o)),!0):!1}function pQ(e,t,n,r,o){return JS(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?fQ(e,n):dQ(e,n))}function hQ(e,t,n,r){return JS(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function mQ(e,t,n,r){return JS(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||gQ(e,n,r)}function gQ(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Lc(e,Fe.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);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)Lc(e,Fe.create(r,a+1,a+1+s.content.size));else if(Me.isSelectable(s))Lc(e,Me.create(r,a));else continue;return!0}}function XS(e){return Mg(e)}const fD=Kr?"metaKey":"ctrlKey";Jn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=XS(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&uQ(n,e.input.lastClick)&&!n[fD]&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(ty(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new vQ(e,s,n,!!r)):(i=="doubleClick"?hQ:mQ)(e,s.pos,s.inside,n)?n.preventDefault():Us(e,"pointer"))};class vQ{constructor(t,n,r,o){this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[fD],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Me&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Uo&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Us(t,"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(()=>$i(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ty(t))),this.updateAllowDefault(t),this.allowDefault||!n?Us(this.view,"pointer"):pQ(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Yn&&this.mightDrag&&!this.mightDrag.node.isAtom||Ln&&!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)?(Lc(this.view,Ge.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Us(this.view,"pointer")}move(t){this.updateAllowDefault(t),Us(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Jn.touchstart=e=>{e.input.lastTouch=Date.now(),XS(e),Us(e,"pointer")};Jn.touchmove=e=>{e.input.lastTouch=Date.now(),Us(e,"pointer")};Jn.contextmenu=e=>XS(e);function pD(e,t){return e.composing?!0:Yn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const yQ=Eo?5e3:-1;Xn.compositionstart=Xn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Fe&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Mg(e,!0),e.markCursor=null;else if(Mg(e,!t.selection.empty),Uo&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.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=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}e.input.composing=!0}hD(e,yQ)};Xn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,hD(e,20))};function hD(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Mg(e),t))}function mD(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=bQ());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function xQ(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=dZ(t.focusNode,t.focusOffset),r=fZ(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function bQ(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Mg(e,t=!1){if(!(Eo&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),mD(e),t||e.docView&&e.docView.dirty){let n=qS(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!e.state.selection.empty?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function wQ(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Xf=dr&&ta<15||cu&&vZ<604;Jn.copy=Xn.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=Xf?null:n.clipboardData,s=r.content(),{dom:a,text:l}=iD(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):wQ(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function SQ(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function kQ(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Zf(e,r.value,null,o,t):Zf(e,r.textContent,r.innerHTML,o,t)},50)}function Zf(e,t,n,r,o){let i=sD(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||fe.empty)))return!0;if(!i)return!1;let s=SQ(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function gD(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Xn.paste=(e,t)=>{let n=t;if(e.composing&&!Eo)return;let r=Xf?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Zf(e,gD(r),r.getData("text/html"),o,n)?n.preventDefault():kQ(e,n)};class vD{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const yD=Kr?"altKey":"ctrlKey";Jn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,i=o.empty?null:e.posAtCoords(ty(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Me?o.to-1:o.to))){if(r&&r.mightDrag)s=Me.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(s=Me.create(e.state.doc,d.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=iD(e,a);(!n.dataTransfer.files.length||!Ln||UI>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Xf?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Xf||n.dataTransfer.setData("text/plain",c),e.dragging=new vD(u,!n[yD],s)};Jn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Xn.dragover=Xn.dragenter=(e,t)=>t.preventDefault();Xn.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(ty(n));if(!o)return;let i=e.state.doc.resolve(o.pos),s=r&&r.slice;s?e.someProp("transformPasted",m=>{s=m(s,e)}):s=sD(e,gD(n.dataTransfer),Xf?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[yD]);if(e.someProp("handleDrop",m=>m(e,n,s||fe.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?PI(e.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=e.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let h=c.doc.resolve(u);if(d&&Me.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Me(h));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,b,x,w)=>m=w),c.setSelection(GS(e,h,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};Jn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&$i(e)},20))};Jn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Jn.beforeinput=(e,t)=>{if(Ln&&Eo&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,Wa(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let e in Xn)Jn[e]=Xn[e];function Qf(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Pg{constructor(t,n){this.toDOM=t,this.spec=n||ul,this.side=this.spec.side||0}map(t,n,r,o){let{pos:i,deleted:s}=t.mapResult(n.from+o,this.side<0?-1:1);return s?null:new _t(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Pg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Qf(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ra{constructor(t,n){this.attrs=t,this.spec=n||ul}map(t,n,r,o){let i=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new _t(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof ra&&Qf(this.attrs,t.attrs)&&Qf(this.spec,t.spec)}static is(t){return t.type instanceof ra}destroy(){}}class ZS{constructor(t,n){this.attrs=t,this.spec=n||ul}map(t,n,r,o){let i=t.mapResult(n.from+o,1);if(i.deleted)return null;let s=t.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new _t(i.pos-r,s.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),i;return o==n.from&&!(i=t.child(r)).isText&&o+i.nodeSize==n.to}eq(t){return this==t||t instanceof ZS&&Qf(this.attrs,t.attrs)&&Qf(this.spec,t.spec)}destroy(){}}class _t{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new _t(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new _t(t,t,new Pg(n,r))}static inline(t,n,r,o){return new _t(t,n,new ra(r,o))}static node(t,n,r,o){return new _t(t,n,new ZS(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ra}get widget(){return this.type instanceof Pg}}const rc=[],ul={};class it{constructor(t,n){this.local=t.length?t:rc,this.children=n.length?n:rc}static create(t,n){return n.length?jg(n,t,0,ul):In}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=t&&(!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]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,n-a,r,o+a,i)}}map(t,n,r){return this==In||t.maps.length==0?this:this.mapInner(t,n,0,0,r||ul)}mapInner(t,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?EQ(this.children,s||[],t,n,r,o,i):s?new it(s.sort(dl),rc):In}add(t,n){return n.length?this==In?it.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=bD(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,jg(u,a,c+1,ul)),i+=3}});let s=xD(i?wD(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new it(s.length?this.local.concat(s).sort(dl):this.local,o||this.children)}remove(t){return t.length==0||this==In?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<t.length;u++)(d=t[u])&&d.from>a&&d.to<l&&(t[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=In?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<t.length;i++)if(s=t[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 it(o,r):In}forChild(t,n){if(this==In)return this;if(n.isLeaf)return it.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof ra){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new it(o.sort(dl),rc);return r?new Rs([a,r]):a}return r||In}eq(t){if(this==t)return!0;if(!(t instanceof it)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return QS(this.localsInner(t))}localsInner(t){if(this==In)return rc;if(t.inlineContent||!this.local.some(ra.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ra||n.push(this.local[r]);return n}forEachSet(t){t(this)}}it.empty=new it([],[]);it.removeOverlap=QS;const In=it.empty;class Rs{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,ul));return Rs.from(r)}forChild(t,n){if(n.isLeaf)return it.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=In&&(i instanceof Rs?r=r.concat(i.members):r.push(i))}return Rs.from(r)}eq(t){if(!(t instanceof Rs)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(t);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?QS(r?n:n.sort(dl)):rc}static from(t){switch(t.length){case 0:return In;case 1:return t[0];default:return new Rs(t.every(n=>n instanceof it)?t:t.reduce((n,r)=>n.concat(r instanceof it?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function EQ(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((p,h,m,v)=>{let b=v-m-(h-p);for(let x=0;x<a.length;x+=3){let w=a[x+1];if(w<0||p>w+u-d)continue;let k=a[x]+u-d;h>=k?a[x+1]=p<=k?-2:-1:p>=u&&b&&(a[x]+=b,a[x+1]+=b)}d+=b}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let p=n.map(e[c+1]+i,-1),h=p-o,{index:m,offset:v}=r.content.findIndex(d),b=r.maybeChild(m);if(b&&v==d&&v+b.nodeSize==h){let x=a[c+2].mapInner(n,b,u+1,e[c]+i+1,s);x!=In?(a[c]=d,a[c+1]=h,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=CQ(a,e,t,n,o,i,s),u=jg(c,r,0,s);t=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,p=0;d<u.children.length;d+=3){let h=u.children[d];for(;p<a.length&&a[p]<h;)p+=3;a.splice(p,0,u.children[d],u.children[d+1],u.children[d+2])}}return new it(t.sort(dl),a)}function xD(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new _t(o.from+t,o.to+t,o.type))}return n}function CQ(e,t,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function bD(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i=0,s;i<e.length;i++)(s=e[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),e[i]=null);return o}function wD(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function jg(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=bD(e,a,l+n);if(c){i=!0;let u=jg(c,a,n+l+1,r);u!=In&&o.push(l,l+a.nodeSize,u)}});let s=xD(i?wD(e):e,-n).sort(dl);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new it(s,o):In}function dl(e,t){return e.from-t.from||e.to-t.to}function QS(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),uN(t,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),uN(t,o,r.copy(i.from,r.to)));break}}}return t}function uN(e,t,n){for(;t<e.length&&dl(n,e[t])>0;)t++;e.splice(t,0,n)}function D0(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=In&&t.push(r)}),e.cursorWrapper&&t.push(it.create(e.state.doc,[e.cursorWrapper.deco])),Rs.from(t)}const _Q={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},NQ=dr&&ta<=11;class TQ{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class OQ{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new TQ,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]);dr&&ta<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),NQ&&(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,_Q)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[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(nN(this.view)){if(this.suppressingSelectionUpdates)return $i(this.view);if(dr&&ta<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Nl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=Jf(i))n.add(i);for(let i=t.anchorNode;i;i=Jf(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 t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nN(t)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);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(Uo&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,p]=u;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!d||jQ(t,d)!=h)&&p.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Qv(r)&&(c=qS(t))&&c.eq(Ge.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,$i(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),MQ(t)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||$i(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let d=t.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,i=t.nextSibling;if(dr&&ta<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:p}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!p||Array.prototype.indexOf.call(t.addedNodes,p)<0)&&(i=p)}let s=o&&o.parentNode==t.target?bn(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?bn(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let dN=new WeakMap,fN=!1;function MQ(e){if(!dN.has(e)&&(dN.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Uo,fN)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."),fN=!0}}function pN(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return Nl(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function PQ(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return pN(e,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?pN(e,n):null}function jQ(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function RQ(e,t,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Qv(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Ln&&e.input.lastKeyCode===8)for(let b=i;b>o;b--){let x=r.childNodes[b-1],w=x.pmViewDesc;if(x.nodeName=="BR"&&!w){i=b;break}if(!w||w.size)break}let d=e.state.doc,p=e.someProp("domParser")||su.fromSchema(e.state.schema),h=d.resolve(s),m=null,v=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:AQ,context:h});if(c&&c[0].pos!=null){let b=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=b),m={anchor:b+s,head:x+s}}return{doc:v,sel:m,from:s,to:a}}function AQ(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Yn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Yn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const IQ=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function DQ(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let A=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,D=qS(e,A);if(D&&!e.state.selection.eq(D)){if(Ln&&Eo&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",W=>W(e,Wa(13,"Enter"))))return;let V=e.state.tr.setSelection(D);A=="pointer"?V.setMeta("pointer",!0):A=="key"&&V.scrollIntoView(),i&&V.setMeta("composition",i),e.dispatch(V)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=RQ(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),p,h;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(p=e.state.selection.to,h="end"):(p=e.state.selection.from,h="start"),e.input.lastKeyCode=null;let m=zQ(d.content,c.doc.content,c.from,p,h);if(m&&e.input.domChangeCount++,(cu&&e.input.lastIOSEnter>Date.now()-225||Eo)&&o.some(A=>A.nodeType==1&&!IQ.test(A.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",A=>A(e,Wa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Fe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=hN(e,e.state.doc,c.sel);if(A&&!A.eq(e.state.selection)){let D=e.state.tr.setSelection(A);i&&D.setMeta("composition",i),e.dispatch(D)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Fe&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),dr&&ta<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let v=c.doc.resolveNoCache(m.start-c.from),b=c.doc.resolveNoCache(m.endB-c.from),x=u.resolve(m.start),w=v.sameParent(b)&&v.parent.inlineContent&&x.end()>=m.endA,k;if((cu&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!w&&v.pos<c.doc.content.size&&!v.sameParent(b)&&(k=Ge.findFrom(c.doc.resolve(v.pos+1),1,!0))&&k.head==b.pos)&&e.someProp("handleKeyDown",A=>A(e,Wa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&FQ(u,m.start,m.endA,v,b)&&e.someProp("handleKeyDown",A=>A(e,Wa(8,"Backspace")))){Eo&&Ln&&e.domObserver.suppressSelectionUpdates();return}Ln&&Eo&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),Eo&&!w&&v.start()!=b.start()&&b.parentOffset==0&&v.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,b=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(A){return A(e,Wa(13,"Enter"))})},20));let C=m.start,_=m.endA,O,T,j;if(w){if(v.pos==b.pos)dr&&ta<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>$i(e),20)),O=e.state.tr.delete(C,_),T=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(j=LQ(v.parent.content.cut(v.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start()))))O=e.state.tr,j.type=="add"?O.addMark(C,_,j.mark):O.removeMark(C,_,j.mark);else if(v.parent.child(v.index()).isText&&v.index()==b.index()-(b.textOffset?0:1)){let A=v.parent.textBetween(v.parentOffset,b.parentOffset);if(e.someProp("handleTextInput",D=>D(e,C,_,A)))return;O=e.state.tr.insertText(A,C,_)}}if(O||(O=e.state.tr.replace(C,_,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let A=hN(e,O.doc,c.sel);A&&!(Ln&&Eo&&e.composing&&A.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(A.head==C||A.head==O.mapping.map(_)-1)||dr&&A.empty&&A.head==C)&&O.setSelection(A)}T&&O.ensureMarks(T),i&&O.setMeta("composition",i),e.dispatch(O.scrollIntoView())}function hN(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:GS(e,t.resolve(n.anchor),t.resolve(n.head))}function LQ(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(q.from(c).eq(e))return{mark:a,type:s}}function FQ(e,t,n,r,o){if(n-t<=o.pos-r.pos||L0(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(L0(i,!0,!0));return!s.parent.isTextblock||s.pos>n||L0(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function L0(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function zQ(e,t,n,r,o){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&e.size<t.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<t.size&&mN(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&mN(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function mN(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class BQ{constructor(t,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 iQ,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(bN),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=yN(this),vN(this),this.nodeViews=xN(this),this.docView=J_(this.state.doc,gN(this),D0(this),this.dom,this),this.domObserver=new OQ(this,(r,o,i,s)=>DQ(this,r,o,i,s)),this.domObserver.start(),sQ(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&$b(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(bN),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let o=this.state,i=!1,s=!1;t.storedMarks&&this.composing&&(mD(this),s=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=xN(this);VQ(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&$b(this),this.editable=yN(this),vN(this);let l=D0(this),c=gN(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,c,l);(d||!t.selection.eq(o.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&bZ(this);if(s){this.domObserver.stop();let h=d&&(dr||Ln)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&$Q(o.selection,t.selection);if(d){let m=Ln?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=xQ(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=J_(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&HZ(this))?$i(this,h):(nD(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&wZ(p)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Me){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&H_(this,n.getBoundingClientRect(),t)}else H_(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.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,t)}}updateDraggedNode(t,n){let r=t.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 vD(t.slice,t.move,o<0?void 0:Me.create(this.state.doc,o))}someProp(t,n){let r=this._props&&this._props[t],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[t];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[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(dr){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&SZ(this.dom),$i(this),this.domObserver.start()}get root(){let t=this._root;if(t==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 t||document}updateRoot(){this._root=null}posAtCoords(t){return NZ(this,t)}coordsAtPos(t,n=1){return GI(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let o=this.docView.posFromDOM(t,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,n){return jZ(this,n||this.state,t)}pasteHTML(t,n){return Zf(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Zf(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(aQ(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],D0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,cZ())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return cQ(this,t)}dispatch(t){let n=this._props.dispatchTransaction;n?n.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?Yn&&this.root.nodeType===11&&hZ(this.dom.ownerDocument)==this.dom&&PQ(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function gN(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[_t.node(0,e.state.doc.content.size,t)]}function vN(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:_t.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function yN(e){return!e.someProp("editable",t=>t(e.state)===!1)}function $Q(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function xN(e){let t=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=r[o])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function VQ(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r}function bN(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var UQ=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const HQ=ka(UQ);function WQ(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function KQ(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function qQ(e){return!!(!e.prev&&e.next)}function GQ(e){return!!(e.prev&&!e.next)}function YQ(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function JQ(e){return e==="invalid-exit-split"}var XQ=["jump-backward-exit","jump-forward-exit"],ZQ=["jump-backward-change","jump-forward-change"];function QQ(e){var t,n;return Vo(XQ,(t=e.exit)==null?void 0:t.exitReason)||Vo(ZQ,(n=e.change)==null?void 0:n.changeReason)}function wN(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function SN(e){return Bn(e)&&e instanceof Fe}function ir(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function eee(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(Ub(n)).test(e):new RegExp(Ub(r)).test(e)}function tee(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,i=r.start();let s;return Xv(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(eee(l,o)){const c=a.index+i,u=a[0],d=a[1];if(!Le(u)||!Le(d))return;const p=c+u.length,h=Math.min(p,r.pos),m=h-c;c<r.pos&&p>=r.pos&&(s={range:{from:c,to:p,cursor:h},match:a,query:{partial:u.slice(d.length,m),full:u.slice(d.length)},text:{partial:u.slice(0,m),full:u},textAfter:r.doc.textBetween(p,r.end(),$s,$s),textBefore:r.doc.textBetween(i,c,$s,$s),suggester:o})}}),s}function SD(e){const{$pos:t,suggester:n}=e,{char:r,name:o,startOfLine:i,supportedCharacters:s,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,d=uee({char:r,matchOffset:a,startOfLine:i,supportedCharacters:s,multiline:l,caseInsensitive:c,unicode:u}),p=t.doc.textBetween(t.before(),t.end(),$s,$s);return tee({suggester:n,text:p,regexp:d,$pos:t,char:r,name:o})}function kD(e){const{state:t,match:n}=e;try{return SD({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function ED(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:ir({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:ir({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:ir({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:ir({match:n,exitReason:"exit-split"})}:{}}function nee(e){const{prev:t,next:n,state:r}=e,o=Ce(),i=kD({state:r,match:t}),{exit:s}=i&&i.query.full!==t.query.full?ED({prev:t,next:i,state:r}):o;return t.range.from<n.range.from?{exit:s??ir({match:t,exitReason:"jump-forward-exit"}),change:ir({match:n,changeReason:"jump-forward-change"})}:{exit:s??ir({match:t,exitReason:"jump-backward-exit"}),change:ir({match:n,changeReason:"jump-backward-change"})}}function ree(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,i=kD({match:t,state:n});return!i||i.text.full!==t.text.full?ED({prev:t,next:i,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:ir({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:ir({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:ir({match:t,exitReason:"move-start"})}:{}}function oee(e){const{prev:t,next:n,state:r,$pos:o}=e,i=Ce();if(!t&&!n)return i;const s={prev:t,next:n};return YQ(s)?nee({prev:s.prev,next:s.next,state:r}):qQ(s)?{change:ir({match:s.next,changeReason:"start"})}:GQ(s)?ree({$pos:o,match:s.prev,state:r}):WQ(s)?{change:ir({match:s.next,changeReason:"change-character"})}:KQ(s)?{change:ir({match:s.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function kN(e,t){for(let n=e.depth;n>0;n--){const r=e.node(n);if(t.includes(r.type.name))return!0}return!1}function Vb(e,t){const{$from:n,$to:r}=e;return CD(e,t)?!0:nI(n.pos,r.pos).some(o=>iee(n.doc.resolve(o),t))}function CD(e,t){const{$from:n,$to:r}=e,o=new Set((n.marksAcross(r)??[]).map(i=>i.type.name));return t.some(i=>o.has(i))}function iee(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function see(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:i,invalidNodes:s}=e;return!r&&!o&&ya(i)&&ya(s)?!0:!(r&&!CD(t,r)||o&&!kN(n,o)||!r&&Vb(t,i)||!o&&kN(n,s))}function EN(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const i=SD({suggester:o,$pos:n});if(!i)continue;const s={$from:n.doc.resolve(i.range.from),$to:n.doc.resolve(i.range.to),$cursor:n};if(see(o,s)&&o.isValidPosition(s,i))return i}catch{}}function Ub(e){return bJ(e)?e.source:e}function aee(e){return e?"^":""}function lee(e,t){return`(?:${Ub(e)}){${t},}`}function cee(e){return Le(e)?new RegExp(HQ(e)):e}function uee(e){const{char:t,matchOffset:n,startOfLine:r,supportedCharacters:o,captureChar:i=!0,caseInsensitive:s=!1,multiline:a=!1,unicode:l=!1}=e,c=`g${a?"m":""}${s?"i":""}${l?"u":""}`;let u=cee(t).source;return i&&(u=`(${u})`),new RegExp(`${aee(r)}${u}${lee(o,n)}`,c)}var dee={appendTransaction:!1,priority:50,ignoredTag:"span",matchOffset:0,disableDecorations:!1,startOfLine:!1,suggestClassName:"suggest",suggestTag:"span",supportedCharacters:/\w+/,validPrefixCharacters:/^[\s\0]?$/,invalidPrefixCharacters:null,ignoredClassName:null,invalidMarks:[],invalidNodes:[],validMarks:null,validNodes:null,isValidPosition:()=>!0,checkNextValidSelection:null,emptySelectionsOnly:!1,caseInsensitive:!1,multiline:!1,unicode:!1,captureChar:!0},_D="__ignore_prosemirror_suggest_update__",hp,zc,Jt,ji,el,bo,Ht,Ri,tl,Bc,fee=(Bc=class{constructor(t){Pn(this,hp,!1);Pn(this,zc,!1);Pn(this,Jt);Pn(this,ji);Pn(this,el);Pn(this,bo,Ce());zt(this,"view");Pn(this,Ht,it.empty);Pn(this,Ri,!1);Pn(this,tl,!1);zt(this,"setMarkRemoved",()=>{Ze(this,Ri,!0)});zt(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),i=Ge.findFrom(o,1,!0);if(SN(i))return i});zt(this,"ignoreNextExit",()=>{Ze(this,zc,!0)});zt(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=me(this,Jt).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const i=Le(o.char)?o.char.length:1,s=t+i,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=_t.inline(t,s,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});Ze(this,Ht,me(this,Ht).add(this.view.state.doc,[l]))});zt(this,"removeIgnored",({from:t,name:n})=>{const r=me(this,Jt).find(s=>s.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=Le(r.char)?r.char.length:1,i=me(this,Ht).find(t,t+o)[0];!i||i.spec.name!==n||Ze(this,Ht,me(this,Ht).remove([i]))});zt(this,"clearIgnored",t=>{if(!t){Ze(this,Ht,it.empty);return}const r=me(this,Ht).find().filter(({spec:o})=>o.name===t);Ze(this,Ht,me(this,Ht).remove(r))});zt(this,"findMatchAtPosition",(t,n)=>{const r=n?me(this,Jt).filter(o=>o.name===n):me(this,Jt);return EN({suggesters:r,$pos:t,docChanged:!1,selectionEmpty:!0})});zt(this,"setLastChangeFromAppend",()=>{Ze(this,tl,!0)});const n=CN();Ze(this,Jt,t.map(n)),Ze(this,Jt,El(me(this,Jt),(r,o)=>o.priority-r.priority))}static create(t){return new Bc(t)}get decorationSet(){return me(this,Ht)}get removed(){return me(this,Ri)}get match(){return me(this,ji)?me(this,ji):me(this,el)&&me(this,bo).exit?me(this,el):void 0}init(t){return this.view=t,this}createProps(t){const{name:n,char:r}=t.suggester;return{view:this.view,addIgnored:this.addIgnored,clearIgnored:this.clearIgnored,ignoreNextExit:this.ignoreNextExit,setMarkRemoved:this.setMarkRemoved,name:n,char:r,...t}}shouldRunExit(){return me(this,zc)?(Ze(this,zc,!1),!1):!0}updateWithNextSelection(t){var r,o,i;const n=this.findNextTextSelection(t.selection);if(n)for(const s of me(this,Jt)){const a=(r=me(this,bo).change)==null?void 0:r.suggester.name,l=(o=me(this,bo).exit)==null?void 0:o.suggester.name;(i=s.checkNextValidSelection)==null||i.call(s,n.$from,t,{change:a,exit:l})}}changeHandler(t,n){const{change:r,exit:o}=me(this,bo),i=this.match;if(!r&&!o||!wN(i))return;const s=n===(o==null?void 0:o.suggester.appendTransaction)&&this.shouldRunExit(),a=n===(r==null?void 0:r.suggester.appendTransaction);if(!(!s&&!a)){if(r&&o&&QQ({change:r,exit:o})){const l=this.createProps(o),c=this.createProps(r),u=o.range.from<r.range.from;s&&o.suggester.onChange(l,t),a&&r.suggester.onChange(c,t),s&&Ze(this,Ri,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&s&&(o.suggester.onChange(this.createProps(o),t),Ze(this,Ri,!1),JQ(o.exitReason)&&Ze(this,bo,Ce()))}}mapIgnoredDecorations(t){const n=me(this,Ht).map(t.mapping,t.doc),o=n.find().filter(({from:i,to:s,spec:a})=>{const l=Le(a.char)?a.char.length:1;return s-i!==l});Ze(this,Ht,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return me(this,Ht).find().some(({spec:i,from:s})=>s!==t.from?!1:i.specific?i.name===n:!0)}resetState(){Ze(this,bo,Ce()),Ze(this,ji,void 0),Ze(this,Ri,!1),Ze(this,tl,!1)}updateReasons(t){const{$pos:n,state:r}=t,o=me(this,hp),i=me(this,Jt),s=r.selection.empty,a=SN(r.selection)?EN({suggesters:i,$pos:n,docChanged:o,selectionEmpty:s}):void 0;Ze(this,ji,a&&this.shouldIgnoreMatch(a)?void 0:a),Ze(this,bo,oee({next:me(this,ji),prev:me(this,el),state:r,$pos:n}))}addSuggester(t){const n=me(this,Jt).find(o=>o.name===t.name),r=CN();if(n)Ze(this,Jt,me(this,Jt).map(o=>o===n?r(t):o));else{const o=[...me(this,Jt),r(t)];Ze(this,Jt,El(o,(i,s)=>s.priority-i.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=Le(t)?t:t.name;Ze(this,Jt,me(this,Jt).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=me(this,bo);if(me(this,tl)&&(Ze(this,tl,!1),!(n!=null&&n.suggester.appendTransaction)&&!(r!=null&&r.suggester.appendTransaction)))return this;const{tr:o,state:i}=t,s=o.docChanged||o.selectionSet;return o.getMeta(_D)||!s&&!me(this,Ri)?this:(Ze(this,hp,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),Ze(this,el,me(this,ji)),this.updateReasons({$pos:o.selection.$from,state:i}),this)}createDecorations(t){const n=this.match;if(!wN(n))return me(this,Ht);const{disableDecorations:r}=n.suggester;if(Nt(r)?r(t,n):r)return me(this,Ht);const{range:i,suggester:s}=n,{name:a,suggestTag:l,suggestClassName:c}=s,{from:u,to:d}=i;return this.shouldIgnoreMatch(n)?me(this,Ht):me(this,Ht).add(t.doc,[_t.inline(u,d,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},hp=new WeakMap,zc=new WeakMap,Jt=new WeakMap,ji=new WeakMap,el=new WeakMap,bo=new WeakMap,Ht=new WeakMap,Ri=new WeakMap,tl=new WeakMap,Bc);function CN(){const e=new Set;return t=>{if(e.has(t.name))throw new Error(`A suggester already exists with the name '${t.name}'. The name provided must be unique.`);const n={...dee,...t};return e.add(t.name),n}}var ND=new Mu("suggest");function ek(e){return ND.getState(e)}function _N(e,t){return ek(e).addSuggester(t)}function NN(e){e.setMeta(_D,!0)}function pee(e,t){return ek(e).removeSuggester(t)}function hee(...e){const t=fee.create(e);return new rs({key:ND,view:n=>(t.init(n),{update:r=>t.changeHandler(r.state.tr,!1)}),state:{init:()=>t,apply:(n,r,o,i)=>t.apply({tr:n,state:i})},appendTransaction:(n,r,o)=>{const i=o.tr;return t.updateWithNextSelection(i),t.changeHandler(i,!0),i.docChanged||i.steps.length>0||i.selectionSet||i.storedMarksSet?(t.setLastChangeFromAppend(),i):null},props:{decorations:n=>t.createDecorations(n)}})}function tk(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,i=e.storedMarks;const s=Ce();for(const[a,l]of Object.entries(t))s[a]={value:l};return Object.create(n,{...s,storedMarks:{get(){return i}},selection:{get(){return r}},doc:{get(){return o}},tr:{get(){return r=e.selection,o=e.doc,i=e.storedMarks,e}}})}function Xd(e){return({state:t,dispatch:n,view:r,tr:o})=>e(tk(o,t),n,r)}function TN(e){return t=>{var n;return Te(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:oe.NON_CHAINABLE_COMMAND}),e(t)}}function mee(...e){return({state:t,dispatch:n,view:r,tr:o,...i})=>{for(const s of e)if(s({state:t,dispatch:n,view:r,tr:o,...i}))return!0;return!1}}var Co={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return Co.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return Co.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return Co.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return Co.isNode?process.platform==="darwin":Co.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function gs(e,t){var n;const r=$ee(e);return((n=r==null?void 0:r.getComputedStyle(e))==null?void 0:n.getPropertyValue(t))??""}function An(e,t){return Object.assign(e.style,t)}function Hb(e){return Bn(e)&&Dr(e.nodeType)&&Le(e.nodeName)}function pi(e){return Hb(e)&&e.nodeType===1}function nk(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return rn(t)?t.some(r):r(t)}function gee(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function ny(e){const{predicate:t,selection:n}=e,r=OD(n)?n.selection.$from:ik(n)?n.$from:n;for(let o=r.depth;o>0;o--){const i=r.node(o),s=o>0?r.before(o):0,a=r.start(o),l=s+i.nodeSize;if(t(i,s))return{pos:s,depth:o,node:i,start:a,end:l}}}function vee(e){const{depth:t}=e,n=t>0?e.before(t):0,r=e.node(t),o=e.start(t),i=n+r.nodeSize;return{pos:n,start:o,node:r,end:i,depth:t}}function ep(e){const{types:t,selection:n}=e;return ny({predicate:r=>nk({types:t,node:r}),selection:n})}function yee(e){const{types:t,selection:n}=e;if(!(!oy(n)||!nk({types:t,node:n.node})))return{pos:n.$from.pos,depth:n.$from.depth,start:n.$from.start(),end:n.$from.pos+n.node.nodeSize,node:n.node}}function rk(e){return ik(e)?e.empty:e.selection.empty}function xee(e){return e.docChanged||e.selectionSet}function bee(e){return!!tp(e)}function tp(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:i}=t,s=Le(n)?i.type.schema.nodes[n]:n;Te(s,{code:oe.SCHEMA,message:`No node exists for ${n}`});const a=yee({selection:o,types:n})??ny({predicate:l=>l.type===s,selection:o});return!r||vg(r)||!a||a.node.hasMarkup(s,{...a.node.attrs,...r})?a:void 0}function Rg(...e){return t=>{if(!y_(e))return!1;const[n,...r]=e;let o=!1;const i=(...l)=>()=>{if(!y_(l))return!1;o=!0;const[,...c]=l;return Rg(...l)({...t,next:i(...c)})},s=i(...r),a=n({...t,next:s});return o||a?a:s()}}function wee(e,t){const n=new Map,r=Ce();for(const o of e)for(const[i,s]of tn(o)){const l=[...n.get(i)??[],s],c=Rg(...l);n.set(i,l),r[i]=t(c)}return r}function See(e){return wee(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function ok(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function kee(e){return PD(e,[Li,Ut,fn,Oo])}function Pu(e){return Bn(e)}function ju(e,t){return rn(t)?Vo(t,e[Zi]):t===e[Zi]}function Eee(e){return Bn(e)&&e instanceof Ob}function Cee(e,t){return Le(e)?jt(t.nodes,e):e}function TD(e){return Bn(e)&&e instanceof Wp}function _ee(e,t){return Le(e)?jt(t.marks,e):e}function ry(e){return Bn(e)&&e instanceof ea}function Nee(e){return Bn(e)&&e instanceof q}function Tee(e){return Bn(e)&&e instanceof nt}function OD(e){return Bn(e)&&e instanceof Xa}function Dl(e){return Bn(e)&&e instanceof Fe}function Oee(e){return Bn(e)&&e instanceof Kn}function ik(e){return Bn(e)&&e instanceof Ge}function Mee(e){return Bn(e)&&e instanceof iu}function ON(e){const{trState:t,from:n,to:r,type:o,attrs:i={}}=e,{doc:s}=t,a=_ee(o,s.type.schema);if(Object.keys(i).length===0)return s.rangeHasMark(n,r,a);let l=!1;return r>n&&s.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(d=>d.type!==a?!1:ok(d,i)),!l)),l}function oy(e){return Bn(e)&&e instanceof Me}function Ag(e){const{trState:t,type:n,attrs:r={},from:o,to:i}=e,{selection:s,doc:a,storedMarks:l}=t,c=Le(n)?a.type.schema.marks[n]:n;if(Te(c,{code:oe.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&i)try{return Math.max(o,i)<a.nodeSize&&ON({...e,from:o,to:i})}catch{return!1}return s.empty?(l??s.$from.marks()).some(d=>d.type!==n?!1:ok(d,r??{})):ON({...e,from:s.from,to:s.to})}function sk(e,t={}){const n=Pee(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?MD(n,e):o?n.content.eq(e.content):n.eq(e)}function MD(e,t){if(e===t)return!0;const n=e.type===t.type&&nt.sameSet(e.marks,t.marks);function r(){if(e.content===t.content)return!0;if(e.content.size!==t.content.size)return!1;const o=[],i=[];e.content.forEach(s=>o.push(s)),t.content.forEach(s=>i.push(s));for(const[s,a]of o.entries()){const l=i[s];if(!l||!MD(a,l))return!1}return!0}return n&&r()}function Pee(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function iy(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;Te(!1,{code:oe.SCHEMA,message:"No default block node found for the provided schema."})}function jee(e){return e.type===iy(e.type.schema)}function ak(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function Qi(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=Le(t)?t:t.name,i=r.node.marks.find(({type:d})=>d.name===o);let s=e.index(),a=e.start()+r.offset,l=s+1,c=a+r.node.nodeSize;if(!i)return n&&c<n.pos?Qi(e.doc.resolve(c+1),t,n):void 0;for(;s>0&&i.isInSet(e.parent.child(s-1).marks);)s-=1,a-=e.parent.child(s).nodeSize;for(;l<e.parent.childCount&&i.isInSet(e.parent.child(l).marks);)c+=e.parent.child(l).nodeSize,l+=1;const u=e.doc.textBetween(a,c,W2,`
415
-
416
- `);return{from:a,to:c,text:u,mark:i}}function PD(e,t){return t.length===0||t.some(n=>e instanceof n)}function Ree(e){return tI(e,({from:n,to:r,prevFrom:o,prevTo:i})=>`${n}_${r}_${o}_${i}`).filter((n,r,o)=>!o.some((i,s)=>r===s?!1:n.prevFrom>=i.prevFrom&&n.prevTo<=i.prevTo&&n.from>=i.from&&n.to<=i.to))}function Aee(e,t=[]){const n=[],{steps:r,mapping:o}=e,i=o.invert();r.forEach((a,l)=>{if(!PD(a,t))return;const c=[],u=a.getMap(),d=o.slice(l);if(u.ranges.length===0&&kee(a)){const{from:p,to:h}=a;c.push({from:p,to:h})}else u.forEach((p,h)=>{c.push({from:p,to:h})});c.forEach(p=>{const h=d.map(p.from,-1),m=d.map(p.to);n.push({from:h,to:m,prevFrom:i.map(h,-1),prevTo:i.map(m)})})});const s=El(n,(a,l)=>a.from-l.from);return Ree(s)}function Iee(e){var t;return((t=e.content.firstChild)==null?void 0:t.textContent)??""}function Dee(e,t){if(!Dl(e.selection))return;let{from:n,to:r}=e.selection;const o=(s,a)=>Iee(Fe.between(e.doc.resolve(s),e.doc.resolve(a)).content());for(let s=o(n-1,n);s&&!t.test(s);n--,s=o(n-1,n));for(let s=o(r,r+1);s&&!t.test(s);r++,s=o(r,r+1));if(n===r)return;const i=e.doc.textBetween(n,r,W2,`
417
-
418
- `);return{from:n,to:r,text:i}}function jD(e){return Dee(e,/\W/)}function Zd(e,t=0){const n=rn(e)?e[t]:e;return X2(Le(n),`No match string found for match ${e}`),n??""}function Lee(e){return Dl(e)?e.$cursor:void 0}function Fee(e,t){return ry(e)?t?e.type===t.nodes.doc:e.type.name==="doc":!1}function zee(e){return Bn(e)&&Dr(e.anchor)&&Dr(e.head)}function oo(e,t){const n=t.nodeSize-2,r=0;let o;const i=l=>_J({min:r,max:n,value:l});if(ik(e))return e;if(e==="all")return new Kn(t);if(e==="start"?o=r:e==="end"?o=n:Mee(e)?o=e.pos:o=e,Dr(o))return o=i(o),Fe.near(t.resolve(o));if(zee(o)){const l=i(o.anchor),c=i(o.head);return Fe.between(t.resolve(l),t.resolve(c))}const s=i(o.from),a=i(o.to);return Fe.between(t.resolve(s),t.resolve(a))}var Bee=3;function RD(e){const{content:t,schema:n,document:r,stringHandler:o,onError:i,attempts:s=0}=e,a=i&&s<=Bee||s===0;if(Te(a,{code:oe.INVALID_CONTENT,message:"The invalid content has been called recursively more than ${MAX_ATTEMPTS} times. The content is invalid and the error handler has not been able to recover properly."}),Le(t))return Te(o,{code:oe.INVALID_CONTENT,message:`The string '${t}' was added to the editor, but no \`stringHandler\` was added. Please provide a valid string handler which transforms your content to a \`ProsemirrorNode\` to prevent this error.`}),o({document:r,content:t,schema:n});if(OD(t))return t.doc;if(ry(t))return t;try{return n.nodeFromJSON(t)}catch(l){const c=qee({schema:n,error:l,json:t}),u=i==null?void 0:i(c);return Te(u,{code:oe.INVALID_CONTENT,message:`An error occurred when processing the content. Please provide an \`onError\` handler to process the invalid content: ${JSON.stringify(c.invalidContent,null,2)}`}),RD({...e,content:u,attempts:s+1})}}function sy(){const e=FI();if(e)return e;throw new Error(`Unable to retrieve the document from the global scope.
419
- It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
420
- If you are using Jest (or other testing frameworks), make sure that you are using the JSDOM environment (https://jestjs.io/docs/29.0/configuration#testenvironment-string).
421
- If you are using Next.js (or other server-side rendering frameworks), please use dynamic import with \`ssr: false\` to load the editor component without rendering it on the server (https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr).
422
- If you are using Node.js, you can install JSDOM and Remirror will try to use it automatically, or you can create a fake document and pass it to Remirror`)}function AD(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=FI())==null?void 0:t.defaultView)}function $ee(e){return AD(e==null?void 0:e.ownerDocument)}function Vee(e){const t=AD(e)??sy().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function Uee(e,t=sy()){const n=Fee(e,e.type.schema)?e.content:q.from(e);return ja.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function Hee(e,t){return new(Vee(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function Wee(e,t=sy()){const n=t.createElement("div");return n.append(Uee(e,t)),n.innerHTML}function Wb(e){const{content:t,schema:n,document:r,fragment:o=!1,...i}=e,s=Hee(t,r),a=su.fromSchema(n);return o?a.parseSlice(s,{...MN,...i}).content:a.parse(s,{...MN,...i})}var MN={preserveWhitespace:!1};function ID(e,t){const n=qf(t.defaults());return LS({...e},n)}var Kee={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=OJ(r.path,n));return n}};function qee({json:e,schema:t,...n}){const r=new Set(qf(t.marks)),o=new Set(qf(t.nodes)),i=DD({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:i,transformers:Kee,...n}}function DD(e){const{json:t,validMarks:n,validNodes:r,path:o=[]}=e,i={validMarks:n,validNodes:r},s=[],{type:a,marks:l,content:c}=t;let{invalidParentMark:u=!1,invalidParentNode:d=!1}=e;if(l){const p=[];for(const[h,m]of l.entries()){const v=Le(m)?m:m.type;n.has(v)||(p.unshift({name:v,path:[...o,"marks",`${h}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}s.push(...p)}if(r.has(a)||(s.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const p=[];for(const[h,m]of c.entries())p.unshift(...DD({...i,json:m,path:[...o,"content",`${h}`],invalidParentMark:u,invalidParentNode:d}));s.unshift(...p)}return s}function Gee(e){return!!(Dl(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function Kb(e){return!!(Dl(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function PN(e){const t=Ge.atStart(e.$anchor.doc);return!!(Kb(e)&&t.anchor===e.anchor)}function Yee(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=Ce(),appendText:i,range:s}=e,a=s?Fe.between(n.doc.resolve(s.from),n.doc.resolve(s.to)):n.selection,{$from:l,from:c,to:u}=a;let d=l.depth===0?n.doc.type.allowsMarkType(r):!1;return n.doc.nodesBetween(c,u,p=>{if(d)return!1;if(p.inlineContent&&p.type.allowsMarkType(r)){d=!0;return}}),d?(t==null||t(n.addMark(c,u,r.create(o))&&i?n.insertText(i):n),!0):!1}}function Jee({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Ou(o);return!Dr(i)||!o?!1:(t==null||t(e.lift(o,i).scrollIntoView()),!0)}function LD(e,t={},n){return function(r){const{tr:o,dispatch:i,state:s}=r,a=Le(e)?jt(s.schema.nodes,e):e,{from:l,to:c}=oo(n??o.selection,o.doc),u=o.doc.resolve(l),d=o.doc.resolve(c),p=u.blockRange(d),h=p&&$S(p,a,t);return!h||!p?!1:(i==null||i(o.wrap(p,h).scrollIntoView()),!0)}}function Xee(e,t={},n){return r=>{const{tr:o,state:i}=r,s=Le(e)?jt(i.schema.nodes,e):e;return tp({state:o,type:s,attrs:t})?Jee(r):LD(e,t,n)(r)}}function Ig(e,t,n,r=!0){return function(o){const{tr:i,dispatch:s,state:a}=o,l=Le(e)?jt(a.schema.nodes,e):e,{from:c,to:u}=oo(n??i.selection,i.doc);let d=!1,p;return i.doc.nodesBetween(c,u,(h,m)=>{if(d)return!1;if(!h.isTextblock||h.hasMarkup(l,t))return;if(h.type===l){d=!0,p=h.attrs;return}const v=i.doc.resolve(m),b=v.index();d=v.parent.canReplaceWith(b,b+1,l),d&&(p=v.parent.attrs)}),d?(s==null||s(i.setBlockType(c,u,l,{...r?p:{},...t}).scrollIntoView()),!0):!1}}function FD(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:i,preserveAttrs:s=!0}=e,a=tp({state:n,type:o,attrs:i}),l=e.toggleType??iy(r.schema);if(a)return Ig(l,{...s?a.node.attrs:{},...i})(t);const c=tp({state:n,type:l,attrs:i});return Ig(o,{...s?c==null?void 0:c.node.attrs:{},...i})(t)}}function Zee(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(jt(t,2),10)>=e:!1}function Qee(e,t){let{head:n,empty:r,anchor:o}=e;for(const i of t.steps)n=i.getMap().map(n);r?t.setSelection(Fe.near(t.doc.resolve(n))):t.setSelection(Fe.between(t.doc.resolve(o),t.doc.resolve(n)))}function ete(e){const{attrs:t={},appendText:n="",content:r="",keepSelection:o=!1,range:i}=e;return({state:s,tr:a,dispatch:l})=>{var c;const u=s.schema,d=oo(e.selection??i??a.selection,a.doc),p=d.$from.index(),{from:h,to:m,$from:v}=d,b=Le(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(Te(Le(e.type)?b:!0,{code:oe.SCHEMA,message:`Schema contains no marks or nodes with name ${b}`}),Eee(b)){if(!v.parent.canReplaceWith(p,p,b))return!1;a.replaceWith(h,m,b.create(t,r?u.text(r):void 0))}else Te(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(h,m,u.text(r,TD(b)?[b.create(t)]:void 0));return n&&a.insertText(n),o&&Qee(s.selection,a),l&&(Zee(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function zD(e,t){const n=e.parent.childAfter(e.parentOffset);if(!n.node)return;const{marks:r,nodeSize:o}=n.node;if(r[0])return r[0].type;const s=e.start()+n.offset+o;return zD(e.doc.resolve(s+1))}function BD(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:i=!0,range:s}=e,a=oo(e.selection??s??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const p=Le(o)?r.schema.marks[o]:o;p!==null&&Te(p,{code:oe.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const h=p??zD(u);if(!h)return!1;const m=Qi(u,h,d);return i&&m&&(l=Math.max(0,Math.min(l,m.from)),c=Math.min(Math.max(c,m.to),n.doc.nodeSize-2)),t==null||t(n.removeMark(l,Dr(c)?c:l,TD(p)?p:void 0)),!0}}function Dg(e){const{regexp:t,type:n,getAttributes:r,ignoreWhitespace:o=!1,beforeDispatch:i,updateCaptured:s,shouldSkip:a,invalidMarks:l}=e;let c;const u=new lo(t,(d,p,h,m)=>{const{tr:v,schema:b}=d;c||(c=Le(n)?b.marks[n]:n,Te(c,{code:oe.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let x=p[1],w=p[0];const k=tte({captureGroup:x,fullMatch:w,end:m,start:h,rule:u,state:d,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:s});if(!k)return null;({start:h,end:m,captureGroup:x,fullMatch:w}=k);const C=Nt(r)?r(p):r;let _=m,O=[];if(x){const T=w.search(/\S/),j=h+w.indexOf(x),A=j+x.length;O=v.storedMarks??[],A<m&&v.delete(A,m),j>h&&v.delete(h+T,j),_=h+T+x.length}return v.addMark(h,_,c.create(C)),v.setStoredMarks(O),i==null||i({tr:v,match:p,start:h,end:m}),v});return u}function tte({captureGroup:e,fullMatch:t,end:n,start:r,rule:o,ignoreWhitespace:i,shouldSkip:s,updateCaptured:a,state:l,invalidMarks:c}){var u;if(t==null)return null;const d=(a==null?void 0:a({captureGroup:e,fullMatch:t,start:r,end:n}))??{};e=d.captureGroup??e,t=d.fullMatch??t,r=d.start??r,n=d.end??n;const p=l.doc.resolve(r),h=l.doc.resolve(n);return c&&Vb({$from:p,$to:h},c)||o.invalidMarks&&Vb({$from:p,$to:h},o.invalidMarks)||i&&(e==null?void 0:e.trim())===""||s!=null&&s({state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})||(u=o.shouldSkip)!=null&&u.call(o,{state:l,captureGroup:e,fullMatch:t,start:r,end:n,ruleType:"mark"})?null:{captureGroup:e,end:n,fullMatch:t,start:r}}var nte=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(i=>{(i?i.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const o=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.push(n[i]);return o.push(...r),o.join(" ")},rte=nte;const $D=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ote(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const VD=(e,t,n)=>{let r=ote(e,n);if(!r)return!1;let o=UD(r);if(!o){let s=r.blockRange(),a=s&&Ou(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(KD(e,o,t,-1))return!0;if(r.parent.content.size==0&&(uu(i,"end")||Me.isSelectable(i)))for(let s=r.depth;;s--){let a=VS(e.doc,r.before(s),r.after(s),fe.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(uu(i,"end")?Ge.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Me.create(l.doc,o.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function uu(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ite=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=UD(r)}let s=i&&i.nodeBefore;return!s||!Me.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Me.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function UD(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function ste(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const ate=(e,t,n)=>{let r=ste(e,n);if(!r)return!1;let o=HD(r);if(!o)return!1;let i=o.nodeAfter;if(KD(e,o,t,1))return!0;if(r.parent.content.size==0&&(uu(i,"start")||Me.isSelectable(i))){let s=VS(e.doc,r.before(),r.after(),fe.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(uu(i,"start")?Ge.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Me.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},lte=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=HD(r)}let s=i&&i.nodeAfter;return!s||!Me.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Me.create(e.doc,i.pos)).scrollIntoView()),!0)};function HD(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const cte=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
423
- `).scrollIntoView()),!0)};function lk(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const WD=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=lk(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ge.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},ute=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Kn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=lk(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(s,i.createAndFill());a.setSelection(Fe.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},dte=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ic(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ou(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function fte(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof Me&&t.selection.node.isBlock)return!r.parentOffset||!Ic(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),a=lk(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(l&&a?{type:a}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof Fe||t.selection instanceof Kn)&&u.deleteSelection();let d=u.mapping.map(r.pos),p=Ic(u.doc,d,i.length,i);if(p||(i[0]=a?{type:a}:null,p=Ic(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let h=u.mapping.map(r.before(s)),m=u.doc.resolve(h);a&&r.node(s-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const pte=fte(),hte=(e,t)=>{let{$from:n,to:r}=e.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),t&&t(e.tr.setSelection(Me.create(e.doc,o))),!0)},mte=(e,t)=>(t&&t(e.tr.setSelection(new Kn(e.doc))),!0);function gte(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(o.isTextblock||Kp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function KD(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&gte(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let h=t.pos+i.nodeSize,m=q.empty;for(let x=s.length-1;x>=0;x--)m=q.from(s[x].create(null,m));m=q.from(o.copy(m));let v=e.tr.step(new Ut(t.pos-1,h,t.pos,h,new fe(m,1,0),s.length,!0)),b=v.doc.resolve(h+2*s.length);b.nodeAfter&&b.nodeAfter.type==o.type&&Kp(v.doc,b.pos)&&v.join(b.pos),n(v.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Ge.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),p=d&&Ou(d);if(p!=null&&p>=t.depth)return n&&n(e.tr.lift(d,p).scrollIntoView()),!0;if(c&&uu(i,"start",!0)&&uu(o,"end")){let h=o,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let v=i,b=1;for(;!v.isTextblock;v=v.firstChild)b++;if(h.canReplace(h.childCount,h.childCount,v.content)){if(n){let x=q.empty;for(let k=m.length-1;k>=0;k--)x=q.from(m[k].copy(x));let w=e.tr.step(new Ut(t.pos-m.length,t.pos+i.nodeSize,t.pos+b,t.pos+i.nodeSize-b,new fe(x,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function qD(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(t.tr.setSelection(Fe.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const vte=qD(-1),yte=qD(1);function xte(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:i,$to:s}=t[o],a=i.depth==0?e.inlineContent&&e.type.allowsMarkType(n):!1;if(e.nodesBetween(i.pos,s.pos,(l,c)=>{if(a||!r)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function bte(e,t=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:a,ranges:l}=o.selection;if(s&&!a||!xte(o.doc,l,e,r))return!1;if(i)if(a)e.isInSet(o.storedMarks||a.marks())?i(o.tr.removeStoredMark(e)):i(o.tr.addStoredMark(e.create(t)));else{let c,u=o.tr;c=!l.some(d=>o.doc.rangeHasMark(d.$from.pos,d.$to.pos,e));for(let d=0;d<l.length;d++){let{$from:p,$to:h}=l[d];if(!c)u.removeMark(p.pos,h.pos,e);else{let m=p.pos,v=h.pos,b=p.nodeAfter,x=h.nodeBefore,w=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,k=x&&x.isText?/\s*$/.exec(x.text)[0].length:0;m+w<v&&(m+=w,v-=k),u.addMark(m,v,e.create(t))}}i(u.scrollIntoView())}return!0}}function ay(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let F0=ay($D,VD,ite),jN=ay($D,ate,lte);const Pi={Enter:ay(cte,ute,dte,pte),"Mod-Enter":WD,Backspace:F0,"Mod-Backspace":F0,"Shift-Backspace":F0,Delete:jN,"Mod-Delete":jN,"Mod-a":mte},GD={"Ctrl-h":Pi.Backspace,"Alt-Backspace":Pi["Mod-Backspace"],"Ctrl-d":Pi.Delete,"Ctrl-Alt-Backspace":Pi["Mod-Delete"],"Alt-Delete":Pi["Mod-Delete"],"Alt-d":Pi["Mod-Delete"],"Ctrl-a":vte,"Ctrl-e":yte};for(let e in Pi)GD[e]=Pi[e];const wte=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,z0=wte?GD:Pi;var ba={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:"'"},Lg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ste=typeof navigator<"u"&&/Mac/.test(navigator.platform),kte=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var wn=0;wn<10;wn++)ba[48+wn]=ba[96+wn]=String(wn);for(var wn=1;wn<=24;wn++)ba[wn+111]="F"+wn;for(var wn=65;wn<=90;wn++)ba[wn]=String.fromCharCode(wn+32),Lg[wn]=String.fromCharCode(wn);for(var B0 in ba)Lg.hasOwnProperty(B0)||(Lg[B0]=ba[B0]);function Ete(e){var t=Ste&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||kte&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Lg:ba)[e.keyCode]||e.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 Cte=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function _te(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Cte?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function Nte(e){let t=Object.create(null);for(let n in e)t[_te(n)]=e[n];return t}function $0(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function YD(e){let t=Nte(e);return function(n,r){let o=Ete(r),i,s=t[$0(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[$0(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=ba[r.keyCode])&&i!=o){let a=t[$0(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function Tte(e){const t=El(e,(i,s)=>(s.priority??ft.Low)-(i.priority??ft.Low)),n=[],r=[];for(const i of t)Ite(i)?n.push(i):r.push(i);let o;return new rs({key:Ote,view:i=>(o=i,{}),props:{transformPasted:i=>{var c,u,d;const s=o.state.selection.$from,a=s.node().type.name,l=new Set(s.marks().map(p=>p.type.name));for(const p of n){if((c=p.ignoredNodes)!=null&&c.includes(a)||(u=p.ignoredMarks)!=null&&u.some(w=>l.has(w)))continue;const h=((d=i.content.firstChild)==null?void 0:d.textContent)??"",m=!o.state.selection.empty&&i.content.childCount===1&&h,v=Xv(h,p.regexp)[0];if(m&&v&&p.type==="mark"&&p.replaceSelection){const{from:w,to:k}=o.state.selection,C=o.state.doc.slice(w,k),_=C.content.textBetween(0,C.content.size);if(typeof p.replaceSelection!="boolean"?p.replaceSelection(_):p.replaceSelection){const O=[],{getAttributes:T,markType:j}=p,A=Nt(T)?T(v,!0):T,D=j.create(A);return C.content.forEach(V=>{if(V.isText){const W=D.addToSet(V.marks);O.push(V.mark(W))}}),fe.maxOpen(q.fromArray(O))}}const{nodes:b,transformed:x}=Rte(i.content,p,o.state.schema);x&&(i=p.type==="node"&&p.nodeType.isBlock?new fe(q.fromArray(b),0,0):new fe(q.fromArray(b),i.openStart,i.openEnd))}return zte(i)},handleDOMEvents:{paste:(i,s)=>{var d,p;const a=s;if(!((p=(d=i.props).editable)!=null&&p.call(d,i.state)))return!1;const{clipboardData:l}=a;if(!l)return!1;const c=[...l.items].map(h=>h.getAsFile()).filter(h=>!!h);if(c.length===0)return!1;const{selection:u}=i.state;for(const{fileHandler:h,regexp:m}of r){const v=m?c.filter(b=>m.test(b.type)):c;if(v.length!==0&&h({event:a,files:v,selection:u,view:i,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(i,s)=>{var h,m,v;const a=s;if(!((m=(h=i.props).editable)!=null&&m.call(h,i.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const d=Fte(a);if(d.length===0)return!1;const p=((v=i.posAtCoords({left:c,top:u}))==null?void 0:v.pos)??i.state.selection.anchor;for(const{fileHandler:b,regexp:x}of r){const w=x?d.filter(k=>x.test(k.type)):d;if(w.length!==0&&b({event:a,files:w,pos:p,view:i,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var Ote=new Mu("pasteRule");function V0(e,t){return function n(r){const{fragment:o,rule:i,nodes:s}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=i;let d=!1;return o.forEach(p=>{if(u!=null&&u.includes(p.type.name)||Dte(p)){s.push(p);return}if(!p.isText){const v=n({fragment:p.content,rule:i,nodes:[]});d||(d=v.transformed);const b=q.fromArray(v.nodes);p.type.validContent(b)?s.push(p.copy(b)):s.push(...v.nodes);return}if(p.marks.some(v=>Lte(v)||(c==null?void 0:c.includes(v.type.name)))){s.push(p);return}const h=p.text??"";let m=0;for(const v of Xv(h,a)){const b=v[1],x=v[0];if(l&&(b==null?void 0:b.trim())===""||!x)return;const w=v.index,k=w+x.length;w>m&&s.push(p.cut(m,w));let C=p.cut(w,k);if(x&&b){const _=x.search(/\S/),O=w+x.indexOf(b),T=O+b.length;_&&s.push(p.cut(w,w+_)),C=p.cut(O,T)}e({nodes:s,rule:i,textNode:C,match:v,schema:t}),d=!0,m=k}h&&m<h.length&&s.push(p.cut(m))}),{nodes:s,transformed:d}}}function Mte(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s,getAttributes:a,markType:l}=n,c=Nt(a)?a(o,!1):a,u=r.text??"",d=l.create(c),p=s==null?void 0:s(o);if(p==="")return;if(p===!1){t.push(i.text(u,r.marks));return}const h=d.addToSet(r.marks);t.push(i.text(p??u,h))}function Pte(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s}=n,a=s==null?void 0:s(o);if(a===""||a===!1)return;const l=a??r.text??"";t.push(i.text(l,r.marks))}function jte(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:i,nodeType:s,getContent:a}=n,l=Nt(i)?i(o,!1):i,c=(a?a(o):r)||void 0;t.push(s.createChecked(l,c))}function Rte(e,t,n){const r=[];switch(t.type){case"mark":return V0(Mte,n)({fragment:e,nodes:r,rule:t});case"node":return V0(jte,n)({fragment:e,nodes:r,rule:t});default:return V0(Pte,n)({fragment:e,nodes:r,rule:t})}}var Ate=["mark","node","text"];function Ite(e){return Vo(Ate,e.type)}function Dte(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function Lte(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function Fte(e){var n,r;const{dataTransfer:t}=e;return t?((n=t.files)==null?void 0:n.length)>0?[...t.files]:(r=t.items)!=null&&r.length?[...t.items].map(o=>o.getAsFile()).filter(o=>!!o):[]:[]}function zte(e){const t=fe.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var Bte=Object.defineProperty,$te=Object.getOwnPropertyDescriptor,xe=(e,t,n,r)=>{for(var o=r>1?void 0:r?$te(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Bte(t,n,o),o},JD=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},pe=(e,t,n)=>(JD(e,t,"read from private field"),n?n.call(e):t.get(e)),Wt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ln=(e,t,n,r)=>(JD(e,t,"write to private field"),t.set(e,n),n);function Vte(e,t){return e===t}function RN(e){const{previousOptions:t,update:n,equals:r=Vte}=e,o=Ja({...t,...n}),i=Ce(),s=qf(t);for(const l of s){const c=t[l],u=o[l];if(r(c,u)){i[l]={changed:!1};continue}i[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=Ce();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:Ja(i),options:o,pickChanged:a}}var Ute={[oe.DUPLICATE_HELPER_NAMES]:"helper method",[oe.DUPLICATE_COMMAND_NAMES]:"command method"};function XD(e){const{name:t,set:n,code:r}=e,o=Ute[r];Te(!n.has(t),{code:r,message:`There is a naming conflict for the name: ${t} used in this '${o}'. Please rename or remove from the editor to avoid runtime errors.`}),n.add(t)}function qb(...e){return Gf(rte(...e).split(" ")).join(" ")}var AN="__IGNORE__",Hte="__ALL__",Ru=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=Ce(),this.populateMappedHandlers(),this._options=this._initialOptions=CJ(e,this.constructor.defaultOptions,t??Ce(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){const e=[],{customHandlerKeys:t,handlerKeys:n,staticKeys:r}=this.constructor;for(const o of qf(this._options))r.includes(o)||n.includes(o)||t.includes(o)||e.push(o);return e}ensureAllKeysAreDynamic(e){}setOptions(e){var t;const n=this.getDynamicOptions();this.ensureAllKeysAreDynamic(e);const{changes:r,options:o,pickChanged:i}=RN({previousOptions:n,update:e});this.updateDynamicOptions(o),(t=this.onSetOptions)==null||t.call(this,{reason:"set",changes:r,options:o,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var e;const t=this.getDynamicOptions(),{changes:n,options:r,pickChanged:o}=RN({previousOptions:t,update:this._initialOptions});this.updateDynamicOptions(r),(e=this.onSetOptions)==null||e.call(this,{reason:"reset",options:r,changes:n,pickChanged:o,initialOptions:this._initialOptions})}getDynamicOptions(){return LS(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(e){this._options={...this._options,...e}}populateMappedHandlers(){for(const e of this.constructor.handlerKeys)this._mappedHandlers[e]=[]}createDefaultHandlerOptions(){const e=Ce();for(const t of this.constructor.handlerKeys)e[t]=(...n)=>{var r;const{handlerKeyOptions:o}=this.constructor,i=(r=o[t])==null?void 0:r.reducer;let s=i==null?void 0:i.getDefault(...n);for(const[,a]of this._mappedHandlers[t]){const l=a(...n);if(s=i?i.accumulator(s,l,...n):l,Wte(o,s,t))return s}return s};return e}addHandler(e,t,n=ft.Default){return this._mappedHandlers[e].push([n,t]),this.sortHandlers(e),()=>this._mappedHandlers[e]=this._mappedHandlers[e].filter(([,r])=>r!==t)}hasHandlers(e){return(this._mappedHandlers[e]??[]).length>0}sortHandlers(e){this._mappedHandlers[e]=El(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??eI}};Ru.defaultOptions={};Ru.staticKeys=[];Ru.handlerKeys=[];Ru.handlerKeyOptions={};Ru.customHandlerKeys=[];function Wte(e,t,n){const{[Hte]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==AN&&(Nt(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==AN&&(Nt(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var ly=class extends Ru{constructor(...e){super(Kte,...e),this["~E"]={},this._extensions=tI(this.createExtensions(),t=>t.constructor),this.extensionMap=new Map;for(const t of this._extensions)this.extensionMap.set(t.constructor,t)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${J2(this.name)}Extension`}get store(){return Te(this._store,{code:oe.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),Ja(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(e,t){this.extensionMap.has(e)&&(this.extensionMap.set(e,t),this._extensions=this.extensions.map(n=>t.constructor===e?t:n))}createExtensions(){return[]}getExtension(e){const t=this.extensionMap.get(e);return Te(t,{code:oe.INVALID_GET_EXTENSION,message:`'${e.name}' does not exist within the preset: '${this.name}'`}),t}isOfType(e){return this.constructor===e}setStore(e){this._store||(this._store=e)}clone(...e){return new this.constructor(...e)}setPriority(e){this.priorityOverride=e}};ly.defaultPriority=ft.Default;var Tt=class extends ly{static get[Zi](){return hn.PlainExtensionConstructor}get[Zi](){return hn.PlainExtension}},Jp=class extends ly{static get[Zi](){return hn.MarkExtensionConstructor}get[Zi](){return hn.MarkExtension}get type(){return jt(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};Jp.disableExtraAttributes=!1;var co=class extends ly{static get[Zi](){return hn.NodeExtensionConstructor}get[Zi](){return hn.NodeExtension}get type(){return jt(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};co.disableExtraAttributes=!1;var Kte={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function ZD(e){return Pu(e)&&ju(e,[hn.PlainExtension,hn.MarkExtension,hn.NodeExtension])}function qte(e){return Pu(e)&&ju(e,[hn.PlainExtensionConstructor,hn.MarkExtensionConstructor,hn.NodeExtensionConstructor])}function QD(e){return Pu(e)&&ju(e,hn.PlainExtension)}function Xp(e){return Pu(e)&&ju(e,hn.NodeExtension)}function cy(e){return Pu(e)&&ju(e,hn.MarkExtension)}function ot(e){return t=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:o,staticKeys:i,defaultPriority:s,handlerKeyOptions:a,...l}=e,c=t;n&&(c.defaultOptions=n),s&&(c.defaultPriority=s),a&&(c.handlerKeyOptions=a),c.staticKeys=i??[],c.handlerKeys=o??[],c.customHandlerKeys=r??[];for(const[u,d]of Object.entries(l))c[u]||(c[u]=d);return c}}var Gte=class extends Tt{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=Ce(),this.updateAttributes=(e=!0)=>{this.transformAttributes(),e&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var e,t,n;if(this.attributeObject=Ce(),(e=this.store.managerSettings.exclude)!=null&&e.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}this.attributeList=[];for(const r of this.store.extensions){if((t=r.options.exclude)!=null&&t.attributes)continue;const o=(n=r.createAttributes)==null?void 0:n.call(r),i={...o,class:qb(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:qb(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function Ft(e={}){return(t,n,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[n]=e}}function Se(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function Vr(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var Yte=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>t=>{let n=!0;const{view:r,tr:o,dispatch:i}=t;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...t,dispatch:()=>{}})){n=!1;break}return!i||!n?n:(this.promiseCreator(t).then(a=>{this.runHandlers(this.successHandlers,{value:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}).catch(a=>{this.runHandlers(this.failureHandlers,{error:a,state:r.state,tr:r.state.tr,dispatch:r.dispatch,view:r})}),i(o),!0)}}validate(e,t="push"){return this.validateHandlers[t](e),this}success(e,t="push"){return this.successHandlers[t](e),this}failure(e,t="push"){return this.failureHandlers[t](e),this}runHandlers(e,t){var n;for(const r of e)if(!r({...t,dispatch:()=>{}}))break;(n=t.dispatch)==null||n.call(t,t.tr)}};function np(e){const{type:t,attrs:n,range:r,selection:o}=e;return i=>{const{dispatch:s,tr:a,state:l}=i,c=Le(t)?l.schema.marks[t]:t;if(Te(c,{code:oe.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:d}=oo(o??r??a.selection,a.doc);return Ag({trState:a,type:t,...r})?s==null||s(a.removeMark(u,d,c)):s==null||s(a.addMark(u,d,c.create(n))),!0}return Xd(bte(c,n))(i)}}function Jte(e,t,n){for(const{$from:r,$to:o}of n){let i=r.depth===0?t.type.allowsMarkType(e):!1;if(t.nodesBetween(r.pos,o.pos,s=>{if(i)return!1;i=s.inlineContent&&s.type.allowsMarkType(e)}),i)return!0}return!1}function Xte(e,t,n){return({tr:r,dispatch:o,state:i})=>{const s=oo(n??r.selection,r.doc),a=Lee(s),l=Le(e)?i.schema.marks[e]:e;if(Te(l,{code:oe.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),s.empty&&!a||!Jte(l,r.doc,s.ranges))return!1;if(!o)return!0;if(a)return r.removeStoredMark(l),t&&r.addStoredMark(l.create(t)),o(r),!0;let c=!1;for(const{$from:u,$to:d}of s.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,d.pos,l)}for(const{$from:u,$to:d}of s.ranges)c&&r.removeMark(u.pos,d.pos,l),t&&r.addMark(u.pos,d.pos,l.create(t));return o(r),!0}}function Zte(e,t={}){return({tr:n,dispatch:r,state:o})=>{const i=o.schema,s=n.selection,{from:a=s.from,to:l=a??s.to,marks:c={}}=t;if(!r)return!0;n.insertText(e,a,l);const u=jt(n.steps,n.steps.length-1).getMap().map(l);for(const[d,p]of tn(c))n.addMark(a,u,jt(i.marks,d).create(p));return r(n),!0}}var Ye=class extends Tt{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{const{forcedUpdates:n}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:Gf([...n,...t])}),e}}get name(){return"commands"}get transaction(){const e=this.store.getState();this._transaction||(this._transaction=e.tr);const t=this._transaction.before.eq(e.doc),n=!ya(this._transaction.steps);if(!t){const r=e.tr;if(n)for(const o of this._transaction.steps)r.step(o);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(e){var t;const{extensions:n,helpers:r}=this.store,o=Ce(),i=new Set;let s=Ce();const a=c=>{var u;const d=Ce(),p=()=>c??this.transaction;let h=[];const m=()=>h;for(const[b,x]of Object.entries(o))(u=s[b])!=null&&u.disableChaining||(d[b]=this.chainedFactory({chain:d,command:x.original,getTr:p,getChain:m}));const v=b=>{Te(b===p(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return d.run=(b={})=>{const x=h;h=[];for(const w of x)if(!w(v)&&b.exitEarly)return;e.dispatch(p())},d.tr=()=>{const b=h;h=[];for(const x of b)x(v);return p()},d.enabled=()=>{for(const b of h)if(!b())return!1;return!0},d.new=b=>a(b),d};for(const c of n){const u=((t=c.createCommands)==null?void 0:t.call(c))??{},d=c.decoratedCommands??{},p={};s={...s,decoratedCommands:d};for(const[h,m]of Object.entries(d)){const v=Le(m.shortcut)&&m.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(m.shortcut,c.options)}:void 0;this.updateDecorated(h,{...m,name:c.name,...v}),u[h]=c[h].bind(c),m.active&&(p[h]=()=>{var b;return((b=m.active)==null?void 0:b.call(m,c.options,this.store))??!1})}vg(u)||this.addCommands({active:p,names:i,commands:o,extensionCommands:u})}const l=a();for(const[c,u]of Object.entries(l))a[c]=u;this.store.setStoreKey("commands",o),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",o),this.store.setExtensionStore("chain",a)}onStateUpdate({state:e}){this._transaction=e.tr}createPlugin(){return{}}customDispatch(e){return e}insertText(e,t={}){return Le(e)?Zte(e,t):this.store.createPlaceholderCommand({promise:e,placeholder:{type:"inline"},onSuccess:(n,r,o)=>this.insertText(n,{...t,...r})(o)}).generateCommand()}selectText(e,t={}){return({tr:n,dispatch:r})=>{const o=oo(e,n.doc);return n.selection.anchor===o.anchor&&n.selection.head===o.head&&!t.forceUpdate?!1:(r==null||r(n.setSelection(o)),!0)}}selectMark(e){return t=>{const{tr:n}=t,r=Qi(n.selection.$from,e);return r?this.store.commands.selectText.original({from:r.from,to:r.to})(t):!1}}delete(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=e??t.selection;return n==null||n(t.delete(r,o)),!0}}emptyUpdate(e){return({tr:t,dispatch:n})=>(n&&(e==null||e(),n(t)),!0)}forceUpdate(...e){return({tr:t,dispatch:n})=>(n==null||n(this.forceUpdateTransaction(t,...e)),!0)}updateNodeAttributes(e,t){return({tr:n,dispatch:r})=>(r==null||r(n.setNodeMarkup(e,void 0,t)),!0)}setContent(e,t){return n=>{const{tr:r,dispatch:o}=n,i=this.store.manager.createState({content:e,selection:t});return i?(o==null||o(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0):!1}}resetContent(){return e=>{const{tr:t,dispatch:n}=e,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(e):(n==null||n(t.delete(0,t.doc.nodeSize)),!0)}}emptySelection(){return({tr:e,dispatch:t})=>e.selection.empty?!1:(t==null||t(e.setSelection(Fe.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>Dl(t.selection)?(e==null||e(t.insertText(`
424
- `)),!0):!1}insertNode(e,t={}){return({dispatch:n,tr:r,state:o})=>{var i;const{attrs:s,range:a,selection:l,replaceEmptyParentBlock:c=!1}=t,{from:u,to:d,$from:p}=oo(l??a??r.selection,r.doc);if(ry(e)||Nee(e)){const x=p.before(p.depth);return n==null||n(c&&u===d&&ak(p.parent)?r.replaceWith(x,x+p.parent.nodeSize,e):r.replaceWith(u,d,e)),!0}const h=Le(e)?o.schema.nodes[e]:e;Te(h,{code:oe.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});const m=(i=t.marks)==null?void 0:i.map(x=>{if(x instanceof nt)return x;const w=Le(x)?o.schema.marks[x]:x;return Te(w,{code:oe.SCHEMA,message:`The requested mark type ${x} does not exist in the schema.`}),w.create()}),v=h.createAndFill(s,Le(t.content)?o.schema.text(t.content):t.content,m);if(!v)return!1;const b=u!==d;return n==null||n(b?r.replaceRangeWith(u,d,v):r.insert(u,v)),!0}}focus(e){return t=>{const{dispatch:n,tr:r}=t,{view:o}=this.store;if(e===!1||o.hasFocus()&&(e===void 0||e===!0))return!1;if(e===void 0||e===!0){const{from:i=0,to:s=i}=r.selection;e={from:i,to:s}}return n&&this.delayedFocus(),this.selectText(e)(t)}}blur(e){return t=>{const{view:n}=this.store;return n.hasFocus()?(requestAnimationFrame(()=>{n.dom.blur()}),e?this.selectText(e)(t):!0):!1}}setBlockNodeType(e,t,n,r=!0){return Ig(e,t,n,r)}toggleWrappingNode(e,t,n){return Xee(e,t,n)}toggleBlockNodeItem(e){return FD(e)}wrapInNode(e,t,n){return LD(e,t,n)}applyMark(e,t,n){return Xte(e,t,n)}toggleMark(e){return np(e)}removeMark(e){return BD(e)}setMeta(e,t){return({tr:n})=>(n.setMeta(e,t),!0)}selectAll(){return this.selectText("all")}copy(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({promise:async()=>{var e;return(e=navigator.clipboard)!=null&&e.readText?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(e,t,n)=>this.insertNode(Wb({content:e,schema:n.state.schema}),{selection:t})(n)}).generateCommand()}cut(){return e=>e.tr.selection.empty?!1:(e.dispatch&&document.execCommand("cut"),!0)}replaceText(e){return ete(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)vg(n)||(e[t]=n);return e}getCommandOptions(e){return this.decorated.get(e)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(e,t){if(!t){this.decorated.delete(e);return}const n=this.decorated.get(e)??{name:""};this.decorated.set(e,{...n,...t})}handleIosFocus(){Co.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(e){return this.getCommandMeta(e).forcedUpdates}getCommandMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...Qte,...t}}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addCommands(e){const{extensionCommands:t,commands:n,names:r,active:o}=e;for(const[i,s]of tn(t))XD({name:i,set:r,code:oe.DUPLICATE_COMMAND_NAMES}),Te(!ene.has(i),{code:oe.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[i]=this.createUnchainedCommand(s,o[i])}unchainedFactory(e){return(...t)=>{const{shouldDispatch:n=!0,command:r}=e,{view:o}=this.store,{state:i}=o;let s;return n&&(s=o.dispatch),r(...t)({state:i,dispatch:s,view:o,tr:i.tr})}}createUnchainedCommand(e,t){const n=this.unchainedFactory({command:e});return n.enabled=this.unchainedFactory({command:e,shouldDispatch:!1}),n.isEnabled=n.enabled,n.original=e,n.active=t,n}chainedFactory(e){return(...t)=>{const{chain:n,command:r,getTr:o,getChain:i}=e,s=i(),{view:a}=this.store,{state:l}=a;return s.push(c=>r(...t)({state:l,dispatch:c,view:a,tr:o()})),n}}};xe([Se()],Ye.prototype,"customDispatch",1);xe([Se()],Ye.prototype,"insertText",1);xe([Se()],Ye.prototype,"selectText",1);xe([Se()],Ye.prototype,"selectMark",1);xe([Se()],Ye.prototype,"delete",1);xe([Se()],Ye.prototype,"emptyUpdate",1);xe([Se()],Ye.prototype,"forceUpdate",1);xe([Se()],Ye.prototype,"updateNodeAttributes",1);xe([Se()],Ye.prototype,"setContent",1);xe([Se()],Ye.prototype,"resetContent",1);xe([Se()],Ye.prototype,"emptySelection",1);xe([Se()],Ye.prototype,"insertNewLine",1);xe([Se()],Ye.prototype,"insertNode",1);xe([Se()],Ye.prototype,"focus",1);xe([Se()],Ye.prototype,"blur",1);xe([Se()],Ye.prototype,"setBlockNodeType",1);xe([Se()],Ye.prototype,"toggleWrappingNode",1);xe([Se()],Ye.prototype,"toggleBlockNodeItem",1);xe([Se()],Ye.prototype,"wrapInNode",1);xe([Se()],Ye.prototype,"applyMark",1);xe([Se()],Ye.prototype,"toggleMark",1);xe([Se()],Ye.prototype,"removeMark",1);xe([Se()],Ye.prototype,"setMeta",1);xe([Se({description:({t:e})=>e(xa.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(xa.SELECT_ALL_LABEL),shortcut:ie.SelectAll})],Ye.prototype,"selectAll",1);xe([Se({description:({t:e})=>e(xa.COPY_DESCRIPTION),label:({t:e})=>e(xa.COPY_LABEL),shortcut:ie.Copy,icon:"fileCopyLine"})],Ye.prototype,"copy",1);xe([Se({description:({t:e})=>e(xa.PASTE_DESCRIPTION),label:({t:e})=>e(xa.PASTE_LABEL),shortcut:ie.Paste,icon:"clipboardLine"})],Ye.prototype,"paste",1);xe([Se({description:({t:e})=>e(xa.CUT_DESCRIPTION),label:({t:e})=>e(xa.CUT_LABEL),shortcut:ie.Cut,icon:"scissorsFill"})],Ye.prototype,"cut",1);xe([Se()],Ye.prototype,"replaceText",1);xe([Ft()],Ye.prototype,"getAllCommandOptions",1);xe([Ft()],Ye.prototype,"getCommandOptions",1);xe([Ft()],Ye.prototype,"getCommandProp",1);Ye=xe([ot({defaultPriority:ft.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Ye);var Qte={forcedUpdates:[]},ene=new Set(["run","chain","original","raw","enabled","tr","new"]),Ho=class extends Tt{constructor(){super(...arguments),this.placeholders=it.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=xg(),{promise:n,placeholder:r,onFailure:o,onSuccess:i}=e;return new Yte(n).validate(s=>this.addPlaceholder(t,r)(s)).success(s=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=s,p=this.store.helpers.findPlaceholder(t);if(!p){const h=new Error("The placeholder has been removed");return(o==null?void 0:o({error:h,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(t)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,p,{state:a,tr:l,dispatch:c,view:u})}).failure(s=>(this.removePlaceholder(t)({...s,dispatch:()=>{}}),(o==null?void 0:o(s))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:e=>{var t,n,r,o,i,s;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(e);if(l){this.placeholders=it.empty;for(const[,d]of this.placeholderWidgets)(n=(t=d.spec).onDestroy)==null||n.call(t,this.store.view,d.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:d=>{var p,h;const m=this.placeholderWidgets.get(d.id);m&&((h=(p=m.spec).onDestroy)==null||h.call(p,this.store.view,m.spec.element))}});for(const[,d]of this.placeholderWidgets)(o=(r=d.spec).onUpdate)==null||o.call(r,this.store.view,d.from,d.spec.element,d.spec.data);for(const d of a){if(d.type==="inline"){this.addInlinePlaceholder(d,e);continue}if(d.type==="node"){this.addNodePlaceholder(d,e);continue}if(d.type==="widget"){this.addWidgetPlaceholder(d,e);continue}}for(const{id:d,data:p}of u){const h=this.placeholderWidgets.get(d);if(!h)continue;const m=_t.widget(h.from,h.spec.element,{...h.spec,data:p});this.placeholders=this.placeholders.remove([h]).add(e.doc,[m]),this.placeholderWidgets.set(d,m)}for(const d of c){const p=this.placeholders.find(void 0,void 0,m=>m.id===d&&m.__type===Jl),h=this.placeholderWidgets.get(d);h&&((s=(i=h.spec).onDestroy)==null||s.call(i,this.store.view,h.spec.element)),this.placeholders=this.placeholders.remove(p),this.placeholderWidgets.delete(d)}}},props:{decorations:e=>{let t=this.options.decorations(e);t=t.add(e.doc,this.placeholders.find());for(const n of this.store.extensions){if(!n.createDecorations)continue;const r=n.createDecorations(e).find();t=t.add(e.doc,r)}return t},handleDOMEvents:{blur:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(IN,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(IN,!0)),!1)}}}}updateDecorations(){return({tr:e,dispatch:t})=>(t==null||t(e),!0)}addPlaceholder(e,t,n){return({dispatch:r,tr:o})=>this.addPlaceholderTransaction(e,t,o,!r)?(r==null||r(n?o.deleteSelection():o),!0):!1}updatePlaceholder(e,t){return({dispatch:n,tr:r})=>this.updatePlaceholderTransaction({id:e,data:t,tr:r,checkOnly:!n})?(n==null||n(r),!0):!1}removePlaceholder(e){return({dispatch:t,tr:n})=>this.removePlaceholderTransaction({id:e,tr:n,checkOnly:!t})?(t==null||t(n),!0):!1}clearPlaceholders(){return({tr:e,dispatch:t})=>this.clearPlaceholdersTransaction({tr:e,checkOnly:!t})?(t==null||t(e),!0):!1}findPlaceholder(e){return this.findAllPlaceholders().get(e)}findAllPlaceholders(){const e=new Map,t=this.placeholders.find(void 0,void 0,n=>n.__type===Jl);for(const n of t)e.set(n.spec.id,{from:n.from,to:n.to});return e}createDecorations(e){var t,n,r;const{persistentSelectionClass:o}=this.options;return!o||(t=this.store.view)!=null&&t.hasFocus()||(r=(n=this.store.helpers).isInteracting)!=null&&r.call(n)?it.empty:nne(e,it.empty,{class:Le(o)?o:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){const{pos:n,createElement:r,onDestroy:o,onUpdate:i,className:s,nodeName:a,id:l,type:c}=e,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(s);const d=_t.widget(n,u,{id:l,__type:Jl,type:c,element:u,onDestroy:o,onUpdate:i});this.placeholderWidgets.set(l,d),this.placeholders=this.placeholders.add(t.doc,[d])}addInlinePlaceholder(e,t){const{from:n=t.selection.from,to:r=t.selection.to,className:o,nodeName:i,id:s,type:a}=e;let l;if(n===r){const c=document.createElement(i);c.classList.add(o),l=_t.widget(n,c,{id:s,type:a,__type:Jl,widget:c})}else l=_t.inline(n,r,{nodeName:i,class:o},{id:s,__type:Jl});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:i}=e,s=Dr(n)?t.doc.resolve(n):t.selection.$from,a=Dr(n)?s.nodeAfter?{pos:n,end:s.nodeAfter.nodeSize}:void 0:vee(s);if(!a)return;const l=_t.node(a.pos,a.end,{nodeName:o,class:r},{id:i,__type:Jl});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:o=n,className:i,...s}=t,a=(i?[r,i]:[r]).join(" ");return{nodeName:o,className:a,...s,id:e}}getMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...tne,...t}}setMeta(e,t){const n=this.getMeta(e);e.setMeta(this.pluginKey,{...n,...t})}addPlaceholderTransaction(e,t,n,r=!1){if(this.findPlaceholder(e))return!1;if(r)return!0;const{added:i}=this.getMeta(n);return this.setMeta(n,{added:[...i,this.withRequiredBase(e,t)]}),!0}updatePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1,data:o}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{updated:s}=this.getMeta(n);return this.setMeta(n,{updated:Gf([...s,{id:t,data:o}])}),!0}removePlaceholderTransaction(e){const{id:t,tr:n,checkOnly:r=!1}=e;if(!this.findPlaceholder(t))return!1;if(r)return!0;const{removed:i}=this.getMeta(n);return this.setMeta(n,{removed:Gf([...i,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===it.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};xe([Se()],Ho.prototype,"updateDecorations",1);xe([Se()],Ho.prototype,"addPlaceholder",1);xe([Se()],Ho.prototype,"updatePlaceholder",1);xe([Se()],Ho.prototype,"removePlaceholder",1);xe([Se()],Ho.prototype,"clearPlaceholders",1);xe([Ft()],Ho.prototype,"findPlaceholder",1);xe([Ft()],Ho.prototype,"findAllPlaceholders",1);Ho=xe([ot({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(e,t,n)=>e.add(n.doc,t.find()),getDefault:()=>it.empty}}},defaultPriority:ft.Low})],Ho);var tne={added:[],updated:[],clearTrackers:!1,removed:[]},Jl="placeholderDecoration",IN="persistentSelectionFocus";function nne(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:i,to:s}=r,a=oy(r)?_t.node(i,s,n):_t.inline(i,s,n);return t.add(o,[a])}var Gb=class extends Tt{get name(){return"docChanged"}onStateUpdate(e){const{firstUpdate:t,transactions:n,tr:r}=e;t||(n??[r]).some(o=>o==null?void 0:o.docChanged)&&this.options.docChanged(e)}};Gb=xe([ot({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:ft.Lowest})],Gb);var io=class extends Tt{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",Wb);const t=Ce(),n=Ce(),r=Ce(),o=new Set;for(const i of this.store.extensions){Xp(i)&&(n[i.name]=a=>bee({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=tp({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),cy(i)&&(n[i.name]=a=>Ag({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=Qi(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(ok(l.mark,a))return l.mark.attrs});const s=((e=i.createHelpers)==null?void 0:e.call(i))??{};for(const a of Object.keys(i.decoratedHelpers??{}))s[a]=i[a].bind(i);if(!vg(s))for(const[a,l]of tn(s))XD({name:a,set:o,code:oe.DUPLICATE_HELPER_NAMES}),t[a]=l}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",n),this.store.setStoreKey("helpers",t),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",n),this.store.setExtensionStore("helpers",t)}isSelectionEmpty(e=this.store.getState()){return rk(e)}isViewEditable(e=this.store.getState()){var t,n;return((n=(t=this.store.view.props).editable)==null?void 0:n.call(t,e))??!1}getStateJSON(e=this.store.getState()){return e.toJSON()}getJSON(e=this.store.getState()){return e.doc.toJSON()}getRemirrorJSON(e=this.store.getState()){return this.getJSON(e)}insertHtml(e,t){return n=>{const{state:r}=n,o=Wb({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
425
-
426
- `,state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,$s)}getTextBetween(e,t,n=this.store.getState().doc){return n.textBetween(e,t,`
427
-
428
- `,$s)}getHTML(e=this.store.getState()){return Wee(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};xe([Ft()],io.prototype,"isSelectionEmpty",1);xe([Ft()],io.prototype,"isViewEditable",1);xe([Ft()],io.prototype,"getStateJSON",1);xe([Ft()],io.prototype,"getJSON",1);xe([Ft()],io.prototype,"getRemirrorJSON",1);xe([Se()],io.prototype,"insertHtml",1);xe([Ft()],io.prototype,"getText",1);xe([Ft()],io.prototype,"getTextBetween",1);xe([Ft()],io.prototype,"getHTML",1);io=xe([ot({})],io);var Yb=class extends Tt{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;const n=[],r=this.store.markTags[He.ExcludeInputRules];for(const o of this.store.extensions)if(!((e=this.store.managerSettings.exclude)!=null&&e.inputRules||!o.createInputRules||(t=o.options.exclude)!=null&&t.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return sZ({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};Yb=xe([ot({defaultPriority:ft.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],Yb);var _o=class extends Tt{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,n;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],(n=(t=this.store).rebuildKeymap)==null||n.call(t),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==e),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:e}=this.options;return Le(e)?sne[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new rs({props:{handleKeyDown:(t,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,t,n)}}})])}setupKeydownHandler(){const e=this.generateKeymapBindings();this.keydownHandler=YD(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Ye),o=a=>l=>rm({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((e=a.options.exclude)!=null&&e.keymap)){a.createKeymap&&t.push(one(a.createKeymap(o(a)),n));for(const[c,u]of tn(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),p=rm({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),h=Nt(u.priority)?u.priority(a.options,this.store):u.priority??ft.Low,m=Ce();for(const v of p)m[v]=d;t.push([h,m]),u.command&&r.updateDecorated(u.command,{shortcut:p})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return See(i)}arrowRightShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return Rg(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[He.PreventExits],n=this.store.nodeTags[He.PreventExits];return Rg(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=Ce();if(!n)for(const[o,i]of tn(z0))r[o]=Xd(i);return t&&z0.Backspace&&(r.Backspace=Xd(ay(aZ,z0.Backspace))),e&&(r.Escape=Xd(hte)),[ft.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?rm({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,n;const{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(t=this.store).rebuildKeymap)==null||n.call(t))}sortKeymaps(e){return El(e.map(t=>rn(t)?t:[ft.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!Gee(r.selection)||ep({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(ya(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return n=>{const{tr:r}=n;if(!(t?PN:Kb)(r.selection))return!1;const i=r.selection.$anchor.node();return!ak(i)||jee(i)||e.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?PN:Kb)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(ep({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(ya(l))return!1;if(!i)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),i(o),!0}}};xe([Vr({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],_o.prototype,"arrowRightShortcut",1);xe([Vr({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],_o.prototype,"arrowLeftShortcut",1);xe([Vr({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],_o.prototype,"backspace",1);xe([Ft()],_o.prototype,"getNamedShortcut",1);_o=xe([ot({defaultPriority:ft.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],_o);function rne(e){return Vo(Yv(ie),e)}function rm({shortcut:e,map:t,options:n,store:r}){return Le(e)?[Jb(e,t)]:rn(e)?e.map(o=>Jb(o,t)):(e=e(n,r),rm({shortcut:e,map:t,options:n,store:r}))}function Jb(e,t){return rne(e)?t[e]:e}function one(e,t){const n={};let r,o;rn(e)?[o,r]=e:r=e;for(const[i,s]of tn(r))n[Jb(i,t)]=s;return Jv(o)?n:[o,n]}var eL={[ie.Copy]:"Mod-c",[ie.Cut]:"Mod-x",[ie.Paste]:"Mod-v",[ie.PastePlain]:"Mod-Shift-v",[ie.SelectAll]:"Mod-a",[ie.Undo]:"Mod-z",[ie.Redo]:Co.isMac?"Shift-Mod-z":"Mod-y",[ie.Bold]:"Mod-b",[ie.Italic]:"Mod-i",[ie.Underline]:"Mod-u",[ie.Strike]:"Mod-d",[ie.Code]:"Mod-`",[ie.Paragraph]:"Mod-Shift-0",[ie.H1]:"Mod-Shift-1",[ie.H2]:"Mod-Shift-2",[ie.H3]:"Mod-Shift-3",[ie.H4]:"Mod-Shift-4",[ie.H5]:"Mod-Shift-5",[ie.H6]:"Mod-Shift-6",[ie.TaskList]:"Mod-Shift-7",[ie.BulletList]:"Mod-Shift-8",[ie.OrderedList]:"Mod-Shift-9",[ie.Quote]:"Mod->",[ie.Divider]:"Mod-Shift-|",[ie.Codeblock]:"Mod-Shift-~",[ie.ClearFormatting]:"Mod-Shift-C",[ie.Superscript]:"Mod-.",[ie.Subscript]:"Mod-,",[ie.LeftAlignment]:"Mod-Shift-L",[ie.CenterAlignment]:"Mod-Shift-E",[ie.RightAlignment]:"Mod-Shift-R",[ie.JustifyAlignment]:"Mod-Shift-J",[ie.InsertLink]:"Mod-k",[ie.Find]:"Mod-f",[ie.FindBackwards]:"Mod-Shift-f",[ie.FindReplace]:"Mod-Shift-H",[ie.AddFootnote]:"Mod-Alt-f",[ie.AddComment]:"Mod-Alt-m",[ie.ContextMenu]:"Mod-Shift-\\",[ie.IncreaseFontSize]:"Mod-Shift-.",[ie.DecreaseFontSize]:"Mod-Shift-,",[ie.IncreaseIndent]:"Tab",[ie.DecreaseIndent]:"Shift-Tab",[ie.Shortcuts]:"Mod-/",[ie.Format]:Co.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},ine={...eL,[ie.Strike]:"Mod-Shift-S",[ie.Code]:"Mod-Shift-M",[ie.Paragraph]:"Mod-Alt-0",[ie.H1]:"Mod-Alt-1",[ie.H2]:"Mod-Alt-2",[ie.H3]:"Mod-Alt-3",[ie.H4]:"Mod-Alt-4",[ie.H5]:"Mod-Alt-5",[ie.H6]:"Mod-Alt-6",[ie.OrderedList]:"Mod-Alt-7",[ie.BulletList]:"Mod-Alt-8",[ie.Quote]:"Mod-Alt-9",[ie.ClearFormatting]:"Mod-\\",[ie.IncreaseIndent]:"Mod-[",[ie.DecreaseIndent]:"Mod-]"},sne={default:eL,googleDoc:ine},ane=class extends Tt{get name(){return"nodeViews"}createPlugin(){const e=[],t=Ce();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(Nt(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},lne=class extends Tt{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.pasteRules||!r.createPasteRules||(t=r.options.exclude)!=null&&t.pasteRules)continue;const o=r.createPasteRules(),i=rn(o)?o:[o];n.push(...i)}return Tte(n)}},Xb=class extends Tt{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=Ce(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return Te(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){const{setStoreKey:e,setExtensionStore:t,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:o=[]}=n;this.updatePlugins(o,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=o,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr,o={previousState:t,tr:r,transactions:e,state:n};for(const i of this.appendTransactionHandlers)i(o);return this.options.appendTransaction(o),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(const n of this.initStateHandlers)n(t)},apply:(e,t,n,r)=>{const o={previousState:n,state:r,tr:e};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(e){var t,n;if(!(!e.createPlugin&&!e.createExternalPlugins||(t=this.store.managerSettings.exclude)!=null&&t.plugins||(n=e.options.exclude)!=null&&n.plugins)){if(e.createPlugin){const o=new Mu(e.name);this.pluginKeys[e.name]=o;const i=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);const s={...e.createPlugin(),key:o},a=new rs(s);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){const o=e.createExternalPlugins();this.updatePlugins(o,e.externalPlugins),e.externalPlugins=o}}}updatePlugins(e,t){if(!t||ya(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(r=>!t.includes(r)),...e];return}const n=new Map;for(const[r,o]of e.entries())n.set(jt(t,r),o);this.plugins=this.plugins.map(r=>t.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){const t=ZD(e)?e:qte(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);Te(t,{code:oe.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(t),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){Te(this.store.phase>=tr.EditorView,{code:oe.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:e,updateState:t}=this.store,n=e.state.reconfigure({plugins:this.plugins});t(n)}};Xb=xe([ot({defaultPriority:ft.Highest,handlerKeys:["applyState","appendTransaction"]})],Xb);var Zb=class extends Tt{constructor(){super(...arguments),this.dynamicAttributes={marks:Ce(),nodes:Ce()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=e,c=m=>!!(m&&t[He.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=gne(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:Ce(),[i]:Ce()}:Ce(),d=Ce(),p=cne({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){p[m.name]={...p[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(Xp(m)){const{spec:b,dynamic:x}=DN({createExtensionSpec:(w,k)=>m.createNodeSpec(w,k),extraAttributes:jt(p,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags});m.spec=b,u[m.name]=b,Object.keys(x).length>0&&(this.dynamicAttributes.nodes[m.name]=x)}if(cy(m)){const{spec:b,dynamic:x}=DN({createExtensionSpec:(w,k)=>m.createMarkSpec(w,k),extraAttributes:jt(p,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags??[]});m.spec=b,d[m.name]=b,Object.keys(x).length>0&&(this.dynamicAttributes.marks[m.name]=x)}}const h=new JJ({nodes:u,marks:d,topNode:"doc"});this.addSchema(h,u,d)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,s)=>(this.checkAndUpdateDynamicNodes(i,s,r),this.checkAndUpdateDynamicMarks(i,s,r),!0)),r.steps.length>0?r:null)}}}addSchema(e,t,n){this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",iy(e).name);for(const r of Object.values(e.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,n){for(const[r,o]of tn(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of tn(o)){if(!va(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),NN(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of tn(this.dynamicAttributes.marks)){const i=jt(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of tn(o)){if(!va(s.attrs[a]))continue;const c=Qi(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:d}=c,p=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,p),NN(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};Zb=xe([ot({defaultPriority:ft.Highest})],Zb);function cne(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=Ce();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=dne({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const d=s[u]??{};s[u]={...d,...l.attributes}}}return s}function une(e){return Il(e)&&rn(e.tags)}function dne(e){const{identifiers:t,nodeNames:n,markNames:r,tags:o}=e;if(t==="nodes")return n;if(t==="marks")return r;if(t==="all")return[...n,...r];if(rn(t))return t;Te(une(t),{code:oe.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,d=new Set,p=u==="mark"?r:u==="node"?n:[...r,...n],h=v=>p.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)h(v)&&d.add(v);const m=new Map;for(const v of i)if(!(c!=null&&c.includes(v)))for(const b of o[v]){if(!h(b))continue;if(a==="any"){d.add(b);continue}const x=m.get(b)??new Set;x.add(v),m.set(b,x)}for(const[v,b]of m)b.size===i.length&&d.add(v);return[...d]}function DN(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=Ce();function c(b,x){l[b]=x}let u=!1;function d(){u=!0}const p=fne(r,o,d,c),h=pne(r,o),m=hne(r,o),v=n({defaults:p,parse:h,dom:m},a);return Te(o||u,{code:oe.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...s].join(" ")||void 0,{spec:v,dynamic:l}}function ck(e){return Le(e)||Nt(e)?{default:e}:(Te(e,{message:`${Z2(e)} is not supported`,code:oe.EXTENSION_EXTRA_ATTRIBUTES}),e)}function fne(e,t,n,r){return()=>{n();const o=Ce();if(t)return o;for(const[i,s]of tn(e)){let l=ck(s).default;Nt(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function pne(e,t){return n=>{const r=Ce();if(t)return r;for(const[o,i]of tn(e)){const{parseDOM:s,...a}=ck(i);if(pi(n)){if(va(s)){r[o]=n.getAttribute(o)??a.default;continue}if(Nt(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function hne(e,t){return n=>{const r=Ce();if(t)return r;function o(i,s){if(i){if(Le(i)){r[s]=i;return}if(rn(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of tn(i))r[a]=l}}for(const[i,s]of tn(e)){const{toDOM:a,parseDOM:l}=ck(s);if(va(a)){const c=Le(l)?l:i;r[c]=n.attrs[i];continue}if(Nt(a)){o(a(n.attrs,mne(n)),i);continue}o(a,i)}return r}}function mne(e){return ry(e)?{node:e}:Tee(e)?{mark:e}:{}}function gne(e){const t=Ce(),n=Ce();for(const[r,o]of Object.entries(e.nodes))t[r]=o.spec;for(const[r,o]of Object.entries(e.marks))n[r]=o.spec;return{nodes:t,marks:n}}var du=class extends Tt{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return _N(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>_N(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>pee(this.store.getState(),e))}createExternalPlugins(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.suggesters)break;if(!r.createSuggesters||(t=r.options.exclude)!=null&&t.suggesters)continue;const o=r.createSuggesters(),i=rn(o)?o:[o];n.push(...i)}return[hee(...n)]}getSuggestState(e){return ek(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return Vo(rn(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};xe([Ft()],du.prototype,"getSuggestState",1);xe([Ft()],du.prototype,"getSuggestMethods",1);xe([Ft()],du.prototype,"isSuggesterActive",1);du=xe([ot({customHandlerKeys:["suggester"]})],du);var Qb=class extends Tt{constructor(){super(...arguments),this.allTags=Ce(),this.plainTags=Ce(),this.markTags=Ce(),this.nodeTags=Ce()}get name(){return"tags"}onCreate(){this.resetTags();for(const e of this.store.extensions)this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const e=Ce(),t=Ce(),n=Ce(),r=Ce();for(const o of Yv(He))e[o]=[],t[o]=[],n[o]=[],r[o]=[];this.allTags=e,this.plainTags=t,this.markTags=n,this.nodeTags=r}updateTagForExtension(e){var t,n;const r=new Set([...e.tags??[],...((t=e.createTags)==null?void 0:t.call(e))??[],...e.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[e.name])??[]]);for(const o of r)Te(vne(o),{code:oe.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(e.name),QD(e)&&this.plainTags[o].push(e.name),cy(e)&&this.markTags[o].push(e.name),Xp(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};Qb=xe([ot({defaultPriority:ft.Highest})],Qb);function vne(e){return Vo(Yv(He),e)}var yne=new Mu("remirrorFilePlaceholderPlugin");function xne(){const e=new rs({key:yne,state:{init(){return{set:it.empty,payloads:new Map}},apply(t,{set:n,payloads:r}){n=n.map(t.mapping,t.doc);const o=t.getMeta(e);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=_t.widget(o.pos,i,{id:o.id});n=n.add(t.doc,[s]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===o.id)),r.delete(o.id));return{set:n,payloads:r}}},props:{decorations(t){var n;return((n=e.getState(t))==null?void 0:n.set)??null}}});return e}var bne=class extends Tt{get name(){return"upload"}createExternalPlugins(){return[xne()]}};function wne(e={}){e={...{exitMarksOnArrowPress:_o.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:_o.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:_o.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:_o.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:Ho.defaultOptions.persistentSelectionClass},...e};const n=Cb(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=Cb(e,["persistentSelectionClass"]);return[new Qb,new Zb,new Gte,new Xb,new Yb,new lne,new ane,new du,new Ye,new io,new _o(n),new Gb,new bne,new Ho(r)]}var LN=class extends Tt{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){const t=e.decoratedCommands??{},n=e.createCommands;for(const r of Object.keys(t)){const o=e[r];e[r]=(...i)=>s=>{var a;const l=o(...i)(s);return s.dispatch&&l&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==((a=s.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,i]of Object.entries(r))r[o]=(...s)=>a=>{var l;const c=i(...s)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:o,extension:e.name,decorated:!1}),c};return r})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...n,t])}};LN=xe([ot({defaultOptions:{capture:Co.isDevelopment},staticKeys:["capture"],defaultPriority:ft.Highest})],LN);var om,hd,im,oc,Ss,sm,am,Sne=class{constructor(e){Wt(this,om,xg()),Wt(this,hd,void 0),Wt(this,im,void 0),Wt(this,oc,!0),Wt(this,Ss,Gv()),Wt(this,sm,void 0),Wt(this,am,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;Te(!this.manager.destroyed,{code:oe.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);ln(this,im,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);ya(d)||this.updateViewProps(...d)},this.onChange=(i=Ce())=>{var s,a;const l=this.eventListenerProps(i);pe(this,oc)&&ln(this,oc,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),pe(this,Ss).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),pe(this,Ss).emit("focus",l,i)},this.setContent=(i,{triggerChange:s=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(s)return this.updateState({state:c,triggerChange:s});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,s)=>this.manager.createState({content:i,selection:s}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:t,initialEditorState:n,element:r}=e;if(ln(this,hd,t),ln(this,am,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return pe(this,sm)??ln(this,sm,pe(this,Ss).on.bind(pe(this,Ss)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return pe(this,oc)}get props(){return pe(this,hd).call(this)}get previousState(){return this.previousStateOverride??pe(this,im)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return pe(this,om)}get initialEditorState(){return pe(this,am)}updateListener(e){const{state:t,tr:n}=e;return pe(this,Ss).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return ln(this,hd,t),this}updateViewProps(...e){const t=Cb(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=Nt(n)?n(this.eventListenerProps()):n;let c={};(r||Dr(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=Gf(qb(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return kJ({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){pe(this,Ss).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=Ce()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:pe(this,oc),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:pe(this,om),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};om=new WeakMap;hd=new WeakMap;im=new WeakMap;oc=new WeakMap;Ss=new WeakMap;sm=new WeakMap;am=new WeakMap;function kne(e,t){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:t};for(const d of e)tL(a,{extension:d});s=El(s,(d,p)=>p.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const p=d.constructor,h=d.name,m=i.get(p);Te(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:oe.INTERNAL}),!(l.has(p)||c.has(h))&&(l.add(p),c.add(h),n.push(d),r.set(p,d),m.forEach(v=>v==null?void 0:v.replaceChildExtension(p,d)))}const u=[];for(const d of n)Ene({extension:d,found:l,missing:u});return Te(ya(u),{code:oe.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:p})=>`The extension '${p.name}' requires '${d.name} in order to run correctly.`).join(`
429
- `)}),{extensions:n,extensionMap:r}}function tL(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;Te(ZD(a),{code:oe.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),Cne({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)tL(e,{names:c,extension:d,parentExtension:a})}}function Ene(e){const{extension:t,found:n,missing:r}=e;if(t.requiredExtensions)for(const o of t.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:t})}function Cne(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,i=t.get(o),s=r?[r]:[];t.set(o,i?[...i,...s]:s)}function _ne(e){var t,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=e;i.setStore(c);const d=(t=i.onCreate)==null?void 0:t.bind(i),p=(n=i.onView)==null?void 0:n.bind(i),h=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);d&&u.create.push(d),p&&u.view.push(p),h&&u.update.push(h),m&&u.destroy.push(m),cy(i)&&a.push(i.name),Xp(i)&&i.name!=="doc"&&s.push(i.name),QD(i)&&l.push(i.name)}var ks,md,mo,Ci,gd,Sr,$a,vd,Va,yd,Ua,go,xd,lm=class{constructor(e,t={}){Wt(this,ks,void 0),Wt(this,md,Ce()),Wt(this,mo,Ce()),Wt(this,Ci,void 0),Wt(this,gd,void 0),Wt(this,Sr,tr.None),Wt(this,$a,void 0),Wt(this,vd,!0),Wt(this,Va,{create:[],view:[],update:[],destroy:[]}),Wt(this,yd,[]),Wt(this,Ua,Gv()),Wt(this,go,void 0),Wt(this,xd,void 0),this.getState=()=>{var o;return pe(this,Sr)>=tr.EditorView?this.view.state:(Te(pe(this,go),{code:oe.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=pe(this,go))==null?void 0:o.initialEditorState)},this.updateState=o=>{const i=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:i,state:o})};const{extensions:n,extensionMap:r}=kne(e,t);ln(this,$a,t),ln(this,Ci,Ja(n)),ln(this,gd,r),ln(this,ks,this.createExtensionStore()),ln(this,Sr,tr.Create),this.setupLifecycleHandlers();for(const o of pe(this,Va).create){const i=o();i&&pe(this,yd).push(i)}}static create(e,t={}){return new lm([...rI(e),...wne(t.builtin)],t)}get[Zi](){return hn.Manager}get destroyed(){return pe(this,Sr)===tr.Destroy}get mounted(){return pe(this,Sr)>=tr.EditorView&&pe(this,Sr)<tr.Destroy}get output(){var e;return(e=pe(this,go))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!pe(this,go)}get extensions(){return pe(this,Ci)}get stringHandlers(){return pe(this,md)}get store(){return Ja(pe(this,mo))}get extensionStore(){return Ja(pe(this,ks))}get tr(){return this.getExtension(Ye).transaction}get nodes(){return pe(this,mo).nodes}get marks(){return pe(this,mo).marks}get schema(){return pe(this,mo).schema}get extensionTags(){return pe(this,mo).tags}get view(){return pe(this,mo).view}get settings(){return pe(this,$a)}get document(){return pe(this,$a).document??sy()}setupLifecycleHandlers(){const e=pe(this,ks),t=pe(this,Va),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of pe(this,Ci))_ne({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){pe(this,md)[e]=t}setStoreKey(e,t){pe(this,mo)[e]=t}getStoreKey(e){const t=pe(this,mo)[e];return Te(!va(t),{code:oe.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){Te(pe(this,Sr)<=tr.EditorView,{code:oe.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),pe(this,ks)[e]=t}createExtensionStore(){const e=Ce(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>pe(this,Ci),enumerable:t},phase:{get:()=>pe(this,Sr),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>Ja(pe(this,$a)),enumerable:t},getState:{value:this.getState,enumerable:t},updateState:{value:this.updateState,enumerable:t},isMounted:{value:()=>this.mounted,enumerable:t},getExtension:{value:this.getExtension.bind(this),enumerable:t},manager:{get:()=>this,enumerable:t},document:{get:()=>this.document,enumerable:t},stringHandlers:{get:()=>pe(this,md),enumerable:t},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:t},previousState:{get:()=>r,set:o=>{r=o},enumerable:t}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(pe(this,Sr)>=tr.EditorView)return this;ln(this,vd,!0),ln(this,Sr,tr.EditorView),pe(this,mo).view=e;for(const t of pe(this,Va).view){const n=t(e);n&&pe(this,yd).push(n)}return this}attachFramework(e,t){var n;pe(this,go)!==e&&(pe(this,go)&&(pe(this,go).destroy(),(n=pe(this,xd))==null||n.call(this)),ln(this,go,e),ln(this,xd,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return Te(t,{code:oe.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){const{onError:t,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=e,{schema:s,plugins:a}=this.store,l=RD({stringHandler:Le(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return Xa.create({schema:s,doc:l,plugins:a,selection:oo(o,l)})}addHandler(e,t){return pe(this,Ua).on(e,t)}onStateUpdate(e){const t=pe(this,vd);pe(this,ks).currentState=e.state,pe(this,ks).previousState=e.previousState,t&&(ln(this,Sr,tr.Runtime),ln(this,vd,!1));const n={...e,firstUpdate:t};for(const r of pe(this,Va).update)r(n);pe(this,Ua).emit("stateUpdate",n)}getExtension(e){const t=pe(this,gd).get(e);return Te(t,{code:oe.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){return!!pe(this,gd).get(e)}clone(){const e=pe(this,Ci).map(n=>n.clone(n.options)),t=lm.create(()=>e,pe(this,$a));return pe(this,Ua).emit("clone",t),t}recreate(e=[],t={}){const n=pe(this,Ci).map(o=>o.clone(o.initialOptions)),r=lm.create(()=>[...n,...e],t);return pe(this,Ua).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;ln(this,Sr,tr.Destroy);for(const s of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=s.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=pe(this,go))==null||r.destroy(),(o=pe(this,xd))==null||o.call(this);for(const s of pe(this,yd))s();for(const s of pe(this,Va).destroy)s();(i=this.view)==null||i.destroy(),pe(this,Ua).emit("destroy")}includes(e){const t=[],n=[];for(const r of pe(this,Ci))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>Le(r)?Vo(t,r):Vo(n,r))}},Nne=lm;ks=new WeakMap;md=new WeakMap;mo=new WeakMap;Ci=new WeakMap;gd=new WeakMap;Sr=new WeakMap;$a=new WeakMap;vd=new WeakMap;Va=new WeakMap;yd=new WeakMap;Ua=new WeakMap;go=new WeakMap;xd=new WeakMap;function Tne(e,t){return!(!Pu(e)||!ju(e,hn.Manager))}var One=Object.defineProperty,Mne=Object.getOwnPropertyDescriptor,Pne=(e,t,n,r)=>{for(var o=r>1?void 0:r?Mne(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&One(t,n,o),o},nL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ke=(e,t,n)=>(nL(e,t,"read from private field"),n?n.call(e):t.get(e)),kr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},wr=(e,t,n,r)=>(nL(e,t,"write to private field"),t.set(e,n),n),bd,jne=class{constructor(){this.portals=new Map,kr(this,bd,Gv()),this.on=e=>ke(this,bd).on("update",e),this.once=e=>{const t=ke(this,bd).on("update",n=>{t(),e(n)});return t}}update(){ke(this,bd).emit("update",this.portals)}render({Component:e,container:t}){const n=this.portals.get(t);this.portals.set(t,{Component:e,key:(n==null?void 0:n.key)??xg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:xg()})}remove(e){this.portals.delete(e),this.update()}};bd=new WeakMap;var Rne=e=>{const{portals:t}=e;return _e.createElement(_e.Fragment,null,t.map(([n,{Component:r,key:o}])=>Or.createPortal(_e.createElement(r,null),n,o)))};function Ane(e){const[t,n]=g.useState(()=>Array.from(e.portals.entries()));return g.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),g.useMemo(()=>t,[t])}var Ot,wd,Ha,Sd,cm,kd,ic,Ed,um,_i,$n,ew,rL=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){kr(this,Ot,void 0),kr(this,wd,[]),kr(this,Ha,void 0),kr(this,Sd,void 0),kr(this,cm,void 0),kr(this,kd,void 0),kr(this,ic,void 0),kr(this,Ed,!1),kr(this,um,void 0),kr(this,_i,void 0),kr(this,$n,void 0),kr(this,ew,l=>{l&&(Te(ke(this,_i),{code:oe.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${ke(this,Ot).type.name}' which doesn't support content.`}),l.append(ke(this,_i)))}),this.Component=()=>{const l=ke(this,cm);return Te(l,{code:oe.REACT_NODE_VIEW,message:`The custom react node view provided for ${ke(this,Ot).type.name} doesn't have a valid ReactComponent`}),_e.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:ke(this,Ha),getPosition:ke(this,kd),node:ke(this,Ot),forwardRef:ke(this,ew),decorations:ke(this,wd)})},this.updateAttributes=l=>{if(!ke(this,Ha).editable)return;const c=ke(this,kd).call(this);if(c==null)return;const u=ke(this,Ha).state.tr.setNodeMarkup(c,void 0,{...ke(this,Ot).attrs,...l});ke(this,Ha).dispatch(u)},Te(Nt(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),wr(this,Ot,t),wr(this,Ha,r),wr(this,Sd,n),wr(this,cm,o),wr(this,kd,e),wr(this,ic,i),wr(this,$n,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};wr(this,um,s??void 0),wr(this,_i,a),ke(this,_i)&&ke(this,$n).append(ke(this,_i)),this.setDomAttributes(ke(this,Ot),ke(this,$n)),this.Component.displayName=J2(`${ke(this,Ot).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new rL({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return ke(this,Ed)}get contentDOM(){return ke(this,um)}get dom(){return ke(this,$n)}renderComponent(){ke(this,Sd).render({Component:this.Component,container:ke(this,$n)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=ke(this,ic),n=ke(this,Ot).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${v_(ke(this,Ot).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(ke(this,Ot).isLeaf)return;const n=(t=(e=ke(this,Ot).type.spec).toDOM)==null?void 0:t.call(e,ke(this,Ot));if(!n)return;const{contentDOM:r,dom:o}=ja.renderSpec(document,n);let i;if(pi(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${v_(ke(this,Ot).type.name)}-node-view-content-wrapper`),i.append(r)),pi(r),{wrapper:i,contentDOM:r}}update(e,t){return nk({types:ke(this,Ot).type,node:e})?(ke(this,Ot)===e&&ke(this,wd)===t||(ke(this,Ot).sameMarkup(e)||this.setDomAttributes(e,ke(this,$n)),wr(this,Ot,e),wr(this,wd,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=ke(this,Ot).type.spec;let r=e.attrs;if(n){const o=n(e);if(Le(o)||Ine(o))return;Il(o[1])&&(r=o[1])}for(const[o,i]of tn(r))t.setAttribute(o,i)}selectNode(){wr(this,Ed,!0),ke(this,$n)&&ke(this,$n).classList.add(p_),this.renderComponent()}deselectNode(){wr(this,Ed,!1),ke(this,$n)&&ke(this,$n).classList.remove(p_),this.renderComponent()}destroy(){ke(this,Sd).remove(ke(this,$n))}ignoreMutation(e){return e.type==="selection"?!ke(this,Ot).type.spec.selectable:ke(this,_i)?!ke(this,_i).contains(e.target):!0}stopEvent(e){var t;if(!ke(this,$n))return!1;if(Nt(ke(this,ic).stopEvent))return ke(this,ic).stopEvent({event:e});const n=e.target;if(!(ke(this,$n).contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!ke(this,Ot).type.spec.draggable,a=Me.isSelectable(ke(this,Ot)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",d=e.type==="mousedown",p=e.type.startsWith("drag");return!s&&a&&p&&e.preventDefault(),!(p||o||l||c||u||d&&a)}},FN=rL;Ot=new WeakMap;wd=new WeakMap;Ha=new WeakMap;Sd=new WeakMap;cm=new WeakMap;kd=new WeakMap;ic=new WeakMap;Ed=new WeakMap;um=new WeakMap;_i=new WeakMap;$n=new WeakMap;ew=new WeakMap;function Ine(e){return Hb(e)||Il(e)&&Hb(e.dom)}var rp=class extends Tt{constructor(){super(...arguments),this.portalContainer=new jne}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=Ce(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Xp(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=FN.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=tn({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=FN.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};rp=Pne([ot({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],rp);var Dne=Object.defineProperty,zN=Object.getOwnPropertySymbols,Lne=Object.prototype.hasOwnProperty,Fne=Object.prototype.propertyIsEnumerable,BN=(e,t,n)=>t in e?Dne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$N=(e,t)=>{for(var n in t||(t={}))Lne.call(t,n)&&BN(e,n,t[n]);if(zN)for(var n of zN(t))Fne.call(t,n)&&BN(e,n,t[n]);return e};function zne(e){const t=g.createContext(null),n=Bne(t);return[o=>{const i=e(o);return _e.createElement(t.Provider,{value:i},o.children)},n,t]}function Bne(e){return(t,n)=>{const r=g.useContext(e),o=$ne(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!t)return r;if(typeof t!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=t(r);if(!o||!n)return i;const s=t(o);return n(s,i)?s:i}}function $ne(e){const t=g.useRef();return Vne(()=>{t.current=e}),t.current}var Vne=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Une(e,t){return zne(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:VN(r),set:UN(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:VN(r),set:UN(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function VN(e){return t=>{if(!e.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!t)return e.current;if(typeof t!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return t(e.current)}}function UN(e){return t=>{if(!e.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");e.current(n=>$N($N({},n),typeof t=="function"?t(n):t))}}var oL={},iL={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessages=e.ErrorType=void 0;var t;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(t=e.ErrorType||(e.ErrorType={})),e.errorMessages=new Map([[t.MalformedUnicode,"malformed Unicode character escape sequence"],[t.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[t.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[t.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[t.EndOfString,"malformed escape sequence at end of string"]])})(iL);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=iL;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(h){return!h.match(/[^a-f0-9]/i)?parseInt(h,16):NaN}function r(h,m,v){const b=n(h);if(Number.isNaN(b)||v!==void 0&&v!==h.length)throw new SyntaxError(t.errorMessages.get(m));return b}function o(h){const m=r(h,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(h,m){const v=r(h,t.ErrorType.MalformedUnicode,4);if(m!==void 0){const b=r(m,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,b)}return String.fromCharCode(v)}function s(h){return h.charAt(0)==="{"&&h.charAt(h.length-1)==="}"}function a(h){if(!s(h))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=h.slice(1,-1),v=r(m,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(b){throw b instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):b}}function l(h,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(h,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
430
- `],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(h){return c.get(h)||h}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function p(h,m=!1){return h.replace(d,function(v,b,x,w,k,C,_,O,T){if(b!==void 0)return"\\";if(x!==void 0)return o(x);if(w!==void 0)return a(w);if(k!==void 0)return i(k,C);if(_!==void 0)return i(_);if(O==="0")return"\0";if(O!==void 0)return l(O,!m);if(T!==void 0)return u(T);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=p,e.default=p})(oL);const fl=e=>typeof e=="string",Hne=e=>typeof e=="function",HN=new Map,sL="en";function uk(e){return[...Array.isArray(e)?e:[e],sL]}function aL(e,t,n){const r=uk(e);return Fg(()=>zg("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(fl(t)?new Date(t):t)}function tw(e,t,n){const r=uk(e);return Fg(()=>zg("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function WN(e,t,n,{offset:r=0,...o}){const i=uk(e),s=t?Fg(()=>zg("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):Fg(()=>zg("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function Fg(e,t){const n=e();let r=HN.get(n);return r||(r=t(),HN.set(n,r)),r}function zg(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const lL=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,cL="%__lingui_octothorpe__%",Wne=(e,t,n={})=>{const r=t||e,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=tw(r,s,l);return a.replace(new RegExp(cL,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=WN(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=WN(r,!0,s,a);return i(s-l,c)},select:Kne,number:(s,a)=>tw(r,s,o(a)),date:(s,a)=>aL(r,s,o(a))}},Kne=(e,t)=>t[e]??t.other;function qne(e,t,n){return(r={},o)=>{const i=Wne(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,d)=>{if(d==="#"&&c)return u+cL;if(fl(d))return u+d;const[p,h,m]=d;let v={};h==="plural"||h==="selectordinal"||h==="select"?Object.entries(m).forEach(([x,w])=>{v[x]=s(w,h==="plural"||h==="selectordinal")}):v=m;let b;if(h){const x=i[h];b=x(r[p],v)}else b=r[p];return b==null?u:u+b},""):l,a=s(e);return fl(a)&&lL.test(a)?oL.unraw(a.trim()):fl(a)?a.trim():a?String(a):""}}var Gne=Object.defineProperty,Yne=(e,t,n)=>t in e?Gne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jne=(e,t,n)=>(Yne(e,t+"",n),n);class Xne{constructor(){Jne(this,"_events",{})}on(t,n){var r;return(r=this._events)[t]??(r[t]=[]),this._events[t].push(n),()=>this.removeListener(t,n)}removeListener(t,n){const r=this._getListeners(t);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(t,...n){const r=this._getListeners(t);r&&r.map(o=>o.apply(this,n))}_getListeners(t){const n=this._events[t];return Array.isArray(n)?n:!1}}var Zne=Object.defineProperty,Qne=(e,t,n)=>t in e?Zne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xl=(e,t,n)=>(Qne(e,typeof t!="symbol"?t+"":t,n),n);class ere extends Xne{constructor(t){super(),Xl(this,"_locale",""),Xl(this,"_locales"),Xl(this,"_localeData",{}),Xl(this,"_messages",{}),Xl(this,"_missing"),Xl(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??sL,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(t,n){const r=this._localeData[t];r?Object.assign(r,n):this._localeData[t]=n}loadLocaleData(t,n){n!=null?this._loadLocaleData(t,n):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,n){const r=this._messages[t];r?Object.assign(r,n):this._messages[t]=n}load(t,n){typeof t=="string"&&typeof n=="object"?this._load(t,n):Object.entries(t).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:t,locales:n,messages:r}){this._locale=t,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,n){this._locale=t,this._locales=n,this.emit("change")}_(t,n,r){let o=r==null?void 0:r.message;t||(t=""),fl(t)||(n=t.values||n,o=t.message,t=t.id);const i=this.messages[t],s=i===void 0,a=this._missing;if(a&&s)return Hne(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return fl(l)&&lL.test(l)?JSON.parse(`"${l}"`):fl(l)?l:qne(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return aL(this._locales||this._locale,t,n)}number(t,n){return tw(this._locales||this._locale,t,n)}}function tre(e={}){return new ere(e)}const uy=tre();function ue(e,t){return t?"other":e==1?"one":"other"}function is(e,t){return t?"other":e==0||e==1?"one":"other"}function vr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function lt(e,t){return"other"}function Aa(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const nre=lt,rre=ue,ore=is;function ire(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const sre=ue;function are(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function lre(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function cre(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const ure=ue,dre=vr;function fre(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||i==20||i==50||i==70||i==80?"one":o==3||o==4||s==100||s==200||s==300||s==400||s==500||s==600||s==700||s==800||s==900?"few":r==0||o==6||i==40||i==60||i==90?"many":"other":e==1?"one":"other"}function pre(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?(o==2||o==3)&&i!=12&&i!=13?"few":"other":o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"}const hre=ue,mre=ue,gre=ue,vre=is,yre=lt;function xre(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const bre=lt;function wre(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return t?"other":o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"}const Sre=ue;function kre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Ere(e,t){var n=String(e).split("."),r=!n[1];return t?e==1||e==3?"one":e==2?"two":e==4?"few":"other":e==1&&r?"one":"other"}const Cre=ue;function _re(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Nre=ue,Tre=ue,Ore=ue;function Mre(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function Pre(e,t){return t?e==0||e==7||e==8||e==9?"zero":e==1?"one":e==2?"two":e==3||e==4?"few":e==5||e==6?"many":"other":e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"}function jre(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return t?"other":e==1||!o&&(r==0||r==1)?"one":"other"}const Rre=vr;function Are(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}const Ire=ue,Dre=lt,Lre=ue,Fre=ue;function zre(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":e==1&&r?"one":"other"}const Bre=ue,$re=ue,Vre=vr,Ure=ue;function Hre(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function Wre(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Kre=vr;function qre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Gre=ue;function Yre(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Jre=ue,Xre=vr;function Zre(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1?"one":"other":e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"}function Qre(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==11?"one":e==2||e==12?"two":e==3||e==13?"few":"other":e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"}const eoe=vr,toe=ue;function noe(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const roe=is;function ooe(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(s==0||s==20||s==40||s==60||s==80)?"few":o?"other":"many"}const ioe=ue,soe=ue;function aoe(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}function loe(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}function coe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function uoe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}function doe(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function foe(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const poe=vr,hoe=lt,moe=lt,goe=lt,voe=vr;function yoe(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11||!o?"one":"other"}function xoe(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const boe=Aa;function woe(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}const Soe=lt,koe=lt,Eoe=ue,Coe=vr,_oe=ue,Noe=lt,Toe=lt;function Ooe(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-2);return t?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":e==1?"one":"other"}function Moe(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Poe=ue,joe=ue,Roe=lt,Aoe=lt;function Ioe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||r&&o==0&&e!=0?"many":"other":e==1?"one":"other"}const Doe=ue,Loe=ue,Foe=lt;function zoe(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Boe=lt,$oe=ue,Voe=ue;function Uoe(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const Hoe=ue;function Woe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),i=r&&n[0].slice(-3),s=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return t?r&&e>=1&&e<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":e==5||o==5?"many":"other":e==0?"zero":e==1?"one":o==2||o==22||o==42||o==62||o==82||r&&i==0&&(s>=1e3&&s<=2e4||s==4e4||s==6e4||s==8e4)||e!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":e!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const Koe=ue;function qoe(e,t){var n=String(e).split("."),r=n[0];return t?"other":e==0?"zero":(r==0||r==1)&&e!=0?"one":"other"}const Goe=ue,Yoe=ue,Joe=lt,Xoe=is;function Zoe(e,t){return t&&e==1?"one":"other"}function Qoe(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function eie(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const tie=ue,nie=is,rie=ue;function oie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?s==1&&a!=11?"one":s==2&&a!=12?"two":(s==7||s==8)&&a!=17&&a!=18?"many":"other":i&&s==1&&a!=11||l==1&&c!=11?"one":"other"}const iie=ue,sie=ue;function aie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}function lie(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function cie(e,t){return t&&e==1?"one":"other"}function uie(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==1?"one":e==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const die=lt,fie=ue,pie=Aa,hie=ue,mie=ue;function gie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?r&&e>=1&&e<=4?"one":"other":e==1?"one":"other"}const vie=vr,yie=ue,xie=ue,bie=ue,wie=lt,Sie=ue,kie=is,Eie=ue,Cie=ue,_ie=ue;function Nie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==5||r&&e>=7&&e<=9?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e==1?"one":"other"}const Tie=ue,Oie=lt,Mie=is,Pie=ue;function jie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"}function Rie(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const Aie=ue;function Iie(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const Die=vr,Lie=ue;function Fie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}const zie=ue,Bie=lt;function $ie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"}const Vie=ue,Uie=lt,Hie=ue;function Wie(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}function Kie(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const qie=ue,Gie=ue,Yie=Aa,Jie=ue,Xie=lt,Zie=lt;function Qie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function ese(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"}function tse(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"";return t?"other":e==0||e==1||r==0&&o==1?"one":"other"}function nse(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function rse(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const ose=Aa,ise=Aa,sse=Aa,ase=Aa,lse=Aa,cse=ue,use=ue;function dse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?e==1?"one":o==4&&i!=14?"many":"other":e==1?"one":"other"}function fse(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const pse=ue,hse=ue,mse=ue,gse=lt;function vse(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?(i==1||i==2)&&s!=11&&s!=12?"one":"other":e==1&&r?"one":"other"}const yse=vr,xse=ue,bse=ue,wse=ue,Sse=ue,kse=lt,Ese=is,Cse=ue;function _se(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||e==10?"few":"other":e==1?"one":"other"}function Nse(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Tse=ue,Ose=lt,Mse=ue,Pse=ue;function jse(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e==0||e==1||r&&e>=11&&e<=99?"one":"other"}const Rse=ue;function Ase(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?s==3&&a!=13?"few":"other":o&&l==1&&c!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)?"few":o&&l==0||o&&l>=5&&l<=9||o&&c>=11&&c<=14?"many":"other"}const Ise=vr,Dse=ue,Lse=ue;function Fse(e,t){return t&&e==1?"one":"other"}const zse=ue,Bse=ue,$se=is,Vse=ue,Use=lt,Hse=ue,Wse=ue,Kse=vr,qse=lt,Gse=lt,Yse=lt;function Jse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Xse=Object.freeze(Object.defineProperty({__proto__:null,_in:nre,af:rre,ak:ore,am:ire,an:sre,ar:are,ars:lre,as:cre,asa:ure,ast:dre,az:fre,be:pre,bem:hre,bez:mre,bg:gre,bho:vre,bm:yre,bn:xre,bo:bre,br:wre,brx:Sre,bs:kre,ca:Ere,ce:Cre,ceb:_re,cgg:Nre,chr:Tre,ckb:Ore,cs:Mre,cy:Pre,da:jre,de:Rre,dsb:Are,dv:Ire,dz:Dre,ee:Lre,el:Fre,en:zre,eo:Bre,es:$re,et:Vre,eu:Ure,fa:Hre,ff:Wre,fi:Kre,fil:qre,fo:Gre,fr:Yre,fur:Jre,fy:Xre,ga:Zre,gd:Qre,gl:eoe,gsw:toe,gu:noe,guw:roe,gv:ooe,ha:ioe,haw:soe,he:aoe,hi:loe,hr:coe,hsb:uoe,hu:doe,hy:foe,ia:poe,id:hoe,ig:moe,ii:goe,io:voe,is:yoe,it:xoe,iu:boe,iw:woe,ja:Soe,jbo:koe,jgo:Eoe,ji:Coe,jmc:_oe,jv:Noe,jw:Toe,ka:Ooe,kab:Moe,kaj:Poe,kcg:joe,kde:Roe,kea:Aoe,kk:Ioe,kkj:Doe,kl:Loe,km:Foe,kn:zoe,ko:Boe,ks:$oe,ksb:Voe,ksh:Uoe,ku:Hoe,kw:Woe,ky:Koe,lag:qoe,lb:Goe,lg:Yoe,lkt:Joe,ln:Xoe,lo:Zoe,lt:Qoe,lv:eie,mas:tie,mg:nie,mgo:rie,mk:oie,ml:iie,mn:sie,mo:aie,mr:lie,ms:cie,mt:uie,my:die,nah:fie,naq:pie,nb:hie,nd:mie,ne:gie,nl:vie,nn:yie,nnh:xie,no:bie,nqo:wie,nr:Sie,nso:kie,ny:Eie,nyn:Cie,om:_ie,or:Nie,os:Tie,osa:Oie,pa:Mie,pap:Pie,pl:jie,prg:Rie,ps:Aie,pt:Iie,pt_PT:Die,rm:Lie,ro:Fie,rof:zie,root:Bie,ru:$ie,rwk:Vie,sah:Uie,saq:Hie,sc:Wie,scn:Kie,sd:qie,sdh:Gie,se:Yie,seh:Jie,ses:Xie,sg:Zie,sh:Qie,shi:ese,si:tse,sk:nse,sl:rse,sma:ose,smi:ise,smj:sse,smn:ase,sms:lse,sn:cse,so:use,sq:dse,sr:fse,ss:pse,ssy:hse,st:mse,su:gse,sv:vse,sw:yse,syr:xse,ta:bse,te:wse,teo:Sse,th:kse,ti:Ese,tig:Cse,tk:_se,tl:Nse,tn:Tse,to:Ose,tr:Mse,ts:Pse,tzm:jse,ug:Rse,uk:Ase,ur:Ise,uz:Dse,ve:Lse,vi:Fse,vo:zse,vun:Bse,wa:$se,wae:Vse,wo:Use,xh:Hse,xog:Wse,yi:Kse,yo:qse,yue:Gse,zh:Yse,zu:Jse},Symbol.toStringTag,{value:"Module"}));var Zse=Object.defineProperty,Qse=Object.getOwnPropertyDescriptor,eae=Object.getOwnPropertyNames,tae=Object.prototype.hasOwnProperty,nae=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of eae(t))!tae.call(e,o)&&o!==n&&Zse(e,o,{get:()=>t[o],enumerable:!(r=Qse(t,o))||r.enumerable});return e},rae=(e,t,n)=>(nae(e,t,"default"),n),oae=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),uL={};rae(uL,Xse);uy.loadLocaleData("en",{plurals:uL.en});uy.load("en",oae);uy.activate("en");var iae=Object.defineProperty,sae=Object.getOwnPropertyDescriptor,dk=(e,t,n,r)=>{for(var o=r>1?void 0:r?sae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&iae(t,n,o),o},fu=class extends co{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=Ce();if(Il(n))for(const[i,s]of tn(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...t}}setDocAttributes(e){return({tr:t,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(e))t.step(new nw(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return sk(e.doc,t)}};dk([Se()],fu.prototype,"setDocAttributes",1);dk([Ft()],fu.prototype,"isDefaultDocNode",1);fu=dk([ot({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:ft.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],fu);var dL="SetDocAttribute",fL="RevertSetDocAttribute",nw=class rw extends on{constructor(n,r,o=dL){super();zt(this,"key");zt(this,"stepType");zt(this,"value");zt(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new rw(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return Vt.ok(n.type.create(r,n.content,n.marks))}invert(){return new rw(this.key,this.previous,fL)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{on.jsonID(dL,nw),on.jsonID(fL,nw)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var aae=Object.defineProperty,lae=Object.getOwnPropertyDescriptor,pL=(e,t,n,r)=>{for(var o=r>1?void 0:r?lae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&aae(t,n,o),o};function cae(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function uae(e,t){const n=t.target;if(n){const r=cae(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var Bg=class extends Tt{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=uae(t,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const d of nI(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const p=Qi(c,d);p&&s.push(p)}return e(r,{view:t,nodes:i,marks:s,getMark:d=>{const p=Le(d)?t.state.schema.marks[d]:d;return Te(p,{code:oe.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(h=>h.mark.type===p)},getNode:d=>{var p;const h=Le(d)?t.state.schema.nodes[d]:d;Te(h,{code:oe.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===h);if(m)return{...m,isRoot:!!((p=i[0])!=null&&p.node.eq(m.node))}}})}}get name(){return"events"}onView(){var e,t;if(!((e=this.store.managerSettings.exclude)!=null&&e.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(t=n.options.exclude)!=null&&t.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of tn(r))this.addHandler(o,i)}}createPlugin(){const e=new WeakMap,t=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:p}=u,h=p.resolve(i),m=e.has(l),v=dae({$pos:h,handled:m,view:o,state:u});let b=!1;m||(b=n(l,v)||b);const x={...v,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:w=>{const k=Le(w)?d.nodes[w]:w;return Te(k,{code:oe.EXTENSION,message:"The node being checked does not exist"}),k===s.type?{node:s,pos:a}:void 0}};return e.set(l,!0),r(l,x)||b};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,i)=>this.options.textInput({from:r,to:o,text:i})||!1,handleClickOn:(n,r,o,i,s,a)=>t(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,i,s,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!1};return this.options.hover(n,o)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!0};return this.options.hover(n,o)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const o=this.options;return{update(i){const s=i.editable;s!==r&&(o.editable(s),r=s)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};pL([Ft()],Bg.prototype,"isInteracting",1);Bg=pL([ot({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:ft.High})],Bg);function dae(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:eI,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=Qi(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Le(s)?o.schema.marks[s]:s;return Te(a,{code:oe.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class Dt extends Ge{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Dt.valid(r)?new Dt(r):Ge.near(r)}content(){return fe.empty}eq(t){return t instanceof Dt&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Dt(t.resolve(n.pos))}getBookmark(){return new fk(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!fae(t)||!pae(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Dt.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if(Dt.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Me.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if(Dt.valid(a))return a}return null}}}Dt.prototype.visible=!1;Dt.findFrom=Dt.findGapCursorFrom;Ge.jsonID("gapcursor",Dt);class fk{constructor(t){this.pos=t}map(t){return new fk(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Dt.valid(n)?new Dt(n):Ge.near(n)}}function fae(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function pae(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function hae(){return new rs({props:{decorations:yae,createSelectionBetween(e,t,n){return t.pos==n.pos&&Dt.valid(n)?new Dt(n):null},handleClick:gae,handleKeyDown:mae,handleDOMEvents:{beforeinput:vae}}})}const mae=YD({ArrowLeft:Ah("horiz",-1),ArrowRight:Ah("horiz",1),ArrowUp:Ah("vert",-1),ArrowDown:Ah("vert",1)});function Ah(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof Fe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=Dt.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new Dt(c))),!0):!1}}function gae(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Dt.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Me.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Dt(r))),!0)}function vae(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Dt))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=q.empty;for(let s=r.length-1;s>=0;s--)o=q.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new fe(o,0,0));return i.setSelection(Fe.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function yae(e){if(!(e.selection instanceof Dt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",it.create(e.doc,[_t.widget(e.selection.head,t,{key:"gapcursor"})])}var xae=Object.defineProperty,bae=Object.getOwnPropertyDescriptor,wae=(e,t,n,r)=>{for(var o=r>1?void 0:r?bae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&xae(t,n,o),o},ow=class extends Tt{get name(){return"gapCursor"}createExternalPlugins(){return[hae()]}};ow=wae([ot({})],ow);var $g=200,mn=function(){};mn.prototype.append=function(t){return t.length?(t=mn.from(t),!this.length&&t||t.length<$g&&this.leafAppend(t)||this.length<$g&&t.leafPrepend(this)||this.appendInner(t)):this};mn.prototype.prepend=function(t){return t.length?mn.from(t).append(this):this};mn.prototype.appendInner=function(t){return new Sae(this,t)};mn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?mn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};mn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};mn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};mn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};mn.from=function(t){return t instanceof mn?t:t&&t.length?new hL(t):mn.empty};var hL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=$g)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=$g)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(mn);mn.empty=new hL([]);var Sae=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(mn);const kae=500;class No{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){o||(o=this.remapping(r,p+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new vs(d.map));let h=d.step.map(o.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new vs(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new No(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),p=new vs(t.mapping.maps[u],d,n),h;(h=l&&l.merge(p))&&(p=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(p),n&&(s++,n=void 0),o||(l=p)}let c=s-r.depth;return c>Cae&&(a=Eae(a,c),s-=c),new No(a.append(i),s)}remapping(t,n){let r=new Ac;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new No(this.items.append(t.map(n=>new vs(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let l=n;this.items.forEach(p=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(p.step){let v=t.steps[h].invert(t.docs[h]),b=p.selection&&p.selection.map(i.slice(l+1,h));b&&a++,r.push(new vs(m,v,b))}else r.push(new vs(m))},o);let c=[];for(let p=n;p<s;p++)c.push(new vs(i.maps[p]));let u=this.items.slice(0,o).append(c).append(r),d=new No(u,a);return d.emptyItemCount()>kae&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new vs(c.invert(),l,u),p,h=o.length-1;(p=o.length&&o[h].merge(d))?o[h]=p:o.push(d)}}else s.map&&r--},this.items.length,0),new No(mn.from(o.reverse()),i)}}No.empty=new No(mn.empty,0);function Eae(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let vs=class mL{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new mL(n.getMap().invert(),n,this.selection)}}};class Os{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Cae=20;function _ae(e,t,n,r){let o=n.getMeta(Vi),i;if(o)return o.historyState;n.getMeta(Oae)&&(e=new Os(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Vi))return s.getMeta(Vi).redo?new Os(e.done.addTransform(n,void 0,r,dm(t)),e.undone,KN(n.mapping.maps),e.prevTime,e.prevComposition):new Os(e.done,e.undone.addTransform(n,void 0,r,dm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Nae(n,e.prevRanges)),c=s?U0(e.prevRanges,n.mapping):KN(n.mapping.maps);return new Os(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,dm(t)),No.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new Os(e.done.rebased(n,i),e.undone.rebased(n,i),U0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Os(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),U0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Nae(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function KN(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function U0(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function Tae(e,t,n){let r=dm(t),o=Vi.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new Os(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Vi,{redo:n,historyState:l})}let H0=!1,qN=null;function dm(e){let t=e.plugins;if(qN!=t){H0=!1,qN=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){H0=!0;break}}return H0}const Vi=new Mu("history"),Oae=new Mu("closeHistory");function Mae(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new rs({key:Vi,state:{init(){return new Os(No.empty,No.empty,null,0,-1)},apply(t,n,r){return _ae(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?fm:r=="historyRedo"?Cd:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function gL(e,t){return(n,r)=>{let o=Vi.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=Tae(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const fm=gL(!1,!0),Cd=gL(!0,!0);function iw(e){let t=Vi.getState(e);return t?t.done.eventCount:0}function Pae(e){let t=Vi.getState(e);return t?t.undone.eventCount:0}var jae=Object.defineProperty,Rae=Object.getOwnPropertyDescriptor,Ll=(e,t,n,r)=>{for(var o=r>1?void 0:r?Rae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&jae(t,n,o),o},hi=class extends Tt{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=Nt(i)?i():n,l=Nt(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Co.isMac?()=>!1:this.wrapMethod(Cd,this.options.onRedo),"Mod-z":this.wrapMethod(fm,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(Cd,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(fm,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(Cd,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[Mae({depth:e,newGroupDelay:t})]}undo(){return TN(this.wrapMethod(fm,this.options.onUndo))}redo(){return TN(this.wrapMethod(Cd,this.options.onRedo))}undoDepth(e=this.store.getState()){return iw(e)}redoDepth(e=this.store.getState()){return Pae(e)}};Ll([Vr({shortcut:ie.Undo,command:"undo"})],hi.prototype,"undoShortcut",1);Ll([Vr({shortcut:ie.Redo,command:"redo"})],hi.prototype,"redoShortcut",1);Ll([Se({disableChaining:!0,description:({t:e})=>e(_g.UNDO_DESCRIPTION),label:({t:e})=>e(_g.UNDO_LABEL),icon:"arrowGoBackFill"})],hi.prototype,"undo",1);Ll([Se({disableChaining:!0,description:({t:e})=>e(_g.REDO_DESCRIPTION),label:({t:e})=>e(_g.REDO_LABEL),icon:"arrowGoForwardFill"})],hi.prototype,"redo",1);Ll([Ft()],hi.prototype,"undoDepth",1);Ll([Ft()],hi.prototype,"redoDepth",1);hi=Ll([ot({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],hi);var Aae=Object.defineProperty,Iae=Object.getOwnPropertyDescriptor,dy=(e,t,n,r)=>{for(var o=r>1?void 0:r?Iae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Aae(t,n,o),o},Dae={icon:"paragraph",label:({t:e})=>e(Ng.INSERT_LABEL),description:({t:e})=>e(Ng.INSERT_DESCRIPTION)},Lae={icon:"paragraph",label:({t:e})=>e(Ng.CONVERT_LABEL),description:({t:e})=>e(Ng.CONVERT_DESCRIPTION)},Ol=class extends co{get name(){return"paragraph"}createTags(){return[He.LastNodeCompatible,He.TextBlock,He.Block,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",draggable:!1,...t,attrs:{...e.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...e.parse(n)})},...t.parseDOM??[]],toDOM:n=>["p",e.dom(n),0]}}convertParagraph(e={}){const{attrs:t,selection:n,preserveAttrs:r}=e;return this.store.commands.setBlockNodeType.original(this.type,t,n,r)}insertParagraph(e,t={}){const{selection:n,attrs:r}=t;return this.store.commands.insertNode.original(this.type,{content:e,selection:n,attrs:r})}shortcut(e){return this.convertParagraph()(e)}};dy([Se(Lae)],Ol.prototype,"convertParagraph",1);dy([Se(Dae)],Ol.prototype,"insertParagraph",1);dy([Vr({shortcut:ie.Paragraph,command:"convertParagraph"})],Ol.prototype,"shortcut",1);Ol=dy([ot({defaultPriority:ft.Medium})],Ol);function Fi(e,t,n){return Math.min(Math.max(e,n),t)}class Fae extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var _d=Fae;function pk(e){if(typeof e!="string")throw new _d(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=Kae.test(e)?$ae(e):e;const n=Vae.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(op(a,2),16)),parseInt(op(s[3]||"f",2),16)/255]}const r=Uae.exec(t);if(r){const s=Array.from(r).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,16)),parseInt(s[3]||"ff",16)/255]}const o=Hae.exec(t);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,10)),parseFloat(s[3]||"1")]}const i=Wae.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Fi(0,100,a)!==a)throw new _d(e);if(Fi(0,100,l)!==l)throw new _d(e);return[...qae(s,a,l),Number.isNaN(c)?1:c]}throw new _d(e)}function zae(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const GN=e=>parseInt(e.replace(/_/g,""),36),Bae="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=GN(t.substring(0,3)),r=GN(t.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return e[n]=`${o}${r}`,e},{});function $ae(e){const t=e.toLowerCase().trim(),n=Bae[zae(t)];if(!n)throw new _d(e);return`#${n}`}const op=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),Vae=new RegExp(`^#${op("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Uae=new RegExp(`^#${op("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Hae=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${op(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Wae=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,Kae=/^[a-z]+$/i,YN=e=>Math.round(e*255),qae=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(YN);const o=(e%360+360)%360/60,i=(1-Math.abs(2*r-1))*(t/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,p=l+u,h=c+u;return[d,p,h].map(YN)};function Gae(e){const[t,n,r,o]=pk(e).map((d,p)=>p===3?d:d/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2;if(i===s)return[0,0,a,o];const l=i-s,c=a>.5?l/(2-i-s):l/(i+s);return[60*(t===i?(n-r)/l+(n<r?6:0):n===i?(r-t)/l+2:(t-n)/l+4),c,a,o]}function Yae(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Fi(0,100,t*100).toFixed()}%, ${Fi(0,100,n*100).toFixed()}%, ${parseFloat(Fi(0,1,r).toFixed(3))})`}function _r(e,t){const[n,r,o,i]=Gae(e);return Yae(n,r,o-t,i)}function Jae(e){if(e==="transparent")return 0;function t(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=pk(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function Xae(e,t,n,r){return`rgba(${Fi(0,255,e).toFixed()}, ${Fi(0,255,t).toFixed()}, ${Fi(0,255,n).toFixed()}, ${parseFloat(Fi(0,1,r).toFixed(3))})`}function pm(e,t){return _r(e,-t)}function Vg(e,t){const[n,r,o,i]=pk(e);return Xae(n,r,o,i-t)}function Zae(e){return Jae(e)>.179}function Fc(e){return Zae(e)?"#000":"#fff"}const Qae="remirror-editor-wrapper",ele="remirror-button-active",tle="remirror-button",nle="remirror-composite",rle="remirror-dialog",ole="remirror-dialog-backdrop",ile="remirror-form",sle="remirror-form-message",ale="remirror-form-label",lle="remirror-form-group",cle="remirror-group",ule="remirror-input",dle="remirror-menu",fle="remirror-menu-pane",ple="remirror-menu-pane-active",hle="remirror-menu-dropdown-label",mle="remirror-menu-pane-icon",gle="remirror-menu-pane-label",vle="remirror-menu-pane-shortcut",yle="remirror-menu-button-left",xle="remirror-menu-button-right",ble="remirror-menu-button-nested-left",wle="remirror-menu-button-nested-right",Sle="remirror-menu-button",kle="remirror-menu-bar",Ele="remirror-flex-column",Cle="remirror-flex-row",_le="remirror-menu-item",Nle="remirror-menu-item-row",Tle="remirror-menu-item-column",Ole="remirror-menu-item-checkbox",Mle="remirror-menu-item-radio",Ple="remirror-menu-group",jle="remirror-floating-popover",Rle="remirror-popover",Ale="remirror-animated-popover",Ile="remirror-role",Dle="remirror-separator",Lle="remirror-tab",Fle="remirror-tab-list",zle="remirror-tabbable",Ble="remirror-toolbar",$le="remirror-tooltip",Vle="remirror-table-size-editor",Ule="remirror-table-size-editor-body",Hle="remirror-table-size-editor-cell",Wle="remirror-table-size-editor-cell-selected",Kle="remirror-table-size-editor-footer",qle="remirror-color-picker",Gle="remirror-color-picker-cell",Yle="remirror-color-picker-cell-selected";var Jle=Object.freeze({__proto__:null,ANIMATED_POPOVER:Ale,BUTTON:tle,BUTTON_ACTIVE:ele,COLOR_PICKER:qle,COLOR_PICKER_CELL:Gle,COLOR_PICKER_CELL_SELECTED:Yle,COMPOSITE:nle,DIALOG:rle,DIALOG_BACKDROP:ole,EDITOR_WRAPPER:Qae,FLEX_COLUMN:Ele,FLEX_ROW:Cle,FLOATING_POPOVER:jle,FORM:ile,FORM_GROUP:lle,FORM_LABEL:ale,FORM_MESSAGE:sle,GROUP:cle,INPUT:ule,MENU:dle,MENU_BAR:kle,MENU_BUTTON:Sle,MENU_BUTTON_LEFT:yle,MENU_BUTTON_NESTED_LEFT:ble,MENU_BUTTON_NESTED_RIGHT:wle,MENU_BUTTON_RIGHT:xle,MENU_DROPDOWN_LABEL:hle,MENU_GROUP:Ple,MENU_ITEM:_le,MENU_ITEM_CHECKBOX:Ole,MENU_ITEM_COLUMN:Tle,MENU_ITEM_RADIO:Mle,MENU_ITEM_ROW:Nle,MENU_PANE:fle,MENU_PANE_ACTIVE:ple,MENU_PANE_ICON:mle,MENU_PANE_LABEL:gle,MENU_PANE_SHORTCUT:vle,POPOVER:Rle,ROLE:Ile,SEPARATOR:Dle,TAB:Lle,TABBABLE:zle,TABLE_SIZE_EDITOR:Vle,TABLE_SIZE_EDITOR_BODY:Ule,TABLE_SIZE_EDITOR_CELL:Hle,TABLE_SIZE_EDITOR_CELL_SELECTED:Wle,TABLE_SIZE_EDITOR_FOOTER:Kle,TAB_LIST:Fle,TOOLBAR:Ble,TOOLTIP:$le});const Xle="remirror-image-loader";var Zle=Object.freeze({__proto__:null,IMAGE_LOADER:Xle});const Qle="remirror-list-item-with-custom-mark",ece="remirror-ul-list-content",tce="remirror-editor",nce="remirror-list-item-marker-container",rce="remirror-list-item-checkbox",oce="remirror-collapsible-list-item-closed",ice="remirror-collapsible-list-item-button",sce="remirror-list-spine";var wa=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:ice,COLLAPSIBLE_LIST_ITEM_CLOSED:oce,EDITOR:tce,LIST_ITEM_CHECKBOX:rce,LIST_ITEM_MARKER_CONTAINER:nce,LIST_ITEM_WITH_CUSTOM_MARKER:Qle,LIST_SPINE:sce,UL_LIST_CONTENT:ece});const ace="remirror-is-empty";var lce=Object.freeze({__proto__:null,IS_EMPTY:ace});const cce="remirror-editor",uce="remirror-positioner",dce="remirror-positioner-widget";var fce=Object.freeze({__proto__:null,EDITOR:cce,POSITIONER:uce,POSITIONER_WIDGET:dce});const vo={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},zi="#000000",hk="#ffffff",pce="#252103",mk=Vg(zi,.75),fy="#7963d2",gk="#bcd263",hce="#fff",mce="#fff",vk=vo.gray[1],JN="rgba(10,31,68,0.08)",XN="rgba(10,31,68,0.10)",ZN="rgba(10,31,68,0.12)",gce=pm(Vg(zi,.1),.13),yk={background:hk,border:mk,foreground:zi,muted:vk,primary:fy,secondary:gk,primaryText:hce,secondaryText:mce,text:pce,faded:gce},vce={...yk,background:_r(hk,.15),border:_r(mk,.15),foreground:_r(zi,.15),muted:_r(vk,.15),primary:_r(fy,.15),secondary:_r(gk,.15),get text(){return Fc(this.background)},get primaryText(){return Fc(this.primary)},get secondaryText(){return Fc(this.secondary)}},yce={...yk,background:_r(hk,.075),border:_r(mk,.075),foreground:_r(zi,.075),muted:_r(vk,.075),primary:_r(fy,.075),secondary:_r(gk,.075),get text(){return Fc(this.background)},get primaryText(){return Fc(this.primary)},get secondaryText(){return Fc(this.secondary)}};({...yk,backdrop:Vg(zi,.1),outline:Vg(fy,.6),table:(pm(zi,.8),pm(zi,.4),vo.gray[3],vo.blue[7],vo.blue[1],vo.blue[5],vo.blue[7],pm(zi,.4),vo.blue[5],vo.red[7],vo.red[1],vo.red[5])},`${JN}`,`${XN}`,`${ZN}`);var xce=Object.defineProperty,bce=Object.getOwnPropertyDescriptor,xk=(e,t,n,r)=>{for(var o=r>1?void 0:r?bce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&xce(t,n,o),o},vL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Yt=(e,t,n)=>(vL(e,t,"read from private field"),n?n.call(e):t.get(e)),ki=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ys=(e,t,n,r)=>(vL(e,t,"write to private field"),t.set(e,n),n),Nd,Td,sc,Od,hm,Md,Pd,jd,Rd,mm=class{constructor(e){ki(this,Nd,Gv()),ki(this,Td,[]),ki(this,sc,new Map),ki(this,Od,[]),ki(this,hm,!1),ki(this,Md,void 0),ki(this,Pd,void 0),ki(this,jd,void 0),ki(this,Rd,void 0),this.addListener=(t,n)=>Yt(this,Nd).on(t,n),ys(this,Md,e),ys(this,Pd,e.getActive),ys(this,Rd,e.getPosition),ys(this,jd,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new mm(e)}static fromPositioner(e,t){return mm.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:Yt(this,Pd),getPosition:Yt(this,Rd),hasChanged:this.hasChanged,events:this.events,getID:Yt(this,jd)}}onActiveChanged(e){this.recentUpdate=e;const t=Yt(this,Pd).call(this,e);ys(this,Td,t),ys(this,sc,new Map),ys(this,hm,!1),ys(this,Od,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);Yt(this,Od).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}Yt(this,Nd).emit("update",n)}getID(e,t){var n;return((n=Yt(this,jd))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(Yt(this,hm)||(Yt(this,sc).set(t,e),Yt(this,sc).size<Yt(this,Td).length))return;const n=[];for(const r of Yt(this,Td).keys()){const o=Yt(this,sc).get(r);Te(o,{code:oe.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Yt(this,Od)[r];if(!i)return;n.push({position:Yt(this,Rd).call(this,o),element:o.element,id:i})}Yt(this,Nd).emit("done",n)}clone(e){return mm.create({...Yt(this,Md),...Nt(e)?e(Yt(this,Md)):e})}active(e){const t=Nt(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},Ro=mm;Nd=new WeakMap;Td=new WeakMap;sc=new WeakMap;Od=new WeakMap;hm=new WeakMap;Md=new WeakMap;Pd=new WeakMap;jd=new WeakMap;Rd=new WeakMap;Ro.EMPTY=[];function wce(e,t=wL){const{key:n}=(e==null?void 0:e.getMeta(bL))??{};return n===t}function yL(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&wce(t)?!0:t?xee(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function xL(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(pi(t)&&o){const u=Number.parseFloat(gs(t,"padding-left").replace("px","")),d=Number.parseFloat(gs(t,"padding-right").replace("px","")),p=Number.parseFloat(gs(t,"padding-top").replace("px","")),h=Number.parseFloat(gs(t,"padding-bottom").replace("px","")),m=Number.parseFloat(gs(t,"border-left").replace("px","")),v=Number.parseFloat(gs(t,"border-right").replace("px","")),b=Number.parseFloat(gs(t,"border-top").replace("px","")),x=Number.parseFloat(gs(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,k=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=d+v+(t.dir==="rtl"?0:w),a+=p+b,l+=h+x+k}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(x_(u,c.top,c.bottom)&&x_(d,c.left,c.right))return!0;return!1}var Sce="remirror-positioner-widget",bL="positionerUpdate",wL="__all_positioners__",SL={y:-999999,x:-999999,width:0,height:0},QN={...SL,left:-999999,top:-999999,bottom:-999999,right:-999999},kce={...SL,rect:{...QN,toJSON:()=>QN},visible:!1},Ece=Ro.create({hasChanged:yL,getActive(e){const{state:t}=e;if(!rk(t)||t.selection.$anchor.depth>2)return Ro.EMPTY;const n=ny({predicate:r=>r.type.isBlock,selection:t});return n?[n]:Ro.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!pi(r))return kce;const o=r.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=o.height,a=o.width,l=t.dom.scrollLeft+o.left-i.left,c=t.dom.scrollTop+o.top-i.top,u=xL(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),kL=Ece.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&ak(n.node)&&n.node.type===iy(t.state.schema)?[n]:Ro.EMPTY}}));kL.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));kL.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:i}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function bk(e){return Ro.create({hasChanged:yL,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!Dl(n.selection))return Ro.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return Ro.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),p=Math.min(i.top,s.top),h=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+p-l.top,v=u?1:Math.abs(i.left-s.right),b=new DOMRect(u?s.left:d,p,v,c),x=xL(b,o.dom);return{rect:b,y:m,x:h,height:c,width:v,visible:x}}})}var Cce=bk(e=>!e.selection.empty);bk(e=>e.selection.empty);bk(()=>!0);Cce.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return Ro.EMPTY;const r=jD(t);if(!r)return Ro.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return Ro.EMPTY}}}));var ip=class extends Tt{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:e})=>{if(e)return this.positioners=[...this.positioners,e],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(t=>t!==e)}}}get name(){return"positioner"}createAttributes(){return{class:fce.EDITOR}}init(){this.onScroll=mJ(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(e,t)=>(this.positioner(this.getBaseProps("hover",{hover:t})),!1),contextmenu:(e,t)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:t})),!1)}}onStateUpdate(e){this.positioner({...e,previousState:e.firstUpdate?void 0:e.previousState,event:"state",helpers:this.store.helpers})}createDecorations(e){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return it.empty;const t=_t.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return it.create(e.doc,[t])}forceUpdatePositioners(e=wL){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta(bL,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=Sce,e.setAttribute("role","presentation"),e}triggerPositioner(e,t){e.hasChanged(t)&&e.onActiveChanged({...t,view:this.store.view})}positioner(e){for(const t of this.positioners)t.events.includes(e.event)&&this.triggerPositioner(t,e)}getBaseProps(e,t){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:e,firstUpdate:!1,previousState:r,state:n,...t}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};xk([Se()],ip.prototype,"forceUpdatePositioners",1);xk([Ft()],ip.prototype,"getPositionerWidget",1);ip=xk([ot({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],ip);var _ce=Object.defineProperty,Nce=Object.getOwnPropertyDescriptor,Tce=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&_ce(t,n,o),o},sw=class extends co{get name(){return"text"}createTags(){return[He.InlineNode]}createNodeSpec(){return{}}};sw=Tce([ot({disableExtraAttributes:!0,defaultPriority:ft.Medium})],sw);var Oce={...fu.defaultOptions,...Ol.defaultOptions,...hi.defaultOptions,excludeExtensions:[]};function Mce(e={}){e={...Oce,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=e,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new hi({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new fu({content:t})),a.text||l.push(new sw),a.paragraph||l.push(new Ol),a.positioner||l.push(new ip),a.gapCursor||l.push(new ow),a.events||l.push(new Bg),l}var Pce=Object.defineProperty,jce=Object.getOwnPropertyDescriptor,Rce=(e,t,n,r)=>{for(var o=r>1?void 0:r?jce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Pce(t,n,o),o},Ml=class extends Tt{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:sk(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>Ace({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>Ice({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=tr.EditorView&&this.store.updateAttributes()}};Ml=Rce([ot({defaultOptions:{emptyNodeClass:lce.IS_EMPTY,placeholder:""}})],Ml);function Ace(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:sk(o.doc)}:t}function Ice(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=t.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=_t.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),it.create(n.doc,s)}var Dce=Object.defineProperty,Lce=Object.getOwnPropertyDescriptor,Fce=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Dce(t,n,o),o},zce={...Ml.defaultOptions,...rp.defaultOptions},Bce=[...Ml.staticKeys,...rp.staticKeys],sp=class extends Tt{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(Ml).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Ml({emptyNodeClass:e,placeholder:t,priority:ft.Low}),new rp({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};sp=Fce([ot({defaultOptions:zce,staticKeys:Bce})],sp);var EL={};Object.defineProperty(EL,"__esModule",{value:!0});function $ce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return tT(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return tT(r,o)},e[0]);return n||null}var td=EL.default=$ce,eT=new WeakMap;function tT(e,t){if(e&&t){var n=eT.get(e)||new WeakMap;eT.set(e,n);var r=n.get(t)||function(o){nT(e,o),nT(t,o)};return n.set(t,r),r}return e||t}function nT(e,t){typeof e=="function"?e(t):e.current=t}var CL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},W0=(e,t,n)=>(CL(e,t,"read from private field"),t.get(e)),Vce=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Uce=(e,t,n,r)=>(CL(e,t,"write to private field"),t.set(e,n),n);function Hce(){const[,e]=g.useState(Ce());return g.useCallback(()=>{e(Ce())},[])}var _L=g.createContext(null);function py(e){const t=g.useContext(_L),n=g.useRef(Hce());Te(t,{code:oe.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(Il(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(Nt(o))return r("updated",o)}},[r,e]),t}function Wce(e=!0){return py({autoUpdate:e}).active}function Kce(e=!1){return py(e?{autoUpdate:!0}:void 0).attrs}function NL(){return py().chain.new()}var[qce,Upe]=Une(({props:e})=>{const t=e.locale??"en",n=e.i18n??uy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function rT(e,t={}){const{core:n,react:r,...o}=t;return Tne(e)?e:Nne.create(()=>[...rI(e),new sp(r),...Mce(n)],o)}function Gce(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>rT(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>rT(n.current,r.current))}),[o]),o}var Yce=typeof td=="object"&&td.__esModule&&td.default?td.default:td,ac,Jce=class extends Sne{constructor(e){if(super(e),Vce(this,ac,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=t=>this.internalGetRootProps(t,null),this.internalGetRootProps=(t,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=t??Ce();return{[r]:Yce(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,Te(this.rootPropsConfig.count<=1,{code:oe.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),Uce(this,ac,t),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(Ml).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new BQ(null,{state:e,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:e,...t}){const{triggerChange:n=!0,tr:r,transactions:o}=t;if(this.props.state){const{onChange:i}=this.props;Te(i,{code:oe.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),Te(n,{code:oe.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:e,tr:r,transactions:o});return}!r&&!o&&(e=e.apply(e.tr.setMeta(h_,{}))),this.view.updateState(e),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:e,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:e,tr:r,transactions:o})}updateControlledState(e,t){this.previousStateOverride=t,e=e.apply(e.tr.setMeta(h_,{})),this.view.updateState(e),this.manager.onStateUpdate({previousState:this.previousState,state:e}),this.previousStateOverride=void 0}addProsemirrorViewToDom(e,t){this.props.insertPosition==="start"?e.insertBefore(t,e.firstChild):e.append(t)}onRefLoad(){Te(W0(this,ac),{code:oe.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(W0(this,ac),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&W0(this,ac)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};ac=new WeakMap;var TL=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Xce(e){const t=g.useRef();return TL(()=>{t.current=e}),t.current}function Zce(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!va(r)&&t.getExtension(sp).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(sp).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=rn(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=Qce({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),eue(a),a.frameworkOutput}function Qce(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new Jce(t.current),[]);return n.update(e),n}function eue(e){const{state:t}=e.props,n=g.useRef(!!t),r=Xce(t);TL(()=>{const o=t?n.current===!0:n.current===!1;Te(o,{code:oe.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!t||t===r)&&e.updateControlledState(t,r??void 0)},[t,r,e])}function tue(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=Gce(o??(()=>[]),i),[a,l]=g.useState(()=>s.createState({selection:r,content:t??s.createEmptyDoc()})),c=g.useCallback(({state:d})=>{l(d)},[]),u=g.useCallback(()=>s.output,[s]);return g.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var aw=()=>_e.createElement("div",{className:Jle.EDITOR_WRAPPER,...py().getRootProps()}),nue=e=>(e.hook(),null);function rue(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=Zce(a),c=Ane(l.portalContainer),u=n==="start"||n===!0||!t&&va(n),d=n==="end";return _e.createElement(qce,{i18n:r,locale:o,supportedLocales:i},_e.createElement(_L.Provider,{value:l},_e.createElement(Rne,{portals:c}),s.map((p,h)=>_e.createElement(nue,{hook:p,key:h})),u&&_e.createElement(aw,null),t,d&&_e.createElement(aw,null)))}function oue(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return iue(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function iue(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=s.resolve(t.start-2);i=new Cl(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new Cl(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=$S(i,n,r,t);return a?(e&&sue(e,t,a,o,n),!0):!1}function sue(e,t,n,r,o){let i=q.empty;for(let u=n.length-1;u>=0;u--)i=q.from(n[u].type.create(n[u].attrs,i));e.step(new Ut(t.start-(r?2:0),t.end,t.start,t.end,new fe(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,p=!0;u<d;u++,p=!1)!p&&Ic(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function aue(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?lue(t,n,e,i):cue(t,n,i):!0:!1}}function lue(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Ut(i-1,s,i,s,new fe(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Cl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ou(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return Kp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function cue(e,t,n){let r=e.tr,o=n.parent;for(let h=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?q.empty:q.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new Ut(d-(a?1:0),p+(l?1:0),d+1,p-1,new fe((a?q.empty:q.from(o.copy(q.empty))).append(l?q.empty:q.from(o.copy(q.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var uue=Object.defineProperty,due=Object.getOwnPropertyDescriptor,uo=(e,t,n,r)=>{for(var o=r>1?void 0:r?due(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&uue(t,n,o),o};function lw(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListContainerNode))}function fue(e){var t;return!!((t=e.spec.group)!=null&&t.includes(He.ListItemNode))}function Sa(e){return lw(e.type)}function oa(e){return fue(e.type)}function wk(e,t){return n=>{const{dispatch:r,tr:o}=n,i=tk(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=ny({predicate:u=>lw(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return PL(t)(n);if(lw(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):pue(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return oue(e)(i,r)}}function OL(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var h,m;const i=Cee(e,o.schema),{$from:s,$to:a}=n.selection;if(oy(n.selection)&&n.selection.node.isBlock||s.depth<2||!s.sameParent(a))return!1;const l=s.node(-1);if(l.type!==i)return!1;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==i||s.index(-2)!==s.node(-2).childCount-1)return!1;if(r){const v=s.index(-1)>0;let b=q.empty;for(let k=s.depth-(v?1:2);k>=s.depth-3;k--)b=q.from(s.node(k).copy(b));const x=((h=i.contentMatch.defaultType)==null?void 0:h.createAndFill())||void 0;b=b.append(q.from(i.createAndFill(null,x)||void 0));const w=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;n.replace(s.before(v?void 0:-1),s.after(-w),new fe(b,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(s.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&s.sameParent(a)&&a.pos===a.end()){if(r){const v=s.after(-1),b=((m=i.contentMatch.defaultType)==null?void 0:m.createAndFill())||void 0,x=i.createAndFill(null,b);x&&(n.insert(v,x),n.setSelection(Fe.near(n.doc.resolve(v+1)))),n.delete(s.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===s.end()?l.contentMatchAt(0).defaultType:null,d={...s.node().attrs};n.delete(s.pos,a.pos);const p=u?[{type:i,attrs:c},{type:u,attrs:d}]:[{type:i,attrs:c}];return Ic(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,p).scrollIntoView()),!0):!1}}function pue(e,t,n,r){const o=t.node,i=e.doc.resolve(t.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,q.from(n.create())))return!1;const l=[];for(let h=0;h<o.childCount;h++){const m=o.child(h);if(!r.validContent(m.content))return!1;const v=r.createChecked(null,m.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,d=u+o.nodeSize,p=e.selection.from;return e.replaceRangeWith(u,d,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(p))),!0}function hue({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,i=n.doc.slice(r.start,r.end);if(o.type===e&&((l=i.content.firstChild)==null?void 0:l.type)===t)return!1;const s=[];for(let c=0;c<i.content.childCount;c++){const u=i.content.child(c);if(!t.validContent(u.content))return!1;const d=t.createChecked(null,u.content);s.push(d)}const a=e.createChecked(null,s);return n.replaceRange(r.start,r.end,new fe(q.from(a),0,0)),!0}function pu({listType:e,itemType:t,tr:n}){const r=Ug(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return hue({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Fe.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function mue(e,t,n){const r=e.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,v=n.endIndex-1,b=n.startIndex;v>b;v--)m-=o.child(v).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?q.empty:q.from(o))))return!1;const p=s.pos,h=p+a.nodeSize;return r.step(new Ut(p-(l?1:0),h+(c?1:0),p+1,h-1,new fe((l?q.empty:q.from(o.copy(q.empty))).append(c?q.empty:q.from(o.copy(q.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function ML(e,t){const n=t||e.selection.$from;let r=[],o,i,s,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),o=n.index(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Sa(s)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&Sa(s)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)Kp(e.doc,c)&&(e.join(c),l=!0);return l}function PL(e){return t=>{const{dispatch:n,tr:r}=t,o=tk(r,t.state),i=gue(e,r.selection);return i?(n&&mue(o,n,i),!0):!1}}function gue(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===e})}function Ug(e){const{$from:t,$to:n}=e;return t.blockRange(n,Sa)}function vue(e){const t=e.selection.$from,n=t.blockRange();if(!n||!oa(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),i=t.index(n.depth-1),s=t.index(n.depth-2),a=r.maybeChild(s-1),l=a==null?void 0:a.lastChild;if(o!==0||i!==0)return!1;if(a&&Sa(a)&&l&&oa(l))return pu({listType:a.type,itemType:l.type,tr:e});if(oa(r)){const c=r,u=t.node(n.depth-3);if(Sa(u))return pu({listType:u.type,itemType:c.type,tr:e})}return!1}function oT({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!oa(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;vue(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!oa(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),i=t.index(n.depth-2),s=n.depth-2>=1&&oa(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&aue(n.parent.type)(e.state,e.dispatch)}return VD(e.state,e.dispatch,e),!0}function jL({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(wa.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(wa.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==e.type?!1:(e=l,n(e,s),r(e,t),!0);return a(e),{dom:s,contentDOM:i,update:a}}function yue(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!oa(n)||!Sa(r)?!1:{parentItem:n,parentList:r}}function xue(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth);return o<i?(e.step(new Ut(o-1,i,o,i,new fe(q.from(r.type.create(null,n.copy())),1,0),1,!0)),new Cl(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function bue(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth-1);return o+1<i?(e.step(new Ut(o-1,i,o+1,i,new fe(q.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Cl(e.selection.$from,e.selection.$to,t.depth)):t}function wue(e,t,n,r){return pu({listType:n.type,itemType:r.type,tr:e})?new Cl(e.selection.$from,e.selection.$to,t.depth):t}function Sue(e){let t=Ug(e.selection);if(!t)return!1;const n=yue(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=xue(e,t),t=bue(e,t),t=wue(e,t,o,r);const i=Ou(t);return typeof i!="number"||(e.lift(t,i),t=Ug(e.selection),t&&ML(e,e.doc.resolve(t.end-2))),!0}var kue=({tr:e,dispatch:t})=>Sue(e)?(t==null||t(e.scrollIntoView()),!0):!1;function Eue(e,t,n){let r,o,i,s;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,s=a.resolve(n.start).start(n.depth),i=s+1;for(let l=0;l<n.startIndex-1;l++)i+=o.child(l).nodeSize}else{const l=t.index(n.depth-1);if(l>=1){const c=t.node(n.depth-1),u=t.start(n.depth-1);if(o=c.child(l-1),!Sa(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!oa(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function Cue(e,t,n){let r,o;const i=n.start,s=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=e.slice(i,a),o=null):(r=e.slice(i,s),o=e.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function _ue(e){const{$from:t,$to:n}=e.selection,r=Ug(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!Sa(o))return!1;const i=Eue(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=Cue(e.doc,n,r),d=s.content.append(q.fromArray([o.copy(c.content)])).append(u?u.content:q.empty);e.deleteRange(r.start,r.end);const p=l+s.nodeSize-2,h=s.copy(d);return h.check(),e.replaceRangeWith(l-1,p+1,h),e.setSelection(a===o?Fe.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Fe.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var Nue=({tr:e,dispatch:t})=>_ue(e)?(t==null||t(e.scrollIntoView()),!0):!1,RL=class extends Tt{get name(){return"listItemShared"}createKeymap(){const e={Tab:Nue,"Shift-Tab":kue,Backspace:oT,"Mod-Backspace":oT};if(Co.isMac){const t={"Ctrl-h":e.Backspace,"Alt-Backspace":e["Mod-Backspace"]};return{...e,...t}}return e}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr;return ML(r)?r:null}}}},hu=class extends co{get name(){return"listItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:e.parse,priority:ft.Lowest},...t.parseDOM??[]],toDOM:n=>["li",e.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(e,t,n)=>{const r=document.createElement("div");return r.classList.add(wa.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=Me.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),jL({mark:r,node:e,updateDOM:Tue,updateMark:Oue})}:{}}createKeymap(){return{Enter:OL(this.type)}}createExtensions(){return[new RL]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!oy(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=yJ(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return PL(e??this.type)}};uo([Se()],hu.prototype,"toggleListItemClosed",1);uo([Se()],hu.prototype,"liftListItemOutOfList",1);hu=uo([ot({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],hu);function Tue(e,t){e.attrs.closed?t.classList.add(wa.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(wa.COLLAPSIBLE_LIST_ITEM_CLOSED)}function Oue(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var ap=class extends co{get name(){return"bulletList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["ul",e.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(e,t,n)=>{var c;const r=document.createElement("div");r.style.position="relative";const o=n(),i=t.state.doc.resolve(o+1),s=i.node(i.depth-1);if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(wa.LIST_SPINE),u.addEventListener("click",d=>{const p=n(),h=t.state.doc.resolve(p+1),m=h.start(h.depth-1),v=Me.create(t.state.doc,m-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(wa.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new hu({priority:ft.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return wk(this.type,jt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[WS(e,this.type),new lo(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),pu({listType:this.type,itemType:jt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};uo([Se({icon:"listUnordered",label:({t:e})=>e(HS.BULLET_LIST_LABEL)})],ap.prototype,"toggleBulletList",1);uo([Vr({shortcut:ie.BulletList,command:"toggleBulletList"})],ap.prototype,"listShortcut",1);ap=uo([ot({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],ap);var lp=class extends co{get name(){return"orderedList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>pi(n)?{...e.parse(n),order:+(n.getAttribute("start")??1)}:{}},...t.parseDOM??[]],toDOM:n=>{const r=e.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new hu({priority:ft.Low})]}toggleOrderedList(){return wk(this.type,jt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[WS(e,this.type,t=>({order:+jt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+jt(t,1)),new lo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!pu({listType:this.type,itemType:jt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+jt(n,1);if(a!==1){const l=ep({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};uo([Se({icon:"listOrdered",label:({t:e})=>e(HS.ORDERED_LIST_LABEL)})],lp.prototype,"toggleOrderedList",1);uo([Vr({shortcut:ie.OrderedList,command:"toggleOrderedList"})],lp.prototype,"listShortcut",1);lp=uo([ot({})],lp);var AL=class extends co{get name(){return"taskListItem"}createTags(){return[He.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return pi(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:ft.Medium},...t.parseDOM??[]],toDOM:n=>["li",{...e.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(e,t,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(wa.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=e.attrs.checked,jL({node:e,mark:r,updateDOM:Mue,updateMark:Pue})}}createKeymap(){return{Enter:OL(this.type)}}createExtensions(){return[new RL]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=ep({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:t??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[WS(e,this.type,t=>({checked:["x","X"].includes(Zd(t,2))})),new lo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!pu({listType:jt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(Zd(n,2));if(a){const l=ep({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};uo([Se()],AL.prototype,"toggleCheckboxChecked",1);function Mue(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function Pue(e,t){t.checked=!!e.attrs.checked}var IL=class extends co{get name(){return"taskList"}createTags(){return[He.Block,He.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:ft.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new AL({})]}toggleTaskList(){return wk(this.type,jt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};uo([Se({icon:"checkboxMultipleLine",label:({t:e})=>e(HS.TASK_LIST_LABEL)})],IL.prototype,"toggleTaskList",1);uo([Vr({shortcut:ie.TaskList,command:"toggleTaskList"})],IL.prototype,"listShortcut",1);function jue(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:p,children:h,...m}=d,v=(p==null?void 0:p[e][l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:h})}function u(d,p){const h=(p==null?void 0:p[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Rue(o,...t)]}function Rue(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var K0="rovingFocusGroup.onEntryFocus",Aue={bubbles:!1,cancelable:!0},hy="RovingFocusGroup",[cw,DL,Iue]=Av(hy),[Due,LL]=jue(hy,[Iue]),[Lue,Fue]=Due(hy),FL=g.forwardRef((e,t)=>f.jsx(cw.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(cw.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(zue,{...e,ref:t})})}));FL.displayName=hy;var zue=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=g.useRef(null),h=Ue(t,p),m=Tp(i),[v=null,b]=ro({prop:s,defaultProp:a,onChange:l}),[x,w]=g.useState(!1),k=Qt(c),C=DL(n),_=g.useRef(!1),[O,T]=g.useState(0);return g.useEffect(()=>{const j=p.current;if(j)return j.addEventListener(K0,k),()=>j.removeEventListener(K0,k)},[k]),f.jsx(Lue,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:v,onItemFocus:g.useCallback(j=>b(j),[b]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>T(j=>j+1),[]),onFocusableItemRemove:g.useCallback(()=>T(j=>j-1),[]),children:f.jsx(Pe.div,{tabIndex:x||O===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:se(e.onMouseDown,()=>{_.current=!0}),onFocus:se(e.onFocus,j=>{const A=!_.current;if(j.target===j.currentTarget&&A&&!x){const D=new CustomEvent(K0,Aue);if(j.currentTarget.dispatchEvent(D),!D.defaultPrevented){const V=C().filter(I=>I.focusable),W=V.find(I=>I.active),J=V.find(I=>I.id===v),U=[W,J,...V].filter(Boolean).map(I=>I.ref.current);$L(U,u)}}_.current=!1}),onBlur:se(e.onBlur,()=>w(!1))})})}),zL="RovingFocusGroupItem",BL=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Zr(),l=i||a,c=Fue(zL,n),u=c.currentTabStopId===l,d=DL(n),{onFocusableItemAdd:p,onFocusableItemRemove:h}=c;return g.useEffect(()=>{if(r)return p(),()=>h()},[r,p,h]),f.jsx(cw.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(Pe.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:se(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:se(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:se(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=Vue(m,c.orientation,c.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let x=d().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")x.reverse();else if(v==="prev"||v==="next"){v==="prev"&&x.reverse();const w=x.indexOf(m.currentTarget);x=c.loop?Uue(x,w+1):x.slice(w+1)}setTimeout(()=>$L(x))}})})})});BL.displayName=zL;var Bue={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $ue(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vue(e,t,n){const r=$ue(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Bue[r]}function $L(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Uue(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hue=FL,Wue=BL,uw=["Enter"," "],Kue=["ArrowDown","PageUp","Home"],VL=["ArrowUp","PageDown","End"],que=[...Kue,...VL],Gue={ltr:[...uw,"ArrowRight"],rtl:[...uw,"ArrowLeft"]},Yue={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Zp="Menu",[cp,Jue,Xue]=Av(Zp),[Fl,UL]=Wo(Zp,[Xue,Ta,LL]),my=Ta(),HL=LL(),[Zue,zl]=Fl(Zp),[Que,Qp]=Fl(Zp),WL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=my(t),[l,c]=g.useState(null),u=g.useRef(!1),d=Qt(i),p=Tp(o);return g.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),f.jsx(Cv,{...a,children:f.jsx(Zue,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(Que,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:p,modal:s,children:r})})})};WL.displayName=Zp;var ede="MenuAnchor",Sk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=my(n);return f.jsx(Pp,{...o,...r,ref:t})});Sk.displayName=ede;var kk="MenuPortal",[tde,KL]=Fl(kk,{forceMount:void 0}),qL=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=zl(kk,t);return f.jsx(tde,{scope:t,forceMount:n,children:f.jsx(On,{present:n||i.open,children:f.jsx(jp,{asChild:!0,container:o,children:r})})})};qL.displayName=kk;var eo="MenuContent",[nde,Ek]=Fl(eo),GL=g.forwardRef((e,t)=>{const n=KL(eo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=zl(eo,e.__scopeMenu),s=Qp(eo,e.__scopeMenu);return f.jsx(cp.Provider,{scope:e.__scopeMenu,children:f.jsx(On,{present:r||i.open,children:f.jsx(cp.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(rde,{...o,ref:t}):f.jsx(ode,{...o,ref:t})})})})}),rde=g.forwardRef((e,t)=>{const n=zl(eo,e.__scopeMenu),r=g.useRef(null),o=Ue(t,r);return g.useEffect(()=>{const i=r.current;if(i)return Tv(i)},[]),f.jsx(Ck,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:se(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ode=g.forwardRef((e,t)=>{const n=zl(eo,e.__scopeMenu);return f.jsx(Ck,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ck=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,onDismiss:h,disableOutsideScroll:m,...v}=e,b=zl(eo,n),x=Qp(eo,n),w=my(n),k=HL(n),C=Jue(n),[_,O]=g.useState(null),T=g.useRef(null),j=Ue(t,T,b.onContentChange),A=g.useRef(0),D=g.useRef(""),V=g.useRef(0),W=g.useRef(null),J=g.useRef("right"),X=g.useRef(0),U=m?Rp:g.Fragment,I=m?{as:Gi,allowPinchZoom:!0}:void 0,R=F=>{var $,Y;const L=D.current+F,B=C().filter(ne=>!ne.disabled),K=document.activeElement,be=($=B.find(ne=>ne.ref.current===K))==null?void 0:$.textValue,ae=B.map(ne=>ne.textValue),le=gde(ae,L,be),re=(Y=B.find(ne=>ne.textValue===le))==null?void 0:Y.ref.current;(function ne(te){D.current=te,window.clearTimeout(A.current),te!==""&&(A.current=window.setTimeout(()=>ne(""),1e3))})(L),re&&setTimeout(()=>re.focus())};g.useEffect(()=>()=>window.clearTimeout(A.current),[]),wv();const M=g.useCallback(F=>{var B,K;return J.current===((B=W.current)==null?void 0:B.side)&&yde(F,(K=W.current)==null?void 0:K.area)},[]);return f.jsx(nde,{scope:n,searchRef:D,onItemEnter:g.useCallback(F=>{M(F)&&F.preventDefault()},[M]),onItemLeave:g.useCallback(F=>{var L;M(F)||((L=T.current)==null||L.focus(),O(null))},[M]),onTriggerLeave:g.useCallback(F=>{M(F)&&F.preventDefault()},[M]),pointerGraceTimerRef:V,onPointerGraceIntentChange:g.useCallback(F=>{W.current=F},[]),children:f.jsx(U,{...I,children:f.jsx(Op,{asChild:!0,trapped:o,onMountAutoFocus:se(i,F=>{var L;F.preventDefault(),(L=T.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(wu,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,onDismiss:h,children:f.jsx(Hue,{asChild:!0,...k,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:O,onEntryFocus:se(l,F=>{x.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(_v,{role:"menu","aria-orientation":"vertical","data-state":u4(b.open),"data-radix-menu-content":"",dir:x.dir,...w,...v,ref:j,style:{outline:"none",...v.style},onKeyDown:se(v.onKeyDown,F=>{const B=F.target.closest("[data-radix-menu-content]")===F.currentTarget,K=F.ctrlKey||F.altKey||F.metaKey,be=F.key.length===1;B&&(F.key==="Tab"&&F.preventDefault(),!K&&be&&R(F.key));const ae=T.current;if(F.target!==ae||!que.includes(F.key))return;F.preventDefault();const re=C().filter($=>!$.disabled).map($=>$.ref.current);VL.includes(F.key)&&re.reverse(),hde(re)}),onBlur:se(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(A.current),D.current="")}),onPointerMove:se(e.onPointerMove,up(F=>{const L=F.target,B=X.current!==F.clientX;if(F.currentTarget.contains(L)&&B){const K=F.clientX>X.current?"right":"left";J.current=K,X.current=F.clientX}}))})})})})})})});GL.displayName=eo;var ide="MenuGroup",_k=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Pe.div,{role:"group",...r,ref:t})});_k.displayName=ide;var sde="MenuLabel",YL=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Pe.div,{...r,ref:t})});YL.displayName=sde;var Hg="MenuItem",iT="menu.itemSelect",gy=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=Qp(Hg,e.__scopeMenu),a=Ek(Hg,e.__scopeMenu),l=Ue(t,i),c=g.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const p=new CustomEvent(iT,{bubbles:!0,cancelable:!0});d.addEventListener(iT,h=>r==null?void 0:r(h),{once:!0}),FP(d,p),p.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(JL,{...o,ref:l,disabled:n,onClick:se(e.onClick,u),onPointerDown:d=>{var p;(p=e.onPointerDown)==null||p.call(e,d),c.current=!0},onPointerUp:se(e.onPointerUp,d=>{var p;c.current||(p=d.currentTarget)==null||p.click()}),onKeyDown:se(e.onKeyDown,d=>{const p=a.searchRef.current!=="";n||p&&d.key===" "||uw.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});gy.displayName=Hg;var JL=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Ek(Hg,n),a=HL(n),l=g.useRef(null),c=Ue(t,l),[u,d]=g.useState(!1),[p,h]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&h((m.textContent??"").trim())},[i.children]),f.jsx(cp.ItemSlot,{scope:n,disabled:r,textValue:o??p,children:f.jsx(Wue,{asChild:!0,...a,focusable:!r,children:f.jsx(Pe.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:se(e.onPointerMove,up(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:se(e.onPointerLeave,up(m=>s.onItemLeave(m))),onFocus:se(e.onFocus,()=>d(!0)),onBlur:se(e.onBlur,()=>d(!1))})})})}),ade="MenuCheckboxItem",XL=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx(n4,{scope:e.__scopeMenu,checked:n,children:f.jsx(gy,{role:"menuitemcheckbox","aria-checked":Wg(n)?"mixed":n,...o,ref:t,"data-state":Tk(n),onSelect:se(o.onSelect,()=>r==null?void 0:r(Wg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});XL.displayName=ade;var ZL="MenuRadioGroup",[lde,cde]=Fl(ZL,{value:void 0,onValueChange:()=>{}}),QL=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Qt(r);return f.jsx(lde,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(_k,{...o,ref:t})})});QL.displayName=ZL;var e4="MenuRadioItem",t4=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=cde(e4,e.__scopeMenu),i=n===o.value;return f.jsx(n4,{scope:e.__scopeMenu,checked:i,children:f.jsx(gy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Tk(i),onSelect:se(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});t4.displayName=e4;var Nk="MenuItemIndicator",[n4,ude]=Fl(Nk,{checked:!1}),r4=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=ude(Nk,n);return f.jsx(On,{present:r||Wg(i.checked)||i.checked===!0,children:f.jsx(Pe.span,{...o,ref:t,"data-state":Tk(i.checked)})})});r4.displayName=Nk;var dde="MenuSeparator",o4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Pe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});o4.displayName=dde;var fde="MenuArrow",i4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=my(n);return f.jsx(Nv,{...o,...r,ref:t})});i4.displayName=fde;var pde="MenuSub",[Hpe,s4]=Fl(pde),Ad="MenuSubTrigger",a4=g.forwardRef((e,t)=>{const n=zl(Ad,e.__scopeMenu),r=Qp(Ad,e.__scopeMenu),o=s4(Ad,e.__scopeMenu),i=Ek(Ad,e.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),f.jsx(Sk,{asChild:!0,...c,children:f.jsx(JL,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":u4(n.open),...e,ref:yv(t,o.onTriggerChange),onClick:d=>{var p;(p=e.onClick)==null||p.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:se(e.onPointerMove,up(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:se(e.onPointerLeave,up(d=>{var h,m;u();const p=(h=n.content)==null?void 0:h.getBoundingClientRect();if(p){const v=(m=n.content)==null?void 0:m.dataset.side,b=v==="right",x=b?-5:5,w=p[b?"left":"right"],k=p[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:w,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x:w,y:p.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:se(e.onKeyDown,d=>{var h;const p=i.searchRef.current!=="";e.disabled||p&&d.key===" "||Gue[r.dir].includes(d.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),d.preventDefault())})})})});a4.displayName=Ad;var l4="MenuSubContent",c4=g.forwardRef((e,t)=>{const n=KL(eo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=zl(eo,e.__scopeMenu),s=Qp(eo,e.__scopeMenu),a=s4(l4,e.__scopeMenu),l=g.useRef(null),c=Ue(t,l);return f.jsx(cp.Provider,{scope:e.__scopeMenu,children:f.jsx(On,{present:r||i.open,children:f.jsx(cp.Slot,{scope:e.__scopeMenu,children:f.jsx(Ck,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:se(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:se(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:se(e.onKeyDown,u=>{var h;const d=u.currentTarget.contains(u.target),p=Yue[s.dir].includes(u.key);d&&p&&(i.onOpenChange(!1),(h=a.trigger)==null||h.focus(),u.preventDefault())})})})})})});c4.displayName=l4;function u4(e){return e?"open":"closed"}function Wg(e){return e==="indeterminate"}function Tk(e){return Wg(e)?"indeterminate":e?"checked":"unchecked"}function hde(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function mde(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function gde(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=mde(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function vde(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function yde(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return vde(n,t)}function up(e){return t=>t.pointerType==="mouse"?e(t):void 0}var xde=WL,bde=Sk,wde=qL,Sde=GL,kde=_k,Ede=YL,Cde=gy,_de=XL,Nde=QL,Tde=t4,Ode=r4,Mde=o4,Pde=i4,jde=a4,Rde=c4,Ok="DropdownMenu",[Ade,Wpe]=Wo(Ok,[UL]),er=UL(),[Ide,d4]=Ade(Ok),f4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=er(t),c=g.useRef(null),[u=!1,d]=ro({prop:o,defaultProp:i,onChange:s});return f.jsx(Ide,{scope:t,triggerId:Zr(),triggerRef:c,contentId:Zr(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(p=>!p),[d]),modal:a,children:f.jsx(xde,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};f4.displayName=Ok;var p4="DropdownMenuTrigger",h4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=d4(p4,n),s=er(n);return f.jsx(bde,{asChild:!0,...s,children:f.jsx(Pe.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:yv(t,i.triggerRef),onPointerDown:se(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:se(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});h4.displayName=p4;var Dde="DropdownMenuPortal",m4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=er(t);return f.jsx(wde,{...r,...n})};m4.displayName=Dde;var g4="DropdownMenuContent",v4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=d4(g4,n),i=er(n),s=g.useRef(!1);return f.jsx(Sde,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:se(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:se(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});v4.displayName=g4;var Lde="DropdownMenuGroup",Fde=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(kde,{...o,...r,ref:t})});Fde.displayName=Lde;var zde="DropdownMenuLabel",y4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Ede,{...o,...r,ref:t})});y4.displayName=zde;var Bde="DropdownMenuItem",x4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Cde,{...o,...r,ref:t})});x4.displayName=Bde;var $de="DropdownMenuCheckboxItem",b4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(_de,{...o,...r,ref:t})});b4.displayName=$de;var Vde="DropdownMenuRadioGroup",Ude=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Nde,{...o,...r,ref:t})});Ude.displayName=Vde;var Hde="DropdownMenuRadioItem",w4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Tde,{...o,...r,ref:t})});w4.displayName=Hde;var Wde="DropdownMenuItemIndicator",S4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Ode,{...o,...r,ref:t})});S4.displayName=Wde;var Kde="DropdownMenuSeparator",k4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Mde,{...o,...r,ref:t})});k4.displayName=Kde;var qde="DropdownMenuArrow",Gde=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Pde,{...o,...r,ref:t})});Gde.displayName=qde;var Yde="DropdownMenuSubTrigger",E4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(jde,{...o,...r,ref:t})});E4.displayName=Yde;var Jde="DropdownMenuSubContent",C4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=er(n);return f.jsx(Rde,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});C4.displayName=Jde;var Xde=f4,Zde=h4,Qde=m4,_4=v4,N4=y4,T4=x4,O4=b4,M4=w4,P4=S4,j4=k4,R4=E4,A4=C4;const efe=Xde,tfe=Zde,nfe=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(R4,{ref:o,className:Ke("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary_alt data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,f.jsx(gv,{className:"w-4 h-4 ml-auto"})]}));nfe.displayName=R4.displayName;const rfe=g.forwardRef(({className:e,...t},n)=>f.jsx(A4,{ref:n,className:Ke("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));rfe.displayName=A4.displayName;const I4=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>f.jsx(Qde,{container:n,children:f.jsx(_4,{ref:o,sideOffset:t,className:Ke("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));I4.displayName=_4.displayName;const Es=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(T4,{ref:r,className:Ke("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-bg-brand-solid focus:text-text-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Es.displayName=T4.displayName;const ofe=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(O4,{ref:o,className:Ke("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(P4,{children:f.jsx(_p,{className:"w-4 h-4"})})}),t]}));ofe.displayName=O4.displayName;const ife=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(M4,{ref:r,className:Ke("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(P4,{children:f.jsx(_V,{className:"w-2 h-2 fill-current"})})}),t]}));ife.displayName=M4.displayName;const sfe=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(N4,{ref:r,className:Ke("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));sfe.displayName=N4.displayName;const afe=g.forwardRef(({className:e,...t},n)=>f.jsx(j4,{ref:n,className:Ke("-mx-1 my-1 h-px bg-muted",e),...t}));afe.displayName=j4.displayName;var lfe=Object.defineProperty,cfe=Object.getOwnPropertyDescriptor,eh=(e,t,n,r)=>{for(var o=r>1?void 0:r?cfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&lfe(t,n,o),o},ufe={icon:"bold",label:({t:e})=>e(F_.LABEL),description:({t:e})=>e(F_.DESCRIPTION)},Pl=class extends Jp{get name(){return"bold"}createTags(){return[He.FormattingMark,He.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>pi(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>Le(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...t.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",e.dom(n),0]}}}createInputRules(){return[Dg({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return np({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=oo(e??t.selection,t.doc);return n==null||n(t.addMark(r,o,this.type.create())),!0}}removeBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=oo(e??t.selection,t.doc);return t.doc.rangeHasMark(r,o,this.type)?(n==null||n(t.removeMark(r,o,this.type)),!0):!1}}shortcut(e){return this.toggleBold()(e)}};eh([Se(ufe)],Pl.prototype,"toggleBold",1);eh([Se()],Pl.prototype,"setBold",1);eh([Se()],Pl.prototype,"removeBold",1);eh([Vr({shortcut:ie.Bold,command:"toggleBold"})],Pl.prototype,"shortcut",1);Pl=eh([ot({defaultOptions:{weight:void 0},staticKeys:["weight"]})],Pl);var dfe=Object.defineProperty,ffe=Object.getOwnPropertyDescriptor,Mk=(e,t,n,r)=>{for(var o=r>1?void 0:r?ffe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&dfe(t,n,o),o},pfe={icon:"italic",label:({t:e})=>e(z_.LABEL),description:({t:e})=>e(z_.DESCRIPTION)},dp=class extends Jp{get name(){return"italic"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"i",getAttrs:e.parse},{tag:"em",getAttrs:e.parse},{style:"font-style=italic"},...t.parseDOM??[]],toDOM:n=>["em",e.dom(n),0]}}createKeymap(){return{"Mod-i":np({type:this.type})}}createInputRules(){return[Dg({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),Dg({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(e){return np({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};Mk([Se(pfe)],dp.prototype,"toggleItalic",1);Mk([Vr({shortcut:ie.Italic,command:"toggleItalic"})],dp.prototype,"shortcut",1);dp=Mk([ot({})],dp);var hfe=Object.defineProperty,mfe=Object.getOwnPropertyDescriptor,Pk=(e,t,n,r)=>{for(var o=r>1?void 0:r?mfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&hfe(t,n,o),o},gfe={icon:"strikethrough",label:({t:e})=>e(B_.LABEL),description:({t:e})=>e(B_.DESCRIPTION)},fp=class extends Jp{get name(){return"strike"}createTags(){return[He.FontStyle,He.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"s",getAttrs:e.parse},{tag:"del",getAttrs:e.parse},{tag:"strike",getAttrs:e.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...t.parseDOM??[]],toDOM:n=>["s",e.dom(n),0]}}toggleStrike(){return np({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[Dg({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};Pk([Se(gfe)],fp.prototype,"toggleStrike",1);Pk([Vr({shortcut:ie.Strike,command:"toggleStrike"})],fp.prototype,"shortcut",1);fp=Pk([ot({})],fp);var vfe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',yfe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',xfe=encodeURIComponent(vfe),bfe=encodeURIComponent(yfe),Vn,pT,wfe=(pT=class{constructor(e){zt(this,"dom");Pn(this,Vn);zt(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,Ze(this,Vn,n),this.type=e,this.createHandle(e)}createHandle(e){switch(An(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),An(me(this,Vn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),me(this,Vn).dataset.dragging="",e){case 0:An(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),An(me(this,Vn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 1:An(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),An(me(this,Vn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 2:An(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),An(me(this,Vn),{width:" 42px",height:"4px",boxSizing:"content-box",maxWidth:"50%",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 3:An(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),An(me(this,Vn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${bfe}") `});break;case 4:An(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),An(me(this,Vn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${xfe}") `});break}this.dom.append(me(this,Vn))}setHandleVisibility(e){const t=e||!!me(this,Vn).dataset.dragging;me(this,Vn).style.opacity=t?"1":"0"}dataSetDragging(e){me(this,Vn).dataset.dragging=e?"true":""}},Vn=new WeakMap,pT),Ih=50,D4=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(D4||{}),As,Is,Ds,Zo,Ls,hT,Sfe=(hT=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){zt(this,"dom");Pn(this,As);Pn(this,Is);Pn(this,Ds,[]);zt(this,"aspectRatio");Pn(this,Zo);Pn(this,Ls);const s=this.createWrapper(e,i),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(p=>new wfe(p));for(const p of c){const h=m=>{this.startResizing(m,t,n,p)};p.dom.addEventListener("mousedown",h),me(this,Ds).push(()=>p.dom.removeEventListener("mousedown",h)),s.append(p.dom)}const u=()=>{c.forEach(p=>p.setHandleVisibility(!0))},d=()=>{c.forEach(p=>p.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),me(this,Ds).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,Ze(this,Is,e),Ze(this,As,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?An(n,{width:sT(t.width),aspectRatio:`${t.width} / ${t.height}`}):An(n,{width:sT(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),An(n,{maxWidth:"100%",minWidth:`${Ih}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(e,t,n,r){var u,d;e.preventDefault(),r.dataSetDragging(!0),me(this,As).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=me(this,As))==null?void 0:u.getBoundingClientRect().width)||0,a=((d=me(this,As))==null?void 0:d.getBoundingClientRect().height)||0,l=_b(100,!1,p=>{const h=p.pageX,m=p.pageY,v=h-o,b=m-i;let x=null,w=null;if(this.aspectRatio===0&&s&&a)switch(r.type){case 0:case 3:x=s+v,w=a/s*x;break;case 1:case 4:x=s-v,w=a/s*x;break;case 2:w=a+b,x=s/a*w;break}else if(this.aspectRatio===1)switch(r.type){case 0:x=s+v;break;case 1:x=s-v;break;case 2:w=a+b;break;case 3:x=s+v,w=a+b;break;case 4:x=s-v,w=a+b;break}typeof x=="number"&&x<Ih&&(this.aspectRatio===0&&s&&a?(x=Ih,w=a/s*x):this.aspectRatio===1&&(x=Ih)),x&&(Ze(this,Zo,Math.round(x)),this.dom.style.width=`${me(this,Zo)}px`),w&&Ze(this,Ls,Math.round(w)),(x||w)&&(this.dom.style.aspectRatio=`${me(this,Zo)} / ${me(this,Ls)}`)}),c=p=>{p.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),me(this,As).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const h=n(),m=t.state.tr.setNodeMarkup(h,void 0,{...me(this,Is).attrs,width:me(this,Zo),height:me(this,Ls)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),me(this,Ds).push(()=>document.removeEventListener("mousemove",l)),me(this,Ds).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==me(this,Is).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==me(this,Zo)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==me(this,Zo)&&e.attrs.height!==me(this,Ls)||!kfe(me(this,Is),e,["width","height"])?!1:(Ze(this,Is,e),Ze(this,Zo,e.attrs.width),Ze(this,Ls,e.attrs.height),!0)}destroy(){me(this,Ds).forEach(e=>e())}},As=new WeakMap,Is=new WeakMap,Ds=new WeakMap,Zo=new WeakMap,Ls=new WeakMap,hT);function kfe(e,t,n){return e===t||Efe(e,t,n)&&e.content.eq(t.content)}function Efe(e,t,n){const r=e.attrs,o=t.attrs,i={};for(const a of n)i[a]=null;e.attrs={...r,...i},t.attrs={...o,...i};const s=e.sameMarkup(t);return e.attrs=r,t.attrs=o,s}function sT(e){return typeof e=="number"?`${e}px`:e||void 0}var Cfe=Object.defineProperty,_fe=Object.getOwnPropertyDescriptor,jk=(e,t,n,r)=>{for(var o=r>1?void 0:r?_fe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Cfe(t,n,o),o},Nfe=class extends Sfe{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:D4.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),An(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},pp=class extends co{get name(){return"image"}createTags(){return[He.InlineNode,He.Media]}createNodeSpec(e,t){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...t,attrs:{...e.defaults(),alt:{default:""},crop:{default:null},height:{default:null},width:{default:null},rotate:{default:null},src:{default:null},title:{default:""},fileName:{default:null},resizable:{default:!1}},parseDOM:[{tag:"img[src]",getAttrs:r=>{var o;if(pi(r)){const i=Ofe({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=ID(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=oo(t??n.selection,n.doc),s=this.type.create(e);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return i=>{const{tr:s}=i;let a=s.selection.from;return this.store.createPlaceholderCommand({promise:e,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return t==null||t(u),u},onUpdate:(l,c,u,d)=>{n(l,c,u,d)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=MI(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&jfe(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:i,chain:s}=this.store,a=e.map((u,d)=>({file:u,progress:p=>{i.updatePlaceholder(l[d],p)}})),l=o(a);Dr(n)&&s.selectText(n);for(const u of l)s.uploadImage(u);return s.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:e=>{const t=e.type==="drop"?e.pos:void 0;return this.fileUploadFileHandler(e.files,e.event,t)}}]}createNodeViews(){return this.options.enableResizing?(e,t,n)=>new Nfe(e,t,n):{}}};jk([Se()],pp.prototype,"insertImage",1);jk([Se()],pp.prototype,"uploadImage",1);pp=jk([ot({defaultOptions:{createPlaceholder:Mfe,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:Pfe,enableResizing:!1,preferPastedTextContent:!0}})],pp);function Tfe(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function Ofe({element:e,parse:t}){const{width:n,height:r}=Tfe(e);return{...t(e),alt:e.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:e.getAttribute("src")??null,title:e.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:e.getAttribute("data-file-name")??null}}function Mfe(e,t){const n=document.createElement("div");return n.classList.add(Zle.IMAGE_LOADER),n}function Pfe(e){Te(e.length>0,{code:oe.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let t=0;const n=[];for(const{file:r,progress:o}of e)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;t+=1,o(t/e.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function jfe(e){return e.clipboardData!==void 0}function Rfe(e={}){return new rs({view(t){return new Afe(t,e)}})}class Afe{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r;if(n){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=PI(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}var Ife=Object.defineProperty,Dfe=Object.getOwnPropertyDescriptor,Lfe=(e,t,n,r)=>{for(var o=r>1?void 0:r?Dfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ife(t,n,o),o},dw=class extends Tt{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[Rfe({color:e,width:t})]}};dw=Lfe([ot({defaultOptions:{color:"black",width:1}})],dw);var Ffe=Object.defineProperty,zfe=Object.getOwnPropertyDescriptor,L4=(e,t,n,r)=>{for(var o=r>1?void 0:r?zfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ffe(t,n,o),o},{LABEL:Bfe}=VX,$fe={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...Bfe,values:{level:t==null?void 0:t.level}})},Vfe=[ie.H1,ie.H2,ie.H3,ie.H4,ie.H5,ie.H6],Kg=class extends co{get name(){return"heading"}createTags(){return[He.Block,He.TextBlock,He.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...e.parse(r),level:n})})),...t.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,e.dom(n),0]:[`h${this.options.defaultLevel}`,e.dom(n),0]}}toggleHeading(e={}){return FD({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Ye),n=Ce(),r=[];for(const o of this.options.levels){const i=Vfe[o-1]??ie.H1;n[i]=Ig(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(i)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>lZ(new RegExp(`^(#{1,${e}})\\s$`),this.type,()=>({level:e})))}createPasteRules(){return this.options.levels.map(e=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${e}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:e}),startOfTextBlock:!0}))}};L4([Se($fe)],Kg.prototype,"toggleHeading",1);Kg=L4([ot({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],Kg);var F4={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:t3,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,d=0,p=0,h=c.length,m=0;h--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){p=m+1;break}return 2>p?"":c.slice(p,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,p=0;for(d=c.length;p<d;p++)u.push(s(c[p]));return u}i()}}])})})(F4);var Ufe=F4.exports;const Hfe=ka(Ufe);var Wfe=Object.defineProperty,Kfe=Object.getOwnPropertyDescriptor,th=(e,t,n,r)=>{for(var o=r>1?void 0:r?Kfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Wfe(t,n,o),o},qfe=["com","de","net","org","uk","cn","ga","nl","cf","ml","tk","ru","br","gq","xyz","fr","eu","info","co","au","ca","it","in","ch","pl","es","online","us","top","be","jp","biz","se","at","dk","cz","za","me","ir","icu","shop","kr","site","mx","hu","io","cc","club","no","cyou"],aT="updateLink",Gfe=/(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)*(?:(?:\d(?!\.)|[a-z\u00A1-\uFFFF])(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)+[a-z\u00A1-\uFFFF]{2,}(?::\d{2,5})?(?:[#/?]\S*)?/gi,jl=class extends Jp{constructor(){super(...arguments);zt(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[He.Link,He.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=i=>{const{defaultTarget:s,supportedTargets:a}=this.options,l=s?[...a,s]:a;return i&&Vo(l,i)?{target:i}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:i=>{if(!pi(i))return!1;const s=i.getAttribute("href"),a=i.textContent,l=this.options.autoLink&&(i.hasAttribute(r)||s===a||(s==null?void 0:s.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(i),href:s,auto:l,...o(i.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:i=>{const{auto:s,target:a,...l}=ID(i.attrs,t),c=i.attrs.auto?{[r]:""}:{};return["a",{...t.dom(i),...l,rel:"noopener noreferrer nofollow",...c,...o(i.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let n="",{from:r,to:o,empty:i,$from:s}=t.selection,a=!1;const l=Qi(s,this.type);if(i){const c=l??jD(t);if(!c)return!1;({text:n,from:r,to:o}=c),a=!0}return r===o?!1:(a||(n=t.doc.textBetween(r,o)),this.options.onActivateLink(n),this.options.onShortcut({activeLink:l?{attrs:l.mark.attrs,from:l.from,to:l.to}:void 0,selectedText:n,from:r,to:o}),!0)}updateLink(t,n){return r=>{const{tr:o}=r;return!(Dl(o.selection)&&!rk(o.selection)||Oee(o.selection)||Ag({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:aT,attrs:t,range:n}),Yee({type:this.type,attrs:t,range:n})(r))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return n=>{const{tr:r}=n;return Ag({trState:r,type:this.type,...t})?BD({type:this.type,expand:!0,range:t})(n):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,n)=>({href:this.buildHref(Zd(t)),auto:!n}),transformMatch:t=>{const n=Zd(t);return!n||!this.isValidUrl(n)?!1:n}}]}createEventHandlers(){return{clickMark:(t,n)=>{const r=n.getMark(this.type);if(!r)return;const o=r.mark.attrs,i={...o,...r};if(this.options.onClick(t,i))return!0;if(!this.store.view.editable)return;let s=!1;if(this.options.openLinkOnClick){s=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(s=!0,this.store.commands.selectText(r)),s}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(m=>!!m.getMeta(this.name)).forEach(m=>{const v=m.getMeta(this.name);if(v.command===aT){const{range:b,attrs:x}=v,{selection:w,doc:k}=r,C={range:b,selection:w,doc:k,attrs:x},{from:_,to:O}=b??w;this.options.onUpdateLink(k.textBetween(_,O),C)}}),!this.options.autoLink||iw(n)-iw(r)===1||!t.some(m=>m.docChanged))return;const a=gee(t,n),l=Aee(a,[Ut,fn]),{mapping:c}=a,{tr:u,doc:d}=r,{updateLink:p,removeLink:h}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:b,to:x})=>{const w=[],k=x-b===2,C=this.getLinkMarksInRange(n.doc,m,v,!0).filter(_=>_.mark.type===this.type).map(({from:_,to:O,text:T})=>({mappedFrom:c.map(_),mappedTo:c.map(O),text:T,from:_,to:O}));C.forEach(({mappedFrom:_,mappedTo:O,from:T,to:j},A)=>this.getLinkMarksInRange(d,_,O,!0).filter(D=>D.mark.type===this.type).forEach(D=>{const V=n.doc.textBetween(T,j,void 0," "),W=d.textBetween(D.from,D.to+1,void 0," ").trim(),J=this.isValidUrl(V);this.isValidUrl(W)||(J&&(h({from:D.from,to:D.to}).tr(),C.splice(A,1)),!k&&b===x&&this.findAutoLinks(W).map(U=>this.addLinkProperties({...U,from:_+U.start,to:_+U.end})).forEach(({attrs:U,range:I,text:R})=>{p(U,I).tr(),w.push({attrs:U,range:I,text:R})}))})),this.findTextBlocksInRange(d,{from:b,to:x}).forEach(({text:_,positionStart:O})=>{this.findAutoLinks(_).map(T=>this.addLinkProperties({...T,from:O+T.start+1,to:O+T.end+1})).filter(({range:T})=>{const j=b>=T.from&&b<=T.to,A=x>=T.from&&x<=T.to;return j||A||k}).filter(({range:T})=>this.getLinkMarksInRange(u.doc,T.from,T.to,!1).length===0).filter(({range:{from:T},text:j})=>!C.some(({text:A,mappedFrom:D})=>D===T&&A===j)).forEach(({attrs:T,text:j,range:A})=>{p(T,A).tr(),w.push({attrs:T,range:A,text:j})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:_,range:O,text:T})=>{const{doc:j,selection:A}=u;this.options.onUpdateLink(T,{attrs:_,doc:j,range:O,selection:A})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const i=[];if(n===r){const s=Math.max(n-1,0),a=t.resolve(s),l=Qi(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&i.push(l)}else t.nodesBetween(n,r,(s,a)=>{const c=(s.marks??[]).find(({type:u,attrs:d})=>u===this.type&&d.auto===o);c&&i.push({from:a,to:a+s.nodeSize,mark:c,text:s.textContent})});return i}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,i)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:i})}),r.map(o=>({text:t.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," "),positionStart:o.pos}))}addLinkProperties({from:t,to:n,href:r,...o}){return{...o,range:{from:t,to:n},attrs:{href:r,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const n=[];for(const r of Xv(t,this.options.autoLinkRegex)){const o=Zd(r);if(!o)continue;const i=this.buildHref(o);!this.isValidTLD(i)&&!i.startsWith("tel:")||n.push({text:o,href:i,start:r.index,end:r.index+o.length})}return n}isValidUrl(t){var n;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((n=this._autoLinkRegexNonGlobal)!=null&&n.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:n}=this.options;if(n.length===0)return!0;const r=Hfe(t);if(r==="")return!0;const o=NJ(r.split("."));return n.includes(o)}};th([Vr({shortcut:ie.InsertLink})],jl.prototype,"shortcut",1);th([Se()],jl.prototype,"updateLink",1);th([Se()],jl.prototype,"selectLink",1);th([Se()],jl.prototype,"removeLink",1);jl=th([ot({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:Gfe,autoLinkAllowedTLDs:qfe,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:Yfe},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:ft.Medium})],jl);function Yfe({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var Jfe=Object.defineProperty,Xfe=Object.getOwnPropertyDescriptor,z4=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Jfe(t,n,o),o},qg=class extends co{get name(){return"hardBreak"}createTags(){return[He.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
431
- `,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=mee(Xd(WD),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};z4([Se()],qg.prototype,"insertHardBreak",1);qg=z4([ot({defaultPriority:ft.Low})],qg);const Zfe=()=>[new Pl({}),new dp,new fp,new pp({enableResizing:!1}),new dw({}),new Kg({levels:[1,2,3,4,5,6],defaultLevel:1}),new ap({}),new lp,new jl({autoLink:!0}),new qg].slice();function Qfe(e){const{manager:t,state:n,setState:r}=tue({extensions:Zfe,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function epe({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,autoFocus:a}){const l=r&&Object.entries(r).some(([,p])=>p),[c,u]=g.useState(l),d=g.useMemo(()=>[Ne("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[c]);return f.jsx("div",{autoFocus:a,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:Ne("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:f.jsxs(rue,{manager:n,initialContent:e,state:t,classNames:d,onChange:o,children:[f.jsx(tpe,{hasOptions:l,options:r,debug:s,setShowToolbar:u}),f.jsx(aw,{})]})})}const tpe=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,p,h,m,v,b,x,w,k,C,_,O,T,j,A,D,V,W,J,X,U,I,R,M,F;const o=NL(),i=Wce(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return f.jsxs("div",{children:[f.jsx("div",{className:"h-0",ref:a}),f.jsxs("div",{className:Ne("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((d=e==null?void 0:e.block)==null?void 0:d.h4)||((p=e==null?void 0:e.block)==null?void 0:p.h5)||((h=e==null?void 0:e.block)==null?void 0:h.h6)||i.heading())&&f.jsxs(efe,{children:[f.jsx(tfe,{asChild:!0,className:"pr-4",children:f.jsxs("button",{children:[i.heading({level:1})&&f.jsx(uC,{size:22}),i.heading({level:2})&&f.jsx(dC,{size:22}),i.heading({level:3})&&f.jsx(fC,{size:22}),i.heading({level:4})&&f.jsx(pC,{size:22}),i.heading({level:5})&&f.jsx(hC,{size:22}),i.heading({level:6})&&f.jsx(mC,{size:22}),!i.heading()&&"Normal"]})}),f.jsxs(I4,{container:a.current,children:[f.jsx(Es,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&f.jsx(Es,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:f.jsx(uC,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&f.jsx(Es,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:f.jsx(dC,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h3)&&f.jsx(Es,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:f.jsx(fC,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h4)&&f.jsx(Es,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:f.jsx(pC,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&f.jsx(Es,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:f.jsx(hC,{size:16})}),((k=e==null?void 0:e.block)==null?void 0:k.h6)&&f.jsx(Es,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:f.jsx(mC,{size:16})})]})]}),(((C=e==null?void 0:e.style)==null?void 0:C.bold)||i.bold())&&f.jsx(Zl,{icon:f.jsx(SV,{size:18}),stroke:3,isOption:(_=e==null?void 0:e.style)==null?void 0:_.bold,isActive:((O=e==null?void 0:e.style)==null?void 0:O.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((T=e==null?void 0:e.style)==null?void 0:T.lineThrough)||i.strike())&&f.jsx(Zl,{icon:f.jsx(HV,{size:18}),stroke:3,isOption:(j=e==null?void 0:e.style)==null?void 0:j.lineThrough,isActive:((A=e==null?void 0:e.style)==null?void 0:A.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((D=e==null?void 0:e.style)==null?void 0:D.italic)||i.italic())&&f.jsx(Zl,{icon:f.jsx(MV,{size:18}),stroke:3,isOption:(V=e==null?void 0:e.style)==null?void 0:V.italic,isActive:((W=e==null?void 0:e.style)==null?void 0:W.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((J=e==null?void 0:e.block)==null?void 0:J.ul)||i.bulletList())&&f.jsx(Zl,{icon:f.jsx(RV,{size:18}),stroke:3,isActive:((X=e==null?void 0:e.block)==null?void 0:X.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((U=e==null?void 0:e.block)==null?void 0:U.ol)||i.orderedList())&&f.jsx(Zl,{icon:f.jsx(jV,{size:18}),stroke:3,isActive:((I=e==null?void 0:e.block)==null?void 0:I.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((R=e==null?void 0:e.inline)==null?void 0:R.a)||i.link())&&f.jsx(Zl,{icon:f.jsx(PV,{size:18}),stroke:3,isActive:((M=e==null?void 0:e.inline)==null?void 0:M.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((F=e==null?void 0:e.inline)==null?void 0:F.img)||i.image())&&f.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[f.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:L=>{z2(L).then(B=>{o.insertImage({src:B.src,width:B.width,height:B.height,fileName:de.createFilename(B.src,B.filename??null,{width:B.width,height:B.height,mimeType:B.mimeType},B.fileHash)??void 0}).focus().run()})}}),f.jsx(OV,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&f.jsx("button",{onMouseDown:L=>L.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),f.jsx(npe,{})]})]})};function npe(){const e=NL(),[t,n]=g.useState(),r=Kce().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?f.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[f.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),f.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:f.jsx(_p,{size:14})}),f.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:f.jsx(YV,{size:13})})]}):null}function Zl({stroke:e,isActive:t,onToggle:n,icon:r}){return f.jsx("button",{className:Ne({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function rpe({path:e,autoFocus:t}){var v,b;const n="richtext",r=Ep(),o=Lt(e),i=st(e,n),s=N1(),a=T1(),l="data"in i?i.data:void 0,{state:c,manager:u}=Qfe(l&&U7(l)),{patchPath:d,addDebouncedPatch:p}=Tn(e);if(o.status==="error")return f.jsx(qt,{path:e,error:o.error,type:n});if(i.status==="error")return f.jsx(rt,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return f.jsx(Cn,{path:e,type:n});if(o.status==="loading")return f.jsx(ht,{path:e,type:n});if(!("data"in i)||i.data===void 0)return f.jsx(ht,{path:e,type:n});if(o.data.type!==n)return f.jsx(mr,{path:e,expectedType:n,actualType:o.data.type});const h=o.data,m=typeof((b=(v=h.options)==null?void 0:v.inline)==null?void 0:b.img)=="object"&&h.options.inline.img.remote&&s.status==="ready"&&(r!=null&&r.remoteHost)&&a?{publicProjectId:s.publicProjectId,bucket:a,coreVersion:s.coreVersion,schema:h.options.inline.img,remoteHost:r==null?void 0:r.remoteHost}:null;return r!=null&&r.remoteHost||console.warn("RichTextField: config.remoteHost is not set. Remote images will not work."),f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx(epe,{autoFocus:t,initialContent:c,options:h.options,manager:u,onChange:x=>{x.state.doc.eq(c.doc)||p(()=>{var w;return ope(d,((w=r==null?void 0:r.files)==null?void 0:w.directory)??"/public/val",x.state.doc.toJSON(),m)},e)}})]})}function ope(e,t,n,r){const{blocks:o,files:i}=n?R7(n,t,r):{blocks:[],files:{}};return[{op:"replace",path:e,value:o},...Object.entries(i).flatMap(([s,{value:a,patchPaths:l}])=>l.map(c=>({op:"file",path:e,filePath:s,value:a,nestedFilePath:c,remote:!!r})))]}function ipe({path:e}){const t=st(e,"richtext");if(t.status==="error")return f.jsx(rt,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return f.jsx(Cn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return f.jsx(fr,{path:e});if(t.data===null)return f.jsx(pr,{path:e});const n=spe(t.data);return n.status==="error"?f.jsx(rt,{path:e,error:n.error,type:"richtext"}):f.jsx("div",{className:"truncate",children:n.value})}function spe(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function Rk({path:e}){const t=Lt(e),n=st(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return f.jsx(fr,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return f.jsx(pr,{path:e});if(r==="string")return f.jsx(NG,{path:e});if(r==="array")return f.jsx(dpe,{path:e});if(r==="boolean")return f.jsx(MG,{path:e});if(r==="number")return f.jsx(jG,{path:e});if(r==="union")return f.jsx(CY,{path:e});if(r==="object")return f.jsx(bY,{path:e});if(r==="image")return f.jsx(RY,{path:e});if(r==="keyOf")return f.jsx(DY,{path:e});if(r==="date")return f.jsx(FY,{path:e});if(r==="literal")return f.jsx(zY,{path:e});if(r==="record")return f.jsx($Y,{path:e});if(r==="richtext")return f.jsx(ipe,{path:e});if(r==="file")return f.jsx(MY,{path:e});{const o=r;return f.jsxs("div",{children:["Cannot preview: ",o]})}}function fr({path:e}){return f.jsx("div",{children:f.jsx(xu,{size:12,className:"animate-spin"})},e+"-loading")}function pr({path:e}){return f.jsx("div",{className:"text-text-quartenary",children:"null"},e+"-null")}function ape({source:e,path:t,schema:n,onClick:r,onMove:o,onDelete:i}){const[s,a]=g.useState([]);g.useEffect(()=>{const u=[];let d=1;for(const p of e)u.push({path:p,id:d}),d++;a(u)},[e,t]);const l=nq(w0(VA),w0(UA),w0(NS,{coordinateGetter:CG})),c=g.useCallback(u=>{const{active:d,over:p}=u;if((d==null?void 0:d.id)!==(p==null?void 0:p.id)){const h=s.findIndex(v=>v.id===Number(d==null?void 0:d.id)),m=s.findIndex(v=>v.id===Number(p==null?void 0:p.id));a(v=>OS(v,h,m)),o(h,m)}},[s]);return f.jsx(nG,{sensors:l,collisionDetection:oq,onDragEnd:c,children:f.jsx(mG,{items:s,strategy:pG,children:f.jsx("div",{className:"grid grid-cols-[min-content,min-content,1fr,min-content] gap-4",children:s.map(({path:u,id:d})=>f.jsx(lpe,{id:d,schema:n,path:u,onClick:r,onDelete:p=>{i(p-1)}},d))})})})}const lT=170;function lpe({id:e,path:t,schema:n,disabled:r,onClick:o,onDelete:i}){var b,x;const s=g.useRef(null),[a,l]=g.useState(!1);g.useEffect(()=>{s.current&&(s.current.getBoundingClientRect().height>=lT?l(!0):l(!1))},[e,t]);const{attributes:c,listeners:u,setNodeRef:d,transform:p,transition:h}=SG({id:e,disabled:r===!0}),{validationErrors:m}=mi(),v={transform:Hf.Transform.toString(p),transition:h};return f.jsxs("div",{"touch-action":"manipulation",ref:d,style:v,className:"grid items-start col-span-4 gap-2 grid-cols-subgrid disabled:opacity-55",children:[f.jsx("button",{...c,...u,className:Ne("pt-2 my-1",{"opacity-30":r}),disabled:r,onClick:()=>{o(t)},children:f.jsx(TV,{})}),f.jsx("button",{className:"pt-2 my-1 font-serif text-accent",disabled:r,onClick:()=>{o(t)},children:cpe(e)}),((b=n==null?void 0:n.item)==null?void 0:b.type)==="string"&&f.jsx(QA,{path:t}),((x=n==null?void 0:n.item)==null?void 0:x.type)!=="string"&&f.jsxs("button",{className:"relative grid p-4 overflow-hidden text-left border rounded border-border bg-card gap-y-2 grid-cols-subgrid cols-span-1",style:{maxHeight:lT},ref:s,disabled:r,onClick:()=>{o(t)},children:[f.jsx(Rk,{path:t}),a&&f.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),f.jsxs("button",{className:"flex items-center pt-4 gap-x-2",onClick:()=>{i(e)},children:[V2(t,m)?f.jsx(U2,{}):f.jsx("div",{className:"w-2 h-2"}),f.jsx(KV,{className:"w-4 h-4 mr-2"})]})]})}function cpe(e){return"#"+(e-1).toString()}function upe({path:e}){const t="array",{navigate:n}=hr(),r=Lt(e),o=st(e,t),{addPatch:i,patchPath:s}=Tn(e);if(r.status==="error")return f.jsx(qt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(rt,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(Cn,{path:e,type:t});if(r.status==="loading")return f.jsx(ht,{path:e,type:t});if(r.data.type!=="array")return f.jsx(mr,{path:e,expectedType:"array",actualType:r.data.type});const a=r.data;return f.jsxs("div",{children:[f.jsx(Ir,{path:e}),f.jsx(ape,{path:e,onClick:l=>{n(l)},onDelete:async l=>{i([{op:"remove",path:s.concat(l.toString())}])},onMove:async(l,c)=>{i([{op:"move",from:s.concat(l.toString()),path:s.concat(c.toString())}])},schema:a,source:o.data||[]})]})}function dpe({path:e}){const t=st(e,"array");return t.status==="error"?f.jsx(rt,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?f.jsx(fr,{path:e}):t.data===null?f.jsx(pr,{path:e}):f.jsx("div",{children:`${t.data.length} items`})}function vy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return f.jsx(QA,{path:e,autoFocus:n},e);if(t.type==="number")return f.jsx(PG,{path:e},e);if(t.type==="boolean")return f.jsx(TG,{path:e},e);if(t.type==="image")return f.jsx(PY,{path:e},e);if(t.type==="object")return f.jsx(xY,{path:e},e);if(t.type==="array")return f.jsx(upe,{path:e},e);if(t.type==="record")return f.jsx(BY,{path:e},e);if(t.type==="union")return f.jsx(SY,{path:e},e);if(t.type==="keyOf")return f.jsx(AY,{path:e},e);if(t.type==="richtext")return f.jsx(rpe,{path:e,autoFocus:n},e);if(t.type==="date")return f.jsx(LY,{path:e},e);if(t.type==="file")return f.jsx(OY,{path:e},e);if(t.type==="literal")return f.jsx(qt,{path:e,error:"Literal fields are not editable"});{const r=t;return f.jsx(qt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function fpe({path:e}){const t=Lt(e),{path:n,schema:r}=j2(e),{navigate:o}=hr();if(t.status==="error")return f.jsx(qt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return f.jsx(ht,{path:e,type:"module"});if(t.status==="not-found")return f.jsx(Cn,{path:e,type:"module"});const i=t.data,s=I2(e),a=s.slice(0,-1),l=s[s.length-1],c=cY(e,n,r);return f.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[f.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[s.length>1&&f.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:a.map((u,d)=>d<a.length-1?f.jsxs(g.Fragment,{children:[f.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text}),f.jsx("span",{children:f.jsx(gv,{size:16})})]},d):f.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text},d))}),f.jsx("div",{children:f.jsxs("div",{className:"flex items-center justify-between h-6 gap-4 text-xl",children:[!c&&f.jsx("span",{children:l.text}),c&&f.jsxs("span",{children:["#",Number(l.text)]}),f.jsx(A2,{path:e,variant:"module"})]})})]}),f.jsx(vy,{path:e,schema:i},e)]})}function ppe(){const e=lV();return f.jsxs(f.Fragment,{children:[f.jsx(hpe,{}),f.jsx(Ya,{viewportId:"val-content-area",children:f.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?f.jsxs("div",{className:"p-8 mt-20 text-center text-text-error-primary bg-bg-error-primary",children:[f.jsx("p",{children:"Could not connect to the content service."}),f.jsx("p",{children:"Please try again later"})]}):f.jsx(mpe,{})})})]})}function hpe(){const{navMenu:e,toolsMenu:t}=yy();return f.jsxs("div",{className:"flex items-center justify-between w-full h-16 px-4 border-b border-border-primary",children:[f.jsx("button",{className:Ne({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:f.jsx(eg,{size:16,className:Ne("transform",{"rotate-180":!e.isOpen})})}),f.jsx("button",{className:Ne({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:f.jsx(eg,{size:16,className:Ne("transform",{"rotate-180":t.isOpen})})})]})}function mpe(){const{currentSourcePath:e}=hr(),t=e;return f.jsx(fpe,{path:t})}function gpe(){const e=so();return f.jsx(OR,{open:!0,modal:!0,children:f.jsxs(cS,{container:e,"aria-label":"Login required",className:"bg-bg-primary text-text-primary",children:[f.jsx(PR,{children:f.jsx(aS,{children:f.jsx("span",{children:"Log in required"})})}),f.jsx(jR,{children:"You need to log in to access Val."}),f.jsx(nn,{asChild:!0,children:f.jsx("a",{href:ug("/api/val/authorize",{redirect_to:window.origin+ug("/val")}),children:"Log in"})})]})})}function vpe(){const{theme:e}=hv(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=hr();return g.useEffect(()=>{!t&&l&&(window.innerWidth<Xj?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),SP()==="login-required"?f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(gpe,{})}):f.jsx(B4.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:i,setOpen:s}},children:f.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:Ne("font-sans bg-bg-primary text-text-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&i,"xl:grid-cols-[320px,1fr]":r&&!i,"xl:grid-cols-[1fr,320px]":!r&&i}),...e?{"data-mode":e}:{},children:[f.jsx("div",{className:Ne({hidden:!r,"w-[min(320px,100vw)] border-r overflow-x-hidden border-border-primary fixed top-0 left-0 xl:relative xl:left-auto z-[41]":r}),children:f.jsx(NW,{})}),f.jsx("div",{children:f.jsx(ppe,{})}),f.jsx("div",{className:Ne({hidden:!i,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":i}),children:f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(FK,{})})})]})})}const B4=_e.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function yy(){return g.useContext(B4)}const ype=({client:e})=>f.jsx(wP,{client:e,dispatchValEvents:!1,children:f.jsx(vpe,{})}),xpe=g.createContext(null),q0={didCatch:!1,error:null};class $4 extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=q0}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState(q0)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&bpe(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(q0)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(xpe.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function bpe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const wpe=({className:e})=>f.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[f.jsx("g",{filter:"url(#filter0_d_21_1677)",children:f.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),f.jsx("g",{filter:"url(#filter1_i_21_1677)",children:f.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),f.jsxs("defs",{children:[f.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),f.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function V4({error:e,resetErrorBoundary:t}){return console.error(e),f.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-bg-primary text-text-primary",children:f.jsx("div",{className:"w-full h-full p-10",children:f.jsxs("div",{className:"w-full h-full p-10 overflow-scroll bg-card text-primary",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[f.jsx(wpe,{})," encountered an error"]}),f.jsx("button",{onClick:t,children:f.jsx(Af,{})})]}),f.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),f.jsx("pre",{children:e.message}),e.stack&&f.jsx(fb,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:f.jsxs(zf,{value:"error",children:[f.jsx(Bf,{children:"Stack trace:"}),f.jsx($f,{className:"p-4 bg-bg-secondary",children:e.stack&&f.jsx("pre",{children:e.stack})})]})})]})})})}function Spe({root:e,children:t}){return Or.createPortal(t,e)}const U4=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),f.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&f.jsx(Spe,{root:r,children:e})})},H4="/spa/index.css",kpe="val-app",Epe="val-overlay";function W4(){return f.jsxs(f.Fragment,{children:[f.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),f.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),f.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function Cpe(){const{client:e}=g.useMemo(()=>({client:cA("/api/val")}),[]);return f.jsxs(f.Fragment,{children:[f.jsx(W4,{}),f.jsxs(U4,{children:[f.jsx("link",{rel:"stylesheet",href:`/api/val/static${H4}`}),f.jsx($4,{fallbackRender:V4,children:f.jsx(LP,{children:f.jsx(ype,{client:e})})})]})]})}function _pe(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const v=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),g.useEffect(()=>{if(t==="select"){let v;const b=()=>{const x=[];document.querySelectorAll("[data-val-path]").forEach(w=>{const k=w.getAttribute("data-val-path");if(!k)return;const C=w.getBoundingClientRect();x.push({top:C.top,left:C.left,width:C.width,height:C.height,joinedPaths:k})}),o(x),v=setTimeout(b,1e3)};return b(),()=>{clearTimeout(v)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const v=b=>{b.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=hv(),[u,d]=g.useState(null),p=Ep(),h="val-menu-right-center";g.useEffect(()=>{try{const v=p&&localStorage.getItem("val-menu-drop-zone-"+((p==null?void 0:p.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(v)if(v==="val-menu-left-top"||v==="val-menu-left-center"||v==="val-menu-left-bottom"||v==="val-menu-center-top"||v==="val-menu-center-bottom"||v==="val-menu-right-top"||v==="val-menu-right-center"||v==="val-menu-right-bottom")d(v);else throw new Error("Invalid drop zone: "+v);else d(h)}catch(v){console.error("Error getting drop zone from local storage",v),d(h)}},[(p==null?void 0:p.project)||"unknown"]);const m=v=>{d(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((p==null?void 0:p.project)||"unknown"),v),localStorage.setItem("val-menu-drop-zone-default",v))}catch(b){console.error("Error setting drop zone to local storage",b)}};return f.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[f.jsx(Npe,{editMode:a,setMode:n,setEditMode:l}),r.map((v,b)=>f.jsx("div",{className:"absolute top-0 border border-bg-brand-primary z-[8998] hover:border-2 rounded",onClickCapture:x=>{x.stopPropagation(),n(null),l({joinedPaths:v.joinedPaths,clientY:x.clientY,clientX:x.clientX,boundingBox:v})},style:{display:"block",top:(v==null?void 0:v.top)+i.y,left:(v==null?void 0:v.left)+i.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:f.jsx("div",{className:"relative top-0 left-0 w-full",children:f.jsx("div",{className:"absolute top-[0px] right-[0px] truncate bg-bg-brand-primary text-text-brand-primary flex gap-2 px-2 rounded-bl hover:opacity-20 cursor-pointer",style:{fontSize:`${Math.min(v.height-2,10)}px`,maxHeight:`${Math.min(v.height-2,16)}px`,maxWidth:`${Math.min(v.width-2,300)}px`},children:de.splitJoinedSourcePaths(v.joinedPaths).map(x=>{const[w,k]=de.splitModuleFilePathAndModulePath(x),C=w.split("/").slice(1),_=k?de.splitModulePath(k):[];return f.jsxs("span",{children:[C.length>0&&f.jsx("span",{children:"/"}),C.length>0&&C.map((O,T)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{children:fa(O)}),T<C.length-1&&f.jsx("span",{children:"/"})]},`${O}-${T}`)),_.length>0&&f.jsx("span",{children:"/"}),_.length>0&&_.map((O,T)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{children:vv(O)}),T<_.length-1&&f.jsx("span",{children:"/"})]},`${O}-${T}`))]},x)})})})},b)),a===null&&f.jsx(Ope,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function Npe({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:window.innerWidth,y:window.innerHeight}),[i,s]=g.useState(window.innerWidth),a=g.useRef(null);g.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:d,innerHeight:p}=window,{offsetWidth:h,offsetHeight:m}=a.current,v=m,b=h;let x=e.clientX,w=e.clientY;const k=80,C=d-(e.clientX+b);C<0&&(x=x+(C-k));const _=p-(e.clientY+v);_<0&&(w=w+(_-k)),o({x,y:w})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),g.useEffect(()=>{const u=()=>{s(window.innerWidth),i<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=g.useState(!1);return g.useEffect(()=>{if(l){const u=h=>{if(h instanceof MouseEvent)o(m=>({x:m.x+h.movementX,y:m.y+h.movementY}));else{const m=h.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},d=()=>{c(!1)},p=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",d),window.addEventListener("click",p),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),window.removeEventListener("click",p)}}},[l]),g.useEffect(()=>{const u=d=>{d.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),f.jsxs("div",{className:Ne("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[f.jsx("div",{className:Ne("fixed top-0 left-0",{hidden:e===null,"opacity-100 w-[100vw] h-[100svh]":e!==null}),onClick:u=>{u.preventDefault(),l||(t("select"),n(null))}}),f.jsxs("div",{className:Ne("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-text-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":i<1024}),ref:a,style:{top:r.y,left:r.x},children:[f.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("form",{className:"flex flex-col items-start justify-start w-full gap-4 lg:justify-start",onSubmit:u=>{u.preventDefault(),u.stopPropagation(),t("select"),n(null)},children:[e&&de.splitJoinedSourcePaths(e.joinedPaths).map(u=>f.jsxs(g.Fragment,{children:[f.jsx("div",{children:f.jsx(DS,{disabled:!1,path:u})}),f.jsx(Tpe,{path:u})]},u)),f.jsx(nn,{className:"self-end",type:"submit",children:"Done"})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}function Tpe({path:e}){const t=Lt(e);return!("data"in t)||t.data===void 0?f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx(ht,{path:e})}):f.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:f.jsx(vy,{path:e,schema:t.data,autoFocus:!0})})}function cT({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",d=SP(),p=so(),{theme:h,setTheme:m}=hv(),v=M1(),[b,x]=g.useState(0),w=O1(),{validationErrors:k}=mi(),C=Object.keys(k).length,_=Cp();g.useEffect(()=>{const j=()=>{window.innerWidth<400?x(-56):x(32)};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]);const{publishDisabled:O}=yu(),T=e==="val-menu-center-bottom"?"top":e==="val-menu-center-top"?"bottom":e==="val-menu-right-center"?"left":e==="val-menu-left-center"?"right":e==="val-menu-left-bottom"||e==="val-menu-right-bottom"?"top":e==="val-menu-right-top"||e==="val-menu-left-top"?"bottom":"top";return f.jsxs("div",{className:"p-4 right-16",children:[l&&f.jsx("div",{className:Gg(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx(i0,{className:"animate-spin",size:16})})}),d==="login-required"&&f.jsx("div",{className:Gg(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx("a",{href:ug("/api/val/authorize",{redirect_to:window.location.href}),children:f.jsx(AV,{size:16})})})}),f.jsx(RR,{}),f.jsx(If,{isOpen:n&&!r&&!l&&d!=="login-required",children:f.jsxs("div",{className:Ne("flex relative rounded bg-bg-primary border border-border-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(Ql,{label:"Pick content",active:i==="select",onClick:()=>s(j=>j==="select"?null:"select"),icon:f.jsx(VV,{size:16})}),f.jsx(Ql,{label:"Disable preview mode",disabled:r,icon:r?f.jsx(i0,{size:16,className:"animate-spin"}):f.jsx(NV,{size:16}),onClick:()=>o(!1)}),f.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),f.jsxs(ga,{children:[f.jsx(Ff,{disabled:O,className:Ne("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsxs(il,{children:[f.jsx(nS,{children:f.jsxs("div",{className:"relative",children:[w.length>0&&f.jsx("div",{className:"absolute -top-3 -right-3",children:f.jsxs("div",{className:Ne("w-4 h-4 text-[9px] leading-4 text-center rounded-full",{"bg-bg-brand-primary":C===0,"bg-bg-error-primary text-text-error-primary":C>0}),children:[C===0&&w.length>9&&f.jsx("span",{children:"9+"}),C===0&&w.length<=9&&f.jsx("span",{children:w.length}),C>9&&f.jsx("span",{children:"9+"}),C<=9&&C>0&&f.jsx("span",{children:C})]})}),f.jsx(P1,{size:16})]})}),f.jsx(rS,{children:f.jsxs("div",{className:"p-2 rounded bg-bg-primary text-text-primary",children:[C>0&&f.jsxs("div",{className:"text-text-error-primary",children:["Cannot ",_==="fs"?"save":"publish"," due to"," ",C," validation error",C>1&&"s"]}),w.length>0&&C==0&&f.jsxs("div",{children:[w.length," patch",w.length>1&&"es"," ready to publish"]})]})})]})}),f.jsxs(Xi,{container:p,align:"center",side:T,sideOffset:b,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[f.jsx("div",{className:"absolute sm:hidden top-4 right-4",children:f.jsx(Y1,{children:f.jsx(Af,{size:16})})}),!O&&f.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:f.jsx(uT,{})}),f.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px] overflow-scroll",children:f.jsx(cR,{loadingStatus:v})}),!O&&f.jsx("div",{className:"hidden py-4 sm:block",children:f.jsx(uT,{})})]})]}),f.jsx(Ql,{label:"Studio",icon:f.jsx(gC,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsxs(ga,{children:[f.jsx(Ff,{className:Ne("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsx(PP,{size:16})}),f.jsx(Xi,{container:p,className:"z-[9003]",children:f.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[f.jsx("span",{children:"Dock to top"}),f.jsx("button",{onClick:()=>{c("val-menu-center-top")},children:f.jsx(zV,{size:16})}),f.jsx("span",{children:"Dock to right"}),f.jsx("button",{onClick:()=>{c("val-menu-right-center")},children:f.jsx(FV,{size:16})}),f.jsx("span",{children:"Dock to left"}),f.jsx("button",{onClick:()=>{c("val-menu-left-center")},children:f.jsx(LV,{size:16})}),f.jsx("span",{children:"Dock to bottom"}),f.jsx("button",{onClick:()=>{c("val-menu-center-bottom")},children:f.jsx(DV,{size:16})}),f.jsx("span",{children:"Dark mode"}),f.jsx(Z1,{checked:h==="dark",onCheckedChange:j=>{m(j?"dark":"light")}})]})})]})]})}),f.jsx(If,{isOpen:!(n&&!r)&&!l&&d!=="login-required",children:f.jsxs("div",{className:Ne("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(Ql,{label:"Enable preview mode",disabled:r,icon:r?f.jsx(i0,{size:16,className:"animate-spin"}):f.jsx(jP,{size:16}),onClick:()=>{o(!0)}}),f.jsx(Ql,{label:"Studio",icon:f.jsx(gC,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsx(Ql,{label:"Disable Val",icon:f.jsx(Af,{size:16}),onClick:()=>a()})]})})]})}function uT(){const{publishDisabled:e,isPublishing:t,publish:n}=yu(),r=Cp();return f.jsxs(nn,{className:"mx-4 ",disabled:e,onClick:()=>{n()},children:[!t&&f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{children:r==="fs"?"Save":"Publish"}),f.jsx(P1,{size:16})]}),t&&f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{children:"Publishing"}),f.jsx(xu,{size:16,className:"animate-spin"})]})]})}function Ql({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return f.jsx("button",{disabled:n,className:Ne("p-2 rounded-full disabled:bg-bg-disabled",{"bg-bg-brand-primary text-text-brand-primary":i==="primary","text-bg-brand-primary":!!r}),onClick:t,"aria-label":o,title:o,children:e})}function Ope(e){const[t,n]=g.useState(!1),{dropZone:r,setDropZone:o}=e,[i,s]=g.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),s(c)};return f.jsxs(f.Fragment,{children:[r&&f.jsx("div",{className:Ne("z-[8999] cursor-grab",Gg(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:f.jsx(cT,{...e,dropZone:r})}),t&&r&&f.jsxs(f.Fragment,{children:[i&&i!==r&&f.jsx("div",{className:Ne("z-[3]",Gg(i)),onDrop:a(i),onDragOver:l(i),children:f.jsx(cT,{ghost:!0,...e,dropZone:i})}),f.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[f.jsx(xs,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(xs,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(xs,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(xs,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx("div",{}),f.jsx(xs,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(xs,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(xs,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(xs,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function Gg(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const xs=({id:e,onDrop:t,onDragOver:n})=>f.jsx("div",{onDrop:t(e),onDragOver:n(e)});function Mpe(){const e="/api/val",t=cA(e),[n,r]=g.useState(!1),[o,i]=g.useState(!1);return g.useEffect(()=>{const s=a=>{a instanceof CustomEvent?(a==null?void 0:a.detail.type)==="draftMode"&&typeof(a==null?void 0:a.detail.value)=="boolean"?r(a.detail.value):a.detail.type==="draftModeLoading"&&typeof a.detail.value=="boolean"?i(a.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",a.detail):console.error("Val: invalid event (val-overlay-spa)",a)};return window.addEventListener("val-overlay-spa",s),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",s)}},[]),f.jsxs(f.Fragment,{children:[f.jsx(W4,{}),f.jsxs(U4,{children:[f.jsx("style",{children:`
432
- #val-overlay-container {
433
- visibility: hidden;
434
- }
435
- `}),f.jsx("link",{rel:"stylesheet",href:`${e}/static${H4}`}),f.jsx($4,{fallbackRender:V4,children:f.jsx(LP,{overlay:!0,children:f.jsx(wP,{client:t,dispatchValEvents:n,children:f.jsx(_pe,{draftMode:n,draftModeLoading:o,setDraftMode:s=>{const a=new CustomEvent("val-overlay-provider",{detail:{type:"draftMode",value:s}});window.dispatchEvent(a)},disableOverlay:()=>{location.href=`${window.location.origin}/api/val/disable?redirect_to=${encodeURIComponent(window.location.href)}`}})})})})]})]})}const dT=document.getElementById(kpe),fT=document.getElementById(Epe);dT?gm.createRoot(dT).render(_e.createElement(_e.StrictMode,null,_e.createElement(Cpe,null))):fT?gm.createRoot(fT).render(_e.createElement(_e.StrictMode,null,_e.createElement(Mpe,null))):console.error("Val: could not mount Val element. Check your configuration.");