@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.
- package/package.json +2 -1
- package/server/.tmp/assets/index-B4xpMmmQ.js +497 -0
- package/server/.tmp/assets/{index-Uj0_k2Mc.css → index-CDA2_ifk.css} +1 -1
- package/server/.tmp/index.html +2 -2
- package/server/dist/valbuild-ui-server.cjs.js +1 -1
- package/server/dist/valbuild-ui-server.esm.js +1 -1
- package/server/.tmp/assets/index-CO7CKULg.js +0 -435
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
var V3=Object.defineProperty;var uE=e=>{throw TypeError(e)};var U3=(e,t,n)=>t in e?V3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var zt=(e,t,n)=>U3(e,typeof t!="symbol"?t+"":t,n),dE=(e,t,n)=>t.has(e)||uE("Cannot "+n);var ue=(e,t,n)=>(dE(e,t,"read from private field"),n?n.call(e):t.get(e)),jn=(e,t,n)=>t.has(e)?uE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Je=(e,t,n,r)=>(dE(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function H3(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 W3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ta(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var UP={exports:{}},qe={};/**
|
|
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 jh=Symbol.for("react.element"),K3=Symbol.for("react.portal"),G3=Symbol.for("react.fragment"),q3=Symbol.for("react.strict_mode"),Y3=Symbol.for("react.profiler"),J3=Symbol.for("react.provider"),X3=Symbol.for("react.context"),Z3=Symbol.for("react.forward_ref"),Q3=Symbol.for("react.suspense"),eF=Symbol.for("react.memo"),tF=Symbol.for("react.lazy"),fE=Symbol.iterator;function nF(e){return e===null||typeof e!="object"?null:(e=fE&&e[fE]||e["@@iterator"],typeof e=="function"?e:null)}var HP={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},WP=Object.assign,KP={};function Tu(e,t,n){this.props=e,this.context=t,this.refs=KP,this.updater=n||HP}Tu.prototype.isReactComponent={};Tu.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")};Tu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function GP(){}GP.prototype=Tu.prototype;function Iw(e,t,n){this.props=e,this.context=t,this.refs=KP,this.updater=n||HP}var Aw=Iw.prototype=new GP;Aw.constructor=Iw;WP(Aw,Tu.prototype);Aw.isPureReactComponent=!0;var hE=Array.isArray,qP=Object.prototype.hasOwnProperty,Dw={current:null},YP={key:!0,ref:!0,__self:!0,__source:!0};function JP(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)qP.call(t,r)&&!YP.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:jh,type:e,key:i,ref:s,props:o,_owner:Dw.current}}function rF(e,t){return{$$typeof:jh,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Lw(e){return typeof e=="object"&&e!==null&&e.$$typeof===jh}function oF(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pE=/\/+/g;function $y(e,t){return typeof e=="object"&&e!==null&&e.key!=null?oF(""+e.key):t.toString(36)}function rm(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 jh:case K3:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+$y(s,0):r,hE(o)?(n="",e!=null&&(n=e.replace(pE,"$&/")+"/"),rm(o,t,n,"",function(c){return c})):o!=null&&(Lw(o)&&(o=rF(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(pE,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",hE(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+$y(i,a);s+=rm(i,t,n,l,o)}else if(l=nF(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+$y(i,a++),s+=rm(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 Sp(e,t,n){if(e==null)return e;var r=[],o=0;return rm(e,r,"","",function(i){return t.call(n,i,o++)}),r}function iF(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 nr={current:null},om={transition:null},sF={ReactCurrentDispatcher:nr,ReactCurrentBatchConfig:om,ReactCurrentOwner:Dw};function XP(){throw Error("act(...) is not supported in production builds of React.")}qe.Children={map:Sp,forEach:function(e,t,n){Sp(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Sp(e,function(){t++}),t},toArray:function(e){return Sp(e,function(t){return t})||[]},only:function(e){if(!Lw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};qe.Component=Tu;qe.Fragment=G3;qe.Profiler=Y3;qe.PureComponent=Iw;qe.StrictMode=q3;qe.Suspense=Q3;qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sF;qe.act=XP;qe.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=WP({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Dw.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)qP.call(t,l)&&!YP.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:jh,type:e.type,key:o,ref:i,props:r,_owner:s}};qe.createContext=function(e){return e={$$typeof:X3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:J3,_context:e},e.Consumer=e};qe.createElement=JP;qe.createFactory=function(e){var t=JP.bind(null,e);return t.type=e,t};qe.createRef=function(){return{current:null}};qe.forwardRef=function(e){return{$$typeof:Z3,render:e}};qe.isValidElement=Lw;qe.lazy=function(e){return{$$typeof:tF,_payload:{_status:-1,_result:e},_init:iF}};qe.memo=function(e,t){return{$$typeof:eF,type:e,compare:t===void 0?null:t}};qe.startTransition=function(e){var t=om.transition;om.transition={};try{e()}finally{om.transition=t}};qe.unstable_act=XP;qe.useCallback=function(e,t){return nr.current.useCallback(e,t)};qe.useContext=function(e){return nr.current.useContext(e)};qe.useDebugValue=function(){};qe.useDeferredValue=function(e){return nr.current.useDeferredValue(e)};qe.useEffect=function(e,t){return nr.current.useEffect(e,t)};qe.useId=function(){return nr.current.useId()};qe.useImperativeHandle=function(e,t,n){return nr.current.useImperativeHandle(e,t,n)};qe.useInsertionEffect=function(e,t){return nr.current.useInsertionEffect(e,t)};qe.useLayoutEffect=function(e,t){return nr.current.useLayoutEffect(e,t)};qe.useMemo=function(e,t){return nr.current.useMemo(e,t)};qe.useReducer=function(e,t,n){return nr.current.useReducer(e,t,n)};qe.useRef=function(e){return nr.current.useRef(e)};qe.useState=function(e){return nr.current.useState(e)};qe.useSyncExternalStore=function(e,t,n){return nr.current.useSyncExternalStore(e,t,n)};qe.useTransition=function(){return nr.current.useTransition()};qe.version="18.3.1";UP.exports=qe;var g=UP.exports;const Se=Ta(g),aF=H3({__proto__:null,default:Se},[g]);var Dm={},ZP={exports:{}},$r={},QP={exports:{}},eN={};/**
|
|
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(N,D){var z=N.length;N.push(D);e:for(;0<z;){var V=z-1>>>1,G=N[V];if(0<o(G,D))N[V]=D,N[z]=G,z=V;else break e}}function n(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var D=N[0],z=N.pop();if(z!==D){N[0]=z;e:for(var V=0,G=N.length,Re=G>>>1;V<Re;){var Y=2*(V+1)-1,he=N[Y],ie=Y+1,ne=N[ie];if(0>o(he,z))ie<G&&0>o(ne,he)?(N[V]=ne,N[ie]=z,V=ie):(N[V]=he,N[Y]=z,V=Y);else if(ie<G&&0>o(ne,z))N[V]=ne,N[ie]=z,V=ie;else break e}}return D}function o(N,D){var z=N.sortIndex-D.sortIndex;return z!==0?z:N.id-D.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,h=3,p=!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 S(N){for(var D=n(c);D!==null;){if(D.callback===null)r(c);else if(D.startTime<=N)r(c),D.sortIndex=D.expirationTime,t(l,D);else break;D=n(c)}}function C(N){if(v=!1,S(N),!m)if(n(l)!==null)m=!0,A(_);else{var D=n(c);D!==null&&R(C,D.startTime-N)}}function _(N,D){m=!1,v&&(v=!1,x(j),j=-1),p=!0;var z=h;try{for(S(D),d=n(l);d!==null&&(!(d.expirationTime>D)||N&&!H());){var V=d.callback;if(typeof V=="function"){d.callback=null,h=d.priorityLevel;var G=V(d.expirationTime<=D);D=e.unstable_now(),typeof G=="function"?d.callback=G:d===n(l)&&r(l),S(D)}else r(l);d=n(l)}if(d!==null)var Re=!0;else{var Y=n(c);Y!==null&&R(C,Y.startTime-D),Re=!1}return Re}finally{d=null,h=z,p=!1}}var P=!1,O=null,j=-1,I=5,F=-1;function H(){return!(e.unstable_now()-F<I)}function $(){if(O!==null){var N=e.unstable_now();F=N;var D=!0;try{D=O(!0,N)}finally{D?J():(P=!1,O=null)}}else P=!1}var J;if(typeof w=="function")J=function(){w($)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,B=W.port2;W.port1.onmessage=$,J=function(){B.postMessage(null)}}else J=function(){b($,0)};function A(N){O=N,P||(P=!0,J())}function R(N,D){j=b(function(){N(e.unstable_now())},D)}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(N){N.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,A(_))},e.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<N?Math.floor(1e3/N):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(N){switch(h){case 1:case 2:case 3:var D=3;break;default:D=h}var z=h;h=D;try{return N()}finally{h=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(N,D){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var z=h;h=N;try{return D()}finally{h=z}},e.unstable_scheduleCallback=function(N,D,z){var V=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?V+z:V):z=V,N){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=z+G,N={id:u++,callback:D,priorityLevel:N,startTime:z,expirationTime:G,sortIndex:-1},z>V?(N.sortIndex=z,t(c,N),n(l)===null&&N===n(c)&&(v?(x(j),j=-1):v=!0,R(C,z-V))):(N.sortIndex=G,t(l,N),m||p||(m=!0,A(_))),N},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(N){var D=h;return function(){var z=h;h=D;try{return N.apply(this,arguments)}finally{h=z}}}})(eN);QP.exports=eN;var lF=QP.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 cF=g,Dr=lF;function Q(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 tN=new Set,xf={};function zl(e,t){Jc(e,t),Jc(e+"Capture",t)}function Jc(e,t){for(xf[e]=t,e=0;e<t.length;e++)tN.add(t[e])}var qi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m0=Object.prototype.hasOwnProperty,uF=/^[: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]*$/,mE={},gE={};function dF(e){return m0.call(gE,e)?!0:m0.call(mE,e)?!1:uF.test(e)?gE[e]=!0:(mE[e]=!0,!1)}function fF(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 hF(e,t,n,r){if(t===null||typeof t>"u"||fF(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 rr(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 Cn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Cn[e]=new rr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Cn[t]=new rr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Cn[e]=new rr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Cn[e]=new rr(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){Cn[e]=new rr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Cn[e]=new rr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Cn[e]=new rr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Cn[e]=new rr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Cn[e]=new rr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Fw=/[\-:]([a-z])/g;function zw(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(Fw,zw);Cn[t]=new rr(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(Fw,zw);Cn[t]=new rr(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(Fw,zw);Cn[t]=new rr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Cn[e]=new rr(e,1,!1,e.toLowerCase(),null,!1,!1)});Cn.xlinkHref=new rr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Cn[e]=new rr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bw(e,t,n,r){var o=Cn.hasOwnProperty(t)?Cn[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(hF(t,n,o,r)&&(n=null),r||o===null?dF(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 ss=cF.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,kp=Symbol.for("react.element"),gc=Symbol.for("react.portal"),vc=Symbol.for("react.fragment"),$w=Symbol.for("react.strict_mode"),g0=Symbol.for("react.profiler"),nN=Symbol.for("react.provider"),rN=Symbol.for("react.context"),Vw=Symbol.for("react.forward_ref"),v0=Symbol.for("react.suspense"),y0=Symbol.for("react.suspense_list"),Uw=Symbol.for("react.memo"),Ms=Symbol.for("react.lazy"),oN=Symbol.for("react.offscreen"),vE=Symbol.iterator;function ed(e){return e===null||typeof e!="object"?null:(e=vE&&e[vE]||e["@@iterator"],typeof e=="function"?e:null)}var Rt=Object.assign,Vy;function xd(e){if(Vy===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Vy=t&&t[1]||""}return`
|
|
26
|
+
`+Vy+e}var Uy=!1;function Hy(e,t){if(!e||Uy)return"";Uy=!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{Uy=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?xd(e):""}function pF(e){switch(e.tag){case 5:return xd(e.type);case 16:return xd("Lazy");case 13:return xd("Suspense");case 19:return xd("SuspenseList");case 0:case 2:case 15:return e=Hy(e.type,!1),e;case 11:return e=Hy(e.type.render,!1),e;case 1:return e=Hy(e.type,!0),e;default:return""}}function x0(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 vc:return"Fragment";case gc:return"Portal";case g0:return"Profiler";case $w:return"StrictMode";case v0:return"Suspense";case y0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case rN:return(e.displayName||"Context")+".Consumer";case nN:return(e._context.displayName||"Context")+".Provider";case Vw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Uw:return t=e.displayName||null,t!==null?t:x0(e.type)||"Memo";case Ms:t=e._payload,e=e._init;try{return x0(e(t))}catch{}}return null}function mF(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 x0(t);case 8:return t===$w?"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 da(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function iN(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function gF(e){var t=iN(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 Ep(e){e._valueTracker||(e._valueTracker=gF(e))}function sN(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=iN(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Lm(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 b0(e,t){var n=t.checked;return Rt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function yE(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=da(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 aN(e,t){t=t.checked,t!=null&&Bw(e,"checked",t,!1)}function w0(e,t){aN(e,t);var n=da(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")?S0(e,t.type,n):t.hasOwnProperty("defaultValue")&&S0(e,t.type,da(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xE(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 S0(e,t,n){(t!=="number"||Lm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bd=Array.isArray;function Oc(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=""+da(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 k0(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return Rt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function bE(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(bd(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:da(n)}}function lN(e,t){var n=da(t.value),r=da(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 wE(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function cN(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 E0(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?cN(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Cp,uN=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(Cp=Cp||document.createElement("div"),Cp.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Cp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Qd={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},vF=["Webkit","ms","Moz","O"];Object.keys(Qd).forEach(function(e){vF.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Qd[t]=Qd[e]})});function dN(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Qd.hasOwnProperty(e)&&Qd[e]?(""+t).trim():t+"px"}function fN(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=dN(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var yF=Rt({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 C0(e,t){if(t){if(yF[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function _0(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 T0=null;function Hw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var P0=null,Mc=null,jc=null;function SE(e){if(e=Ah(e)){if(typeof P0!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=vv(t),P0(e.stateNode,e.type,t))}}function hN(e){Mc?jc?jc.push(e):jc=[e]:Mc=e}function pN(){if(Mc){var e=Mc,t=jc;if(jc=Mc=null,SE(e),t)for(e=0;e<t.length;e++)SE(t[e])}}function mN(e,t){return e(t)}function gN(){}var Wy=!1;function vN(e,t,n){if(Wy)return e(t,n);Wy=!0;try{return mN(e,t,n)}finally{Wy=!1,(Mc!==null||jc!==null)&&(gN(),pN())}}function wf(e,t){var n=e.stateNode;if(n===null)return null;var r=vv(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(Q(231,t,typeof n));return n}var N0=!1;if(qi)try{var td={};Object.defineProperty(td,"passive",{get:function(){N0=!0}}),window.addEventListener("test",td,td),window.removeEventListener("test",td,td)}catch{N0=!1}function xF(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 ef=!1,Fm=null,zm=!1,O0=null,bF={onError:function(e){ef=!0,Fm=e}};function wF(e,t,n,r,o,i,s,a,l){ef=!1,Fm=null,xF.apply(bF,arguments)}function SF(e,t,n,r,o,i,s,a,l){if(wF.apply(this,arguments),ef){if(ef){var c=Fm;ef=!1,Fm=null}else throw Error(Q(198));zm||(zm=!0,O0=c)}}function Bl(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 yN(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 kE(e){if(Bl(e)!==e)throw Error(Q(188))}function kF(e){var t=e.alternate;if(!t){if(t=Bl(e),t===null)throw Error(Q(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 kE(o),e;if(i===r)return kE(o),t;i=i.sibling}throw Error(Q(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(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function xN(e){return e=kF(e),e!==null?bN(e):null}function bN(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=bN(e);if(t!==null)return t;e=e.sibling}return null}var wN=Dr.unstable_scheduleCallback,EE=Dr.unstable_cancelCallback,EF=Dr.unstable_shouldYield,CF=Dr.unstable_requestPaint,Bt=Dr.unstable_now,_F=Dr.unstable_getCurrentPriorityLevel,Ww=Dr.unstable_ImmediatePriority,SN=Dr.unstable_UserBlockingPriority,Bm=Dr.unstable_NormalPriority,TF=Dr.unstable_LowPriority,kN=Dr.unstable_IdlePriority,hv=null,ii=null;function PF(e){if(ii&&typeof ii.onCommitFiberRoot=="function")try{ii.onCommitFiberRoot(hv,e,void 0,(e.current.flags&128)===128)}catch{}}var Ro=Math.clz32?Math.clz32:MF,NF=Math.log,OF=Math.LN2;function MF(e){return e>>>=0,e===0?32:31-(NF(e)/OF|0)|0}var _p=64,Tp=4194304;function wd(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 $m(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=wd(a):(i&=s,i!==0&&(r=wd(i)))}else s=n&~o,s!==0?r=wd(s):i!==0&&(r=wd(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-Ro(t),o=1<<n,r|=e[n],t&=~o;return r}function jF(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 RF(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Ro(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=jF(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function M0(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function EN(){var e=_p;return _p<<=1,!(_p&4194240)&&(_p=64),e}function Ky(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Rh(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ro(t),e[t]=n}function IF(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-Ro(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Kw(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ro(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var dt=0;function CN(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var _N,Gw,TN,PN,NN,j0=!1,Pp=[],Js=null,Xs=null,Zs=null,Sf=new Map,kf=new Map,Ds=[],AF="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 CE(e,t){switch(e){case"focusin":case"focusout":Js=null;break;case"dragenter":case"dragleave":Xs=null;break;case"mouseover":case"mouseout":Zs=null;break;case"pointerover":case"pointerout":Sf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kf.delete(t.pointerId)}}function nd(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=Ah(t),t!==null&&Gw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function DF(e,t,n,r,o){switch(t){case"focusin":return Js=nd(Js,e,t,n,r,o),!0;case"dragenter":return Xs=nd(Xs,e,t,n,r,o),!0;case"mouseover":return Zs=nd(Zs,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Sf.set(i,nd(Sf.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,kf.set(i,nd(kf.get(i)||null,e,t,n,r,o)),!0}return!1}function ON(e){var t=Ya(e.target);if(t!==null){var n=Bl(t);if(n!==null){if(t=n.tag,t===13){if(t=yN(n),t!==null){e.blockedOn=t,NN(e.priority,function(){TN(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 im(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=R0(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);T0=r,n.target.dispatchEvent(r),T0=null}else return t=Ah(n),t!==null&&Gw(t),e.blockedOn=n,!1;t.shift()}return!0}function _E(e,t,n){im(e)&&n.delete(t)}function LF(){j0=!1,Js!==null&&im(Js)&&(Js=null),Xs!==null&&im(Xs)&&(Xs=null),Zs!==null&&im(Zs)&&(Zs=null),Sf.forEach(_E),kf.forEach(_E)}function rd(e,t){e.blockedOn===t&&(e.blockedOn=null,j0||(j0=!0,Dr.unstable_scheduleCallback(Dr.unstable_NormalPriority,LF)))}function Ef(e){function t(o){return rd(o,e)}if(0<Pp.length){rd(Pp[0],e);for(var n=1;n<Pp.length;n++){var r=Pp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Js!==null&&rd(Js,e),Xs!==null&&rd(Xs,e),Zs!==null&&rd(Zs,e),Sf.forEach(t),kf.forEach(t),n=0;n<Ds.length;n++)r=Ds[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ds.length&&(n=Ds[0],n.blockedOn===null);)ON(n),n.blockedOn===null&&Ds.shift()}var Rc=ss.ReactCurrentBatchConfig,Vm=!0;function FF(e,t,n,r){var o=dt,i=Rc.transition;Rc.transition=null;try{dt=1,qw(e,t,n,r)}finally{dt=o,Rc.transition=i}}function zF(e,t,n,r){var o=dt,i=Rc.transition;Rc.transition=null;try{dt=4,qw(e,t,n,r)}finally{dt=o,Rc.transition=i}}function qw(e,t,n,r){if(Vm){var o=R0(e,t,n,r);if(o===null)nx(e,t,r,Um,n),CE(e,r);else if(DF(o,e,t,n,r))r.stopPropagation();else if(CE(e,r),t&4&&-1<AF.indexOf(e)){for(;o!==null;){var i=Ah(o);if(i!==null&&_N(i),i=R0(e,t,n,r),i===null&&nx(e,t,r,Um,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else nx(e,t,r,null,n)}}var Um=null;function R0(e,t,n,r){if(Um=null,e=Hw(r),e=Ya(e),e!==null)if(t=Bl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=yN(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 Um=e,null}function MN(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(_F()){case Ww:return 1;case SN:return 4;case Bm:case TF:return 16;case kN:return 536870912;default:return 16}default:return 16}}var Hs=null,Yw=null,sm=null;function jN(){if(sm)return sm;var e,t=Yw,n=t.length,r,o="value"in Hs?Hs.value:Hs.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 sm=o.slice(e,1<r?1-r:void 0)}function am(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 Np(){return!0}function TE(){return!1}function Vr(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)?Np:TE,this.isPropagationStopped=TE,this}return Rt(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=Np)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Np)},persist:function(){},isPersistent:Np}),t}var Pu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jw=Vr(Pu),Ih=Rt({},Pu,{view:0,detail:0}),BF=Vr(Ih),Gy,qy,od,pv=Rt({},Ih,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xw,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!==od&&(od&&e.type==="mousemove"?(Gy=e.screenX-od.screenX,qy=e.screenY-od.screenY):qy=Gy=0,od=e),Gy)},movementY:function(e){return"movementY"in e?e.movementY:qy}}),PE=Vr(pv),$F=Rt({},pv,{dataTransfer:0}),VF=Vr($F),UF=Rt({},Ih,{relatedTarget:0}),Yy=Vr(UF),HF=Rt({},Pu,{animationName:0,elapsedTime:0,pseudoElement:0}),WF=Vr(HF),KF=Rt({},Pu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),GF=Vr(KF),qF=Rt({},Pu,{data:0}),NE=Vr(qF),YF={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JF={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"},XF={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ZF(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=XF[e])?!!t[e]:!1}function Xw(){return ZF}var QF=Rt({},Ih,{key:function(e){if(e.key){var t=YF[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=am(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?JF[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xw,charCode:function(e){return e.type==="keypress"?am(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?am(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),e5=Vr(QF),t5=Rt({},pv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),OE=Vr(t5),n5=Rt({},Ih,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xw}),r5=Vr(n5),o5=Rt({},Pu,{propertyName:0,elapsedTime:0,pseudoElement:0}),i5=Vr(o5),s5=Rt({},pv,{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}),a5=Vr(s5),l5=[9,13,27,32],Zw=qi&&"CompositionEvent"in window,tf=null;qi&&"documentMode"in document&&(tf=document.documentMode);var c5=qi&&"TextEvent"in window&&!tf,RN=qi&&(!Zw||tf&&8<tf&&11>=tf),ME=" ",jE=!1;function IN(e,t){switch(e){case"keyup":return l5.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function AN(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yc=!1;function u5(e,t){switch(e){case"compositionend":return AN(t);case"keypress":return t.which!==32?null:(jE=!0,ME);case"textInput":return e=t.data,e===ME&&jE?null:e;default:return null}}function d5(e,t){if(yc)return e==="compositionend"||!Zw&&IN(e,t)?(e=jN(),sm=Yw=Hs=null,yc=!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 RN&&t.locale!=="ko"?null:t.data;default:return null}}var f5={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 RE(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!f5[e.type]:t==="textarea"}function DN(e,t,n,r){hN(r),t=Hm(t,"onChange"),0<t.length&&(n=new Jw("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var nf=null,Cf=null;function h5(e){GN(e,0)}function mv(e){var t=wc(e);if(sN(t))return e}function p5(e,t){if(e==="change")return t}var LN=!1;if(qi){var Jy;if(qi){var Xy="oninput"in document;if(!Xy){var IE=document.createElement("div");IE.setAttribute("oninput","return;"),Xy=typeof IE.oninput=="function"}Jy=Xy}else Jy=!1;LN=Jy&&(!document.documentMode||9<document.documentMode)}function AE(){nf&&(nf.detachEvent("onpropertychange",FN),Cf=nf=null)}function FN(e){if(e.propertyName==="value"&&mv(Cf)){var t=[];DN(t,Cf,e,Hw(e)),vN(h5,t)}}function m5(e,t,n){e==="focusin"?(AE(),nf=t,Cf=n,nf.attachEvent("onpropertychange",FN)):e==="focusout"&&AE()}function g5(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mv(Cf)}function v5(e,t){if(e==="click")return mv(t)}function y5(e,t){if(e==="input"||e==="change")return mv(t)}function x5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Lo=typeof Object.is=="function"?Object.is:x5;function _f(e,t){if(Lo(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(!m0.call(t,o)||!Lo(e[o],t[o]))return!1}return!0}function DE(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function LE(e,t){var n=DE(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=DE(n)}}function zN(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zN(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function BN(){for(var e=window,t=Lm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Lm(e.document)}return t}function Qw(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 b5(e){var t=BN(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&zN(n.ownerDocument.documentElement,n)){if(r!==null&&Qw(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=LE(n,i);var s=LE(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 w5=qi&&"documentMode"in document&&11>=document.documentMode,xc=null,I0=null,rf=null,A0=!1;function FE(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;A0||xc==null||xc!==Lm(r)||(r=xc,"selectionStart"in r&&Qw(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}),rf&&_f(rf,r)||(rf=r,r=Hm(I0,"onSelect"),0<r.length&&(t=new Jw("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=xc)))}function Op(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var bc={animationend:Op("Animation","AnimationEnd"),animationiteration:Op("Animation","AnimationIteration"),animationstart:Op("Animation","AnimationStart"),transitionend:Op("Transition","TransitionEnd")},Zy={},$N={};qi&&($N=document.createElement("div").style,"AnimationEvent"in window||(delete bc.animationend.animation,delete bc.animationiteration.animation,delete bc.animationstart.animation),"TransitionEvent"in window||delete bc.transitionend.transition);function gv(e){if(Zy[e])return Zy[e];if(!bc[e])return e;var t=bc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in $N)return Zy[e]=t[n];return e}var VN=gv("animationend"),UN=gv("animationiteration"),HN=gv("animationstart"),WN=gv("transitionend"),KN=new Map,zE="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 Pa(e,t){KN.set(e,t),zl(t,[e])}for(var Qy=0;Qy<zE.length;Qy++){var ex=zE[Qy],S5=ex.toLowerCase(),k5=ex[0].toUpperCase()+ex.slice(1);Pa(S5,"on"+k5)}Pa(VN,"onAnimationEnd");Pa(UN,"onAnimationIteration");Pa(HN,"onAnimationStart");Pa("dblclick","onDoubleClick");Pa("focusin","onFocus");Pa("focusout","onBlur");Pa(WN,"onTransitionEnd");Jc("onMouseEnter",["mouseout","mouseover"]);Jc("onMouseLeave",["mouseout","mouseover"]);Jc("onPointerEnter",["pointerout","pointerover"]);Jc("onPointerLeave",["pointerout","pointerover"]);zl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zl("onBeforeInput",["compositionend","keypress","textInput","paste"]);zl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sd="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(" "),E5=new Set("cancel close invalid load scroll toggle".split(" ").concat(Sd));function BE(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,SF(r,t,void 0,e),e.currentTarget=null}function GN(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;BE(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;BE(o,a,c),i=l}}}if(zm)throw e=O0,zm=!1,O0=null,e}function St(e,t){var n=t[B0];n===void 0&&(n=t[B0]=new Set);var r=e+"__bubble";n.has(r)||(qN(t,e,2,!1),n.add(r))}function tx(e,t,n){var r=0;t&&(r|=4),qN(n,e,r,t)}var Mp="_reactListening"+Math.random().toString(36).slice(2);function Tf(e){if(!e[Mp]){e[Mp]=!0,tN.forEach(function(n){n!=="selectionchange"&&(E5.has(n)||tx(n,!1,e),tx(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mp]||(t[Mp]=!0,tx("selectionchange",!1,t))}}function qN(e,t,n,r){switch(MN(t)){case 1:var o=FF;break;case 4:o=zF;break;default:o=qw}n=o.bind(null,t,n,e),o=void 0,!N0||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 nx(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=Ya(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}vN(function(){var c=i,u=Hw(n),d=[];e:{var h=KN.get(e);if(h!==void 0){var p=Jw,m=e;switch(e){case"keypress":if(am(n)===0)break e;case"keydown":case"keyup":p=e5;break;case"focusin":m="focus",p=Yy;break;case"focusout":m="blur",p=Yy;break;case"beforeblur":case"afterblur":p=Yy;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=PE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=VF;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=r5;break;case VN:case UN:case HN:p=WF;break;case WN:p=i5;break;case"scroll":p=BF;break;case"wheel":p=a5;break;case"copy":case"cut":case"paste":p=GF;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=OE}var v=(t&4)!==0,b=!v&&e==="scroll",x=v?h!==null?h+"Capture":null:h;v=[];for(var w=c,S;w!==null;){S=w;var C=S.stateNode;if(S.tag===5&&C!==null&&(S=C,x!==null&&(C=wf(w,x),C!=null&&v.push(Pf(w,C,S)))),b)break;w=w.return}0<v.length&&(h=new p(h,m,null,n,u),d.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==T0&&(m=n.relatedTarget||n.fromElement)&&(Ya(m)||m[Yi]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=c,m=m?Ya(m):null,m!==null&&(b=Bl(m),m!==b||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(v=PE,C="onMouseLeave",x="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(v=OE,C="onPointerLeave",x="onPointerEnter",w="pointer"),b=p==null?h:wc(p),S=m==null?h:wc(m),h=new v(C,w+"leave",p,n,u),h.target=b,h.relatedTarget=S,C=null,Ya(u)===c&&(v=new v(x,w+"enter",m,n,u),v.target=S,v.relatedTarget=b,C=v),b=C,p&&m)t:{for(v=p,x=m,w=0,S=v;S;S=ql(S))w++;for(S=0,C=x;C;C=ql(C))S++;for(;0<w-S;)v=ql(v),w--;for(;0<S-w;)x=ql(x),S--;for(;w--;){if(v===x||x!==null&&v===x.alternate)break t;v=ql(v),x=ql(x)}v=null}else v=null;p!==null&&$E(d,h,p,v,!1),m!==null&&b!==null&&$E(d,b,m,v,!0)}}e:{if(h=c?wc(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var _=p5;else if(RE(h))if(LN)_=y5;else{_=g5;var P=m5}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(_=v5);if(_&&(_=_(e,c))){DN(d,_,n,u);break e}P&&P(e,h,c),e==="focusout"&&(P=h._wrapperState)&&P.controlled&&h.type==="number"&&S0(h,"number",h.value)}switch(P=c?wc(c):window,e){case"focusin":(RE(P)||P.contentEditable==="true")&&(xc=P,I0=c,rf=null);break;case"focusout":rf=I0=xc=null;break;case"mousedown":A0=!0;break;case"contextmenu":case"mouseup":case"dragend":A0=!1,FE(d,n,u);break;case"selectionchange":if(w5)break;case"keydown":case"keyup":FE(d,n,u)}var O;if(Zw)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 yc?IN(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(RN&&n.locale!=="ko"&&(yc||j!=="onCompositionStart"?j==="onCompositionEnd"&&yc&&(O=jN()):(Hs=u,Yw="value"in Hs?Hs.value:Hs.textContent,yc=!0)),P=Hm(c,j),0<P.length&&(j=new NE(j,e,null,n,u),d.push({event:j,listeners:P}),O?j.data=O:(O=AN(n),O!==null&&(j.data=O)))),(O=c5?u5(e,n):d5(e,n))&&(c=Hm(c,"onBeforeInput"),0<c.length&&(u=new NE("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=O))}GN(d,t)})}function Pf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Hm(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=wf(e,n),i!=null&&r.unshift(Pf(e,i,o)),i=wf(e,t),i!=null&&r.push(Pf(e,i,o))),e=e.return}return r}function ql(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function $E(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=wf(n,i),l!=null&&s.unshift(Pf(n,l,a))):o||(l=wf(n,i),l!=null&&s.push(Pf(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var C5=/\r\n?/g,_5=/\u0000|\uFFFD/g;function VE(e){return(typeof e=="string"?e:""+e).replace(C5,`
|
|
30
|
+
`).replace(_5,"")}function jp(e,t,n){if(t=VE(t),VE(e)!==t&&n)throw Error(Q(425))}function Wm(){}var D0=null,L0=null;function F0(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 z0=typeof setTimeout=="function"?setTimeout:void 0,T5=typeof clearTimeout=="function"?clearTimeout:void 0,UE=typeof Promise=="function"?Promise:void 0,P5=typeof queueMicrotask=="function"?queueMicrotask:typeof UE<"u"?function(e){return UE.resolve(null).then(e).catch(N5)}:z0;function N5(e){setTimeout(function(){throw e})}function rx(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),Ef(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Ef(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 HE(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 Nu=Math.random().toString(36).slice(2),ti="__reactFiber$"+Nu,Nf="__reactProps$"+Nu,Yi="__reactContainer$"+Nu,B0="__reactEvents$"+Nu,O5="__reactListeners$"+Nu,M5="__reactHandles$"+Nu;function Ya(e){var t=e[ti];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Yi]||n[ti]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=HE(e);e!==null;){if(n=e[ti])return n;e=HE(e)}return t}e=n,n=e.parentNode}return null}function Ah(e){return e=e[ti]||e[Yi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function wc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function vv(e){return e[Nf]||null}var $0=[],Sc=-1;function Na(e){return{current:e}}function kt(e){0>Sc||(e.current=$0[Sc],$0[Sc]=null,Sc--)}function yt(e,t){Sc++,$0[Sc]=e.current,e.current=t}var fa={},zn=Na(fa),ur=Na(!1),ml=fa;function Xc(e,t){var n=e.type.contextTypes;if(!n)return fa;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 dr(e){return e=e.childContextTypes,e!=null}function Km(){kt(ur),kt(zn)}function WE(e,t,n){if(zn.current!==fa)throw Error(Q(168));yt(zn,t),yt(ur,n)}function YN(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(Q(108,mF(e)||"Unknown",o));return Rt({},n,r)}function Gm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fa,ml=zn.current,yt(zn,e),yt(ur,ur.current),!0}function KE(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=YN(e,t,ml),r.__reactInternalMemoizedMergedChildContext=e,kt(ur),kt(zn),yt(zn,e)):kt(ur),yt(ur,n)}var Ri=null,yv=!1,ox=!1;function JN(e){Ri===null?Ri=[e]:Ri.push(e)}function j5(e){yv=!0,JN(e)}function Oa(){if(!ox&&Ri!==null){ox=!0;var e=0,t=dt;try{var n=Ri;for(dt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ri=null,yv=!1}catch(o){throw Ri!==null&&(Ri=Ri.slice(e+1)),wN(Ww,Oa),o}finally{dt=t,ox=!1}}return null}var kc=[],Ec=0,qm=null,Ym=0,Zr=[],Qr=0,gl=null,zi=1,Bi="";function Ba(e,t){kc[Ec++]=Ym,kc[Ec++]=qm,qm=e,Ym=t}function XN(e,t,n){Zr[Qr++]=zi,Zr[Qr++]=Bi,Zr[Qr++]=gl,gl=e;var r=zi;e=Bi;var o=32-Ro(r)-1;r&=~(1<<o),n+=1;var i=32-Ro(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,zi=1<<32-Ro(t)+o|n<<o|r,Bi=i+e}else zi=1<<i|n<<o|r,Bi=e}function e1(e){e.return!==null&&(Ba(e,1),XN(e,1,0))}function t1(e){for(;e===qm;)qm=kc[--Ec],kc[Ec]=null,Ym=kc[--Ec],kc[Ec]=null;for(;e===gl;)gl=Zr[--Qr],Zr[Qr]=null,Bi=Zr[--Qr],Zr[Qr]=null,zi=Zr[--Qr],Zr[Qr]=null}var jr=null,Or=null,Et=!1,_o=null;function ZN(e,t){var n=no(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 GE(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,jr=e,Or=Qs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,jr=e,Or=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=gl!==null?{id:zi,overflow:Bi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=no(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,jr=e,Or=null,!0):!1;default:return!1}}function V0(e){return(e.mode&1)!==0&&(e.flags&128)===0}function U0(e){if(Et){var t=Or;if(t){var n=t;if(!GE(e,t)){if(V0(e))throw Error(Q(418));t=Qs(n.nextSibling);var r=jr;t&&GE(e,t)?ZN(r,n):(e.flags=e.flags&-4097|2,Et=!1,jr=e)}}else{if(V0(e))throw Error(Q(418));e.flags=e.flags&-4097|2,Et=!1,jr=e}}}function qE(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;jr=e}function Rp(e){if(e!==jr)return!1;if(!Et)return qE(e),Et=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!F0(e.type,e.memoizedProps)),t&&(t=Or)){if(V0(e))throw QN(),Error(Q(418));for(;t;)ZN(e,t),t=Qs(t.nextSibling)}if(qE(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Or=Qs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Or=null}}else Or=jr?Qs(e.stateNode.nextSibling):null;return!0}function QN(){for(var e=Or;e;)e=Qs(e.nextSibling)}function Zc(){Or=jr=null,Et=!1}function n1(e){_o===null?_o=[e]:_o.push(e)}var R5=ss.ReactCurrentBatchConfig;function id(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(Q(309));var r=n.stateNode}if(!r)throw Error(Q(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(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function Ip(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function YE(e){var t=e._init;return t(e._payload)}function eO(e){function t(x,w){if(e){var S=x.deletions;S===null?(x.deletions=[w],x.flags|=16):S.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=ra(x,w),x.index=0,x.sibling=null,x}function i(x,w,S){return x.index=S,e?(S=x.alternate,S!==null?(S=S.index,S<w?(x.flags|=2,w):S):(x.flags|=2,w)):(x.flags|=1048576,w)}function s(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,w,S,C){return w===null||w.tag!==6?(w=dx(S,x.mode,C),w.return=x,w):(w=o(w,S),w.return=x,w)}function l(x,w,S,C){var _=S.type;return _===vc?u(x,w,S.props.children,C,S.key):w!==null&&(w.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Ms&&YE(_)===w.type)?(C=o(w,S.props),C.ref=id(x,w,S),C.return=x,C):(C=pm(S.type,S.key,S.props,null,x.mode,C),C.ref=id(x,w,S),C.return=x,C)}function c(x,w,S,C){return w===null||w.tag!==4||w.stateNode.containerInfo!==S.containerInfo||w.stateNode.implementation!==S.implementation?(w=fx(S,x.mode,C),w.return=x,w):(w=o(w,S.children||[]),w.return=x,w)}function u(x,w,S,C,_){return w===null||w.tag!==7?(w=il(S,x.mode,C,_),w.return=x,w):(w=o(w,S),w.return=x,w)}function d(x,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return w=dx(""+w,x.mode,S),w.return=x,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case kp:return S=pm(w.type,w.key,w.props,null,x.mode,S),S.ref=id(x,null,w),S.return=x,S;case gc:return w=fx(w,x.mode,S),w.return=x,w;case Ms:var C=w._init;return d(x,C(w._payload),S)}if(bd(w)||ed(w))return w=il(w,x.mode,S,null),w.return=x,w;Ip(x,w)}return null}function h(x,w,S,C){var _=w!==null?w.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return _!==null?null:a(x,w,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case kp:return S.key===_?l(x,w,S,C):null;case gc:return S.key===_?c(x,w,S,C):null;case Ms:return _=S._init,h(x,w,_(S._payload),C)}if(bd(S)||ed(S))return _!==null?null:u(x,w,S,C,null);Ip(x,S)}return null}function p(x,w,S,C,_){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(S)||null,a(w,x,""+C,_);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case kp:return x=x.get(C.key===null?S:C.key)||null,l(w,x,C,_);case gc:return x=x.get(C.key===null?S:C.key)||null,c(w,x,C,_);case Ms:var P=C._init;return p(x,w,S,P(C._payload),_)}if(bd(C)||ed(C))return x=x.get(S)||null,u(w,x,C,_,null);Ip(w,C)}return null}function m(x,w,S,C){for(var _=null,P=null,O=w,j=w=0,I=null;O!==null&&j<S.length;j++){O.index>j?(I=O,O=null):I=O.sibling;var F=h(x,O,S[j],C);if(F===null){O===null&&(O=I);break}e&&O&&F.alternate===null&&t(x,O),w=i(F,w,j),P===null?_=F:P.sibling=F,P=F,O=I}if(j===S.length)return n(x,O),Et&&Ba(x,j),_;if(O===null){for(;j<S.length;j++)O=d(x,S[j],C),O!==null&&(w=i(O,w,j),P===null?_=O:P.sibling=O,P=O);return Et&&Ba(x,j),_}for(O=r(x,O);j<S.length;j++)I=p(O,x,j,S[j],C),I!==null&&(e&&I.alternate!==null&&O.delete(I.key===null?j:I.key),w=i(I,w,j),P===null?_=I:P.sibling=I,P=I);return e&&O.forEach(function(H){return t(x,H)}),Et&&Ba(x,j),_}function v(x,w,S,C){var _=ed(S);if(typeof _!="function")throw Error(Q(150));if(S=_.call(S),S==null)throw Error(Q(151));for(var P=_=null,O=w,j=w=0,I=null,F=S.next();O!==null&&!F.done;j++,F=S.next()){O.index>j?(I=O,O=null):I=O.sibling;var H=h(x,O,F.value,C);if(H===null){O===null&&(O=I);break}e&&O&&H.alternate===null&&t(x,O),w=i(H,w,j),P===null?_=H:P.sibling=H,P=H,O=I}if(F.done)return n(x,O),Et&&Ba(x,j),_;if(O===null){for(;!F.done;j++,F=S.next())F=d(x,F.value,C),F!==null&&(w=i(F,w,j),P===null?_=F:P.sibling=F,P=F);return Et&&Ba(x,j),_}for(O=r(x,O);!F.done;j++,F=S.next())F=p(O,x,j,F.value,C),F!==null&&(e&&F.alternate!==null&&O.delete(F.key===null?j:F.key),w=i(F,w,j),P===null?_=F:P.sibling=F,P=F);return e&&O.forEach(function($){return t(x,$)}),Et&&Ba(x,j),_}function b(x,w,S,C){if(typeof S=="object"&&S!==null&&S.type===vc&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case kp:e:{for(var _=S.key,P=w;P!==null;){if(P.key===_){if(_=S.type,_===vc){if(P.tag===7){n(x,P.sibling),w=o(P,S.props.children),w.return=x,x=w;break e}}else if(P.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Ms&&YE(_)===P.type){n(x,P.sibling),w=o(P,S.props),w.ref=id(x,P,S),w.return=x,x=w;break e}n(x,P);break}else t(x,P);P=P.sibling}S.type===vc?(w=il(S.props.children,x.mode,C,S.key),w.return=x,x=w):(C=pm(S.type,S.key,S.props,null,x.mode,C),C.ref=id(x,w,S),C.return=x,x=C)}return s(x);case gc:e:{for(P=S.key;w!==null;){if(w.key===P)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){n(x,w.sibling),w=o(w,S.children||[]),w.return=x,x=w;break e}else{n(x,w);break}else t(x,w);w=w.sibling}w=fx(S,x.mode,C),w.return=x,x=w}return s(x);case Ms:return P=S._init,b(x,w,P(S._payload),C)}if(bd(S))return m(x,w,S,C);if(ed(S))return v(x,w,S,C);Ip(x,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(n(x,w.sibling),w=o(w,S),w.return=x,x=w):(n(x,w),w=dx(S,x.mode,C),w.return=x,x=w),s(x)):n(x,w)}return b}var Qc=eO(!0),tO=eO(!1),Jm=Na(null),Xm=null,Cc=null,r1=null;function o1(){r1=Cc=Xm=null}function i1(e){var t=Jm.current;kt(Jm),e._currentValue=t}function H0(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 Ic(e,t){Xm=e,r1=Cc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ar=!0),e.firstContext=null)}function so(e){var t=e._currentValue;if(r1!==e)if(e={context:e,memoizedValue:t,next:null},Cc===null){if(Xm===null)throw Error(Q(308));Cc=e,Xm.dependencies={lanes:0,firstContext:e}}else Cc=Cc.next=e;return t}var Ja=null;function s1(e){Ja===null?Ja=[e]:Ja.push(e)}function nO(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,s1(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ji(e,r)}function Ji(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 js=!1;function a1(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rO(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 Wi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ea(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,et&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ji(e,n)}return o=r.interleaved,o===null?(t.next=t,s1(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ji(e,n)}function lm(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,Kw(e,n)}}function JE(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 Zm(e,t,n,r){var o=e.updateQueue;js=!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 h=a.lane,p=a.eventTime;if((r&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,v=a;switch(h=t,p=n,v.tag){case 1:if(m=v.payload,typeof m=="function"){d=m.call(p,d,h);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=v.payload,h=typeof m=="function"?m.call(p,d,h):m,h==null)break e;d=Rt({},d,h);break e;case 2:js=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=d):u=u.next=p,s|=h;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;h=a,a=h.next,h.next=null,o.lastBaseUpdate=h,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);yl|=s,e.lanes=s,e.memoizedState=d}}function XE(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(Q(191,o));o.call(r)}}}var Dh={},si=Na(Dh),Of=Na(Dh),Mf=Na(Dh);function Xa(e){if(e===Dh)throw Error(Q(174));return e}function l1(e,t){switch(yt(Mf,t),yt(Of,e),yt(si,Dh),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:E0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=E0(t,e)}kt(si),yt(si,t)}function eu(){kt(si),kt(Of),kt(Mf)}function oO(e){Xa(Mf.current);var t=Xa(si.current),n=E0(t,e.type);t!==n&&(yt(Of,e),yt(si,n))}function c1(e){Of.current===e&&(kt(si),kt(Of))}var Ot=Na(0);function Qm(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 ix=[];function u1(){for(var e=0;e<ix.length;e++)ix[e]._workInProgressVersionPrimary=null;ix.length=0}var cm=ss.ReactCurrentDispatcher,sx=ss.ReactCurrentBatchConfig,vl=0,jt=null,Qt=null,un=null,eg=!1,of=!1,jf=0,I5=0;function Rn(){throw Error(Q(321))}function d1(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Lo(e[n],t[n]))return!1;return!0}function f1(e,t,n,r,o,i){if(vl=i,jt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,cm.current=e===null||e.memoizedState===null?F5:z5,e=n(r,o),of){i=0;do{if(of=!1,jf=0,25<=i)throw Error(Q(301));i+=1,un=Qt=null,t.updateQueue=null,cm.current=B5,e=n(r,o)}while(of)}if(cm.current=tg,t=Qt!==null&&Qt.next!==null,vl=0,un=Qt=jt=null,eg=!1,t)throw Error(Q(300));return e}function h1(){var e=jf!==0;return jf=0,e}function Qo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return un===null?jt.memoizedState=un=e:un=un.next=e,un}function ao(){if(Qt===null){var e=jt.alternate;e=e!==null?e.memoizedState:null}else e=Qt.next;var t=un===null?jt.memoizedState:un.next;if(t!==null)un=t,Qt=e;else{if(e===null)throw Error(Q(310));Qt=e,e={memoizedState:Qt.memoizedState,baseState:Qt.baseState,baseQueue:Qt.baseQueue,queue:Qt.queue,next:null},un===null?jt.memoizedState=un=e:un=un.next=e}return un}function Rf(e,t){return typeof t=="function"?t(e):t}function ax(e){var t=ao(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=Qt,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((vl&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,jt.lanes|=u,yl|=u}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Lo(r,t.memoizedState)||(ar=!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,jt.lanes|=i,yl|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function lx(e){var t=ao(),n=t.queue;if(n===null)throw Error(Q(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);Lo(i,t.memoizedState)||(ar=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function iO(){}function sO(e,t){var n=jt,r=ao(),o=t(),i=!Lo(r.memoizedState,o);if(i&&(r.memoizedState=o,ar=!0),r=r.queue,p1(cO.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||un!==null&&un.memoizedState.tag&1){if(n.flags|=2048,If(9,lO.bind(null,n,r,o,t),void 0,null),pn===null)throw Error(Q(349));vl&30||aO(n,t,o)}return o}function aO(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=jt.updateQueue,t===null?(t={lastEffect:null,stores:null},jt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function lO(e,t,n,r){t.value=n,t.getSnapshot=r,uO(t)&&dO(e)}function cO(e,t,n){return n(function(){uO(t)&&dO(e)})}function uO(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Lo(e,n)}catch{return!0}}function dO(e){var t=Ji(e,1);t!==null&&Io(t,e,1,-1)}function ZE(e){var t=Qo();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rf,lastRenderedState:e},t.queue=e,e=e.dispatch=L5.bind(null,jt,e),[t.memoizedState,e]}function If(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=jt.updateQueue,t===null?(t={lastEffect:null,stores:null},jt.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 ao().memoizedState}function um(e,t,n,r){var o=Qo();jt.flags|=e,o.memoizedState=If(1|t,n,void 0,r===void 0?null:r)}function xv(e,t,n,r){var o=ao();r=r===void 0?null:r;var i=void 0;if(Qt!==null){var s=Qt.memoizedState;if(i=s.destroy,r!==null&&d1(r,s.deps)){o.memoizedState=If(t,n,i,r);return}}jt.flags|=e,o.memoizedState=If(1|t,n,i,r)}function QE(e,t){return um(8390656,8,e,t)}function p1(e,t){return xv(2048,8,e,t)}function hO(e,t){return xv(4,2,e,t)}function pO(e,t){return xv(4,4,e,t)}function mO(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 gO(e,t,n){return n=n!=null?n.concat([e]):null,xv(4,4,mO.bind(null,t,e),n)}function m1(){}function vO(e,t){var n=ao();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&d1(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function yO(e,t){var n=ao();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&d1(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function xO(e,t,n){return vl&21?(Lo(n,t)||(n=EN(),jt.lanes|=n,yl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ar=!0),e.memoizedState=n)}function A5(e,t){var n=dt;dt=n!==0&&4>n?n:4,e(!0);var r=sx.transition;sx.transition={};try{e(!1),t()}finally{dt=n,sx.transition=r}}function bO(){return ao().memoizedState}function D5(e,t,n){var r=na(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},wO(e))SO(t,n);else if(n=nO(e,t,n,r),n!==null){var o=Yn();Io(n,e,r,o),kO(n,t,r)}}function L5(e,t,n){var r=na(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(wO(e))SO(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,Lo(a,s)){var l=t.interleaved;l===null?(o.next=o,s1(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=nO(e,t,o,r),n!==null&&(o=Yn(),Io(n,e,r,o),kO(n,t,r))}}function wO(e){var t=e.alternate;return e===jt||t!==null&&t===jt}function SO(e,t){of=eg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Kw(e,n)}}var tg={readContext:so,useCallback:Rn,useContext:Rn,useEffect:Rn,useImperativeHandle:Rn,useInsertionEffect:Rn,useLayoutEffect:Rn,useMemo:Rn,useReducer:Rn,useRef:Rn,useState:Rn,useDebugValue:Rn,useDeferredValue:Rn,useTransition:Rn,useMutableSource:Rn,useSyncExternalStore:Rn,useId:Rn,unstable_isNewReconciler:!1},F5={readContext:so,useCallback:function(e,t){return Qo().memoizedState=[e,t===void 0?null:t],e},useContext:so,useEffect:QE,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,um(4194308,4,mO.bind(null,t,e),n)},useLayoutEffect:function(e,t){return um(4194308,4,e,t)},useInsertionEffect:function(e,t){return um(4,2,e,t)},useMemo:function(e,t){var n=Qo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qo();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=D5.bind(null,jt,e),[r.memoizedState,e]},useRef:function(e){var t=Qo();return e={current:e},t.memoizedState=e},useState:ZE,useDebugValue:m1,useDeferredValue:function(e){return Qo().memoizedState=e},useTransition:function(){var e=ZE(!1),t=e[0];return e=A5.bind(null,e[1]),Qo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=jt,o=Qo();if(Et){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),pn===null)throw Error(Q(349));vl&30||aO(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,QE(cO.bind(null,r,i,e),[e]),r.flags|=2048,If(9,lO.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Qo(),t=pn.identifierPrefix;if(Et){var n=Bi,r=zi;n=(r&~(1<<32-Ro(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=jf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=I5++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},z5={readContext:so,useCallback:vO,useContext:so,useEffect:p1,useImperativeHandle:gO,useInsertionEffect:hO,useLayoutEffect:pO,useMemo:yO,useReducer:ax,useRef:fO,useState:function(){return ax(Rf)},useDebugValue:m1,useDeferredValue:function(e){var t=ao();return xO(t,Qt.memoizedState,e)},useTransition:function(){var e=ax(Rf)[0],t=ao().memoizedState;return[e,t]},useMutableSource:iO,useSyncExternalStore:sO,useId:bO,unstable_isNewReconciler:!1},B5={readContext:so,useCallback:vO,useContext:so,useEffect:p1,useImperativeHandle:gO,useInsertionEffect:hO,useLayoutEffect:pO,useMemo:yO,useReducer:lx,useRef:fO,useState:function(){return lx(Rf)},useDebugValue:m1,useDeferredValue:function(e){var t=ao();return Qt===null?t.memoizedState=e:xO(t,Qt.memoizedState,e)},useTransition:function(){var e=lx(Rf)[0],t=ao().memoizedState;return[e,t]},useMutableSource:iO,useSyncExternalStore:sO,useId:bO,unstable_isNewReconciler:!1};function ko(e,t){if(e&&e.defaultProps){t=Rt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function W0(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Rt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var bv={isMounted:function(e){return(e=e._reactInternals)?Bl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Yn(),o=na(e),i=Wi(r,o);i.payload=t,n!=null&&(i.callback=n),t=ea(e,i,o),t!==null&&(Io(t,e,o,r),lm(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Yn(),o=na(e),i=Wi(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ea(e,i,o),t!==null&&(Io(t,e,o,r),lm(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yn(),r=na(e),o=Wi(n,r);o.tag=2,t!=null&&(o.callback=t),t=ea(e,o,r),t!==null&&(Io(t,e,r,n),lm(t,e,r))}};function eC(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?!_f(n,r)||!_f(o,i):!0}function EO(e,t,n){var r=!1,o=fa,i=t.contextType;return typeof i=="object"&&i!==null?i=so(i):(o=dr(t)?ml:zn.current,r=t.contextTypes,i=(r=r!=null)?Xc(e,o):fa),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=bv,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function tC(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&&bv.enqueueReplaceState(t,t.state,null)}function K0(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},a1(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=so(i):(i=dr(t)?ml:zn.current,o.context=Xc(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(W0(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&&bv.enqueueReplaceState(o,o.state,null),Zm(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function tu(e,t){try{var n="",r=t;do n+=pF(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 cx(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function G0(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var $5=typeof WeakMap=="function"?WeakMap:Map;function CO(e,t,n){n=Wi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rg||(rg=!0,rb=r),G0(e,t)},n}function _O(e,t,n){n=Wi(-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(){G0(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){G0(e,t),typeof r!="function"&&(ta===null?ta=new Set([this]):ta.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function nC(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new $5;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=tz.bind(null,e,t,n),t.then(e,e))}function rC(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 oC(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=Wi(-1,1),t.tag=2,ea(n,t,1))),n.lanes|=1),e)}var V5=ss.ReactCurrentOwner,ar=!1;function Gn(e,t,n,r){t.child=e===null?tO(t,null,n,r):Qc(t,e.child,n,r)}function iC(e,t,n,r,o){n=n.render;var i=t.ref;return Ic(t,o),r=f1(e,t,n,r,i,o),n=h1(),e!==null&&!ar?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Xi(e,t,o)):(Et&&n&&e1(t),t.flags|=1,Gn(e,t,r,o),t.child)}function sC(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!k1(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,TO(e,t,i,r,o)):(e=pm(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:_f,n(s,r)&&e.ref===t.ref)return Xi(e,t,o)}return t.flags|=1,e=ra(i,r),e.ref=t.ref,e.return=t,t.child=e}function TO(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(_f(i,r)&&e.ref===t.ref)if(ar=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(ar=!0);else return t.lanes=e.lanes,Xi(e,t,o)}return q0(e,t,n,r,o)}function PO(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},yt(Tc,_r),_r|=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,yt(Tc,_r),_r|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,yt(Tc,_r),_r|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,yt(Tc,_r),_r|=r;return Gn(e,t,o,n),t.child}function NO(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function q0(e,t,n,r,o){var i=dr(n)?ml:zn.current;return i=Xc(t,i),Ic(t,o),n=f1(e,t,n,r,i,o),r=h1(),e!==null&&!ar?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Xi(e,t,o)):(Et&&r&&e1(t),t.flags|=1,Gn(e,t,n,o),t.child)}function aC(e,t,n,r,o){if(dr(n)){var i=!0;Gm(t)}else i=!1;if(Ic(t,o),t.stateNode===null)dm(e,t),EO(t,n,r),K0(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=so(c):(c=dr(n)?ml:zn.current,c=Xc(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)&&tC(t,s,r,c),js=!1;var h=t.memoizedState;s.state=h,Zm(t,r,s,o),l=t.memoizedState,a!==r||h!==l||ur.current||js?(typeof u=="function"&&(W0(t,n,u,r),l=t.memoizedState),(a=js||eC(t,n,a,r,h,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,rO(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:ko(t.type,a),s.props=c,d=t.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=so(l):(l=dr(n)?ml:zn.current,l=Xc(t,l));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==d||h!==l)&&tC(t,s,r,l),js=!1,h=t.memoizedState,s.state=h,Zm(t,r,s,o);var m=t.memoizedState;a!==d||h!==m||ur.current||js?(typeof p=="function"&&(W0(t,n,p,r),m=t.memoizedState),(c=js||eC(t,n,c,r,h,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&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===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&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Y0(e,t,n,r,i,o)}function Y0(e,t,n,r,o,i){NO(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&KE(t,n,!1),Xi(e,t,i);r=t.stateNode,V5.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Qc(t,e.child,null,i),t.child=Qc(t,null,a,i)):Gn(e,t,a,i),t.memoizedState=r.state,o&&KE(t,n,!0),t.child}function OO(e){var t=e.stateNode;t.pendingContext?WE(e,t.pendingContext,t.pendingContext!==t.context):t.context&&WE(e,t.context,!1),l1(e,t.containerInfo)}function lC(e,t,n,r,o){return Zc(),n1(o),t.flags|=256,Gn(e,t,n,r),t.child}var J0={dehydrated:null,treeContext:null,retryLane:0};function X0(e){return{baseLanes:e,cachePool:null,transitions:null}}function MO(e,t,n){var r=t.pendingProps,o=Ot.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),yt(Ot,o&1),e===null)return U0(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=kv(s,r,0,null),e=il(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=X0(n),t.memoizedState=J0,e):g1(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return U5(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=ra(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=ra(a,i):(i=il(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?X0(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=J0,r}return i=e.child,e=i.sibling,r=ra(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 g1(e,t){return t=kv({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ap(e,t,n,r){return r!==null&&n1(r),Qc(t,e.child,null,n),e=g1(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function U5(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=cx(Error(Q(422))),Ap(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=kv({mode:"visible",children:r.children},o,0,null),i=il(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Qc(t,e.child,null,s),t.child.memoizedState=X0(s),t.memoizedState=J0,i);if(!(t.mode&1))return Ap(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(Q(419)),r=cx(i,r,void 0),Ap(e,t,s,r)}if(a=(s&e.childLanes)!==0,ar||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,Ji(e,o),Io(r,e,o,-1))}return S1(),r=cx(Error(Q(421))),Ap(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=nz.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Or=Qs(o.nextSibling),jr=t,Et=!0,_o=null,e!==null&&(Zr[Qr++]=zi,Zr[Qr++]=Bi,Zr[Qr++]=gl,zi=e.id,Bi=e.overflow,gl=t),t=g1(t,r.children),t.flags|=4096,t)}function cC(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),H0(e.return,t,n)}function ux(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 jO(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Gn(e,t,r.children,n),r=Ot.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&&cC(e,n,t);else if(e.tag===19)cC(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(yt(Ot,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&&Qm(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),ux(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&&Qm(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}ux(t,!0,n,null,i);break;case"together":ux(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function dm(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Xi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yl|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=ra(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ra(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function H5(e,t,n){switch(t.tag){case 3:OO(t),Zc();break;case 5:oO(t);break;case 1:dr(t.type)&&Gm(t);break;case 4:l1(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;yt(Jm,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(yt(Ot,Ot.current&1),t.flags|=128,null):n&t.child.childLanes?MO(e,t,n):(yt(Ot,Ot.current&1),e=Xi(e,t,n),e!==null?e.sibling:null);yt(Ot,Ot.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return jO(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),yt(Ot,Ot.current),r)break;return null;case 22:case 23:return t.lanes=0,PO(e,t,n)}return Xi(e,t,n)}var RO,Z0,IO,AO;RO=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}};Z0=function(){};IO=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Xa(si.current);var i=null;switch(n){case"input":o=b0(e,o),r=b0(e,r),i=[];break;case"select":o=Rt({},o,{value:void 0}),r=Rt({},r,{value:void 0}),i=[];break;case"textarea":o=k0(e,o),r=k0(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Wm)}C0(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"&&(xf.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"&&(xf.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&St("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)}};AO=function(e,t,n,r){n!==r&&(t.flags|=4)};function sd(e,t){if(!Et)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 In(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 W5(e,t,n){var r=t.pendingProps;switch(t1(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return In(t),null;case 1:return dr(t.type)&&Km(),In(t),null;case 3:return r=t.stateNode,eu(),kt(ur),kt(zn),u1(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Rp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,_o!==null&&(sb(_o),_o=null))),Z0(e,t),In(t),null;case 5:c1(t);var o=Xa(Mf.current);if(n=t.type,e!==null&&t.stateNode!=null)IO(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Q(166));return In(t),null}if(e=Xa(si.current),Rp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ti]=t,r[Nf]=i,e=(t.mode&1)!==0,n){case"dialog":St("cancel",r),St("close",r);break;case"iframe":case"object":case"embed":St("load",r);break;case"video":case"audio":for(o=0;o<Sd.length;o++)St(Sd[o],r);break;case"source":St("error",r);break;case"img":case"image":case"link":St("error",r),St("load",r);break;case"details":St("toggle",r);break;case"input":yE(r,i),St("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},St("invalid",r);break;case"textarea":bE(r,i),St("invalid",r)}C0(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&&jp(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&jp(r.textContent,a,e),o=["children",""+a]):xf.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&St("scroll",r)}switch(n){case"input":Ep(r),xE(r,i,!0);break;case"textarea":Ep(r),wE(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Wm)}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=cN(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[ti]=t,e[Nf]=r,RO(e,t,!1,!1),t.stateNode=e;e:{switch(s=_0(n,r),n){case"dialog":St("cancel",e),St("close",e),o=r;break;case"iframe":case"object":case"embed":St("load",e),o=r;break;case"video":case"audio":for(o=0;o<Sd.length;o++)St(Sd[o],e);o=r;break;case"source":St("error",e),o=r;break;case"img":case"image":case"link":St("error",e),St("load",e),o=r;break;case"details":St("toggle",e),o=r;break;case"input":yE(e,r),o=b0(e,r),St("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=Rt({},r,{value:void 0}),St("invalid",e);break;case"textarea":bE(e,r),o=k0(e,r),St("invalid",e);break;default:o=r}C0(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?fN(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&uN(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&bf(e,l):typeof l=="number"&&bf(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(xf.hasOwnProperty(i)?l!=null&&i==="onScroll"&&St("scroll",e):l!=null&&Bw(e,i,l,s))}switch(n){case"input":Ep(e),xE(e,r,!1);break;case"textarea":Ep(e),wE(e);break;case"option":r.value!=null&&e.setAttribute("value",""+da(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Oc(e,!!r.multiple,i,!1):r.defaultValue!=null&&Oc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Wm)}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 In(t),null;case 6:if(e&&t.stateNode!=null)AO(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Q(166));if(n=Xa(Mf.current),Xa(si.current),Rp(t)){if(r=t.stateNode,n=t.memoizedProps,r[ti]=t,(i=r.nodeValue!==n)&&(e=jr,e!==null))switch(e.tag){case 3:jp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&jp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ti]=t,t.stateNode=r}return In(t),null;case 13:if(kt(Ot),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Et&&Or!==null&&t.mode&1&&!(t.flags&128))QN(),Zc(),t.flags|=98560,i=!1;else if(i=Rp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Q(317));i[ti]=t}else Zc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;In(t),i=!1}else _o!==null&&(sb(_o),_o=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||Ot.current&1?nn===0&&(nn=3):S1())),t.updateQueue!==null&&(t.flags|=4),In(t),null);case 4:return eu(),Z0(e,t),e===null&&Tf(t.stateNode.containerInfo),In(t),null;case 10:return i1(t.type._context),In(t),null;case 17:return dr(t.type)&&Km(),In(t),null;case 19:if(kt(Ot),i=t.memoizedState,i===null)return In(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)sd(i,!1);else{if(nn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Qm(e),s!==null){for(t.flags|=128,sd(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 yt(Ot,Ot.current&1|2),t.child}e=e.sibling}i.tail!==null&&Bt()>nu&&(t.flags|=128,r=!0,sd(i,!1),t.lanes=4194304)}else{if(!r)if(e=Qm(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),sd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Et)return In(t),null}else 2*Bt()-i.renderingStartTime>nu&&n!==1073741824&&(t.flags|=128,r=!0,sd(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=Ot.current,yt(Ot,r?n&1|2:n&1),t):(In(t),null);case 22:case 23:return w1(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?_r&1073741824&&(In(t),t.subtreeFlags&6&&(t.flags|=8192)):In(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function K5(e,t){switch(t1(t),t.tag){case 1:return dr(t.type)&&Km(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return eu(),kt(ur),kt(zn),u1(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return c1(t),null;case 13:if(kt(Ot),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Zc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return kt(Ot),null;case 4:return eu(),null;case 10:return i1(t.type._context),null;case 22:case 23:return w1(),null;case 24:return null;default:return null}}var Dp=!1,Ln=!1,G5=typeof WeakSet=="function"?WeakSet:Set,me=null;function _c(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){At(e,t,r)}else n.current=null}function Q0(e,t,n){try{n()}catch(r){At(e,t,r)}}var uC=!1;function q5(e,t){if(D0=Vm,e=BN(),Qw(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,h=null;t:for(;;){for(var p;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),(p=d.firstChild)!==null;)h=d,d=p;for(;;){if(d===e)break t;if(h===n&&++c===o&&(a=s),h===i&&++u===r&&(l=s),(p=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(L0={focusedElem:e,selectionRange:n},Vm=!1,me=t;me!==null;)if(t=me,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,me=e;else for(;me!==null;){t=me;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:ko(t.type,v),b);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(C){At(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,me=e;break}me=t.return}return m=uC,uC=!1,m}function sf(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&&Q0(t,n,i)}o=o.next}while(o!==r)}}function wv(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 eb(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 DO(e){var t=e.alternate;t!==null&&(e.alternate=null,DO(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ti],delete t[Nf],delete t[B0],delete t[O5],delete t[M5])),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 LO(e){return e.tag===5||e.tag===3||e.tag===4}function dC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||LO(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 tb(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=Wm));else if(r!==4&&(e=e.child,e!==null))for(tb(e,t,n),e=e.sibling;e!==null;)tb(e,t,n),e=e.sibling}function nb(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(nb(e,t,n),e=e.sibling;e!==null;)nb(e,t,n),e=e.sibling}var xn=null,Co=!1;function gs(e,t,n){for(n=n.child;n!==null;)FO(e,t,n),n=n.sibling}function FO(e,t,n){if(ii&&typeof ii.onCommitFiberUnmount=="function")try{ii.onCommitFiberUnmount(hv,n)}catch{}switch(n.tag){case 5:Ln||_c(n,t);case 6:var r=xn,o=Co;xn=null,gs(e,t,n),xn=r,Co=o,xn!==null&&(Co?(e=xn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xn.removeChild(n.stateNode));break;case 18:xn!==null&&(Co?(e=xn,n=n.stateNode,e.nodeType===8?rx(e.parentNode,n):e.nodeType===1&&rx(e,n),Ef(e)):rx(xn,n.stateNode));break;case 4:r=xn,o=Co,xn=n.stateNode.containerInfo,Co=!0,gs(e,t,n),xn=r,Co=o;break;case 0:case 11:case 14:case 15:if(!Ln&&(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)&&Q0(n,t,s),o=o.next}while(o!==r)}gs(e,t,n);break;case 1:if(!Ln&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){At(n,t,a)}gs(e,t,n);break;case 21:gs(e,t,n);break;case 22:n.mode&1?(Ln=(r=Ln)||n.memoizedState!==null,gs(e,t,n),Ln=r):gs(e,t,n);break;default:gs(e,t,n)}}function fC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new G5),t.forEach(function(r){var o=rz.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function vo(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:xn=a.stateNode,Co=!1;break e;case 3:xn=a.stateNode.containerInfo,Co=!0;break e;case 4:xn=a.stateNode.containerInfo,Co=!0;break e}a=a.return}if(xn===null)throw Error(Q(160));FO(i,s,o),xn=null,Co=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){At(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)zO(t,e),t=t.sibling}function zO(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(vo(t,e),Xo(e),r&4){try{sf(3,e,e.return),wv(3,e)}catch(v){At(e,e.return,v)}try{sf(5,e,e.return)}catch(v){At(e,e.return,v)}}break;case 1:vo(t,e),Xo(e),r&512&&n!==null&&_c(n,n.return);break;case 5:if(vo(t,e),Xo(e),r&512&&n!==null&&_c(n,n.return),e.flags&32){var o=e.stateNode;try{bf(o,"")}catch(v){At(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&&aN(o,i),_0(a,s);var c=_0(a,i);for(s=0;s<l.length;s+=2){var u=l[s],d=l[s+1];u==="style"?fN(o,d):u==="dangerouslySetInnerHTML"?uN(o,d):u==="children"?bf(o,d):Bw(o,u,d,c)}switch(a){case"input":w0(o,i);break;case"textarea":lN(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?Oc(o,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?Oc(o,!!i.multiple,i.defaultValue,!0):Oc(o,!!i.multiple,i.multiple?[]:"",!1))}o[Nf]=i}catch(v){At(e,e.return,v)}}break;case 6:if(vo(t,e),Xo(e),r&4){if(e.stateNode===null)throw Error(Q(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){At(e,e.return,v)}}break;case 3:if(vo(t,e),Xo(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ef(t.containerInfo)}catch(v){At(e,e.return,v)}break;case 4:vo(t,e),Xo(e);break;case 13:vo(t,e),Xo(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(x1=Bt())),r&4&&fC(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Ln=(c=Ln)||u,vo(t,e),Ln=c):vo(t,e),Xo(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(me=e,u=e.child;u!==null;){for(d=me=u;me!==null;){switch(h=me,p=h.child,h.tag){case 0:case 11:case 14:case 15:sf(4,h,h.return);break;case 1:_c(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(v){At(r,n,v)}}break;case 5:_c(h,h.return);break;case 22:if(h.memoizedState!==null){pC(d);continue}}p!==null?(p.return=h,me=p):pC(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=dN("display",s))}catch(v){At(e,e.return,v)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(v){At(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:vo(t,e),Xo(e),r&4&&fC(e);break;case 21:break;default:vo(t,e),Xo(e)}}function Xo(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(LO(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(bf(o,""),r.flags&=-33);var i=dC(e);nb(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=dC(e);tb(e,a,s);break;default:throw Error(Q(161))}}catch(l){At(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Y5(e,t,n){me=e,BO(e)}function BO(e,t,n){for(var r=(e.mode&1)!==0;me!==null;){var o=me,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Dp;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Ln;a=Dp;var c=Ln;if(Dp=s,(Ln=l)&&!c)for(me=o;me!==null;)s=me,l=s.child,s.tag===22&&s.memoizedState!==null?mC(o):l!==null?(l.return=s,me=l):mC(o);for(;i!==null;)me=i,BO(i),i=i.sibling;me=o,Dp=a,Ln=c}hC(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,me=i):hC(e)}}function hC(e){for(;me!==null;){var t=me;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ln||wv(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ln)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ko(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&XE(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}XE(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&&Ef(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}Ln||t.flags&512&&eb(t)}catch(h){At(t,t.return,h)}}if(t===e){me=null;break}if(n=t.sibling,n!==null){n.return=t.return,me=n;break}me=t.return}}function pC(e){for(;me!==null;){var t=me;if(t===e){me=null;break}var n=t.sibling;if(n!==null){n.return=t.return,me=n;break}me=t.return}}function mC(e){for(;me!==null;){var t=me;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{wv(4,t)}catch(l){At(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){At(t,o,l)}}var i=t.return;try{eb(t)}catch(l){At(t,i,l)}break;case 5:var s=t.return;try{eb(t)}catch(l){At(t,s,l)}}}catch(l){At(t,t.return,l)}if(t===e){me=null;break}var a=t.sibling;if(a!==null){a.return=t.return,me=a;break}me=t.return}}var J5=Math.ceil,ng=ss.ReactCurrentDispatcher,v1=ss.ReactCurrentOwner,ro=ss.ReactCurrentBatchConfig,et=0,pn=null,Gt=null,kn=0,_r=0,Tc=Na(0),nn=0,Af=null,yl=0,Sv=0,y1=0,af=null,sr=null,x1=0,nu=1/0,Mi=null,rg=!1,rb=null,ta=null,Lp=!1,Ws=null,og=0,lf=0,ob=null,fm=-1,hm=0;function Yn(){return et&6?Bt():fm!==-1?fm:fm=Bt()}function na(e){return e.mode&1?et&2&&kn!==0?kn&-kn:R5.transition!==null?(hm===0&&(hm=EN()),hm):(e=dt,e!==0||(e=window.event,e=e===void 0?16:MN(e.type)),e):1}function Io(e,t,n,r){if(50<lf)throw lf=0,ob=null,Error(Q(185));Rh(e,n,r),(!(et&2)||e!==pn)&&(e===pn&&(!(et&2)&&(Sv|=n),nn===4&&Ls(e,kn)),fr(e,r),n===1&&et===0&&!(t.mode&1)&&(nu=Bt()+500,yv&&Oa()))}function fr(e,t){var n=e.callbackNode;RF(e,t);var r=$m(e,e===pn?kn:0);if(r===0)n!==null&&EE(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&EE(n),t===1)e.tag===0?j5(gC.bind(null,e)):JN(gC.bind(null,e)),P5(function(){!(et&6)&&Oa()}),n=null;else{switch(CN(r)){case 1:n=Ww;break;case 4:n=SN;break;case 16:n=Bm;break;case 536870912:n=kN;break;default:n=Bm}n=qO(n,$O.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function $O(e,t){if(fm=-1,hm=0,et&6)throw Error(Q(327));var n=e.callbackNode;if(Ac()&&e.callbackNode!==n)return null;var r=$m(e,e===pn?kn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ig(e,r);else{t=r;var o=et;et|=2;var i=UO();(pn!==e||kn!==t)&&(Mi=null,nu=Bt()+500,ol(e,t));do try{Q5();break}catch(a){VO(e,a)}while(!0);o1(),ng.current=i,et=o,Gt!==null?t=0:(pn=null,kn=0,t=nn)}if(t!==0){if(t===2&&(o=M0(e),o!==0&&(r=o,t=ib(e,o))),t===1)throw n=Af,ol(e,0),Ls(e,r),fr(e,Bt()),n;if(t===6)Ls(e,r);else{if(o=e.current.alternate,!(r&30)&&!X5(o)&&(t=ig(e,r),t===2&&(i=M0(e),i!==0&&(r=i,t=ib(e,i))),t===1))throw n=Af,ol(e,0),Ls(e,r),fr(e,Bt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:$a(e,sr,Mi);break;case 3:if(Ls(e,r),(r&130023424)===r&&(t=x1+500-Bt(),10<t)){if($m(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Yn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=z0($a.bind(null,e,sr,Mi),t);break}$a(e,sr,Mi);break;case 4:if(Ls(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Ro(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*J5(r/1960))-r,10<r){e.timeoutHandle=z0($a.bind(null,e,sr,Mi),r);break}$a(e,sr,Mi);break;case 5:$a(e,sr,Mi);break;default:throw Error(Q(329))}}}return fr(e,Bt()),e.callbackNode===n?$O.bind(null,e):null}function ib(e,t){var n=af;return e.current.memoizedState.isDehydrated&&(ol(e,t).flags|=256),e=ig(e,t),e!==2&&(t=sr,sr=n,t!==null&&sb(t)),e}function sb(e){sr===null?sr=e:sr.push.apply(sr,e)}function X5(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(!Lo(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 Ls(e,t){for(t&=~y1,t&=~Sv,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ro(t),r=1<<n;e[n]=-1,t&=~r}}function gC(e){if(et&6)throw Error(Q(327));Ac();var t=$m(e,0);if(!(t&1))return fr(e,Bt()),null;var n=ig(e,t);if(e.tag!==0&&n===2){var r=M0(e);r!==0&&(t=r,n=ib(e,r))}if(n===1)throw n=Af,ol(e,0),Ls(e,t),fr(e,Bt()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,$a(e,sr,Mi),fr(e,Bt()),null}function b1(e,t){var n=et;et|=1;try{return e(t)}finally{et=n,et===0&&(nu=Bt()+500,yv&&Oa())}}function xl(e){Ws!==null&&Ws.tag===0&&!(et&6)&&Ac();var t=et;et|=1;var n=ro.transition,r=dt;try{if(ro.transition=null,dt=1,e)return e()}finally{dt=r,ro.transition=n,et=t,!(et&6)&&Oa()}}function w1(){_r=Tc.current,kt(Tc)}function ol(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,T5(n)),Gt!==null)for(n=Gt.return;n!==null;){var r=n;switch(t1(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Km();break;case 3:eu(),kt(ur),kt(zn),u1();break;case 5:c1(r);break;case 4:eu();break;case 13:kt(Ot);break;case 19:kt(Ot);break;case 10:i1(r.type._context);break;case 22:case 23:w1()}n=n.return}if(pn=e,Gt=e=ra(e.current,null),kn=_r=t,nn=0,Af=null,y1=Sv=yl=0,sr=af=null,Ja!==null){for(t=0;t<Ja.length;t++)if(n=Ja[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}Ja=null}return e}function VO(e,t){do{var n=Gt;try{if(o1(),cm.current=tg,eg){for(var r=jt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}eg=!1}if(vl=0,un=Qt=jt=null,of=!1,jf=0,v1.current=null,n===null||n.return===null){nn=1,Af=t,Gt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=kn,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 h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=rC(s);if(p!==null){p.flags&=-257,oC(p,s,a,i,t),p.mode&1&&nC(i,c,t),t=p,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)){nC(i,c,t),S1();break e}l=Error(Q(426))}}else if(Et&&a.mode&1){var b=rC(s);if(b!==null){!(b.flags&65536)&&(b.flags|=256),oC(b,s,a,i,t),n1(tu(l,a));break e}}i=l=tu(l,a),nn!==4&&(nn=2),af===null?af=[i]:af.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=CO(i,l,t);JE(i,x);break e;case 1:a=l;var w=i.type,S=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(ta===null||!ta.has(S)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=_O(i,a,t);JE(i,C);break e}}i=i.return}while(i!==null)}WO(n)}catch(_){t=_,Gt===n&&n!==null&&(Gt=n=n.return);continue}break}while(!0)}function UO(){var e=ng.current;return ng.current=tg,e===null?tg:e}function S1(){(nn===0||nn===3||nn===2)&&(nn=4),pn===null||!(yl&268435455)&&!(Sv&268435455)||Ls(pn,kn)}function ig(e,t){var n=et;et|=2;var r=UO();(pn!==e||kn!==t)&&(Mi=null,ol(e,t));do try{Z5();break}catch(o){VO(e,o)}while(!0);if(o1(),et=n,ng.current=r,Gt!==null)throw Error(Q(261));return pn=null,kn=0,nn}function Z5(){for(;Gt!==null;)HO(Gt)}function Q5(){for(;Gt!==null&&!EF();)HO(Gt)}function HO(e){var t=GO(e.alternate,e,_r);e.memoizedProps=e.pendingProps,t===null?WO(e):Gt=t,v1.current=null}function WO(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=K5(n,t),n!==null){n.flags&=32767,Gt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{nn=6,Gt=null;return}}else if(n=W5(n,t,_r),n!==null){Gt=n;return}if(t=t.sibling,t!==null){Gt=t;return}Gt=t=e}while(t!==null);nn===0&&(nn=5)}function $a(e,t,n){var r=dt,o=ro.transition;try{ro.transition=null,dt=1,ez(e,t,n,r)}finally{ro.transition=o,dt=r}return null}function ez(e,t,n,r){do Ac();while(Ws!==null);if(et&6)throw Error(Q(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(Q(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(IF(e,i),e===pn&&(Gt=pn=null,kn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Lp||(Lp=!0,qO(Bm,function(){return Ac(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ro.transition,ro.transition=null;var s=dt;dt=1;var a=et;et|=4,v1.current=null,q5(e,n),zO(n,e),b5(L0),Vm=!!D0,L0=D0=null,e.current=n,Y5(n),CF(),et=a,dt=s,ro.transition=i}else e.current=n;if(Lp&&(Lp=!1,Ws=e,og=o),i=e.pendingLanes,i===0&&(ta=null),PF(n.stateNode),fr(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(rg)throw rg=!1,e=rb,rb=null,e;return og&1&&e.tag!==0&&Ac(),i=e.pendingLanes,i&1?e===ob?lf++:(lf=0,ob=e):lf=0,Oa(),null}function Ac(){if(Ws!==null){var e=CN(og),t=ro.transition,n=dt;try{if(ro.transition=null,dt=16>e?16:e,Ws===null)var r=!1;else{if(e=Ws,Ws=null,og=0,et&6)throw Error(Q(331));var o=et;for(et|=4,me=e.current;me!==null;){var i=me,s=i.child;if(me.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(me=c;me!==null;){var u=me;switch(u.tag){case 0:case 11:case 15:sf(8,u,i)}var d=u.child;if(d!==null)d.return=u,me=d;else for(;me!==null;){u=me;var h=u.sibling,p=u.return;if(DO(u),u===c){me=null;break}if(h!==null){h.return=p,me=h;break}me=p}}}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)}}me=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,me=s;else e:for(;me!==null;){if(i=me,i.flags&2048)switch(i.tag){case 0:case 11:case 15:sf(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,me=x;break e}me=i.return}}var w=e.current;for(me=w;me!==null;){s=me;var S=s.child;if(s.subtreeFlags&2064&&S!==null)S.return=s,me=S;else e:for(s=w;me!==null;){if(a=me,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:wv(9,a)}}catch(_){At(a,a.return,_)}if(a===s){me=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,me=C;break e}me=a.return}}if(et=o,Oa(),ii&&typeof ii.onPostCommitFiberRoot=="function")try{ii.onPostCommitFiberRoot(hv,e)}catch{}r=!0}return r}finally{dt=n,ro.transition=t}}return!1}function vC(e,t,n){t=tu(n,t),t=CO(e,t,1),e=ea(e,t,1),t=Yn(),e!==null&&(Rh(e,1,t),fr(e,t))}function At(e,t,n){if(e.tag===3)vC(e,e,n);else for(;t!==null;){if(t.tag===3){vC(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ta===null||!ta.has(r))){e=tu(n,e),e=_O(t,e,1),t=ea(t,e,1),e=Yn(),t!==null&&(Rh(t,1,e),fr(t,e));break}}t=t.return}}function tz(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Yn(),e.pingedLanes|=e.suspendedLanes&n,pn===e&&(kn&n)===n&&(nn===4||nn===3&&(kn&130023424)===kn&&500>Bt()-x1?ol(e,0):y1|=n),fr(e,t)}function KO(e,t){t===0&&(e.mode&1?(t=Tp,Tp<<=1,!(Tp&130023424)&&(Tp=4194304)):t=1);var n=Yn();e=Ji(e,t),e!==null&&(Rh(e,t,n),fr(e,n))}function nz(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),KO(e,n)}function rz(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(Q(314))}r!==null&&r.delete(t),KO(e,n)}var GO;GO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ur.current)ar=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ar=!1,H5(e,t,n);ar=!!(e.flags&131072)}else ar=!1,Et&&t.flags&1048576&&XN(t,Ym,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;dm(e,t),e=t.pendingProps;var o=Xc(t,zn.current);Ic(t,n),o=f1(null,t,r,e,o,n);var i=h1();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,dr(r)?(i=!0,Gm(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,a1(t),o.updater=bv,t.stateNode=o,o._reactInternals=t,K0(t,r,e,n),t=Y0(null,t,r,!0,i,n)):(t.tag=0,Et&&i&&e1(t),Gn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(dm(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=iz(r),e=ko(r,e),o){case 0:t=q0(null,t,r,e,n);break e;case 1:t=aC(null,t,r,e,n);break e;case 11:t=iC(null,t,r,e,n);break e;case 14:t=sC(null,t,r,ko(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ko(r,o),q0(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ko(r,o),aC(e,t,r,o,n);case 3:e:{if(OO(t),e===null)throw Error(Q(387));r=t.pendingProps,i=t.memoizedState,o=i.element,rO(e,t),Zm(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=tu(Error(Q(423)),t),t=lC(e,t,r,n,o);break e}else if(r!==o){o=tu(Error(Q(424)),t),t=lC(e,t,r,n,o);break e}else for(Or=Qs(t.stateNode.containerInfo.firstChild),jr=t,Et=!0,_o=null,n=tO(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zc(),r===o){t=Xi(e,t,n);break e}Gn(e,t,r,n)}t=t.child}return t;case 5:return oO(t),e===null&&U0(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,F0(r,o)?s=null:i!==null&&F0(r,i)&&(t.flags|=32),NO(e,t),Gn(e,t,s,n),t.child;case 6:return e===null&&U0(t),null;case 13:return MO(e,t,n);case 4:return l1(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qc(t,null,r,n):Gn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ko(r,o),iC(e,t,r,o,n);case 7:return Gn(e,t,t.pendingProps,n),t.child;case 8:return Gn(e,t,t.pendingProps.children,n),t.child;case 12:return Gn(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,yt(Jm,r._currentValue),r._currentValue=s,i!==null)if(Lo(i.value,s)){if(i.children===o.children&&!ur.current){t=Xi(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=Wi(-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),H0(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(Q(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),H0(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}Gn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Ic(t,n),o=so(o),r=r(o),t.flags|=1,Gn(e,t,r,n),t.child;case 14:return r=t.type,o=ko(r,t.pendingProps),o=ko(r.type,o),sC(e,t,r,o,n);case 15:return TO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ko(r,o),dm(e,t),t.tag=1,dr(r)?(e=!0,Gm(t)):e=!1,Ic(t,n),EO(t,r,o),K0(t,r,o,n),Y0(null,t,r,!0,e,n);case 19:return jO(e,t,n);case 22:return PO(e,t,n)}throw Error(Q(156,t.tag))};function qO(e,t){return wN(e,t)}function oz(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 no(e,t,n,r){return new oz(e,t,n,r)}function k1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function iz(e){if(typeof e=="function")return k1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Vw)return 11;if(e===Uw)return 14}return 2}function ra(e,t){var n=e.alternate;return n===null?(n=no(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 pm(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")k1(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case vc:return il(n.children,o,i,t);case $w:s=8,o|=8;break;case g0:return e=no(12,n,t,o|2),e.elementType=g0,e.lanes=i,e;case v0:return e=no(13,n,t,o),e.elementType=v0,e.lanes=i,e;case y0:return e=no(19,n,t,o),e.elementType=y0,e.lanes=i,e;case oN:return kv(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case nN:s=10;break e;case rN:s=9;break e;case Vw:s=11;break e;case Uw:s=14;break e;case Ms:s=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=no(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function il(e,t,n,r){return e=no(7,e,r,t),e.lanes=n,e}function kv(e,t,n,r){return e=no(22,e,r,t),e.elementType=oN,e.lanes=n,e.stateNode={isHidden:!1},e}function dx(e,t,n){return e=no(6,e,null,t),e.lanes=n,e}function fx(e,t,n){return t=no(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sz(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=Ky(0),this.expirationTimes=Ky(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ky(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function E1(e,t,n,r,o,i,s,a,l){return e=new sz(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=no(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},a1(i),e}function az(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:gc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function YO(e){if(!e)return fa;e=e._reactInternals;e:{if(Bl(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(dr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(dr(n))return YN(e,n,t)}return t}function JO(e,t,n,r,o,i,s,a,l){return e=E1(n,r,!0,e,o,i,s,a,l),e.context=YO(null),n=e.current,r=Yn(),o=na(n),i=Wi(r,o),i.callback=t??null,ea(n,i,o),e.current.lanes=o,Rh(e,o,r),fr(e,r),e}function Ev(e,t,n,r){var o=t.current,i=Yn(),s=na(o);return n=YO(n),t.context===null?t.context=n:t.pendingContext=n,t=Wi(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ea(o,t,s),e!==null&&(Io(e,o,s,i),lm(e,o,s)),s}function sg(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 yC(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function C1(e,t){yC(e,t),(e=e.alternate)&&yC(e,t)}function lz(){return null}var XO=typeof reportError=="function"?reportError:function(e){console.error(e)};function _1(e){this._internalRoot=e}Cv.prototype.render=_1.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Ev(e,t,null,null)};Cv.prototype.unmount=_1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;xl(function(){Ev(null,e,null,null)}),t[Yi]=null}};function Cv(e){this._internalRoot=e}Cv.prototype.unstable_scheduleHydration=function(e){if(e){var t=PN();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ds.length&&t!==0&&t<Ds[n].priority;n++);Ds.splice(n,0,e),n===0&&ON(e)}};function T1(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _v(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function xC(){}function cz(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=sg(s);i.call(c)}}var s=JO(t,r,e,0,null,!1,!1,"",xC);return e._reactRootContainer=s,e[Yi]=s.current,Tf(e.nodeType===8?e.parentNode:e),xl(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=sg(l);a.call(c)}}var l=E1(e,0,!1,null,null,!1,!1,"",xC);return e._reactRootContainer=l,e[Yi]=l.current,Tf(e.nodeType===8?e.parentNode:e),xl(function(){Ev(t,l,n,r)}),l}function Tv(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=sg(s);a.call(l)}}Ev(t,s,e,o)}else s=cz(n,t,e,o,r);return sg(s)}_N=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wd(t.pendingLanes);n!==0&&(Kw(t,n|1),fr(t,Bt()),!(et&6)&&(nu=Bt()+500,Oa()))}break;case 13:xl(function(){var r=Ji(e,1);if(r!==null){var o=Yn();Io(r,e,1,o)}}),C1(e,1)}};Gw=function(e){if(e.tag===13){var t=Ji(e,134217728);if(t!==null){var n=Yn();Io(t,e,134217728,n)}C1(e,134217728)}};TN=function(e){if(e.tag===13){var t=na(e),n=Ji(e,t);if(n!==null){var r=Yn();Io(n,e,t,r)}C1(e,t)}};PN=function(){return dt};NN=function(e,t){var n=dt;try{return dt=e,t()}finally{dt=n}};P0=function(e,t,n){switch(t){case"input":if(w0(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=vv(r);if(!o)throw Error(Q(90));sN(r),w0(r,o)}}}break;case"textarea":lN(e,n);break;case"select":t=n.value,t!=null&&Oc(e,!!n.multiple,t,!1)}};mN=b1;gN=xl;var uz={usingClientEntryPoint:!1,Events:[Ah,wc,vv,hN,pN,b1]},ad={findFiberByHostInstance:Ya,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},dz={bundleType:ad.bundleType,version:ad.version,rendererPackageName:ad.rendererPackageName,rendererConfig:ad.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ss.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=xN(e),e===null?null:e.stateNode},findFiberByHostInstance:ad.findFiberByHostInstance||lz,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 Fp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fp.isDisabled&&Fp.supportsFiber)try{hv=Fp.inject(dz),ii=Fp}catch{}}$r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uz;$r.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!T1(t))throw Error(Q(200));return az(e,t,null,n)};$r.createRoot=function(e,t){if(!T1(e))throw Error(Q(299));var n=!1,r="",o=XO;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=E1(e,1,!1,null,null,n,!1,r,o),e[Yi]=t.current,Tf(e.nodeType===8?e.parentNode:e),new _1(t)};$r.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(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=xN(t),e=e===null?null:e.stateNode,e};$r.flushSync=function(e){return xl(e)};$r.hydrate=function(e,t,n){if(!_v(t))throw Error(Q(200));return Tv(null,e,t,!0,n)};$r.hydrateRoot=function(e,t,n){if(!T1(e))throw Error(Q(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=XO;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=JO(t,null,e,1,n??null,o,!1,i,s),e[Yi]=t.current,Tf(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 Cv(t)};$r.render=function(e,t,n){if(!_v(t))throw Error(Q(200));return Tv(null,e,t,!1,n)};$r.unmountComponentAtNode=function(e){if(!_v(e))throw Error(Q(40));return e._reactRootContainer?(xl(function(){Tv(null,null,e,!1,function(){e._reactRootContainer=null,e[Yi]=null})}),!0):!1};$r.unstable_batchedUpdates=b1;$r.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!_v(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Tv(e,t,n,!1,r)};$r.version="18.3.1-next-f1338f8080-20240426";function ZO(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ZO)}catch(e){console.error(e)}}ZO(),ZP.exports=$r;var Mr=ZP.exports;const fz=Ta(Mr);var bC=Mr;Dm.createRoot=bC.createRoot,Dm.hydrateRoot=bC.hydrateRoot;var QO={exports:{}},Pv={};/**
|
|
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 hz=g,pz=Symbol.for("react.element"),mz=Symbol.for("react.fragment"),gz=Object.prototype.hasOwnProperty,vz=hz.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,yz={key:!0,ref:!0,__self:!0,__source:!0};function eM(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)gz.call(t,r)&&!yz.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:pz,type:e,key:i,ref:s,props:o,_owner:vz.current}}Pv.Fragment=mz;Pv.jsx=eM;Pv.jsxs=eM;QO.exports=Pv;var f=QO.exports;function ab(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 P1(e,t){if(e){if(typeof e=="string")return ab(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)?ab(e,t):void 0}}function Dc(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=P1(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 N1(e){return e.length>0}var Lh=Object.freeze({kind:"ok",value:void 0});function En(e){return e===void 0?Lh:{kind:"ok",value:e}}function Bn(e){return{kind:"err",error:e}}function Ou(e){return e===Lh||e.kind==="ok"}function Nv(e){return e!==Lh&&e.kind==="err"}function tM(e){var t=[],n=[],r=Dc(e),o;try{for(r.s();!(o=r.n()).done;){var i=o.value;Ou(i)?t.push(i.value):n.push(i.error)}}catch(s){r.e(s)}finally{r.f()}return N1(n)?Bn(n):En(t)}function xz(e){return tM(e)}function bz(e){var t=[],n=Dc(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;Nv(o)&&t.push(o.error)}}catch(i){n.e(i)}finally{n.f()}return N1(t)?Bn(t):Lh}function O1(e,t){return function(n){for(var r=En(t),o=0;o<n.length&&Ou(r);++o)r=e(r.value,n[o],o);return r}}function eo(e){return function(t){return Ou(t)?En(e(t.value)):t}}function bl(e){return function(t){return Ou(t)?e(t.value):t}}function wz(e){return function(t){return Nv(t)?Bn(e(t.error)):t}}function Sz(e,t){return function(n){return e(n)?En(n):Bn(t(n))}}var Ov=function(t,n){return function(r){return Ou(r)?t(r.value)?r:Bn(n(r.value)):r}},kz=Object.freeze({__proto__:null,voidOk:Lh,ok:En,err:Bn,isOk:Ou,isErr:Nv,allT:tM,all:xz,allV:bz,flatMapReduce:O1,map:eo,flatMap:bl,mapErr:wz,fromPredicate:Sz,filterOrElse:Ov});function Ez(e){if(Array.isArray(e))return e}function Cz(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 _z(){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 Xn(e,t){return Ez(e)||Cz(e,t)||P1(e,t)||_z()}function Tz(e){if(Array.isArray(e))return ab(e)}function Pz(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Nz(){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 Pc(e){return Tz(e)||Pz(e)||P1(e)||Nz()}function ce(e){"@babel/helpers - typeof";return ce=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},ce(e)}function Oz(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 nM(e){var t=Oz(e,"string");return typeof t=="symbol"?t:t+""}function U(e,t,n){return(t=nM(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wC(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?wC(Object(n),!0).forEach(function(r){U(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mz(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,nM(r.key),r)}}function Nn(e,t,n){return t&&Mz(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ag(e){return ag=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ag(e)}function rM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rM=function(){return!!e})()}function jz(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rz(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 jz(e)}function Ur(e,t,n){return t=ag(t),Rz(e,rM()?Reflect.construct(t,[],ag(e).constructor):t.apply(e,n))}function lb(e,t){return lb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},lb(e,t)}function Hr(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&&lb(e,t)}var Wr=function(){function e(){Pn(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):U({},r,[{message:o,value:i}])}}])}(),oM=Symbol("GetSchema"),iM=Symbol("Path"),Iz=Symbol("GetSource");function Az(e){return e[oM]}var We="_type",xt="_ref",cb="_tag";function Dz(e){return ce(e)==="object"&&e!==null&&We in e&&e[We]==="file"&&xt in e&&typeof e[xt]=="string"}var Lz=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 Pn(this,t),r=Ur(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Hr(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 U({},r,[{message:"Non-optional file was null or undefined.",value:o}]);if(typeof o[xt]!="string")return U({},r,[{message:"File did not have a file reference string. Got: ".concat(ce(o[xt])),value:o}]);if(this.isRemote&&o[We]!=="remote")return U({},r,[{message:"Expected a remote file, but got a local file.",value:o,fixes:["file:upload-remote"]}]);if(this.isRemote&&o[We]==="remote")return U({},r,[{message:"Remote file was not checked.",value:o,fixes:["file:check-remote"]}]);if(!this.isRemote&&o[We]==="remote")return U({},r,[{message:"Expected locale file, but found remote.",value:o,fixes:["file:download-remote"]}]);if(o[We]!=="file")return U({},r,[{message:"File did not have the valid file extension type. Got: ".concat(o[We]),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 U({},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(h){return h.trim()}),u=c.some(function(h){if(h==="*/*")return!0;if(h.endsWith("/*")){var p=h.slice(0,-2);return l.startsWith(p)}return h===l});if(!u)return U({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])}var d=ee.filenameToMimeType(o[xt]);return d?d!==l?U({},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?U({},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"]}]):U({},r,[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}]):U({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[xt]),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:U({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ce(o)!=="object"?{success:!1,errors:U({},r,[{message:"Expected object, got '".concat(ce(o),"'"),typeError:!0}])}:xt in o?We in o&&o[We]==="file"?{success:!0,data:o}:{success:!1,errors:U({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:U({},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}}}])}(Wr),Fz=function(t){return new Lz(t)};function zz(e){return e[xt].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[xt]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[xt].slice(7),metadata:e.metadata}:{url:e[xt]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function Bz(e){return ce(e)==="object"&&e!==null&&e!==void 0&&iM in e&&"val"in e}function sM(e){return e[iM]}function Df(e,t){if(ce(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(ee.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(ee.ModuleFilePathSep).concat(JSON.stringify(t))}function Zo(e,t){if(ce(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(ee.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(ee.ModuleFilePathSep).concat(JSON.stringify(t))}var M1=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.items=n,r.opt=o,r}return Hr(t,e),Nn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?U({},r,[{message:"Expected 'object', got 'null'"}]):ce(o)!=="object"?U({},r,[{message:"Expected 'object', got '".concat(ce(o),"'")}]):Array.isArray(o)?U({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(this.items).forEach(function(a){var l=Xn(a,2),c=l[0],u=l[1],d=Df(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 h=u.validate(d,o[c]);h&&s?s=$t($t({},h),s):h&&(s=h)}}),s)}},{key:"assert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:U({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(ce(o)!=="object")return{success:!1,errors:U({},r,[{message:"Expected 'object', got '".concat(ce(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:U({},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=Df(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:U({},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=Xn(r,2),i=o[0],s=o[1];return[i,s.serialize()]})),opt:this.opt}}}])}(Wr),$z=function(t){return new M1(t)},aM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.item=n,r.opt=o,r}return Hr(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=Xn(l[a],2),u=c[0],d=c[1],h=Zo(r,Number(u)),p=this.item.validate(h,d);p&&(s=$t($t({},p),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:U({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:ce(o)!=="object"?{success:!1,errors:U({},r,[{message:"Expected 'object', got '".concat(ce(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:U({},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}}}])}(Wr),Vz=function(t){return new aM(t)},kd=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.value=n,r.opt=o,r}return Hr(t,e),Nn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="string"?U({},r,[{message:"Expected 'string', got '".concat(ce(o),"'"),value:o}]):o!==this.value?U({},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:U({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:U({},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}}}])}(Wr),Uz=function(t){return new kd(t)},lM=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Pn(this,t),o=Ur(this,t),o.key=n,o.items=r,o.opt=i,o}return Hr(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 U({},r,[{message:"Missing required first argument in union",schemaError:!0}]);var a=this.key;if(!Array.isArray(this.items))return U({},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 M1)}))return U({},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 U({},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,h=d.filter(function(j){return j.items[a].opt});if(h.length>1)return U({},r,[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]);if(ce(i)!=="object")return U({},r,[{message:"Expected an object",typeError:!0}]);var p=i;if(p[a]===void 0)return U({},r,[{message:"Missing required key: ".concat(a),typeError:!0}]);var m=[],v=Dc(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 U({},r,[{message:"Found duplicate key in schema: ".concat(w.value),schemaError:!0}])}}catch(j){v.e(j)}finally{v.f()}var S=l.find(function(j){return!j.items[a].validate(r,p[a])});if(!S){var C=Df(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 U({},C,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(d.map(function(j){var I=j.items[a];if(I.type==="literal"&&I.value)return'"'.concat(I.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(I,null,2)))}).join(", "))}])}var _=S.validate(r,p);if(_)return _}else if(a instanceof kd){if(this.items.some(function(j){return!(j instanceof kd)}))return U({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var P=[a].concat(Pc(this.items));if(typeof i=="string"){var O=P.some(function(j){return!j.validate(r,i)});if(!O)return U({},r,[{message:"Union must match one of the following: ".concat(P.map(function(j){return'"'.concat(j.value,'"')}).join(", "))}])}}else return U({},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:U({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:U({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:U({},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 kd){var i,s=!1,a={},l=Dc((i=[this.key]).concat.apply(i,Pc(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof kd))return{success:!1,errors:U({},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(ce(o),"'"),typeError:!0}];continue}var d=u.assert(r,o);if(d.success){s=!0;break}else for(var h=0,p=Object.entries(d.errors);h<p.length;h++){var m,v=Xn(p[h],2),b=v[0],x=v[1];a[b]||(a[b]=[]),(m=a[b]).push.apply(m,Pc(x))}}}catch(W){l.e(W)}finally{l.f()}return s?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var w=!1,S={},C=Dc(this.items),_;try{for(C.s();!(_=C.n()).done;){var P=_.value,O=P.assert(r,o);if(O.success){w=!0;break}else for(var j=0,I=Object.entries(O.errors);j<I.length;j++){var F,H=Xn(I[j],2),$=H[0],J=H[1];S[$]||(S[$]=[]),(F=S[$]).push.apply(F,Pc(J))}}}catch(W){C.e(W)}finally{C.f()}return w?{success:!0,data:o}:{success:!1,errors:S}}else return{success:!1,errors:U({},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}}}])}(Wr),Hz=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 lM(t,r)},j1=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 Pn(this,t),r=Ur(this,t),r.options=n,r.opt=o,r.isRemote=i,r}return Hr(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 U({},r,[{message:"Non-optional image was null or undefined.",value:o}]);if(this.isRemote&&o[We]!=="remote")return U({},r,[{message:"Expected a remote image, but got a local image.",value:o,fixes:["image:upload-remote"]}]);if(this.isRemote&&o[We]==="remote")return U({},r,[{message:"Remote image was not checked.",value:o,fixes:["image:check-remote"]}]);if(!this.isRemote&&o[We]==="remote")return U({},r,[{message:"Expected locale image, but found remote.",value:o,fixes:["image:download-remote"]}]);if(typeof o[xt]!="string")return U({},r,[{message:"Image did not have a file reference string. Got: ".concat(ce(o[xt])),value:o}]);if(o[We]!=="file")return U({},r,[{message:"Image did not have the valid file extension type. Got: ".concat(o[We]),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 U({},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(h){return h.trim()}),u=c.some(function(h){if(h==="*/*")return!0;if(h.endsWith("/*")){var p=h.slice(0,-2);return l.startsWith(p)}return h===l});if(!u)return U({},r,[{message:"Mime type mismatch. Found '".concat(l,"' but schema accepts '").concat(s,"'"),value:o,fixes:["image:check-metadata"]}])}var d=ee.filenameToMimeType(o[xt]);return d?d&&l&&d!==l?U({},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&&(ce(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?U({},r,[{message:"Hotspot must be an object with x and y as numbers.",value:o}]):U({},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"]}]):U({},r,[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}]):U({},r,[{message:"Could not determine mime type from file extension. Got: ".concat(o[xt]),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:U({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:ce(o)!=="object"?{success:!1,errors:U({},r,[{message:"Expected 'object', got '".concat(ce(o),"'"),typeError:!0}])}:xt in o?We in o&&o[We]==="file"?{success:!0,data:o}:{success:!1,errors:U({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:U({},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}}}])}(Wr),Wz=function(t){return new j1(t)},cM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.options=n,r.opt=o,r}return Hr(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 U({},r,i.errors[r]);var s=i.data;if(s===null&&this.opt)return!1;if(s===null)return U({},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(M,L,q){b[M]||(b[M]=[]),b[M].push({message:L,typeError:q})},w=Dc(v),S;try{for(w.s();!(S=w.n()).done;){var C,_,P,O,j,I,F,H,$,J,W,B=S.value,A=Zo(m,v.indexOf(B));if(typeof B=="string"){a+=B.length;continue}if(ce(B)!=="object")return U({},A,[{message:"Expected nodes of type 'object' or 'string', got '".concat(ce(B),"'"),typeError:!0}]);if(B===null)return U({},A,[{message:"Expected nodes of type 'object' or 'string', got 'null'",typeError:!0}]);if(!("tag"in B))return U({},A,[{message:"Expected node to either have 'tag' or be of type 'string'",typeError:!0}]);if(typeof B.tag!="string")return U({},A,[{message:"Expected 'string', got '".concat(ce(B.tag),"'"),typeError:!0}]);if(B.tag==="h1"&&!((C=s.options.block)!==null&&C!==void 0&&C.h1)&&x(A,"'h' block is not valid",!1),B.tag==="h2"&&!((_=s.options.block)!==null&&_!==void 0&&_.h2)&&x(A,"'h2' block is not valid",!1),B.tag==="h3"&&!((P=s.options.block)!==null&&P!==void 0&&P.h3)&&x(A,"'h3' block is not valid",!1),B.tag==="h4"&&!((O=s.options.block)!==null&&O!==void 0&&O.h4)&&x(A,"'h4' block is not valid",!1),B.tag==="h5"&&!((j=s.options.block)!==null&&j!==void 0&&j.h5)&&x(A,"'h5' block is not valid",!1),B.tag==="h6"&&!((I=s.options.block)!==null&&I!==void 0&&I.h6)&&x(A,"'h6' block is not valid",!1),B.tag==="ol"&&!((F=s.options.block)!==null&&F!==void 0&&F.ol)&&x(A,"'ol' block is not valid",!1),B.tag==="ul"&&!((H=s.options.block)!==null&&H!==void 0&&H.ul)&&x(A,"'ul' block is not valid",!1),B.tag==="li"&&!(($=s.options.block)!==null&&$!==void 0&&$.ul)&&!((J=s.options.block)!==null&&J!==void 0&&J.ol)&&x(A,"'li' tag is invalid since neither 'ul' nor 'ol' block is not valid",!1),B.tag==="a"&&!((W=s.options.inline)!==null&&W!==void 0&&W.a)&&x(A,"'a' inline is not valid",!1),B.tag==="img"){var R,N;if(!((R=s.options.inline)!==null&&R!==void 0&&R.img))x(A,"'img' inline is not valid",!1);else if((N=s.options.inline)!==null&&N!==void 0&&N.img){var D,z;if(!("src"in B))return U({},A,[{message:"Expected 'src' in 'img'",typeError:!0}]);var V=Zo(A,"src"),G=ce((D=s.options.inline)===null||D===void 0?void 0:D.img)==="object"?(z=s.options.inline)===null||z===void 0?void 0:z.img.validate(V,B.src):new j1({},!1,!1).validate(V,B.src);if(G)for(var Re in G){var Y,he=Re;b[he]||(b[he]=[]),(Y=b[he]).push.apply(Y,Pc(G[he]))}}}if("styles"in B&&B.tag!=="span")return U({},A,[{message:"Cannot have styles on '".concat(B.tag,"'. This is only allowed on 'span'"),typeError:!0}]);if("styles"in B){if(!Array.isArray(B.styles))return U({},A,[{message:"Expected 'array', got '".concat(ce(B.styles),"'"),typeError:!0}]);for(var ie=Zo(A,"styles"),ne=0;ne<B.styles.length;ne++){var Oe,Ae,pe,De=B.styles[ne],Pe=Zo(ie,ne);if(typeof De!="string")return U({},Pe,[{message:"Expected 'string', got '".concat(ce(De),"'"),typeError:!0}]);De==="bold"&&!((Oe=s.options.style)!==null&&Oe!==void 0&&Oe.bold)&&x(Pe,"Style 'bold' is not valid",!1),De==="italic"&&!((Ae=s.options.style)!==null&&Ae!==void 0&&Ae.italic)&&x(Pe,"Style 'italic' is not valid",!1),De==="lineThrough"&&!((pe=s.options.style)!==null&&pe!==void 0&&pe.lineThrough)&&x(Pe,"Style 'lineThrough' is not valid",!1)}}if("children"in B){if(!Array.isArray(B.children))return U({},A,[{message:"Expected 'array', got '".concat(ce(B.children),"'"),typeError:!0}]);for(var Ze=B.children,pt=0;pt<Ze.length;pt++){var Ht=Ze[pt];if(ce(Ht)==="object"){var T=Zo(A,"children"),k=l(T,[Ht],b);if(k)return k}else if(typeof Ht=="string"){a+=Ht.length;continue}else return U({},A,[{message:"Expected 'object' or 'string', got '".concat(ce(Ht),"'"),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 h;i[r]||(i[r]=[]),(h=i[r]).push.apply(h,u)}return i}return u.length>0?U({},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:U({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])};if(!Array.isArray(o))return{success:!1,errors:U({},r,[{message:"Expected 'array', got '".concat(ce(o),"'"),typeError:!0}])};for(var i={},s=0;s<o.length;s++)this.recursiveAssert(Zo(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(ce(o)!=="object"){i[r]||(i[r]=[]),i[r].push({message:"Expected 'object', got '".concat(ce(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(ce(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=Zo(Zo(r,"children"),s);if(ce(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(ce(a),"'"),typeError:!0})}}else{i[r]||(i[r]=[]),i[r].push({message:"Expected 'array', got '".concat(ce(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(ce(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=Zo(r,c);i[d]||(i[d]=[]),i[d].push({message:"Expected 'string', got '".concat(ce(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"serialize",value:function(){var r={maxLength:this.options.maxLength,minLength:this.options.minLength,style:this.options.style,block:this.options.block,inline:this.options.inline&&{a:this.options.inline.a,img:this.options.inline.img&&ce(this.options.inline.img)==="object"?this.options.inline.img.serialize():this.options.inline.img}};return{type:"richtext",opt:this.opt,options:r}}}])}(Wr),Kz=function(t){return new cM(t??{})},uM=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.item=n,r.opt=o,r}return Hr(t,e),Nn(t,[{key:"validate",value:function(r,o){var i=this,s=!1;return this.opt&&o==null?!1:o===null?U({},r,[{message:"Expected 'object', got 'null'"}]):ce(o)!=="object"?U({},r,[{message:"Expected 'object', got '".concat(ce(o),"'")}]):Array.isArray(o)?U({},r,[{message:"Expected 'object', got 'array'"}]):(Object.entries(o).forEach(function(a){var l=Xn(a,2),c=l[0],u=l[1],d=Df(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 h=i.item.validate(d,u);h&&s?s=$t($t({},h),s):h&&(s=h)}}),s)}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:ce(o)!=="object"?{success:!1,errors:U({},r,[{message:"Expected 'object', got '".concat(ce(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:U({},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}}}])}(Wr),Gz=function(t){return new uM(t)};function qz(e){var t=e[Iz],n=t;return n}function dM(e){var t=e.indexOf(ha);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+ha.length)]}function fM(e,t){return t===""?e:"".concat(e).concat(ha).concat(t)}function Yz(e){return e instanceof M1||ce(e)==="object"&&"type"in e&&e.type==="object"}function Jz(e){return e instanceof uM||ce(e)==="object"&&"type"in e&&e.type==="record"}function Xz(e){return e instanceof aM||ce(e)==="object"&&"type"in e&&e.type==="array"}function Zz(e){return e instanceof lM||ce(e)==="object"&&"type"in e&&e.type==="union"}function Qz(e){return e instanceof cM||ce(e)==="object"&&"type"in e&&e.type==="richtext"}function e6(e){return e instanceof j1||ce(e)==="object"&&"type"in e&&e.type==="image"}function t6(e,t,n){for(var r=lg(e),o=Pc(r),i=n,s=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(Xz(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(ce(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of array, but got ".concat(ce(s)));s=s[u],i=i.item}else if(Jz(i)){if(typeof u!="string")throw Error("Invalid path: record schema ".concat(i," must have path: ").concat(u," as string"));if(ce(s)!=="object"&&!Array.isArray(s))throw Error("Schema type error: expected source to be type of record, but got ".concat(ce(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(Yz(i)){if(ce(s)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(ce(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(e6(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(Zz(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 h=s[d];if(!h)throw Error("Invalid path: union source ".concat(i," did not have required key ").concat(d," in path: ").concat(e));var p=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)===h});if(!p)throw Error("Invalid path: union schema ".concat(i," did not have a child object with ").concat(d," of value ").concat(h," in path: ").concat(e));i=p.items[u],s=s[u]}else if(Qz(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 n6(e){var t=e.split("/").slice(1);return t}function lg(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 r6(e){return e.split(",")}function o6(e){var t=dM(e),n=Xn(t,2),r=n[0],o=n[1],i=lg(o).slice(0,-1);return i.length>0?fM(r,hM(i)):r}function hM(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var i6=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.options=n,r.opt=o,r}return Hr(t,e),Nn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="number"?U({},r,[{message:"Expected 'number', got '".concat(ce(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:U({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:U({},r,[{message:"Expected 'number', got '".concat(ce(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}}}])}(Wr),s6=function(t){return new i6(t)},a6=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 Pn(this,t),r=Ur(this,t),r.options=n,r.opt=o,r.isRaw=i,r}return Hr(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 U({},r,[{message:"Expected 'string', got '".concat(ce(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?U({},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:U({},r,[{message:"Expected 'string', got '".concat(ce(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}}}])}(Wr),l6=function(t){return new a6(t)},c6=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Pn(this,t),n=Ur(this,t),n.opt=r,n}return Hr(t,e),Nn(t,[{key:"validate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?U({},r,[{message:"Expected 'boolean', got '".concat(ce(o),"'"),value:o}]):!1}},{key:"assert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:U({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:U({},r,[{message:"Expected 'boolean', got '".concat(ce(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}}}])}(Wr),u6=function(){return new c6},d6=function(e){function t(n,r){var o,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return Pn(this,t),o=Ur(this,t),o.schema=n,o.sourcePath=r,o.opt=i,o}return Hr(t,e),Nn(t,[{key:"validate",value:function(r,o){if(this.opt&&o==null)return!1;if(!this.schema)return U({},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 U({},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 U({},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 U({},r,[{message:"Value of keyOf (object) must be: ".concat(s.join(", "),". Found: ").concat(o)}])}return i.type==="record"?typeof o!="string"?U({},r,[{message:"Value of keyOf (record) must be 'string'. Found: ".concat(ce(o))}]):U({},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:U({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var i=this.schema;if(!i)return{success:!1,errors:U({},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:U({},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:U({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(ce(o),"'"),typeError:!0}])};if(s.type==="object"){var a=Object.keys(s.items);if(!a.includes(o))return{success:!1,errors:U({},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}}}])}(Wr),f6=function(t){var n;return new d6(t==null||(n=t[oM])===null||n===void 0?void 0:n.serialize(),sM(t))},h6=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Pn(this,t),r=Ur(this,t),r.options=n,r.opt=o,r}return Hr(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 U({},r,[{message:"Expected 'string', got '".concat(ce(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 U({},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 U({},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 U({},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 U({},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:U({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:U({},r,[{message:"Expected 'string', got '".concat(ce(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}}}])}(Wr),p6=function(t){return new h6(t)};function m6(){return{string:l6,boolean:u6,array:Vz,object:$z,number:s6,union:Hz,richtext:Kz,image:Wz,literal:Uz,keyOf:f6,record:Gz,file:Fz,date:p6}}function g6(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 v6=/^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;function pM(e){var t=e.match(v6);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 SC="https://remote.val.build";function y6(e){if(e!=null&&e.patch_id){var t=pM(e[xt]);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[xt],". The data format is different than what is expected. Check Val versions for mismatches."),t.error)}return{url:e[xt],metadata:e.metadata}}var Lr=Nn(function e(t){Pn(this,e),this.message=t}),x6=[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],mt=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}(mt||{});function b6(e){return new w6}var w6=function(){function e(){Pn(this,e),U(this,"A",1779033703),U(this,"B",-1150833019),U(this,"C",1013904242),U(this,"D",-1521486534),U(this,"E",1359893119),U(this,"F",-1694144372),U(this,"G",528734635),U(this,"H",1541459225),U(this,"_size",0),U(this,"_sp",0),(!zp||ld>=mt.allocTotal)&&(zp=new ArrayBuffer(mt.allocTotal),ld=0),this._byte=new Uint8Array(zp,ld,mt.allocBytes),this._word=new Int32Array(zp,ld,mt.allocWords),ld+=mt.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: "+ce(n));var r=n.byteOffset,o=n.byteLength,i=o/mt.inputBytes|0,s=0;if(i&&!(r&3)&&!(this._size%mt.inputBytes)){for(var a=new Int32Array(n.buffer,r,i*mt.inputWords);i--;)this._int32(a,s>>2),s+=mt.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%mt.inputBytes,l=a;r<s&&l<mt.inputBytes;)o[l++]=n[r++];l>=mt.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%mt.inputBytes,c=l;a<i&&c<mt.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>=mt.inputBytes&&(this._int32(o),o[0]=o[mt.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,h=0;for(r=r|0;h<mt.inputWords;)za[h++]=yo(n[r++]);for(h=mt.inputWords;h<mt.workWords;h++)za[h]=N6(za[h-2])+za[h-7]+P6(za[h-15])+za[h-16]|0;for(h=0;h<mt.workWords;h++){var p=d+T6(l)+E6(l,c,u)+x6[h]+za[h]|0,m=_6(o)+C6(o,i,s)|0;d=u,u=c,c=l,l=a+p|0,a=s,s=i,i=o,o=p+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%mt.inputBytes|0;for(r[i++]=128;i&3;)r[i++]=0;if(i>>=2,i>mt.highIndex){for(;i<mt.inputWords;)o[i++]=0;i=0,this._int32(o)}for(;i<mt.inputWords;)o[i++]=0;var s=this._size*8,a=(s&4294967295)>>>0,l=(s-a)/4294967296;return l&&(o[mt.highIndex]=yo(l)),a&&(o[mt.lowIndex]=yo(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 vs(n)+vs(r)+vs(o)+vs(i)+vs(s)+vs(a)+vs(l)+vs(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]=yo(n),d[1]=yo(r),d[2]=yo(o),d[3]=yo(i),d[4]=yo(s),d[5]=yo(a),d[6]=yo(l),d[7]=yo(c),u.slice(0,32)}}])}(),za=new Int32Array(mt.workWords),zp,ld=0,vs=function(t){return(t+4294967296).toString(16).substr(-8)},S6=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},k6=function(t){return t},yo=O6()?k6:S6,E6=function(t,n,r){return r^t&(n^r)},C6=function(t,n,r){return t&n|r&(t|n)},_6=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},T6=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},P6=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},N6=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function O6(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var R1=function(t){return b6().update(t).digest("hex")},I1={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",mov:"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"},mM=Object.fromEntries(Object.entries(I1).map(function(e){var t=Xn(e,2),n=t[0],r=t[1];return[r,n]})),M6=/^data:(.*?);base64,/;function j6(e){var t=M6.exec(e);if(t&&t[1])return t[1]}function R6(e){var t=mM[e];return t||e.split("/")[1]}function I6(e){var t=e.split(".").pop(),n=t&&I1[t];if(n)return n}function gM(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 A6(e,t,n,r,o,i){return R1(i.encode(gM(e,t,n,r,o))).slice(0,4)}function vM(e){return e.slice(0,12)}function D6(e){return vM(R1(new Uint8Array(e)))}var ha="?p=",yM="https://content.val.build",ub="https://app.val.build",ee={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:zz,convertRemoteSource:y6,getSchema:Az,getValPath:sM,getSource:qz,resolvePath:t6,splitModuleFilePathAndModulePath:dM,joinModuleFilePathAndModulePath:fM,remote:{createRemoteRef:g6,getValidationBasis:gM,getValidationHash:A6,getFileHash:D6,hashToRemoteFileHash:vM,splitRemoteRef:pM},isVal:Bz,isFile:Dz,createValPathOfItem:Df,getSHA256Hash:R1,initSchema:m6,getMimeType:j6,mimeTypeToFileExt:R6,filenameToMimeType:I6,EXT_TO_MIME_TYPES:I1,MIME_TYPES_TO_EXT:mM,ModuleFilePathSep:ha,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&&L6(n)}).join("/"))},createPatchPath:function(t){return lg(t)},splitModulePath:lg,splitModuleFilePath:n6,splitJoinedSourcePaths:r6,parentOfSourcePath:o6,patchPathToModulePath:hM,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=ee.getMimeType(t))!==null&&i!==void 0?i:"unknown",c=(s=ee.mimeTypeToFileExt(l))!==null&&s!==void 0?s:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,d=u.lastIndexOf("_"),h=u.slice(d+1,u.length);h===a&&(u=u.slice(0,d));var p=encodeURIComponent(u).replace(/%[0-9A-Fa-f]{2}/g,"").toLowerCase();return"".concat(p,"_").concat(a,".").concat(c)}return"".concat(o,".").concat(c)}};function L6(e){try{return JSON.parse(e)}catch{return e}}function Ks(e){return Array.isArray(e)}function ru(e){"@babel/helpers - typeof";return ru=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},ru(e)}function vn(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 Ce(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function He(e){Ce(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||ru(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 qn(e,t){Ce(2,arguments);var n=He(e),r=vn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Fo(e,t){Ce(2,arguments);var n=He(e),r=vn(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 F6(e,t){Ce(2,arguments);var n=He(e).getTime(),r=vn(t);return new Date(n+r)}var z6={};function Ma(){return z6}function ci(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=Ma(),d=vn((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 h=He(e),p=h.getDay(),m=(p<d?7:0)+p-d;return h.setDate(h.getDate()-m),h.setHours(0,0,0,0),h}function wl(e){return Ce(1,arguments),ci(e,{weekStartsOn:1})}function B6(e){Ce(1,arguments);var t=He(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=wl(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var s=wl(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function $6(e){Ce(1,arguments);var t=B6(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=wl(n);return r}function Lf(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 ou(e){Ce(1,arguments);var t=He(e);return t.setHours(0,0,0,0),t}var V6=864e5;function $i(e,t){Ce(2,arguments);var n=ou(e),r=ou(t),o=n.getTime()-Lf(n),i=r.getTime()-Lf(r);return Math.round((o-i)/V6)}function db(e,t){Ce(2,arguments);var n=vn(t),r=n*7;return qn(e,r)}function U6(e,t){Ce(2,arguments);var n=vn(t);return Fo(e,n*12)}function H6(e){Ce(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(ru(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=He(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function W6(e){Ce(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(ru(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=He(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function lr(e,t){Ce(2,arguments);var n=ou(e),r=ou(t);return n.getTime()===r.getTime()}function A1(e){return Ce(1,arguments),e instanceof Date||ru(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function K6(e){if(Ce(1,arguments),!A1(e)&&typeof e!="number")return!1;var t=He(e);return!isNaN(Number(t))}function Ff(e,t){Ce(2,arguments);var n=He(e),r=He(t),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}var G6=6048e5;function q6(e,t,n){Ce(2,arguments);var r=ci(e,n),o=ci(t,n),i=r.getTime()-Lf(r),s=o.getTime()-Lf(o);return Math.round((i-s)/G6)}function D1(e){Ce(1,arguments);var t=He(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function hr(e){Ce(1,arguments);var t=He(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Y6(e){Ce(1,arguments);var t=He(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function L1(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=Ma(),d=vn((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 h=He(e),p=h.getDay(),m=(p<d?-7:0)+6-(p-d);return h.setDate(h.getDate()+m),h.setHours(23,59,59,999),h}function xM(e){return Ce(1,arguments),L1(e,{weekStartsOn:1})}function J6(e,t){Ce(2,arguments);var n=vn(t);return F6(e,-n)}var X6=864e5;function Z6(e){Ce(1,arguments);var t=He(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/X6)+1}function cg(e){Ce(1,arguments);var t=1,n=He(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 bM(e){Ce(1,arguments);var t=He(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=cg(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var s=cg(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function Q6(e){Ce(1,arguments);var t=bM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=cg(n);return r}var eB=6048e5;function tB(e){Ce(1,arguments);var t=He(e),n=cg(t).getTime()-Q6(t).getTime();return Math.round(n/eB)+1}function ug(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=Ma(),d=vn((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 h=He(e),p=h.getUTCDay(),m=(p<d?7:0)+p-d;return h.setUTCDate(h.getUTCDate()-m),h.setUTCHours(0,0,0,0),h}function wM(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=He(e),d=u.getUTCFullYear(),h=Ma(),p=vn((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:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(d+1,0,p),m.setUTCHours(0,0,0,0);var v=ug(m,t),b=new Date(0);b.setUTCFullYear(d,0,p),b.setUTCHours(0,0,0,0);var x=ug(b,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=x.getTime()?d:d-1}function nB(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=Ma(),d=vn((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),h=wM(e,t),p=new Date(0);p.setUTCFullYear(h,0,d),p.setUTCHours(0,0,0,0);var m=ug(p,t);return m}var rB=6048e5;function oB(e,t){Ce(1,arguments);var n=He(e),r=ug(n,t).getTime()-nB(n,t).getTime();return Math.round(r/rB)+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 ys={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)}},Yl={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iB={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 ys.y(t,n)},Y:function(t,n,r,o){var i=wM(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=bM(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 ys.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=oB(t,o);return n==="wo"?r.ordinalNumber(i,{unit:"week"}):ut(i,n.length)},I:function(t,n,r){var o=tB(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"}):ys.d(t,n)},D:function(t,n,r){var o=Z6(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=Yl.noon:o===0?i=Yl.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=Yl.evening:o>=12?i=Yl.afternoon:o>=4?i=Yl.morning:i=Yl.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 ys.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):ys.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"}):ys.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):ys.s(t,n)},S:function(t,n){return ys.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 EC(s);case"XXXX":case"XX":return Va(s);case"XXXXX":case"XXX":default:return Va(s,":")}},x:function(t,n,r,o){var i=o._originalDate||t,s=i.getTimezoneOffset();switch(n){case"x":return EC(s);case"xxxx":case"xx":return Va(s);case"xxxxx":case"xxx":default:return Va(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"+kC(s,":");case"OOOO":default:return"GMT"+Va(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"+kC(s,":");case"zzzz":default:return"GMT"+Va(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 kC(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 EC(e,t){if(e%60===0){var n=e>0?"-":"+";return n+ut(Math.abs(e)/60,2)}return Va(e,t)}function Va(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 CC=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"})}},SM=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"})}},sB=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return CC(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}}",CC(o,n)).replace("{{time}}",SM(i,n))},aB={p:SM,P:sB},lB=["D","DD"],cB=["YY","YYYY"];function uB(e){return lB.indexOf(e)!==-1}function dB(e){return cB.indexOf(e)!==-1}function _C(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 fB={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"}},hB=function(t,n,r){var o,i=fB[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 hx(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 pB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},mB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vB={date:hx({formats:pB,defaultWidth:"full"}),time:hx({formats:mB,defaultWidth:"full"}),dateTime:hx({formats:gB,defaultWidth:"full"})},yB={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},xB=function(t,n,r,o){return yB[t]};function cd(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 bB={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},wB={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},SB={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"]},kB={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"]},EB={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"}},CB={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"}},_B=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"},TB={ordinalNumber:_B,era:cd({values:bB,defaultWidth:"wide"}),quarter:cd({values:wB,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:cd({values:SB,defaultWidth:"wide"}),day:cd({values:kB,defaultWidth:"wide"}),dayPeriod:cd({values:EB,defaultWidth:"wide",formattingValues:CB,defaultFormattingWidth:"wide"})};function ud(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)?NB(a,function(d){return d.test(s)}):PB(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 PB(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function NB(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function OB(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 MB=/^(\d+)(th|st|nd|rd)?/i,jB=/\d+/i,RB={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},IB={any:[/^b/i,/^(a|c)/i]},AB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},DB={any:[/1/i,/2/i,/3/i,/4/i]},LB={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},FB={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]},zB={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},BB={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]},$B={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},VB={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}},UB={ordinalNumber:OB({matchPattern:MB,parsePattern:jB,valueCallback:function(t){return parseInt(t,10)}}),era:ud({matchPatterns:RB,defaultMatchWidth:"wide",parsePatterns:IB,defaultParseWidth:"any"}),quarter:ud({matchPatterns:AB,defaultMatchWidth:"wide",parsePatterns:DB,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:ud({matchPatterns:LB,defaultMatchWidth:"wide",parsePatterns:FB,defaultParseWidth:"any"}),day:ud({matchPatterns:zB,defaultMatchWidth:"wide",parsePatterns:BB,defaultParseWidth:"any"}),dayPeriod:ud({matchPatterns:$B,defaultMatchWidth:"any",parsePatterns:VB,defaultParseWidth:"any"})},kM={code:"en-US",formatDistance:hB,formatLong:vB,formatRelative:xB,localize:TB,match:UB,options:{weekStartsOn:0,firstWeekContainsDate:1}},HB=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,WB=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,KB=/^'([^]*?)'?$/,GB=/''/g,qB=/[a-zA-Z]/;function as(e,t,n){var r,o,i,s,a,l,c,u,d,h,p,m,v,b,x,w,S,C;Ce(2,arguments);var _=String(t),P=Ma(),O=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:P.locale)!==null&&r!==void 0?r:kM,j=vn((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:P.firstWeekContainsDate)!==null&&s!==void 0?s:(d=P.locale)===null||d===void 0||(h=d.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&i!==void 0?i:1);if(!(j>=1&&j<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var I=vn((p=(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:P.weekStartsOn)!==null&&m!==void 0?m:(S=P.locale)===null||S===void 0||(C=S.options)===null||C===void 0?void 0:C.weekStartsOn)!==null&&p!==void 0?p:0);if(!(I>=0&&I<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!O.localize)throw new RangeError("locale must contain localize property");if(!O.formatLong)throw new RangeError("locale must contain formatLong property");var F=He(e);if(!K6(F))throw new RangeError("Invalid time value");var H=Lf(F),$=J6(F,H),J={firstWeekContainsDate:j,weekStartsOn:I,locale:O,_originalDate:F},W=_.match(WB).map(function(B){var A=B[0];if(A==="p"||A==="P"){var R=aB[A];return R(B,O.formatLong)}return B}).join("").match(HB).map(function(B){if(B==="''")return"'";var A=B[0];if(A==="'")return YB(B);var R=iB[A];if(R)return!(n!=null&&n.useAdditionalWeekYearTokens)&&dB(B)&&_C(B,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&uB(B)&&_C(B,t,String(e)),R($,B,O.localize,J);if(A.match(qB))throw new RangeError("Format string contains an unescaped latin alphabet character `"+A+"`");return B}).join("");return W}function YB(e){var t=e.match(KB);return t?t[1].replace(GB,"'"):e}function JB(e){Ce(1,arguments);var t=He(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 XB=6048e5;function ZB(e){Ce(1,arguments);var t=He(e),n=wl(t).getTime()-$6(t).getTime();return Math.round(n/XB)+1}function QB(e){Ce(1,arguments);var t=He(e),n=t.getTime();return n}function e$(e){return Ce(1,arguments),Math.floor(QB(e)/1e3)}function t$(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=He(e),d=u.getFullYear(),h=Ma(),p=vn((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:h.firstWeekContainsDate)!==null&&r!==void 0?r:(l=h.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1);if(!(p>=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setFullYear(d+1,0,p),m.setHours(0,0,0,0);var v=ci(m,t),b=new Date(0);b.setFullYear(d,0,p),b.setHours(0,0,0,0);var x=ci(b,t);return u.getTime()>=v.getTime()?d+1:u.getTime()>=x.getTime()?d:d-1}function n$(e,t){var n,r,o,i,s,a,l,c;Ce(1,arguments);var u=Ma(),d=vn((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),h=t$(e,t),p=new Date(0);p.setFullYear(h,0,d),p.setHours(0,0,0,0);var m=ci(p,t);return m}var r$=6048e5;function o$(e,t){Ce(1,arguments);var n=He(e),r=ci(n,t).getTime()-n$(n,t).getTime();return Math.round(r/r$)+1}function i$(e){Ce(1,arguments);var t=He(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function s$(e,t){return Ce(1,arguments),q6(i$(e),hr(e),t)+1}function fb(e,t){Ce(2,arguments);var n=He(e),r=He(t);return n.getTime()>r.getTime()}function EM(e,t){Ce(2,arguments);var n=He(e),r=He(t);return n.getTime()<r.getTime()}function F1(e,t){Ce(2,arguments);var n=He(e),r=He(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function a$(e,t){Ce(2,arguments);var n=He(e),r=He(t);return n.getFullYear()===r.getFullYear()}function px(e,t){Ce(2,arguments);var n=vn(t);return qn(e,-n)}function mx(e,t){Ce(2,arguments);var n=He(e),r=vn(t),o=n.getFullYear(),i=n.getDate(),s=new Date(0);s.setFullYear(o,r,15),s.setHours(0,0,0,0);var a=JB(s);return n.setMonth(r,Math.min(i,a)),n}function TC(e,t){Ce(2,arguments);var n=He(e),r=vn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var Me=function(){return Me=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},Me.apply(this,arguments)};function l$(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 CM(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 Fh(e){return e.mode==="multiple"}function zh(e){return e.mode==="range"}function Mv(e){return e.mode==="single"}var c$={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 u$(e,t){return as(e,"LLLL y",t)}function d$(e,t){return as(e,"d",t)}function f$(e,t){return as(e,"LLLL",t)}function h$(e){return"".concat(e)}function p$(e,t){return as(e,"cccccc",t)}function m$(e,t){return as(e,"yyyy",t)}var g$=Object.freeze({__proto__:null,formatCaption:u$,formatDay:d$,formatMonthCaption:f$,formatWeekNumber:h$,formatWeekdayName:p$,formatYearCaption:m$}),v$=function(e,t,n){return as(e,"do MMMM (EEEE)",n)},y$=function(){return"Month: "},x$=function(){return"Go to next month"},b$=function(){return"Go to previous month"},w$=function(e,t){return as(e,"cccc",t)},S$=function(e){return"Week n. ".concat(e)},k$=function(){return"Year: "},E$=Object.freeze({__proto__:null,labelDay:v$,labelMonthDropdown:y$,labelNext:x$,labelPrevious:b$,labelWeekNumber:S$,labelWeekday:w$,labelYearDropdown:k$});function C$(){var e="buttons",t=c$,n=kM,r={},o={},i=1,s={},a=new Date;return{captionLayout:e,classNames:t,formatters:g$,labels:E$,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:i,styles:s,today:a,mode:"default"}}function _$(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,s=e.toDate;return r?i=hr(r):t&&(i=new Date(t,0,1)),o?s=D1(o):n&&(s=new Date(n,11,31)),{fromDate:i?ou(i):void 0,toDate:s?ou(s):void 0}}var _M=g.createContext(void 0);function TM(e){var t,n=e.initialProps,r=C$(),o=_$(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;(Mv(n)||Fh(n)||zh(n))&&(l=n.onSelect);var c=Me(Me(Me({},r),n),{captionLayout:a,classNames:Me(Me({},r.classNames),n.classNames),components:Me({},n.components),formatters:Me(Me({},r.formatters),n.formatters),fromDate:i,labels:Me(Me({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Me(Me({},r.modifiers),n.modifiers),modifiersClassNames:Me(Me({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:Me(Me({},r.styles),n.styles),toDate:s});return f.jsx(_M.Provider,{value:c,children:e.children})}function bt(){var e=g.useContext(_M);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function PM(e){var t=bt(),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 T$(e){return f.jsx("svg",Me({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 NM(e){var t,n,r=e.onChange,o=e.value,i=e.children,s=e.caption,a=e.className,l=e.style,c=bt(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:T$;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 P$(e){var t,n=bt(),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(a$(r,o))for(var h=hr(r),p=r.getMonth();p<=o.getMonth();p++)d.push(mx(h,p));else for(var h=hr(new Date),p=0;p<=11;p++)d.push(mx(h,p));var m=function(b){var x=Number(b.target.value),w=mx(hr(e.displayMonth),x);e.onChange(w)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:NM;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 N$(e){var t,n=e.displayMonth,r=bt(),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,h=[];if(!o)return f.jsx(f.Fragment,{});if(!i)return f.jsx(f.Fragment,{});for(var p=o.getFullYear(),m=i.getFullYear(),v=p;v<=m;v++)h.push(TC(Y6(new Date),v));var b=function(w){var S=TC(hr(n),Number(w.target.value));e.onChange(S)},x=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:NM;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:h.map(function(w){return f.jsx("option",{value:w.getFullYear(),children:u(w,{locale:s})},w.getFullYear())})})}function O$(e,t){var n=g.useState(e),r=n[0],o=n[1],i=t===void 0?r:t;return[i,o]}function M$(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&&Ff(i,o)<0){var c=-1*(l-1);o=Fo(i,c)}return s&&Ff(o,s)<0&&(o=s),hr(o)}function j$(){var e=bt(),t=M$(e),n=O$(t,e.month),r=n[0],o=n[1],i=function(s){var a;if(!e.disableNavigation){var l=hr(s);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,i]}function R$(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=hr(e),i=hr(Fo(o,r)),s=Ff(i,o),a=[],l=0;l<s;l++){var c=Fo(o,l);a.push(c)}return n&&(a=a.reverse()),a}function I$(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=hr(e);if(!n)return Fo(a,s);var l=Ff(n,e);if(!(l<i))return Fo(a,s)}}function A$(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=hr(e);if(!n)return Fo(a,-s);var l=Ff(a,n);if(!(l<=0))return Fo(a,-s)}}var OM=g.createContext(void 0);function D$(e){var t=bt(),n=j$(),r=n[0],o=n[1],i=R$(r,t),s=I$(r,t),a=A$(r,t),l=function(d){return i.some(function(h){return F1(d,h)})},c=function(d,h){l(d)||(h&&EM(d,h)?o(Fo(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(OM.Provider,{value:u,children:e.children})}function Bh(){var e=g.useContext(OM);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function PC(e){var t,n=bt(),r=n.classNames,o=n.styles,i=n.components,s=Bh().goToMonth,a=function(u){s(Fo(u,e.displayIndex?-e.displayIndex:0))},l=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:PM,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(P$,{onChange:a,displayMonth:e.displayMonth}),f.jsx(N$,{onChange:a,displayMonth:e.displayMonth})]})}function L$(e){return f.jsx("svg",Me({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 F$(e){return f.jsx("svg",Me({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 dg=g.forwardRef(function(e,t){var n=bt(),r=n.classNames,o=n.styles,i=[r.button_reset,r.button];e.className&&i.push(e.className);var s=i.join(" "),a=Me(Me({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),f.jsx("button",Me({},e,{ref:t,type:"button",className:s,style:a}))});function z$(e){var t,n,r=bt(),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 h=c(e.previousMonth,{locale:i}),p=[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:F$,x=(n=d==null?void 0:d.IconLeft)!==null&&n!==void 0?n:L$;return f.jsxs("div",{className:s.nav,style:a.nav,children:[!e.hidePrevious&&f.jsx(dg,{name:"previous-month","aria-label":h,className:p,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(dg,{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=bt().numberOfMonths,n=Bh(),r=n.previousMonth,o=n.nextMonth,i=n.goToMonth,s=n.displayMonths,a=s.findIndex(function(m){return F1(e.displayMonth,m)}),l=a===0,c=a===s.length-1,u=t>1&&(l||!c),d=t>1&&(c||!l),h=function(){r&&i(r)},p=function(){o&&i(o)};return f.jsx(z$,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:d,nextMonth:o,previousMonth:r,onPreviousClick:h,onNextClick:p})}function B$(e){var t,n=bt(),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:PM,c;return o?c=f.jsx(l,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?c=f.jsx(PC,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?c=f.jsxs(f.Fragment,{children:[f.jsx(PC,{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 $$(e){var t=bt(),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 V$(e,t,n){for(var r=n?wl(new Date):ci(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var s=qn(r,i);o.push(s)}return o}function U$(){var e=bt(),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=V$(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 H$(){var e,t=bt(),n=t.classNames,r=t.styles,o=t.components,i=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:U$;return f.jsx("thead",{style:r.head,className:n.head,children:f.jsx(i,{})})}function W$(e){var t=bt(),n=t.locale,r=t.formatters.formatDay;return f.jsx(f.Fragment,{children:r(e.date,{locale:n})})}var z1=g.createContext(void 0);function K$(e){if(!Fh(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return f.jsx(z1.Provider,{value:t,children:e.children})}return f.jsx(G$,{initialProps:e.initialProps,children:e.children})}function G$(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,i=t.max,s=function(c,u,d){var h,p;(h=t.onDayClick)===null||h===void 0||h.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?CM([],r):[];if(u.selected){var x=b.findIndex(function(w){return lr(c,w)});b.splice(x,1)}else b.push(c);(p=t.onSelect)===null||p===void 0||p.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(h){return lr(h,c)});return!!(u&&!d)});var l={selected:r,onDayClick:s,modifiers:a};return f.jsx(z1.Provider,{value:l,children:n})}function B1(){var e=g.useContext(z1);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function q$(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?lr(o,e)&&lr(r,e)?void 0:lr(o,e)?{from:o,to:void 0}:lr(r,e)?void 0:fb(r,e)?{from:e,to:o}:{from:r,to:e}:o?fb(e,o)?{from:o,to:e}:{from:e,to:o}:r?EM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var $1=g.createContext(void 0);function Y$(e){if(!zh(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return f.jsx($1.Provider,{value:t,children:e.children})}return f.jsx(J$,{initialProps:e.initialProps,children:e.children})}function J$(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(p,m,v){var b,x;(b=t.onDayClick)===null||b===void 0||b.call(t,p,m,v);var w=q$(p,r);(x=t.onSelect)===null||x===void 0||x.call(t,w,p,m,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],s?(u.range_end=[s],lr(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:px(i,a-1),before:qn(i,a-1)}),i&&s&&u.disabled.push({after:i,before:qn(i,a-1)}),!i&&s&&u.disabled.push({after:px(s,a-1),before:qn(s,a-1)})),l){if(i&&!s&&(u.disabled.push({before:qn(i,-l+1)}),u.disabled.push({after:qn(i,l-1)})),i&&s){var d=$i(s,i)+1,h=l-d;u.disabled.push({before:px(i,h)}),u.disabled.push({after:qn(s,h)})}!i&&s&&(u.disabled.push({before:qn(s,-l+1)}),u.disabled.push({after:qn(s,l-1)}))}return f.jsx($1.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function V1(){var e=g.useContext($1);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function mm(e){return Array.isArray(e)?CM([],e):e!==void 0?[e]:[]}function X$(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=mm(o)}),t}var zo;(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"})(zo||(zo={}));var Z$=zo.Selected,ki=zo.Disabled,Q$=zo.Hidden,e8=zo.Today,gx=zo.RangeEnd,vx=zo.RangeMiddle,yx=zo.RangeStart,t8=zo.Outside;function n8(e,t,n){var r,o=(r={},r[Z$]=mm(e.selected),r[ki]=mm(e.disabled),r[Q$]=mm(e.hidden),r[e8]=[e.today],r[gx]=[],r[vx]=[],r[yx]=[],r[t8]=[],r);return e.fromDate&&o[ki].push({before:e.fromDate}),e.toDate&&o[ki].push({after:e.toDate}),Fh(e)?o[ki]=o[ki].concat(t.modifiers[ki]):zh(e)&&(o[ki]=o[ki].concat(n.modifiers[ki]),o[yx]=n.modifiers[yx],o[vx]=n.modifiers[vx],o[gx]=n.modifiers[gx]),o}var MM=g.createContext(void 0);function r8(e){var t=bt(),n=B1(),r=V1(),o=n8(t,n,r),i=X$(t.modifiers),s=Me(Me({},o),i);return f.jsx(MM.Provider,{value:s,children:e.children})}function jM(){var e=g.useContext(MM);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function o8(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function i8(e){return!!(e&&typeof e=="object"&&"from"in e)}function s8(e){return!!(e&&typeof e=="object"&&"after"in e)}function a8(e){return!!(e&&typeof e=="object"&&"before"in e)}function l8(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function c8(e,t){var n,r=t.from,o=t.to;if(r&&o){var i=$i(o,r)<0;i&&(n=[o,r],r=n[0],o=n[1]);var s=$i(e,r)>=0&&$i(o,e)>=0;return s}return o?lr(o,e):r?lr(r,e):!1}function u8(e){return A1(e)}function d8(e){return Array.isArray(e)&&e.every(A1)}function f8(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(u8(n))return lr(e,n);if(d8(n))return n.includes(e);if(i8(n))return c8(e,n);if(l8(n))return n.dayOfWeek.includes(e.getDay());if(o8(n)){var r=$i(n.before,e),o=$i(n.after,e),i=r>0,s=o<0,a=fb(n.before,n.after);return a?s&&i:i||s}return s8(n)?$i(e,n.after)>0:a8(n)?$i(n.before,e)>0:typeof n=="function"?n(e):!1})}function U1(e,t,n){var r=Object.keys(t).reduce(function(i,s){var a=t[s];return f8(e,a)&&i.push(s),i},[]),o={};return r.forEach(function(i){return o[i]=!0}),n&&!F1(e,n)&&(o.outside=!0),o}function h8(e,t){for(var n=hr(e[0]),r=D1(e[e.length-1]),o,i,s=n;s<=r;){var a=U1(s,t),l=!a.disabled&&!a.hidden;if(!l){s=qn(s,1);continue}if(a.selected)return s;a.today&&!i&&(i=s),o||(o=s),s=qn(s,1)}return i||o}var p8=365;function RM(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,h={day:qn,week:db,month:Fo,year:U6,startOfWeek:function(b){return o.ISOWeek?wl(b):ci(b,{locale:d,weekStartsOn:l})},endOfWeek:function(b){return o.ISOWeek?xM(b):L1(b,{locale:d,weekStartsOn:l})}},p=h[n](e,r==="after"?1:-1);r==="before"&&c?p=H6([c,p]):r==="after"&&u&&(p=W6([u,p]));var m=!0;if(i){var v=U1(p,i);m=!v.disabled&&!v.hidden}return m?p:a.count>p8?a.lastFocused:RM(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:Me(Me({},a),{count:a.count+1})})}var IM=g.createContext(void 0);function m8(e){var t=Bh(),n=jM(),r=g.useState(),o=r[0],i=r[1],s=g.useState(),a=s[0],l=s[1],c=h8(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,d=function(){l(o),i(void 0)},h=function(b){i(b)},p=bt(),m=function(b,x){if(o){var w=RM(o,{moveBy:b,direction:x,context:p,modifiers:n});lr(o,w)||(t.goToDate(w,o),h(w))}},v={focusedDay:o,focusTarget:u,blur:d,focus:h,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(IM.Provider,{value:v,children:e.children})}function H1(){var e=g.useContext(IM);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function g8(e,t){var n=jM(),r=U1(e,n,t);return r}var W1=g.createContext(void 0);function v8(e){if(!Mv(e.initialProps)){var t={selected:void 0};return f.jsx(W1.Provider,{value:t,children:e.children})}return f.jsx(y8,{initialProps:e.initialProps,children:e.children})}function y8(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(W1.Provider,{value:o,children:n})}function AM(){var e=g.useContext(W1);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function x8(e,t){var n=bt(),r=AM(),o=B1(),i=V1(),s=H1(),a=s.focusDayAfter,l=s.focusDayBefore,c=s.focusWeekAfter,u=s.focusWeekBefore,d=s.blur,h=s.focus,p=s.focusMonthBefore,m=s.focusMonthAfter,v=s.focusYearBefore,b=s.focusYearAfter,x=s.focusStartOfWeek,w=s.focusEndOfWeek,S=function(R){var N,D,z,V;Mv(n)?(N=r.onDayClick)===null||N===void 0||N.call(r,e,t,R):Fh(n)?(D=o.onDayClick)===null||D===void 0||D.call(o,e,t,R):zh(n)?(z=i.onDayClick)===null||z===void 0||z.call(i,e,t,R):(V=n.onDayClick)===null||V===void 0||V.call(n,e,t,R)},C=function(R){var N;h(e),(N=n.onDayFocus)===null||N===void 0||N.call(n,e,t,R)},_=function(R){var N;d(),(N=n.onDayBlur)===null||N===void 0||N.call(n,e,t,R)},P=function(R){var N;(N=n.onDayMouseEnter)===null||N===void 0||N.call(n,e,t,R)},O=function(R){var N;(N=n.onDayMouseLeave)===null||N===void 0||N.call(n,e,t,R)},j=function(R){var N;(N=n.onDayPointerEnter)===null||N===void 0||N.call(n,e,t,R)},I=function(R){var N;(N=n.onDayPointerLeave)===null||N===void 0||N.call(n,e,t,R)},F=function(R){var N;(N=n.onDayTouchCancel)===null||N===void 0||N.call(n,e,t,R)},H=function(R){var N;(N=n.onDayTouchEnd)===null||N===void 0||N.call(n,e,t,R)},$=function(R){var N;(N=n.onDayTouchMove)===null||N===void 0||N.call(n,e,t,R)},J=function(R){var N;(N=n.onDayTouchStart)===null||N===void 0||N.call(n,e,t,R)},W=function(R){var N;(N=n.onDayKeyUp)===null||N===void 0||N.call(n,e,t,R)},B=function(R){var N;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():p();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}(N=n.onDayKeyDown)===null||N===void 0||N.call(n,e,t,R)},A={onClick:S,onFocus:C,onBlur:_,onKeyDown:B,onKeyUp:W,onMouseEnter:P,onMouseLeave:O,onPointerEnter:j,onPointerLeave:I,onTouchCancel:F,onTouchEnd:H,onTouchMove:$,onTouchStart:J};return A}function b8(){var e=bt(),t=AM(),n=B1(),r=V1(),o=Mv(e)?t.selected:Fh(e)?n.selected:zh(e)?r.selected:void 0;return o}function w8(e){return Object.values(zo).includes(e)}function S8(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(w8(r)){var i=e.classNames["day_".concat(r)];i&&n.push(i)}}),n}function k8(e,t){var n=Me({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=Me(Me({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function E8(e,t,n){var r,o,i,s=bt(),a=H1(),l=g8(e,t),c=x8(e,l),u=b8(),d=!!(s.onDayClick||s.mode!=="default");g.useEffect(function(){var P;l.outside||a.focusedDay&&d&&lr(a.focusedDay,e)&&((P=n.current)===null||P===void 0||P.focus())},[a.focusedDay,e,n,d,l.outside]);var h=S8(s,l).join(" "),p=k8(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:W$,b=f.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),x={style:p,className:h,children:b,role:"gridcell"},w=a.focusTarget&&lr(a.focusTarget,e)&&!l.outside,S=a.focusedDay&&lr(a.focusedDay,e),C=Me(Me(Me({},x),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=S||w?0:-1,r)),c),_={isButton:d,isHidden:m,activeModifiers:l,selectedDays:u,buttonProps:C,divProps:x};return _}function C8(e){var t=g.useRef(null),n=E8(e.date,e.displayMonth,t);return n.isHidden?f.jsx("div",{role:"gridcell"}):n.isButton?f.jsx(dg,Me({name:"day",ref:t},n.buttonProps)):f.jsx("div",Me({},n.divProps))}function _8(e){var t=e.number,n=e.dates,r=bt(),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}),h=function(p){o(t,n,p)};return f.jsx(dg,{name:"week-number","aria-label":d,className:s.weeknumber,style:i.weeknumber,onClick:h,children:u})}function T8(e){var t,n,r=bt(),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:C8,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:_8,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})},e$(d))})]})}function OC(e,t,n){for(var r=n!=null&&n.ISOWeek?xM(t):L1(t,n),o=n!=null&&n.ISOWeek?wl(e):ci(e,n),i=$i(r,o),s=[],a=0;a<=i;a++)s.push(qn(o,a));var l=s.reduce(function(c,u){var d=n!=null&&n.ISOWeek?ZB(u):o$(u,n),h=c.find(function(p){return p.weekNumber===d});return h?(h.dates.push(u),c):(c.push({weekNumber:d,dates:[u]}),c)},[]);return l}function P8(e,t){var n=OC(hr(e),D1(e),t);if(t!=null&&t.useFixedWeeks){var r=s$(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],s=db(i,6-r),a=OC(db(i,1),s,t);n.push.apply(n,a)}}return n}function N8(e){var t,n,r,o=bt(),i=o.locale,s=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,d=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,m=P8(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:i,weekStartsOn:d,firstWeekContainsDate:h}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:H$,b=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:T8,x=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:$$;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 O8(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var M8=O8()?g.useLayoutEffect:g.useEffect,xx=!1,j8=0;function MC(){return"react-day-picker-".concat(++j8)}function R8(e){var t,n=e??(xx?MC():null),r=g.useState(n),o=r[0],i=r[1];return M8(function(){o===null&&i(MC())},[]),g.useEffect(function(){xx===!1&&(xx=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function I8(e){var t,n,r=bt(),o=r.dir,i=r.classNames,s=r.styles,a=r.components,l=Bh().displayMonths,c=R8(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],h=s.month,p=e.displayIndex===0,m=e.displayIndex===l.length-1,v=!p&&!m;o==="rtl"&&(t=[p,m],m=t[0],p=t[1]),p&&(d.push(i.caption_start),h=Me(Me({},h),s.caption_start)),m&&(d.push(i.caption_end),h=Me(Me({},h),s.caption_end)),v&&(d.push(i.caption_between),h=Me(Me({},h),s.caption_between));var b=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:B$;return f.jsxs("div",{className:d.join(" "),style:h,children:[f.jsx(b,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),f.jsx(N8,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function A8(e){var t=bt(),n=t.classNames,r=t.styles;return f.jsx("div",{className:n.months,style:r.months,children:e.children})}function D8(e){var t,n,r=e.initialProps,o=bt(),i=H1(),s=Bh(),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=Me(Me({},o.styles.root),o.style),h=Object.keys(r).filter(function(m){return m.startsWith("data-")}).reduce(function(m,v){var b;return Me(Me({},m),(b={},b[v]=r[v],b))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:A8;return f.jsx("div",Me({className:u.join(" "),style:d,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:f.jsx(p,{children:s.displayMonths.map(function(m,v){return f.jsx(I8,{displayIndex:v,displayMonth:m},v)})})}))}function L8(e){var t=e.children,n=l$(e,["children"]);return f.jsx(TM,{initialProps:n,children:f.jsx(D$,{children:f.jsx(v8,{initialProps:n,children:f.jsx(K$,{initialProps:n,children:f.jsx(Y$,{initialProps:n,children:f.jsx(r8,{children:f.jsx(m8,{children:t})})})})})})})}function F8(e){return f.jsx(L8,Me({},e,{children:f.jsx(D8,{initialProps:e})}))}var jv={},Rv={};Rv.byteLength=$8;Rv.toByteArray=U8;Rv.fromByteArray=K8;var ni=[],Yr=[],z8=typeof Uint8Array<"u"?Uint8Array:Array,bx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Jl=0,B8=bx.length;Jl<B8;++Jl)ni[Jl]=bx[Jl],Yr[bx.charCodeAt(Jl)]=Jl;Yr[45]=62;Yr[95]=63;function DM(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 $8(e){var t=DM(e),n=t[0],r=t[1];return(n+r)*3/4-r}function V8(e,t,n){return(t+n)*3/4-n}function U8(e){var t,n=DM(e),r=n[0],o=n[1],i=new z8(V8(e,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)t=Yr[e.charCodeAt(l)]<<18|Yr[e.charCodeAt(l+1)]<<12|Yr[e.charCodeAt(l+2)]<<6|Yr[e.charCodeAt(l+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return o===2&&(t=Yr[e.charCodeAt(l)]<<2|Yr[e.charCodeAt(l+1)]>>4,i[s++]=t&255),o===1&&(t=Yr[e.charCodeAt(l)]<<10|Yr[e.charCodeAt(l+1)]<<4|Yr[e.charCodeAt(l+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function H8(e){return ni[e>>18&63]+ni[e>>12&63]+ni[e>>6&63]+ni[e&63]}function W8(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(H8(r));return o.join("")}function K8(e){for(var t,n=e.length,r=n%3,o=[],i=16383,s=0,a=n-r;s<a;s+=i)o.push(W8(e,s,s+i>a?a:s+i));return r===1?(t=e[n-1],o.push(ni[t>>2]+ni[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(ni[t>>10]+ni[t>>4&63]+ni[t<<2&63]+"=")),o.join("")}var K1={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */K1.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,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-u)-1,p>>=-u,u+=a;u>0;i=i*256+e[t+d],d+=h,u-=8);for(s=i&(1<<-u)-1,i>>=-u,u+=r;u>0;s=s*256+e[t+d],d+=h,u-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(p?-1:1)*s*Math.pow(2,i-r)};K1.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,u=(1<<c)-1,d=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=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+=h/l:t+=h*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+p]=a&255,p+=m,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+p]=s&255,p+=m,s/=256,c-=8);e[n+p-m]|=v*128};/*!
|
|
44
|
+
* The buffer module from node.js, for the browser.
|
|
45
|
+
*
|
|
46
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
47
|
+
* @license MIT
|
|
48
|
+
*/(function(e){var t=Rv,n=K1,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 T=new Uint8Array(1),k={foo:function(){return 42}};return Object.setPrototypeOf(k,Uint8Array.prototype),Object.setPrototypeOf(T,k),T.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(T){if(T>o)throw new RangeError('The value "'+T+'" is invalid for option "size"');var k=new Uint8Array(T);return Object.setPrototypeOf(k,a.prototype),k}function a(T,k,E){if(typeof T=="number"){if(typeof k=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(T)}return l(T,k,E)}a.poolSize=8192;function l(T,k,E){if(typeof T=="string")return h(T,k);if(ArrayBuffer.isView(T))return m(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(Ze(T,ArrayBuffer)||T&&Ze(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ze(T,SharedArrayBuffer)||T&&Ze(T.buffer,SharedArrayBuffer)))return v(T,k,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var M=T.valueOf&&T.valueOf();if(M!=null&&M!==T)return a.from(M,k,E);var L=b(T);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),k,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,k,E){return l(T,k,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function u(T,k,E){return c(T),T<=0?s(T):k!==void 0?typeof E=="string"?s(T).fill(k,E):s(T).fill(k):s(T)}a.alloc=function(T,k,E){return u(T,k,E)};function d(T){return c(T),s(T<0?0:x(T)|0)}a.allocUnsafe=function(T){return d(T)},a.allocUnsafeSlow=function(T){return d(T)};function h(T,k){if((typeof k!="string"||k==="")&&(k="utf8"),!a.isEncoding(k))throw new TypeError("Unknown encoding: "+k);var E=S(T,k)|0,M=s(E),L=M.write(T,k);return L!==E&&(M=M.slice(0,L)),M}function p(T){for(var k=T.length<0?0:x(T.length)|0,E=s(k),M=0;M<k;M+=1)E[M]=T[M]&255;return E}function m(T){if(Ze(T,Uint8Array)){var k=new Uint8Array(T);return v(k.buffer,k.byteOffset,k.byteLength)}return p(T)}function v(T,k,E){if(k<0||T.byteLength<k)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<k+(E||0))throw new RangeError('"length" is outside of buffer bounds');var M;return k===void 0&&E===void 0?M=new Uint8Array(T):E===void 0?M=new Uint8Array(T,k):M=new Uint8Array(T,k,E),Object.setPrototypeOf(M,a.prototype),M}function b(T){if(a.isBuffer(T)){var k=x(T.length)|0,E=s(k);return E.length===0||T.copy(E,0,0,k),E}if(T.length!==void 0)return typeof T.length!="number"||pt(T.length)?s(0):p(T);if(T.type==="Buffer"&&Array.isArray(T.data))return p(T.data)}function x(T){if(T>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return T|0}function w(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==a.prototype},a.compare=function(k,E){if(Ze(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),Ze(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(k)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===E)return 0;for(var M=k.length,L=E.length,q=0,Z=Math.min(M,L);q<Z;++q)if(k[q]!==E[q]){M=k[q],L=E[q];break}return M<L?-1:L<M?1:0},a.isEncoding=function(k){switch(String(k).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(k,E){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return a.alloc(0);var M;if(E===void 0)for(E=0,M=0;M<k.length;++M)E+=k[M].length;var L=a.allocUnsafe(E),q=0;for(M=0;M<k.length;++M){var Z=k[M];if(Ze(Z,Uint8Array))q+Z.length>L.length?a.from(Z).copy(L,q):Uint8Array.prototype.set.call(L,Z,q);else if(a.isBuffer(Z))Z.copy(L,q);else throw new TypeError('"list" argument must be an Array of Buffers');q+=Z.length}return L};function S(T,k){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||Ze(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,M=arguments.length>2&&arguments[2]===!0;if(!M&&E===0)return 0;for(var L=!1;;)switch(k){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Oe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return De(T).length;default:if(L)return M?-1:Oe(T).length;k=(""+k).toLowerCase(),L=!0}}a.byteLength=S;function C(T,k,E){var M=!1;if((k===void 0||k<0)&&(k=0),k>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,k>>>=0,E<=k))return"";for(T||(T="utf8");;)switch(T){case"hex":return D(this,k,E);case"utf8":case"utf-8":return W(this,k,E);case"ascii":return R(this,k,E);case"latin1":case"binary":return N(this,k,E);case"base64":return J(this,k,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,k,E);default:if(M)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),M=!0}}a.prototype._isBuffer=!0;function _(T,k,E){var M=T[k];T[k]=T[E],T[E]=M}a.prototype.swap16=function(){var k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<k;E+=2)_(this,E,E+1);return this},a.prototype.swap32=function(){var k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<k;E+=4)_(this,E,E+3),_(this,E+1,E+2);return this},a.prototype.swap64=function(){var k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<k;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 k=this.length;return k===0?"":arguments.length===0?W(this,0,k):C.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(k){if(!a.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k?!0:a.compare(this,k)===0},a.prototype.inspect=function(){var k="",E=e.INSPECT_MAX_BYTES;return k=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(k+=" ... "),"<Buffer "+k+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(k,E,M,L,q){if(Ze(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),!a.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(E===void 0&&(E=0),M===void 0&&(M=k?k.length:0),L===void 0&&(L=0),q===void 0&&(q=this.length),E<0||M>k.length||L<0||q>this.length)throw new RangeError("out of range index");if(L>=q&&E>=M)return 0;if(L>=q)return-1;if(E>=M)return 1;if(E>>>=0,M>>>=0,L>>>=0,q>>>=0,this===k)return 0;for(var Z=q-L,Ye=M-E,it=Math.min(Z,Ye),vt=this.slice(L,q),ln=k.slice(E,M),lt=0;lt<it;++lt)if(vt[lt]!==ln[lt]){Z=vt[lt],Ye=ln[lt];break}return Z<Ye?-1:Ye<Z?1:0};function P(T,k,E,M,L){if(T.length===0)return-1;if(typeof E=="string"?(M=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,pt(E)&&(E=L?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(L)return-1;E=T.length-1}else if(E<0)if(L)E=0;else return-1;if(typeof k=="string"&&(k=a.from(k,M)),a.isBuffer(k))return k.length===0?-1:O(T,k,E,M,L);if(typeof k=="number")return k=k&255,typeof Uint8Array.prototype.indexOf=="function"?L?Uint8Array.prototype.indexOf.call(T,k,E):Uint8Array.prototype.lastIndexOf.call(T,k,E):O(T,[k],E,M,L);throw new TypeError("val must be string, number or Buffer")}function O(T,k,E,M,L){var q=1,Z=T.length,Ye=k.length;if(M!==void 0&&(M=String(M).toLowerCase(),M==="ucs2"||M==="ucs-2"||M==="utf16le"||M==="utf-16le")){if(T.length<2||k.length<2)return-1;q=2,Z/=2,Ye/=2,E/=2}function it(ds,Ju){return q===1?ds[Ju]:ds.readUInt16BE(Ju*q)}var vt;if(L){var ln=-1;for(vt=E;vt<Z;vt++)if(it(T,vt)===it(k,ln===-1?0:vt-ln)){if(ln===-1&&(ln=vt),vt-ln+1===Ye)return ln*q}else ln!==-1&&(vt-=vt-ln),ln=-1}else for(E+Ye>Z&&(E=Z-Ye),vt=E;vt>=0;vt--){for(var lt=!0,go=0;go<Ye;go++)if(it(T,vt+go)!==it(k,go)){lt=!1;break}if(lt)return vt}return-1}a.prototype.includes=function(k,E,M){return this.indexOf(k,E,M)!==-1},a.prototype.indexOf=function(k,E,M){return P(this,k,E,M,!0)},a.prototype.lastIndexOf=function(k,E,M){return P(this,k,E,M,!1)};function j(T,k,E,M){E=Number(E)||0;var L=T.length-E;M?(M=Number(M),M>L&&(M=L)):M=L;var q=k.length;M>q/2&&(M=q/2);for(var Z=0;Z<M;++Z){var Ye=parseInt(k.substr(Z*2,2),16);if(pt(Ye))return Z;T[E+Z]=Ye}return Z}function I(T,k,E,M){return Pe(Oe(k,T.length-E),T,E,M)}function F(T,k,E,M){return Pe(Ae(k),T,E,M)}function H(T,k,E,M){return Pe(De(k),T,E,M)}function $(T,k,E,M){return Pe(pe(k,T.length-E),T,E,M)}a.prototype.write=function(k,E,M,L){if(E===void 0)L="utf8",M=this.length,E=0;else if(M===void 0&&typeof E=="string")L=E,M=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(M)?(M=M>>>0,L===void 0&&(L="utf8")):(L=M,M=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var q=this.length-E;if((M===void 0||M>q)&&(M=q),k.length>0&&(M<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");for(var Z=!1;;)switch(L){case"hex":return j(this,k,E,M);case"utf8":case"utf-8":return I(this,k,E,M);case"ascii":case"latin1":case"binary":return F(this,k,E,M);case"base64":return H(this,k,E,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,k,E,M);default:if(Z)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),Z=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(T,k,E){return k===0&&E===T.length?t.fromByteArray(T):t.fromByteArray(T.slice(k,E))}function W(T,k,E){E=Math.min(T.length,E);for(var M=[],L=k;L<E;){var q=T[L],Z=null,Ye=q>239?4:q>223?3:q>191?2:1;if(L+Ye<=E){var it,vt,ln,lt;switch(Ye){case 1:q<128&&(Z=q);break;case 2:it=T[L+1],(it&192)===128&&(lt=(q&31)<<6|it&63,lt>127&&(Z=lt));break;case 3:it=T[L+1],vt=T[L+2],(it&192)===128&&(vt&192)===128&&(lt=(q&15)<<12|(it&63)<<6|vt&63,lt>2047&&(lt<55296||lt>57343)&&(Z=lt));break;case 4:it=T[L+1],vt=T[L+2],ln=T[L+3],(it&192)===128&&(vt&192)===128&&(ln&192)===128&&(lt=(q&15)<<18|(it&63)<<12|(vt&63)<<6|ln&63,lt>65535&<<1114112&&(Z=lt))}}Z===null?(Z=65533,Ye=1):Z>65535&&(Z-=65536,M.push(Z>>>10&1023|55296),Z=56320|Z&1023),M.push(Z),L+=Ye}return A(M)}var B=4096;function A(T){var k=T.length;if(k<=B)return String.fromCharCode.apply(String,T);for(var E="",M=0;M<k;)E+=String.fromCharCode.apply(String,T.slice(M,M+=B));return E}function R(T,k,E){var M="";E=Math.min(T.length,E);for(var L=k;L<E;++L)M+=String.fromCharCode(T[L]&127);return M}function N(T,k,E){var M="";E=Math.min(T.length,E);for(var L=k;L<E;++L)M+=String.fromCharCode(T[L]);return M}function D(T,k,E){var M=T.length;(!k||k<0)&&(k=0),(!E||E<0||E>M)&&(E=M);for(var L="",q=k;q<E;++q)L+=Ht[T[q]];return L}function z(T,k,E){for(var M=T.slice(k,E),L="",q=0;q<M.length-1;q+=2)L+=String.fromCharCode(M[q]+M[q+1]*256);return L}a.prototype.slice=function(k,E){var M=this.length;k=~~k,E=E===void 0?M:~~E,k<0?(k+=M,k<0&&(k=0)):k>M&&(k=M),E<0?(E+=M,E<0&&(E=0)):E>M&&(E=M),E<k&&(E=k);var L=this.subarray(k,E);return Object.setPrototypeOf(L,a.prototype),L};function V(T,k,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+k>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(k,E,M){k=k>>>0,E=E>>>0,M||V(k,E,this.length);for(var L=this[k],q=1,Z=0;++Z<E&&(q*=256);)L+=this[k+Z]*q;return L},a.prototype.readUintBE=a.prototype.readUIntBE=function(k,E,M){k=k>>>0,E=E>>>0,M||V(k,E,this.length);for(var L=this[k+--E],q=1;E>0&&(q*=256);)L+=this[k+--E]*q;return L},a.prototype.readUint8=a.prototype.readUInt8=function(k,E){return k=k>>>0,E||V(k,1,this.length),this[k]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(k,E){return k=k>>>0,E||V(k,2,this.length),this[k]|this[k+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(k,E){return k=k>>>0,E||V(k,2,this.length),this[k]<<8|this[k+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(k,E){return k=k>>>0,E||V(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+this[k+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]*16777216+(this[k+1]<<16|this[k+2]<<8|this[k+3])},a.prototype.readIntLE=function(k,E,M){k=k>>>0,E=E>>>0,M||V(k,E,this.length);for(var L=this[k],q=1,Z=0;++Z<E&&(q*=256);)L+=this[k+Z]*q;return q*=128,L>=q&&(L-=Math.pow(2,8*E)),L},a.prototype.readIntBE=function(k,E,M){k=k>>>0,E=E>>>0,M||V(k,E,this.length);for(var L=E,q=1,Z=this[k+--L];L>0&&(q*=256);)Z+=this[k+--L]*q;return q*=128,Z>=q&&(Z-=Math.pow(2,8*E)),Z},a.prototype.readInt8=function(k,E){return k=k>>>0,E||V(k,1,this.length),this[k]&128?(255-this[k]+1)*-1:this[k]},a.prototype.readInt16LE=function(k,E){k=k>>>0,E||V(k,2,this.length);var M=this[k]|this[k+1]<<8;return M&32768?M|4294901760:M},a.prototype.readInt16BE=function(k,E){k=k>>>0,E||V(k,2,this.length);var M=this[k+1]|this[k]<<8;return M&32768?M|4294901760:M},a.prototype.readInt32LE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},a.prototype.readInt32BE=function(k,E){return k=k>>>0,E||V(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},a.prototype.readFloatLE=function(k,E){return k=k>>>0,E||V(k,4,this.length),n.read(this,k,!0,23,4)},a.prototype.readFloatBE=function(k,E){return k=k>>>0,E||V(k,4,this.length),n.read(this,k,!1,23,4)},a.prototype.readDoubleLE=function(k,E){return k=k>>>0,E||V(k,8,this.length),n.read(this,k,!0,52,8)},a.prototype.readDoubleBE=function(k,E){return k=k>>>0,E||V(k,8,this.length),n.read(this,k,!1,52,8)};function G(T,k,E,M,L,q){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(k>L||k<q)throw new RangeError('"value" argument is out of bounds');if(E+M>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(k,E,M,L){if(k=+k,E=E>>>0,M=M>>>0,!L){var q=Math.pow(2,8*M)-1;G(this,k,E,M,q,0)}var Z=1,Ye=0;for(this[E]=k&255;++Ye<M&&(Z*=256);)this[E+Ye]=k/Z&255;return E+M},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(k,E,M,L){if(k=+k,E=E>>>0,M=M>>>0,!L){var q=Math.pow(2,8*M)-1;G(this,k,E,M,q,0)}var Z=M-1,Ye=1;for(this[E+Z]=k&255;--Z>=0&&(Ye*=256);)this[E+Z]=k/Ye&255;return E+M},a.prototype.writeUint8=a.prototype.writeUInt8=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,1,255,0),this[E]=k&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,2,65535,0),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,2,65535,0),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,4,4294967295,0),this[E+3]=k>>>24,this[E+2]=k>>>16,this[E+1]=k>>>8,this[E]=k&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,4,4294967295,0),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4},a.prototype.writeIntLE=function(k,E,M,L){if(k=+k,E=E>>>0,!L){var q=Math.pow(2,8*M-1);G(this,k,E,M,q-1,-q)}var Z=0,Ye=1,it=0;for(this[E]=k&255;++Z<M&&(Ye*=256);)k<0&&it===0&&this[E+Z-1]!==0&&(it=1),this[E+Z]=(k/Ye>>0)-it&255;return E+M},a.prototype.writeIntBE=function(k,E,M,L){if(k=+k,E=E>>>0,!L){var q=Math.pow(2,8*M-1);G(this,k,E,M,q-1,-q)}var Z=M-1,Ye=1,it=0;for(this[E+Z]=k&255;--Z>=0&&(Ye*=256);)k<0&&it===0&&this[E+Z+1]!==0&&(it=1),this[E+Z]=(k/Ye>>0)-it&255;return E+M},a.prototype.writeInt8=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,1,127,-128),k<0&&(k=255+k+1),this[E]=k&255,E+1},a.prototype.writeInt16LE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,2,32767,-32768),this[E]=k&255,this[E+1]=k>>>8,E+2},a.prototype.writeInt16BE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,2,32767,-32768),this[E]=k>>>8,this[E+1]=k&255,E+2},a.prototype.writeInt32LE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,4,2147483647,-2147483648),this[E]=k&255,this[E+1]=k>>>8,this[E+2]=k>>>16,this[E+3]=k>>>24,E+4},a.prototype.writeInt32BE=function(k,E,M){return k=+k,E=E>>>0,M||G(this,k,E,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[E]=k>>>24,this[E+1]=k>>>16,this[E+2]=k>>>8,this[E+3]=k&255,E+4};function Re(T,k,E,M,L,q){if(E+M>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function Y(T,k,E,M,L){return k=+k,E=E>>>0,L||Re(T,k,E,4),n.write(T,k,E,M,23,4),E+4}a.prototype.writeFloatLE=function(k,E,M){return Y(this,k,E,!0,M)},a.prototype.writeFloatBE=function(k,E,M){return Y(this,k,E,!1,M)};function he(T,k,E,M,L){return k=+k,E=E>>>0,L||Re(T,k,E,8),n.write(T,k,E,M,52,8),E+8}a.prototype.writeDoubleLE=function(k,E,M){return he(this,k,E,!0,M)},a.prototype.writeDoubleBE=function(k,E,M){return he(this,k,E,!1,M)},a.prototype.copy=function(k,E,M,L){if(!a.isBuffer(k))throw new TypeError("argument should be a Buffer");if(M||(M=0),!L&&L!==0&&(L=this.length),E>=k.length&&(E=k.length),E||(E=0),L>0&&L<M&&(L=M),L===M||k.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(M<0||M>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),k.length-E<L-M&&(L=k.length-E+M);var q=L-M;return this===k&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,M,L):Uint8Array.prototype.set.call(k,this.subarray(M,L),E),q},a.prototype.fill=function(k,E,M,L){if(typeof k=="string"){if(typeof E=="string"?(L=E,E=0,M=this.length):typeof M=="string"&&(L=M,M=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!a.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(k.length===1){var q=k.charCodeAt(0);(L==="utf8"&&q<128||L==="latin1")&&(k=q)}}else typeof k=="number"?k=k&255:typeof k=="boolean"&&(k=Number(k));if(E<0||this.length<E||this.length<M)throw new RangeError("Out of range index");if(M<=E)return this;E=E>>>0,M=M===void 0?this.length:M>>>0,k||(k=0);var Z;if(typeof k=="number")for(Z=E;Z<M;++Z)this[Z]=k;else{var Ye=a.isBuffer(k)?k:a.from(k,L),it=Ye.length;if(it===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(Z=0;Z<M-E;++Z)this[Z+E]=Ye[Z%it]}return this};var ie=/[^+/0-9A-Za-z-_]/g;function ne(T){if(T=T.split("=")[0],T=T.trim().replace(ie,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function Oe(T,k){k=k||1/0;for(var E,M=T.length,L=null,q=[],Z=0;Z<M;++Z){if(E=T.charCodeAt(Z),E>55295&&E<57344){if(!L){if(E>56319){(k-=3)>-1&&q.push(239,191,189);continue}else if(Z+1===M){(k-=3)>-1&&q.push(239,191,189);continue}L=E;continue}if(E<56320){(k-=3)>-1&&q.push(239,191,189),L=E;continue}E=(L-55296<<10|E-56320)+65536}else L&&(k-=3)>-1&&q.push(239,191,189);if(L=null,E<128){if((k-=1)<0)break;q.push(E)}else if(E<2048){if((k-=2)<0)break;q.push(E>>6|192,E&63|128)}else if(E<65536){if((k-=3)<0)break;q.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((k-=4)<0)break;q.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return q}function Ae(T){for(var k=[],E=0;E<T.length;++E)k.push(T.charCodeAt(E)&255);return k}function pe(T,k){for(var E,M,L,q=[],Z=0;Z<T.length&&!((k-=2)<0);++Z)E=T.charCodeAt(Z),M=E>>8,L=E%256,q.push(L),q.push(M);return q}function De(T){return t.toByteArray(ne(T))}function Pe(T,k,E,M){for(var L=0;L<M&&!(L+E>=k.length||L>=T.length);++L)k[L+E]=T[L];return L}function Ze(T,k){return T instanceof k||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===k.name}function pt(T){return T!==T}var Ht=function(){for(var T="0123456789abcdef",k=new Array(256),E=0;E<16;++E)for(var M=E*16,L=0;L<16;++L)k[M+L]=T[E]+T[L];return k}()})(jv);var Qe;(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})(Qe||(Qe={}));var hb;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(hb||(hb={}));const fe=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fs=e=>{switch(typeof e){case"undefined":return fe.undefined;case"string":return fe.string;case"number":return isNaN(e)?fe.nan:fe.number;case"boolean":return fe.boolean;case"function":return fe.function;case"bigint":return fe.bigint;case"symbol":return fe.symbol;case"object":return Array.isArray(e)?fe.array:e===null?fe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?fe.promise:typeof Map<"u"&&e instanceof Map?fe.map:typeof Set<"u"&&e instanceof Set?fe.set:typeof Date<"u"&&e instanceof Date?fe.date:fe.object;default:return fe.unknown}},X=Qe.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"]),G8=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Rr 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 Rr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.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()}}Rr.create=e=>new Rr(e);const iu=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===fe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Qe.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qe.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qe.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${Qe.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.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}"`:Qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.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 X.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 X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,Qe.assertNever(e)}return{message:n}};let LM=iu;function q8(e){LM=e}function fg(){return LM}const hg=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}},Y8=[];function de(e,t){const n=fg(),r=hg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===iu?void 0:iu].filter(o=>!!o)});e.common.issues.push(r)}class $n{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 je;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 $n.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 je;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 je=Object.freeze({status:"aborted"}),Nc=e=>({status:"dirty",value:e}),Zn=e=>({status:"valid",value:e}),pb=e=>e.status==="aborted",mb=e=>e.status==="dirty",zf=e=>e.status==="valid",Bf=e=>typeof Promise<"u"&&e instanceof Promise;function pg(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 FM(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 be;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(be||(be={}));var Ed,Cd;class ui{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 jC=(e,t)=>{if(zf(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 Rr(e.common.issues);return this._error=n,this._error}}};function Fe(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 Fs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Fs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new $n,ctx:{common:t.parent.common,data:t.data,parsedType:Fs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Bf(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:Fs(t)},i=this._parseSync({data:t,path:o.path,parent:o});return jC(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:Fs(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Bf(o)?o:Promise.resolve(o));return jC(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:X.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 Bo({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return ai.create(this,this._def)}nullable(){return va.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ao.create(this,this._def)}promise(){return au.create(this,this._def)}or(t){return Hf.create([this,t],this._def)}and(t){return Wf.create(this,t,this._def)}transform(t){return new Bo({...Fe(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Jf({...Fe(this._def),innerType:this,defaultValue:n,typeName:Ne.ZodDefault})}brand(){return new G1({typeName:Ne.ZodBranded,type:this,...Fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Xf({...Fe(this._def),innerType:this,catchValue:n,typeName:Ne.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return $h.create(this,t)}readonly(){return Zf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const J8=/^c[^\s-]{8,}$/i,X8=/^[0-9a-z]+$/,Z8=/^[0-9A-HJKMNP-TV-Z]{26}$/,Q8=/^[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,eV=/^[a-z0-9_-]{21}$/i,tV=/^[-+]?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)?)??$/,nV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wx;const oV=/^(?:(?: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])$/,iV=/^(([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})))$/,sV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zM="((\\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])))",aV=new RegExp(`^${zM}$`);function BM(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 lV(e){return new RegExp(`^${BM(e)}$`)}function $M(e){let t=`${zM}T${BM(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 cV(e,t){return!!((t==="v4"||!t)&&oV.test(e)||(t==="v6"||!t)&&iV.test(e))}class Mo extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==fe.string){const i=this._getOrReturnCtx(t);return de(i,{code:X.invalid_type,expected:fe.string,received:i.parsedType}),je}const r=new $n;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:X.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),de(o,{code:X.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?de(o,{code:X.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&de(o,{code:X.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")nV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"email",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")wx||(wx=new RegExp(rV,"u")),wx.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"emoji",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Q8.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"uuid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")eV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"nanoid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")J8.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")X8.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"cuid2",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Z8.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ulid",code:X.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),de(o,{validation:"url",code:X.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),de(o,{validation:"regex",code:X.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),de(o,{code:X.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),de(o,{code:X.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),de(o,{code:X.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?$M(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:X.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?aV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:X.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?lV(i).test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{code:X.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?tV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"duration",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?cV(t.data,i.version)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"ip",code:X.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?sV.test(t.data)||(o=this._getOrReturnCtx(t,o),de(o,{validation:"base64",code:X.invalid_string,message:i.message}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:X.invalid_string,...be.errToObj(r)})}_addCheck(t){return new Mo({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...be.errToObj(t)})}url(t){return this._addCheck({kind:"url",...be.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...be.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...be.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...be.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...be.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...be.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...be.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...be.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...be.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,...be.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,...be.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...be.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...be.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...be.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...be.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...be.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...be.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...be.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...be.errToObj(n)})}nonempty(t){return this.min(1,be.errToObj(t))}trim(){return new Mo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Mo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Mo({...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}}Mo.create=e=>{var t;return new Mo({checks:[],typeName:Ne.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Fe(e)})};function uV(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 pa 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)!==fe.number){const i=this._getOrReturnCtx(t);return de(i,{code:X.invalid_type,expected:fe.number,received:i.parsedType}),je}let r;const o=new $n;for(const i of this._def.checks)i.kind==="int"?Qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:X.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),de(r,{code:X.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),de(r,{code:X.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?uV(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),de(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),de(r,{code:X.not_finite,message:i.message}),o.dirty()):Qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,o){return new pa({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(o)}]})}_addCheck(t){return new pa({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:be.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:be.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:be.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:be.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"&&Qe.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)}}pa.create=e=>new pa({checks:[],typeName:Ne.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class ma 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)!==fe.bigint){const i=this._getOrReturnCtx(t);return de(i,{code:X.invalid_type,expected:fe.bigint,received:i.parsedType}),je}let r;const o=new $n;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),de(r,{code:X.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),de(r,{code:X.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),de(r,{code:X.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,be.toString(n))}gt(t,n){return this.setLimit("min",t,!1,be.toString(n))}lte(t,n){return this.setLimit("max",t,!0,be.toString(n))}lt(t,n){return this.setLimit("max",t,!1,be.toString(n))}setLimit(t,n,r,o){return new ma({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:be.toString(o)}]})}_addCheck(t){return new ma({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:be.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:be.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:be.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:be.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:be.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}}ma.create=e=>{var t;return new ma({checks:[],typeName:Ne.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Fe(e)})};class $f extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==fe.boolean){const r=this._getOrReturnCtx(t);return de(r,{code:X.invalid_type,expected:fe.boolean,received:r.parsedType}),je}return Zn(t.data)}}$f.create=e=>new $f({typeName:Ne.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Sl extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==fe.date){const i=this._getOrReturnCtx(t);return de(i,{code:X.invalid_type,expected:fe.date,received:i.parsedType}),je}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return de(i,{code:X.invalid_date}),je}const r=new $n;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),de(o,{code:X.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),de(o,{code:X.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Sl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:be.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:be.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}}Sl.create=e=>new Sl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ne.ZodDate,...Fe(e)});class mg extends Ve{_parse(t){if(this._getType(t)!==fe.symbol){const r=this._getOrReturnCtx(t);return de(r,{code:X.invalid_type,expected:fe.symbol,received:r.parsedType}),je}return Zn(t.data)}}mg.create=e=>new mg({typeName:Ne.ZodSymbol,...Fe(e)});class Vf extends Ve{_parse(t){if(this._getType(t)!==fe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:X.invalid_type,expected:fe.undefined,received:r.parsedType}),je}return Zn(t.data)}}Vf.create=e=>new Vf({typeName:Ne.ZodUndefined,...Fe(e)});class Uf extends Ve{_parse(t){if(this._getType(t)!==fe.null){const r=this._getOrReturnCtx(t);return de(r,{code:X.invalid_type,expected:fe.null,received:r.parsedType}),je}return Zn(t.data)}}Uf.create=e=>new Uf({typeName:Ne.ZodNull,...Fe(e)});class su extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Zn(t.data)}}su.create=e=>new su({typeName:Ne.ZodAny,...Fe(e)});class sl extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Zn(t.data)}}sl.create=e=>new sl({typeName:Ne.ZodUnknown,...Fe(e)});class Zi extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return de(n,{code:X.invalid_type,expected:fe.never,received:n.parsedType}),je}}Zi.create=e=>new Zi({typeName:Ne.ZodNever,...Fe(e)});class gg extends Ve{_parse(t){if(this._getType(t)!==fe.undefined){const r=this._getOrReturnCtx(t);return de(r,{code:X.invalid_type,expected:fe.void,received:r.parsedType}),je}return Zn(t.data)}}gg.create=e=>new gg({typeName:Ne.ZodVoid,...Fe(e)});class Ao extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==fe.array)return de(n,{code:X.invalid_type,expected:fe.array,received:n.parsedType}),je;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(s||a)&&(de(n,{code:s?X.too_big:X.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&&(de(n,{code:X.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&&(de(n,{code:X.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 ui(n,s,n.path,a)))).then(s=>$n.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new ui(n,s,n.path,a)));return $n.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Ao({...this._def,minLength:{value:t,message:be.toString(n)}})}max(t,n){return new Ao({...this._def,maxLength:{value:t,message:be.toString(n)}})}length(t,n){return new Ao({...this._def,exactLength:{value:t,message:be.toString(n)}})}nonempty(t){return this.min(1,t)}}Ao.create=(e,t)=>new Ao({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Fe(t)});function lc(e){if(e instanceof Nt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ai.create(lc(r))}return new Nt({...e._def,shape:()=>t})}else return e instanceof Ao?new Ao({...e._def,type:lc(e.element)}):e instanceof ai?ai.create(lc(e.unwrap())):e instanceof va?va.create(lc(e.unwrap())):e instanceof di?di.create(e.items.map(t=>lc(t))):e}class Nt 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=Qe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==fe.object){const c=this._getOrReturnCtx(t);return de(c,{code:X.invalid_type,expected:fe.object,received:c.parsedType}),je}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Zi&&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 ui(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Zi){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&&(de(o,{code:X.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 ui(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,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>$n.mergeObjectSync(r,c)):$n.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return be.errToObj,new Nt({...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=be.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Nt({...this._def,unknownKeys:"strip"})}passthrough(){return new Nt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Nt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Nt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ne.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Nt({...this._def,catchall:t})}pick(t){const n={};return Qe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Nt({...this._def,shape:()=>n})}omit(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Nt({...this._def,shape:()=>n})}deepPartial(){return lc(this)}partial(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Nt({...this._def,shape:()=>n})}required(t){const n={};return Qe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ai;)i=i._def.innerType;n[r]=i}}),new Nt({...this._def,shape:()=>n})}keyof(){return VM(Qe.objectKeys(this.shape))}}Nt.create=(e,t)=>new Nt({shape:()=>e,unknownKeys:"strip",catchall:Zi.create(),typeName:Ne.ZodObject,...Fe(t)});Nt.strictCreate=(e,t)=>new Nt({shape:()=>e,unknownKeys:"strict",catchall:Zi.create(),typeName:Ne.ZodObject,...Fe(t)});Nt.lazycreate=(e,t)=>new Nt({shape:e,unknownKeys:"strip",catchall:Zi.create(),typeName:Ne.ZodObject,...Fe(t)});class Hf 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 Rr(a.ctx.common.issues));return de(n,{code:X.invalid_union,unionErrors:s}),je}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 Rr(l));return de(n,{code:X.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}}Hf.create=(e,t)=>new Hf({options:e,typeName:Ne.ZodUnion,...Fe(t)});const Pi=e=>e instanceof Gf?Pi(e.schema):e instanceof Bo?Pi(e.innerType()):e instanceof qf?[e.value]:e instanceof ga?e.options:e instanceof Yf?Qe.objectValues(e.enum):e instanceof Jf?Pi(e._def.innerType):e instanceof Vf?[void 0]:e instanceof Uf?[null]:e instanceof ai?[void 0,...Pi(e.unwrap())]:e instanceof va?[null,...Pi(e.unwrap())]:e instanceof G1||e instanceof Zf?Pi(e.unwrap()):e instanceof Xf?Pi(e._def.innerType):[];class Iv extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.object)return de(n,{code:X.invalid_type,expected:fe.object,received:n.parsedType}),je;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}):(de(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}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=Pi(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 Iv({typeName:Ne.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Fe(r)})}}function gb(e,t){const n=Fs(e),r=Fs(t);if(e===t)return{valid:!0,data:e};if(n===fe.object&&r===fe.object){const o=Qe.objectKeys(t),i=Qe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=gb(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===fe.array&&r===fe.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=gb(s,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===fe.date&&r===fe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Wf extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,s)=>{if(pb(i)||pb(s))return je;const a=gb(i.value,s.value);return a.valid?((mb(i)||mb(s))&&n.dirty(),{status:n.value,value:a.data}):(de(r,{code:X.invalid_intersection_types}),je)};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}))}}Wf.create=(e,t,n)=>new Wf({left:e,right:t,typeName:Ne.ZodIntersection,...Fe(n)});class di extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.array)return de(r,{code:X.invalid_type,expected:fe.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return de(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(de(r,{code:X.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 ui(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>$n.mergeArray(n,s)):$n.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new di({...this._def,rest:t})}}di.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new di({items:e,typeName:Ne.ZodTuple,rest:null,...Fe(t)})};class Kf 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!==fe.object)return de(r,{code:X.invalid_type,expected:fe.object,received:r.parsedType}),je;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new ui(r,a,r.path,a)),value:s._parse(new ui(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?$n.mergeObjectAsync(n,o):$n.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new Kf({keyType:t,valueType:n,typeName:Ne.ZodRecord,...Fe(r)}):new Kf({keyType:Mo.create(),valueType:t,typeName:Ne.ZodRecord,...Fe(n)})}}class vg 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!==fe.map)return de(r,{code:X.invalid_type,expected:fe.map,received:r.parsedType}),je;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new ui(r,a,r.path,[c,"key"])),value:i._parse(new ui(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 je;(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 je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}vg.create=(e,t,n)=>new vg({valueType:t,keyType:e,typeName:Ne.ZodMap,...Fe(n)});class kl extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==fe.set)return de(r,{code:X.invalid_type,expected:fe.set,received:r.parsedType}),je;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(de(r,{code:X.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&&(de(r,{code:X.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 je;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 ui(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new kl({...this._def,minSize:{value:t,message:be.toString(n)}})}max(t,n){return new kl({...this._def,maxSize:{value:t,message:be.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}kl.create=(e,t)=>new kl({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Fe(t)});class Lc extends Ve{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.function)return de(n,{code:X.invalid_type,expected:fe.function,received:n.parsedType}),je;function r(a,l){return hg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,fg(),iu].filter(c=>!!c),issueData:{code:X.invalid_arguments,argumentsError:l}})}function o(a,l){return hg({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,fg(),iu].filter(c=>!!c),issueData:{code:X.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof au){const a=this;return Zn(async function(...l){const c=new Rr([]),u=await a._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(r(l,p)),c}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,i).catch(p=>{throw c.addIssue(o(d,p)),c})})}else{const a=this;return Zn(function(...l){const c=a._def.args.safeParse(l,i);if(!c.success)throw new Rr([r(l,c.error)]);const u=Reflect.apply(s,this,c.data),d=a._def.returns.safeParse(u,i);if(!d.success)throw new Rr([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Lc({...this._def,args:di.create(t).rest(sl.create())})}returns(t){return new Lc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Lc({args:t||di.create([]).rest(sl.create()),returns:n||sl.create(),typeName:Ne.ZodFunction,...Fe(r)})}}class Gf 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})}}Gf.create=(e,t)=>new Gf({getter:e,typeName:Ne.ZodLazy,...Fe(t)});class qf extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return de(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:t.data}}get value(){return this._def.value}}qf.create=(e,t)=>new qf({value:e,typeName:Ne.ZodLiteral,...Fe(t)});function VM(e,t){return new ga({values:e,typeName:Ne.ZodEnum,...Fe(t)})}class ga extends Ve{constructor(){super(...arguments),Ed.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{expected:Qe.joinValues(r),received:n.parsedType,code:X.invalid_type}),je}if(pg(this,Ed)||FM(this,Ed,new Set(this._def.values)),!pg(this,Ed).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return de(n,{received:n.data,code:X.invalid_enum_value,options:r}),je}return Zn(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 ga.create(t,{...this._def,...n})}exclude(t,n=this._def){return ga.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ed=new WeakMap;ga.create=VM;class Yf extends Ve{constructor(){super(...arguments),Cd.set(this,void 0)}_parse(t){const n=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==fe.string&&r.parsedType!==fe.number){const o=Qe.objectValues(n);return de(r,{expected:Qe.joinValues(o),received:r.parsedType,code:X.invalid_type}),je}if(pg(this,Cd)||FM(this,Cd,new Set(Qe.getValidEnumValues(this._def.values))),!pg(this,Cd).has(t.data)){const o=Qe.objectValues(n);return de(r,{received:r.data,code:X.invalid_enum_value,options:o}),je}return Zn(t.data)}get enum(){return this._def.values}}Cd=new WeakMap;Yf.create=(e,t)=>new Yf({values:e,typeName:Ne.ZodNativeEnum,...Fe(t)});class au extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==fe.promise&&n.common.async===!1)return de(n,{code:X.invalid_type,expected:fe.promise,received:n.parsedType}),je;const r=n.parsedType===fe.promise?n.data:Promise.resolve(n.data);return Zn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}au.create=(e,t)=>new au({type:e,typeName:Ne.ZodPromise,...Fe(t)});class Bo extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.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=>{de(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 je;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?je:l.status==="dirty"||n.value==="dirty"?Nc(l.value):l});{if(n.value==="aborted")return je;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||n.value==="dirty"?Nc(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"?je:(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"?je:(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(!zf(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=>zf(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):s);Qe.assertNever(o)}}Bo.create=(e,t,n)=>new Bo({schema:e,typeName:Ne.ZodEffects,effect:t,...Fe(n)});Bo.createWithPreprocess=(e,t,n)=>new Bo({schema:t,effect:{type:"preprocess",transform:e},typeName:Ne.ZodEffects,...Fe(n)});class ai extends Ve{_parse(t){return this._getType(t)===fe.undefined?Zn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ai.create=(e,t)=>new ai({innerType:e,typeName:Ne.ZodOptional,...Fe(t)});class va extends Ve{_parse(t){return this._getType(t)===fe.null?Zn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}va.create=(e,t)=>new va({innerType:e,typeName:Ne.ZodNullable,...Fe(t)});class Jf extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===fe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Jf.create=(e,t)=>new Jf({innerType:e,typeName:Ne.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});class Xf 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 Bf(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Rr(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Rr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Xf.create=(e,t)=>new Xf({innerType:e,typeName:Ne.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});class yg extends Ve{_parse(t){if(this._getType(t)!==fe.nan){const r=this._getOrReturnCtx(t);return de(r,{code:X.invalid_type,expected:fe.nan,received:r.parsedType}),je}return{status:"valid",value:t.data}}}yg.create=e=>new yg({typeName:Ne.ZodNaN,...Fe(e)});const dV=Symbol("zod_brand");class G1 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 $h 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"?je:i.status==="dirty"?(n.dirty(),Nc(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"?je: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 $h({in:t,out:n,typeName:Ne.ZodPipeline})}}class Zf extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=o=>(zf(o)&&(o.value=Object.freeze(o.value)),o);return Bf(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Zf.create=(e,t)=>new Zf({innerType:e,typeName:Ne.ZodReadonly,...Fe(t)});function UM(e,t={},n){return e?su.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})}}):su.create()}const fV={object:Nt.lazycreate};var Ne;(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"})(Ne||(Ne={}));const hV=(e,t={message:`Input not instance of ${e.name}`})=>UM(n=>n instanceof e,t),HM=Mo.create,WM=pa.create,pV=yg.create,mV=ma.create,KM=$f.create,gV=Sl.create,vV=mg.create,yV=Vf.create,xV=Uf.create,bV=su.create,wV=sl.create,SV=Zi.create,kV=gg.create,EV=Ao.create,CV=Nt.create,_V=Nt.strictCreate,TV=Hf.create,PV=Iv.create,NV=Wf.create,OV=di.create,MV=Kf.create,jV=vg.create,RV=kl.create,IV=Lc.create,AV=Gf.create,DV=qf.create,LV=ga.create,FV=Yf.create,zV=au.create,RC=Bo.create,BV=ai.create,$V=va.create,VV=Bo.createWithPreprocess,UV=$h.create,HV=()=>HM().optional(),WV=()=>WM().optional(),KV=()=>KM().optional(),GV={string:e=>Mo.create({...e,coerce:!0}),number:e=>pa.create({...e,coerce:!0}),boolean:e=>$f.create({...e,coerce:!0}),bigint:e=>ma.create({...e,coerce:!0}),date:e=>Sl.create({...e,coerce:!0})},qV=je;var y=Object.freeze({__proto__:null,defaultErrorMap:iu,setErrorMap:q8,getErrorMap:fg,makeIssue:hg,EMPTY_PATH:Y8,addIssueToContext:de,ParseStatus:$n,INVALID:je,DIRTY:Nc,OK:Zn,isAborted:pb,isDirty:mb,isValid:zf,isAsync:Bf,get util(){return Qe},get objectUtil(){return hb},ZodParsedType:fe,getParsedType:Fs,ZodType:Ve,datetimeRegex:$M,ZodString:Mo,ZodNumber:pa,ZodBigInt:ma,ZodBoolean:$f,ZodDate:Sl,ZodSymbol:mg,ZodUndefined:Vf,ZodNull:Uf,ZodAny:su,ZodUnknown:sl,ZodNever:Zi,ZodVoid:gg,ZodArray:Ao,ZodObject:Nt,ZodUnion:Hf,ZodDiscriminatedUnion:Iv,ZodIntersection:Wf,ZodTuple:di,ZodRecord:Kf,ZodMap:vg,ZodSet:kl,ZodFunction:Lc,ZodLazy:Gf,ZodLiteral:qf,ZodEnum:ga,ZodNativeEnum:Yf,ZodPromise:au,ZodEffects:Bo,ZodTransformer:Bo,ZodOptional:ai,ZodNullable:va,ZodDefault:Jf,ZodCatch:Xf,ZodNaN:yg,BRAND:dV,ZodBranded:G1,ZodPipeline:$h,ZodReadonly:Zf,custom:UM,Schema:Ve,ZodSchema:Ve,late:fV,get ZodFirstPartyTypeKind(){return Ne},coerce:GV,any:bV,array:EV,bigint:mV,boolean:KM,date:gV,discriminatedUnion:PV,effect:RC,enum:LV,function:IV,instanceof:hV,intersection:NV,lazy:AV,literal:DV,map:jV,nan:pV,nativeEnum:FV,never:SV,null:xV,nullable:$V,number:WM,object:CV,oboolean:KV,onumber:WV,optional:BV,ostring:HV,pipeline:UV,preprocess:VV,promise:zV,record:MV,set:RV,strictObject:_V,string:HM,symbol:vV,transformer:RC,tuple:OV,undefined:yV,union:TV,unknown:wV,void:kV,NEVER:qV,ZodIssueCode:X,quotelessJson:G8,ZodError:Rr});function q1(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var vb=class extends Error{constructor(n,r){super(n,r);zt(this,"name");zt(this,"details");this.name="ZodValidationError",this.details=YV(r)}toString(){return this.message}};function YV(e){if(e){const t=e.cause;if(q1(t))return t.issues}return[]}function GM(e){return e.length!==0}var JV=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function XV(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+'["'+ZV(n)+'"]';if(!JV.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function ZV(e){return e.replace(/"/g,'\\"')}var QV="; ",e9=99,qM="Validation error",t9=": ",n9=", or ";function r9(e={}){const{issueSeparator:t=QV,unionSeparator:n=n9,prefixSeparator:r=t9,prefix:o=qM,includePath:i=!0,maxIssuesInMessage:s=e9}=e;return a=>{const l=a.slice(0,s).map(c=>gm({issue:c,issueSeparator:t,unionSeparator:n,includePath:i})).join(t);return o9(l,o,r)}}function gm(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===X.invalid_union)return t.unionErrors.reduce((i,s)=>{const a=s.issues.map(l=>gm({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return i.includes(a)||i.push(a),i},[]).join(r);if(t.code===X.invalid_arguments)return[t.message,...t.argumentsError.issues.map(i=>gm({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===X.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(i=>gm({issue:i,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&GM(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 "${XV(t.path)}"`}return t.message}function o9(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:qM}function IC(e,t={}){if(!q1(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${a9.name}" method instead?`);return YM(e,t)}function YM(e,t={}){const n=e.errors;let r;return GM(n)?r=i9(t)(n):r=e.message,new vb(r,{cause:e})}function i9(e){return"messageBuilder"in e?e.messageBuilder:r9(e)}var s9=(e={})=>t=>q1(t)?YM(t,e):t instanceof Error?new vb(t.message,{cause:t}):new vb("Unknown error");function a9(e,t={}){return s9(t)(e)}function l9(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 c9(e){var t=l9(e,"string");return typeof t=="symbol"?t:t+""}function ct(e,t,n){return(t=c9(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AC(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 Ii(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AC(Object(n),!0).forEach(function(r){ct(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yb(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 Y1(e,t){if(e){if(typeof e=="string")return yb(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)?yb(e,t):void 0}}function J1(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Y1(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.
|
|
49
|
+
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 u9(e,t,n){var r={},o=[],i=0,s=J1((e==null?void 0:e.content)||[]),a;try{for(s.s();!(a=s.n()).done;){var l=a.value,c=d9([(i++).toString()],l,r,t,n);o.push(c)}}catch(u){s.e(u)}finally{s.f()}return{blocks:o,files:r}}function d9(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 f9(e.concat("children",u.toString()),c,n,r,o)}))||[]}}else{if(t.type==="paragraph")return JM(e,t,n,r,o);if(t.type==="bulletList")return QM(e,t,n,r,o);if(t.type==="orderedList")return ej(e,t,n,r,o);var l=t;throw new Error("Unhandled node type: ".concat("type"in l?"exhaustiveCheck.type":"unknown"))}}function f9(e,t,n,r,o){if(t.type==="text")return XM(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return tj(e,t,n,r,o);var i=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(i,null,2)))}function JM(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 XM(s);if(s.type==="hardBreak")return{tag:"br"};if(s.type==="image")return tj(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 XM(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 ZM(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 JM(e.concat("children",a.toString()),s,n,r,o);if(s.type==="bulletList")return QM(e.concat("children",a.toString()),s,n,r,o);if(s.type==="orderedList")return ej(e.concat("children",a.toString()),s,n,r,o);var l=s;throw new Error("Unexpected list child type: ".concat(l))}))||[]}}function QM(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 ZM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected bullet list child type: ".concat(l))}))||[]}}function ej(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 ZM(e.concat("children",a.toString()),s,n,r,o);var l=s.type;throw new Error("Unexpected ordered list child type: ".concat(l))}))||[]}}var h9=new TextEncoder;function tj(e,t,n,r,o){if(t.attrs&&t.attrs.src.startsWith("data:")){var i=jv.Buffer.from(t.attrs.src.split(",")[1],"base64"),s=ee.getSHA256Hash(new Uint8Array(i)),a=ee.getMimeType(t.attrs.src);if(a===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var l=ee.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],h=e.concat("src");d?d.patchPaths.push(h):n[u]={value:t.attrs.src,patchPaths:[h]};var p=ee.remote.hashToRemoteFileHash(s),m=o?ee.remote.createRemoteRef(o.remoteHost,Ii(Ii({},o),{},{fileHash:p,validationHash:ee.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},p,h9),filePath:u.slice(1)})):u;return{tag:"img",src:Ii(Ii(ct({},xt,m),o?ct({},We,"remote"):ct(ct({},We,"file"),cb,"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=DC("patch_id",v),x=v.split("?")[0],w=!1;b?(w=DC("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 S={tag:"img",src:Ii(Ii({},ct(w?ct({},We,"remote"):ct(ct({},We,"file"),cb,"image"),xt,x)),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:x&&ee.filenameToMimeType(x)||""}},b?{patch_id:b}:{})};return S}else throw new Error("Invalid image node (no attrs): "+JSON.stringify(t))}function DC(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 nj=y.object({type:y.union([y.literal("bold"),y.literal("strike"),y.literal("italic")])}),p9=y.object({type:y.literal("link"),attrs:y.object({href:y.string(),target:y.union([y.literal("_blank"),y.null()]),auto:y.boolean()})}),rj=y.intersection(y.object({type:y.literal("text"),text:y.string()}),y.object({marks:y.array(y.union([nj,p9]))}).partial()),oj=y.intersection(y.object({type:y.literal("hardBreak")}),y.object({marks:y.array(nj)}).partial()),ij=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()),m9=y.intersection(y.object({type:y.literal("heading")}),y.object({attrs:y.object({level:y.number()}),content:y.array(y.union([rj,ij,oj]))}).partial()),sj=y.lazy(function(){return y.intersection(y.object({type:y.literal("bulletList")}),y.object({content:y.array(lj)}).partial())}),aj=y.lazy(function(){return y.intersection(y.object({type:y.literal("orderedList")}),y.object({content:y.array(lj)}).partial())}),lj=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([cj,sj,aj]))}).partial())}),cj=y.lazy(function(){return y.intersection(y.object({type:y.literal("paragraph")}),y.object({content:y.array(y.union([rj,ij,oj]))}).partial())});y.object({type:y.literal("doc"),content:y.array(y.union([cj,m9,sj,aj]))});function g9(e){if(Array.isArray(e))return yb(e)}function v9(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function y9(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x9(e){return g9(e)||v9(e)||Y1(e)||y9()}function Bp(e){return{type:"doc",content:e.map(function(t){return b9(t)})}}function b9(e){switch(e.tag){case"h1":return Xl(1,e.children);case"h2":return Xl(2,e.children);case"h3":return Xl(3,e.children);case"h4":return Xl(4,e.children);case"h5":return Xl(5,e.children);case"h6":return Xl(6,e.children);case"p":return fj(e.children);case"ul":return gj(e);case"ol":return vj(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function Xl(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(uj)}}function Av(e){return{type:"text",text:e}}function uj(e){return typeof e=="string"?[Av(e)]:e.tag==="img"?[mj(e)]:e.tag==="br"?[hj()]:e.tag==="a"?pj(e):dj(e)}function dj(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Av(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 fj(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Av(t)];switch(t.tag){case"span":return dj(t);case"a":return pj(t);case"img":return[mj(t)];case"br":return[hj()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function hj(){return{type:"hardBreak",marks:[]}}function pj(e){return e.children.flatMap(uj).map(function(t){return t.type!=="text"?t:Ii(Ii({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function mj(e){var t,n,r=e.src;if(!(We in r)||r[We]!=="file"&&r[We]!=="remote")throw Error("Expected file source in image node");var o;return r[We]==="remote"?o=ee.convertRemoteSource(r):o=ee.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 gj(e){return{type:"bulletList",content:e.children.map(yj)}}function vj(e){return{type:"orderedList",content:e.children.map(yj)}}function yj(e){return{type:"listItem",content:w9(e.children)}}function w9(e){var t=[],n=J1(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(Av(o));else switch(o.tag){case"ol":{t.push(vj(o));break}case"ul":{t.push(gj(o));break}case"p":{var a=fj(o.children);i.type==="paragraph"&&a.type==="paragraph"?a.content&&s.push.apply(s,x9(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 xs=ee.VAL_SESSION_COOKIE,Zl=ee.VAL_STATE_COOKIE,dd=ee.VAL_ENABLE_COOKIE_NAME;function _d(){_d=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(A,R,N){A[R]=N.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(A,R,N){return Object.defineProperty(A,R,{value:N,enumerable:!0,configurable:!0,writable:!0}),A[R]}try{c({},"")}catch{c=function(R,N,D){return R[N]=D}}function u(A,R,N,D){var z=R&&R.prototype instanceof x?R:x,V=Object.create(z.prototype),G=new W(D||[]);return o(V,"_invoke",{value:F(A,N,G)}),V}function d(A,R,N){try{return{type:"normal",arg:A.call(R,N)}}catch(D){return{type:"throw",arg:D}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",m="executing",v="completed",b={};function x(){}function w(){}function S(){}var C={};c(C,s,function(){return this});var _=Object.getPrototypeOf,P=_&&_(_(B([])));P&&P!==n&&r.call(P,s)&&(C=P);var O=S.prototype=x.prototype=Object.create(C);function j(A){["next","throw","return"].forEach(function(R){c(A,R,function(N){return this._invoke(R,N)})})}function I(A,R){function N(z,V,G,Re){var Y=d(A[z],A,V);if(Y.type!=="throw"){var he=Y.arg,ie=he.value;return ie&&typeof ie=="object"&&r.call(ie,"__await")?R.resolve(ie.__await).then(function(ne){N("next",ne,G,Re)},function(ne){N("throw",ne,G,Re)}):R.resolve(ie).then(function(ne){he.value=ne,G(he)},function(ne){return N("throw",ne,G,Re)})}Re(Y.arg)}var D;o(this,"_invoke",{value:function(z,V){function G(){return new R(function(Re,Y){N(z,V,Re,Y)})}return D=D?D.then(G,G):G()}})}function F(A,R,N){var D=h;return function(z,V){if(D===m)throw Error("Generator is already running");if(D===v){if(z==="throw")throw V;return{value:e,done:!0}}for(N.method=z,N.arg=V;;){var G=N.delegate;if(G){var Re=H(G,N);if(Re){if(Re===b)continue;return Re}}if(N.method==="next")N.sent=N._sent=N.arg;else if(N.method==="throw"){if(D===h)throw D=v,N.arg;N.dispatchException(N.arg)}else N.method==="return"&&N.abrupt("return",N.arg);D=m;var Y=d(A,R,N);if(Y.type==="normal"){if(D=N.done?v:p,Y.arg===b)continue;return{value:Y.arg,done:N.done}}Y.type==="throw"&&(D=v,N.method="throw",N.arg=Y.arg)}}}function H(A,R){var N=R.method,D=A.iterator[N];if(D===e)return R.delegate=null,N==="throw"&&A.iterator.return&&(R.method="return",R.arg=e,H(A,R),R.method==="throw")||N!=="return"&&(R.method="throw",R.arg=new TypeError("The iterator does not provide a '"+N+"' method")),b;var z=d(D,A.iterator,R.arg);if(z.type==="throw")return R.method="throw",R.arg=z.arg,R.delegate=null,b;var V=z.arg;return V?V.done?(R[A.resultName]=V.value,R.next=A.nextLoc,R.method!=="return"&&(R.method="next",R.arg=e),R.delegate=null,b):V:(R.method="throw",R.arg=new TypeError("iterator result is not an object"),R.delegate=null,b)}function $(A){var R={tryLoc:A[0]};1 in A&&(R.catchLoc=A[1]),2 in A&&(R.finallyLoc=A[2],R.afterLoc=A[3]),this.tryEntries.push(R)}function J(A){var R=A.completion||{};R.type="normal",delete R.arg,A.completion=R}function W(A){this.tryEntries=[{tryLoc:"root"}],A.forEach($,this),this.reset(!0)}function B(A){if(A||A===""){var R=A[s];if(R)return R.call(A);if(typeof A.next=="function")return A;if(!isNaN(A.length)){var N=-1,D=function z(){for(;++N<A.length;)if(r.call(A,N))return z.value=A[N],z.done=!1,z;return z.value=e,z.done=!0,z};return D.next=D}}throw new TypeError(typeof A+" is not iterable")}return w.prototype=S,o(O,"constructor",{value:S,configurable:!0}),o(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,l,"GeneratorFunction"),t.isGeneratorFunction=function(A){var R=typeof A=="function"&&A.constructor;return!!R&&(R===w||(R.displayName||R.name)==="GeneratorFunction")},t.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,S):(A.__proto__=S,c(A,l,"GeneratorFunction")),A.prototype=Object.create(O),A},t.awrap=function(A){return{__await:A}},j(I.prototype),c(I.prototype,a,function(){return this}),t.AsyncIterator=I,t.async=function(A,R,N,D,z){z===void 0&&(z=Promise);var V=new I(u(A,R,N,D),z);return t.isGeneratorFunction(R)?V:V.next().then(function(G){return G.done?G.value:V.next()})},j(O),c(O,l,"Generator"),c(O,s,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),t.keys=function(A){var R=Object(A),N=[];for(var D in R)N.push(D);return N.reverse(),function z(){for(;N.length;){var V=N.pop();if(V in R)return z.value=V,z.done=!1,z}return z.done=!0,z}},t.values=B,W.prototype={constructor:W,reset:function(A){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),!A)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 A=this.tryEntries[0].completion;if(A.type==="throw")throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var R=this;function N(Y,he){return V.type="throw",V.arg=A,R.next=Y,he&&(R.method="next",R.arg=e),!!he}for(var D=this.tryEntries.length-1;D>=0;--D){var z=this.tryEntries[D],V=z.completion;if(z.tryLoc==="root")return N("end");if(z.tryLoc<=this.prev){var G=r.call(z,"catchLoc"),Re=r.call(z,"finallyLoc");if(G&&Re){if(this.prev<z.catchLoc)return N(z.catchLoc,!0);if(this.prev<z.finallyLoc)return N(z.finallyLoc)}else if(G){if(this.prev<z.catchLoc)return N(z.catchLoc,!0)}else{if(!Re)throw Error("try statement without catch or finally");if(this.prev<z.finallyLoc)return N(z.finallyLoc)}}}},abrupt:function(A,R){for(var N=this.tryEntries.length-1;N>=0;--N){var D=this.tryEntries[N];if(D.tryLoc<=this.prev&&r.call(D,"finallyLoc")&&this.prev<D.finallyLoc){var z=D;break}}z&&(A==="break"||A==="continue")&&z.tryLoc<=R&&R<=z.finallyLoc&&(z=null);var V=z?z.completion:{};return V.type=A,V.arg=R,z?(this.method="next",this.next=z.finallyLoc,b):this.complete(V)},complete:function(A,R){if(A.type==="throw")throw A.arg;return A.type==="break"||A.type==="continue"?this.next=A.arg:A.type==="return"?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):A.type==="normal"&&R&&(this.next=R),b},finish:function(A){for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R];if(N.finallyLoc===A)return this.complete(N.completion,N.afterLoc),J(N),b}},catch:function(A){for(var R=this.tryEntries.length-1;R>=0;--R){var N=this.tryEntries[R];if(N.tryLoc===A){var D=N.completion;if(D.type==="throw"){var z=D.arg;J(N)}return z}}throw Error("illegal catch attempt")},delegateYield:function(A,R,N){return this.delegate={iterator:B(A),resultName:R,nextLoc:N},this.method==="next"&&(this.arg=e),b}},t}function LC(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 FC(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(l){LC(i,r,o,s,a,"next",l)}function a(l){LC(i,r,o,s,a,"throw",l)}s(void 0)})}}var oa=y.lazy(function(){return y.union([y.string(),y.number(),y.boolean(),y.null(),y.array(oa),y.record(oa)])}),S9=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.string(),value:oa}).strict(),y.object({op:y.literal("remove"),path:y.string()}).strict(),y.object({op:y.literal("replace"),path:y.string(),value:oa}).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:oa}).strict(),y.object({op:y.literal("file"),path:y.string(),filePath:y.string(),value:y.string(),remote:y.boolean()}).strict()]);y.array(S9);var k9=y.discriminatedUnion("op",[y.object({op:y.literal("add"),path:y.array(y.string()),value:oa}).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:oa}).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:oa}).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()]),xb=y.array(k9),Xt=y.string().refine(function(e){return!0}),E9=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Xt})]);y.object({patch:xb,parentRef:E9});var C9=y.string().transform(function(e){return e}),_9=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()}),bb=y.object({type:y.literal("literal"),value:y.string(),opt:y.boolean()}),T9=y.object({type:y.literal("boolean"),opt:y.boolean()}),P9=y.object({type:y.literal("number"),options:y.object({max:y.number().optional(),min:y.number().optional()}).optional(),opt:y.boolean()}),xj=y.lazy(function(){return y.object({type:y.literal("object"),items:y.record(Vh),opt:y.boolean()})}),N9=y.lazy(function(){return y.object({type:y.literal("array"),item:Vh,opt:y.boolean()})}),O9=y.lazy(function(){return y.union([y.object({type:y.literal("union"),key:bb,items:y.array(bb),opt:y.boolean()}),y.object({type:y.literal("union"),key:y.string(),items:y.array(xj),opt:y.boolean()})])}),M9=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()}),bj=y.object({type:y.literal("image"),options:M9.optional(),opt:y.boolean()}),j9=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(),bj]).optional()}).optional()}),R9=y.object({type:y.literal("richtext"),options:j9.optional(),opt:y.boolean()}),I9=y.lazy(function(){return y.object({type:y.literal("record"),item:Vh,opt:y.boolean()})}),A9=y.lazy(function(){return y.object({type:y.literal("keyOf"),path:C9,schema:Vh,values:y.union([y.literal("string"),y.array(y.string())]),opt:y.boolean()})}),D9=y.object({accept:y.string().optional()}),L9=y.object({type:y.literal("file"),options:D9.optional(),opt:y.boolean()}),F9=y.object({type:y.literal("date"),opt:y.boolean()}),Vh=y.union([_9,bb,T9,P9,xj,N9,O9,R9,I9,A9,L9,F9,bj]),X1=y.object({commitSha:y.string(),clientCommitSha:y.string(),parentCommitSha:y.string(),branch:y.string(),creator:y.string(),createdAt:y.string(),commitMessage:y.string().nullable()}),Ua=y.string().refine(function(e){return!0}),zC=y.union([y.object({type:y.literal("head"),headBaseSha:y.string()}),y.object({type:y.literal("patch"),patchId:Xt})]),BC=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()}),z9=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")]),B9=y.object({message:y.string(),value:y.unknown().optional(),fatal:y.boolean().optional(),fixes:y.array(z9).optional()}),Ei=y.object({status:y.literal(401),json:y.object({message:y.string()})}),$9=y.object({status:y.literal(404),json:y.object({message:y.string()})}),Yt=y.object({message:y.string()}),$C=y.union([y.object({patchId:Xt,message:y.string()}),y.object({parentPatchId:y.string(),message:y.string()})]),Sx=y.object({message:y.string(),path:Ua.optional()});y.union([y.literal("val_session"),y.literal("val_enable"),y.literal("val_state")]);var $p=y.object({value:y.literal("true"),options:y.object({httpOnly:y.literal(!1),sameSite:y.literal("lax")})}),V9={"/draft/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ct({},xs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Yt}),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:ct({},xs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Yt}),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:ct({},xs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Yt}),y.object({status:y.literal(200),json:y.object({draftMode:y.boolean()})})])}},"/enable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ct({},xs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Yt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ct(ct({},dd,$p),Zl,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(ct({},dd,$p))}),y.object({status:y.literal(400),json:y.object({message:y.string()})})])}},"/disable":{GET:{req:{query:{redirect_to:y.string().optional()},cookies:ct({},xs,y.string().optional())},res:y.union([y.object({status:y.literal(401),json:Yt}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ct({},dd,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(ct(ct({},dd,$p),Zl,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:ct({},Zl,y.string())},res:y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ct(ct(ct({},Zl,y.object({value:y.literal(null)})),dd,$p.optional()),xs,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:{query:{redirect_to:y.string().optional()}},res:y.union([y.object({status:y.literal(200),cookies:y.object(ct(ct({},xs,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()),Zl,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()))}),y.object({status:y.literal(302),redirectTo:y.string(),cookies:y.object(ct(ct({},xs,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()),Zl,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()))})])}},"/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({sourcesSha:y.string(),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:Yt}),y.object({status:y.literal(500),json:Yt}),y.object({status:y.literal(503),json:Yt}),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(),sourcesSha:y.string(),patches:y.array(Xt),config:BC,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])}),y.object({type:y.literal("use-websocket"),url:y.string(),nonce:y.string(),baseSha:y.string(),schemaSha:y.string(),sourcesSha:y.string(),commitSha:y.string(),patches:y.array(Xt),commits:y.array(X1),config:BC,profileId:y.string().nullable(),mode:y.union([y.literal("http"),y.literal("fs")])})])})])}},"/patches":{DELETE:{req:{query:{id:y.array(Xt)},cookies:{val_session:y.string().optional()}},res:y.union([Ei,y.object({status:y.literal(500),json:y.object({message:y.string(),errors:y.array($C)})}),y.object({status:y.literal(200),json:y.array(Xt)})])},PUT:{req:{body:y.object({parentRef:zC,patches:y.array(y.object({path:Ua,patchId:Xt,patch:xb}))}),cookies:{val_session:y.string().optional()}},res:y.union([Ei,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(Ua,y.array(y.object({error:Yt})))})}),y.object({status:y.literal(200),json:y.object({newPatchIds:y.array(Xt),parentRef:zC})})])},GET:{req:{query:{patch_id:y.array(Xt).optional(),exclude_patch_ops:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Ei,y.object({status:y.literal(500),json:y.object({message:y.string(),patchErrors:y.array($C)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),error:Yt})}),y.object({status:y.literal(200),json:y.object({patches:y.array(y.object({path:Ua,patch:xb.optional(),patchId:Xt,createdAt:y.string(),authorId:y.string().nullable(),appliedAt:y.object({commitSha:y.string()}).nullable()})),baseSha:y.string(),error:Yt.optional(),errors:y.record(Xt,Yt).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Ei,y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Sx)})}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.array(Yt)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),schemas:y.record(Ua,Vh)})})])}},"/sources/~":{PUT:{req:{path:y.string().optional(),query:{validate_sources:y.boolean().optional(),validate_binary_files:y.boolean().optional()},cookies:{val_session:y.string().optional()}},res:y.union([Ei,y.object({status:y.literal(401),json:Yt}),y.object({status:y.literal(500),json:y.object({message:y.string(),details:y.union([y.array(Sx),Yt])})}),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(Sx)})}),y.object({status:y.literal(200),json:y.object({schemaSha:y.string(),sourcesSha:y.string(),modules:y.record(Ua,y.object({source:y.any(),patches:y.object({applied:y.array(Xt),skipped:y.array(Xt).optional(),errors:y.record(Xt,Yt).optional()}).optional(),validationErrors:y.record(y.string(),y.array(B9)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:y.string().optional()}},res:y.union([Ei,y.object({status:y.literal(200),json:y.object({profiles:y.array(y.object({profileId:y.string(),fullName:y.string(),email:y.string().optional(),avatar:y.object({url:y.string()}).nullable()}))})})])}},"/commit-summary":{GET:{req:{query:{patch_id:y.array(Xt)},cookies:{val_session:y.string().optional()}},res:y.union([Ei,y.object({status:y.literal(400),json:y.object({message:y.string()})}),y.object({status:y.literal(200),json:y.object({patchIds:y.array(Xt),baseSha:y.string(),commitSummary:y.string().nullable()})})])}},"/save":{POST:{req:{body:y.object({message:y.string().optional(),patchIds:y.array(Xt)}),cookies:{val_session:y.string().optional()}},res:y.union([Ei,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(Ua,y.array(Yt)),binaryFilePatchErrors:y.record(Yt)}),y.array(Yt)])}),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:Xt.optional(),remote:y.string().optional()}},res:y.union([Ei,$9,y.object({status:y.literal(200),body:y.instanceof(ReadableStream)})])}}},wj=function(t,n){var r=V9;return function(){var o=FC(_d().mark(function i(s,a,l){var c,u,d,h,p,m,v,b,x,w,S,C,_,P,O,j,I,F;return _d().wrap(function($){for(;;)switch($.prev=$.next){case 0:if(d=l,h=s,d!=null&&d.path&&d.path.length>0&&(h+=d.path),d.query){for(p=[],m=0,v=Object.keys(d.query);m<v.length;m++)if(x=v[m],Array.isArray((b=d.query)===null||b===void 0?void 0:b[x])){S=J1(((w=d.query)===null||w===void 0?void 0:w[x])||[]);try{for(S.s();!(C=S.n()).done;)_=C.value,_!==void 0&&p.push([x,_.toString()])}catch(J){S.e(J)}finally{S.f()}}else((P=d.query)===null||P===void 0?void 0:P[x])!==void 0&&p.push([x,d==null||(O=d.query)===null||O===void 0?void 0:O[x].toString()]);d!=null&&d.query&&p.length>0&&(h+="?".concat(new URLSearchParams(p).toString()))}if(j=r==null||(c=r[s])===null||c===void 0?void 0:c[a],j){$.next=7;break}return $.abrupt("return",{status:null,json:{message:"Invalid route ".concat(s," with method ").concat(a,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(s," with method ").concat(a," not found."),data:{routes:Object.keys(r||{}),methods:Object.keys((r==null?void 0:r[s])||{}),route:s,method:a}}}});case 7:if(I=(u=j.req.body)===null||u===void 0?void 0:u.safeParse(d.body),!(I&&!I.success)){$.next=11;break}return console.error("Invalid request body",{body:d.body,error:I.error}),$.abrupt("return",{status:null,json:{message:"Invalid request body. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:IC(I.error).toString(),data:d.body}}});case 11:return $.prev=11,$.next=14,fetch("".concat(t).concat(h),{method:a,headers:{"Content-Type":"application/json"},body:d.body!==void 0?JSON.stringify(d.body):void 0}).then(function(){var J=FC(_d().mark(function W(B){var A,R,N,D,z;return _d().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:if(R=B.headers.get("content-type"),B.status!==413){G.next=3;break}return G.abrupt("return",{status:413,json:{message:"Request too large.",method:a,path:s}});case 3:if(R!=null&&R.includes("application/json")){G.next=5;break}return G.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(B.status),details:{validationError:"Invalid content type",data:{status:B.status,contentType:R}}}});case 5:return G.next=7,B.json();case 7:if(N=G.sent,D={status:B.status,json:N},B.status!==500){G.next=12;break}return console.log("Server responded with an error",N),G.abrupt("return",{status:500,json:Ii({type:"unknown",message:N.message},N)});case 12:if(z=(A=j.res)===null||A===void 0?void 0:A.safeParse(D),!(z&&!z.success)){G.next=15;break}return G.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:IC(z.error).toString(),data:D}}});case 15:return G.abrupt("return",{status:B.status,json:N});case 16:case"end":return G.stop()}},W)}));return function(W){return J.apply(this,arguments)}}());case 14:return F=$.sent,$.abrupt("return",F);case 18:return $.prev=18,$.t0=$.catch(11),$.abrupt("return",{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:U9($.t0),details:$.t0 instanceof Error?$.t0.message:JSON.stringify($.t0)}});case 21:case"end":return $.stop()}},i,null,[[11,18]])}));return function(i,s,a){return o.apply(this,arguments)}}()};function U9(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 H9(e){if(Array.isArray(e))return e}function W9(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 K9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
51
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G9(e,t){return H9(e)||W9(e,t)||Y1(e,t)||K9()}var Qf=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=G9(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)},VC="val-config",q9="val-config-received",Y9=y.object({contentHostUrl:y.string().optional(),appHostUrl:y.string().optional(),project:y.string().optional(),root:y.string().optional(),files:y.object({directory:y.literal("/public/val")}).optional(),gitCommit:y.string().optional(),gitBranch:y.string().optional(),defaultTheme:y.enum(["dark","light"]).optional(),ai:y.object({commitMessages:y.object({disabled:y.boolean().optional()}).optional()}).optional()}),Sj=y.object({deploymentId:y.string(),deploymentState:y.string(),commitSha:y.string(),updatedAt:y.string(),createdAt:y.string()});const kj=y.string().uuid().refine(e=>!0),J9=y.union([y.object({type:y.literal("patches"),patches:y.array(kj)}),y.object({type:y.literal("deployment"),deployment:Sj}),y.object({type:y.literal("commit"),commit:X1}),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")]),profileId:y.string().nullable(),config:y.object({project:y.string().optional(),files:y.object({directory:y.string()}).optional()}),commitSha:y.string().optional(),sourcesSha:y.string(),schemaSha:y.string(),baseSha:y.string(),patches:y.array(kj),commits:y.array(X1).optional(),deployments:y.array(Sj).optional(),mode:y.union([y.literal("fs"),y.literal("http")])});function X9(e){const[t,n]=g.useState({status:"not-asked"}),r=g.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:i,setIsAuthenticated:s}=Z9(),[a,l]=g.useState(),c=g.useRef(0);return g.useEffect(()=>{if(t.status==="updated-request-again"||t.status==="error"||t.status==="ws-message-received")if(t.wait===0)console.debug("Executing stat immediately",t.status,t.status==="error"?t.error:"no error","Now:",Date.now()),kx(e,r,c,t,n,i,s,l);else{console.debug("Executing stat in ",t.wait," status: ",t.status,"Now:",Date.now());const u=setTimeout(()=>{kx(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"),kx(e,r,c,t,n,i,s,l))},[e,t.status]),[t,n,o,i,s,a]}const fd=10*1e3;async function kx(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,sourcesSha:r.data.sourcesSha,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,waitStart:Date.now(),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,waitStart:Date.now(),wait:t.current?fd:0});else if(u.json.type==="use-websocket"){o(m=>({...m,status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:fd})),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 h=u.json.nonce;t.current.onopen=()=>{var m;(m=t.current)==null||m.send(JSON.stringify({nonce:h,type:"subscribe"}))},t.current.onmessage=m=>{try{const v=J9.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=>hd(x,b.message)):b.type==="patches"?o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,patches:b.patches},waitStart:"waitStart"in x?x.waitStart:Date.now(),wait:"waitStart"in x?Math.max(0,Date.now()-x.waitStart):fd}:x):b.type==="subscribed"?console.debug("Subscribed!"):b.type==="commit"?(console.debug("Commit",b.commit),o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,commits:(x.data.commits||[]).concat(b.commit)},waitStart:"waitStart"in x?x.waitStart:Date.now(),wait:"waitStart"in x?Math.max(0,Date.now()-x.waitStart):fd}:x)):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({commitSha:b.deployment.commitSha,deploymentId:b.deployment.deploymentId,deploymentState:b.deployment.deploymentState,createdAt:b.deployment.createdAt,updatedAt:b.deployment.updatedAt})},waitStart:"waitStart"in x?x.waitStart:Date.now(),wait:"waitStart"in x?Math.max(0,Date.now()-x.waitStart):fd}:x)):console.warn("Unknown WebSocket message",b)}catch(v){console.error("Could not parse WebSocket message",v)}};const p=t.current;t.current.onclose=()=>{p===t.current&&(console.debug("WebSocket closed"),o(m=>hd(m,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(m=>hd(m,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(d=>hd(d,u.json.message))}).catch(u=>{n.current!==0&&n.current!==l||o(d=>hd(d,u.message))})}function hd(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,waitStart:"waitStart"in e?e.waitStart:Date.now(),wait:r}}function Z9(){const[e,t]=g.useState("not-asked"),n=g.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}function Td(e){var t,n,r,o,i;if(e.type==="file")return!!e.remote;if(e.type==="image")return!!e.remote;if(e.type==="richtext")return!!(typeof((n=(t=e.options)==null?void 0:t.inline)==null?void 0:n.img)!="boolean"&&((i=(o=(r=e.options)==null?void 0:r.inline)==null?void 0:o.img)!=null&&i.remote));if(e.type==="array")return Td(e.item);if(e.type==="record")return Td(e.item);if(e.type==="union"){for(const s of e.items)if(Td(s))return!0;return!1}else if(e.type==="object"){for(const s in e.items)if(Td(e.items[s]))return!0;return!1}else{if(e.type==="boolean"||e.type==="number"||e.type==="string"||e.type==="date"||e.type==="keyOf"||e.type==="literal")return!1;{const s=e;return console.error(`Val: requiresRemoteFiles: unexpected schema type ${typeof s=="object"&&"type"in s&&s.type}`,e),null}}}function fn(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 Ej(e){return N1(e)}function lu(e,t){if(e===t)return!0;if(ce(e)==="object"&&ce(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(!lu(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=Xn(i[o],2),a=s[0],l=s[1],c=t[a];if(c===void 0||!lu(l,c))return!1}return!0}}return!1}function Ai(e){return Array.isArray(e)?e.map(Ai):ce(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=Xn(t,2),r=n[0],o=n[1];return[r,Ai(o)]})):e}function Z1(e){return/^(0|[1-9][0-9]*)$/g.test(e)?En(Number(e)):Bn(new Lr('Invalid array index "'.concat(e,'"')))}function Q9(e,t){return e==="-"?En(t.length):fn(Z1(e),Ov(function(n){return n<=t.length},function(){return new Lr("Array index out of bounds")}))}function Cj(e,t){return fn(Z1(e),Ov(function(n){return n<t.length},function(){return new Lr("Array index out of bounds")}))}function eU(e,t,n){if(Array.isArray(e))return fn(Cj(t,e),eo(function(o){var i=e[o];return e[o]=n,i}));if(ce(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,En(r)}else return Bn(new Lr("Cannot replace object element which does not exist"));return Bn(new Lr("Cannot replace in non-object/array"))}function tU(e,t,n){return Ej(t)?fn(Q1(e,t),bl(function(r){var o=Xn(r,2),i=o[0],s=o[1];return eU(i,s,n)}),eo(function(r){return[e,r]})):En([n,e])}function _j(e,t){return Array.isArray(e)?fn(Z1(t),bl(function(n){return n>=e.length?Bn(new Lr("Array index out of bounds")):En(e[n])})):ce(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?En(e[t]):En(void 0):Bn(new Lr("Cannot access non-object/array"))}function Q1(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var i=_j(n,r);if(Nv(i))return i;if(i.value===void 0)return Bn(new Lr("Path refers to non-existing object/array"));n=i.value}return En([n,r])}function Ex(e,t){return fn(t,O1(function(n,r){return fn(_j(n,r),Ov(function(o){return o!==void 0},function(){return new Lr("Path refers to non-existing object/array")}))},e))}function nU(e,t){if(Array.isArray(e))return fn(Cj(t,e),eo(function(r){var o=e.splice(r,1),i=Xn(o,1),s=i[0];return s}));if(ce(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],En(n)}return Bn(new Lr("Cannot remove from non-object/array"))}function UC(e,t){return fn(Q1(e,t),bl(function(n){var r=Xn(n,2),o=r[0],i=r[1];return nU(o,i)}))}function rU(e,t,n){if(Array.isArray(e))return fn(Q9(t,e),eo(function(o){e.splice(o,0,n)}));if(ce(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,En(r)}return Bn(new Lr("Cannot add to non-object/array"))}function Cx(e,t,n){return Ej(t)?fn(Q1(e,t),bl(function(r){var o=Xn(r,2),i=o[0],s=o[1];return rU(i,s,n)}),eo(function(r){return[e,r]})):En([n,e])}function Vp(e){var t=Xn(e,1),n=t[0];return n}var oU=function(){function e(){Pn(this,e)}return Nn(e,[{key:"get",value:function(n,r){return Ex(n,r)}},{key:"add",value:function(n,r,o){return fn(Cx(n,r,o),eo(Vp))}},{key:"remove",value:function(n,r){return fn(UC(n,r),eo(function(){return n}))}},{key:"replace",value:function(n,r,o){return fn(tU(n,r,o),eo(Vp))}},{key:"move",value:function(n,r,o){return fn(UC(n,r),bl(function(i){return Cx(n,o,i)}),eo(Vp))}},{key:"copy",value:function(n,r,o){return fn(Ex(n,r),bl(function(i){return Cx(n,o,Ai(i))}),eo(Vp))}},{key:"test",value:function(n,r,o){return fn(Ex(n,r),eo(function(i){return lu(o,i)}))}}])}();function iU(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)?En(e):Bn(new Lr("Test failed"));case"file":return Bn(new Lr("Cannot apply a file patch here"))}}function sU(e,t,n){return fn(n,O1(function(r,o){return iU(r,t,o)},e))}function aU(e,t){return!e||!t?!1:e.length===1&&e[0].op==="replace"&&t.length===1&&t[0].op==="replace"?e[0].path.join("/")===t[0].path.join("/"):!1}function cc(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=cc(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 pd{constructor(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}reset(){this.patchSetMetadata={},this.orderedInsertKeys=[],this.insertedPatches=new Set}getInsertedPatches(){return this.insertedPatches}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 h=this.orderedInsertKeys[d];c!==h?c.startsWith(h)?(c=h,this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c)):h.startsWith(c)&&u.push(d):(this.orderedInsertKeys.splice(d,1),this.orderedInsertKeys.unshift(c))}for(const d of u){const h=this.orderedInsertKeys[d];this.orderedInsertKeys.splice(d,1);const p=this.patchSetMetadata[h];if(this.patchSetMetadata[c]||(this.patchSetMetadata[c]={moduleFilePath:t,patchPath:n,patches:[],authors:[],opTypes:[],schemaTypes:Array.from(a),lastUpdated:o,lastUpdatedBy:i}),p)for(const m of p.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: ${h}`);h!==c&&delete this.patchSetMetadata[h]}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=cc(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=cc(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=cc(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=cc(n,c);if(this.insertPath(t,c,o,i,s,r.op,Array.from(u),r.path),r.op==="move"){const d=r.from,h=cc(n,d);this.insertPath(t,d,o,i,s,r.op,Array.from(h),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}`)})}}class lU{constructor(t,n=void 0){this.client=t,this.overlayEmitter=n,this.autoPublish=!1,this.isSyncing=!1,this.MIN_WAIT_SECONDS=1,this.MAX_WAIT_SECONDS=5,this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.baseSha=null,this.sourcesSha=null,this.mode=null,this.optimisticClientSources={},this.serverSources=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new pd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null}setAutoPublish(t,n){this.autoPublish=n;try{localStorage.setItem("val-auto-publish",n.toString())}catch{}return this.invalidateAutoPublish(),this.sync(t)}loadAutoPublish(){try{this.autoPublish=localStorage.getItem("val-auto-publish")==="true",this.invalidateAutoPublish()}catch{}}async init(t,n,r,o,i,s,a,l){this.mode=t,this.baseSha=n,this.commitSha=a,this.sourcesSha=o,this.authorId=s;const c=Date.now();t==="fs"?this.loadAutoPublish():this.autoPublish=!1;const u=await this.syncWithUpdatedStat(t,n,r,o,i,s,a,l);return u.status==="done"&&(await this.syncPatches(!0,l),this.publishDisabled=!1,this.invalidatePublishDisabled(),this.initializedAt=l+(Date.now()-c),this.invalidateInitializedAt()),u}reset(){console.debug("Resetting ValSyncEngine"),this.initializedAt=null,this.forceSyncAllModules=!0,this.errors={},this.listeners={},this.syncStatus={},this.schemas=null,this.serverSideSchemaSha=null,this.clientSideSchemaSha=null,this.sourcesSha=null,this.optimisticClientSources={},this.serverSources=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new pd,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedPatchData=null,this.cachedSerializedPatchSetsSnapshot=null,this.cachedValidationErrors=null,this.cachedAllSchemasSnapshot=null,this.cachedGlobalServerSidePatchIdsSnapshot=null,this.cachedPendingClientSidePatchIdsSnapshot=null,this.cachedSyncedServerSidePatchIdsSnapshot=null,this.cachedSavedServerSidePatchIdsSnapshot=null,this.cachedAllSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.invalidateInitializedAt()}subscribe(t,n){const r=n||Hn;return o=>{const i=this.listeners;i[t]||(i[t]={}),i[t][r]||(i[t][r]=[]);const s=i[t][r].push(o)-1;return()=>{var a;(a=i[t])==null||a[r].splice(s,1)}}}emit(t){if(t)for(const n of t)n()}setCommitSha(t){this.commitSha=t}invalidateInitializedAt(){var t;this.cachedInitializedAtSnapshot=null,this.emit((t=this.listeners["initialized-at"])==null?void 0:t[Hn])}invalidateSource(t){var n;this.cachedSourceSnapshots!==null&&(this.cachedSourceSnapshots={...this.cachedSourceSnapshots,[t]:void 0}),this.cachedAllSourcesSnapshot=null,this.emit((n=this.listeners.source)==null?void 0:n[t])}invalidateSyncStatus(t){var n;this.cachedSyncStatus={...this.cachedSyncStatus,[t]:void 0},this.emit((n=this.listeners["sync-status"])==null?void 0:n[t])}invalidateValidationError(t){var n;this.emit((n=this.listeners["validation-error"])==null?void 0:n[t])}invalidateAllValidationErrors(){var t;this.cachedValidationErrors=null,this.emit((t=this.listeners["all-validation-errors"])==null?void 0:t[Hn])}invalidateTransientGlobalError(){var t;this.emit((t=this.listeners["transient-global-error"])==null?void 0:t[Hn])}invalidatePersistentGlobalError(){var t;this.emit((t=this.listeners["persistent-global-error"])==null?void 0:t[Hn])}invalidatePatchSets(){var t;this.cachedSerializedPatchSetsSnapshot=null,this.emit((t=this.listeners["patch-sets"])==null?void 0:t[Hn])}invalidatePendingOps(){var t;this.cachedPendingOpsCountSnapshot=null,this.emit((t=this.listeners["pending-ops-count"])==null?void 0:t[Hn])}invalidateAllPatches(){var t;this.cachedPatchData=null,this.emit((t=this.listeners["all-patches"])==null?void 0:t[Hn])}invalidateSchema(){var t,n;this.cachedAllSchemasSnapshot=null,this.cachedSchemaSnapshots=null,this.cachedAllSourcesSnapshot=null,this.emit((t=this.listeners.schema)==null?void 0:t[Hn]),this.invalidateAllValidationErrors();for(const r in((n=this.listeners)==null?void 0:n["validation-error"])||{}){const o=r;this.invalidateValidationError(o)}}invalidateGlobalServerSidePatchIds(){var t;this.cachedGlobalServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["global-server-side-patch-ids"])==null?void 0:t[Hn])}invalidatePendingClientSidePatchIds(){var t;this.cachedPendingClientSidePatchIdsSnapshot=null,this.emit((t=this.listeners["pending-client-side-patch-ids"])==null?void 0:t[Hn])}invalidateSyncedServerSidePatchIds(){var t;this.cachedSyncedServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["synced-server-side-patch-ids"])==null?void 0:t[Hn])}invalidateSavedServerSidePatchIds(){var t;this.cachedSavedServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["saved-server-side-patch-ids"])==null?void 0:t[Hn])}invalidatePublishDisabled(){var t;this.cachedPublishDisabledSnapshot=null,this.emit((t=this.listeners["publish-disabled"])==null?void 0:t[Hn])}invalidateAutoPublish(){var t;this.cachedAutoPublishSnapshot=null,this.emit((t=this.listeners["auto-publish"])==null?void 0:t[Hn])}getSchemaSnapshot(t){if(this.cachedSchemaSnapshots===null&&(this.cachedSchemaSnapshots={}),this.cachedSchemaSnapshots[t]===void 0)if(!this.schemas)this.cachedSchemaSnapshots[t]={status:"no-schemas"};else{const n=this.schemas[t];n?this.cachedSchemaSnapshots[t]={status:"success",data:Ai(n)}:this.cachedSchemaSnapshots[t]={status:"module-schema-not-found"}}return this.cachedSchemaSnapshots[t]}getSourceSnapshot(t){var n;if(this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedSourceSnapshots[t]===void 0){const r=this.optimisticClientSources[t]!==void 0?this.optimisticClientSources[t]:(n=this.serverSources)==null?void 0:n[t];this.schemas===null?this.cachedSourceSnapshots[t]={status:"no-schemas"}:this.schemas[t]?r===void 0?this.cachedSourceSnapshots[t]={status:"source-not-found"}:this.cachedSourceSnapshots[t]={status:"success",data:Ai(r),optimistic:this.optimisticClientSources[t]!==void 0}:this.cachedSourceSnapshots[t]={status:"schema-not-found"}}return this.cachedSourceSnapshots[t]}getAllSourcesSnapshot(){var t;if(this.cachedAllSourcesSnapshot===null){this.cachedAllSourcesSnapshot={};for(const n in this.schemas||{}){const r=n,o=this.optimisticClientSources[r]||((t=this.serverSources)==null?void 0:t[r]);o&&(this.cachedAllSourcesSnapshot[r]=Ai(o))}}return this.cachedAllSourcesSnapshot}getAllSchemasSnapshot(){var t;this.cachedAllSchemasSnapshot===null&&(this.cachedAllSchemasSnapshot={});for(const n in this.schemas||{}){const r=n,o=(t=this.schemas)==null?void 0:t[r];o&&(this.cachedAllSchemasSnapshot[r]=Ai(o))}return this.cachedAllSchemasSnapshot}getValidationErrorSnapshot(t){const n=this.getAllValidationErrorsSnapshot();return n==null?void 0:n[t]}getAllValidationErrorsSnapshot(){if(!this.cachedValidationErrors){this.cachedValidationErrors={};for(const t in this.errors.validationErrors){const n=t,r=[];for(const o of this.errors.validationErrors[n]||[])o&&r.push(o);r.length>0&&(this.cachedValidationErrors[n]=r)}}return this.cachedValidationErrors}getSyncStatusSnapshot(t){return this.cachedSyncStatus===null&&(this.cachedSyncStatus={}),this.cachedSyncStatus[t]===void 0&&(this.cachedSyncStatus[t]=this.syncStatus[t]||null),this.syncStatus[t]}getPendingOpsSnapshot(){return this.cachedPendingOpsCountSnapshot===null&&(this.cachedPendingOpsCountSnapshot=this.pendingOps.length),this.cachedPendingOpsCountSnapshot}getSerializedPatchSetsSnapshot(){return this.cachedSerializedPatchSetsSnapshot||(this.cachedSerializedPatchSetsSnapshot=this.patchSets.serialize()),this.cachedSerializedPatchSetsSnapshot}getInitializedAtSnapshot(){return this.cachedInitializedAtSnapshot===null&&(this.cachedInitializedAtSnapshot={data:this.initializedAt}),this.cachedInitializedAtSnapshot}getAllPatchesSnapshot(){if(!this.cachedPatchData){this.cachedPatchData={};for(const t in this.patchDataByPatchId){const n=t,r=this.patchDataByPatchId[n];r&&(this.cachedPatchData[n]=Ai(r))}}return this.cachedPatchData}getGlobalServerSidePatchIdsSnapshot(){var t;return this.cachedGlobalServerSidePatchIdsSnapshot===null&&(this.cachedGlobalServerSidePatchIdsSnapshot=((t=this.globalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedGlobalServerSidePatchIdsSnapshot}getPendingClientSidePatchIdsSnapshot(){var t;return this.cachedPendingClientSidePatchIdsSnapshot===null&&(this.cachedPendingClientSidePatchIdsSnapshot=((t=this.pendingClientPatchIds)==null?void 0:t.slice())||[]),this.cachedPendingClientSidePatchIdsSnapshot}getSyncedServerSidePatchIdsSnapshot(){var t;return this.cachedSyncedServerSidePatchIdsSnapshot===null&&(this.cachedSyncedServerSidePatchIdsSnapshot=((t=this.syncedServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSyncedServerSidePatchIdsSnapshot}getSavedServerSidePatchIdsSnapshot(){var t;return this.cachedSavedServerSidePatchIdsSnapshot===null&&(this.cachedSavedServerSidePatchIdsSnapshot=((t=this.savedButNotYetGlobalServerSidePatchIds)==null?void 0:t.slice())||[]),this.cachedSavedServerSidePatchIdsSnapshot}getPublishDisabledSnapshot(){return this.cachedPublishDisabledSnapshot===null&&(this.cachedPublishDisabledSnapshot=this.publishDisabled),this.cachedPublishDisabledSnapshot}getAutoPublishSnapshot(){return this.cachedAutoPublishSnapshot===null&&(this.cachedAutoPublishSnapshot=this.autoPublish),this.cachedAutoPublishSnapshot}addPatch(t,n,r,o){var c,u,d,h,p,m,v,b,x,w,S,C;const[i]=ee.splitModuleFilePathAndModulePath(t),s=this.pendingOps[this.pendingOps.length-1];if(this.serverSources===null||((c=this.serverSources)==null?void 0:c[i])===void 0)return this.addTransientGlobalError(`Content at '${i}' is not yet initialized`,o),{status:"patch-error",message:`Content at '${i}' is not yet initialized`,moduleFilePath:i};this.optimisticClientSources[i]===void 0&&(this.optimisticClientSources[i]=this.serverSources[i]);const a=r.filter(_=>_.op!=="file"),l=sU(Ai(this.optimisticClientSources[i]),cU,a);if(kz.isErr(l))return console.error("Could not apply patch:",l.error),this.addTransientGlobalError(`Could apply patch: ${l.error.message}`,o),{status:"patch-error",message:l.error.message,moduleFilePath:i};{const _=l.value;if(this.syncStatus[t]="patches-pending",this.optimisticClientSources[i]=_,(s==null?void 0:s.type)==="add-patches"){const P=(((d=(u=s.data)==null?void 0:u[i])==null?void 0:d.length)||0)-1,O=(m=(p=(h=s.data)==null?void 0:h[i])==null?void 0:p[P])==null?void 0:m.patch,j=(x=(b=(v=s.data)==null?void 0:v[i])==null?void 0:b[P])==null?void 0:x.patchId;if(aU(O,r)&&((C=(S=(w=s.data)==null?void 0:w[i])==null?void 0:S[P])==null?void 0:C.type)===n&&j&&this.patchDataByPatchId[j])return s.data[i][P].patch=r,s.updatedAt=o,this.invalidatePendingOps(),this.patchDataByPatchId[j].patch=r,this.patchSetInsert(i,j,r,o),this.invalidateSyncStatus(t),this.invalidateSource(i),{status:"patch-merged",patchId:j,moduleFilePath:i};{s.data[i]||(s.data[i]=[]);const I=this.createPatchId();return s.data[i].push({patch:r,type:n,patchId:I}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(I),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[I]={moduleFilePath:i,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(i,I,r,o),this.invalidateSyncStatus(t),this.invalidateSource(i),{status:"patch-added",patchId:I,moduleFilePath:i}}}else{const P=this.createPatchId();return this.pendingOps.push({type:"add-patches",data:{[i]:[{patch:r,type:n,patchId:P}]},createdAt:o}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(P),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[P]={moduleFilePath:i,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(i,P,r,o),this.invalidateSyncStatus(t),this.invalidateSource(i),{status:"patch-added",patchId:P,moduleFilePath:i}}}}createPatchId(){return crypto.randomUUID()}patchSetInsert(t,n,r,o){var s;const i=new Date(o).toISOString();for(const a of r)this.patchSets.insert(t,((s=this.schemas)==null?void 0:s[t])??void 0,a,n,i,this.authorId);this.invalidatePatchSets()}deletePatches(t,n){const r=this.pendingOps[this.pendingOps.length-1];if((r==null?void 0:r.type)==="delete-patches"){r.patchIds.push(...t),r.updatedAt=n;return}this.pendingOps.push({type:"delete-patches",patchIds:t,createdAt:n}),this.invalidatePendingOps()}markAllSyncStatusIn(t,n){for(const r in this.syncStatus)r.startsWith(t)&&(this.syncStatus[r]=n)}getParentRef(){if(this.baseSha===null||this.globalServerSidePatchIds===null)return null;const t=this.savedButNotYetGlobalServerSidePatchIds[this.savedButNotYetGlobalServerSidePatchIds.length-1]||this.globalServerSidePatchIds[this.globalServerSidePatchIds.length-1];return t?{type:"patch",patchId:t}:{type:"head",headBaseSha:this.baseSha}}async syncWithUpdatedStat(t,n,r,o,i,s,a,l){const c=this.sourcesSha!==o;if(this.sourcesSha=o,this.baseSha=n,this.mode=t,this.serverSideSchemaSha!==r||this.commitSha!==a)return this.reset(),this.serverSideSchemaSha=r,this.commitSha=a,this.init(t,n,r,o,i,s,a,l);const u=this.globalServerSidePatchIds===null||!lu(this.globalServerSidePatchIds,i);if(u){this.globalServerSidePatchIds=i;const d=new Set(i);this.deletePendingPatchId(d),this.deleteSavedButNotYetGlobalServerSidePatchIds(d),await this.syncPatches(!1,l),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),this.invalidatePendingClientSidePatchIds()}return!this.forceSyncAllModules&&(c||u)&&(this.forceSyncAllModules=!0),this.sync(l)}async executeAddPatches(t,n,r){const o=[],i=[];for(const[l,c]of Object.entries(t.data)){const u=l;for(const d of c)o.push({path:u,patchId:d.patchId,patch:d.patch}),i.push(d.patchId),n[u]||(n[u]=new Set),n[u].add(d.type)}const s=this.getParentRef();if(s===null)return this.addTransientGlobalError("Tried to update content with changes, but could not since Val is not yet initialized",r),{status:"retry",reason:"not-initialized"};const a=await this.client("/patches","PUT",{body:{patches:o,parentRef:s}});if(a.status===null)return console.warn("Network error: trying again..."),this.addTransientGlobalError("Network error: trying again",r),{status:"retry",reason:"network-error"};if(a.status===409)return this.savedButNotYetGlobalServerSidePatchIds=[],{status:"retry",reason:"conflict"};if(a.status!==200){console.error("Failed to add patches",{error:a.json.message}),this.addTransientGlobalError("Failed to save changes",r,a.json.message);for(const c of i)this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0};const l=new Set(i);this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!l.has(c))}else{const l=new Set(a.json.newPatchIds);this.deletePendingPatchId(l);for(const c of i){const u=c;this.savedButNotYetGlobalServerSidePatchIds.push(u),this.patchDataByPatchId[u]&&(this.patchDataByPatchId[u].isPending=!1)}}return{status:"done"}}deletePendingPatchId(t){let n=0;for(let r=0;r<this.pendingClientPatchIds.length;r++){const o=this.pendingClientPatchIds[r];if(t.has(o)&&(this.pendingClientPatchIds.splice(r,1),r--,n++,t.size===n))break}}deleteSavedButNotYetGlobalServerSidePatchIds(t){let n=0;for(let r=0;r<this.savedButNotYetGlobalServerSidePatchIds.length;r++){const o=this.savedButNotYetGlobalServerSidePatchIds[r];if(t.has(o)&&(this.savedButNotYetGlobalServerSidePatchIds.splice(r,1),r--,n++,t.size===n))break}}async executeDeletePatches(t,n,r){var l;let o=!1;const i=t.patchIds,s=new Set(i),a=await this.client("/patches","DELETE",{query:{id:t.patchIds.reverse()}});if(a.status===null)return this.addTransientGlobalError("Network error: trying again",r),{status:"retry",reason:"network-error"};if(a.status!==200)this.addTransientGlobalError("Failed to delete patches",r);else{for(const c of t.patchIds)if(this.patchDataByPatchId[c]){const u=this.patchDataByPatchId[c].moduleFilePath;n[u]||(n[u]=new Set),n[u].add("unknown"),this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0}}else o=!0;this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!s.has(c)),this.globalServerSidePatchIds=((l=this.globalServerSidePatchIds)==null?void 0:l.filter(c=>!s.has(c)))??null}return{status:"done",syncAllRequired:o}}async syncSchema(){const t=await this.client("/schema","GET",{});if(t.status===200){this.schemas={};for(const[n,r]of Object.entries(t.json.schemas)){const o=n;r&&(this.schemas[o]=r)}return this.clientSideSchemaSha!==t.json.schemaSha&&(this.clientSideSchemaSha=t.json.schemaSha),console.debug("Invalidating schema"),this.invalidateSchema(),{status:"done"}}else if(t.status===null)return{status:"retry",reason:"error"};return{status:"retry",reason:"error"}}async syncPatches(t,n){var l;const r=this.globalServerSidePatchIds||[];let o=!1,i=!1;if(this.initializedAt===null||t){this.patchSets=new pd,o=!0;const c=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:void 0}});if(c.status!==200)return this.addTransientGlobalError("Failed to get changes (full sync)",n,`Did not get ok status (got: ${c.status}): ${c.json.message}`),{status:"retry"};for(const u of c.json.patches)u.patch&&(i=!0,this.patchDataByPatchId[u.patchId]={moduleFilePath:u.path,patch:u.patch,isPending:!1,createdAt:u.createdAt,authorId:u.authorId,isCommitted:u.appliedAt?{commitSha:u.appliedAt.commitSha}:void 0});c.json.error&&this.addTransientGlobalError("Some changes has errors",n,c.json.error.message);for(const u of Object.values(c.json.errors||{}))u&&this.addTransientGlobalError("A change has an error",n,u.message)}else{const c=[];for(const u of this.globalServerSidePatchIds||[])this.patchDataByPatchId[u]||c.push(u);if(c.length>0){const d=[];for(let h=0;h<c.length;h+=100)d.push(c.slice(h,h+100));for(const h of d){const p=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:h}});if(p.status!==200)return this.addTransientGlobalError("Failed to get changes (batch)",n,`Did not get ok status (got: ${p.status}): ${p.json.message}`),{status:"retry"};for(const m of p.json.patches)m.patch&&(i=!0,this.patchDataByPatchId[m.patchId]={moduleFilePath:m.path,patch:m.patch,isPending:!1,createdAt:m.createdAt,authorId:m.authorId,isCommitted:m.appliedAt?{commitSha:m.appliedAt.commitSha}:void 0})}}}const s=new Set(r);for(const c of Array.from(this.patchSets.getInsertedPatches())||[])if(!s.has(c)){this.patchSets=new pd,o=!0;break}const a=[];for(const c of r)if(!this.patchSets.isInserted(c)){const u=this.patchDataByPatchId[c],d=(u==null?void 0:u.moduleFilePath)&&((l=this.schemas)==null?void 0:l[u==null?void 0:u.moduleFilePath]);if(u&&d)for(const h of u.patch)o=!0,this.patchSets.insert(u.moduleFilePath,d,h,c,u.createdAt,u.authorId);else a.push(c)}return i&&this.invalidateAllPatches(),o&&this.invalidatePatchSets(),a.length>0?(this.initializedAt!==null&&(console.debug("Missing data for patch ids",a,{currentPatchIds:r,reset:t}),this.addTransientGlobalError("Failed to get changes",n,`Missing data for patch ids: ${a.join(", ")}`)),{status:"retry"}):{status:"done"}}getChangedModules(t){const n=Object.entries(t);if(n.length===0)return[];if(n.length===1){const[r,o]=n[0];if(Array.from(o).every(i=>uU.includes(i)))return[r]}return"all"}async sync(t){var s,a,l,c,u,d,h,p;if(this.isSyncing)return{status:"retry",reason:"already-syncing"};if(this.isPublishing)return{status:"retry",reason:"publishing"};let n=[];this.forceSyncAllModules&&(this.forceSyncAllModules=!1,n="all"),this.initializedAt===null&&(n="all"),this.clientSideSchemaSha!==this.serverSideSchemaSha&&(n="all"),this.isSyncing=!0;let r=[],o=!1;const i=new Set([...this.syncedServerSidePatchIds,...this.savedButNotYetGlobalServerSidePatchIds]);if(this.globalServerSidePatchIds&&this.mode==="http"){for(const m of i)if(!this.globalServerSidePatchIds.includes(m)){this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingClientPatchIds=[],await this.syncPatches(!0,t),o=!0;break}}try{const m={},v=(w,S)=>t-S<=w*1e3,b=(w,S)=>t-S>=w*1e3;if(((s=this.pendingOps[this.pendingOps.length-1])==null?void 0:s.updatedAt)!==void 0&&v(this.MIN_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].updatedAt)&&!b(this.MAX_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].createdAt))return{status:"retry",reason:"too-fast"};r=this.pendingOps.slice(),this.pendingOps=[];let x=!1;for(;r[0];){const w=r[0];if(w.type==="add-patches")try{const S=await this.executeAddPatches(w,m,t);if(S.status!=="done")return S}catch{return{status:"retry",reason:"error"}}else if(w.type==="delete-patches")try{const S=await this.executeDeletePatches(w,m,t);if(S.status!=="done")return S;S.syncAllRequired&&n!=="all"&&(n="all")}catch{return{status:"retry",reason:"error"}}x=!0,r.shift()}if(this.invalidatePendingOps(),n!=="all"){const w=this.getChangedModules(m);if(w==="all")n="all";else for(const S of w)n.push(S)}if(this.clientSideSchemaSha===null||this.schemas===null||this.initializedAt===null){const w=await this.syncSchema();if(w.status!=="done")return w}if(console.debug("Syncing?",{changedModules:n}),n==="all"||n.length>0){const w=n!=="all"&&n.length===1?n[0]:void 0,S=await this.client("/sources/~","PUT",{path:w,query:{validate_sources:!0,validate_binary_files:!1}});if(S.status===null)return this.addTransientGlobalError("Network error: trying again",t),{status:"retry",reason:"network-error"};if(S.status!==200)this.addTransientGlobalError("Could not sync content with server. Please wait or reload the application.",t,S.json.message);else{const C=new Set;for(const _ in this.errors.validationErrors){const P=_;(w===void 0||P.startsWith(w))&&(C.add(P),this.errors.validationErrors[P]&&(this.errors.validationErrors={...this.errors.validationErrors,[P]:void 0}))}for(const[_,P]of Object.entries(S.json.modules)){const O=_;if(P){this.serverSources===null&&(this.serverSources={}),this.serverSources[O]=P.source,(lu(this.serverSources[O],this.optimisticClientSources[O])||this.pendingOps.length===0)&&(this.optimisticClientSources={...this.optimisticClientSources,[O]:void 0}),console.debug("Invalidating source",O),this.invalidateSource(O),(a=this.overlayEmitter)==null||a.call(this,O,P.source);for(const j in P.validationErrors){const I=j;this.errors.validationErrors||(this.errors.validationErrors={}),this.errors.validationErrors[I]=P.validationErrors[I],C.add(I)}for(const j of((l=P.patches)==null?void 0:l.applied)||[])this.syncedServerSidePatchIds.push(j);for(const j of((c=P.patches)==null?void 0:c.skipped)||[])this.syncedServerSidePatchIds.push(j)}else this.addTransientGlobalError(`Could not find '${O}' in server reply`,t,"This is most likely a bug");this.markAllSyncStatusIn(O,"done")}this.invalidateAllValidationErrors();for(const _ of Array.from(C))this.invalidateValidationError(_);S.json.schemaSha!==this.clientSideSchemaSha&&await this.syncSchema()}}if(this.autoPublish&&this.mode==="fs"&&this.globalServerSidePatchIds&&this.globalServerSidePatchIds.length>0){let w=!1;for(const S in this.errors.validationErrors||{}){const C=S;if((d=(u=this.errors)==null?void 0:u.validationErrors)!=null&&d[C]&&((p=(h=this.errors)==null?void 0:h.validationErrors)==null?void 0:p[C].length)>0){w=!0;break}}w?console.debug("Skip auto-publish since there's validation errors",this.errors.validationErrors):(await this.publish(this.globalServerSidePatchIds.concat(...Array.from(this.syncedServerSidePatchIds)),void 0,t),x=!0)}return(o||x)&&(this.invalidatePendingClientSidePatchIds(),this.invalidateGlobalServerSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds()),{status:"done"}}finally{this.isSyncing=!1,this.pendingOps=[...r,...this.pendingOps]}}async publish(t,n,r){try{if(this.isPublishing)return console.debug("Already publishing changes",r),{status:"retry",reason:"already-publishing"};if(this.isPublishing=!0,this.publishDisabled)return console.debug("Could not publish changes, since the publish is disabled",r),{status:"retry",reason:"publish-disabled"};if(this.publishDisabled=!0,this.invalidatePublishDisabled(),Object.values(this.errors.validationErrors||{}).flatMap(s=>s||[]).length>0)return console.debug("Skipping publish since there's validation errors",this.errors.validationErrors),this.addTransientGlobalError("Could not publish changes, since there are validation errors",r),{status:"retry",reason:"validation-error"};if(t.length===0)return this.addTransientGlobalError("Could not publish changes, since there are no changes to publish",Date.now()),{status:"done"};const i=await this.client("/save","POST",{body:{message:n,patchIds:t}});return i.status===null?(this.addTransientGlobalError("Network error: could not publish",Date.now()),{status:"retry"}):i.status!==200?(this.addTransientGlobalError("Failed to publish changes",Date.now(),i.json.message),{status:"retry"}):(this.mode==="fs"&&(this.globalServerSidePatchIds=[],console.log("Deleting all patch ids")),this.pendingClientPatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.patchDataByPatchId={},this.patchSets=new pd,await this.syncPatches(!0,r),this.invalidatePatchSets(),this.invalidateAllPatches(),this.invalidatePendingClientSidePatchIds(),this.invalidateSyncedServerSidePatchIds(),this.invalidateSavedServerSidePatchIds(),{status:"done"})}catch(o){return console.error("Error while publishing",o),this.addTransientGlobalError("Failed to publish changes",Date.now(),o.message),{status:"retry",reason:"error"}}finally{this.isPublishing=!1,this.publishDisabled=!1,this.invalidatePublishDisabled()}}addTransientGlobalError(t,n,r){this.errors.transientGlobalErrorQueue||(this.errors.transientGlobalErrorQueue=[]),console.error("Transient global error",t,r||""),this.errors.transientGlobalErrorQueue.push({message:t,details:r,timestamp:n}),this.invalidateTransientGlobalError()}}const cU=new oU,Hn="global",uU=["string","boolean","number","date","richtext","file","image"],dU=(e,t)=>{window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:e,source:t}}))};function fU(e,t,n){var o,i,s;const r={};for(const a of e)r[a.commitSha]=a;for(const a of t)r[a.commitSha]||(r[a.commitSha]={commitMessage:(a==null?void 0:a.commitMessage)||null,deploymentState:"created",creator:a.creator,createdAt:a.createdAt,updatedAt:a.createdAt,commitSha:a.commitSha});for(const a of n)a.commitSha&&(r[a.commitSha]={commitMessage:((o=r[a.commitSha])==null?void 0:o.commitMessage)||null,deploymentState:a.deploymentState,creator:((i=r[a.commitSha])==null?void 0:i.creator)||null,createdAt:((s=r[a.commitSha])==null?void 0:s.createdAt)||a.createdAt,updatedAt:a.updatedAt,commitSha:a.commitSha});return Object.values(r).sort((a,l)=>new Date(l.updatedAt).getTime()-new Date(a.updatedAt).getTime())}function te(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 hU(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Dv(...e){return t=>e.forEach(n=>hU(n,t))}function Be(...e){return g.useCallback(Dv(...e),e)}function pU(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 uo(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:h,children:p,...m}=d,v=((x=h==null?void 0:h[e])==null?void 0:x[l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,m=g.useContext(p);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,mU(o,...t)]}function mU(...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 Qi=g.forwardRef((e,t)=>{const{children:n,...r}=e,o=g.Children.toArray(n),i=o.find(gU);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(wb,{...r,ref:t,children:g.isValidElement(s)?g.cloneElement(s,void 0,a):null})}return f.jsx(wb,{...r,ref:t,children:n})});Qi.displayName="Slot";var wb=g.forwardRef((e,t)=>{const{children:n,...r}=e;if(g.isValidElement(n)){const o=yU(n);return g.cloneElement(n,{...vU(r,n.props),ref:t?Dv(t,o):o})}return g.Children.count(n)>1?g.Children.only(null):null});wb.displayName="SlotClone";var Tj=({children:e})=>f.jsx(f.Fragment,{children:e});function gU(e){return g.isValidElement(e)&&e.type===Tj}function vU(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 yU(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 xU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_e=xU.reduce((e,t)=>{const n=g.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Qi: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 Pj(e,t){e&&Mr.flushSync(()=>e.dispatchEvent(t))}function tn(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)},[])}function bU(e,t=globalThis==null?void 0:globalThis.document){const n=tn(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 wU="DismissableLayer",Sb="dismissableLayer.update",SU="dismissableLayer.pointerDownOutside",kU="dismissableLayer.focusOutside",HC,Nj=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$l=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=g.useContext(Nj),[u,d]=g.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=Be(t,O=>d(O)),v=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(b),w=u?v.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,C=w>=x,_=_U(O=>{const j=O.target,I=[...c.branches].some(F=>F.contains(j));!C||I||(o==null||o(O),s==null||s(O),O.defaultPrevented||a==null||a())},h),P=TU(O=>{const j=O.target;[...c.branches].some(F=>F.contains(j))||(i==null||i(O),s==null||s(O),O.defaultPrevented||a==null||a())},h);return bU(O=>{w===c.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},h),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(HC=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),WC(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=HC)}},[u,h,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),WC())},[u,c]),g.useEffect(()=>{const O=()=>p({});return document.addEventListener(Sb,O),()=>document.removeEventListener(Sb,O)},[]),f.jsx(_e.div,{...l,ref:m,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,P.onFocusCapture),onBlurCapture:te(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,_.onPointerDownCapture)})});$l.displayName=wU;var EU="DismissableLayerBranch",CU=g.forwardRef((e,t)=>{const n=g.useContext(Nj),r=g.useRef(null),o=Be(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),f.jsx(_e.div,{...e,ref:o})});CU.displayName=EU;function _U(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){Oj(SU,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 TU(e,t=globalThis==null?void 0:globalThis.document){const n=tn(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&Oj(kU,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(Sb);document.dispatchEvent(e)}function Oj(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?Pj(o,i):o.dispatchEvent(i)}var _n=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},PU=aF.useId||(()=>{}),NU=0;function Ir(e){const[t,n]=g.useState(PU());return _n(()=>{n(r=>r??String(NU++))},[e]),t?`radix-${t}`:""}const OU=["top","right","bottom","left"],ya=Math.min,Tr=Math.max,xg=Math.round,Up=Math.floor,li=e=>({x:e,y:e}),MU={left:"right",right:"left",bottom:"top",top:"bottom"},jU={start:"end",end:"start"};function kb(e,t,n){return Tr(e,ya(t,n))}function es(e,t){return typeof e=="function"?e(t):e}function ts(e){return e.split("-")[0]}function Mu(e){return e.split("-")[1]}function eS(e){return e==="x"?"y":"x"}function tS(e){return e==="y"?"height":"width"}function xa(e){return["top","bottom"].includes(ts(e))?"y":"x"}function nS(e){return eS(xa(e))}function RU(e,t,n){n===void 0&&(n=!1);const r=Mu(e),o=nS(e),i=tS(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=bg(s)),[s,bg(s)]}function IU(e){const t=bg(e);return[Eb(e),t,Eb(t)]}function Eb(e){return e.replace(/start|end/g,t=>jU[t])}function AU(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 DU(e,t,n,r){const o=Mu(e);let i=AU(ts(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Eb)))),i}function bg(e){return e.replace(/left|right|bottom|top/g,t=>MU[t])}function LU(e){return{top:0,right:0,bottom:0,left:0,...e}}function Mj(e){return typeof e!="number"?LU(e):{top:e,right:e,bottom:e,left:e}}function wg(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 KC(e,t,n){let{reference:r,floating:o}=e;const i=xa(t),s=nS(t),a=tS(s),l=ts(t),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Mu(t)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1);break}return p}const FU=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}=KC(c,r,l),h=r,p={},m=0;for(let v=0;v<a.length;v++){const{name:b,fn:x}=a[v],{x:w,y:S,data:C,reset:_}=await x({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});u=w??u,d=S??d,p={...p,[b]:{...p[b],...C}},_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(h=_.placement),_.rects&&(c=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:u,y:d}=KC(c,h,l)),v=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:p}};async function eh(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:h=!1,padding:p=0}=es(t,e),m=Mj(p),b=a[h?d==="floating"?"reference":"floating":d],x=wg(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,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),C=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},_=wg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:S,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 zU=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}=es(e,t)||{};if(c==null)return{};const d=Mj(u),h={x:n,y:r},p=nS(o),m=tS(p),v=await s.getDimensions(c),b=p==="y",x=b?"top":"left",w=b?"bottom":"right",S=b?"clientHeight":"clientWidth",C=i.reference[m]+i.reference[p]-h[p]-i.floating[m],_=h[p]-i.reference[p],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let O=P?P[S]:0;(!O||!await(s.isElement==null?void 0:s.isElement(P)))&&(O=a.floating[S]||i.floating[m]);const j=C/2-_/2,I=O/2-v[m]/2-1,F=ya(d[x],I),H=ya(d[w],I),$=F,J=O-v[m]-H,W=O/2-v[m]/2+j,B=kb($,W,J),A=!l.arrow&&Mu(o)!=null&&W!==B&&i.reference[m]/2-(W<$?F:H)-v[m]/2<0,R=A?W<$?W-$:W-J:0;return{[p]:h[p]+R,data:{[p]:B,centerOffset:W-B-R,...A&&{alignmentOffset:R}},reset:A}}}),BU=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:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...b}=es(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const x=ts(o),w=xa(a),S=ts(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),_=h||(S||!v?[bg(a)]:IU(a)),P=m!=="none";!h&&P&&_.push(...DU(a,v,m,C));const O=[a,..._],j=await eh(t,b),I=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&I.push(j[x]),d){const W=RU(o,s,C);I.push(j[W[0]],j[W[1]])}if(F=[...F,{placement:o,overflows:I}],!I.every(W=>W<=0)){var H,$;const W=(((H=i.flip)==null?void 0:H.index)||0)+1,B=O[W];if(B)return{data:{index:W,overflows:F},reset:{placement:B}};let A=($=F.filter(R=>R.overflows[0]<=0).sort((R,N)=>R.overflows[1]-N.overflows[1])[0])==null?void 0:$.placement;if(!A)switch(p){case"bestFit":{var J;const R=(J=F.filter(N=>{if(P){const D=xa(N.placement);return D===w||D==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(D=>D>0).reduce((D,z)=>D+z,0)]).sort((N,D)=>N[1]-D[1])[0])==null?void 0:J[0];R&&(A=R);break}case"initialPlacement":A=a;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function GC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qC(e){return OU.some(t=>e[t]>=0)}const $U=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=es(e,t);switch(r){case"referenceHidden":{const i=await eh(t,{...o,elementContext:"reference"}),s=GC(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:qC(s)}}}case"escaped":{const i=await eh(t,{...o,altBoundary:!0}),s=GC(i,n.floating);return{data:{escapedOffsets:s,escaped:qC(s)}}}default:return{}}}}};async function VU(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=ts(n),a=Mu(n),l=xa(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,d=es(t,e);let{mainAxis:h,crossAxis:p,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"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const UU=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 VU(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}}}}},HU=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}=es(e,t),c={x:n,y:r},u=await eh(t,l),d=xa(ts(o)),h=eS(d);let p=c[h],m=c[d];if(i){const b=h==="y"?"top":"left",x=h==="y"?"bottom":"right",w=p+u[b],S=p-u[x];p=kb(w,p,S)}if(s){const b=d==="y"?"top":"left",x=d==="y"?"bottom":"right",w=m+u[b],S=m-u[x];m=kb(w,m,S)}const v=a.fn({...t,[h]:p,[d]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[d]:s}}}}}},WU=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}=es(e,t),u={x:n,y:r},d=xa(o),h=eS(d);let p=u[h],m=u[d];const v=es(a,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const S=h==="y"?"height":"width",C=i.reference[h]-i.floating[S]+b.mainAxis,_=i.reference[h]+i.reference[S]-b.mainAxis;p<C?p=C:p>_&&(p=_)}if(c){var x,w;const S=h==="y"?"width":"height",C=["top","left"].includes(ts(o)),_=i.reference[d]-i.floating[S]+(C&&((x=s.offset)==null?void 0:x[d])||0)+(C?0:b.crossAxis),P=i.reference[d]+i.reference[S]+(C?0:((w=s.offset)==null?void 0:w[d])||0)-(C?b.crossAxis:0);m<_?m=_:m>P&&(m=P)}return{[h]:p,[d]:m}}}},KU=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}=es(e,t),u=await eh(t,c),d=ts(o),h=Mu(o),p=xa(o)==="y",{width:m,height:v}=i.floating;let b,x;d==="top"||d==="bottom"?(b=d,x=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(x=d,b=h==="end"?"top":"bottom");const w=v-u.top-u.bottom,S=m-u.left-u.right,C=ya(v-u[b],w),_=ya(m-u[x],S),P=!t.middlewareData.shift;let O=C,j=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(j=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=w),P&&!h){const F=Tr(u.left,0),H=Tr(u.right,0),$=Tr(u.top,0),J=Tr(u.bottom,0);p?j=m-2*(F!==0||H!==0?F+H:Tr(u.left,u.right)):O=v-2*($!==0||J!==0?$+J:Tr(u.top,u.bottom))}await l({...t,availableWidth:j,availableHeight:O});const I=await s.getDimensions(a.floating);return m!==I.width||v!==I.height?{reset:{rects:!0}}:{}}}};function Lv(){return typeof window<"u"}function ju(e){return jj(e)?(e.nodeName||"").toLowerCase():"#document"}function Ar(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xi(e){var t;return(t=(jj(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jj(e){return Lv()?e instanceof Node||e instanceof Ar(e).Node:!1}function $o(e){return Lv()?e instanceof Element||e instanceof Ar(e).Element:!1}function fi(e){return Lv()?e instanceof HTMLElement||e instanceof Ar(e).HTMLElement:!1}function YC(e){return!Lv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ar(e).ShadowRoot}function Uh(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Vo(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function GU(e){return["table","td","th"].includes(ju(e))}function Fv(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function rS(e){const t=oS(),n=$o(e)?Vo(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 qU(e){let t=ba(e);for(;fi(t)&&!cu(t);){if(rS(t))return t;if(Fv(t))return null;t=ba(t)}return null}function oS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function cu(e){return["html","body","#document"].includes(ju(e))}function Vo(e){return Ar(e).getComputedStyle(e)}function zv(e){return $o(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ba(e){if(ju(e)==="html")return e;const t=e.assignedSlot||e.parentNode||YC(e)&&e.host||xi(e);return YC(t)?t.host:t}function Rj(e){const t=ba(e);return cu(t)?e.ownerDocument?e.ownerDocument.body:e.body:fi(t)&&Uh(t)?t:Rj(t)}function th(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Rj(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ar(o);if(i){const a=Cb(s);return t.concat(s,s.visualViewport||[],Uh(o)?o:[],a&&n?th(a):[])}return t.concat(o,th(o,[],n))}function Cb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ij(e){const t=Vo(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=fi(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=xg(n)!==i||xg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function iS(e){return $o(e)?e:e.contextElement}function Fc(e){const t=iS(e);if(!fi(t))return li(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Ij(t);let s=(i?xg(n.width):n.width)/r,a=(i?xg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const YU=li(0);function Aj(e){const t=Ar(e);return!oS()||!t.visualViewport?YU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function JU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ar(e)?!1:t}function El(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=iS(e);let s=li(1);t&&(r?$o(r)&&(s=Fc(r)):s=Fc(e));const a=JU(i,n,r)?Aj(i):li(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 h=Ar(i),p=r&&$o(r)?Ar(r):r;let m=h,v=Cb(m);for(;v&&r&&p!==m;){const b=Fc(v),x=v.getBoundingClientRect(),w=Vo(v),S=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+=S,c+=C,m=Ar(v),v=Cb(m)}}return wg({width:u,height:d,x:l,y:c})}function sS(e,t){const n=zv(e).scrollLeft;return t?t.left+n:El(xi(e)).left+n}function Dj(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:sS(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function XU(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=xi(r),a=t?Fv(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=li(1);const u=li(0),d=fi(r);if((d||!d&&!i)&&((ju(r)!=="body"||Uh(s))&&(l=zv(r)),fi(r))){const p=El(r);c=Fc(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=s&&!d&&!i?Dj(s,l,!0):li(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function ZU(e){return Array.from(e.getClientRects())}function QU(e){const t=xi(e),n=zv(e),r=e.ownerDocument.body,o=Tr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Tr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+sS(e);const a=-n.scrollTop;return Vo(r).direction==="rtl"&&(s+=Tr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function eH(e,t){const n=Ar(e),r=xi(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=oS();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function tH(e,t){const n=El(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=fi(e)?Fc(e):li(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 JC(e,t,n){let r;if(t==="viewport")r=eH(e,n);else if(t==="document")r=QU(xi(e));else if($o(t))r=tH(t,n);else{const o=Aj(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return wg(r)}function Lj(e,t){const n=ba(e);return n===t||!$o(n)||cu(n)?!1:Vo(n).position==="fixed"||Lj(n,t)}function nH(e,t){const n=t.get(e);if(n)return n;let r=th(e,[],!1).filter(a=>$o(a)&&ju(a)!=="body"),o=null;const i=Vo(e).position==="fixed";let s=i?ba(e):e;for(;$o(s)&&!cu(s);){const a=Vo(s),l=rS(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Uh(s)&&!l&&Lj(e,s))?r=r.filter(u=>u!==s):o=a,s=ba(s)}return t.set(e,r),r}function rH(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Fv(t)?[]:nH(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const d=JC(t,u,o);return c.top=Tr(d.top,c.top),c.right=ya(d.right,c.right),c.bottom=ya(d.bottom,c.bottom),c.left=Tr(d.left,c.left),c},JC(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function oH(e){const{width:t,height:n}=Ij(e);return{width:t,height:n}}function iH(e,t,n){const r=fi(t),o=xi(t),i=n==="fixed",s=El(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=li(0);if(r||!r&&!i)if((ju(t)!=="body"||Uh(o))&&(a=zv(t)),r){const h=El(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&(l.x=sS(o));const c=o&&!r&&!i?Dj(o,a):li(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 _x(e){return Vo(e).position==="static"}function XC(e,t){if(!fi(e)||Vo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return xi(e)===n&&(n=n.ownerDocument.body),n}function Fj(e,t){const n=Ar(e);if(Fv(e))return n;if(!fi(e)){let o=ba(e);for(;o&&!cu(o);){if($o(o)&&!_x(o))return o;o=ba(o)}return n}let r=XC(e,t);for(;r&&GU(r)&&_x(r);)r=XC(r,t);return r&&cu(r)&&_x(r)&&!rS(r)?n:r||qU(e)||n}const sH=async function(e){const t=this.getOffsetParent||Fj,n=this.getDimensions,r=await n(e.floating);return{reference:iH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function aH(e){return Vo(e).direction==="rtl"}const lH={convertOffsetParentRelativeRectToViewportRelativeRect:XU,getDocumentElement:xi,getClippingRect:rH,getOffsetParent:Fj,getElementRects:sH,getClientRects:ZU,getDimensions:oH,getScale:Fc,isElement:$o,isRTL:aH};function cH(e,t){let n=null,r;const o=xi(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:h}=e.getBoundingClientRect();if(a||t(),!d||!h)return;const p=Up(u),m=Up(o.clientWidth-(c+d)),v=Up(o.clientHeight-(u+h)),b=Up(c),w={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:Tr(0,ya(1,l))||1};let S=!0;function C(_){const P=_[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return s(!0),i}function uH(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=iS(e),u=o||i?[...c?th(c):[],...th(t)]:[];u.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const d=c&&a?cH(c,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(x=>{let[w]=x;w&&w.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m,v=l?El(e):null;l&&b();function b(){const x=El(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=p)==null||x.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const dH=UU,fH=HU,hH=BU,pH=KU,mH=$U,ZC=zU,gH=WU,vH=(e,t,n)=>{const r=new Map,o={platform:lH,...n},i={...o.platform,_c:r};return FU(e,t,{...o,platform:i})};var vm=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 zj(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function QC(e,t){const n=zj(e);return Math.round(t*n)/n}function Tx(e){const t=g.useRef(e);return vm(()=>{t.current=e}),t}function yH(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}),[h,p]=g.useState(r);Sg(h,r)||p(r);const[m,v]=g.useState(null),[b,x]=g.useState(null),w=g.useCallback(N=>{N!==P.current&&(P.current=N,v(N))},[]),S=g.useCallback(N=>{N!==O.current&&(O.current=N,x(N))},[]),C=i||m,_=s||b,P=g.useRef(null),O=g.useRef(null),j=g.useRef(u),I=l!=null,F=Tx(l),H=Tx(o),$=Tx(c),J=g.useCallback(()=>{if(!P.current||!O.current)return;const N={placement:t,strategy:n,middleware:h};H.current&&(N.platform=H.current),vH(P.current,O.current,N).then(D=>{const z={...D,isPositioned:$.current!==!1};W.current&&!Sg(j.current,z)&&(j.current=z,Mr.flushSync(()=>{d(z)}))})},[h,t,n,H,$]);vm(()=>{c===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,d(N=>({...N,isPositioned:!1})))},[c]);const W=g.useRef(!1);vm(()=>(W.current=!0,()=>{W.current=!1}),[]),vm(()=>{if(C&&(P.current=C),_&&(O.current=_),C&&_){if(F.current)return F.current(C,_,J);J()}},[C,_,J,F,I]);const B=g.useMemo(()=>({reference:P,floating:O,setReference:w,setFloating:S}),[w,S]),A=g.useMemo(()=>({reference:C,floating:_}),[C,_]),R=g.useMemo(()=>{const N={position:n,left:0,top:0};if(!A.floating)return N;const D=QC(A.floating,u.x),z=QC(A.floating,u.y);return a?{...N,transform:"translate("+D+"px, "+z+"px)",...zj(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:z}},[n,a,A.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:J,refs:B,elements:A,floatingStyles:R}),[u,J,B,A,R])}const xH=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?ZC({element:r.current,padding:o}).fn(n):{}:r?ZC({element:r,padding:o}).fn(n):{}}}},bH=(e,t)=>({...dH(e),options:[e,t]}),wH=(e,t)=>({...fH(e),options:[e,t]}),SH=(e,t)=>({...gH(e),options:[e,t]}),kH=(e,t)=>({...hH(e),options:[e,t]}),EH=(e,t)=>({...pH(e),options:[e,t]}),CH=(e,t)=>({...mH(e),options:[e,t]}),_H=(e,t)=>({...xH(e),options:[e,t]});var TH="Arrow",Bj=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return f.jsx(_e.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"})})});Bj.displayName=TH;var PH=Bj;function NH(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);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,OH(o,...t)]}function OH(...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 aS(e){const[t,n]=g.useState(void 0);return _n(()=>{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 lS="Popper",[$j,bi]=NH(lS),[MH,Vj]=$j(lS),Uj=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return f.jsx(MH,{scope:t,anchor:r,onAnchorChange:o,children:n})};Uj.displayName=lS;var Hj="PopperAnchor",Wj=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Vj(Hj,n),s=g.useRef(null),a=Be(t,s);return g.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.jsx(_e.div,{...o,ref:a})});Wj.displayName=Hj;var cS="PopperContent",[jH,RH]=$j(cS),Kj=g.forwardRef((e,t)=>{var ne,Oe,Ae,pe,De,Pe;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:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...v}=e,b=Vj(cS,n),[x,w]=g.useState(null),S=Be(t,Ze=>w(Ze)),[C,_]=g.useState(null),P=aS(C),O=(P==null?void 0:P.width)??0,j=(P==null?void 0:P.height)??0,I=r+(i!=="center"?"-"+i:""),F=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},H=Array.isArray(c)?c:[c],$=H.length>0,J={padding:F,boundary:H.filter(AH),altBoundary:$},{refs:W,floatingStyles:B,placement:A,isPositioned:R,middlewareData:N}=yH({strategy:"fixed",placement:I,whileElementsMounted:(...Ze)=>uH(...Ze,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[bH({mainAxis:o+j,alignmentAxis:s}),l&&wH({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?SH():void 0,...J}),l&&kH({...J}),EH({...J,apply:({elements:Ze,rects:pt,availableWidth:Ht,availableHeight:T})=>{const{width:k,height:E}=pt.reference,M=Ze.floating.style;M.setProperty("--radix-popper-available-width",`${Ht}px`),M.setProperty("--radix-popper-available-height",`${T}px`),M.setProperty("--radix-popper-anchor-width",`${k}px`),M.setProperty("--radix-popper-anchor-height",`${E}px`)}}),C&&_H({element:C,padding:a}),DH({arrowWidth:O,arrowHeight:j}),h&&CH({strategy:"referenceHidden",...J})]}),[D,z]=Yj(A),V=tn(m);_n(()=>{R&&(V==null||V())},[R,V]);const G=(ne=N.arrow)==null?void 0:ne.x,Re=(Oe=N.arrow)==null?void 0:Oe.y,Y=((Ae=N.arrow)==null?void 0:Ae.centerOffset)!==0,[he,ie]=g.useState();return _n(()=>{x&&ie(window.getComputedStyle(x).zIndex)},[x]),f.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:R?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(pe=N.transformOrigin)==null?void 0:pe.x,(De=N.transformOrigin)==null?void 0:De.y].join(" "),...((Pe=N.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(jH,{scope:n,placedSide:D,onArrowChange:_,arrowX:G,arrowY:Re,shouldHideArrow:Y,children:f.jsx(_e.div,{"data-side":D,"data-align":z,...v,ref:S,style:{...v.style,animation:R?void 0:"none"}})})})});Kj.displayName=cS;var Gj="PopperArrow",IH={top:"bottom",right:"left",bottom:"top",left:"right"},qj=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=RH(Gj,r),s=IH[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(PH,{...o,ref:n,style:{...o.style,display:"block"}})})});qj.displayName=Gj;function AH(e){return e!==null}var DH=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]=Yj(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+l/2;let m="",v="";return c==="bottom"?(m=s?d:`${h}px`,v=`${-l}px`):c==="top"?(m=s?d:`${h}px`,v=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,v=s?d:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,v=s?d:`${p}px`),{data:{x:m,y:v}}}});function Yj(e){const[t,n="center"]=e.split("-");return[t,n]}var Hh=Uj,Ru=Wj,Wh=Kj,Kh=qj,LH="Portal",Iu=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=g.useState(!1);_n(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?fz.createPortal(f.jsx(_e.div,{...r,ref:t}),s):null});Iu.displayName=LH;function FH(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var an=e=>{const{present:t,children:n}=e,r=zH(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=Be(r.ref,BH(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};an.displayName="Presence";function zH(e){const[t,n]=g.useState(),r=g.useRef({}),o=g.useRef(e),i=g.useRef("none"),s=e?"mounted":"unmounted",[a,l]=FH(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Hp(r.current);i.current=a==="mounted"?c:"none"},[a]),_n(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=Hp(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),_n(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const v=Hp(r.current).includes(p.animationName);if(p.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)})}},h=p=>{p.target===t&&(i.current=Hp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),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 Hp(e){return(e==null?void 0:e.animationName)||"none"}function BH(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 Fr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=$H({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=tn(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 $H({defaultProp:e,onChange:t}){const n=g.useState(e),[r]=n,o=g.useRef(r),i=tn(t);return g.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var VH="VisuallyHidden",uS=g.forwardRef((e,t)=>f.jsx(_e.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}}));uS.displayName=VH;var UH=uS,[Bv,vme]=uo("Tooltip",[bi]),$v=bi(),Jj="TooltipProvider",HH=700,_b="tooltip.open",[WH,dS]=Bv(Jj),Xj=e=>{const{__scopeTooltip:t,delayDuration:n=HH,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=g.useState(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),f.jsx(WH,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};Xj.displayName=Jj;var Vv="Tooltip",[KH,Gh]=Bv(Vv),Zj=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=dS(Vv,e.__scopeTooltip),c=$v(t),[u,d]=g.useState(null),h=Ir(),p=g.useRef(0),m=s??l.disableHoverableContent,v=a??l.delayDuration,b=g.useRef(!1),[x=!1,w]=Fr({prop:r,defaultProp:o,onChange:O=>{O?(l.onOpen(),document.dispatchEvent(new CustomEvent(_b))):l.onClose(),i==null||i(O)}}),S=g.useMemo(()=>x?b.current?"delayed-open":"instant-open":"closed",[x]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,w(!0)},[w]),_=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),P=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,w(!0),p.current=0},v)},[v,w]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),f.jsx(Hh,{...c,children:f.jsx(KH,{scope:t,contentId:h,open:x,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayed?P():C()},[l.isOpenDelayed,P,C]),onTriggerLeave:g.useCallback(()=>{m?_():(window.clearTimeout(p.current),p.current=0)},[_,m]),onOpen:C,onClose:_,disableHoverableContent:m,children:n})})};Zj.displayName=Vv;var Tb="TooltipTrigger",fS=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Gh(Tb,n),i=dS(Tb,n),s=$v(n),a=g.useRef(null),l=Be(t,a,o.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),d=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),f.jsx(Ru,{asChild:!0,...s,children:f.jsx(_e.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:te(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:te(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:te(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:te(e.onBlur,o.onClose),onClick:te(e.onClick,o.onClose)})})});fS.displayName=Tb;var hS="TooltipPortal",[GH,qH]=Bv(hS,{forceMount:void 0}),Qj=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Gh(hS,t);return f.jsx(GH,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Iu,{asChild:!0,container:o,children:r})})})};Qj.displayName=hS;var uu="TooltipContent",eR=g.forwardRef((e,t)=>{const n=qH(uu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Gh(uu,e.__scopeTooltip);return f.jsx(an,{present:r||s.open,children:s.disableHoverableContent?f.jsx(tR,{side:o,...i,ref:t}):f.jsx(YH,{side:o,...i,ref:t})})}),YH=g.forwardRef((e,t)=>{const n=Gh(uu,e.__scopeTooltip),r=dS(uu,e.__scopeTooltip),o=g.useRef(null),i=Be(t,o),[s,a]=g.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:d}=r,h=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,v)=>{const b=m.currentTarget,x={x:m.clientX,y:m.clientY},w=QH(x,b.getBoundingClientRect()),S=eW(x,w),C=tW(v.getBoundingClientRect()),_=rW([...S,...C]);a(_),d(!0)},[d]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(l&&u){const m=b=>p(b,u),v=b=>p(b,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",v)}}},[l,u,p,h]),g.useEffect(()=>{if(s){const m=v=>{const b=v.target,x={x:v.clientX,y:v.clientY},w=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),S=!nW(x,s);w?h():S&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,s,c,h]),f.jsx(tR,{...e,ref:i})}),[JH,XH]=Bv(Vv,{isInside:!1}),tR=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Gh(uu,n),c=$v(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(_b,u),()=>document.removeEventListener(_b,u)),[u]),g.useEffect(()=>{if(l.trigger){const d=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),f.jsx($l,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:f.jsxs(Wh,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Tj,{children:r}),f.jsx(JH,{scope:n,isInside:!0,children:f.jsx(UH,{id:l.contentId,role:"tooltip",children:o||r})})]})})});eR.displayName=uu;var nR="TooltipArrow",ZH=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$v(n);return XH(nR,n).isInside?null:f.jsx(Kh,{...o,...r,ref:t})});ZH.displayName=nR;function QH(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function eW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function tW(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function nW(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 rW(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),oW(t)}function oW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var iW=Xj,sW=Zj,aW=fS,rR=eR;function oR(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=oR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function iR(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=oR(e))&&(r&&(r+=" "),r+=t);return r}const pS="-",lW=e=>{const t=uW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(pS);return a[0]===""&&a.length!==1&&a.shift(),sR(a,t)||cW(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},sR=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?sR(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(pS);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},e_=/^\[(.+)\]$/,cW=e=>{if(e_.test(e)){const t=e_.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},uW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return fW(Object.entries(e.classGroups),n).forEach(([i,s])=>{Pb(s,r,i,t)}),r},Pb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:t_(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(dW(o)){Pb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Pb(s,t_(t,i),n,r)})})},t_=(e,t)=>{let n=e;return t.split(pS).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},dW=e=>e.isThemeGetter,fW=(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,hW=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)}}},aR="!",pW=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 h=l.length===0?a:a.substring(u),p=h.startsWith(aR),m=p?h.substring(1):h,v=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:s}):s},mW=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},gW=e=>({cache:hW(e.cacheSize),parseClassName:pW(e),...lW(e)}),vW=/\s+/,yW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(vW);let a="";for(let l=s.length-1;l>=0;l-=1){const c=s[l],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let m=!!p,v=r(m?h.substring(0,p):h);if(!v){if(!m){a=c+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=c+(a.length>0?" "+a:a);continue}m=!1}const b=mW(u).join(":"),x=d?b+aR:b,w=x+v;if(i.includes(w))continue;i.push(w);const S=o(v,m);for(let C=0;C<S.length;++C){const _=S[C];i.push(x+_)}a=c+(a.length>0?" "+a:a)}return a};function xW(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=lR(t))&&(r&&(r+=" "),r+=n);return r}const lR=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=lR(e[r]))&&(n&&(n+=" "),n+=t);return n};function bW(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,d)=>d(u),e());return n=gW(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=yW(l,n);return o(l,u),u}return function(){return i(xW.apply(null,arguments))}}const wt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},cR=/^\[(?:([a-z-]+):)?(.+)\]$/i,wW=/^\d+\/\d+$/,SW=new Set(["px","full","screen"]),kW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,EW=/\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$/,CW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,_W=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ci=e=>zc(e)||SW.has(e)||wW.test(e),bs=e=>Au(e,"length",AW),zc=e=>!!e&&!Number.isNaN(Number(e)),Px=e=>Au(e,"number",zc),md=e=>!!e&&Number.isInteger(Number(e)),PW=e=>e.endsWith("%")&&zc(e.slice(0,-1)),$e=e=>cR.test(e),ws=e=>kW.test(e),NW=new Set(["length","size","percentage"]),OW=e=>Au(e,NW,uR),MW=e=>Au(e,"position",uR),jW=new Set(["image","url"]),RW=e=>Au(e,jW,LW),IW=e=>Au(e,"",DW),gd=()=>!0,Au=(e,t,n)=>{const r=cR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},AW=e=>EW.test(e)&&!CW.test(e),uR=()=>!1,DW=e=>_W.test(e),LW=e=>TW.test(e),FW=()=>{const e=wt("colors"),t=wt("spacing"),n=wt("blur"),r=wt("brightness"),o=wt("borderColor"),i=wt("borderRadius"),s=wt("borderSpacing"),a=wt("borderWidth"),l=wt("contrast"),c=wt("grayscale"),u=wt("hueRotate"),d=wt("invert"),h=wt("gap"),p=wt("gradientColorStops"),m=wt("gradientColorStopPositions"),v=wt("inset"),b=wt("margin"),x=wt("opacity"),w=wt("padding"),S=wt("saturate"),C=wt("scale"),_=wt("sepia"),P=wt("skew"),O=wt("space"),j=wt("translate"),I=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto",$e,t],$=()=>[$e,t],J=()=>["",Ci,bs],W=()=>["auto",zc,$e],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],A=()=>["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"],N=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",$e],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[zc,$e];return{cacheSize:500,separator:":",theme:{colors:[gd],spacing:[Ci,bs],blur:["none","",ws,$e],brightness:V(),borderColor:[e],borderRadius:["none","","full",ws,$e],borderSpacing:$(),borderWidth:J(),contrast:V(),grayscale:D(),hueRotate:V(),invert:D(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[PW,bs],inset:H(),margin:H(),opacity:V(),padding:$(),saturate:V(),scale:V(),sepia:D(),skew:V(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[ws]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:[...B(),$e]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],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",md,$e]}],basis:[{basis:H()}],"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:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",md,$e]}],"grid-cols":[{"grid-cols":[gd]}],"col-start-end":[{col:["auto",{span:["full",md,$e]},$e]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[gd]}],"row-start-end":[{row:["auto",{span:[md,$e]},$e]}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"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:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"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":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"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:[ws]},ws]}],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",ws,bs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Px]}],"font-family":[{font:[gd]}],"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",zc,Px]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ci,$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:[...A(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ci,bs]}],"underline-offset":[{"underline-offset":["auto",Ci,$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:$()}],"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:[...B(),MW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",OW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},RW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],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:[...A(),"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:A()}],"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:["",...A()]}],"outline-offset":[{"outline-offset":[Ci,$e]}],"outline-w":[{outline:[Ci,bs]}],"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":[Ci,bs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ws,IW]}],"shadow-color":[{shadow:[gd]}],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",ws,$e]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],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":[S]}],"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:V()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:V()}],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:[md,$e]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"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":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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:[Ci,bs,Px]}],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"]}}},zW=bW(FW);function ze(...e){return zW(iR(e))}const BW=iW,dR=sW,$W=aW,mS=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(rR,{ref:r,sideOffset:t,className:ze("z-50 overflow-hidden rounded-md border bg-bg-primary-solid px-3 py-2 text-sm text-text-primary shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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),...n}));mS.displayName=rR.displayName;const ht=Se.createContext(new Proxy({},{get:()=>{throw new Error("Cannot use ValContext outside of ValProvider")}}));function fR({children:e,client:t,dispatchValEvents:n}){var z,V,G,Re;const[r,o,i,s,a,l]=X9(t),[c,u]=g.useState({});g.useEffect(()=>{const Y=async()=>{const he=await t("/profiles","GET",{});if(he.status===200){const ie={};for(const ne of he.json.profiles)ie[ne.profileId]={fullName:ne.fullName,email:ne.email,avatar:ne.avatar};u(ie)}else{console.error("Could not get profiles",he.json);const ie=setTimeout(Y,2e3);return()=>{clearTimeout(ie)}}};Y()},[i,t,l]);const d=g.useMemo(()=>new lU(t,(Y,he)=>{n&&dU(Y,he)}),[n]),h="data"in r&&r.data?r.data.config:void 0,p="error"in r?r.error:void 0,[m,v]=g.useState();g.useEffect(()=>{if(m===void 0||m===!0)if(l){const Y=setTimeout(()=>{v(l)},2e3);return()=>{clearTimeout(Y)}}else l||v(!1)},[l,m]);const[b,x]=g.useState(null);g.useEffect(()=>{try{const Y=localStorage.getItem("val-theme-"+((h==null?void 0:h.project)||"unknown"));if(Y)if(Y==="light"||Y==="dark")x(Y);else throw new Error(`Invalid Val theme: ${Y}`);else p&&x("dark")}catch(Y){console.error("Error getting theme from local storage",Y)}},[h,p]),g.useEffect(()=>{h!=null&&h.defaultTheme&&b===null?(h==null?void 0:h.defaultTheme)==="dark"||(h==null?void 0:h.defaultTheme)==="light"?x(h.defaultTheme):console.warn(`Invalid config default theme: ${h.defaultTheme}`):h!==void 0&&b===null&&x("dark")},[b,h]);const w=g.useRef(null),S="data"in r&&r.data?r.data.baseSha:void 0,[C,_]=g.useState([]),P=g.useRef(new Set);g.useEffect(()=>{"data"in r&&r.data&&_(Y=>{var he,ie,ne,Oe,Ae,pe;return(he=r.data)!=null&&he.deployments&&((ie=r.data.deployments)==null?void 0:ie.length)>0||(ne=r.data)!=null&&ne.commits&&((Oe=r.data.commits)==null?void 0:Oe.length)>0?fU(Y,((Ae=r.data)==null?void 0:Ae.commits)||[],((pe=r.data)==null?void 0:pe.deployments)||[]).filter(De=>!P.current.has(De.commitSha)):Y})},["data"in r&&((z=r.data)==null?void 0:z.deployments)&&((V=r.data)==null?void 0:V.deployments.length),"data"in r&&((G=r.data)==null?void 0:G.commits)&&((Re=r.data)==null?void 0:Re.commits.length)]);const O=g.useCallback(Y=>{_(he=>he.filter(ie=>ie.commitSha!==Y)),P.current.add(Y)},[]),[j,I]=g.useState({status:"not-asked"}),[F,H]=g.useState(!1),$=g.useSyncExternalStore(d.subscribe("schema"),()=>d.getAllSchemasSnapshot(),()=>d.getAllSchemasSnapshot());g.useEffect(()=>{if($){const Y=$;let he=!1;for(const ie of Object.values(Y))if(Td(ie)){he=!0;break}H(he)}},[$]),g.useEffect(()=>{let Y=0;function he(){Y++,j.status!=="ready"&&Y<10&&t("/remote/settings","GET",{}).then(ie=>{ie.status===200?I({status:"ready",coreVersion:ie.json.coreVersion,buckets:ie.json.remoteFileBuckets.map(ne=>ne.bucket),publicProjectId:ie.json.publicProjectId}):("errorCode"in ie.json&&ie.json.errorCode?I({status:"inactive",reason:ie.json.errorCode}):I({status:"inactive",reason:"unknown-error"}),setTimeout(he,5e3))}).catch(ie=>{console.error("Error getting remote settings",ie),I({status:"inactive",reason:"unknown-error"}),setTimeout(he,5e3)})}F&&(I({status:"loading"}),he())},[F]);const J=g.useRef("not-initialized"),[W,B]=g.useState(!1),A=Jh(d);g.useEffect(()=>{if(A===null&&J.current==="done"&&(J.current="not-initialized"),"data"in r&&r.data&&J.current==="not-initialized"){J.current="in-progress";let Y=null;const he=async()=>{if("data"in r&&r.data){console.debug("ValSyncEngine init started...",r.data.profileId);const ie=await d.init(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now());console.debug("ValSyncEngine init result",ie),ie.status==="retry"?(J.current="retry",Y=setTimeout(he,4e3)):(console.debug("Val is initialized!",ie),J.current="done",Y&&clearTimeout(Y),B(!0))}else throw J.current="not-initialized",Error("Unexpected state: init was started with stat.data but now it is not there")};return he(),()=>{Y&&clearTimeout(Y)}}else"data"in r&&r.data&&J.current==="done"&&d.syncWithUpdatedStat(r.data.mode,r.data.baseSha,r.data.schemaSha,r.data.sourcesSha,r.data.patches,r.data.profileId,r.data.commitSha??null,Date.now())},[r,d,A]),g.useEffect(()=>{if(!W)return;let Y=null;const he=async()=>{if(A===null){B(!1),J.current="not-initialized";return}await d.sync(Date.now()),Y&&clearTimeout(Y),Y=setTimeout(he,1e3)};return he(),()=>{Y&&clearTimeout(Y)}},[d,A,W]);const[R,N]=g.useState({type:"not-asked"}),D=g.useSyncExternalStore(d.subscribe("pending-ops-count"),()=>d.getPendingOpsSnapshot(),()=>d.getPendingOpsSnapshot());return g.useEffect(()=>{const Y=he=>{D>0&&(he.preventDefault(),he.returnValue="")};return window.addEventListener("beforeunload",Y),()=>{window.removeEventListener("beforeunload",Y)}},[D]),f.jsx(ht.Provider,{value:{client:t,publishSummaryState:R,setPublishSummaryState:N,syncEngine:d,profileId:"data"in r&&r.data?r.data.profileId:null,mode:"data"in r&&r.data?r.data.mode:"unknown",serviceUnavailable:m,baseSha:S,deployments:C,dismissDeployment:O,portalRef:w.current,authenticationState:i,addPatch:(Y,he,ie)=>d.addPatch(Y,ie,he,Date.now()),deletePatches:Y=>{const he=[];for(let ie=0;ie<Y.length;ie+=100)he.push(Y.slice(ie,ie+100));for(const ie of he)d.deletePatches(ie,Date.now())},theme:b,setTheme:Y=>{if(Y==="dark"||Y==="light"){try{localStorage.setItem("val-theme-"+((h==null?void 0:h.project)||"unknown"),Y),localStorage.setItem("val-theme-unknown",Y)}catch(he){console.error("Error setting theme in local storage",he)}x(Y)}else console.warn(`Cannot set invalid theme theme: ${Y}`)},config:h,profiles:c,remoteFiles:j},children:f.jsx(BW,{children:f.jsxs(TM,{initialProps:{mode:"default"},children:[f.jsx("div",{"data-val-portal":"true",ref:w,...b?{"data-mode":b}:{}}),e]})})})}function Kr(){return g.useContext(ht).portalRef}function Uv(){const{theme:e,setTheme:t}=g.useContext(ht);return{theme:e,setTheme:t}}function Du(){const{config:e}=g.useContext(ht),t=g.useRef(e&&{...e,remoteHost:SC,appHost:ub,studioPrefix:"/val/~"});return g.useEffect(()=>{e&&(t.current={...e,remoteHost:SC,appHost:ub,studioPrefix:"/val/~"})},[e]),t.current}function gS(){const{remoteFiles:e}=g.useContext(ht);return e}function vS(){const{remoteFiles:e}=g.useContext(ht),[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 hR(){const{authenticationState:e}=g.useContext(ht);return e}function VW(){const{serviceUnavailable:e}=g.useContext(ht);return e===!0?"service-unavailable":"connected"}function On(e){const{addPatch:t}=g.useContext(ht),[n,r]=ee.splitModuleFilePathAndModulePath(e),o=g.useMemo(()=>ee.createPatchPath(r),[r]),i=g.useCallback((s,a)=>{t(n,s,a)},[t,e]);return{patchPath:o,addPatch:i,addModuleFilePatch:t}}function UW(){const{deletePatches:e}=g.useContext(ht);return{deletePatches:e}}function HW(){const{deployments:e,dismissDeployment:t}=g.useContext(ht);return{deployments:e,dismissDeployment:t}}function WW(){const{syncEngine:e}=g.useContext(ht);return{status:"success",data:g.useSyncExternalStore(e.subscribe("patch-sets"),()=>e.getSerializedPatchSetsSnapshot(),()=>e.getSerializedPatchSetsSnapshot())}}function KW(){const{syncEngine:e}=g.useContext(ht),t=g.useSyncExternalStore(e.subscribe("all-patches"),()=>e.getAllPatchesSnapshot(),()=>e.getAllPatchesSnapshot()),n=qh();return g.useMemo(()=>{const o=new Set;for(const i of n){const s=t[i];s!=null&&s.isCommitted&&o.add(i)}return o},[t,n])}function pR(){const{syncEngine:e}=g.useContext(ht);return g.useSyncExternalStore(e.subscribe("global-server-side-patch-ids"),()=>e.getGlobalServerSidePatchIdsSnapshot(),()=>e.getGlobalServerSidePatchIdsSnapshot())}function mR(){const{syncEngine:e}=g.useContext(ht);return g.useSyncExternalStore(e.subscribe("pending-client-side-patch-ids"),()=>e.getPendingClientSidePatchIdsSnapshot(),()=>e.getPendingClientSidePatchIdsSnapshot())}function qh(){const{syncEngine:e}=g.useContext(ht),t=pR(),n=mR(),r=g.useSyncExternalStore(e.subscribe("saved-server-side-patch-ids"),()=>e.getSavedServerSidePatchIdsSnapshot(),()=>e.getSavedServerSidePatchIdsSnapshot());return g.useMemo(()=>{const i=new Set,s=[];for(const a of t)i.has(a)||s.push(a),i.add(a);for(const a of r)i.has(a)||s.push(a),i.add(a);for(const a of n)i.has(a)||s.push(a),i.add(a);return s},[t,n,r])}function Lu(){const{mode:e}=g.useContext(ht);return e}function Hv(){const{syncEngine:e}=g.useContext(ht);return g.useSyncExternalStore(e.subscribe("pending-ops-count"),()=>e.getPendingOpsSnapshot(),()=>e.getPendingOpsSnapshot())>0?"loading":"success"}const GW=y.union([y.object({type:y.literal("not-asked"),isGenerating:y.boolean().optional()}),y.object({type:y.literal("manual").or(y.literal("ai")),text:y.string(),patchIds:y.array(y.string()).nullable(),isGenerating:y.boolean()})]);function Yh(){const{syncEngine:e,client:t,publishSummaryState:n,setPublishSummaryState:r,config:o}=g.useContext(ht),i=qh(),s=g.useSyncExternalStore(e.subscribe("publish-disabled"),()=>e.getPublishDisabledSnapshot(),()=>e.getPublishDisabledSnapshot()),[a,l]=g.useState(!1);g.useEffect(()=>{var m,v;((v=(m=o==null?void 0:o.ai)==null?void 0:m.commitMessages)==null?void 0:v.disabled)===void 0||o.ai.commitMessages.disabled===!1?l(!0):l(!1)},[o]),g.useEffect(()=>{if(n.type==="not-asked"){const m=YW(o==null?void 0:o.project);m&&m.type!=="not-asked"&&i.length>0&&r(m)}},[n,o==null?void 0:o.project,r]);const c=g.useCallback(async()=>{if(i===null)return{type:"error",message:"Empty patch set"};if("isGenerating"in n&&n.isGenerating)return{type:"error",message:"Already generating summary"};r(m=>({...m,isGenerating:!0}));try{const m=await t("/commit-summary","GET",{query:{patch_id:i}});return m.status===200?m.json.commitSummary?{type:"ai",text:m.json.commitSummary}:{type:"error",message:"Commit summary could not be generated"}:{type:"error",message:m.json.message}}finally{r(m=>({...m,isGenerating:!1}))}},[t,i,n]),[u,d]=g.useState(!1),h=g.useCallback(async m=>i===null?{status:"error",message:"No changes to publish"}:u?{status:"error",message:"Already publishing"}:(d(!0),e.publish(i,m,Date.now()).then(v=>(v.status==="done"&&(JW(o==null?void 0:o.project),r(b=>({type:"not-asked",isGenerating:b.isGenerating}))),v)).finally(()=>{d(!1)})),[i,u,o==null?void 0:o.project,e]),p=g.useCallback(m=>{r(v=>{let b;return m.type==="not-asked"?b={type:"not-asked",isGenerating:v.isGenerating}:b={type:m.type,text:m.text,patchIds:i,isGenerating:!!v.isGenerating},qW(b,o==null?void 0:o.project),b})},[i,r,o==null?void 0:o.project]);return{publish:h,publishDisabled:s,isPublishing:u,generateSummary:c,canGenerate:a,summary:n,setSummary:p}}function qW(e,t){try{localStorage.setItem("val-publish-summary-"+(t||"unknown"),JSON.stringify(e))}catch(n){console.error("Error setting publish summary in local storage",n)}return e}function YW(e){try{const t=localStorage.getItem("val-publish-summary-"+(e||"unknown"));if(t){const n=GW.safeParse(JSON.parse(t));if(n.success)return n.data;console.warn("Error parsing publish summary from local storage",n.error)}}catch(t){console.error("Error getting publish summary from local storage",t)}return null}function JW(e){try{localStorage.removeItem("val-publish-summary-"+(e||"unknown"))}catch(t){console.error("Error deleting publish summary from local storage",t)}}function XW(){const{profileId:e,profiles:t}=g.useContext(ht);return e?t[e]??null:null}const Jh=e=>g.useSyncExternalStore(e.subscribe("initialized-at"),()=>e.getInitializedAtSnapshot(),()=>e.getInitializedAtSnapshot()).data;function yS(){const{syncEngine:e}=g.useContext(ht);return{autoPublish:g.useSyncExternalStore(e.subscribe("auto-publish"),()=>e.getAutoPublishSnapshot(),()=>e.getAutoPublishSnapshot()),setAutoPublish:n=>{e.setAutoPublish(Date.now(),n)}}}function It(e){const{syncEngine:t}=g.useContext(ht),[n,r]=g.useMemo(()=>ee.splitModuleFilePathAndModulePath(e),[e]),o=g.useSyncExternalStore(t.subscribe("schema"),()=>t.getSchemaSnapshot(n),()=>t.getSchemaSnapshot(n)),i=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),s=g.useMemo(()=>{var c;if(o.status!=="success")return o;if(i.status!=="success")return i;const l=(c=ee.resolvePath(r,i.data,o.data))==null?void 0:c.schema;return l?{status:"success",data:l}:{status:"resolved-schema-not-found"}},[o,i,n,r]);return Jh(t)===null?{status:"loading"}:s.status!=="success"?s.status==="resolved-schema-not-found"?{status:"not-found"}:s.status==="no-schemas"?{status:"error",error:"No schemas"}:s.status==="module-schema-not-found"?{status:"not-found"}:{status:"loading"}:s}function Xh(){const{syncEngine:e}=g.useContext(ht),t=g.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());if(Jh(e)===null)return{status:"loading"};if(t===null)return console.warn("Schemas: not found"),{status:"error",error:"Schemas not found"};const r={};for(const[o,i]of Object.entries(t)){const s=o;i&&(r[s]=i)}return{status:"success",data:r}}function ZW(e){const{syncEngine:t}=g.useContext(ht);return g.useSyncExternalStore(t.subscribe("validation-error",e),()=>t.getValidationErrorSnapshot(e),()=>t.getValidationErrorSnapshot(e))||[]}function ja(){const{syncEngine:e}=g.useContext(ht);return g.useSyncExternalStore(e.subscribe("all-validation-errors"),()=>e.getAllValidationErrorsSnapshot(),()=>e.getAllValidationErrorsSnapshot())}function xS(){return{globalErrors:[],patchErrors:{},skippedPatches:{}}}function bS(){const{profiles:e}=g.useContext(ht);return e}function st(e,t){const{syncEngine:n}=g.useContext(ht),[r,o]=e?ee.splitModuleFilePathAndModulePath(e):["",""],i=g.useSyncExternalStore(n.subscribe("source",r),()=>n.getSourceSnapshot(r),()=>n.getSourceSnapshot(r)),s=Jh(n);return g.useMemo(()=>{if(s===null)return{status:"loading"};if(i.status==="success"){const l=i.data;return l!==void 0&&t!==void 0?QW(r,o,t,l,i.optimistic):{status:"not-found"}}return{status:"error",error:i.message||"Unknown error"}},[i,o,r,s,t])}function wS(){const{syncEngine:e}=g.useContext(ht);return g.useSyncExternalStore(e.subscribe("all-sources"),()=>e.getAllSourcesSnapshot(),()=>e.getAllSourcesSnapshot())}function SS(e){const{syncEngine:t}=g.useContext(ht),[n,r]=ee.splitModuleFilePathAndModulePath(e),o=g.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=Jh(t);return g.useMemo(()=>i===null?{status:"loading"}:o.status==="success"?gR(r,o.data):{status:"error",error:o.message||"Unknown error"},[o,i,r,n])}function gR(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of ee.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(Ks(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 QW(e,t,n,r,o){const i=gR(t,r);if("data"in i&&i.data!==void 0){const s=e7(e,t,n,i.data);return s.status==="success"?{status:"success",data:s.data,clientSideOnly:o}:s}return i}function e7(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(Ks(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Nx(e,t,s);return{status:"success",data:i}}else if(o==="array"){if(typeof r!="object"||!Ks(r))return{status:"error",error:`Expected array, got ${typeof r}`};const i=[];for(let s=0;s<r.length;s++)i.push(Nx(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"||!Ks(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"||!(xt in r)||r[xt]===void 0?{status:"error",error:`Expected object with ${xt} 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(Ks(r))return{status:"error",error:"Expected object, got array"};const i={};for(const s of Object.keys(r))i[s]=Nx(e,t,s);return{status:"success",data:i}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function Nx(e,t,n){return t?e+ha+t+"."+JSON.stringify(n):e+ha+n}var vR={exports:{}};/*!
|
|
52
|
+
Copyright (c) 2018 Jed Watson.
|
|
53
|
+
Licensed under the MIT License (MIT), see
|
|
54
|
+
http://jedwatson.github.io/classnames
|
|
55
|
+
*/(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})()})(vR);var t7=vR.exports;const ke=Ta(t7);/**
|
|
56
|
+
* @license lucide-react v0.379.0 - ISC
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the ISC license.
|
|
59
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/const n7=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yR=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/**
|
|
61
|
+
* @license lucide-react v0.379.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/var r7={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"};/**
|
|
66
|
+
* @license lucide-react v0.379.0 - ISC
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the ISC license.
|
|
69
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/const o7=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,...r7,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yR("lucide",o),...a},[...s.map(([c,u])=>g.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
|
|
71
|
+
* @license lucide-react v0.379.0 - ISC
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the ISC license.
|
|
74
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
+
*/const ve=(e,t)=>{const n=g.forwardRef(({className:r,...o},i)=>g.createElement(o7,{ref:i,iconNode:t,className:yR(`lucide-${n7(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
|
|
76
|
+
* @license lucide-react v0.379.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/const i7=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
81
|
+
* @license lucide-react v0.379.0 - ISC
|
|
82
|
+
*
|
|
83
|
+
* This source code is licensed under the ISC license.
|
|
84
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
+
*/const s7=ve("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"}]]);/**
|
|
86
|
+
* @license lucide-react v0.379.0 - ISC
|
|
87
|
+
*
|
|
88
|
+
* This source code is licensed under the ISC license.
|
|
89
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
+
*/const xR=ve("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"}]]);/**
|
|
91
|
+
* @license lucide-react v0.379.0 - ISC
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the ISC license.
|
|
94
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/const Zh=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
96
|
+
* @license lucide-react v0.379.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const Qh=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
101
|
+
* @license lucide-react v0.379.0 - ISC
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the ISC license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/const a7=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
106
|
+
* @license lucide-react v0.379.0 - ISC
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the ISC license.
|
|
109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
+
*/const Wv=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
111
|
+
* @license lucide-react v0.379.0 - ISC
|
|
112
|
+
*
|
|
113
|
+
* This source code is licensed under the ISC license.
|
|
114
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
+
*/const l7=ve("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
|
|
116
|
+
* @license lucide-react v0.379.0 - ISC
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the ISC license.
|
|
119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/const c7=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
121
|
+
* @license lucide-react v0.379.0 - ISC
|
|
122
|
+
*
|
|
123
|
+
* This source code is licensed under the ISC license.
|
|
124
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
+
*/const u7=ve("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
126
|
+
* @license lucide-react v0.379.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/const Ox=ve("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
131
|
+
* @license lucide-react v0.379.0 - ISC
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the ISC license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/const d7=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
|
|
136
|
+
* @license lucide-react v0.379.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/const bR=ve("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"}]]);/**
|
|
141
|
+
* @license lucide-react v0.379.0 - ISC
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the ISC license.
|
|
144
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
+
*/const f7=ve("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"}]]);/**
|
|
146
|
+
* @license lucide-react v0.379.0 - ISC
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the ISC license.
|
|
149
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/const wR=ve("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"}]]);/**
|
|
151
|
+
* @license lucide-react v0.379.0 - ISC
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the ISC license.
|
|
154
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/const h7=ve("FileText",[["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"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
156
|
+
* @license lucide-react v0.379.0 - ISC
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the ISC license.
|
|
159
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
+
*/const SR=ve("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"}]]);/**
|
|
161
|
+
* @license lucide-react v0.379.0 - ISC
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the ISC license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/const p7=ve("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"}]]);/**
|
|
166
|
+
* @license lucide-react v0.379.0 - ISC
|
|
167
|
+
*
|
|
168
|
+
* This source code is licensed under the ISC license.
|
|
169
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
+
*/const m7=ve("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
171
|
+
* @license lucide-react v0.379.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/const n_=ve("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"}]]);/**
|
|
176
|
+
* @license lucide-react v0.379.0 - ISC
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the ISC license.
|
|
179
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/const r_=ve("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"}]]);/**
|
|
181
|
+
* @license lucide-react v0.379.0 - ISC
|
|
182
|
+
*
|
|
183
|
+
* This source code is licensed under the ISC license.
|
|
184
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
+
*/const o_=ve("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"}]]);/**
|
|
186
|
+
* @license lucide-react v0.379.0 - ISC
|
|
187
|
+
*
|
|
188
|
+
* This source code is licensed under the ISC license.
|
|
189
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
+
*/const i_=ve("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"}]]);/**
|
|
191
|
+
* @license lucide-react v0.379.0 - ISC
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the ISC license.
|
|
194
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/const s_=ve("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"}]]);/**
|
|
196
|
+
* @license lucide-react v0.379.0 - ISC
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the ISC license.
|
|
199
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/const a_=ve("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"}]]);/**
|
|
201
|
+
* @license lucide-react v0.379.0 - ISC
|
|
202
|
+
*
|
|
203
|
+
* This source code is licensed under the ISC license.
|
|
204
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
+
*/const kR=ve("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"}]]);/**
|
|
206
|
+
* @license lucide-react v0.379.0 - ISC
|
|
207
|
+
*
|
|
208
|
+
* This source code is licensed under the ISC license.
|
|
209
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
+
*/const g7=ve("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"}]]);/**
|
|
211
|
+
* @license lucide-react v0.379.0 - ISC
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the ISC license.
|
|
214
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/const v7=ve("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
|
|
216
|
+
* @license lucide-react v0.379.0 - ISC
|
|
217
|
+
*
|
|
218
|
+
* This source code is licensed under the ISC license.
|
|
219
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
+
*/const y7=ve("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
221
|
+
* @license lucide-react v0.379.0 - ISC
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the ISC license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/const x7=ve("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"}]]);/**
|
|
226
|
+
* @license lucide-react v0.379.0 - ISC
|
|
227
|
+
*
|
|
228
|
+
* This source code is licensed under the ISC license.
|
|
229
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
+
*/const b7=ve("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"}]]);/**
|
|
231
|
+
* @license lucide-react v0.379.0 - ISC
|
|
232
|
+
*
|
|
233
|
+
* This source code is licensed under the ISC license.
|
|
234
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
+
*/const ER=ve("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"}]]);/**
|
|
236
|
+
* @license lucide-react v0.379.0 - ISC
|
|
237
|
+
*
|
|
238
|
+
* This source code is licensed under the ISC license.
|
|
239
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
+
*/const Uo=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
241
|
+
* @license lucide-react v0.379.0 - ISC
|
|
242
|
+
*
|
|
243
|
+
* This source code is licensed under the ISC license.
|
|
244
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
+
*/const w7=ve("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"}]]);/**
|
|
246
|
+
* @license lucide-react v0.379.0 - ISC
|
|
247
|
+
*
|
|
248
|
+
* This source code is licensed under the ISC license.
|
|
249
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
+
*/const S7=ve("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
251
|
+
* @license lucide-react v0.379.0 - ISC
|
|
252
|
+
*
|
|
253
|
+
* This source code is licensed under the ISC license.
|
|
254
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
+
*/const k7=ve("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
256
|
+
* @license lucide-react v0.379.0 - ISC
|
|
257
|
+
*
|
|
258
|
+
* This source code is licensed under the ISC license.
|
|
259
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
+
*/const E7=ve("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
261
|
+
* @license lucide-react v0.379.0 - ISC
|
|
262
|
+
*
|
|
263
|
+
* This source code is licensed under the ISC license.
|
|
264
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
+
*/const C7=ve("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
266
|
+
* @license lucide-react v0.379.0 - ISC
|
|
267
|
+
*
|
|
268
|
+
* This source code is licensed under the ISC license.
|
|
269
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
+
*/const _7=ve("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
271
|
+
* @license lucide-react v0.379.0 - ISC
|
|
272
|
+
*
|
|
273
|
+
* This source code is licensed under the ISC license.
|
|
274
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
+
*/const kg=ve("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"}]]);/**
|
|
276
|
+
* @license lucide-react v0.379.0 - ISC
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the ISC license.
|
|
279
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/const T7=ve("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
281
|
+
* @license lucide-react v0.379.0 - ISC
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the ISC license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/const P7=ve("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
|
|
286
|
+
* @license lucide-react v0.379.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/const l_=ve("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"}]]);/**
|
|
291
|
+
* @license lucide-react v0.379.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/const CR=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
296
|
+
* @license lucide-react v0.379.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/const _R=ve("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"}]]);/**
|
|
301
|
+
* @license lucide-react v0.379.0 - ISC
|
|
302
|
+
*
|
|
303
|
+
* This source code is licensed under the ISC license.
|
|
304
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
+
*/const N7=ve("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/**
|
|
306
|
+
* @license lucide-react v0.379.0 - ISC
|
|
307
|
+
*
|
|
308
|
+
* This source code is licensed under the ISC license.
|
|
309
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
+
*/const O7=ve("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"}]]);/**
|
|
311
|
+
* @license lucide-react v0.379.0 - ISC
|
|
312
|
+
*
|
|
313
|
+
* This source code is licensed under the ISC license.
|
|
314
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
+
*/const M7=ve("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"}]]);/**
|
|
316
|
+
* @license lucide-react v0.379.0 - ISC
|
|
317
|
+
*
|
|
318
|
+
* This source code is licensed under the ISC license.
|
|
319
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
+
*/const j7=ve("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"}]]);/**
|
|
321
|
+
* @license lucide-react v0.379.0 - ISC
|
|
322
|
+
*
|
|
323
|
+
* This source code is licensed under the ISC license.
|
|
324
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
+
*/const R7=ve("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"}]]);/**
|
|
326
|
+
* @license lucide-react v0.379.0 - ISC
|
|
327
|
+
*
|
|
328
|
+
* This source code is licensed under the ISC license.
|
|
329
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
+
*/const I7=ve("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
331
|
+
* @license lucide-react v0.379.0 - ISC
|
|
332
|
+
*
|
|
333
|
+
* This source code is licensed under the ISC license.
|
|
334
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
+
*/const A7=ve("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
336
|
+
* @license lucide-react v0.379.0 - ISC
|
|
337
|
+
*
|
|
338
|
+
* This source code is licensed under the ISC license.
|
|
339
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
+
*/const D7=ve("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
|
|
341
|
+
* @license lucide-react v0.379.0 - ISC
|
|
342
|
+
*
|
|
343
|
+
* This source code is licensed under the ISC license.
|
|
344
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
+
*/const L7=ve("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"}]]);/**
|
|
346
|
+
* @license lucide-react v0.379.0 - ISC
|
|
347
|
+
*
|
|
348
|
+
* This source code is licensed under the ISC license.
|
|
349
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
+
*/const F7=ve("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"}]]);/**
|
|
351
|
+
* @license lucide-react v0.379.0 - ISC
|
|
352
|
+
*
|
|
353
|
+
* This source code is licensed under the ISC license.
|
|
354
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
+
*/const z7=ve("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
356
|
+
* @license lucide-react v0.379.0 - ISC
|
|
357
|
+
*
|
|
358
|
+
* This source code is licensed under the ISC license.
|
|
359
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
+
*/const B7=ve("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"}]]);/**
|
|
361
|
+
* @license lucide-react v0.379.0 - ISC
|
|
362
|
+
*
|
|
363
|
+
* This source code is licensed under the ISC license.
|
|
364
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
+
*/const $7=ve("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"}]]);/**
|
|
366
|
+
* @license lucide-react v0.379.0 - ISC
|
|
367
|
+
*
|
|
368
|
+
* This source code is licensed under the ISC license.
|
|
369
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
+
*/const kS=ve("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"}]]);/**
|
|
371
|
+
* @license lucide-react v0.379.0 - ISC
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the ISC license.
|
|
374
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/const V7=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
376
|
+
* @license lucide-react v0.379.0 - ISC
|
|
377
|
+
*
|
|
378
|
+
* This source code is licensed under the ISC license.
|
|
379
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
+
*/const TR=ve("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"}]]);/**
|
|
381
|
+
* @license lucide-react v0.379.0 - ISC
|
|
382
|
+
*
|
|
383
|
+
* This source code is licensed under the ISC license.
|
|
384
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
+
*/const du=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function U7(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 nh({isOpen:e,children:t,duration:n=.3}){return f.jsx("div",{style:{transition:`grid-template-rows ${n}s`},className:ke("grid overflow-hidden",{"grid-rows-[0fr]":!e,"grid-rows-[1fr]":e}),children:f.jsx("div",{style:{transition:`visibility ${n}s`},className:ke("min-h-0",{visible:e,invisible:!e}),children:t})})}function cf(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 fu(e){return e.endsWith(".val.ts")||e.endsWith(".val.js")?cf(e.slice(0,-7)):cf(e)}const PR=Se.createContext(new Proxy({},{get:()=>{throw Error("ValRouter context not provided")}})),Mx="/val/~";function c_(e,t){var n;(n=e.getElementById("val-content-area"))==null||n.scrollTo({top:t.offsetTop,behavior:"smooth"})}function NR({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(Mx);if(c>-1){const u=new URLSearchParams(location.search).get("p"),h=location.pathname.slice(c+Mx.length)+(u?`?p=${u}`:"");i(h);const p=s.current.pop();if(p)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");p&&(m==null||m.scrollTo(0,p))},50);else if(location.hash){const m=decodeURIComponent(location.hash.slice(1));window.history.replaceState(null,"",location.pathname+location.search);let v=100;const b=()=>{var x;if(m){const w=(x=document.getElementById("val-shadow-root"))==null?void 0:x.shadowRoot,S=w==null?void 0:w.getElementById(m);S&&w?c_(w,S):v>0&&(v--,setTimeout(b,100))}};b()}}r(!0)};return l(),window.addEventListener("popstate",l),()=>{window.removeEventListener("popstate",l)}},[]);const a=g.useCallback((l,c)=>{var d;const u=`${Mx}${l}`;if(i(l),t)window.location.href=u+(c!=null&&c.scrollToId?`#${c.scrollToId}`:"");else{const h=(d=document.getElementById("val-shadow-root"))==null?void 0:d.shadowRoot,p=h==null?void 0:h.getElementById("val-content-area"),m=p==null?void 0:p.scrollTop,v=c==null?void 0:c.scrollToId;v&&h?setTimeout(()=>{const b=h.getElementById(v);b&&h&&c_(h,b)},100):p==null||p.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(PR.Provider,{value:{hardLink:!!t,currentSourcePath:o,navigate:a,ready:n},children:e})}function Vn(){const{navigate:e,currentSourcePath:t,ready:n}=g.useContext(PR);return{navigate:e,currentSourcePath:t,ready:n}}var H7=g.createContext(void 0);function ep(e){const t=g.useContext(H7);return e||t||"ltr"}function Nb(e,[t,n]){return Math.min(n,Math.max(t,e))}function W7(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var ES="ScrollArea",[OR,yme]=uo(ES),[K7,fo]=OR(ES),MR=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,h]=g.useState(null),[p,m]=g.useState(null),[v,b]=g.useState(null),[x,w]=g.useState(0),[S,C]=g.useState(0),[_,P]=g.useState(!1),[O,j]=g.useState(!1),I=Be(t,H=>l(H)),F=ep(o);return f.jsx(K7,{scope:n,type:r,dir:F,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:_,onScrollbarXEnabledChange:P,scrollbarY:v,onScrollbarYChange:b,scrollbarYEnabled:O,onScrollbarYEnabledChange:j,onCornerWidthChange:w,onCornerHeightChange:C,children:f.jsx(_e.div,{dir:F,...s,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})});MR.displayName=ES;var jR="ScrollAreaViewport",RR=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=fo(jR,n),a=g.useRef(null),l=Be(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(_e.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})})]})});RR.displayName=jR;var wi="ScrollAreaScrollbar",CS=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=fo(wi,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(G7,{...r,ref:t,forceMount:n}):o.type==="scroll"?f.jsx(q7,{...r,ref:t,forceMount:n}):o.type==="auto"?f.jsx(IR,{...r,ref:t,forceMount:n}):o.type==="always"?f.jsx(_S,{...r,ref:t}):null});CS.displayName=wi;var G7=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=fo(wi,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(an,{present:n||i,children:f.jsx(IR,{"data-state":i?"visible":"hidden",...r,ref:t})})}),q7=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=fo(wi,e.__scopeScrollArea),i=e.orientation==="horizontal",s=Gv(()=>l("SCROLL_END"),100),[a,l]=W7("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 h=()=>{const p=c[u];d!==p&&(l("SCROLL"),s()),d=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[o.viewport,i,l,s]),f.jsx(an,{present:n||a!=="hidden",children:f.jsx(_S,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:te(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:te(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),IR=g.forwardRef((e,t)=>{const n=fo(wi,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=g.useState(!1),a=e.orientation==="horizontal",l=Gv(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return hu(n.viewport,l),hu(n.content,l),f.jsx(an,{present:r||i,children:f.jsx(_S,{"data-state":i?"visible":"hidden",...o,ref:t})})}),_S=g.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=fo(wi,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=zR(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function d(h,p){return eK(h,s.current,a,p)}return n==="horizontal"?f.jsx(Y7,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,p=u_(h,a,o.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=d(h,o.dir))}}):n==="vertical"?f.jsx(J7,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,p=u_(h,a);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=d(h))}}):null}),Y7=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=fo(wi,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Be(t,l,i.onScrollbarXChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(DR,{"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":Kv(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(i.viewport){const h=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(h),$R(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Cg(s.paddingLeft),paddingEnd:Cg(s.paddingRight)}})}})}),J7=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=fo(wi,e.__scopeScrollArea),[s,a]=g.useState(),l=g.useRef(null),c=Be(t,l,i.onScrollbarYChange);return g.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),f.jsx(DR,{"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":Kv(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(i.viewport){const h=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(h),$R(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Cg(s.paddingTop),paddingEnd:Cg(s.paddingBottom)}})}})}),[X7,AR]=OR(wi),DR=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,...h}=e,p=fo(wi,n),[m,v]=g.useState(null),b=Be(t,I=>v(I)),x=g.useRef(null),w=g.useRef(""),S=p.viewport,C=r.content-r.viewport,_=tn(u),P=tn(l),O=Gv(d,10);function j(I){if(x.current){const F=I.clientX-x.current.left,H=I.clientY-x.current.top;c({x:F,y:H})}}return g.useEffect(()=>{const I=F=>{const H=F.target;(m==null?void 0:m.contains(H))&&_(F,C)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[S,m,C,_]),g.useEffect(P,[r,P]),hu(m,O),hu(p.content,O),f.jsx(X7,{scope:n,scrollbar:m,hasThumb:o,onThumbChange:tn(i),onThumbPointerUp:tn(s),onThumbPositionChange:P,onThumbPointerDown:tn(a),children:f.jsx(_e.div,{...h,ref:b,style:{position:"absolute",...h.style},onPointerDown:te(e.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),x.current=m.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(I))}),onPointerMove:te(e.onPointerMove,j),onPointerUp:te(e.onPointerUp,I=>{const F=I.target;F.hasPointerCapture(I.pointerId)&&F.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=w.current,p.viewport&&(p.viewport.style.scrollBehavior=""),x.current=null})})})}),Eg="ScrollAreaThumb",LR=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=AR(Eg,e.__scopeScrollArea);return f.jsx(an,{present:n||o.hasThumb,children:f.jsx(Z7,{ref:t,...r})})}),Z7=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=fo(Eg,n),s=AR(Eg,n),{onThumbPositionChange:a}=s,l=Be(t,d=>s.onThumbChange(d)),c=g.useRef(),u=Gv(()=>{c.current&&(c.current(),c.current=void 0)},100);return g.useEffect(()=>{const d=i.viewport;if(d){const h=()=>{if(u(),!c.current){const p=tK(d,a);c.current=p,a()}};return a(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[i.viewport,u,a]),f.jsx(_e.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:te(e.onPointerDownCapture,d=>{const p=d.target.getBoundingClientRect(),m=d.clientX-p.left,v=d.clientY-p.top;s.onThumbPointerDown({x:m,y:v})}),onPointerUp:te(e.onPointerUp,s.onThumbPointerUp)})});LR.displayName=Eg;var TS="ScrollAreaCorner",FR=g.forwardRef((e,t)=>{const n=fo(TS,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.jsx(Q7,{...e,ref:t}):null});FR.displayName=TS;var Q7=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=fo(TS,n),[i,s]=g.useState(0),[a,l]=g.useState(0),c=!!(i&&a);return hu(o.scrollbarX,()=>{var d;const u=((d=o.scrollbarX)==null?void 0:d.offsetHeight)||0;o.onCornerHeightChange(u),l(u)}),hu(o.scrollbarY,()=>{var d;const u=((d=o.scrollbarY)==null?void 0:d.offsetWidth)||0;o.onCornerWidthChange(u),s(u)}),c?f.jsx(_e.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 Cg(e){return e?parseInt(e,10):0}function zR(e,t){const n=e/t;return isNaN(n)?0:n}function Kv(e){const t=zR(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function eK(e,t,n,r="ltr"){const o=Kv(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 BR([l,c],d)(e)}function u_(e,t,n="ltr"){const r=Kv(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=Nb(e,l);return BR([0,s],[0,a])(c)}function BR(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 $R(e,t){return e>0&&e<t}var tK=(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 Gv(e,t){const n=tn(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 hu(e,t){const n=tn(t);_n(()=>{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 VR=MR,nK=RR,rK=FR;const oi=g.forwardRef(({className:e,children:t,innerRef:n,viewportId:r,orientation:o,...i},s)=>f.jsxs(VR,{ref:s,className:ze("relative overflow-hidden",e),...i,children:[f.jsx(nK,{className:"h-full w-full rounded-[inherit]",ref:n,id:r,children:t}),f.jsx(UR,{orientation:o}),f.jsx(rK,{})]}));oi.displayName=VR.displayName;const UR=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>f.jsx(CS,{ref:r,orientation:t,className:ze("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(LR,{className:ze("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));UR.displayName=CS.displayName;var jx=0;function qv(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??d_()),document.body.insertAdjacentElement("beforeend",e[1]??d_()),jx++,()=>{jx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jx--}},[])}function d_(){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 Rx="focusScope.autoFocusOnMount",Ix="focusScope.autoFocusOnUnmount",f_={bubbles:!1,cancelable:!0},oK="FocusScope",tp=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=g.useState(null),c=tn(o),u=tn(i),d=g.useRef(null),h=Be(t,v=>l(v)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let v=function(S){if(p.paused||!a)return;const C=S.target;a.contains(C)?d.current=C:_s(d.current,{select:!0})},b=function(S){if(p.paused||!a)return;const C=S.relatedTarget;C!==null&&(a.contains(C)||_s(d.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(const _ of S)_.removedNodes.length>0&&_s(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,p.paused]),g.useEffect(()=>{if(a){p_.add(p);const v=document.activeElement;if(!a.contains(v)){const x=new CustomEvent(Rx,f_);a.addEventListener(Rx,c),a.dispatchEvent(x),x.defaultPrevented||(iK(uK(HR(a)),{select:!0}),document.activeElement===v&&_s(a))}return()=>{a.removeEventListener(Rx,c),setTimeout(()=>{const x=new CustomEvent(Ix,f_);a.addEventListener(Ix,u),a.dispatchEvent(x),x.defaultPrevented||_s(v??document.body,{select:!0}),a.removeEventListener(Ix,u),p_.remove(p)},0)}}},[a,c,u,p]);const m=g.useCallback(v=>{if(!n&&!r||p.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(b&&x){const w=v.currentTarget,[S,C]=sK(w);S&&C?!v.shiftKey&&x===C?(v.preventDefault(),n&&_s(S,{select:!0})):v.shiftKey&&x===S&&(v.preventDefault(),n&&_s(C,{select:!0})):x===w&&v.preventDefault()}},[n,r,p.paused]);return f.jsx(_e.div,{tabIndex:-1,...s,ref:h,onKeyDown:m})});tp.displayName=oK;function iK(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(_s(r,{select:t}),document.activeElement!==n)return}function sK(e){const t=HR(e),n=h_(t,e),r=h_(t.reverse(),e);return[n,r]}function HR(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 h_(e,t){for(const n of e)if(!aK(n,{upTo:t}))return n}function aK(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 lK(e){return e instanceof HTMLInputElement&&"select"in e}function _s(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&lK(e)&&t&&e.select()}}var p_=cK();function cK(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=m_(e,t),e.unshift(t)},remove(t){var n;e=m_(e,t),(n=e[0])==null||n.resume()}}}function m_(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function uK(e){return e.filter(t=>t.tagName!=="A")}var dK=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ql=new WeakMap,Wp=new WeakMap,Kp={},Ax=0,WR=function(e){return e&&(e.host||WR(e.parentNode))},fK=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=WR(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})},hK=function(e,t,n,r){var o=fK(t,Array.isArray(e)?e:[e]);Kp[n]||(Kp[n]=new WeakMap);var i=Kp[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(h){if(a.has(h))u(h);else try{var p=h.getAttribute(r),m=p!==null&&p!=="false",v=(Ql.get(h)||0)+1,b=(i.get(h)||0)+1;Ql.set(h,v),i.set(h,b),s.push(h),v===1&&m&&Wp.set(h,!0),b===1&&h.setAttribute(n,"true"),m||h.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return u(t),a.clear(),Ax++,function(){s.forEach(function(d){var h=Ql.get(d)-1,p=i.get(d)-1;Ql.set(d,h),i.set(d,p),h||(Wp.has(d)||d.removeAttribute(r),Wp.delete(d)),p||d.removeAttribute(n)}),Ax--,Ax||(Ql=new WeakMap,Ql=new WeakMap,Wp=new WeakMap,Kp={})}},Yv=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=dK(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),hK(r,o,n,"aria-hidden")):function(){return null}},ri=function(){return ri=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},ri.apply(this,arguments)};function KR(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 pK(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 ym="right-scroll-bar-position",xm="width-before-scroll-bar",mK="with-scroll-bars-hidden",gK="--removed-body-scroll-bar-size";function Dx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vK(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 yK=typeof window<"u"?g.useLayoutEffect:g.useEffect,g_=new WeakMap;function xK(e,t){var n=vK(null,function(r){return e.forEach(function(o){return Dx(o,r)})});return yK(function(){var r=g_.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||Dx(a,null)}),i.forEach(function(a){o.has(a)||Dx(a,s)})}g_.set(n,e)},[e]),n}function bK(e){return e}function wK(e,t){t===void 0&&(t=bK);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 SK(e){e===void 0&&(e={});var t=wK(null);return t.options=ri({async:!0,ssr:!1},e),t}var GR=function(e){var t=e.sideCar,n=KR(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,ri({},n))};GR.isSideCarExport=!0;function kK(e,t){return e.useMedium(t),GR}var qR=SK(),Lx=function(){},Jv=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:Lx,onWheelCapture:Lx,onTouchMoveCapture:Lx}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,h=e.sideCar,p=e.noIsolation,m=e.inert,v=e.allowPinchZoom,b=e.as,x=b===void 0?"div":b,w=e.gapMode,S=KR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,_=xK([n,t]),P=ri(ri({},S),o);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:qR,removeScrollBar:c,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),s?g.cloneElement(g.Children.only(a),ri(ri({},P),{ref:_})):g.createElement(x,ri({},P,{className:l,ref:_}),a))});Jv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jv.classNames={fullWidth:xm,zeroRight:ym};var EK=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CK(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=EK();return t&&e.setAttribute("nonce",t),e}function _K(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TK(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var PK=function(){var e=0,t=null;return{add:function(n){e==0&&(t=CK())&&(_K(t,n),TK(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},NK=function(){var e=PK();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},YR=function(){var e=NK(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},OK={left:0,top:0,right:0,gap:0},Fx=function(e){return parseInt(e||"",10)||0},MK=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[Fx(n),Fx(r),Fx(o)]},jK=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return OK;var t=MK(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])}},RK=YR(),Bc="data-scroll-locked",IK=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
386
|
+
.`.concat(mK,` {
|
|
387
|
+
overflow: hidden `).concat(r,`;
|
|
388
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
389
|
+
}
|
|
390
|
+
body[`).concat(Bc,`] {
|
|
391
|
+
overflow: hidden `).concat(r,`;
|
|
392
|
+
overscroll-behavior: contain;
|
|
393
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
394
|
+
padding-left: `.concat(o,`px;
|
|
395
|
+
padding-top: `).concat(i,`px;
|
|
396
|
+
padding-right: `).concat(s,`px;
|
|
397
|
+
margin-left:0;
|
|
398
|
+
margin-top:0;
|
|
399
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
400
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.`).concat(ym,` {
|
|
404
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.`).concat(xm,` {
|
|
408
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.`).concat(ym," .").concat(ym,` {
|
|
412
|
+
right: 0 `).concat(r,`;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.`).concat(xm," .").concat(xm,` {
|
|
416
|
+
margin-right: 0 `).concat(r,`;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
body[`).concat(Bc,`] {
|
|
420
|
+
`).concat(gK,": ").concat(a,`px;
|
|
421
|
+
}
|
|
422
|
+
`)},v_=function(){var e=parseInt(document.body.getAttribute(Bc)||"0",10);return isFinite(e)?e:0},AK=function(){g.useEffect(function(){return document.body.setAttribute(Bc,(v_()+1).toString()),function(){var e=v_()-1;e<=0?document.body.removeAttribute(Bc):document.body.setAttribute(Bc,e.toString())}},[])},DK=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;AK();var i=g.useMemo(function(){return jK(o)},[o]);return g.createElement(RK,{styles:IK(i,!t,o,n?"":"!important")})},Ob=!1;if(typeof window<"u")try{var Gp=Object.defineProperty({},"passive",{get:function(){return Ob=!0,!0}});window.addEventListener("test",Gp,Gp),window.removeEventListener("test",Gp,Gp)}catch{Ob=!1}var ec=Ob?{passive:!1}:!1,LK=function(e){return e.tagName==="TEXTAREA"},JR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!LK(e)&&n[t]==="visible")},FK=function(e){return JR(e,"overflowY")},zK=function(e){return JR(e,"overflowX")},y_=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=XR(e,r);if(o){var i=ZR(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},BK=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},$K=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},XR=function(e,t){return e==="v"?FK(t):zK(t)},ZR=function(e,t){return e==="v"?BK(t):$K(t)},VK=function(e,t){return e==="h"&&t==="rtl"?-1:1},UK=function(e,t,n,r,o){var i=VK(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,d=0,h=0;do{var p=ZR(e,a),m=p[0],v=p[1],b=p[2],x=v-b-i*m;(m||x)&&XR(e,a)&&(d+=x,h+=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(h)<1||!o))&&(c=!0),c},qp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},x_=function(e){return[e.deltaX,e.deltaY]},b_=function(e){return e&&"current"in e?e.current:e},HK=function(e,t){return e[0]===t[0]&&e[1]===t[1]},WK=function(e){return`
|
|
423
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
424
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
425
|
+
`)},KK=0,tc=[];function GK(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(KK++)[0],i=g.useState(YR)[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=pK([e.lockRef.current],(e.shards||[]).map(b_),!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=qp(v),w=n.current,S="deltaX"in v?v.deltaX:w[0]-x[0],C="deltaY"in v?v.deltaY:w[1]-x[1],_,P=v.target,O=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&O==="h"&&P.type==="range")return!1;var j=y_(O,P);if(!j)return!0;if(j?_=O:(_=O==="v"?"h":"v",j=y_(O,P)),!j)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=_),!_)return!0;var I=r.current||_;return UK(I,b,v,I==="h"?S:C,!0)},[]),l=g.useCallback(function(v){var b=v;if(!(!tc.length||tc[tc.length-1]!==i)){var x="deltaY"in b?x_(b):qp(b),w=t.current.filter(function(_){return _.name===b.type&&(_.target===b.target||b.target===_.shadowParent)&&HK(_.delta,x)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var S=(s.current.shards||[]).map(b_).filter(Boolean).filter(function(_){return _.contains(b.target)}),C=S.length>0?a(b,S[0]):!s.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),c=g.useCallback(function(v,b,x,w){var S={name:v,delta:b,target:x,should:w,shadowParent:qK(x)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),u=g.useCallback(function(v){n.current=qp(v),r.current=void 0},[]),d=g.useCallback(function(v){c(v.type,x_(v),v.target,a(v,e.lockRef.current))},[]),h=g.useCallback(function(v){c(v.type,qp(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return tc.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,ec),document.addEventListener("touchmove",l,ec),document.addEventListener("touchstart",u,ec),function(){tc=tc.filter(function(v){return v!==i}),document.removeEventListener("wheel",l,ec),document.removeEventListener("touchmove",l,ec),document.removeEventListener("touchstart",u,ec)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(i,{styles:WK(o)}):null,p?g.createElement(DK,{gapMode:e.gapMode}):null)}function qK(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const YK=kK(qR,GK);var np=g.forwardRef(function(e,t){return g.createElement(Jv,ri({},e,{ref:t,sideCar:YK}))});np.classNames=Jv.classNames;var PS="Popover",[QR,xme]=uo(PS,[bi]),rp=bi(),[JK,Ra]=QR(PS),eI=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=rp(t),l=g.useRef(null),[c,u]=g.useState(!1),[d=!1,h]=Fr({prop:r,defaultProp:o,onChange:i});return f.jsx(Hh,{...a,children:f.jsx(JK,{scope:t,contentId:Ir(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:s,children:n})})};eI.displayName=PS;var tI="PopoverAnchor",XK=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ra(tI,n),i=rp(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return g.useEffect(()=>(s(),()=>a()),[s,a]),f.jsx(Ru,{...i,...r,ref:t})});XK.displayName=tI;var nI="PopoverTrigger",rh=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ra(nI,n),i=rp(n),s=Be(t,o.triggerRef),a=f.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":aI(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:f.jsx(Ru,{asChild:!0,...i,children:a})});rh.displayName=nI;var NS="PopoverPortal",[ZK,QK]=QR(NS,{forceMount:void 0}),rI=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Ra(NS,t);return f.jsx(ZK,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Iu,{asChild:!0,container:o,children:r})})})};rI.displayName=NS;var pu="PopoverContent",oI=g.forwardRef((e,t)=>{const n=QK(pu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Ra(pu,e.__scopePopover);return f.jsx(an,{present:r||i.open,children:i.modal?f.jsx(eG,{...o,ref:t}):f.jsx(tG,{...o,ref:t})})});oI.displayName=pu;var eG=g.forwardRef((e,t)=>{const n=Ra(pu,e.__scopePopover),r=g.useRef(null),o=Be(t,r),i=g.useRef(!1);return g.useEffect(()=>{const s=r.current;if(s)return Yv(s)},[]),f.jsx(np,{as:Qi,allowPinchZoom:!0,children:f.jsx(iI,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(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:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),tG=g.forwardRef((e,t)=>{const n=Ra(pu,e.__scopePopover),r=g.useRef(!1),o=g.useRef(!1);return f.jsx(iI,{...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()}})}),iI=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,h=Ra(pu,n),p=rp(n);return qv(),f.jsx(tp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx($l,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:f.jsx(Wh,{"data-state":aI(h.open),role:"dialog",id:h.contentId,...p,...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)"}})})})}),sI="PopoverClose",Xv=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ra(sI,n);return f.jsx(_e.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Xv.displayName=sI;var nG="PopoverArrow",rG=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=rp(n);return f.jsx(Kh,{...o,...r,ref:t})});rG.displayName=nG;function aI(e){return e?"open":"closed"}var oG=eI,iG=rh,sG=rI,lI=oI;const ns=oG,Fu=iG,hi=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>f.jsx(sG,{container:r.container,children:f.jsx(lI,{ref:o,align:t,sideOffset:n,className:ze("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})}));hi.displayName=lI.displayName;function w_({profile:e,size:t="md"}){var c,u,d;const[n,r]=g.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);g.useEffect(()=>{var h,p;(h=e==null?void 0:e.avatar)!=null&&h.url?r((p=e==null?void 0:e.avatar)==null?void 0:p.url):r(null)},[(u=e==null?void 0:e.avatar)==null?void 0:u.url]);const[o,...i]=((d=e.fullName)==null?void 0:d.split(" "))||[""],s=i[i.length-1]||"",a=`${o[0].toUpperCase()}${s[0].toUpperCase()}`,l=ke("rounded-full text-center inline-block bg-bg-brand-primary text-text-brand-primary",{"h-8 w-8 leading-8 text-xs":t==="sm","h-10 w-10 leading-10 text-base":t==="md","h-12 w-12 leading-[3rem] text-lg":t==="lg"});return n?f.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):f.jsx("span",{className:l,children:a})}const cI=1280;function aG(){const e=Du(),[t,n]=g.useState(""),[r,o]=g.useState("");g.useEffect(()=>{async function x(){let w=!1;const S=async C=>{if(!w)try{(await fetch(C)).ok&&(w=!0,n(C))}catch{}};await S("/favicon.ico"),await S("/favicon.svg"),await S("/favicon.png"),await S("/apple-touch-icon.png"),await S("https://valbuild.com/favicon.ico")}if(x(),e!=null&&e.project)o(e.project);else try{let w=new URL(location.origin).hostname;if(w!=="localhost"){const S=w.split(".");S.length>=2&&(w=S.slice(1,-1).join(".")),o(cf(w))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const i=Xh(),s=Kr(),{theme:a,setTheme:l}=Uv(),{navMenu:c}=Fy(),u=(e==null?void 0:e.appHost)||ub,[d,h]=r.split("/"),p=XW(),m=`${u}/orgs/${d}`,v=`${u}/orgs/${d}/members`,b=`${m}/projects/${h}`;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"}),d&&h?f.jsx("a",{className:"truncate hover:underline",href:b,children:r}):f.jsx("span",{className:"truncate",children:r})]}),f.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:f.jsx(kg,{size:16,className:ke("transform",{"rotate-180":!c.isOpen})})})]}),"data"in i&&f.jsx("div",{className:ke("py-4 pl-2",{}),children:f.jsx(oi,{children:f.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)]",children:f.jsx(cG,{})})})}),f.jsx("div",{className:"h-6 p-4"}),f.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:f.jsxs(ns,{children:[f.jsxs(rh,{className:"flex items-center justify-between w-full p-4 border-t border-border-primary hover:bg-bg-secondary data-[state=open]:bg-bg-secondary",children:[f.jsx("span",{children:p&&f.jsx(w_,{size:"sm",profile:p})}),f.jsx(bR,{size:16})]}),f.jsx(hi,{className:"p-0 py-2",container:s,side:"top",children:f.jsxs("div",{className:"flex flex-col items-center justify-between gap-2",children:[p&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center w-full gap-2 px-4 py-2",children:[f.jsx(w_,{size:"sm",profile:p}),f.jsxs("div",{className:"text-sm",children:[f.jsx("div",{className:"truncate",children:p.fullName}),p.email&&f.jsx("div",{className:"font-light truncate",children:p.email})]})]}),f.jsx("hr",{className:"w-full h-1 mb-1 border-t border-border-primary"})]}),f.jsxs("div",{className:"flex items-center w-full gap-2 px-4",children:[a==="dark"?f.jsx(E7,{size:"1rem"}):f.jsx(I7,{size:"1rem"}),f.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?f.jsx("span",{className:"text-sm",children:"Dark mode"}):f.jsx("span",{className:"text-sm",children:"Light mode"})})]}),p&&f.jsxs("div",{className:"flex items-center w-full gap-2 px-4",children:[f.jsx(V7,{size:"1rem"}),f.jsx("a",{href:v,children:f.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),p&&f.jsxs(f.Fragment,{children:[f.jsx("hr",{className:"w-full h-1 mt-1 mb-1 border-t border-border-primary"}),f.jsxs("div",{className:"flex items-center w-full gap-2 px-4",children:[f.jsx(S7,{size:"1rem"}),f.jsx("a",{href:Qf("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:f.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function lG(){const e=Xh();return g.useMemo(()=>{if(e.status==="success"){const t=Object.keys(e.data);return{status:e.status,data:U7(t)}}return e},[e])}function cG({title:e}){const t=lG();if(t.status==="error")return console.error(t.error),null;if(t.status!=="success")return f.jsx(uG,{});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(uI).map((r,o)=>g.createElement(dI,{...r,name:r.name,key:o}))})]})}function uG(){return null}function uI(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function dI({name:e,fullPath:t,isDirectory:n,children:r}){const{navigate:o,currentSourcePath:i}=Vn(),{navMenu:s}=Fy(),[a,l]=g.useState(!0),c=ja()||{},u=g.useMemo(()=>{let v=!1;for(const b in c)if(b.startsWith(t)){v=!0;break}return v},[c,t]),d=g.useMemo(()=>{if(n){if(!a)return u}else if(!n)return u;return!1},[u,a,n]),h=t,p=It(h),m="data"in p?p.data.type:"loading";return f.jsxs("div",{className:"w-full text-sm",children:[f.jsxs("button",{className:ke("relative flex justify-between w-full p-2",{underline:i.startsWith(h)&&!n,"font-bold":i.startsWith(h)&&n}),onClick:()=>{n?l(!a):(window.innerWidth<cI&&s.setOpen(!1),o(h))},children:[f.jsxs("div",{className:"flex items-center pr-2",children:[n?f.jsx(Wv,{size:16,className:ke("transform mr-2",{"rotate-90":a,hidden:!r.length})}):f.jsx(dG,{type:m,size:14}),f.jsx("span",{children:fu(e)})]}),d&&f.jsx("div",{className:"w-2 h-2 ml-2 rounded-full bg-bg-error-primary"})]}),f.jsx("div",{className:"pl-2",children:f.jsx(nh,{isOpen:a,children:r.sort(uI).map((v,b)=>g.createElement(dI,{...v,key:b}))})})]})}function dG({size:e,type:t}){if(t==="loading")return f.jsx(Uo,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return f.jsx(z7,{size:e,className:"mr-2"});case"number":return f.jsx(m7,{size:e,className:"mr-2"});case"boolean":return f.jsx(D7,{size:e,className:"mr-2"});case"object":return f.jsx(y7,{size:e,className:"mr-2"});case"literal":return f.jsx(d7,{size:e,className:"mr-2"});case"array":return f.jsx(ER,{size:e,className:"mr-2"});case"union":return f.jsx(N7,{size:e,className:"mr-2"});case"richtext":return f.jsx(h7,{size:e,className:"mr-2"});case"record":return f.jsx(A7,{size:e,className:"mr-2"});case"keyOf":return f.jsx(v7,{size:e,className:"mr-2"});case"file":return f.jsx(SR,{size:e,className:"mr-2"});case"date":return f.jsx(xR,{size:e,className:"mr-2"});case"image":return f.jsx(kR,{size:e,className:"mr-2"});default:return f.jsx(c7,{size:e,className:"mr-2"})}}function OS(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 MS="Checkbox",[fG,bme]=uo(MS),[hG,pG]=fG(MS),fI=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,[h,p]=g.useState(null),m=Be(t,C=>p(C)),v=g.useRef(!1),b=h?u||!!h.closest("form"):!0,[x=!1,w]=Fr({prop:o,defaultProp:i,onChange:c}),S=g.useRef(x);return g.useEffect(()=>{const C=h==null?void 0:h.form;if(C){const _=()=>w(S.current);return C.addEventListener("reset",_),()=>C.removeEventListener("reset",_)}},[h,w]),f.jsxs(hG,{scope:n,state:x,disabled:a,children:[f.jsx(_e.button,{type:"button",role:"checkbox","aria-checked":ia(x)?"mixed":x,"aria-required":s,"data-state":mI(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onKeyDown:te(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:te(e.onClick,C=>{w(_=>ia(_)?!0:!_),b&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})}),b&&f.jsx(mG,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:ia(i)?!1:i})]})});fI.displayName=MS;var hI="CheckboxIndicator",pI=g.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=pG(hI,n);return f.jsx(an,{present:r||ia(i.state)||i.state===!0,children:f.jsx(_e.span,{"data-state":mI(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});pI.displayName=hI;var mG=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=g.useRef(null),a=OS(n),l=aS(t);g.useEffect(()=>{const u=s.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&p){const m=new Event("click",{bubbles:r});u.indeterminate=ia(n),p.call(u,ia(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=g.useRef(ia(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 ia(e){return e==="indeterminate"}function mI(e){return ia(e)?"indeterminate":e?"checked":"unchecked"}var gI=fI,gG=pI;const zu=g.forwardRef(({className:e,...t},n)=>{const[r,o]=g.useState();return g.useEffect(()=>{o(t.checked)},[t.checked]),f.jsx(gI,{ref:n,checked:r,onCheckedChange:i=>{o(i),t.onCheckedChange&&t.onCheckedChange(i)},className:ze("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(gG,{className:ze("flex items-center justify-center text-current"),children:[r===!0&&f.jsx(Zh,{size:12}),r==="indeterminate"&&f.jsx(k7,{size:12})]})})});zu.displayName=gI.displayName;function zx(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 S_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,k_=iR,vG=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return k_(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 h=S_(u)||S_(d);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...p}=u;return Object.entries(p).every(m=>{let[v,b]=m;return Array.isArray(b)?b.includes({...i,...a}[v]):{...i,...a}[v]===b})?[...c,d,h]:c},[]);return k_(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Mb=vG("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"}}),Lt=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Qi:"button";return f.jsx(s,{className:ze(Mb({variant:t,size:n,className:e})),ref:i,...o})});Lt.displayName="Button";var Bx,jS="HoverCard",[vI,wme]=uo(jS,[bi]),Zv=bi(),[yG,RS]=vI(jS),yI=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=Zv(t),c=g.useRef(0),u=g.useRef(0),d=g.useRef(!1),h=g.useRef(!1),[p=!1,m]=Fr({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&&!h.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(yG,{scope:t,open:p,onOpenChange:m,onOpen:v,onClose:b,onDismiss:x,hasSelectionRef:d,isPointerDownOnContentRef:h,children:f.jsx(Hh,{...l,children:n})})};yI.displayName=jS;var xI="HoverCardTrigger",IS=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=RS(xI,n),i=Zv(n);return f.jsx(Ru,{asChild:!0,...i,children:f.jsx(_e.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:te(e.onPointerEnter,Tg(o.onOpen)),onPointerLeave:te(e.onPointerLeave,Tg(o.onClose)),onFocus:te(e.onFocus,o.onOpen),onBlur:te(e.onBlur,o.onClose),onTouchStart:te(e.onTouchStart,s=>s.preventDefault())})})});IS.displayName=xI;var xG="HoverCardPortal",[Sme,bG]=vI(xG,{forceMount:void 0}),_g="HoverCardContent",AS=g.forwardRef((e,t)=>{const n=bG(_g,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=RS(_g,e.__scopeHoverCard);return f.jsx(an,{present:r||i.open,children:f.jsx(wG,{"data-state":i.open?"open":"closed",...o,onPointerEnter:te(e.onPointerEnter,Tg(i.onOpen)),onPointerLeave:te(e.onPointerLeave,Tg(i.onClose)),ref:t})})});AS.displayName=_g;var wG=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=RS(_g,n),c=Zv(n),u=g.useRef(null),d=Be(t,u),[h,p]=g.useState(!1);return g.useEffect(()=>{if(h){const m=document.body;return Bx=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=Bx,m.style.webkitUserSelect=Bx}}},[h]),g.useEffect(()=>{if(u.current){const m=()=>{p(!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&&EG(u.current).forEach(v=>v.setAttribute("tabindex","-1"))}),f.jsx($l,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:te(i,m=>{m.preventDefault()}),onDismiss:l.onDismiss,children:f.jsx(Wh,{...c,...a,onPointerDown:te(a.onPointerDown,m=>{m.currentTarget.contains(m.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"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)"}})})}),SG="HoverCardArrow",kG=g.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=Zv(n);return f.jsx(Kh,{...o,...r,ref:t})});kG.displayName=SG;function Tg(e){return t=>t.pointerType==="touch"?void 0:e()}function EG(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 CG=yI,_G=IS,bI=AS;const al=CG,$c=_G,ll=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>f.jsx(bI,{ref:o,align:t,sideOffset:n,className:ze("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}));ll.displayName=bI.displayName;function wI({onPublish:e,onClose:t}){const[n,r]=g.useState(null),o=qh(),{summary:i,canGenerate:s,setSummary:a,publishDisabled:l,generateSummary:c}=Yh(),[u,d]=g.useState(!1),h=()=>{d(!1),i.type!=="not-asked"&&a({...i})};g.useEffect(()=>{i.type!=="not-asked"&&!i.isGenerating&&!lu(i.patchIds,o)&&d(!0)},[i,o]);const p=g.useCallback(()=>{h(),c().then(b=>{b.type==="ai"?a({type:"ai",text:b.text.trim()}):r(b.message)})},[h,c,a,r]),m="w-full p-2 border rounded bg-bg-secondary",v="text"in i?i.text:"";return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[f.jsx("span",{className:"font-semibold",children:"Summary"}),s&&f.jsx(E_,{onClick:p,isGenerating:i.isGenerating})]}),n&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:n}),f.jsxs("div",{className:"grid text-xs font-light",children:[f.jsx("div",{"aria-hidden":!0,className:ze(m,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),f.jsx("textarea",{disabled:!!i.isGenerating,className:ze(m,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(s?" or generate one using AI":""),onChange:b=>{h(),a({type:"manual",text:b.currentTarget.value})}})]}),f.jsxs("div",{className:ze("p-2 text-xs flex-grow font-light bg-bg-warning-primary text-[black] rounded flex items-center","flex justify-between w-full gap-2 py-2",{hidden:!u}),"aria-hidden":u,children:[f.jsx("span",{children:"Summary might be outdated. "}),f.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),f.jsx("div",{className:"flex items-center justify-end gap-2",children:e?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&s&&f.jsx(E_,{isGenerating:i.isGenerating,onClick:p}),!u&&f.jsxs(Lt,{disabled:l||v.trim()==="",onClick:()=>{i.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[f.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),f.jsx(kS,{size:16})]})]}):f.jsx(f.Fragment,{children:f.jsx(Lt,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function E_({isGenerating:e,onClick:t}){return f.jsx(Lt,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:f.jsxs("span",{className:"flex items-center gap-2",children:[f.jsx("span",{children:e?"Generating...":"Generate"}),f.jsx(_R,{size:16})]})})}function TG(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);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,PG(o,...t)]}function PG(...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 Qv(e){const t=e+"CollectionProvider",[n,r]=TG(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:m,children:v}=p,b=Se.useRef(null),x=Se.useRef(new Map).current;return f.jsx(o,{scope:m,itemMap:x,collectionRef:b,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=Se.forwardRef((p,m)=>{const{scope:v,children:b}=p,x=i(a,v),w=Be(m,x.collectionRef);return f.jsx(Qi,{ref:w,children:b})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=Se.forwardRef((p,m)=>{const{scope:v,children:b,...x}=p,w=Se.useRef(null),S=Be(m,w),C=i(c,v);return Se.useEffect(()=>(C.itemMap.set(w,{ref:w,...x}),()=>void C.itemMap.delete(w))),f.jsx(Qi,{[u]:"",ref:S,children:b})});d.displayName=c;function h(p){const m=i(e+"CollectionConsumer",p);return Se.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},h,r]}var DS="Collapsible",[NG,SI]=uo(DS),[OG,LS]=NG(DS),kI=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,c]=Fr({prop:r,defaultProp:o,onChange:s});return f.jsx(OG,{scope:n,disabled:i,contentId:Ir(),open:l,onOpenToggle:g.useCallback(()=>c(u=>!u),[c]),children:f.jsx(_e.div,{"data-state":zS(l),"data-disabled":i?"":void 0,...a,ref:t})})});kI.displayName=DS;var EI="CollapsibleTrigger",CI=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=LS(EI,n);return f.jsx(_e.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":zS(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});CI.displayName=EI;var FS="CollapsibleContent",_I=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=LS(FS,e.__scopeCollapsible);return f.jsx(an,{present:n||o.open,children:({present:i})=>f.jsx(MG,{...r,ref:t,present:i})})});_I.displayName=FS;var MG=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=LS(FS,n),[a,l]=g.useState(r),c=g.useRef(null),u=Be(t,c),d=g.useRef(0),h=d.current,p=g.useRef(0),m=p.current,v=s.open||a,b=g.useRef(v),x=g.useRef();return g.useEffect(()=>{const w=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(w)},[]),_n(()=>{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 S=w.getBoundingClientRect();d.current=S.height,p.current=S.width,b.current||(w.style.transitionDuration=x.current.transitionDuration,w.style.animationName=x.current.animationName),l(r)}},[s.open,r]),f.jsx(_e.div,{"data-state":zS(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:v&&o})});function zS(e){return e?"open":"closed"}var jG=kI,RG=CI,IG=_I,ls="Accordion",AG=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[BS,DG,LG]=Qv(ls),[ey,kme]=uo(ls,[LG,SI]),$S=SI(),VS=Se.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return f.jsx(BS.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?f.jsx($G,{...i,ref:t}):f.jsx(BG,{...o,ref:t})})});VS.displayName=ls;var[TI,FG]=ey(ls),[PI,zG]=ey(ls,{collapsible:!1}),BG=Se.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=Fr({prop:n,defaultProp:r,onChange:o});return f.jsx(TI,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:Se.useCallback(()=>i&&l(""),[i,l]),children:f.jsx(PI,{scope:e.__scopeAccordion,collapsible:i,children:f.jsx(NI,{...s,ref:t})})})}),$G=Se.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=Fr({prop:n,defaultProp:r,onChange:o}),l=Se.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=Se.useCallback(u=>a((d=[])=>d.filter(h=>h!==u)),[a]);return f.jsx(TI,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c,children:f.jsx(PI,{scope:e.__scopeAccordion,collapsible:!0,children:f.jsx(NI,{...i,ref:t})})})}),[VG,ty]=ey(ls),NI=Se.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=Se.useRef(null),l=Be(a,t),c=DG(n),d=ep(o)==="ltr",h=te(e.onKeyDown,p=>{var j;if(!AG.includes(p.key))return;const m=p.target,v=c().filter(I=>{var F;return!((F=I.ref.current)!=null&&F.disabled)}),b=v.findIndex(I=>I.ref.current===m),x=v.length;if(b===-1)return;p.preventDefault();let w=b;const S=0,C=x-1,_=()=>{w=b+1,w>C&&(w=S)},P=()=>{w=b-1,w<S&&(w=C)};switch(p.key){case"Home":w=S;break;case"End":w=C;break;case"ArrowRight":i==="horizontal"&&(d?_():P());break;case"ArrowDown":i==="vertical"&&_();break;case"ArrowLeft":i==="horizontal"&&(d?P():_());break;case"ArrowUp":i==="vertical"&&P();break}const O=w%x;(j=v[O].ref.current)==null||j.focus()});return f.jsx(VG,{scope:n,disabled:r,direction:o,orientation:i,children:f.jsx(BS.Slot,{scope:n,children:f.jsx(_e.div,{...s,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),Pg="AccordionItem",[UG,US]=ey(Pg),OI=Se.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=ty(Pg,n),s=FG(Pg,n),a=$S(n),l=Ir(),c=r&&s.value.includes(r)||!1,u=i.disabled||e.disabled;return f.jsx(UG,{scope:n,open:c,disabled:u,triggerId:l,children:f.jsx(jG,{"data-orientation":i.orientation,"data-state":DI(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:d=>{d?s.onItemOpen(r):s.onItemClose(r)}})})});OI.displayName=Pg;var MI="AccordionHeader",jI=Se.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=ty(ls,n),i=US(MI,n);return f.jsx(_e.h3,{"data-orientation":o.orientation,"data-state":DI(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});jI.displayName=MI;var jb="AccordionTrigger",RI=Se.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=ty(ls,n),i=US(jb,n),s=zG(jb,n),a=$S(n);return f.jsx(BS.ItemSlot,{scope:n,children:f.jsx(RG,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId,...a,...r,ref:t})})});RI.displayName=jb;var II="AccordionContent",AI=Se.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=ty(ls,n),i=US(II,n),s=$S(n);return f.jsx(IG,{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}})});AI.displayName=II;function DI(e){return e?"open":"closed"}var HG=VS,WG=OI,KG=jI,LI=RI,FI=AI;const oh=HG,Cl=g.forwardRef(({className:e,...t},n)=>f.jsx(WG,{ref:n,className:ze("border-b",e),...t}));Cl.displayName="AccordionItem";const _l=g.forwardRef(({className:e,children:t,...n},r)=>f.jsx(KG,{className:"flex",children:f.jsxs(LI,{ref:r,className:ze("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(Qh,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));_l.displayName=LI.displayName;const Tl=g.forwardRef(({className:e,children:t,...n},r)=>f.jsx(FI,{ref:r,className:ze("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})}));Tl.displayName=FI.displayName;function zI(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const i=c=>{o===""?o=c:o+="."+c};let s=t,a=n;const l=[{modulePath:o,schema:s,source:a}];for(const c of e){if(r++,c==="")return{success:!1,error:`Empty path part in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(s.type==="array"){s=s.item;const u=Number(c);if(!Number.isSafeInteger(u))return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an integer but got '${c}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(typeof a!="object")return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===null)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'null' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(a===void 0)return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an object but got 'undefined' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!Array.isArray(a))return{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an array but got '${typeof a}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};if(!a[u])return{success:!1,error:`Invalid array index in: '${e.join("/")}'. Expected an index less than ${a.length} but got '${u}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};a=a[u],i(c)}else if(s.type==="record"){s=s.item;const u=Yp(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="object"){s=s.items[c];const u=Yp(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else if(s.type==="union"){const u=typeof s.key=="object"&&s.key.type==="literal"?s:void 0,d=typeof s.key=="string"?s:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(d){const h=Yp(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let m;for(const v of d.items){const b=v.items[d.key];if(b.type==="literal"){if(p[d.key]===b.value){m=v;break}}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}if(!m)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};s=m.items[c],a=p[c],i(JSON.stringify(c))}else return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`}}else if(s.type==="image"||s.type==="file"){const u=Yp(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],i(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${s.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:s,source:a})}return{success:!0,modulePath:o,schema:s,source:a,allResolved:l}}function Yp(e,t,n,r,o){return typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===null?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'null' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:r===void 0?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'undefined' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:typeof r!="object"?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got '${typeof r}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:Array.isArray(r)?{success:!1,error:`Invalid source type in: '${e.join("/")}'. Expected an '${o}' but got 'array' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}:t in r?{success:!0,source:r}:{success:!1,error:`Could not find key of source: '${e.join("/")}'. Expected a key in ${Object.keys(r).join(", ")} but got '${t}' at part ${n} (sliced: ${e.slice(0,n+1).join("/")})`}}function GG(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function BI(e,t,n){if(!n)return null;const[r,o]=ee.splitModuleFilePathAndModulePath(e);if(!o)return r;const i=t[r],s=n[r];if(!i||!s)return null;const a=zI(ee.splitModulePath(o),s,i);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(GG(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:ee.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function ny({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const i=Du(),s=g.useRef(null),a=g.useRef(new Map),[l,c]=g.useState([]),[u,d]=g.useState(),h=wS(),p=Xh(),{navigate:m}=Vn();g.useEffect(()=>{const b=e?ee.splitModuleFilePath(e):[],x=t,w=()=>{if(!s.current)return;const C=s.current,_=getComputedStyle(C),P=`${_.fontSize} ${_.fontFamily}`,O=C.offsetWidth,j=b.map(qG).concat(x).map(W=>`/${W}`);d(j.join(""));const I=W=>{const B=`${W}:${P}`,A=a.current.get(B)??YG(W,P);return a.current.set(B,A),A},F="/…",H=I(F),$=[];let J=0;for(let W=j.length-1;W>=0;W--){const B=I(j[W]),R=!(W===0);if(J+B+(R?H:0)<=O){const N=W>b.length?"module-path":"module-file-path";$.unshift({text:j[W],type:N,moduleFilePath:e,modulePathSegments:x.slice(0,W)}),J+=B}else{$.unshift({type:"ellipsis",text:F});break}}c($)},S=new ResizeObserver(w);return s.current&&(S.observe(s.current),w()),()=>{s.current&&S.unobserve(s.current)}},[e,t]);const v=g.useMemo(()=>{if(!o)return null;const b="data"in p?p.data:{},x=zI(t,b[e],h[e]);if(x.success){const w=ee.joinModuleFilePathAndModulePath(e,x.modulePath),S=BI(w,h,b);if(S)return{navPath:S,scrollToId:w};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${S}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${x.error}`);return null},[e,t,h,p]);return f.jsxs(dR,{open:r===!1?!1:void 0,children:[f.jsx(fS,{asChild:!0,children:f.jsx("a",{href:v&&i?`${i.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:s,className:ke("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:b=>{o&&v&&b.metaKey===!1&&b.ctrlKey===!1&&b.shiftKey===!1&&(b.preventDefault(),m(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((b,x)=>f.jsx("span",{children:b.text},x))})}),f.jsx(mS,{side:"top",children:f.jsx(oi,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function qG(e){const t=fu(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function YG(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function $I({className:e,loadingStatus:t}){const n=qh(),r=Lu(),o=KW(),i=WW(),s=Kr(),[a,l]=g.useState(!1),{canGenerate:c}=Yh(),u=ja(),{autoPublish:d}=yS(),h=g.useMemo(()=>{var w;let x=0;for(const S in u)x+=((w=u[S])==null?void 0:w.length)||0;return x},[u]),p=n.length-o.size,m=Vn(),{deployments:v,dismissDeployment:b}=HW();return f.jsxs("div",{className:ke("text-sm",e),children:[u&&h>0&&f.jsx("div",{className:"sticky top-0 text-white border-b border-border-primary bg-bg-error-primary z-5",children:f.jsx(oi,{orientation:"horizontal",children:f.jsx(oh,{type:"single",className:"px-4 font-serif",collapsible:!0,children:f.jsxs(Cl,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[f.jsxs(_l,{children:[h," validation error",h>1?"s":""]}),f.jsx(Tl,{className:"w-full",children:f.jsx("div",{className:"flex flex-col gap-2",children:f.jsx(oh,{type:"multiple",className:"w-full",children:Object.entries(u).map(([x,w],S)=>f.jsxs(Cl,{value:x+"#"+S,children:[f.jsx(_l,{children:f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{m.navigate(x)},children:x}),f.jsxs("span",{className:"pl-4",children:["(",(w==null?void 0:w.length)||0,")"]})]})}),f.jsx(Tl,{children:f.jsx("div",{className:"flex flex-col gap-2",children:w==null?void 0:w.map((C,_)=>f.jsxs("div",{children:[f.jsx("div",{children:C.message}),f.jsxs("div",{className:"pl-4 font-thin",children:["at",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{m.navigate(x)},children:x})]})]},_))})})]},x+"#"+S))})})})]})})})}),v.length>0&&f.jsx("div",{className:"p-4 border-b border-border-primary",children:f.jsx(JG,{deployments:v,onDismiss:b})}),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("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&f.jsx("div",{className:"",children:f.jsx(Uo,{size:16,className:"animate-spin"})})]}),r==="http"&&f.jsxs(ns,{open:a,onOpenChange:x=>{l(x)},children:[f.jsx(Fu,{asChild:!0,children:f.jsxs(Lt,{variant:"outline",className:"flex items-center gap-2 text-sm",children:[f.jsx("span",{children:"Summary"}),c&&f.jsx(_R,{size:14})]})}),f.jsxs(hi,{container:s,align:"end",className:"z-[9001] flex flex-col gap-4",children:[f.jsx(Xv,{asChild:!0,className:"self-end cursor-pointer",children:f.jsx(du,{size:12})}),f.jsx(wI,{onClose:()=>{l(!1)}})]})]})]})}),(!d||h>0)&&f.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in i&&n.length>0&&i.data.map(x=>f.jsx(eq,{committedPatchIds:o,patchSet:x},x.moduleFilePath+":"+x.patchPath.join("/")))})]})}function JG({deployments:e,onDismiss:t}){return f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center justify-between p-2 font-bold",children:[f.jsx("span",{children:"Deployments"}),f.jsx(Uo,{size:16,className:"inline animate-spin"})]}),f.jsx("div",{children:e.reverse().map(n=>f.jsx(XG,{deployment:n,onDismiss:()=>{t(n.commitSha)}},n.commitSha))})]})}function XG({deployment:e}){var o;const t=bS(),n=Kr(),r=e.creator&&t[e.creator];return f.jsxs("div",{className:"flex items-start justify-between p-2",children:[f.jsxs("div",{className:"flex items-start gap-2",children:[r&&f.jsx("img",{src:(o=r.avatar)==null?void 0:o.url,alt:r.fullName,className:"w-8 h-8 rounded-full"}),f.jsxs(dR,{children:[f.jsx(Qj,{container:n}),f.jsx($W,{children:f.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),f.jsx(mS,{className:"max-w-[320px]",children:f.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),f.jsx(ZG,{since:new Date(e.createdAt)})]})}function ZG({since:e}){const[t,n]=g.useState("00"),[r,o]=g.useState("00");return g.useEffect(()=>{let i;const s=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let d;c>4?(d=(60-u)*1e3,n(c.toString()),o(null)):(d=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),i=setTimeout(s,d)};return s(),()=>{clearTimeout(i)}},[e]),f.jsxs("div",{className:"text-xs font-light text-text-quartenary",children:[t,r!==null?`:${r}`:" mins"]})}function QG({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var d;const r=VI([t.opType],t.createdAt,n.has(t.patchId)),o=bS(),{patchErrors:i,skippedPatches:s}=xS(),[a,l]=g.useMemo(()=>[i[t.patchId]||[],!!s[t.patchId]],[t.patchId,i[t.patchId],s[t.patchId]]),c=Lu();let u=[];if(t.author){const h=o[t.author];if(h){const p=((d=h==null?void 0:h.avatar)==null?void 0:d.url)??null;u=[{fullName:h.fullName,url:p}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return u.length===0&&c==="http"&&console.warn("No authors",{patchMetadata:t}),f.jsx(Rb,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:l?"Skipped":r,authors:u,errors:a,skipped:l,isApplied:n.has(t.patchId)})}function VI(e,t,n){const[r,o]=g.useState(new Date);if(g.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+zx(r,t);if(e.length>1)return"Updated "+zx(r,t);const i=e[0];let s=i;return i==="add"?s="Added":i==="remove"?s="Removed":i==="replace"?s="Replaced":i==="move"?s="Moved":i==="copy"?s="Copied":i==="test"?s="Tested":i==="file"?s="Updated":console.warn("Unexpected op type: ",i),s+" "+zx(r,t)}function eq({patchSet:e,committedPatchIds: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}=xS(),{deletePatches:c}=UW(),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]),h=VI(e.opTypes,e.lastUpdated,!1),p=bS(),m=e.patches.every(v=>t.has(v.patchId));return i?f.jsxs(f.Fragment,{children:[f.jsx(Rb,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:m,authors:e.authors.reduce((v,b)=>v.includes(b)?v:v.concat(b),[]).flatMap(v=>{var x;const b=p[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:h,isOpen:n,setOpen:r,errors:d,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),f.jsx(nh,{isOpen:n,children:e.patches.map((v,b)=>f.jsx(QG,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+b))})]}):f.jsx(Rb,{ref:o,isApplied:m})}const Rb=g.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:i,isSelected:s,setSelected:a,errors:l,skipped:c,onDelete:u,amount:d,isApplied:h},p)=>f.jsxs("div",{ref:p,className:ke("p-6",{"bg-bg-secondary":!o,"bg-bg-quartenary":o,"opacity-50":h}),children:[f.jsxs("div",{className:"relative",children:[f.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&f.jsx(ny,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),s===void 0&&f.jsx("span",{className:ke("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),s!==void 0&&!h&&f.jsx(zu,{checked:s,onCheckedChange:m=>{a&&a(m)}}),u&&!h&&f.jsxs("button",{onClick:u,title:"Revert change",className:"relative ml-5",children:[d&&f.jsx("span",{className:"absolute px-2 text-xs rounded-full -top-6 -right-5 bg-bg-quartenary",children:d>10?"10+":d}),f.jsx(B7,{size:16,className:"inline"})]})]}),l&&l.length>0&&!c&&f.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-text-primary",children:[l.slice(0,1).map((m,v)=>f.jsx("div",{title:m,className:"truncate",children:m},v)),l.length>1&&f.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&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:[r!==void 0&&r.length>0&&f.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((m,v)=>{if(m.url)return f.jsxs(al,{children:[f.jsx($c,{className:"flex-shrink-0 w-6 h-6 ",children:f.jsx("img",{src:m.url,alt:m.fullName,className:ke("rounded-full",{"-ml-3":r.length>2&&v>0})})}),f.jsx(ll,{children:f.jsx("div",{children:m.fullName})})]},m.url);const b=tq(m.fullName);return f.jsxs(al,{children:[f.jsx($c,{className:ke({"-ml-3":r.length>2&&v>0}),children:f.jsx("span",{className:ke("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: "+m.fullName,children:b})}),f.jsx(ll,{children:f.jsx("div",{children:m.fullName})})]},m.fullName+m.url)}),r.length>2&&f.jsxs(al,{children:[f.jsx($c,{className:ke({"-ml-3":r.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:["+",r.length-2]})}),f.jsx(ll,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(m=>f.jsxs(g.Fragment,{children:[m.url?f.jsx("img",{src:m.url,alt:m.fullName,title:m.fullName,className:ke("w-6 h-6 rounded-full")},m.url):f.jsx("div",{}),f.jsx("div",{children:m.fullName})]},m.fullName+m.url))})]})]}),r===void 0&&f.jsx("span",{className:ke("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&f.jsx("span",{className:ke({"text-text-disabled":c}),children:n})]}),o!==void 0&&f.jsx("button",{className:"flex-shrink-0 inline-block",onClick:()=>{i&&i(!o)},children:f.jsx(Qh,{size:16,className:ke("transform",{"rotate-180":o})})})]})]}));function tq(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("")}function Ib(){const[e,t]=g.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:i}=Yh(),s=ja(),a=s!==void 0&&Object.keys(s).length>0,l=pR(),c=mR(),u=Lu(),d=Kr(),{autoPublish:h}=yS();return u==="fs"?f.jsxs(Lt,{className:"flex items-center gap-2",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?f.jsx("span",{children:"Save"}):f.jsx("span",{children:o?"Saving":"Save"}),o&&f.jsx(Uo,{className:"animate-spin",size:16})]}):f.jsx("span",{children:f.jsxs(ns,{open:e,onOpenChange:p=>{t(p)},children:[f.jsx(Fu,{asChild:!0,children:f.jsxs(Lt,{className:"flex items-center gap-2",disabled:r||a||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{t(!0)},children:[!o&&f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Ready"}),f.jsx(kS,{size:16})]}),o&&f.jsxs(f.Fragment,{children:[f.jsx("span",{children:"Pushing"}),f.jsx(Uo,{className:"animate-spin",size:16})]})]})}),f.jsxs(hi,{container:d,align:"end",className:"z-[9001] flex flex-col gap-4",children:[f.jsx(Xv,{asChild:!0,className:"self-end cursor-pointer",children:f.jsx(du,{size:12})}),f.jsx(wI,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),i.type==="not-asked")return;const p=i.text.trim();n(p)}})]})]})})}function nq(){const e=Hv(),{isPublishing:t}=Yh(),n=ja()||{},{globalErrors:r}=xS(),o=Lu(),[i,s]=g.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=ee.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return f.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[f.jsx("div",{className:"h-16 border-b border-border-primary",children:f.jsx(iq,{})}),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(Uo,{size:16,className:"animate-spin"})]}),f.jsx(oi,{children:f.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==s&&f.jsx(oh,{type:"single",collapsible:!0,children:f.jsxs(Cl,{value:"global-errors",children:[f.jsxs(_l,{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"," ",r==null?void 0:r.length," errors in all."," ",r.length-s," were non-validation errors. A developer might need to fix these issues."]}),f.jsx(Tl,{children:f.jsx(oi,{children:f.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>f.jsx(oq,{error:a},l))})})})]})}),(r==null?void 0:r.length)===s&&i.length>0&&f.jsx(oh,{type:"single",collapsible:!0,children:f.jsxs(Cl,{value:"global-errors",children:[f.jsx(_l,{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(Tl,{children:f.jsx(oi,{children:f.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:i==null?void 0:i.map((a,l)=>f.jsx(rq,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&f.jsx("div",{className:ke("",{}),children:f.jsx(oi,{children:f.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:f.jsx($I,{loadingStatus:e})})})})]})})]})}function rq({moduleFilePath:e}){const t=ee.splitModuleFilePath(e),n=Vn();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:ze("text-text-brand-secondary",{"ml-1":o>0}),children:"/"}),f.jsx("span",{children:fu(r)})]},o))})})}function oq({error:e}){const[t,n]=g.useState(!1);return f.jsx("div",{className:ze("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 iq(){const{navMenu:e,toolsMenu:t}=Fy(),n=Lu(),{setAutoPublish:r,autoPublish:o}=yS();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:()=>{t.setOpen(!t.isOpen)},children:f.jsx(kg,{size:16,className:ke("transform",{"rotate-180":!e.isOpen})})}),f.jsxs("div",{className:"flex items-center justify-end w-full gap-2",children:[n==="fs"&&f.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[f.jsx("span",{className:"truncate text-text-secondary",children:"Auto-save"}),f.jsx(zu,{checked:o,onCheckedChange:r})]}),f.jsxs(Lt,{className:"flex items-center gap-2",variant:"outline",onClick:()=>{window.location.href=Qf("/api/val/enable",{redirect_to:window.origin})},children:[f.jsx("span",{children:"Preview"}),f.jsx(wR,{size:16})]}),f.jsx(Ib,{})]})]})})}function qt({error:e,path:t}){return f.jsx("div",{id:t,children:f.jsx("div",{className:"p-4 bg-bg-error-primary text-text-error-primary",children:e})})}function gt({path:e,type:t}){return f.jsx("div",{id:e,className:ke("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:f.jsx(Uo,{size:t==="module"?24:16,className:"animate-spin"})})}function Tn({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",id:e,children:f.jsx("div",{children:"Could not get data"})}):f.jsx(gt,{path:e,type:t})}function vr({actualType:e,expectedType:t,path:n}){return f.jsx("div",{id:n,children:f.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function nt({error:e,path:t}){return f.jsx("div",{id:t,children:f.jsxs("div",{className:"p-4 rounded bg-bg-error-primary text-text-primary",children:["Source error: ",e]})})}function sq(){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 ry=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Bu(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function HS(e){return"nodeType"in e}function yr(e){var t,n;return e?Bu(e)?e:HS(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function WS(e){const{Document:t}=yr(e);return e instanceof t}function op(e){return Bu(e)?!1:e instanceof yr(e).HTMLElement}function UI(e){return e instanceof yr(e).SVGElement}function $u(e){return e?Bu(e)?e.document:HS(e)?WS(e)?e:op(e)||UI(e)?e.ownerDocument:document:document:document}const pi=ry?g.useLayoutEffect:g.useEffect;function KS(e){const t=g.useRef(e);return pi(()=>{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 aq(){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 ih(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return pi(()=>{n.current!==e&&(n.current=e)},t),n}function ip(e,t){const n=g.useRef();return g.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ng(e){const t=KS(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 Ab(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let $x={};function sp(e,t){return g.useMemo(()=>{if(t)return t;const n=$x[e]==null?0:$x[e]+1;return $x[e]=n,e+"-"+n},[e,t])}function HI(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 Vc=HI(1),sh=HI(-1);function lq(e){return"clientX"in e&&"clientY"in e}function GS(e){if(!e)return!1;const{KeyboardEvent:t}=yr(e.target);return t&&e instanceof t}function cq(e){if(!e)return!1;const{TouchEvent:t}=yr(e.target);return t&&e instanceof t}function Db(e){if(cq(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 lq(e)?{x:e.clientX,y:e.clientY}:null}const ah=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[ah.Translate.toString(e),ah.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),C_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function uq(e){return e.matches(C_)?e:e.querySelector(C_)}const dq={display:"none"};function fq(e){let{id:t,value:n}=e;return Se.createElement("div",{id:t,style:dq},n)}function hq(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 Se.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function pq(){const[e,t]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const WI=g.createContext(null);function mq(e){const t=g.useContext(WI);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function gq(){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 vq={draggable:`
|
|
426
|
+
To pick up a draggable item, press the space bar.
|
|
427
|
+
While dragging, use the arrow keys to move the item.
|
|
428
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
429
|
+
`},yq={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 xq(e){let{announcements:t=yq,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=vq}=e;const{announce:i,announcement:s}=pq(),a=sp("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),mq(g.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;i(t.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;i(t.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!l)return null;const u=Se.createElement(Se.Fragment,null,Se.createElement(fq,{id:r,value:o.draggable}),Se.createElement(hq,{id:a,announcement:s}));return n?Mr.createPortal(u,n):u}var en;(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"})(en||(en={}));function Og(){}function Vx(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function bq(){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 Ho=Object.freeze({x:0,y:0});function KI(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function GI(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function wq(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function __(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 qI(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function T_(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 Sq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=T_(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=KI(T_(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(GI)},kq=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=__(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=__(l),u=o.reduce((h,p,m)=>h+KI(c[m],p),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(GI)};function Eq(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 Cq=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=Eq(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(wq)};function _q(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function YI(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ho}function Tq(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 Pq=Tq(1);function Nq(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 Oq(e,t,n){const r=Nq(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 Mq={ignoreTransform:!1};function Vu(e,t){t===void 0&&(t=Mq);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=yr(e).getComputedStyle(e);c&&(n=Oq(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 P_(e){return Vu(e,{ignoreTransform:!0})}function jq(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Rq(e,t){return t===void 0&&(t=yr(e).getComputedStyle(e)),t.position==="fixed"}function Iq(e,t){t===void 0&&(t=yr(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 oy(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(WS(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!op(o)||UI(o)||n.includes(o))return n;const i=yr(e).getComputedStyle(o);return o!==e&&Iq(o,i)&&n.push(o),Rq(o,i)?n:r(o.parentNode)}return e?r(e):n}function JI(e){const[t]=oy(e,1);return t??null}function Ux(e){return!ry||!e?null:Bu(e)?e:HS(e)?WS(e)||e===$u(e).scrollingElement?window:op(e)?e:null:null}function XI(e){return Bu(e)?e.scrollX:e.scrollLeft}function ZI(e){return Bu(e)?e.scrollY:e.scrollTop}function Lb(e){return{x:XI(e),y:ZI(e)}}var dn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(dn||(dn={}));function QI(e){return!ry||!e?!1:e===document.scrollingElement}function eA(e){const t={x:0,y:0},n=QI(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 Aq={x:.2,y:.2};function Dq(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Aq);const{isTop:c,isBottom:u,isLeft:d,isRight:h}=eA(e),p={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?(p.y=dn.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(p.y=dn.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(p.x=dn.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(p.x=dn.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:p,speed:m}}function Lq(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 tA(e){return e.reduce((t,n)=>Vc(t,Lb(n)),Ho)}function Fq(e){return e.reduce((t,n)=>t+XI(n),0)}function zq(e){return e.reduce((t,n)=>t+ZI(n),0)}function Bq(e,t){if(t===void 0&&(t=Vu),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);JI(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const $q=[["x",["left","right"],Fq],["y",["top","bottom"],zq]];class qS{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=oy(n),o=tA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of $q)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 uf{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 Vq(e){const{EventTarget:t}=yr(e);return e instanceof t?e:$u(e)}function Hx(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 Jr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Jr||(Jr={}));function N_(e){e.preventDefault()}function Uq(e){e.stopPropagation()}var Xe;(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"})(Xe||(Xe={}));const nA={start:[Xe.Space,Xe.Enter],cancel:[Xe.Esc],end:[Xe.Space,Xe.Enter,Xe.Tab]},Hq=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xe.Right:return{...n,x:n.x+25};case Xe.Left:return{...n,x:n.x-25};case Xe.Down:return{...n,y:n.y+25};case Xe.Up:return{...n,y:n.y-25}}};class YS{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 uf($u(n)),this.windowListeners=new uf(yr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Jr.Resize,this.handleCancel),this.windowListeners.add(Jr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Jr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Bq(r),n(Ho)}handleKeyDown(t){if(GS(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=nA,coordinateGetter:s=Hq,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}:Ho;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const h=sh(d,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const b=t.code,{isTop:x,isRight:w,isLeft:S,isBottom:C,maxScroll:_,minScroll:P}=eA(v),O=Lq(v),j={x:Math.min(b===Xe.Right?O.right-O.width/2:O.right,Math.max(b===Xe.Right?O.left:O.left+O.width/2,d.x)),y:Math.min(b===Xe.Down?O.bottom-O.height/2:O.bottom,Math.max(b===Xe.Down?O.top:O.top+O.height/2,d.y))},I=b===Xe.Right&&!w||b===Xe.Left&&!S,F=b===Xe.Down&&!C||b===Xe.Up&&!x;if(I&&j.x!==d.x){const H=v.scrollLeft+h.x,$=b===Xe.Right&&H<=_.x||b===Xe.Left&&H>=P.x;if($&&!h.y){v.scrollTo({left:H,behavior:a});return}$?p.x=v.scrollLeft-H:p.x=b===Xe.Right?v.scrollLeft-_.x:v.scrollLeft-P.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(F&&j.y!==d.y){const H=v.scrollTop+h.y,$=b===Xe.Down&&H<=_.y||b===Xe.Up&&H>=P.y;if($&&!h.x){v.scrollTo({top:H,behavior:a});return}$?p.y=v.scrollTop-H:p.y=b===Xe.Down?v.scrollTop-_.y:v.scrollTop-P.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,Vc(sh(d,this.referenceCoordinates),p))}}}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()}}YS.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=nA,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 O_(e){return!!(e&&"distance"in e)}function M_(e){return!!(e&&"delay"in e)}class JS{constructor(t,n,r){var o;r===void 0&&(r=Vq(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=$u(s),this.documentListeners=new uf(this.document),this.listeners=new uf(r),this.windowListeners=new uf(yr(s)),this.initialCoordinates=(o=Db(i))!=null?o:Ho,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(Jr.Resize,this.handleCancel),this.windowListeners.add(Jr.DragStart,N_),this.windowListeners.add(Jr.VisibilityChange,this.handleCancel),this.windowListeners.add(Jr.ContextMenu,N_),this.documentListeners.add(Jr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(M_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(O_(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(Jr.Click,Uq,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Jr.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=Db(t))!=null?n:Ho,c=sh(o,l);if(!r&&a){if(O_(a)){if(a.tolerance!=null&&Hx(c,a.tolerance))return this.handleCancel();if(Hx(c,a.distance))return this.handleStart()}if(M_(a)&&Hx(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===Xe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Wq={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rA extends JS{constructor(t){const{event:n}=t,r=$u(n.target);super(t,Wq,r)}}rA.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 Kq={move:{name:"mousemove"},end:{name:"mouseup"}};var Fb;(function(e){e[e.RightClick=2]="RightClick"})(Fb||(Fb={}));class oA extends JS{constructor(t){super(t,Kq,$u(t.event.target))}}oA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Fb.RightClick?!1:(r==null||r({event:n}),!0)}}];const Wx={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class iA extends JS{constructor(t){super(t,Wx)}static setup(){return window.addEventListener(Wx.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Wx.move.name,t)};function t(){}}}iA.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 df;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(df||(df={}));var Mg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Mg||(Mg={}));function Gq(e){let{acceleration:t,activator:n=df.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Mg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:h}=e;const p=Yq({delta:d,disabled:!i}),[m,v]=aq(),b=g.useRef({x:0,y:0}),x=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case df.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case df.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),C=g.useCallback(()=>{const P=S.current;if(!P)return;const O=b.current.x*x.current.x,j=b.current.y*x.current.y;P.scrollBy(O,j)},[]),_=g.useMemo(()=>a===Mg.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const P of _){if((r==null?void 0:r(P))===!1)continue;const O=c.indexOf(P),j=u[O];if(!j)continue;const{direction:I,speed:F}=Dq(P,j,w,t,h);for(const H of["x","y"])p[H][I[H]]||(F[H]=0,I[H]=0);if(F.x>0||F.y>0){v(),S.current=P,m(C,s),b.current=F,x.current=I;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(p),m,c,_,u,JSON.stringify(h)])}const qq={x:{[dn.Backward]:!1,[dn.Forward]:!1},y:{[dn.Backward]:!1,[dn.Forward]:!1}};function Yq(e){let{delta:t,disabled:n}=e;const r=Ab(t);return ip(o=>{if(n||!r||!o)return qq;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[dn.Backward]:o.x[dn.Backward]||i.x===-1,[dn.Forward]:o.x[dn.Forward]||i.x===1},y:{[dn.Backward]:o.y[dn.Backward]||i.y===-1,[dn.Forward]:o.y[dn.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 ip(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Xq(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 lh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(lh||(lh={}));var zb;(function(e){e.Optimized="optimized"})(zb||(zb={}));const j_=new Map;function Zq(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(),h=ih(d),p=g.useCallback(function(x){x===void 0&&(x=[]),!h.current&&s(w=>w===null?x:w.concat(x.filter(S=>!w.includes(S))))},[h]),m=g.useRef(null),v=ip(x=>{if(d&&!n)return j_;if(!x||x===j_||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const C=S.node.current,_=C?new qS(l(C),C):null;S.rect.current=_,_&&w.set(S.id,_)}return w}return x},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||p()},[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(()=>{p(),m.current=null},a))},[a,d,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case lh.Always:return!1;case lh.BeforeDragging:return n;default:return!n}}}function sA(e,t){return ip(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Qq(e,t){return sA(e,t)}function eY(e){let{callback:t,disabled:n}=e;const r=KS(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 iy(e){let{callback:t,disabled:n}=e;const r=KS(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 tY(e){return new qS(Vu(e),e)}function R_(e,t,n){t===void 0&&(t=tY);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=eY({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=iy({callback:i});return pi(()=>{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 nY(e){const t=sA(e);return YI(e,t)}const I_=[];function rY(e){const t=g.useRef(e),n=ip(r=>e?r&&r!==I_&&e&&t.current&&e.parentNode===t.current.parentNode?r:oy(e):I_,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function oY(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=Ux(i.target);s&&n(a=>a?(a.set(s,Lb(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=Ux(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,Lb(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=Ux(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Vc(i,s),Ho):tA(e):Ho,[e,t])}function A_(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==Ho;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?sh(e,n.current):Ho}function iY(e){g.useEffect(()=>{if(!ry)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 sY(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 aA(e){return g.useMemo(()=>e?jq(e):null,[e])}const D_=[];function aY(e,t){t===void 0&&(t=Vu);const[n]=e,r=aA(n?yr(n):null),[o,i]=g.useState(D_);function s(){i(()=>e.length?e.map(l=>QI(l)?r:new qS(t(l),l)):D_)}const a=iy({callback:s});return pi(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function lY(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return op(t)?t:e}function cY(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(op(u)){r(d=>{const h=t(u);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=iy({callback:o}),s=g.useCallback(c=>{const u=lY(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=Ng(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const uY=[{sensor:rA,options:{}},{sensor:YS,options:{}}],dY={current:{}},bm={draggable:{measure:P_},droppable:{measure:P_,strategy:lh.WhileDragging,frequency:zb.Optimized},dragOverlay:{measure:Vu}};class ff 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 fY={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ff,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Og},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bm,measureDroppableContainers:Og,windowRect:null,measuringScheduled:!1},hY={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Og,draggableNodes:new Map,over:null,measureDroppableContainers:Og},sy=g.createContext(hY),lA=g.createContext(fY);function pY(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ff}}}function mY(e,t){switch(t.type){case en.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.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 en.DragEnd:case en.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new ff(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case en.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 ff(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case en.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new ff(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function gY(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(sy),i=Ab(r),s=Ab(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!GS(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=uq(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function vY(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function yY(e){return g.useMemo(()=>({draggable:{...bm.draggable,...e==null?void 0:e.draggable},droppable:{...bm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bm.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 xY(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;pi(()=>{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=YI(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 h=JI(c);h&&h.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const cA=g.createContext({...Ho,scaleX:1,scaleY:1});var Rs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Rs||(Rs={}));const bY=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=uY,collisionDetection:d=Cq,measuring:h,modifiers:p,...m}=t;const v=g.useReducer(mY,void 0,pY),[b,x]=v,[w,S]=gq(),[C,_]=g.useState(Rs.Uninitialized),P=C===Rs.Initialized,{draggable:{active:O,nodes:j,translate:I},droppable:{containers:F}}=b,H=O!=null?j.get(O):null,$=g.useRef({initial:null,translated:null}),J=g.useMemo(()=>{var Mn;return O!=null?{id:O,data:(Mn=H==null?void 0:H.data)!=null?Mn:dY,rect:$}:null},[O,H]),W=g.useRef(null),[B,A]=g.useState(null),[R,N]=g.useState(null),D=ih(m,Object.values(m)),z=sp("DndDescribedBy",s),V=g.useMemo(()=>F.getEnabled(),[F]),G=yY(h),{droppableRects:Re,measureDroppableContainers:Y,measuringScheduled:he}=Zq(V,{dragging:P,dependencies:[I.x,I.y],config:G.droppable}),ie=Jq(j,O),ne=g.useMemo(()=>R?Db(R):null,[R]),Oe=$3(),Ae=Qq(ie,G.draggable.measure);xY({activeNode:O!=null?j.get(O):null,config:Oe.layoutShiftCompensation,initialRect:Ae,measure:G.draggable.measure});const pe=R_(ie,G.draggable.measure,Ae),De=R_(ie?ie.parentElement:null),Pe=g.useRef({activatorEvent:null,active:null,activeNode:ie,collisionRect:null,collisions:null,droppableRects:Re,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ze=F.getNodeFor((n=Pe.current.over)==null?void 0:n.id),pt=cY({measure:G.dragOverlay.measure}),Ht=(r=pt.nodeRef.current)!=null?r:ie,T=P?(o=pt.rect)!=null?o:pe:null,k=!!(pt.nodeRef.current&&pt.rect),E=nY(k?null:pe),M=aA(Ht?yr(Ht):null),L=rY(P?Ze??ie:null),q=aY(L),Z=vY(p,{transform:{x:I.x-E.x,y:I.y-E.y,scaleX:1,scaleY:1},activatorEvent:R,active:J,activeNodeRect:pe,containerNodeRect:De,draggingNodeRect:T,over:Pe.current.over,overlayNodeRect:pt.rect,scrollableAncestors:L,scrollableAncestorRects:q,windowRect:M}),Ye=ne?Vc(ne,I):null,it=oY(L),vt=A_(it),ln=A_(it,[pe]),lt=Vc(Z,vt),go=T?Pq(T,Z):null,ds=J&&go?d({active:J,collisionRect:go,droppableRects:Re,droppableContainers:V,pointerCoordinates:Ye}):null,Ju=qI(ds,"id"),[fs,aE]=g.useState(null),D3=k?Z:Vc(Z,ln),L3=_q(D3,(i=fs==null?void 0:fs.rect)!=null?i:null,pe),zy=g.useRef(null),lE=g.useCallback((Mn,br)=>{let{sensor:wr,options:hs}=br;if(W.current==null)return;const qr=j.get(W.current);if(!qr)return;const Sr=Mn.nativeEvent,Yo=new wr({active:W.current,activeNode:qr,event:Sr,options:hs,context:Pe,onAbort(yn){if(!j.get(yn))return;const{onDragAbort:Jo}=D.current,Si={id:yn};Jo==null||Jo(Si),w({type:"onDragAbort",event:Si})},onPending(yn,ps,Jo,Si){if(!j.get(yn))return;const{onDragPending:Zu}=D.current,ms={id:yn,constraint:ps,initialCoordinates:Jo,offset:Si};Zu==null||Zu(ms),w({type:"onDragPending",event:ms})},onStart(yn){const ps=W.current;if(ps==null)return;const Jo=j.get(ps);if(!Jo)return;const{onDragStart:Si}=D.current,Xu={activatorEvent:Sr,active:{id:ps,data:Jo.data,rect:$}};Mr.unstable_batchedUpdates(()=>{Si==null||Si(Xu),_(Rs.Initializing),x({type:en.DragStart,initialCoordinates:yn,active:ps}),w({type:"onDragStart",event:Xu}),A(zy.current),N(Sr)})},onMove(yn){x({type:en.DragMove,coordinates:yn})},onEnd:Gl(en.DragEnd),onCancel:Gl(en.DragCancel)});zy.current=Yo;function Gl(yn){return async function(){const{active:Jo,collisions:Si,over:Xu,scrollAdjustedTranslate:Zu}=Pe.current;let ms=null;if(Jo&&Zu){const{cancelDrop:Qu}=D.current;ms={activatorEvent:Sr,active:Jo,collisions:Si,delta:Zu,over:Xu},yn===en.DragEnd&&typeof Qu=="function"&&await Promise.resolve(Qu(ms))&&(yn=en.DragCancel)}W.current=null,Mr.unstable_batchedUpdates(()=>{x({type:yn}),_(Rs.Uninitialized),aE(null),A(null),N(null),zy.current=null;const Qu=yn===en.DragEnd?"onDragEnd":"onDragCancel";if(ms){const By=D.current[Qu];By==null||By(ms),w({type:Qu,event:ms})}})}}},[j]),F3=g.useCallback((Mn,br)=>(wr,hs)=>{const qr=wr.nativeEvent,Sr=j.get(hs);if(W.current!==null||!Sr||qr.dndKit||qr.defaultPrevented)return;const Yo={active:Sr};Mn(wr,br.options,Yo)===!0&&(qr.dndKit={capturedBy:br.sensor},W.current=hs,lE(wr,br))},[j,lE]),cE=Xq(u,F3);iY(u),pi(()=>{pe&&C===Rs.Initializing&&_(Rs.Initialized)},[pe,C]),g.useEffect(()=>{const{onDragMove:Mn}=D.current,{active:br,activatorEvent:wr,collisions:hs,over:qr}=Pe.current;if(!br||!wr)return;const Sr={active:br,activatorEvent:wr,collisions:hs,delta:{x:lt.x,y:lt.y},over:qr};Mr.unstable_batchedUpdates(()=>{Mn==null||Mn(Sr),w({type:"onDragMove",event:Sr})})},[lt.x,lt.y]),g.useEffect(()=>{const{active:Mn,activatorEvent:br,collisions:wr,droppableContainers:hs,scrollAdjustedTranslate:qr}=Pe.current;if(!Mn||W.current==null||!br||!qr)return;const{onDragOver:Sr}=D.current,Yo=hs.get(Ju),Gl=Yo&&Yo.rect.current?{id:Yo.id,rect:Yo.rect.current,data:Yo.data,disabled:Yo.disabled}:null,yn={active:Mn,activatorEvent:br,collisions:wr,delta:{x:qr.x,y:qr.y},over:Gl};Mr.unstable_batchedUpdates(()=>{aE(Gl),Sr==null||Sr(yn),w({type:"onDragOver",event:yn})})},[Ju]),pi(()=>{Pe.current={activatorEvent:R,active:J,activeNode:ie,collisionRect:go,collisions:ds,droppableRects:Re,draggableNodes:j,draggingNode:Ht,draggingNodeRect:T,droppableContainers:F,over:fs,scrollableAncestors:L,scrollAdjustedTranslate:lt},$.current={initial:T,translated:go}},[J,ie,ds,go,j,Ht,T,Re,F,fs,L,lt]),Gq({...Oe,delta:I,draggingRect:go,pointerCoordinates:Ye,scrollableAncestors:L,scrollableAncestorRects:q});const z3=g.useMemo(()=>({active:J,activeNode:ie,activeNodeRect:pe,activatorEvent:R,collisions:ds,containerNodeRect:De,dragOverlay:pt,draggableNodes:j,droppableContainers:F,droppableRects:Re,over:fs,measureDroppableContainers:Y,scrollableAncestors:L,scrollableAncestorRects:q,measuringConfiguration:G,measuringScheduled:he,windowRect:M}),[J,ie,pe,R,ds,De,pt,j,F,Re,fs,Y,L,q,G,he,M]),B3=g.useMemo(()=>({activatorEvent:R,activators:cE,active:J,activeNodeRect:pe,ariaDescribedById:{draggable:z},dispatch:x,draggableNodes:j,over:fs,measureDroppableContainers:Y}),[R,cE,J,pe,x,z,j,fs,Y]);return Se.createElement(WI.Provider,{value:S},Se.createElement(sy.Provider,{value:B3},Se.createElement(lA.Provider,{value:z3},Se.createElement(cA.Provider,{value:L3},c)),Se.createElement(gY,{disabled:(a==null?void 0:a.restoreFocus)===!1})),Se.createElement(xq,{...a,hiddenTextDescribedById:z}));function $3(){const Mn=(B==null?void 0:B.autoScrollEnabled)===!1,br=typeof l=="object"?l.enabled===!1:l===!1,wr=P&&!Mn&&!br;return typeof l=="object"?{...l,enabled:wr}:{enabled:wr}}}),wY=g.createContext(null),L_="button",SY="Draggable";function kY(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=sp(SY),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:h}=g.useContext(sy),{role:p=L_,roleDescription:m="draggable",tabIndex:v=0}=o??{},b=(l==null?void 0:l.id)===t,x=g.useContext(b?cA:wY),[w,S]=Ng(),[C,_]=Ng(),P=sY(s,t),O=ih(n);pi(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:C,data:O}),()=>{const I=d.get(t);I&&I.key===i&&d.delete(t)}),[d,t]);const j=g.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&p===L_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,v,b,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:j,isDragging:b,listeners:r?void 0:P,node:w,over:h,setNodeRef:S,setActivatorNodeRef:_,transform:x}}function EY(){return g.useContext(lA)}const CY="Droppable",_Y={timeout:25};function TY(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=sp(CY),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(sy),u=g.useRef({disabled:n}),d=g.useRef(!1),h=g.useRef(null),p=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:b}={..._Y,...o},x=ih(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),p.current=null},b)},[b]),S=iy({callback:w,disabled:m||!s}),C=g.useCallback((j,I)=>{S&&(I&&(S.unobserve(I),d.current=!1),j&&S.observe(j))},[S]),[_,P]=Ng(C),O=ih(t);return g.useEffect(()=>{!S||!_.current||(S.disconnect(),d.current=!1,S.observe(_.current))},[_,S]),g.useEffect(()=>(a({type:en.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:h,data:O}}),()=>a({type:en.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:en.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:h,isOver:(l==null?void 0:l.id)===r,node:_,over:l,setNodeRef:P}}function XS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function PY(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Jp(e){return e!==null&&e>=0}function NY(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 OY(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const uA=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=XS(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}},Xp={scaleX:1,scaleY:1},MY=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,...Xp}:null}const l=jY(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Xp}:o<n&&o>=s?{x:0,y:a.height+l,...Xp}:{x:0,y:0,...Xp}};function jY(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 dA="Sortable",fA=Se.createContext({activeIndex:-1,containerId:dA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:uA,disabled:{draggable:!1,droppable:!1}});function RY(e){let{children:t,id:n,items:r,strategy:o=uA,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=EY(),d=sp(dA,n),h=a.rect!==null,p=g.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),m=s!=null,v=s?p.indexOf(s.id):-1,b=c?p.indexOf(c.id):-1,x=g.useRef(p),w=!NY(p,x.current),S=b!==-1&&v===-1||w,C=OY(i);pi(()=>{w&&m&&u(p)},[w,p,m,u]),g.useEffect(()=>{x.current=p},[p]);const _=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:C,disableTransforms:S,items:p,overIndex:b,useDragOverlay:h,sortedRects:PY(p,l),strategy:o}),[v,d,C.draggable,C.droppable,S,p,b,l,h,o]);return Se.createElement(fA.Provider,{value:_},t)}const IY=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return XS(n,r,o).indexOf(t)},AY=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},DY={duration:200,easing:"ease"},hA="transform",LY=ah.Transition.toString({property:hA,duration:0,easing:"linear"}),FY={roleDescription:"sortable"};function zY(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return pi(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=Vu(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 BY(e){let{animateLayoutChanges:t=AY,attributes:n,disabled:r,data:o,getNewIndex:i=IY,id:s,strategy:a,resizeObserverConfig:l,transition:c=DY}=e;const{items:u,containerId:d,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:v,overIndex:b,useDragOverlay:x,strategy:w}=g.useContext(fA),S=$Y(r,p),C=u.indexOf(s),_=g.useMemo(()=>({sortable:{containerId:d,index:C,items:u},...o}),[d,o,C,u]),P=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:O,node:j,isOver:I,setNodeRef:F}=TY({id:s,data:_,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:H,activatorEvent:$,activeNodeRect:J,attributes:W,setNodeRef:B,listeners:A,isDragging:R,over:N,setActivatorNodeRef:D,transform:z}=kY({id:s,data:_,attributes:{...FY,...n},disabled:S.draggable}),V=sq(F,B),G=!!H,Re=G&&!m&&Jp(h)&&Jp(b),Y=!x&&R,he=Y&&Re?z:null,ne=Re?he??(a??w)({rects:v,activeNodeRect:J,activeIndex:h,overIndex:b,index:C}):null,Oe=Jp(h)&&Jp(b)?i({id:s,items:u,activeIndex:h,overIndex:b}):C,Ae=H==null?void 0:H.id,pe=g.useRef({activeId:Ae,items:u,newIndex:Oe,containerId:d}),De=u!==pe.current.items,Pe=t({active:H,containerId:d,isDragging:R,isSorting:G,id:s,index:C,items:u,newIndex:pe.current.newIndex,previousItems:pe.current.items,previousContainerId:pe.current.containerId,transition:c,wasDragging:pe.current.activeId!=null}),Ze=zY({disabled:!Pe,index:C,node:j,rect:O});return g.useEffect(()=>{G&&pe.current.newIndex!==Oe&&(pe.current.newIndex=Oe),d!==pe.current.containerId&&(pe.current.containerId=d),u!==pe.current.items&&(pe.current.items=u)},[G,Oe,d,u]),g.useEffect(()=>{if(Ae===pe.current.activeId)return;if(Ae&&!pe.current.activeId){pe.current.activeId=Ae;return}const Ht=setTimeout(()=>{pe.current.activeId=Ae},50);return()=>clearTimeout(Ht)},[Ae]),{active:H,activeIndex:h,attributes:W,data:_,rect:O,index:C,newIndex:Oe,items:u,isOver:I,isSorting:G,isDragging:R,listeners:A,node:j,overIndex:b,over:N,setNodeRef:V,setActivatorNodeRef:D,setDroppableNodeRef:F,setDraggableNodeRef:B,transform:Ze??ne,transition:pt()};function pt(){if(Ze||De&&pe.current.newIndex===C)return LY;if(!(Y&&!GS($)||!c)&&(G||Pe))return ah.Transition.toString({...c,property:hA})}}function $Y(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 jg(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 VY=[Xe.Down,Xe.Right,Xe.Up,Xe.Left],UY=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(VY.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case Xe.Down:r.top<h.top&&l.push(d);break;case Xe.Up:r.top>h.top&&l.push(d);break;case Xe.Left:r.left>h.left&&l.push(d);break;case Xe.Right:r.left<h.left&&l.push(d);break}});const c=kq({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=qI(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),h=i.get(u),p=h?o.get(h.id):null,m=h==null?void 0:h.node.current;if(m&&p&&d&&h){const b=oy(m).some((P,O)=>a[O]!==P),x=pA(d,h),w=HY(d,h),S=b||!x?{x:0,y:0}:{x:w?r.width-p.width:0,y:w?r.height-p.height:0},C={x:p.left,y:p.top};return S.x&&S.y?C:sh(C,S)}}}};function pA(e,t){return!jg(e)||!jg(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function HY(e,t){return!jg(e)||!jg(t)||!pA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Uu=g.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:ze("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}));Uu.displayName="Input";function zr({path:e}){const t=ja()||{},n=Vn(),r=[];for(const o in t)o.startsWith(e)&&r.push(...t[o].map(i=>({...i,path:o})));if(r.length===0)return null;if(r.length===1){const o=r[0];return f.jsxs("div",{className:"p-4 font-normal rounded bg-bg-error-primary text-text-primary",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})]})]})}return f.jsx(VS,{type:"single",collapsible:!0,children:f.jsxs(Cl,{value:"validation-errors",className:"font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx(_l,{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(Tl,{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 mA({path:e,autoFocus:t}){const n="string",r=It(e),o=SS(e),{patchPath:i,addPatch:s}=On(e),[a,l]=g.useState(null),c="data"in o&&o.data,u="clientSideOnly"in o&&o.clientSideOnly;return g.useEffect(()=>{u===!1&&l(typeof c=="string"?c:null)},[c,u]),r.status==="error"?f.jsx(qt,{path:e,error:r.error,type:n}):o.status==="error"?f.jsx(nt,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?f.jsx(Tn,{path:e,type:n}):r.status==="loading"?f.jsx(gt,{path:e,type:n}):!("data"in o)||o.data===void 0?f.jsx(gt,{path:e,type:n}):r.data.type!==n?f.jsx(vr,{path:e,expectedType:n,actualType:r.data.type}):f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsxs("div",{className:"relative w-full",children:[f.jsx(Uu,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,value:a||"",onChange:d=>{l(d.target.value),s([{op:"replace",path:i,value:d.target.value}],n)}}),f.jsx("span",{className:ke("absolute right-0 -translate-x-full top-4 duration-1000",{"opacity-0":o.data===a,"opacity-100":o.data!==a}),children:f.jsx(Uo,{className:"transition-opacity animate-spin",size:12})})]})]})}function WY({path:e}){const t=st(e,"string");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function KY({path:e}){const t="boolean",n=It(e),r=st(e,t),{patchPath:o,addPatch:i}=On(e);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx(zu,{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}],n.data.type)}})]})}function GY({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=On(e);return typeof t!="boolean"&&t!==null?f.jsx(nt,{path:e,error:"Expected boolean",type:"boolean"}):f.jsx(zu,{id:e,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}],"boolean")}})}function qY({path:e}){const t=st(e,"boolean");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{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(Zh,{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 YY({path:e}){const t="number",n=It(e),r=st(e,t),{patchPath:o,addPatch:i}=On(e);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx(Uu,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}],t)}})]})}function JY({path:e}){const t=st(e,"number");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}var XY=[" ","Enter","ArrowUp","ArrowDown"],ZY=[" ","Enter"],ap="Select",[ay,ly,QY]=Qv(ap),[Hu,Eme]=uo(ap,[QY,bi]),cy=bi(),[eJ,Ia]=Hu(ap),[tJ,nJ]=Hu(ap),gA=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:h,required:p,form:m}=e,v=cy(t),[b,x]=g.useState(null),[w,S]=g.useState(null),[C,_]=g.useState(!1),P=ep(c),[O=!1,j]=Fr({prop:r,defaultProp:o,onChange:i}),[I,F]=Fr({prop:s,defaultProp:a,onChange:l}),H=g.useRef(null),$=b?m||!!b.closest("form"):!0,[J,W]=g.useState(new Set),B=Array.from(J).map(A=>A.props.value).join(";");return f.jsx(Hh,{...v,children:f.jsxs(eJ,{required:p,scope:t,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:_,contentId:Ir(),value:I,onValueChange:F,open:O,onOpenChange:j,dir:P,triggerPointerDownPosRef:H,disabled:h,children:[f.jsx(ay.Provider,{scope:t,children:f.jsx(tJ,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(A=>{W(R=>new Set(R).add(A))},[]),onNativeOptionRemove:g.useCallback(A=>{W(R=>{const N=new Set(R);return N.delete(A),N})},[]),children:n})}),$?f.jsxs(zA,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:I,onChange:A=>F(A.target.value),disabled:h,form:m,children:[I===void 0?f.jsx("option",{value:""}):null,Array.from(J)]},B):null]})})};gA.displayName=ap;var vA="SelectTrigger",yA=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=cy(n),s=Ia(vA,n),a=s.disabled||r,l=Be(t,s.onTriggerChange),c=ly(n),u=g.useRef("touch"),[d,h,p]=BA(v=>{const b=c().filter(S=>!S.disabled),x=b.find(S=>S.value===s.value),w=$A(b,v,x);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),p()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return f.jsx(Ru,{asChild:!0,...i,children:f.jsx(_e.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":FA(s.value)?"":void 0,...o,ref:l,onClick:te(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:te(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:te(o.onKeyDown,v=>{const b=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(b&&v.key===" ")&&XY.includes(v.key)&&(m(),v.preventDefault())})})})});yA.displayName=vA;var xA="SelectValue",bA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Ia(xA,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Be(t,l.onValueNodeChange);return _n(()=>{c(u)},[c,u]),f.jsx(_e.span,{...a,ref:d,style:{pointerEvents:"none"},children:FA(l.value)?f.jsx(f.Fragment,{children:s}):i})});bA.displayName=xA;var rJ="SelectIcon",wA=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(_e.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});wA.displayName=rJ;var oJ="SelectPortal",SA=e=>f.jsx(Iu,{asChild:!0,...e});SA.displayName=oJ;var Pl="SelectContent",kA=g.forwardRef((e,t)=>{const n=Ia(Pl,e.__scopeSelect),[r,o]=g.useState();if(_n(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Mr.createPortal(f.jsx(EA,{scope:e.__scopeSelect,children:f.jsx(ay.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),i):null}return f.jsx(CA,{...e,ref:t})});kA.displayName=Pl;var So=10,[EA,Aa]=Hu(Pl),iJ="SelectContentImpl",CA=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:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:b,...x}=e,w=Ia(Pl,n),[S,C]=g.useState(null),[_,P]=g.useState(null),O=Be(t,ne=>C(ne)),[j,I]=g.useState(null),[F,H]=g.useState(null),$=ly(n),[J,W]=g.useState(!1),B=g.useRef(!1);g.useEffect(()=>{if(S)return Yv(S)},[S]),qv();const A=g.useCallback(ne=>{const[Oe,...Ae]=$().map(Pe=>Pe.ref.current),[pe]=Ae.slice(-1),De=document.activeElement;for(const Pe of ne)if(Pe===De||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===Oe&&_&&(_.scrollTop=0),Pe===pe&&_&&(_.scrollTop=_.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==De))return},[$,_]),R=g.useCallback(()=>A([j,S]),[A,j,S]);g.useEffect(()=>{J&&R()},[J,R]);const{onOpenChange:N,triggerPointerDownPosRef:D}=w;g.useEffect(()=>{if(S){let ne={x:0,y:0};const Oe=pe=>{var De,Pe;ne={x:Math.abs(Math.round(pe.pageX)-(((De=D.current)==null?void 0:De.x)??0)),y:Math.abs(Math.round(pe.pageY)-(((Pe=D.current)==null?void 0:Pe.y)??0))}},Ae=pe=>{ne.x<=10&&ne.y<=10?pe.preventDefault():S.contains(pe.target)||N(!1),document.removeEventListener("pointermove",Oe),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",Oe),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Oe),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[S,N,D]),g.useEffect(()=>{const ne=()=>N(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[N]);const[z,V]=BA(ne=>{const Oe=$().filter(De=>!De.disabled),Ae=Oe.find(De=>De.ref.current===document.activeElement),pe=$A(Oe,ne,Ae);pe&&setTimeout(()=>pe.ref.current.focus())}),G=g.useCallback((ne,Oe,Ae)=>{const pe=!B.current&&!Ae;(w.value!==void 0&&w.value===Oe||pe)&&(I(ne),pe&&(B.current=!0))},[w.value]),Re=g.useCallback(()=>S==null?void 0:S.focus(),[S]),Y=g.useCallback((ne,Oe,Ae)=>{const pe=!B.current&&!Ae;(w.value!==void 0&&w.value===Oe||pe)&&H(ne)},[w.value]),he=r==="popper"?Bb:_A,ie=he===Bb?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:v,avoidCollisions:b}:{};return f.jsx(EA,{scope:n,content:S,viewport:_,onViewportChange:P,itemRefCallback:G,selectedItem:j,onItemLeave:Re,itemTextRefCallback:Y,focusSelectedItem:R,selectedItemText:F,position:r,isPositioned:J,searchRef:z,children:f.jsx(np,{as:Qi,allowPinchZoom:!0,children:f.jsx(tp,{asChild:!0,trapped:w.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:te(o,ne=>{var Oe;(Oe=w.trigger)==null||Oe.focus({preventScroll:!0}),ne.preventDefault()}),children:f.jsx($l,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(he,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:ne=>ne.preventDefault(),...x,...ie,onPlaced:()=>W(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:te(x.onKeyDown,ne=>{const Oe=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!Oe&&ne.key.length===1&&V(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let pe=$().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){const De=ne.target,Pe=pe.indexOf(De);pe=pe.slice(Pe+1)}setTimeout(()=>A(pe)),ne.preventDefault()}})})})})})})});CA.displayName=iJ;var sJ="SelectItemAlignedPosition",_A=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Ia(Pl,n),s=Aa(Pl,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=Be(t,O=>u(O)),h=ly(n),p=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:x,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&b&&x){const O=i.trigger.getBoundingClientRect(),j=c.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),F=x.getBoundingClientRect();if(i.dir!=="rtl"){const De=F.left-j.left,Pe=I.left-De,Ze=O.left-Pe,pt=O.width+Ze,Ht=Math.max(pt,j.width),T=window.innerWidth-So,k=Nb(Pe,[So,Math.max(So,T-Ht)]);a.style.minWidth=pt+"px",a.style.left=k+"px"}else{const De=j.right-F.right,Pe=window.innerWidth-I.right-De,Ze=window.innerWidth-O.right-Pe,pt=O.width+Ze,Ht=Math.max(pt,j.width),T=window.innerWidth-So,k=Nb(Pe,[So,Math.max(So,T-Ht)]);a.style.minWidth=pt+"px",a.style.right=k+"px"}const H=h(),$=window.innerHeight-So*2,J=v.scrollHeight,W=window.getComputedStyle(c),B=parseInt(W.borderTopWidth,10),A=parseInt(W.paddingTop,10),R=parseInt(W.borderBottomWidth,10),N=parseInt(W.paddingBottom,10),D=B+A+J+N+R,z=Math.min(b.offsetHeight*5,D),V=window.getComputedStyle(v),G=parseInt(V.paddingTop,10),Re=parseInt(V.paddingBottom,10),Y=O.top+O.height/2-So,he=$-Y,ie=b.offsetHeight/2,ne=b.offsetTop+ie,Oe=B+A+ne,Ae=D-Oe;if(Oe<=Y){const De=H.length>0&&b===H[H.length-1].ref.current;a.style.bottom="0px";const Pe=c.clientHeight-v.offsetTop-v.offsetHeight,Ze=Math.max(he,ie+(De?Re:0)+Pe+R),pt=Oe+Ze;a.style.height=pt+"px"}else{const De=H.length>0&&b===H[0].ref.current;a.style.top="0px";const Ze=Math.max(Y,B+v.offsetTop+(De?G:0)+ie)+Ae;a.style.height=Ze+"px",v.scrollTop=Oe-Y+v.offsetTop}a.style.margin=`${So}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,v,b,x,i.dir,r]);_n(()=>S(),[S]);const[C,_]=g.useState();_n(()=>{c&&_(window.getComputedStyle(c).zIndex)},[c]);const P=g.useCallback(O=>{O&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return f.jsx(lJ,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:f.jsx(_e.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});_A.displayName=sJ;var aJ="SelectPopperPosition",Bb=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=So,...i}=e,s=cy(n);return f.jsx(Wh,{...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)"}})});Bb.displayName=aJ;var[lJ,ZS]=Hu(Pl,{}),$b="SelectViewport",TA=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Aa($b,n),s=ZS($b,n),a=Be(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(ay.Slot,{scope:n,children:f.jsx(_e.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:te(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&d){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-So*2,v=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),x=Math.max(v,b);if(x<m){const w=x+p,S=Math.min(m,w),C=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});TA.displayName=$b;var PA="SelectGroup",[cJ,uJ]=Hu(PA),dJ=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ir();return f.jsx(cJ,{scope:n,id:o,children:f.jsx(_e.div,{role:"group","aria-labelledby":o,...r,ref:t})})});dJ.displayName=PA;var NA="SelectLabel",OA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=uJ(NA,n);return f.jsx(_e.div,{id:o.id,...r,ref:t})});OA.displayName=NA;var Rg="SelectItem",[fJ,MA]=Hu(Rg),jA=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Ia(Rg,n),l=Aa(Rg,n),c=a.value===r,[u,d]=g.useState(i??""),[h,p]=g.useState(!1),m=Be(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Ir(),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(fJ,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx(ay.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(_e.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:te(s.onFocus,()=>p(!0)),onBlur:te(s.onBlur,()=>p(!1)),onClick:te(s.onClick,()=>{b.current!=="mouse"&&x()}),onPointerUp:te(s.onPointerUp,()=>{b.current==="mouse"&&x()}),onPointerDown:te(s.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:te(s.onPointerMove,w=>{var S;b.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:te(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:te(s.onKeyDown,w=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&w.key===" "||(ZY.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})})})})});jA.displayName=Rg;var Pd="SelectItemText",RA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Ia(Pd,n),a=Aa(Pd,n),l=MA(Pd,n),c=nJ(Pd,n),[u,d]=g.useState(null),h=Be(t,x=>d(x),l.onItemTextChange,x=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,x,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=g.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=c;return _n(()=>(v(m),()=>b(m)),[v,b,m]),f.jsxs(f.Fragment,{children:[f.jsx(_e.span,{id:l.textId,...i,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Mr.createPortal(i.children,s.valueNode):null]})});RA.displayName=Pd;var IA="SelectItemIndicator",AA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return MA(IA,n).isSelected?f.jsx(_e.span,{"aria-hidden":!0,...r,ref:t}):null});AA.displayName=IA;var Vb="SelectScrollUpButton",hJ=g.forwardRef((e,t)=>{const n=Aa(Vb,e.__scopeSelect),r=ZS(Vb,e.__scopeSelect),[o,i]=g.useState(!1),s=Be(t,r.onScrollButtonChange);return _n(()=>{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(DA,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});hJ.displayName=Vb;var Ub="SelectScrollDownButton",pJ=g.forwardRef((e,t)=>{const n=Aa(Ub,e.__scopeSelect),r=ZS(Ub,e.__scopeSelect),[o,i]=g.useState(!1),s=Be(t,r.onScrollButtonChange);return _n(()=>{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(DA,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});pJ.displayName=Ub;var DA=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Aa("SelectScrollButton",n),s=g.useRef(null),a=ly(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),_n(()=>{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(_e.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:te(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:te(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:te(o.onPointerLeave,()=>{l()})})}),mJ="SelectSeparator",LA=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(_e.div,{"aria-hidden":!0,...r,ref:t})});LA.displayName=mJ;var Hb="SelectArrow",gJ=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=cy(n),i=Ia(Hb,n),s=Aa(Hb,n);return i.open&&s.position==="popper"?f.jsx(Kh,{...o,...r,ref:t}):null});gJ.displayName=Hb;function FA(e){return e===""||e===void 0}var zA=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=Be(t,o),s=OS(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(uS,{asChild:!0,children:f.jsx("select",{...r,ref:i,defaultValue:n})})});zA.displayName="BubbleSelect";function BA(e){const t=tn(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 $A(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=vJ(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 vJ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var VA=gA,QS=yA,yJ=bA,xJ=wA,bJ=SA,ek=kA,UA=TA,HA=OA,tk=jA,WA=RA,wJ=AA,KA=LA;const nk=VA,rk=yJ,uy=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(QS,{ref:r,className:ze("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(xJ,{asChild:!0,children:f.jsx(Qh,{className:"w-4 h-4 opacity-50"})})]}));uy.displayName=QS.displayName;const dy=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>f.jsx(bJ,{container:r,children:f.jsx(ek,{ref:i,className:ze("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(UA,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));dy.displayName=ek.displayName;const SJ=g.forwardRef(({className:e,...t},n)=>f.jsx(HA,{ref:n,className:ze("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));SJ.displayName=HA.displayName;const fy=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(tk,{ref:r,className:ze("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(wJ,{children:f.jsx(Zh,{className:"w-4 h-4"})})}),f.jsx(WA,{children:t})]}));fy.displayName=tk.displayName;const kJ=g.forwardRef(({className:e,...t},n)=>f.jsx(KA,{ref:n,className:ze("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));kJ.displayName=KA.displayName;function mu(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,mu(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"?mu(e.items[0]):e.key.value;if(e.type==="date")return as(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function cl(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function EJ(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function CJ({children:e}){return f.jsx("div",{children:EJ(e)})}function GA(e){const[t,n]=ee.splitModuleFilePathAndModulePath(e),r=ee.joinModuleFilePathAndModulePath(t,ee.splitModulePath(n).slice(0,-1).join(".")),o=It(r);return{path:r,schema:"data"in o?o.data:void 0}}const F_=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",_J=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",TJ=e=>(e==null?void 0:e.type)==="record",PJ=e=>(e==null?void 0:e.type)==="array";function NJ(e,t,n,r){if(!t[n])return console.error(`Get keysOf 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 h;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(B_(d)||qA(d))for(const p in d){const m=d==null?void 0:d[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;m&&l(z_(c,p),v,m)}}else if(u.type==="array"){if(OJ(d)){let p=0;for(const m of d)l(z_(c,p),u.item,m),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&B_(d)){const m=d[p];if(typeof m=="string"){const v=u.items.filter(b=>b.type==="object").find(b=>{const x=b.items[p];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 z_(e,t){return e.includes(ha)?`${e}.${JSON.stringify(t)}`:`${e}${ha}${JSON.stringify(t)}`}function B_(e){return qA(e)}function qA(e){return typeof e=="object"&&!!e&&!Ks(e)}function OJ(e){return typeof e=="object"&&!!e&&Ks(e)}function MJ({path:e,disabled:t}){const[n,r]=ee.splitModuleFilePathAndModulePath(e),o=ee.splitModuleFilePath(n),i=ee.splitModulePath(r),{navigate:s}=Vn();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:ke({"text-muted":!(i.length===0&&l===o.length-1)}),children:fu(a)}),l>0&&l<o.length-1&&f.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),f.jsx("button",{type:"button",disabled:t,title:ee.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(ee.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:ke({"text-muted":l===i.length-2}),children:fu(a)})]},`${a}-${l}`))})]})}function YA({path:e,variant:t}){const n=It(e),{path:r,schema:o}=GA(e),i=JA(e),s=i[i.length-1],a=AJ(r,F_(e,r,o)?s==null?void 0:s.part:void 0);return f.jsxs("span",{className:"inline-flex items-center gap-2",children:[F_(e,r,o)&&f.jsxs(f.Fragment,{children:[f.jsx($_,{refs:a,variant:t}),f.jsx(IJ,{defaultValue:s.text,path:e,parentPath:r,variant:t,refs:a}),f.jsx(RJ,{path:e,parentPath:r,variant:t,refs:a})]}),PJ("data"in n?n.data:void 0)&&f.jsx(jJ,{path:e,variant:t}),TJ("data"in n?n.data:void 0)&&f.jsxs(f.Fragment,{children:[f.jsx($_,{refs:a,variant:t}),f.jsx(DJ,{path:e,variant:t})]})]})}function $_({refs:e,variant:t}){const n=Kr();return e.length===0?null:f.jsxs(ns,{children:[f.jsxs(al,{children:[f.jsx($c,{children:f.jsx(Lt,{asChild:!0,size:lp(t),variant:cp(t),children:f.jsx(Fu,{children:f.jsx(TR,{size:hy(t)})})})}),f.jsx(ll,{side:"top",children:"References to this record"})]}),f.jsx(hi,{container:n,children:f.jsx("div",{className:"text-sm",children:f.jsx("ul",{children:e.map(r=>{const[o,i]=ee.splitModuleFilePathAndModulePath(r),s=ee.createPatchPath(i);return f.jsx("li",{children:f.jsx(ny,{moduleFilePath:o,patchPath:s})},r)})})})})]})}function hy(e){return e==="module"?16:12}function lp(e){return"icon"}function cp(e){return e==="module"?"outline":"ghost"}function jJ({path:e,variant:t}){const{navigate:n}=Vn(),{addPatch:r,patchPath:o}=On(e),i=It(e),s=st(e,"array"),[a]=ee.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(Lt,{title:"Add",size:lp(t),variant:cp(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:mu(l.item)}],l.type),l.item.type!=="string"&&n(ee.joinModuleFilePathAndModulePath(a,ee.patchPathToModulePath(u)))},children:f.jsx(CR,{size:hy(t)})})}function RJ({path:e,parentPath:t,variant:n,refs:r}){const{navigate:o}=Vn(),{addPatch:i,patchPath:s}=On(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(al,{children:[f.jsx($c,{children:f.jsx(Lt,{size:lp(n),variant:cp(n),disabled:r.length>0,onClick:()=>{i([{op:"remove",path:s}],"record"),o(t)},children:f.jsx(F7,{size:hy(n)})})}),f.jsx(ll,{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(TR,{size:10,className:"inline"})," to be able to delete:"]}),f.jsx("ul",{children:r.map(l=>f.jsx("li",{children:f.jsx(MJ,{path:l})},l))})]}):f.jsx("p",{children:"Delete record"})})]})}function IJ({defaultValue:e,path:t,parentPath:n,variant:r,refs:o}){const[i,s]=ee.splitModuleFilePathAndModulePath(n),{navigate:a}=Vn(),{addPatch:l,addModuleFilePatch:c}=On(t),u=st(n,"record"),[d,h]=g.useState(e),[p,m]=g.useState(!1),v=Kr();g.useEffect(()=>{const w=S=>{S.key==="Escape"&&m(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const b=ee.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(ns,{open:p,children:[f.jsxs(al,{children:[f.jsx($c,{children:f.jsx(Lt,{asChild:!0,size:lp(r),variant:cp(r),children:f.jsx(Fu,{onClick:()=>{m(!0)},children:f.jsx(j7,{size:16})})})}),f.jsx(ll,{side:"top",children:"Change name"})]}),f.jsx(hi,{container:v,className:"text-text-primary",children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:w=>{w.preventDefault();const S=[{op:"move",from:b.concat(e),path:b.concat(d)}];l(S,"record");for(const C of o){const[_,P]=ee.splitModuleFilePathAndModulePath(C),O=ee.createPatchPath(P);c(_,[{op:"replace",path:O,value:d}],"record")}a(ee.joinModuleFilePathAndModulePath(i,ee.patchPathToModulePath(b.concat(d))),{replace:!0}),m(!1)},children:[f.jsx(Uu,{type:"text",value:d,onChange:w=>{h(w.target.value)}}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Lt,{disabled:x,variant:"outline",type:"submit",children:"Update"}),f.jsx(Lt,{variant:"ghost",type:"reset",onClick:()=>{m(!1),h(e)},children:"Cancel"})]})]})})]})}function AJ(e,t){const n=Xh(),r=Hv(),o=wS();return g.useMemo(()=>"data"in n&&n.data!==void 0&&n.data[e]!==void 0?NJ(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}function DJ({path:e,variant:t}){const n=st(e,"record"),r=It(e),o=Kr(),{addPatch:i}=On(e),[s,a]=g.useState(""),{navigate:l}=Vn(),[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 h=s===""||s in n.data,[p,m]=ee.splitModuleFilePathAndModulePath(e);return f.jsxs(ns,{open:c,children:[f.jsx(Lt,{asChild:!0,size:lp(t),variant:cp(t),children:f.jsx(Fu,{onClick:()=>{u(!0)},title:"Add",children:f.jsx(CR,{size:hy(t)})})}),f.jsx(hi,{container:o,children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const b=ee.createPatchPath(m).concat(s);i([{op:"add",path:b,value:mu(d.item)}],"record"),l(ee.joinModuleFilePathAndModulePath(p,ee.patchPathToModulePath(b))),u(!1)},children:[f.jsx(Uu,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),f.jsx("div",{children:f.jsx(Lt,{type:"submit",disabled:h,variant:"outline",children:"Add"})})]})})]})}function JA(e){const[t,n]=ee.splitModuleFilePathAndModulePath(e),r=ee.splitModuleFilePath(t).map(a=>({text:fu(a),part:a,sourcePath:t}));if(!n)return r;const o=ee.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:ee.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function XA({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,C;const s=Hv(),a=ZW(n),{patchPath:l,addPatch:c}=On(n),u=It(n),d=st(n,o),[h,p]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var _,P;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((_=u.data)==null?void 0:_.type)==="image"||((P=u.data)==null?void 0:P.type)==="file")&&v(!0)},[d,u]);const b="data"in d?d.data:void 0,x="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((C=u.data)==null?void 0:C.opt)===!0;return f.jsxs("div",{className:ke("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":a.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(zu,{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:mu({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}],u.data.type)}}),x&&f.jsx(GY,{path:n,isNullable:w,loadingStatus:s,source:b}),typeof e=="string"&&f.jsx(CJ,{children:e}),e&&typeof e!="string"&&e]}),f.jsxs("div",{className:"flex items-center gap-2",children:[b!==null&&f.jsx(YA,{path:n,variant:"field"}),b!==null&&!x&&f.jsxs("button",{onClick:()=>p(_=>!_),className:ke("transform transition-transform",{"rotate-180":h}),children:[i==="1"&&f.jsx(Qh,{size:16}),i==="2"&&f.jsx(l7,{size:16})]})]})]}),!x&&f.jsx(nh,{isOpen:h&&(b!==null||m),children:(b!==null||m)&&f.jsx("div",{className:"flex flex-col gap-6 pt-6",children:t})})]})}function LJ({path:e}){const t="object",n=It(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(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=cl(e,i);return f.jsx(XA,{label:i,path:a,type:s.type,children:f.jsx(Ly,{path:a,schema:s},a)},a)})})]})}function FJ({path:e}){const t="object",n=It(e);if(n.status==="error")return f.jsx(qt,{path:e,error:n.error,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(n.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(n.data.type!=="object")return f.jsx(vr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return f.jsx(ZA,{path:e,schema:r})}function ZA({path:e,schema:t}){return f.jsx("div",{id:e,className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=cl(e,n);return f.jsx(zJ,{label:n,children:f.jsx(eE,{path:r})},n)})})}function zJ({label:e,children:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:cf(e)}),t]})}function Wb(e){return typeof e.key!="string"}function BJ({path:e}){const t="union",n=It(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(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(Wb(n.data))return typeof o!="string"&&o!==null?f.jsx(nt,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx(VJ,{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(!Wb(n.data))return typeof o!="object"?f.jsx(nt,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?f.jsx(nt,{path:e,error:"Expected source to be an object, but found an array",type:t}):f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx($J,{path:e,schema:n.data})]})}function $J({path:e,schema:t}){const n=SS(e),{addPatch:r,patchPath:o}=On(e),i=Kr(),s=cl(e,t.key),a=st(s,"literal");if(!("data"in a)||a.data===void 0)return f.jsx(gt,{path:e,type:"union"});const l=t.items.find(d=>{var p;const h=(p=d.items)==null?void 0:p[t.key];return h.type==="literal"?h.value===a.data:(console.error("Expected literal schema in object union",h),!1)});if((l==null?void 0:l.items)===void 0)return f.jsx(gt,{path:e,type:"union"});const c=t.items.flatMap(d=>{var p;const h=(p=d.items)==null?void 0:p[t.key];return h.type==="literal"?[h.value]:(console.error("Expected literal schema in object union",h),[])}),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(nk,{value:a.data??void 0,onValueChange:d=>{const h=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((h==null?void 0:h.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const p=u.current[e][d]||mu(h);p[t.key]=d,r([{op:"replace",path:o,value:p}],t.type)},children:[f.jsx(uy,{children:f.jsx(rk,{children:a.data})}),f.jsx(dy,{container:i,className:"w-32",children:c==null?f.jsx(QA,{}):c.map(d=>f.jsx(fy,{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 p,m,v;const h=cl(e,d);return f.jsx(XA,{path:h,foldLevel:"1",transparent:!0,label:d,type:(m=(p=l==null?void 0:l.items)==null?void 0:p[d])==null?void 0:m.type,children:f.jsx(Ly,{path:h,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},h)})]})}function VJ({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=On(e),i=Kr();return f.jsxs(nk,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}],"union")},children:[f.jsx(uy,{children:f.jsx(rk,{children:t})}),f.jsx(dy,{className:"w-32",container:i,children:n==null?f.jsx(QA,{}):n.map(s=>f.jsx(fy,{value:s,children:s},s))})]})}function QA(){return f.jsx("div",{children:"Loading..."})}function UJ({path:e}){const t="union",n=SS(e),r=It(e);if(n.status==="error")return f.jsx(nt,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return f.jsx(mr,{path:e});if(!("data"in r)||r.data===void 0)return f.jsx(mr,{path:e});if(n.data===null)return f.jsx(gr,{path:e});if(r.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(Wb(o))return typeof n.data!="string"?f.jsx(nt,{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(gr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return f.jsx(nt,{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&&!Ks(i))return l.value===i[o.key]});return s?f.jsx(ZA,{path:e,schema:s}):f.jsx(nt,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}function e2(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=jv.Buffer.from(s.split(",")[1],"base64"),c=ee.getSHA256Hash(l);if(a.naturalWidth&&a.naturalHeight){const u=ee.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,fileHash:c,mimeType:u,fileExt:u&&ee.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 HJ(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=jv.Buffer.from(s.split(",")[1],"base64"),l=ee.getSHA256Hash(a),c=ee.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,fileHash:l,mimeType:c,fileExt:c&&ee.mimeTypeToFileExt(c)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function WJ(e){return e.split(".").pop()||""}const KJ=new TextEncoder;async function t2(e,t,n,r,o,i,s,a="/public/val"){const l=ee.createFilename(t,n,o,r);if(!l||!o)return[];const c=`${a}/${l}`,u=ee.remote.hashToRemoteFileHash(r),d=s?ee.remote.createRemoteRef(s.remoteHost,{publicProjectId:s.publicProjectId,coreVersion:s.coreVersion,bucket:s.bucket,validationHash:ee.remote.getValidationHash(s.coreVersion,s.schema,WJ(l),o,u,KJ),fileHash:u,filePath:`${a.slice(1)}/${l}`}):c;return[{value:{[xt]:d,[We]:s?"remote":"file",...i!=="file"?{[cb]:i}:{},metadata:o},op:"replace",path:e},{value:t,op:"file",path:e,filePath:d,remote:s!==null}]}function GJ({path:e}){var C;const t="file",n=Du(),r=vS(),o=gS(),i=It(e),s=st(e,t),{patchPath:a,addPatch:l}=On(e),[c,u]=g.useState(null),[d,h]=g.useState(!1),p=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{p||h(!1)},[p]),i.status==="error")return f.jsx(qt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(i.status==="loading")return f.jsx(gt,{path:e,type:t});if(n===void 0)return f.jsx(gt,{path:e,type:t});if(i.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:i.data.type});const m=s.data;if(m===void 0)return f.jsx(Tn,{path:e,type:t});const b=i.data.type==="file"&&i.data.remote&&o.status!=="ready",x=i.data.remote&&o.status==="ready"&&r?{publicProjectId:o.publicProjectId,coreVersion:o.coreVersion,bucket:r,schema:i.data,remoteHost:n.remoteHost}:null;let w=null;if(m!=null&&m._ref)if(i.data.remote){const _=ee.remote.splitRemoteRef(m==null?void 0:m._ref);_.status==="success"&&(w=_.filePath)}else w=m==null?void 0:m._ref;let S=null;return w&&(S=w.split("/").slice(-1)[0]),f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),c&&f.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-text-error-primary",children:c}),f.jsxs("div",{className:"grid gap-2",children:[S&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"text-sm text-text-secondary",children:S}),d&&f.jsx(Uo,{className:`animate-spin text-text-secondary ${d?"block":"hidden"}`,size:16})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(Lt,{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"})}),m&&f.jsxs("a",{className:"flex items-center gap-2",href:We in m&&m[We]==="remote"?ee.convertRemoteSource({...m,[We]:"remote"}).url:ee.convertFileSource({...m,[We]:"file"}).url,children:[f.jsx("span",{children:" Open file"}),f.jsx(O7,{})]}),f.jsx("input",{disabled:b,hidden:!0,id:`img_input:${e}`,type:"file",accept:(C=i.data.options)==null?void 0:C.accept,onChange:_=>{h(!0),HJ(_).then(P=>{var I;const O={src:P.src,filename:P.filename};let j;P.mimeType&&(j={mimeType:P.mimeType}),u(null),t2(a,O.src,O.filename??null,P.fileHash,j,"file",x,(I=n.files)==null?void 0:I.directory).then(F=>{l(F,i.data.type)}).catch(F=>{h(!1),console.error("Failed to create file patch",F),u("Could not upload file. Please try again later")})})}})]})]})]})}function qJ({path:e}){const t=st(e,"image");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx(SR,{size:12})}function YJ({path:e}){var F,H,$,J;const t="image",n=Du(),r=gS(),o=vS(),i=It(e),s=st(e,t),{patchPath:a,addPatch:l}=On(e),[c,u]=g.useState(void 0),[d,h]=g.useState(null),[p,m]=g.useState(null),[v,b]=g.useState(!1),x="data"in s&&s.data,w=s.status==="success"&&s.clientSideOnly;if(g.useEffect(()=>{if(x)if(x.metadata){if(!w){const B=We in x&&x[We]==="remote"?ee.convertRemoteSource({...x,[We]:"remote"}).url:ee.convertFileSource({...x,[We]:"file"}).url;m(B),b(!1)}const W=x.metadata;if(typeof W.width!="number"||typeof W.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof W.width} and height was: ${typeof W.height}`);return}if("hotspot"in W){if(typeof W.hotspot=="object"&&W.hotspot&&"x"in W.hotspot&&"y"in W.hotspot){const{x:B,y:A}=W.hotspot;typeof B=="number"&&typeof A=="number"?u({x:B,y:A}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof B} and y: ${typeof A}`)}}else u(void 0)}else u(void 0)},[s]),i.status==="error")return f.jsx(qt,{path:e,error:i.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(s.status=="not-found"||i.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(i.status==="loading")return f.jsx(gt,{path:e,type:t});if(n===void 0)return f.jsx(gt,{path:e,type:t});if(i.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:i.data.type});const S=s.data;if(S===void 0)return f.jsx(Tn,{path:e,type:t});const _=i.data.type==="image"&&i.data.remote&&r.status!=="ready",P=i.data.remote&&r.status==="ready"&&o?{publicProjectId:r.publicProjectId,bucket:o,coreVersion:r.coreVersion,schema:i.data,remoteHost:n.remoteHost}:null,O=ee.createValPathOfItem(e,"metadata"),j=ee.createValPathOfItem(O,"alt"),I=ee.createValPathOfItem(O,"hotspot");return f.jsxs("div",{id:e,children:[f.jsx(zr,{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:JJ(r.reason)}),S&&f.jsxs("div",{className:"p-4 rounded-t-lg bg-bg-secondary",children:[f.jsx("span",{id:j,children:"Alt text"}),f.jsx(Uu,{value:(F=S.metadata)!=null&&F.alt&&typeof((H=S.metadata)==null?void 0:H.alt)=="string"?($=S.metadata)==null?void 0:$.alt:"",disabled:_,onChange:W=>{const B=W.target.value;S.metadata&&"alt"in S.metadata?l([{op:"replace",value:B,path:a.concat(["metadata","alt"])}],"string"):S.metadata&&!("alt"in S.metadata)?l([{op:"add",value:B,path:a.concat(["metadata","alt"])}],"string"):S.metadata===void 0?l([{op:"add",value:{...c?{hotspot:c}:{},alt:B},path:a.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof S.metadata}`)}})]}),S&&p&&f.jsxs("div",{className:"relative bg-bg-secondary",children:[v&&f.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[f.jsx("div",{className:"absolute inset-0 w-full h-full opacity-50 bg-bg-secondary"}),f.jsx(Uo,{size:24,className:"animate-spin"})]}),f.jsx("img",{src:p,draggable:!1,className:"object-contain max-h-[500px] w-full",style:{cursor:"crosshair"},id:I,onClick:W=>{const{width:B,height:A,left:R,top:N}=W.currentTarget.getBoundingClientRect(),D={x:Math.max((W.clientX-6-R)/B,0),y:Math.max((W.clientY-6-N)/A,0)};S.metadata&&"hotspot"in S.metadata?l([{op:"replace",path:a.concat(["metadata","hotspot"]),value:D}],"object"):S.metadata?l([{op:"add",path:a.concat(["metadata","hotspot"]),value:D}],"object"):S.metadata===void 0?l([{op:"add",value:{...D?{hotspot:D}:{}},path:a.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof S.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:ke("block px-1 py-2 text-sm text-center rounded-b-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:((J=i.data.options)==null?void 0:J.accept)||"image/*",onChange:W=>{e2(W).then(B=>{var N;m(B.src),b(!0);const A={src:B.src,filename:B.filename};let R;B.width&&B.height&&B.mimeType&&(R={width:B.width,height:B.height,mimeType:B.mimeType}),h(null),t2(a,A.src,A.filename??null,B.fileHash,R,"image",P,(N=n.files)==null?void 0:N.directory).then(D=>l(D,"image")).catch(D=>{console.error("Failed to create file patch",D),h("Could not upload file. Please try again later")})})}})]})}function JJ(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 XJ({path:e}){const t=st(e,"image");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=t.data;return f.jsx("img",{src:We in n&&n[We]==="remote"?ee.convertRemoteSource({...n,[We]:"remote"}).url:ee.convertFileSource({...n,[We]:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function ZJ({path:e}){const t="keyOf",{navigate:n}=Vn(),r=It(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}=On(e),c=Kr();if(r.status==="error")return f.jsx(qt,{path:e,error:r.error,type:t});if(s.status==="error")return f.jsx(nt,{path:e,error:s.error,type:t});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return f.jsx(Tn,{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(gt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return f.jsx(vr,{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",{id:e,children:[f.jsx(zr,{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(nk,{value:d??"",onValueChange:h=>{l([{op:"replace",path:a,value:h}],t)},children:[f.jsx(uy,{children:f.jsx(rk,{children:d})}),f.jsx(dy,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?f.jsx(QJ,{}):u.map(h=>f.jsx(fy,{value:h,children:h},h))})]}),d&&(o==null?void 0:o.path)&&f.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(ee.createValPathOfItem(o.path,d))},children:f.jsx(i7,{size:16})})]})]})}function QJ(){return f.jsx("span",{children:"Loading..."})}function eX({path:e}){const t=st(e,"keyOf");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function n2({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return f.jsx(F8,{showOutsideDays:r,captionLayout:n,className:ze("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:ze(Mb({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:ze(Mb({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(a7,{className:"w-4 h-4"}),IconRight:()=>f.jsx(Wv,{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(VA,{onValueChange:u,value:String(l),children:[f.jsx(QS,{asChild:!0,children:f.jsxs(Lt,{variant:"ghost",size:"sm",children:[s,f.jsx(Qh,{className:"w-4 h-4"})]})}),f.jsx(ek,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:f.jsx(UA,{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:h,children:p}=d.props;return f.jsx(tk,{value:String(h),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:f.jsx(WA,{children:p})},h)}return null})})})]})})}},...o})}n2.displayName="Calendar";function tX({path:e}){var h,p;const t="date",n=It(e),r=st(e,t),{patchPath:o,addPatch:i}=On(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=Kr();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(nt,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(n.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(gt,{path:e,type:t});if(n.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsxs(ns,{open:l,onOpenChange:m=>{c(m)},children:[f.jsx(Fu,{asChild:!0,onClick:()=>{c(!0)},children:f.jsxs(Lt,{variant:"outline",className:ke("w-[280px] justify-start text-left font-normal bg-bg-primary",!s&&"text-muted-foreground"),children:[f.jsx(xR,{className:"w-4 h-4 mr-2"}),s?as(s,"PPP"):f.jsx("span",{children:"Pick a date"})]})}),f.jsx(hi,{className:"w-auto p-0",container:u,children:f.jsx(n2,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(h=d.options)!=null&&h.from?new Date(d.options.from):void 0,toDate:(p=d.options)!=null&&p.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}],d.type),c(!1))}})})]})]})}function nX({path:e}){const t=st(e,"date");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function rX({path:e}){const t=st(e,"literal");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{id:e,className:"truncate",children:t.data})}function r2(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function o2(){return f.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-primary"})}function oX({path:e}){const t="record",n=ja()||{},{navigate:r}=Vn(),o=It(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(nt,{path:e,error:i.error,type:t});if(i.status=="not-found"||o.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(o.status==="loading")return f.jsx(gt,{path:e,type:t});if(!("data"in i)||i.data===void 0)return f.jsx(gt,{path:e,type:t});if(o.data.type!==t)return f.jsx(vr,{path:e,expectedType:t,actualType:o.data.type});const s=i.data;return f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx("div",{className:"grid grid-cols-1 gap-4",children:s&&Object.entries(s).map(([a])=>f.jsxs("div",{onClick:()=>r(cl(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 hover:bg-bg-brand-primary hover:text-text-brand-primary",children:[f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("div",{className:"pb-4 font-semibold text-md",children:a}),r2(cl(e,a),n)&&f.jsx(o2,{})]}),f.jsx("div",{children:f.jsx(eE,{path:cl(e,a)})})]},a))})]})}function iX({path:e}){const t=st(e,"record");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{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 py=()=>({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 Kb={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 h=u.stack;return r(this,"stack",{configurable:!0,value:h,writable:!0}),h},set:function(h){r(c,"stack",{configurable:!0,value:h,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})(Kb,Kb.exports);var i2=Kb.exports,V_="ProseMirror-selectednode",s2="",Gs="\0",U_="__state_override__",sX={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"},Ue=sX,rs=Symbol.for("__remirror__"),mn=(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))(mn||{}),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||{}),ir=(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))(ir||{}),oe=(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))(oe||{}),re=(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))(re||{}),aX=function(t){return lX(t)&&!cX(t)};function lX(e){return!!e&&typeof e=="object"}function cX(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||fX(e)}var uX=typeof Symbol=="function"&&Symbol.for,dX=uX?Symbol.for("react.element"):60103;function fX(e){return e.$$typeof===dX}function hX(e){return Array.isArray(e)?[]:{}}function ch(e,t){return t.clone!==!1&&t.isMergeableObject(e)?gu(hX(e),e,t):e}function pX(e,t,n){return e.concat(t).map(function(r){return ch(r,n)})}function mX(e,t){if(!t.customMerge)return gu;var n=t.customMerge(e);return typeof n=="function"?n:gu}function gX(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function H_(e){return Object.keys(e).concat(gX(e))}function a2(e,t){try{return t in e}catch{return!1}}function vX(e,t){return a2(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function yX(e,t,n){var r={};return n.isMergeableObject(e)&&H_(e).forEach(function(o){r[o]=ch(e[o],n)}),H_(t).forEach(function(o){vX(e,o)||(a2(e,o)&&n.isMergeableObject(t[o])?r[o]=mX(o,n)(e[o],t[o],n):r[o]=ch(t[o],n))}),r}function gu(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||pX,n.isMergeableObject=n.isMergeableObject||aX,n.cloneUnlessOtherwiseSpecified=ch;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):yX(e,t,n):ch(t,n)}gu.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return gu(r,o,n)},{})};var xX=gu,bX=xX;const wX=Ta(bX);/*!
|
|
430
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
431
|
+
*
|
|
432
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
433
|
+
* Released under the MIT License.
|
|
434
|
+
*/var l2=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
|
|
435
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
436
|
+
*
|
|
437
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
438
|
+
* Released under the MIT License.
|
|
439
|
+
*/var SX=l2;function W_(e){return SX(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var kX=function(t){var n,r;return!(W_(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,W_(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*!
|
|
440
|
+
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
441
|
+
*
|
|
442
|
+
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
443
|
+
* Released under the MIT License.
|
|
444
|
+
*/var EX=kX,CX=function(t){return EX(t)||typeof t=="function"||Array.isArray(t)};/*!
|
|
445
|
+
* object.omit <https://github.com/jonschlinkert/object.omit>
|
|
446
|
+
*
|
|
447
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
448
|
+
* Released under the MIT License.
|
|
449
|
+
*/var _X=CX,TX=function(t,n,r){if(!_X(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 ok=Ta(TX);/*!
|
|
450
|
+
* object.pick <https://github.com/jonschlinkert/object.pick>
|
|
451
|
+
*
|
|
452
|
+
* Copyright (c) 2014-2015 Jon Schlinkert, contributors.
|
|
453
|
+
* Licensed under the MIT License
|
|
454
|
+
*/var PX=l2,NX=function(t,n){if(!PX(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 Gb=Ta(NX),c2=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,OX=/\S+/g;function MX(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 u2(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},i=e.trim().normalize("NFC"),s=i.includes(" "),l=MX(i,s?OX:c2);return l.parts.map((c,u)=>{let d=l.prefixes[u]||"",h=c;return n===!1&&(r&&(h=h.normalize("NFD").replace(new RegExp(`[^a-zA-ZØßø0-9${r.join("")}]`,"g"),"")),r||(h=h.normalize("NFD").replace(/[^a-zA-ZØßø0-9]/g,""),d="")),r&&(d=d.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?d+h:!d&&!h?"":s&&!d&&o.match(/\s/)?" "+h:(d||o)+h}).filter(Boolean)}function jX(e){const t=e.matchAll(c2).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function d2(e,t){return u2(e,t).reduce((n,r)=>n+jX(r),"")}function K_(e,t){return u2(e,{...t,prefix:"-"}).join("").toLowerCase()}function qb(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),h=0;h<u;h++)d[h]=arguments[h];var p=this,m=Date.now()-s;if(i)return;function v(){s=Date.now(),n.apply(p,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 RX(e,t,n){return n===void 0?qb(e,t,!1):qb(e,n,t!==!1)}function Mt(e,t,n){const r=e[t];return f2(!gy(r),n),r}function f2(e,t){if(!e)throw new IX(t)}var IX=class extends i2.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function rn(e){return Object.entries(e)}function uh(e){return Object.keys(e)}function my(e){return Object.values(e)}function Wo(e,t,n){return e.includes(t,n)}function we(e){return Object.assign(Object.create(null),e)}function h2(e){return Object.prototype.toString.call(e)}function p2(e){return h2(e).slice(8,-1)}function up(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function ik(e){return t=>p2(t)===e}var gy=up("undefined"),Ie=up("string"),Br=up("number",e=>!Number.isNaN(e)),_t=up("function");function AX(e){return e===null}function DX(e){return e===!0||e===!1}function Vl(e){if(p2(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})}function LX(e){return e==null||/^[bns]/.test(typeof e)}function wa(e){return AX(e)||gy(e)}function Un(e){return!wa(e)&&(_t(e)||up("object")(e))}var FX=ik("RegExp");function zX(e){return ik("Map")(e)}function BX(e){return ik("Set")(e)}function Ig(e){return Un(e)&&!zX(e)&&!BX(e)&&Object.keys(e).length===0}var on=Array.isArray;function Sa(e){return on(e)&&e.length===0}function G_(e){return on(e)&&e.length>0}function vy(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 Ag(){const e=Date.now(),t=Ag.last||e;return Ag.last=e>t?e:t+1}Ag.last=0;function Dg(e=""){return`${e}${Ag().toString(36)}`}function $X(e){return ok(e,t=>!gy(t))}function VX(e){if(!Vl(e))throw new Error("An invalid value was passed into this clone utility. Expected a plain object");return{...e}}function dh(e,t=!1){const n=t?[...e].reverse():e,r=new Set(n);return t?[...r].reverse():[...r]}function m2(){}function UX(...e){return wX.all(e,{isMergeableObject:Vl})}function HX({min:e,max:t,value:n}){return n<e?e:n>t?t:n}function WX(e){return e[e.length-1]}function Nl(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 KX(e,t,n){try{if(Ie(t)&&t in e)return e[t];on(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 GX(e,t){const n=VX(t);let r=n;for(const[o,i]of e.entries()){const s=o>=e.length-1;let a=r[i];if(s){if(on(r)){const l=Number.parseInt(i.toString(),10);Br(l)&&r.splice(l,1)}else Reflect.deleteProperty(r,i);return n}if(LX(a))return n;a=on(a)?[...a]:{...a},r[i]=a,r=a}return n}function qX(e){return t=>KX(t,e)}function g2(e,t,n=!1){const r=[],o=new Set,i=_t(t)?t:qX(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 v2(e,t){const n=on(e)?e[0]:e;return Br(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 q_(e,...t){const n=t.filter(Br);return e>=Math.min(...n)&&e<=Math.max(...n)}function y2(e){return _t(e)?e():e}var x2="https://remirror.io/docs/errors",YX={[re.UNKNOWN]:"An error occurred but we're not quite sure why. 🧐",[re.INVALID_COMMAND_ARGUMENTS]:"The arguments passed to the command method were invalid.",[re.CUSTOM]:"This is a custom error, possibly thrown by an external library.",[re.CORE_HELPERS]:"An error occurred in a function called from the `@remirror/core-helpers` library.",[re.MUTATION]:"Mutation of immutable value detected.",[re.INTERNAL]:"This is an error which should not occur and is internal to the remirror codebase.",[re.MISSING_REQUIRED_EXTENSION]:"Your editor is missing a required extension.",[re.MANAGER_PHASE_ERROR]:"This occurs when accessing a method or property before it is available.",[re.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.",[re.INVALID_MANAGER_ARGUMENTS]:"Invalid value(s) passed into `Manager` constructor. Only `Presets` and `Extensions` are supported.",[re.SCHEMA]:"There is a problem with the schema or you are trying to access a node / mark that doesn't exists.",[re.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).",[re.INVALID_MANAGER_EXTENSION]:"You requested an invalid extension from the manager.",[re.DUPLICATE_COMMAND_NAMES]:"Command method names must be unique within the editor.",[re.DUPLICATE_HELPER_NAMES]:"Helper method names must be unique within the editor.",[re.NON_CHAINABLE_COMMAND]:"Attempted to chain a non chainable command.",[re.INVALID_EXTENSION]:"The provided extension is invalid.",[re.INVALID_CONTENT]:"The content provided to the editor is not supported.",[re.INVALID_NAME]:"An invalid name was used for the extension.",[re.EXTENSION]:"An error occurred within an extension. More details should be made available.",[re.EXTENSION_SPEC]:"The spec was defined without calling the `defaults`, `parse` or `dom` methods.",[re.EXTENSION_EXTRA_ATTRIBUTES]:"Extra attributes must either be a string or an object.",[re.INVALID_SET_EXTENSION_OPTIONS]:"A call to `extension.setOptions` was made with invalid keys.",[re.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 />`.",[re.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.",[re.REACT_EDITOR_VIEW]:"A problem occurred adding the editor view to the dom.",[re.REACT_CONTROLLED]:"There is a problem with your controlled editor setup.",[re.REACT_NODE_VIEW]:"Something went wrong with your custom ReactNodeView Component.",[re.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.",[re.REACT_COMPONENTS]:"An error occurred within a remirror component.",[re.REACT_HOOKS]:"An error occurred within a remirror hook.",[re.I18N_CONTEXT]:"You called `useI18n()` outside of an `I18nProvider` context."};function JX(e){return Ie(e)&&Wo(my(re),e)}function XX(e,t){const n=YX[e],r=n?`${n}
|
|
455
|
+
|
|
456
|
+
`:"",o=t?`${t}
|
|
457
|
+
|
|
458
|
+
`:"";return`${r}${o}For more information visit ${x2}#${e.toLowerCase()}`}var b2=class extends i2.BaseError{constructor({code:e,message:t,disableLogging:n=!1}={}){const r=JX(e)?e:re.CUSTOM;super(XX(r,t)),this.errorCode=r,this.url=`${x2}#${r.toLowerCase()}`,n||console.error(this.message)}static create(e={}){return new b2(e)}};function Ee(e,t){if(!e)throw b2.create(t)}function Za(e,t={}){return e}function bn(e){this.content=e}bn.prototype={constructor:bn,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 bn(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 bn(n)},addToStart:function(e,t){return new bn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new bn(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 bn(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=bn.from(e),e.size?new bn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=bn.from(e),e.size?new bn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=bn.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}};bn.from=function(e){if(e instanceof bn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new bn(t)};function w2(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=w2(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function S2(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=S2(s.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class K{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 K(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 K(r,o)}cutByIndex(t,n){return t==n?K.empty:t==0&&n==this.content.length?this:new K(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 K(o,i)}addToStart(t){return new K([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new K(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 w2(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return S2(this,t,n,r)}findIndex(t,n=-1){if(t==0)return Zp(0,t);if(t==this.size)return Zp(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?Zp(r+1,s):Zp(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 K.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new K(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return K.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 K(n||t,r)}static from(t){if(!t)return K.empty;if(t instanceof K)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new K([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}K.empty=new K([],0);const Kx={index:0,offset:0};function Zp(e,t){return Kx.index=e,Kx.offset=t,Kx}function Lg(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(!Lg(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Lg(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class tt{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&&Lg(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 tt.none;if(t instanceof tt)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}tt.none=[];class Fg extends Error{}class ae{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=E2(this.content,t+this.openStart,n);return r&&new ae(r,this.openStart,this.openEnd)}removeBetween(t,n){return new ae(k2(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 ae.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 ae(K.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 ae(t,r,o)}}ae.empty=new ae(K.empty,0,0);function k2(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(k2(i.content,t-o-1,n-o-1)))}function E2(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=E2(s.content,t-i-1,n);return a&&e.replaceChild(o,s.copy(a))}function ZX(e,t,n){if(n.openStart>e.depth)throw new Fg("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Fg("Inconsistent open depths");return C2(e,t,n,0)}function C2(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=C2(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 dl(s,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=QX(n,e);return dl(i,T2(e,s,a,t,r))}else return dl(i,zg(e,t,r))}function _2(e,t){if(!t.type.compatibleContent(e.type))throw new Fg("Cannot join "+t.type.name+" onto "+e.type.name)}function Yb(e,t,n){let r=e.node(n);return _2(r,t.node(n)),r}function ul(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 hf(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&&(ul(e.nodeAfter,r),i++));for(let a=i;a<s;a++)ul(o.child(a),r);t&&t.depth==n&&t.textOffset&&ul(t.nodeBefore,r)}function dl(e,t){return e.type.checkContent(t),e.copy(t)}function T2(e,t,n,r,o){let i=e.depth>o&&Yb(e,t,o+1),s=r.depth>o&&Yb(n,r,o+1),a=[];return hf(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(_2(i,s),ul(dl(i,T2(e,t,n,r,o+1)),a)):(i&&ul(dl(i,zg(e,t,o+1)),a),hf(t,n,o,a),s&&ul(dl(s,zg(n,r,o+1)),a)),hf(r,null,o,a),new K(a)}function zg(e,t,n){let r=[];if(hf(null,e,n,r),e.depth>n){let o=Yb(e,t,n+1);ul(dl(o,zg(e,t,n+1)),r)}return hf(t,null,n,r),new K(r)}function QX(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(K.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class vu{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 tt.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 Ol(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 vu(n,r,i)}static resolveCached(t,n){let r=Y_.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 Y_.set(t,r=new eZ);let o=r.elts[r.i]=vu.resolve(t,n);return r.i=(r.i+1)%tZ,o}}class eZ{constructor(){this.elts=[],this.i=0}}const tZ=12,Y_=new WeakMap;class Ol{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 nZ=Object.create(null);let sa=class Jb{constructor(t,n,r,o=tt.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||K.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&&Lg(this.attrs,n||t.defaultAttrs||nZ)&&tt.sameSet(this.marks,r||tt.none)}copy(t=null){return t==this.content?this:new Jb(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Jb(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 ae.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 ae(c,o.depth-s,i.depth-s)}replace(t,n,r){return ZX(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 vu.resolveCached(this,t)}resolveNoCache(t){return vu.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()+")"),P2(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=K.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=tt.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(!tt.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=K.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,o,r);return i.type.checkAttrs(i.attrs),i}};sa.prototype.text=void 0;class Bg extends sa{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):P2(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 Bg(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Bg(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 P2(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Ml{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new rZ(t,n);if(r.next==null)return Ml.empty;let o=N2(r);r.next&&r.err("Unexpected trailing text");let i=uZ(cZ(o));return dZ(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 K.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 h=i(d,a.concat(u));if(h)return h}}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(`
|
|
459
|
+
`)}}Ml.empty=new Ml(!0);class rZ{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 N2(e){let t=[];do t.push(oZ(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function oZ(e){let t=[];do t.push(iZ(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function iZ(e){let t=lZ(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=sZ(e,t);else break;return t}function J_(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function sZ(e,t){let n=J_(e),r=n;return e.eat(",")&&(e.next!="}"?r=J_(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function aZ(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 lZ(e){if(e.eat("(")){let t=N2(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=aZ(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 cZ(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 O2(e,t){return t-e}function X_(e,t){let n=[];return r(t),n.sort(O2);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 uZ(e){let t=Object.create(null);return n(X_(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]);X_(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new Ml(r.indexOf(e.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(O2);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}}function dZ(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 M2(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 j2(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 R2(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 I2(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new hZ(e,r,t[r]);return n}let Xb=class A2{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=I2(t,r.attrs),this.defaultAttrs=M2(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==Ml.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:j2(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new sa(this,this.computeAttrs(t),K.from(n),tt.setFrom(r))}createChecked(t=null,n,r){return n=K.from(n),this.checkContent(n),new sa(this,this.computeAttrs(t),n,tt.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=K.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(K.empty,!0);return i?new sa(this,t,n.append(i),tt.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){R2(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:tt.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,s)=>r[i]=new A2(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 fZ(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 hZ{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?fZ(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class dp{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=I2(t,o.attrs),this.excluded=null;let i=M2(this.attrs);this.instance=i?new tt(this,i):null}create(t=null){return!t&&this.instance?this.instance:new tt(this,j2(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((i,s)=>r[i]=new dp(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){R2(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class pZ{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=bn.from(t.nodes),n.marks=bn.from(t.marks||{}),this.nodes=Xb.compile(this.spec.nodes,this),this.marks=dp.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]=Ml.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?Z_(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==""?[]:Z_(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 Xb){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 Bg(r,r.defaultAttrs,t,tt.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return sa.fromJSON(this,t)}markFromJSON(t){return tt.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function Z_(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 mZ(e){return e.tag!=null}function gZ(e){return e.style!=null}class yu{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(mZ(o))this.tags.push(o);else if(gZ(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 eT(this,n,!1);return r.addAll(t,tt.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new eT(this,n,!0);return r.addAll(t,tt.none,n.from,n.to),ae.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(xZ(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=tT(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=tT(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new yu(t,yu.schemaRules(t)))}}const D2={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},vZ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},L2={ol:!0,ul:!0},$g=1,Vg=2,pf=4;function Q_(e,t,n){return t!=null?(t?$g:0)|(t==="full"?Vg:0):e&&e.whitespace=="pre"?$g|Vg:n&~pf}class Qp{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=tt.none,this.match=i||(s&pf?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.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&$g)){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=K.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(K.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&&!D2.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class eT{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let o=n.topNode,i,s=Q_(null,n.preserveWhitespace,0)|(r?pf:0);o?i=new Qp(o.type,o.attrs,tt.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Qp(null,null,tt.none,!0,null,s):i=new Qp(t.schema.topNodeType,null,tt.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&Vg||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o.options&$g)o.options&Vg?r=r.replace(/\r\n?/g,`
|
|
460
|
+
`):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;L2.hasOwnProperty(o)&&this.parser.normalizeLists&&yZ(t);let s=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,r));if(s?s.ignore:vZ.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(D2.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(`
|
|
461
|
+
`),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=tt.none;for(let s of r.concat(t.marks))(o.type?o.type.allowsMarkType(s.type):nT(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=Q_(t,i,s.options);s.options&pf&&s.content.length==0&&(a|=pf);let l=tt.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):nT(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Qp(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 yZ(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&L2.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function xZ(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function tT(e){let t={};for(let n in e)t[n]=e[n];return t}function nT(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 Da{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=Gx(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}=wm(Gx(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&&wm(Gx(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return wm(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Da(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=rT(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return rT(t.marks)}}function rT(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Gx(e){return e.document||window.document}const oT=new WeakMap;function bZ(e){let t=oT.get(e);return t===void 0&&oT.set(e,t=wZ(e)),t}function wZ(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 wm(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=bZ(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 h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let h=t[d];if(h===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:p,contentDOM:m}=wm(e,h,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const F2=65535,z2=Math.pow(2,16);function SZ(e,t){return e+t*z2}function iT(e){return e&F2}function kZ(e){return(e-(e&F2))/z2}const B2=1,$2=2,Sm=4,V2=8;class Zb{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&V2)>0}get deletedBefore(){return(this.delInfo&(B2|Sm))>0}get deletedAfter(){return(this.delInfo&($2|Sm))>0}get deletedAcross(){return(this.delInfo&Sm)>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=iT(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+kZ(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 h=c?t==l?-1:t==d?1:n:n,p=l+o+(h<0?0:u);if(r)return p;let m=t==(n<0?l:d)?null:SZ(a/3,t-l),v=t==l?$2:t==d?B2:Sm;return(n<0?t!=l:t!=d)&&(v|=V2),new Zb(p,v,m)}o+=u-c}return r?t+o:new Zb(t+o,0,null)}touches(t,n){let r=0,o=iT(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 Uc{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 Uc(this.maps,this.mirror,t,n)}copy(){return new Uc(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 Uc;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 Zb(t,o,null)}}const qx=Object.create(null);class sn{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=qx[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 qx)throw new RangeError("Duplicate use of step JSON ID "+t);return qx[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 Fg)return Vt.fail(i.message);throw i}}}function sk(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(sk(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return K.fromArray(r)}class Vi extends sn{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 ae(sk(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 jo(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 Vi(n.pos,r.pos,this.mark)}merge(t){return t instanceof Vi&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Vi(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 Vi(n.from,n.to,t.markFromJSON(n.mark))}}sn.jsonID("addMark",Vi);class jo extends sn{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 ae(sk(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 Vi(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 jo(n.pos,r.pos,this.mark)}merge(t){return t instanceof jo&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new jo(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 jo(n.from,n.to,t.markFromJSON(n.mark))}}sn.jsonID("removeMark",jo);class qs extends sn{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 ae(K.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 qs(this.pos,n.marks[o]);return new qs(this.pos,this.mark)}}return new xu(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new qs(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 qs(n.pos,t.markFromJSON(n.mark))}}sn.jsonID("addNodeMark",qs);class xu extends sn{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 ae(K.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new qs(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new xu(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 xu(n.pos,t.markFromJSON(n.mark))}}sn.jsonID("removeNodeMark",xu);class hn extends sn{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&Qb(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 hn(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 hn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof hn)||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?ae.empty:new ae(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new hn(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?ae.empty:new ae(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new hn(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 hn(n.from,n.to,ae.fromJSON(t,n.slice),!!n.structure)}}sn.jsonID("replace",hn);class Ut extends sn{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&&(Qb(t,this.from,this.gapFrom)||Qb(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,ae.fromJSON(t,n.slice),n.insert,!!n.structure)}}sn.jsonID("replaceAround",Ut);function Qb(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 EZ(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 h=Math.max(c,t),p=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==h&&s.mark.eq(d[v])?s.to=p:o.push(s=new jo(h,p,d[v])));a&&a.to==h?a.to=p:i.push(a=new Vi(h,p,r))}}),o.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function CZ(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 dp){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],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==i-1&&d.eq(o[p].style)&&(h=m)}h?(h.to=c,h.step=i):o.push({style:d,from:Math.max(a,t),to:c,step:i})}}}),o.forEach(s=>e.step(new jo(s.from,s.to,s.style)))}function ak(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 hn(a,u,ae.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||e.step(new jo(a,u,c.marks[h]));if(o&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new ae(K.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new hn(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(K.empty,!0);e.replace(a,a,new ae(l,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function _Z(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Wu(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||!_Z(o,i,s))break}return null}function TZ(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=K.empty,d=0;for(let m=i,v=!1;m>n;m--)v||r.index(m)>0?(v=!0,u=K.from(r.node(m).copy(u)),d++):l--;let h=K.empty,p=0;for(let m=i,v=!1;m>n;m--)v||o.after(m+1)<o.end(m)?(v=!0,h=K.from(o.node(m).copy(h)),p++):c++;e.step(new Ut(l,c,s,a,new ae(u.append(h),d,p),u.size-d,!0))}function lk(e,t,n=null,r=e){let o=PZ(e,t),i=o&&NZ(r,t);return i?o.map(sT).concat({type:t,attrs:n}).concat(i.map(sT)):null}function sT(e){return{type:e,attrs:null}}function PZ(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 NZ(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 OZ(e,t,n){let r=K.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=K.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 ae(r,0,0),n.length,!0))}function MZ(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)&&jZ(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&H2(e,s,a,i),ak(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),d=u.map(a,1),h=u.map(a+s.nodeSize,1);return e.step(new Ut(d,h,d+1,h-1,new ae(K.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&U2(e,s,a,i),!1}})}function U2(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 H2(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(`
|
|
462
|
+
`))}})}function jZ(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function RZ(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 ae(K.from(s),0,0),1,!0))}function Hc(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),h=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let v=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!v.type.validContent(p))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 IZ(e,t,n=1,r){let o=e.doc.resolve(t),i=K.empty,s=K.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=K.from(o.node(a).copy(i));let u=r&&r[c];s=K.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}e.step(new hn(t,t,new ae(i.append(s),n,n),!0))}function fp(e,t){let n=e.resolve(t),r=n.index();return DZ(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function AZ(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 DZ(e,t){return!!(e&&t&&!e.isLeaf&&AZ(e,t))}function LZ(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);H2(e,u.node(),u.before(),a)}s.inlineContent&&ak(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 hn(c,l.map(t+n,-1),ae.empty,!0)),r===!0){let u=e.doc.resolve(c);U2(e,u.node(),u.before(),e.steps.length)}return e}function W2(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 K2(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 ck(e,t,n=t,r=ae.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return G2(o,i,r)?new hn(t,n,r):new FZ(o,i,r).fit()}function G2(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class FZ{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.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=K.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 ae(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 hn(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=Yx(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(K.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=Yx(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ae(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=Yx(t,n);if(o.childCount<=1&&n>0){let i=t.size-n<=n+o.size;this.unplaced=new ae(Nd(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ae(Nd(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:h}=this.frontier[n];if(o){for(let v=0;v<o.childCount;v++)u.push(o.child(v));d=d.matchFragment(o)}let p=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(q2(v.mark(h.allowedMarks(v.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=Od(this.placed,n,K.from(u)),this.frontier[n].match=d,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,b=a;v<p;v++){let x=b.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),b=x.content}this.unplaced=m?t==0?ae.empty:new ae(Nd(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new ae(Nd(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||!Jx(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=Jx(t,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Jx(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=Od(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=Od(this.placed,this.depth,K.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=Od(this.placed,this.frontier.length,n))}}function Nd(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Nd(e.firstChild.content,t-1,n)))}function Od(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Od(e.lastChild.content,t-1,n)))}function Yx(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function q2(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,q2(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(K.empty,!0)))),e.copy(r)}function Jx(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&&!zZ(n,i.content,s)?a:null}function zZ(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function BZ(e){return e.spec.defining||e.spec.definingForContent}function $Z(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(G2(o,i,r))return e.step(new hn(t,n,r));let s=J2(o,e.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?a=h:o.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=BZ(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(a)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];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),S=o.index(b-1);if(w.canReplaceWith(S,S,m.type,m.marks))return e.replace(o.before(b),x?i.after(b):n,new ae(Y2(r.content,0,r.openStart,p),p,r.openEnd))}}let d=e.steps.length;for(let h=s.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>d));h--){let p=s[h];p<0||(t=o.before(p),n=i.after(p))}}function Y2(e,t,n,r,o){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Y2(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(K.empty,!0))}return e}function VZ(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=W2(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new ae(K.from(r),0,0))}function UZ(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=J2(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 J2(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 Wc extends sn{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 ae(K.from(o),0,n.isLeaf?0:1))}getMap(){return Nr.empty}invert(t){return new Wc(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 Wc(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 Wc(n.pos,n.attr,n.value)}}sn.jsonID("attr",Wc);class fh extends sn{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 fh(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 fh(n.attr,n.value)}}sn.jsonID("docAttr",fh);let bu=class extends Error{};bu=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};bu.prototype=Object.create(Error.prototype);bu.prototype.constructor=bu;bu.prototype.name="TransformError";class HZ{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Uc}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new bu(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=ae.empty){let o=ck(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new ae(K.from(r),0,0))}delete(t,n){return this.replace(t,n,ae.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return $Z(this,t,n,r),this}replaceRangeWith(t,n,r){return VZ(this,t,n,r),this}deleteRange(t,n){return UZ(this,t,n),this}lift(t,n){return TZ(this,t,n),this}join(t,n=1){return LZ(this,t,n),this}wrap(t,n){return OZ(this,t,n),this}setBlockType(t,n=t,r,o=null){return MZ(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return RZ(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new Wc(t,n,r)),this}setDocAttribute(t,n){return this.step(new fh(t,n)),this}addNodeMark(t,n){return this.step(new qs(t,n)),this}removeNodeMark(t,n){if(!(n instanceof tt)){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 xu(t,n)),this}split(t,n=1,r){return IZ(this,t,n,r),this}addMark(t,n,r){return EZ(this,t,n,r),this}removeMark(t,n,r){return CZ(this,t,n,r),this}clearIncompatible(t,n,r){return ak(this,t,n,r),this}}const Xx=Object.create(null);class Ke{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new WZ(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=ae.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?ae.empty:n),a==0&&cT(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),cT(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new Le(t):uc(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?uc(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):uc(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 Jn(t.node(0))}static atStart(t){return uc(t,t,0,0,1)||new Jn(t)}static atEnd(t){return uc(t,t,t.content.size,t.childCount,-1)||new Jn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xx[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 Xx)throw new RangeError("Duplicate use of selection JSON ID "+t);return Xx[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Le.between(this.$anchor,this.$head).getBookmark()}}Ke.prototype.visible=!0;class WZ{constructor(t,n){this.$from=t,this.$to=n}}let aT=!1;function lT(e){!aT&&!e.parent.inlineContent&&(aT=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Le extends Ke{constructor(t,n=t){lT(t),lT(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 Ke.near(r);let o=t.resolve(n.map(this.anchor));return new Le(o.parent.inlineContent?o:r,r)}replace(t,n=ae.empty){if(super.replace(t,n),n==ae.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Le&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new yy(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 Le(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=Ke.findFrom(n,r,!0)||Ke.findFrom(n,-r,!0);if(i)n=i.$head;else return Ke.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(Ke.findFrom(t,-r,!0)||Ke.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new Le(t,n)}}Ke.jsonID("text",Le);class yy{constructor(t,n){this.anchor=t,this.head=n}map(t){return new yy(t.map(this.anchor),t.map(this.head))}resolve(t){return Le.between(t.resolve(this.anchor),t.resolve(this.head))}}class Te extends Ke{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?Ke.near(i):new Te(i)}content(){return new ae(K.from(this.node),0,0)}eq(t){return t instanceof Te&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new uk(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(t.resolve(n.anchor))}static create(t,n){return new Te(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Te.prototype.visible=!1;Ke.jsonID("node",Te);class uk{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new yy(r,r):new uk(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):Ke.near(n)}}class Jn extends Ke{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=ae.empty){if(n==ae.empty){t.delete(0,t.doc.content.size);let r=Ke.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Jn(t)}map(t){return new Jn(t)}eq(t){return t instanceof Jn}getBookmark(){return KZ}}Ke.jsonID("all",Jn);const KZ={map(){return this},resolve(e){return new Jn(e)}};function uc(e,t,n,r,o,i=!1){if(t.inlineContent)return Le.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&&Te.isSelectable(a))return Te.create(e,n-(o<0?a.nodeSize:0))}else{let l=uc(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function cT(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof hn||o instanceof Ut))return;let i=e.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),e.setSelection(Ke.near(e.doc.resolve(s),n))}const uT=1,em=2,dT=4;class GZ extends HZ{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|uT)&~em,this.storedMarks=null,this}get selectionSet(){return(this.updated&uT)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=em,this}ensureMarks(t){return tt.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&em)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~em,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)||tt.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(Ke.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|=dT,this}get scrolledIntoView(){return(this.updated&dT)>0}}function fT(e,t){return!t||!e?e:e.bind(t)}class Md{constructor(t,n,r){this.name=t,this.init=fT(n.init,r),this.apply=fT(n.apply,r)}}const qZ=[new Md("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Md("selection",{init(e,t){return e.selection||Ke.atStart(t.doc)},apply(e){return e.selection}}),new Md("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Md("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class Zx{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=qZ.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 Md(r.key,r.spec.state,r))})}}class Qa{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 Qa(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 GZ(this)}static create(t){let n=new Zx(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new Qa(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 Zx(this.schema,t.plugins),r=n.fields,o=new Qa(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 Zx(t.schema,t.plugins),i=new Qa(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=sa.fromJSON(t.schema,n.doc);else if(s.name=="selection")i.selection=Ke.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 X2(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=X2(o,t,{})),n[r]=o}return n}class cs{constructor(t){this.spec=t,this.props={},t.props&&X2(t.props,this,this.props),this.key=t.key?t.key.key:Z2("plugin")}getState(t){return t[this.key]}}const Qx=Object.create(null);function Z2(e){return e in Qx?e+"$"+ ++Qx[e]:(Qx[e]=0,e+"$")}class Ku{constructor(t="key"){this.key=Z2(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function Q2(){return typeof document<"u"?document:null}function eD(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(h,p,m){var v=n.push(h.slice(l[0].length,-l[1].length))-1;return u.push(v),o+v+o}n.forEach(function(h,p){for(var m,v=0;h!=m;)if(m=h,h=h.replace(c,d),v++>1e4)throw Error("References have circular dependency. Please, check them.");n[p]=h}),u=u.reverse(),n=n.map(function(h){return u.forEach(function(p){h=h.replace(new RegExp("(\\"+o+p+"\\"+o+")","g"),l[0]+"$1"+l[1])}),h})});var s=new RegExp("\\"+o+"([0-9]+)\\"+o);function a(l,c,u){for(var d=[],h,p=0;h=s.exec(l);){if(p++>1e4)throw Error("Circular references in parenthesis");d.push(l.slice(0,h.index)),d.push(a(c[h[1]],c)),l=l.slice(h.index+h[0].length)}return d.push(l),d}return i?n:a(n[0],n)}function tD(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 nD(e,t){return Array.isArray(e)?tD(e,t):eD(e,t)}nD.parse=eD;nD.stringify=tD;const YZ={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},JZ={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},XZ={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},ZZ={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},QZ={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},eQ={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},tQ={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},nQ={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var ka=Object.freeze({__proto__:null,COPY_DESCRIPTION:JZ,COPY_LABEL:YZ,CUT_DESCRIPTION:ZZ,CUT_LABEL:XZ,PASTE_DESCRIPTION:eQ,PASTE_LABEL:QZ,SELECT_ALL_DESCRIPTION:nQ,SELECT_ALL_LABEL:tQ});const rQ={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},oQ={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var hT=Object.freeze({__proto__:null,DESCRIPTION:oQ,LABEL:rQ});const iQ={id:"extension.command.toggle-heading.label",message:`{level, select, 1 {Heading 1}
|
|
463
|
+
2 {Heading 2}
|
|
464
|
+
3 {Heading 3}
|
|
465
|
+
4 {Heading 4}
|
|
466
|
+
5 {Heading 5}
|
|
467
|
+
6 {Heading 6}
|
|
468
|
+
other {Heading}}`,comment:"Label for heading command with support for levels."};var sQ=Object.freeze({__proto__:null,LABEL:iQ});const aQ={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},lQ={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},cQ={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},uQ={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var Ug=Object.freeze({__proto__:null,REDO_DESCRIPTION:uQ,REDO_LABEL:cQ,UNDO_DESCRIPTION:lQ,UNDO_LABEL:aQ});const dQ={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},fQ={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var pT=Object.freeze({__proto__:null,DESCRIPTION:fQ,LABEL:dQ});const hQ={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},pQ={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},mQ={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var dk=Object.freeze({__proto__:null,BULLET_LIST_LABEL:pQ,ORDERED_LIST_LABEL:hQ,TASK_LIST_LABEL:mQ});const gQ={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},vQ={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},yQ={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},xQ={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var Hg=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:xQ,CONVERT_LABEL:yQ,INSERT_DESCRIPTION:vQ,INSERT_LABEL:gQ});const bQ={id:"extension.command.toggle-strike.label",message:"Strikethrough",comment:"Label for strike formatting command."},wQ={id:"extension.command.toggle-strike.description",message:"Strikethrough the selected text",comment:"Description for strike formatting command."};var mT=Object.freeze({__proto__:null,DESCRIPTION:wQ,LABEL:bQ});class ho{constructor(t,n,r={}){this.match=t,this.match=t,this.handler=typeof n=="string"?SQ(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1}}function SQ(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 kQ=500;function EQ({rules:e}){let t=new cs({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 gT(n,r,o,i,e,t)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&gT(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function gT(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-kQ),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),h=d&&u.handler(s,d,t-(d[0].length-r.length),n);if(h)return u.undoable&&h.setMeta(i,{transform:h,from:t,to:n,text:r}),e.dispatch(h),!0}return!1}const CQ=(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 ho(/--$/,"—");new ho(/\.\.\.$/,"…");new ho(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“");new ho(/"$/,"”");new ho(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘");new ho(/'$/,"’");function fk(e,t,n=null,r){return new ho(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(),h=d&&lk(d,t,l);if(!h)return null;c.wrap(d,h);let p=c.doc.resolve(s-1).nodeBefore;return p&&p.type==t&&fp(c.doc,s-1)&&(!r||r(i,p))&&c.join(s-1),c})}function _Q(e,t,n=null){return new ho(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 wn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},hh=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let ew=null;const ji=function(e,t,n){let r=ew||(ew=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},TQ=function(){ew=null},jl=function(e,t,n,r){return n&&(vT(e,t,n,r,-1)||vT(e,t,n,r,1))},PQ=/^(img|br|input|textarea|hr)$/i;function vT(e,t,n,r,o){for(;;){if(e==n&&t==r)return!0;if(t==(o<0?0:to(e))){let i=e.parentNode;if(!i||i.nodeType!=1||hp(e)||PQ.test(e.nodeName)||e.contentEditable=="false")return!1;t=wn(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?to(e):0}else return!1}}function to(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function NQ(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=to(e)}else if(e.parentNode&&!hp(e))t=wn(e),e=e.parentNode;else return null}}function OQ(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&&!hp(e))t=wn(e)+1,e=e.parentNode;else return null}}function MQ(e,t,n){for(let r=t==0,o=t==to(e);r||o;){if(e==n)return!0;let i=wn(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,o=o&&i==to(e)}}function hp(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 xy=function(e){return e.focusNode&&jl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function qa(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function jQ(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function RQ(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(to(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(to(r.startContainer),r.startOffset)}}}const mi=typeof navigator<"u"?navigator:null,yT=typeof document<"u"?document:null,La=mi&&mi.userAgent||"",tw=/Edge\/(\d+)/.exec(La),rD=/MSIE \d/.exec(La),nw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(La),pr=!!(rD||nw||tw),aa=rD?document.documentMode:nw?+nw[1]:tw?+tw[1]:0,Ko=!pr&&/gecko\/(\d+)/i.test(La);Ko&&+(/Firefox\/(\d+)/.exec(La)||[0,0])[1];const rw=!pr&&/Chrome\/(\d+)/.exec(La),Fn=!!rw,oD=rw?+rw[1]:0,Qn=!pr&&!!mi&&/Apple Computer/.test(mi.vendor),wu=Qn&&(/Mobile\/\w+/.test(La)||!!mi&&mi.maxTouchPoints>2),Xr=wu||(mi?/Mac/.test(mi.platform):!1),IQ=mi?/Win/.test(mi.platform):!1,To=/Android \d/.test(La),pp=!!yT&&"webkitFontSmoothing"in yT.documentElement.style,AQ=pp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function DQ(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 _i(e,t){return typeof e=="number"?e:e[t]}function LQ(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 xT(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=hh(s)){if(s.nodeType!=1)continue;let a=s,l=a==i.body,c=l?DQ(i):LQ(a),u=0,d=0;if(t.top<c.top+_i(r,"top")?d=-(c.top-t.top+_i(o,"top")):t.bottom>c.bottom-_i(r,"bottom")&&(d=t.bottom-t.top>c.bottom-c.top?t.top+_i(o,"top")-c.top:t.bottom-c.bottom+_i(o,"bottom")),t.left<c.left+_i(r,"left")?u=-(c.left-t.left+_i(o,"left")):t.right>c.right-_i(r,"right")&&(u=t.right-c.right+_i(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-h,v=a.scrollTop-p;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 FQ(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:iD(e.dom)}}function iD(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=hh(r));return t}function zQ({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;sD(n,r==0?0:r-t)}function sD(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 nc=null;function BQ(e){if(e.setActive)return e.setActive();if(nc)return e.focus(nc);let t=iD(e);e.focus(nc==null?{get preventScroll(){return nc={preventScroll:!0},!0}}:void 0),nc||(nc=!1,sD(t,0))}function aD(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 h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=ji(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];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?$Q(n,o):!n||r&&n.nodeType==1?{node:e,offset:i}:aD(n,o)}function $Q(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=Ts(r,1);if(i.top!=i.bottom&&hk(t,i))return{node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function hk(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function VQ(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function UQ(e,t,n){let{node:r,offset:o}=aD(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 HQ(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 lD(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(hk(t,c))return lD(s,t,c)}}if((i=(i+1)%r)==o)break}return e}function WQ(e,t){let n=e.dom.ownerDocument,r,o=0,i=RQ(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(!hk(t,c)||(s=lD(e.dom,t,c),!s))return null}if(Qn)for(let c=s;r&&c;c=hh(c))c.draggable&&(r=void 0);if(s=VQ(s,t),r){if(Ko&&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;pp&&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=HQ(e,r,o,t))}a==null&&(a=UQ(e,s,t));let l=e.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function bT(e){return e.top<e.bottom||e.left<e.right}function Ts(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(bT(r))return r}return Array.prototype.find.call(n,bT)||e.getBoundingClientRect()}const KQ=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function cD(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=pp||Ko;if(r.nodeType==3)if(s&&(KQ.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=Ts(ji(r,o,o),n);if(Ko&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Ts(ji(r,o-1,o-1),-1);if(c.top==l.top){let u=Ts(ji(r,o,o+1),-1);if(u.top!=l.top)return vd(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++,vd(Ts(ji(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==to(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return e0(l.getBoundingClientRect(),!1)}if(i==null&&o<to(r)){let l=r.childNodes[o];if(l.nodeType==1)return e0(l.getBoundingClientRect(),!0)}return e0(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==to(r))){let l=r.childNodes[o-1],c=l.nodeType==3?ji(l,to(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return vd(Ts(c,1),!1)}if(i==null&&o<to(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ji(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return vd(Ts(c,-1),!0)}return vd(Ts(r.nodeType==3?ji(r):r,-n),n>=0)}function vd(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 e0(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 uD(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 GQ(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return uD(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=cD(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=ji(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 qQ=/[\u0590-\u08ac]/;function YQ(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?!qQ.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:uD(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=e.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:v}=e.domSelectionRange(),b=m&&!p.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 h!=null&&(a.caretBidiLevel=h),b}):r.pos==r.start()||r.pos==r.end()}let wT=null,ST=null,kT=!1;function JQ(e,t,n){return wT==t&&ST==n?kT:(wT=t,ST=n,kT=n=="up"||n=="down"?GQ(e,t,n):YQ(e,t,n))}const oo=0,ET=1,el=2,gi=3;class mp{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=oo,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>wn(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 fD){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 dD&&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?wn(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?wn(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 h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=wn(h.dom)+1;break}t-=h.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=wn(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 p=0,m=0;p<this.children.length;p++){let v=this.children[p],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((Ko||Qn)&&t==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(d=!!(m&&p.nodeValue[m-1]==`
|
|
469
|
+
`),d&&m==p.nodeValue.length)for(let v=p,b;v;v=v.parentNode){if(b=v.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:wn(b)+1});break}let x=v.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let v=p.childNodes[m-1];d=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(Ko&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&Qn)&&jl(a.node,a.offset,u.anchorNode,u.anchorOffset)&&jl(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||t==n)&&!d){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(t>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}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?el:ET,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=gi:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?el:gi}r=s}this.dirty=el}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?el:ET;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(t){return!1}}class dD extends mp{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==oo&&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 XQ extends mp{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 Rl extends mp{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=Da.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Rl(t,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&gi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=gi&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=oo){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=oo}}slice(t,n,r){let o=Rl.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=iw(i,n,s,r)),t>0&&(i=iw(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 la extends mp{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}=Da.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 h=u;return u=mD(u,r,n),c?l=new ZQ(t,n,r,o,u,d||null,h,c,i,s+1):n.isText?new by(t,n,r,o,u,h,i):new la(t,n,r,o,u,d||null,h,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=()=>K.empty)}return t}matchesNode(t,n,r){return this.dirty==oo&&t.eq(this.node)&&Wg(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 eee(this,s&&s.node,t);ree(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?tt.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,o)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,t);let p;l.findNodeMatch(c,u,d,h)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,p,t)||l.updateNextNode(c,u,d,t,h,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==el)&&(s&&this.protectLocalComposition(t,s),hD(this.contentDOM,this.children,t),wu&&oee(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof Le)||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=iee(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 XQ(this,i,n,o);t.input.compositionNodes.push(s),this.children=iw(this.children,r,r+o.length,t,s)}update(t,n,r,o){return this.dirty==gi||!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=oo}updateOuterDeco(t){if(Wg(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=pD(this.dom,this.nodeDOM,ow(this.outerDeco,this.node,n),ow(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 CT(e,t,n,r,o){mD(r,t,e);let i=new la(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class by extends la{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==gi||this.dirty!=oo&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=oo||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=oo,!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 by(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=gi)}get domAtom(){return!1}isText(t){return this.node.text==t}}class fD extends mp{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==oo&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ZQ extends la{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==gi)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 hD(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=_T(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Rl){let l=r?r.previousSibling:e.lastChild;hD(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=_T(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const mf=function(e){e&&(this.nodeName=e)};mf.prototype=Object.create(null);const tl=[new mf];function ow(e,t,n){if(e.length==0)return tl;let r=n?tl[0]:new mf,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new mf(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new mf(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 pD(e,t,n,r){if(n==tl&&r==tl)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=tl[0]),o=l}QQ(o,a||tl[0],s)}return o}function QQ(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 mD(e,t,n){return pD(e,e,tl,ow(t,n,e.nodeType!=1))}function Wg(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 _T(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class eee{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=tee(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=oo,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=Rl.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==gi&&s.dom==s.contentDOM&&(s.dirty=el),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 la){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=gi&&Wg(n,l.outerDeco));if(!h&&l.update(t,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(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=el,d.updateChildren(o,s+1),d.dirty=oo),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)||!Wg(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=la.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=la.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 dD(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 Rl;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof by)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Qn||Fn)&&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 fD(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 tee(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 Rl)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 nee(e,t){return e.type.side-t.type.side}function ree(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(nee);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(c<e.childCount)p=c,h=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+h.nodeSize;if(h.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=h.cut(b-i),h=h.cut(0,b-i),m=b,p=-1)}else for(;s<o.length&&o[s].to<m;)s++;let v=h.isInline&&!h.isLeaf?a.filter(b=>!b.inline):a.slice();r(h,v,t.forChild(i,h),p),i=m}}function oee(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 iee(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 iw(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 pk(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(xy(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Te.isSelectable(d)&&o.parent&&!(d.isInline&&MQ(n.focusNode,n.focusOffset,o.dom))){let h=o.posBefore;c=new Te(s==h?a:r.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,h=s;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,s]=h==e.state.selection.anchor?[h,d]:[d,h],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=mk(e,u,a,d)}return c}function gD(e){return e.editable?e.hasFocus():yD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Ki(e,t=!1){let n=e.state.selection;if(vD(e,n),!!gD(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Fn){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&jl(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)aee(e);else{let{anchor:r,head:o}=n,i,s;TT&&!(n instanceof Le)&&(n.$from.parent.inlineContent||(i=PT(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=PT(e,n.to))),e.docView.setSelection(r,o,e,t),TT&&(i&&NT(i),s&&NT(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&see(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const TT=Qn||Fn&&oD<63;function PT(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(Qn&&o&&o.contentEditable=="false")return t0(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return t0(o);if(i)return t0(i)}}function t0(e){return e.contentEditable="true",Qn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function NT(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function see(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(()=>{(!gD(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function aee(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,wn(r)+1):n.setStart(r,0),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!o&&!e.state.selection.visible&&pr&&aa<=11&&(r.disabled=!0,r.disabled=!1)}function vD(e,t){if(t instanceof Te){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(OT(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else OT(e)}function OT(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function mk(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Le.between(t,n,r)}function MT(e){return e.editable&&!e.hasFocus()?!1:yD(e)}function yD(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 lee(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return jl(t.node,t.offset,n.anchorNode,n.anchorOffset)}function sw(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&&Ke.findFrom(i,t)}function Is(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function jT(e,t,n){let r=e.state.selection;if(r instanceof Le)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 Is(e,new Le(r.$anchor,s))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=sw(e.state,t);return o&&o instanceof Te?Is(e,o):!1}else if(!(Xr&&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?Te.isSelectable(i)?Is(e,new Te(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):pp?Is(e,new Le(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Te&&r.node.isInline)return Is(e,new Le(t>0?r.$to:r.$from));{let o=sw(e.state,t);return o?Is(e,o):!1}}}function Kg(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function gf(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function rc(e,t){return t<0?cee(e):uee(e)}function cee(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(Ko&&n.nodeType==1&&r<Kg(n)&&gf(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(gf(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(xD(n))break;{let a=n.previousSibling;for(;a&&gf(a,-1);)o=n.parentNode,i=wn(a),a=a.previousSibling;if(a)n=a,r=Kg(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?aw(e,n,r):o&&aw(e,o,i)}function uee(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=Kg(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(gf(a,1))i=n,s=++r;else break}else{if(xD(n))break;{let a=n.nextSibling;for(;a&&gf(a,1);)i=a.parentNode,s=wn(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=Kg(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}i&&aw(e,i,s)}function xD(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function dee(e,t){for(;e&&t==e.childNodes.length&&!hp(e);)t=wn(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 fee(e,t){for(;e&&!t&&!hp(e);)t=wn(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 aw(e,t,n){if(t.nodeType!=3){let i,s;(s=dee(t,n))?(t=s,n=0):(i=fee(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(xy(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&&Ki(e)},50)}function RT(e,t){let n=e.state.doc.resolve(t);if(!(Fn||IQ)&&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 IT(e,t,n){let r=e.state.selection;if(r instanceof Le&&!r.empty||n.indexOf("s")>-1||Xr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=sw(e.state,t);if(s&&s instanceof Te)return Is(e,s)}if(!o.parent.inlineContent){let s=t<0?o:i,a=r instanceof Jn?Ke.near(s,t):Ke.findFrom(s,t);return a?Is(e,a):!1}return!1}function AT(e,t){if(!(e.state.selection instanceof Le))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 DT(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function hee(e){if(!Qn||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;DT(e,r,"true"),setTimeout(()=>DT(e,r,"false"),20)}return!1}function pee(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function mee(e,t){let n=t.keyCode,r=pee(t);if(n==8||Xr&&n==72&&r=="c")return AT(e,-1)||rc(e,-1);if(n==46&&!t.shiftKey||Xr&&n==68&&r=="c")return AT(e,1)||rc(e,1);if(n==13||n==27)return!0;if(n==37||Xr&&n==66&&r=="c"){let o=n==37?RT(e,e.state.selection.from)=="ltr"?-1:1:-1;return jT(e,o,r)||rc(e,o)}else if(n==39||Xr&&n==70&&r=="c"){let o=n==39?RT(e,e.state.selection.from)=="ltr"?1:-1:1;return jT(e,o,r)||rc(e,o)}else{if(n==38||Xr&&n==80&&r=="c")return IT(e,-1,r)||rc(e,-1);if(n==40||Xr&&n==78&&r=="c")return hee(e)||IT(e,1,r)||rc(e,1);if(r==(Xr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function bD(e,t){e.someProp("transformCopied",p=>{t=p(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 p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=e.someProp("clipboardSerializer")||Da.fromSchema(e.state.schema),a=_D(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=CD[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);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 h=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
|
|
470
|
+
|
|
471
|
+
`);return{dom:l,text:h,slice:t}}function wD(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",h=>{t=h(t,i||r,e)}),i)return t?new ae(K.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
472
|
+
`))),0,0):ae.empty;let d=e.someProp("clipboardTextParser",h=>h(t,o,r,e));if(d)a=d;else{let h=o.marks(),{schema:p}=e.state,m=Da.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let b=s.appendChild(document.createElement("p"));v&&b.appendChild(m.serializeNode(p.text(v,h)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),s=xee(n),pp&&bee(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 h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||yu.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!gee.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=wee(LT(a,+u[1],+u[2]),u[4]);else if(a=ae.maxOpen(vee(a.content,o),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=LT(a,d,h)}return e.someProp("transformPasted",d=>{a=d(a,e)}),a}const gee=/^(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 vee(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&&kD(l,i,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=ED(s[s.length-1],i.length));let u=SD(a,l);s.push(u),o=o.matchType(u.type),i=l}}),s)return K.from(s)}return e}function SD(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,K.from(e));return e}function kD(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=kD(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(K.from(SD(n,e,o+1))))}}function ED(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,ED(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(K.empty,!0);return e.copy(n.append(r))}function lw(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=lw(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(K.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function LT(e,t,n){return t<e.openStart&&(e=new ae(lw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ae(lw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const CD={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 FT=null;function _D(){return FT||(FT=document.implementation.createHTMLDocument("title"))}let n0=null;function yee(e){let t=window.trustedTypes;return t?(n0||(n0=t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),n0.createHTML(e)):e}function xee(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=_D().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&CD[r[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=yee(e),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function bee(e){let t=e.querySelectorAll(Fn?"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 wee(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=K.from(l.create(r[a+1],o)),i++,s++}return new ae(o,i,s)}const er={},tr={},See={touchstart:!0,touchmove:!0};class kee{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 Eee(e){for(let t in er){let n=er[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{_ee(e,r)&&!gk(e,r)&&(e.editable||!(r.type in tr))&&n(e,r)},See[t]?{passive:!0}:void 0)}Qn&&e.dom.addEventListener("input",()=>null),cw(e)}function Ys(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Cee(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 cw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>gk(e,r))})}function gk(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function _ee(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 Tee(e,t){!gk(e,t)&&er[t.type]&&(e.editable||!(t.type in tr))&&er[t.type](e,t)}tr.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(),!(To&&Fn&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),wu&&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,qa(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||mee(e,n)?n.preventDefault():Ys(e,"key")};tr.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};tr.keypress=(e,t)=>{let n=t;if(PD(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Xr&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Le)||!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 wy(e){return{left:e.clientX,top:e.clientY}}function Pee(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function vk(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 Kc(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 Nee(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(Kc(e,new Te(n)),!0):!1}function Oee(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof Te&&(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(Te.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?(Kc(e,Te.create(e.state.doc,o)),!0):!1}function Mee(e,t,n,r,o){return vk(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(o?Oee(e,n):Nee(e,n))}function jee(e,t,n,r){return vk(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function Ree(e,t,n,r){return vk(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||Iee(e,n,r)}function Iee(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(Kc(e,Le.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)Kc(e,Le.create(r,a+1,a+1+s.content.size));else if(Te.isSelectable(s))Kc(e,Te.create(r,a));else continue;return!0}}function yk(e){return Gg(e)}const TD=Xr?"metaKey":"ctrlKey";er.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=yk(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&Pee(n,e.input.lastClick)&&!n[TD]&&(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(wy(n));s&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Aee(e,s,n,!!r)):(i=="doubleClick"?jee:Ree)(e,s.pos,s.inside,n)?n.preventDefault():Ys(e,"pointer"))};class Aee{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[TD],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 Te&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ko&&!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)),Ys(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(()=>Ki(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(wy(t))),this.updateAllowDefault(t),this.allowDefault||!n?Ys(this.view,"pointer"):Mee(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Qn&&this.mightDrag&&!this.mightDrag.node.isAtom||Fn&&!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)?(Kc(this.view,Ke.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Ys(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ys(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)}}er.touchstart=e=>{e.input.lastTouch=Date.now(),yk(e),Ys(e,"pointer")};er.touchmove=e=>{e.input.lastTouch=Date.now(),Ys(e,"pointer")};er.contextmenu=e=>yk(e);function PD(e,t){return e.composing?!0:Qn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const Dee=To?5e3:-1;tr.compositionstart=tr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Le&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Gg(e,!0),e.markCursor=null;else if(Gg(e,!t.selection.empty),Ko&&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}ND(e,Dee)};tr.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++,ND(e,20))};function ND(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Gg(e),t))}function OD(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Fee());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Lee(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=NQ(t.focusNode,t.focusOffset),r=OQ(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 Fee(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Gg(e,t=!1){if(!(To&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),OD(e),t||e.docView&&e.docView.dirty){let n=pk(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 zee(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 ph=pr&&aa<15||wu&&AQ<604;er.copy=tr.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let i=ph?null:n.clipboardData,s=r.content(),{dom:a,text:l}=bD(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):zee(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Bee(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function $ee(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?mh(e,r.value,null,o,t):mh(e,r.textContent,r.innerHTML,o,t)},50)}function mh(e,t,n,r,o){let i=wD(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,i||ae.empty)))return!0;if(!i)return!1;let s=Bee(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 MD(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," "):""}tr.paste=(e,t)=>{let n=t;if(e.composing&&!To)return;let r=ph?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&mh(e,MD(r),r.getData("text/html"),o,n)?n.preventDefault():$ee(e,n)};class jD{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const RD=Xr?"altKey":"ctrlKey";er.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(wy(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Te?o.to-1:o.to))){if(r&&r.mightDrag)s=Te.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=Te.create(e.state.doc,d.posBefore))}}let a=(s||e.state.selection).content(),{dom:l,text:c,slice:u}=bD(e,a);(!n.dataTransfer.files.length||!Fn||oD>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ph?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ph||n.dataTransfer.setData("text/plain",c),e.dragging=new jD(u,!n[RD],s)};er.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};tr.dragover=tr.dragenter=(e,t)=>t.preventDefault();tr.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let o=e.posAtCoords(wy(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=wD(e,MD(n.dataTransfer),ph?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[RD]);if(e.someProp("handleDrop",m=>m(e,n,s||ae.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?K2(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,h=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(h))return;let p=c.doc.resolve(u);if(d&&Te.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Te(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,b,x,w)=>m=w),c.setSelection(mk(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};er.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())&&Ki(e)},20))};er.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)};er.beforeinput=(e,t)=>{if(Fn&&To&&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,qa(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 tr)er[e]=tr[e];function gh(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 qg{constructor(t,n){this.toDOM=t,this.spec=n||fl,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 Ct(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof qg&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&gh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class ca{constructor(t,n){this.attrs=t,this.spec=n||fl}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 Ct(i,s,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof ca&&gh(this.attrs,t.attrs)&&gh(this.spec,t.spec)}static is(t){return t.type instanceof ca}destroy(){}}class xk{constructor(t,n){this.attrs=t,this.spec=n||fl}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 Ct(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 xk&&gh(this.attrs,t.attrs)&&gh(this.spec,t.spec)}destroy(){}}class Ct{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Ct(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 Ct(t,t,new qg(n,r))}static inline(t,n,r,o){return new Ct(t,n,new ca(r,o))}static node(t,n,r,o){return new Ct(t,n,new xk(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ca}get widget(){return this.type instanceof qg}}const dc=[],fl={};class ot{constructor(t,n){this.local=t.length?t:dc,this.children=n.length?n:dc}static create(t,n){return n.length?Yg(n,t,0,fl):Dn}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==Dn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||fl)}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?Vee(this.children,s||[],t,n,r,o,i):s?new ot(s.sort(hl),dc):Dn}add(t,n){return n.length?this==Dn?ot.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=AD(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,Yg(u,a,c+1,fl)),i+=3}});let s=ID(i?DD(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new ot(s.length?this.local.concat(s).sort(hl):this.local,o||this.children)}remove(t){return t.length==0||this==Dn?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!=Dn?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 ot(o,r):Dn}forChild(t,n){if(this==Dn)return this;if(n.isLeaf)return ot.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 ca){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 ot(o.sort(hl),dc);return r?new zs([a,r]):a}return r||Dn}eq(t){if(this==t)return!0;if(!(t instanceof ot)||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 bk(this.localsInner(t))}localsInner(t){if(this==Dn)return dc;if(t.inlineContent||!this.local.some(ca.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ca||n.push(this.local[r]);return n}forEachSet(t){t(this)}}ot.empty=new ot([],[]);ot.removeOverlap=bk;const Dn=ot.empty;class zs{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,fl));return zs.from(r)}forChild(t,n){if(n.isLeaf)return ot.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(t,n);i!=Dn&&(i instanceof zs?r=r.concat(i.members):r.push(i))}return zs.from(r)}eq(t){if(!(t instanceof zs)||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?bk(r?n:n.sort(hl)):dc}static from(t){switch(t.length){case 0:return Dn;case 1:return t[0];default:return new zs(t.every(n=>n instanceof ot)?t:t.reduce((n,r)=>n.concat(r instanceof ot?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function Vee(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((h,p,m,v)=>{let b=v-m-(p-h);for(let x=0;x<a.length;x+=3){let w=a[x+1];if(w<0||h>w+u-d)continue;let S=a[x]+u-d;p>=S?a[x+1]=h<=S?-2:-1:h>=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 h=n.map(e[c+1]+i,-1),p=h-o,{index:m,offset:v}=r.content.findIndex(d),b=r.maybeChild(m);if(b&&v==d&&v+b.nodeSize==p){let x=a[c+2].mapInner(n,b,u+1,e[c]+i+1,s);x!=Dn?(a[c]=d,a[c+1]=p,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Uee(a,e,t,n,o,i,s),u=Yg(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,h=0;d<u.children.length;d+=3){let p=u.children[d];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ot(t.sort(hl),a)}function ID(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 Ct(o.from+t,o.to+t,o.type))}return n}function Uee(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 AD(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 DD(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Yg(e,t,n,r){let o=[],i=!1;t.forEach((a,l)=>{let c=AD(e,a,l+n);if(c){i=!0;let u=Yg(c,a,n+l+1,r);u!=Dn&&o.push(l,l+a.nodeSize,u)}});let s=ID(i?DD(e):e,-n).sort(hl);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 ot(s,o):Dn}function hl(e,t){return e.from-t.from||e.to-t.to}function bk(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),zT(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),zT(t,o,r.copy(i.from,r.to)));break}}}return t}function zT(e,t,n){for(;t<e.length&&hl(n,e[t])>0;)t++;e.splice(t,0,n)}function r0(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Dn&&t.push(r)}),e.cursorWrapper&&t.push(ot.create(e.state.doc,[e.cursorWrapper.deco])),zs.from(t)}const Hee={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Wee=pr&&aa<=11;class Kee{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 Gee{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Kee,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]);pr&&aa<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Wee&&(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,Hee)),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(MT(this.view)){if(this.suppressingSelectionUpdates)return Ki(this.view);if(pr&&aa<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&jl(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=hh(i))n.add(i);for(let i=t.anchorNode;i;i=hh(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)&&MT(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(Ko&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||Jee(t,d)!=p)&&h.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&&xy(r)&&(c=pk(t))&&c.eq(Ke.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Ki(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),qee(t)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Ki(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(pr&&aa<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(o=d),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(i=h)}let s=o&&o.parentNode==t.target?wn(o)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=i&&i.parentNode==t.target?wn(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 BT=new WeakMap,$T=!1;function qee(e){if(!BT.has(e)&&(BT.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Ko,$T)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."),$T=!0}}function VT(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return jl(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Yee(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return VT(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?VT(e,n):null}function Jee(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 Xee(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}],xy(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Fn&&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,h=e.someProp("domParser")||yu.fromSchema(e.state.schema),p=d.resolve(s),m=null,v=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Zee,context:p});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 Zee(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Qn&&/^(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||Qn&&/^(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 Qee=/^(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 ete(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let I=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,F=pk(e,I);if(F&&!e.state.selection.eq(F)){if(Fn&&To&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",$=>$(e,qa(13,"Enter"))))return;let H=e.state.tr.setSelection(F);I=="pointer"?H.setMeta("pointer",!0):I=="key"&&H.scrollIntoView(),i&&H.setMeta("composition",i),e.dispatch(H)}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=Xee(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),h,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,p="end"):(h=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=rte(d.content,c.doc.content,c.from,h,p);if(m&&e.input.domChangeCount++,(wu&&e.input.lastIOSEnter>Date.now()-225||To)&&o.some(I=>I.nodeType==1&&!Qee.test(I.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",I=>I(e,qa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Le&&!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 I=UT(e,e.state.doc,c.sel);if(I&&!I.eq(e.state.selection)){let F=e.state.tr.setSelection(I);i&&F.setMeta("composition",i),e.dispatch(F)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Le&&(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)),pr&&aa<=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,S;if((wu&&e.input.lastIOSEnter>Date.now()-225&&(!w||o.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!w&&v.pos<c.doc.content.size&&!v.sameParent(b)&&(S=Ke.findFrom(c.doc.resolve(v.pos+1),1,!0))&&S.head==b.pos)&&e.someProp("handleKeyDown",I=>I(e,qa(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&nte(u,m.start,m.endA,v,b)&&e.someProp("handleKeyDown",I=>I(e,qa(8,"Backspace")))){To&&Fn&&e.domObserver.suppressSelectionUpdates();return}Fn&&To&&m.endB==m.start&&(e.input.lastAndroidDelete=Date.now()),To&&!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(I){return I(e,qa(13,"Enter"))})},20));let C=m.start,_=m.endA,P,O,j;if(w){if(v.pos==b.pos)pr&&aa<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Ki(e),20)),P=e.state.tr.delete(C,_),O=u.resolve(m.start).marksAcross(u.resolve(m.endA));else if(m.endA==m.endB&&(j=tte(v.parent.content.cut(v.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start()))))P=e.state.tr,j.type=="add"?P.addMark(C,_,j.mark):P.removeMark(C,_,j.mark);else if(v.parent.child(v.index()).isText&&v.index()==b.index()-(b.textOffset?0:1)){let I=v.parent.textBetween(v.parentOffset,b.parentOffset);if(e.someProp("handleTextInput",F=>F(e,C,_,I)))return;P=e.state.tr.insertText(I,C,_)}}if(P||(P=e.state.tr.replace(C,_,c.doc.slice(m.start-c.from,m.endB-c.from))),c.sel){let I=UT(e,P.doc,c.sel);I&&!(Fn&&To&&e.composing&&I.empty&&(m.start!=m.endB||e.input.lastAndroidDelete<Date.now()-100)&&(I.head==C||I.head==P.mapping.map(_)-1)||pr&&I.empty&&I.head==C)&&P.setSelection(I)}O&&P.ensureMarks(O),i&&P.setMeta("composition",i),e.dispatch(P.scrollIntoView())}function UT(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:mk(e,t.resolve(n.anchor),t.resolve(n.head))}function tte(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(K.from(c).eq(e))return{mark:a,type:s}}function nte(e,t,n,r,o){if(n-t<=o.pos-r.pos||o0(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(o0(i,!0,!0));return!s.parent.isTextblock||s.pos>n||o0(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function o0(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 rte(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&&HT(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&&HT(e.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function HT(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 ote{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 kee,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(YT),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=GT(this),KT(this),this.nodeViews=qT(this),this.docView=CT(this.state.doc,WT(this),r0(this),this.dom,this),this.domObserver=new Gee(this,(r,o,i,s)=>ete(this,r,o,i,s)),this.domObserver.start(),Eee(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&&cw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(YT),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&&(OD(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 p=qT(this);ste(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&cw(this),this.editable=GT(this),KT(this);let l=r0(this),c=WT(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 h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&FQ(this);if(s){this.domObserver.stop();let p=d&&(pr||Fn)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&ite(o.selection,t.selection);if(d){let m=Fn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Lee(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=CT(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&lee(this))?Ki(this,p):(vD(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():h&&zQ(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Te){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&xT(this,n.getBoundingClientRect(),t)}else xT(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 jD(t.slice,t.move,o<0?void 0:Te.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(pr){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&&BQ(this.dom),Ki(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 WQ(this,t)}coordsAtPos(t,n=1){return cD(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 JQ(this,n||this.state,t)}pasteHTML(t,n){return mh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return mh(this,t,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Cee(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],r0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,TQ())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return Tee(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?Qn&&this.root.nodeType===11&&jQ(this.dom.ownerDocument)==this.dom&&Yee(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function WT(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"),[Ct.node(0,e.state.doc.content.size,t)]}function KT(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:Ct.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function GT(e){return!e.someProp("editable",t=>t(e.state)===!1)}function ite(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 qT(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 ste(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 YT(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 ate=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const lte=Ta(ate);function cte(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function ute(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function dte(e){return!!(!e.prev&&e.next)}function fte(e){return!!(e.prev&&!e.next)}function hte(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function pte(e){return e==="invalid-exit-split"}var mte=["jump-backward-exit","jump-forward-exit"],gte=["jump-backward-change","jump-forward-change"];function vte(e){var t,n;return Wo(mte,(t=e.exit)==null?void 0:t.exitReason)||Wo(gte,(n=e.change)==null?void 0:n.changeReason)}function JT(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function XT(e){return Un(e)&&e instanceof Le}function cr(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function yte(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(dw(n)).test(e):new RegExp(dw(r)).test(e)}function xte(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,i=r.start();let s;return vy(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if(yte(l,o)){const c=a.index+i,u=a[0],d=a[1];if(!Ie(u)||!Ie(d))return;const h=c+u.length,p=Math.min(h,r.pos),m=p-c;c<r.pos&&h>=r.pos&&(s={range:{from:c,to:h,cursor:p},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(h,r.end(),Gs,Gs),textBefore:r.doc.textBetween(i,c,Gs,Gs),suggester:o})}}),s}function LD(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=Pte({char:r,matchOffset:a,startOfLine:i,supportedCharacters:s,multiline:l,caseInsensitive:c,unicode:u}),h=t.doc.textBetween(t.before(),t.end(),Gs,Gs);return xte({suggester:n,text:h,regexp:d,$pos:t,char:r,name:o})}function FD(e){const{state:t,match:n}=e;try{return LD({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function zD(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:cr({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:cr({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:cr({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:cr({match:n,exitReason:"exit-split"})}:{}}function bte(e){const{prev:t,next:n,state:r}=e,o=we(),i=FD({state:r,match:t}),{exit:s}=i&&i.query.full!==t.query.full?zD({prev:t,next:i,state:r}):o;return t.range.from<n.range.from?{exit:s??cr({match:t,exitReason:"jump-forward-exit"}),change:cr({match:n,changeReason:"jump-forward-change"})}:{exit:s??cr({match:t,exitReason:"jump-backward-exit"}),change:cr({match:n,changeReason:"jump-backward-change"})}}function wte(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,i=FD({match:t,state:n});return!i||i.text.full!==t.text.full?zD({prev:t,next:i,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:cr({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:cr({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:cr({match:t,exitReason:"move-start"})}:{}}function Ste(e){const{prev:t,next:n,state:r,$pos:o}=e,i=we();if(!t&&!n)return i;const s={prev:t,next:n};return hte(s)?bte({prev:s.prev,next:s.next,state:r}):dte(s)?{change:cr({match:s.next,changeReason:"start"})}:fte(s)?wte({$pos:o,match:s.prev,state:r}):cte(s)?{change:cr({match:s.next,changeReason:"change-character"})}:ute(s)?{change:cr({match:s.next,changeReason:r.selection.empty?"move":"selection-inside"})}:i}function ZT(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 uw(e,t){const{$from:n,$to:r}=e;return BD(e,t)?!0:v2(n.pos,r.pos).some(o=>kte(n.doc.resolve(o),t))}function BD(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 kte(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function Ete(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:i,invalidNodes:s}=e;return!r&&!o&&Sa(i)&&Sa(s)?!0:!(r&&!BD(t,r)||o&&!ZT(n,o)||!r&&uw(t,i)||!o&&ZT(n,s))}function QT(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const i=LD({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(Ete(o,s)&&o.isValidPosition(s,i))return i}catch{}}function dw(e){return FX(e)?e.source:e}function Cte(e){return e?"^":""}function _te(e,t){return`(?:${dw(e)}){${t},}`}function Tte(e){return Ie(e)?new RegExp(lte(e)):e}function Pte(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=Tte(t).source;return i&&(u=`(${u})`),new RegExp(`${Cte(r)}${u}${_te(o,n)}`,c)}var Nte={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__",Mh,qc,Zt,Li,nl,Eo,Wt,Fi,rl,Yc,Ote=(Yc=class{constructor(t){jn(this,Mh,!1);jn(this,qc,!1);jn(this,Zt);jn(this,Li);jn(this,nl);jn(this,Eo,we());zt(this,"view");jn(this,Wt,ot.empty);jn(this,Fi,!1);jn(this,rl,!1);zt(this,"setMarkRemoved",()=>{Je(this,Fi,!0)});zt(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),i=Ke.findFrom(o,1,!0);if(XT(i))return i});zt(this,"ignoreNextExit",()=>{Je(this,qc,!0)});zt(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=ue(this,Zt).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const i=Ie(o.char)?o.char.length:1,s=t+i,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=Ct.inline(t,s,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});Je(this,Wt,ue(this,Wt).add(this.view.state.doc,[l]))});zt(this,"removeIgnored",({from:t,name:n})=>{const r=ue(this,Zt).find(s=>s.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=Ie(r.char)?r.char.length:1,i=ue(this,Wt).find(t,t+o)[0];!i||i.spec.name!==n||Je(this,Wt,ue(this,Wt).remove([i]))});zt(this,"clearIgnored",t=>{if(!t){Je(this,Wt,ot.empty);return}const r=ue(this,Wt).find().filter(({spec:o})=>o.name===t);Je(this,Wt,ue(this,Wt).remove(r))});zt(this,"findMatchAtPosition",(t,n)=>{const r=n?ue(this,Zt).filter(o=>o.name===n):ue(this,Zt);return QT({suggesters:r,$pos:t,docChanged:!1,selectionEmpty:!0})});zt(this,"setLastChangeFromAppend",()=>{Je(this,rl,!0)});const n=eP();Je(this,Zt,t.map(n)),Je(this,Zt,Nl(ue(this,Zt),(r,o)=>o.priority-r.priority))}static create(t){return new Yc(t)}get decorationSet(){return ue(this,Wt)}get removed(){return ue(this,Fi)}get match(){return ue(this,Li)?ue(this,Li):ue(this,nl)&&ue(this,Eo).exit?ue(this,nl):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 ue(this,qc)?(Je(this,qc,!1),!1):!0}updateWithNextSelection(t){var r,o,i;const n=this.findNextTextSelection(t.selection);if(n)for(const s of ue(this,Zt)){const a=(r=ue(this,Eo).change)==null?void 0:r.suggester.name,l=(o=ue(this,Eo).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}=ue(this,Eo),i=this.match;if(!r&&!o||!JT(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&&vte({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&&Je(this,Fi,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&s&&(o.suggester.onChange(this.createProps(o),t),Je(this,Fi,!1),pte(o.exitReason)&&Je(this,Eo,we()))}}mapIgnoredDecorations(t){const n=ue(this,Wt).map(t.mapping,t.doc),o=n.find().filter(({from:i,to:s,spec:a})=>{const l=Ie(a.char)?a.char.length:1;return s-i!==l});Je(this,Wt,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return ue(this,Wt).find().some(({spec:i,from:s})=>s!==t.from?!1:i.specific?i.name===n:!0)}resetState(){Je(this,Eo,we()),Je(this,Li,void 0),Je(this,Fi,!1),Je(this,rl,!1)}updateReasons(t){const{$pos:n,state:r}=t,o=ue(this,Mh),i=ue(this,Zt),s=r.selection.empty,a=XT(r.selection)?QT({suggesters:i,$pos:n,docChanged:o,selectionEmpty:s}):void 0;Je(this,Li,a&&this.shouldIgnoreMatch(a)?void 0:a),Je(this,Eo,Ste({next:ue(this,Li),prev:ue(this,nl),state:r,$pos:n}))}addSuggester(t){const n=ue(this,Zt).find(o=>o.name===t.name),r=eP();if(n)Je(this,Zt,ue(this,Zt).map(o=>o===n?r(t):o));else{const o=[...ue(this,Zt),r(t)];Je(this,Zt,Nl(o,(i,s)=>s.priority-i.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=Ie(t)?t:t.name;Je(this,Zt,ue(this,Zt).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=ue(this,Eo);if(ue(this,rl)&&(Je(this,rl,!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&&!ue(this,Fi)?this:(Je(this,Mh,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),Je(this,nl,ue(this,Li)),this.updateReasons({$pos:o.selection.$from,state:i}),this)}createDecorations(t){const n=this.match;if(!JT(n))return ue(this,Wt);const{disableDecorations:r}=n.suggester;if(_t(r)?r(t,n):r)return ue(this,Wt);const{range:i,suggester:s}=n,{name:a,suggestTag:l,suggestClassName:c}=s,{from:u,to:d}=i;return this.shouldIgnoreMatch(n)?ue(this,Wt):ue(this,Wt).add(t.doc,[Ct.inline(u,d,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},Mh=new WeakMap,qc=new WeakMap,Zt=new WeakMap,Li=new WeakMap,nl=new WeakMap,Eo=new WeakMap,Wt=new WeakMap,Fi=new WeakMap,rl=new WeakMap,Yc);function eP(){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={...Nte,...t};return e.add(t.name),n}}var VD=new Ku("suggest");function wk(e){return VD.getState(e)}function tP(e,t){return wk(e).addSuggester(t)}function nP(e){e.setMeta($D,!0)}function Mte(e,t){return wk(e).removeSuggester(t)}function jte(...e){const t=Ote.create(e);return new cs({key:VD,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 Sk(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,i=e.storedMarks;const s=we();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 vf(e){return({state:t,dispatch:n,view:r,tr:o})=>e(Sk(o,t),n,r)}function rP(e){return t=>{var n;return Ee(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:re.NON_CHAINABLE_COMMAND}),e(t)}}function Rte(...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 Po={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isJSDOM(){return Po.isBrowser&&window.navigator.userAgent.includes("jsdom")},get isNode(){return typeof process<"u"&&process.versions!=null&&process.versions.node!=null},get isIos(){return Po.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return Po.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isApple(){return Po.isNode?process.platform==="darwin":Po.isBrowser?/Mac|iPod|iPhone|iPad/.test(window.navigator.platform):!1},get isDevelopment(){return!1},get isTest(){return!1},get isProduction(){return!0}};function Ss(e,t){var n;const r=ine(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 fw(e){return Un(e)&&Br(e.nodeType)&&Ie(e.nodeName)}function vi(e){return fw(e)&&e.nodeType===1}function kk(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return on(t)?t.some(r):r(t)}function Ite(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Sy(e){const{predicate:t,selection:n}=e,r=HD(n)?n.selection.$from:_k(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 Ate(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 vh(e){const{types:t,selection:n}=e;return Sy({predicate:r=>kk({types:t,node:r}),selection:n})}function Dte(e){const{types:t,selection:n}=e;if(!(!Ey(n)||!kk({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 Ek(e){return _k(e)?e.empty:e.selection.empty}function Lte(e){return e.docChanged||e.selectionSet}function Fte(e){return!!yh(e)}function yh(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:i}=t,s=Ie(n)?i.type.schema.nodes[n]:n;Ee(s,{code:re.SCHEMA,message:`No node exists for ${n}`});const a=Dte({selection:o,types:n})??Sy({predicate:l=>l.type===s,selection:o});return!r||Ig(r)||!a||a.node.hasMarkup(s,{...a.node.attrs,...r})?a:void 0}function Jg(...e){return t=>{if(!G_(e))return!1;const[n,...r]=e;let o=!1;const i=(...l)=>()=>{if(!G_(l))return!1;o=!0;const[,...c]=l;return Jg(...l)({...t,next:i(...c)})},s=i(...r),a=n({...t,next:s});return o||a?a:s()}}function zte(e,t){const n=new Map,r=we();for(const o of e)for(const[i,s]of rn(o)){const l=[...n.get(i)??[],s],c=Jg(...l);n.set(i,l),r[i]=t(c)}return r}function Bte(e){return zte(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function Ck(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function $te(e){return KD(e,[Vi,Ut,hn,jo])}function Gu(e){return Un(e)}function qu(e,t){return on(t)?Wo(t,e[rs]):t===e[rs]}function Vte(e){return Un(e)&&e instanceof Xb}function Ute(e,t){return Ie(e)?Mt(t.nodes,e):e}function UD(e){return Un(e)&&e instanceof dp}function Hte(e,t){return Ie(e)?Mt(t.marks,e):e}function ky(e){return Un(e)&&e instanceof sa}function Wte(e){return Un(e)&&e instanceof K}function Kte(e){return Un(e)&&e instanceof tt}function HD(e){return Un(e)&&e instanceof Qa}function Ul(e){return Un(e)&&e instanceof Le}function Gte(e){return Un(e)&&e instanceof Jn}function _k(e){return Un(e)&&e instanceof Ke}function qte(e){return Un(e)&&e instanceof vu}function oP(e){const{trState:t,from:n,to:r,type:o,attrs:i={}}=e,{doc:s}=t,a=Hte(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:Ck(d,i)),!l)),l}function Ey(e){return Un(e)&&e instanceof Te}function Xg(e){const{trState:t,type:n,attrs:r={},from:o,to:i}=e,{selection:s,doc:a,storedMarks:l}=t,c=Ie(n)?a.type.schema.marks[n]:n;if(Ee(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&i)try{return Math.max(o,i)<a.nodeSize&&oP({...e,from:o,to:i})}catch{return!1}return s.empty?(l??s.$from.marks()).some(d=>d.type!==n?!1:Ck(d,r??{})):oP({...e,from:s.from,to:s.to})}function Tk(e,t={}){const n=Yte(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?WD(n,e):o?n.content.eq(e.content):n.eq(e)}function WD(e,t){if(e===t)return!0;const n=e.type===t.type&&tt.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||!WD(a,l))return!1}return!0}return n&&r()}function Yte(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function Cy(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;Ee(!1,{code:re.SCHEMA,message:"No default block node found for the provided schema."})}function Jte(e){return e.type===Cy(e.type.schema)}function Pk(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function is(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=Ie(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?is(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,s2,`
|
|
473
|
+
|
|
474
|
+
`);return{from:a,to:c,text:u,mark:i}}function KD(e,t){return t.length===0||t.some(n=>e instanceof n)}function Xte(e){return g2(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 Zte(e,t=[]){const n=[],{steps:r,mapping:o}=e,i=o.invert();r.forEach((a,l)=>{if(!KD(a,t))return;const c=[],u=a.getMap(),d=o.slice(l);if(u.ranges.length===0&&$te(a)){const{from:h,to:p}=a;c.push({from:h,to:p})}else u.forEach((h,p)=>{c.push({from:h,to:p})});c.forEach(h=>{const p=d.map(h.from,-1),m=d.map(h.to);n.push({from:p,to:m,prevFrom:i.map(p,-1),prevTo:i.map(m)})})});const s=Nl(n,(a,l)=>a.from-l.from);return Xte(s)}function Qte(e){var t;return((t=e.content.firstChild)==null?void 0:t.textContent)??""}function ene(e,t){if(!Ul(e.selection))return;let{from:n,to:r}=e.selection;const o=(s,a)=>Qte(Le.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,s2,`
|
|
475
|
+
|
|
476
|
+
`);return{from:n,to:r,text:i}}function GD(e){return ene(e,/\W/)}function yf(e,t=0){const n=on(e)?e[t]:e;return f2(Ie(n),`No match string found for match ${e}`),n??""}function tne(e){return Ul(e)?e.$cursor:void 0}function nne(e,t){return ky(e)?t?e.type===t.nodes.doc:e.type.name==="doc":!1}function rne(e){return Un(e)&&Br(e.anchor)&&Br(e.head)}function lo(e,t){const n=t.nodeSize-2,r=0;let o;const i=l=>HX({min:r,max:n,value:l});if(_k(e))return e;if(e==="all")return new Jn(t);if(e==="start"?o=r:e==="end"?o=n:qte(e)?o=e.pos:o=e,Br(o))return o=i(o),Le.near(t.resolve(o));if(rne(o)){const l=i(o.anchor),c=i(o.head);return Le.between(t.resolve(l),t.resolve(c))}const s=i(o.from),a=i(o.to);return Le.between(t.resolve(s),t.resolve(a))}var one=3;function qD(e){const{content:t,schema:n,document:r,stringHandler:o,onError:i,attempts:s=0}=e,a=i&&s<=one||s===0;if(Ee(a,{code:re.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."}),Ie(t))return Ee(o,{code:re.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(HD(t))return t.doc;if(ky(t))return t;try{return n.nodeFromJSON(t)}catch(l){const c=dne({schema:n,error:l,json:t}),u=i==null?void 0:i(c);return Ee(u,{code:re.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)}`}),qD({...e,content:u,attempts:s+1})}}function _y(){const e=Q2();if(e)return e;throw new Error(`Unable to retrieve the document from the global scope.
|
|
477
|
+
It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
|
|
478
|
+
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).
|
|
479
|
+
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).
|
|
480
|
+
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 YD(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=Q2())==null?void 0:t.defaultView)}function ine(e){return YD(e==null?void 0:e.ownerDocument)}function sne(e){const t=YD(e)??_y().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function ane(e,t=_y()){const n=nne(e,e.type.schema)?e.content:K.from(e);return Da.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function lne(e,t){return new(sne(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function cne(e,t=_y()){const n=t.createElement("div");return n.append(ane(e,t)),n.innerHTML}function hw(e){const{content:t,schema:n,document:r,fragment:o=!1,...i}=e,s=lne(t,r),a=yu.fromSchema(n);return o?a.parseSlice(s,{...iP,...i}).content:a.parse(s,{...iP,...i})}var iP={preserveWhitespace:!1};function JD(e,t){const n=uh(t.defaults());return ok({...e},n)}var une={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=GX(r.path,n));return n}};function dne({json:e,schema:t,...n}){const r=new Set(uh(t.marks)),o=new Set(uh(t.nodes)),i=XD({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:i,transformers:une,...n}}function XD(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 h=[];for(const[p,m]of l.entries()){const v=Ie(m)?m:m.type;n.has(v)||(h.unshift({name:v,path:[...o,"marks",`${p}`],type:"mark",invalidParentMark:u,invalidParentNode:d}),u=!0)}s.push(...h)}if(r.has(a)||(s.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:d}),d=!0),c){const h=[];for(const[p,m]of c.entries())h.unshift(...XD({...i,json:m,path:[...o,"content",`${p}`],invalidParentMark:u,invalidParentNode:d}));s.unshift(...h)}return s}function fne(e){return!!(Ul(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function pw(e){return!!(Ul(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function sP(e){const t=Ke.atStart(e.$anchor.doc);return!!(pw(e)&&t.anchor===e.anchor)}function hne(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=we(),appendText:i,range:s}=e,a=s?Le.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,h=>{if(d)return!1;if(h.inlineContent&&h.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 pne({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Wu(o);return!Br(i)||!o?!1:(t==null||t(e.lift(o,i).scrollIntoView()),!0)}function ZD(e,t={},n){return function(r){const{tr:o,dispatch:i,state:s}=r,a=Ie(e)?Mt(s.schema.nodes,e):e,{from:l,to:c}=lo(n??o.selection,o.doc),u=o.doc.resolve(l),d=o.doc.resolve(c),h=u.blockRange(d),p=h&&lk(h,a,t);return!p||!h?!1:(i==null||i(o.wrap(h,p).scrollIntoView()),!0)}}function mne(e,t={},n){return r=>{const{tr:o,state:i}=r,s=Ie(e)?Mt(i.schema.nodes,e):e;return yh({state:o,type:s,attrs:t})?pne(r):ZD(e,t,n)(r)}}function Zg(e,t,n,r=!0){return function(o){const{tr:i,dispatch:s,state:a}=o,l=Ie(e)?Mt(a.schema.nodes,e):e,{from:c,to:u}=lo(n??i.selection,i.doc);let d=!1,h;return i.doc.nodesBetween(c,u,(p,m)=>{if(d)return!1;if(!p.isTextblock||p.hasMarkup(l,t))return;if(p.type===l){d=!0,h=p.attrs;return}const v=i.doc.resolve(m),b=v.index();d=v.parent.canReplaceWith(b,b+1,l),d&&(h=v.parent.attrs)}),d?(s==null||s(i.setBlockType(c,u,l,{...r?h:{},...t}).scrollIntoView()),!0):!1}}function QD(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:i,preserveAttrs:s=!0}=e,a=yh({state:n,type:o,attrs:i}),l=e.toggleType??Cy(r.schema);if(a)return Zg(l,{...s?a.node.attrs:{},...i})(t);const c=yh({state:n,type:l,attrs:i});return Zg(o,{...s?c==null?void 0:c.node.attrs:{},...i})(t)}}function gne(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(Mt(t,2),10)>=e:!1}function vne(e,t){let{head:n,empty:r,anchor:o}=e;for(const i of t.steps)n=i.getMap().map(n);r?t.setSelection(Le.near(t.doc.resolve(n))):t.setSelection(Le.between(t.doc.resolve(o),t.doc.resolve(n)))}function yne(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=lo(e.selection??i??a.selection,a.doc),h=d.$from.index(),{from:p,to:m,$from:v}=d,b=Ie(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(Ee(Ie(e.type)?b:!0,{code:re.SCHEMA,message:`Schema contains no marks or nodes with name ${b}`}),Vte(b)){if(!v.parent.canReplaceWith(h,h,b))return!1;a.replaceWith(p,m,b.create(t,r?u.text(r):void 0))}else Ee(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(p,m,u.text(r,UD(b)?[b.create(t)]:void 0));return n&&a.insertText(n),o&&vne(s.selection,a),l&&(gne(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function eL(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 eL(e.doc.resolve(s+1))}function tL(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:i=!0,range:s}=e,a=lo(e.selection??s??n.selection,n.doc);let{from:l,to:c,$from:u,$to:d}=a;const h=Ie(o)?r.schema.marks[o]:o;h!==null&&Ee(h,{code:re.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const p=h??eL(u);if(!p)return!1;const m=is(u,p,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,Br(c)?c:l,UD(h)?h:void 0)),!0}}function Qg(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 ho(t,(d,h,p,m)=>{const{tr:v,schema:b}=d;c||(c=Ie(n)?b.marks[n]:n,Ee(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let x=h[1],w=h[0];const S=xne({captureGroup:x,fullMatch:w,end:m,start:p,rule:u,state:d,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:s});if(!S)return null;({start:p,end:m,captureGroup:x,fullMatch:w}=S);const C=_t(r)?r(h):r;let _=m,P=[];if(x){const O=w.search(/\S/),j=p+w.indexOf(x),I=j+x.length;P=v.storedMarks??[],I<m&&v.delete(I,m),j>p&&v.delete(p+O,j),_=p+O+x.length}return v.addMark(p,_,c.create(C)),v.setStoredMarks(P),i==null||i({tr:v,match:h,start:p,end:m}),v});return u}function xne({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 h=l.doc.resolve(r),p=l.doc.resolve(n);return c&&uw({$from:h,$to:p},c)||o.invalidMarks&&uw({$from:h,$to:p},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 bne=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(" ")},wne=bne;const nL=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Sne(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const rL=(e,t,n)=>{let r=Sne(e,n);if(!r)return!1;let o=oL(r);if(!o){let s=r.blockRange(),a=s&&Wu(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(aL(e,o,t,-1))return!0;if(r.parent.content.size==0&&(Su(i,"end")||Te.isSelectable(i)))for(let s=r.depth;;s--){let a=ck(e.doc,r.before(s),r.after(s),ae.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(Su(i,"end")?Ke.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Te.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 Su(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 kne=(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=oL(r)}let s=i&&i.nodeBefore;return!s||!Te.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Te.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function oL(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 Ene(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Cne=(e,t,n)=>{let r=Ene(e,n);if(!r)return!1;let o=iL(r);if(!o)return!1;let i=o.nodeAfter;if(aL(e,o,t,1))return!0;if(r.parent.content.size==0&&(Su(i,"start")||Te.isSelectable(i))){let s=ck(e.doc,r.before(),r.after(),ae.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=e.tr.step(s);a.setSelection(Su(i,"start")?Ke.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Te.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},_ne=(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=iL(r)}let s=i&&i.nodeAfter;return!s||!Te.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Te.create(e.doc,i.pos)).scrollIntoView()),!0)};function iL(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 Tne=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
481
|
+
`).scrollIntoView()),!0)};function Nk(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 sL=(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=Nk(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(Ke.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Pne=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Jn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Nk(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(Le.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},Nne=(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(Hc(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Wu(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function One(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof Te&&t.selection.node.isBlock)return!r.parentOffset||!Hc(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 p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=Nk(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof Le||t.selection instanceof Jn)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=Hc(u.doc,d,i.length,i);if(h||(i[0]=a?{type:a}:null,h=Hc(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),m=u.doc.resolve(p);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 Mne=One(),jne=(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(Te.create(e.doc,o))),!0)},Rne=(e,t)=>(t&&t(e.tr.setSelection(new Jn(e.doc))),!0);function Ine(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||fp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function aL(e,t,n,r){let o=t.nodeBefore,i=t.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&Ine(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 p=t.pos+i.nodeSize,m=K.empty;for(let x=s.length-1;x>=0;x--)m=K.from(s[x].create(null,m));m=K.from(o.copy(m));let v=e.tr.step(new Ut(t.pos-1,p,t.pos,p,new ae(m,1,0),s.length,!0)),b=v.doc.resolve(p+2*s.length);b.nodeAfter&&b.nodeAfter.type==o.type&&fp(v.doc,b.pos)&&v.join(b.pos),n(v.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Ke.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),h=d&&Wu(d);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(c&&Su(i,"start",!0)&&Su(o,"end")){let p=o,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let v=i,b=1;for(;!v.isTextblock;v=v.firstChild)b++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(n){let x=K.empty;for(let S=m.length-1;S>=0;S--)x=K.from(m[S].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 ae(x,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function lL(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(Le.create(t.doc,e<0?o.start(i):o.end(i)))),!0):!1}}const Ane=lL(-1),Dne=lL(1);function Lne(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 Fne(e,t=null,n){let r=n!==!1;return function(o,i){let{empty:s,$cursor:a,ranges:l}=o.selection;if(s&&!a||!Lne(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:h,$to:p}=l[d];if(!c)u.removeMark(h.pos,p.pos,e);else{let m=h.pos,v=p.pos,b=h.nodeAfter,x=p.nodeBefore,w=b&&b.isText?/^\s*/.exec(b.text)[0].length:0,S=x&&x.isText?/\s*$/.exec(x.text)[0].length:0;m+w<v&&(m+=w,v-=S),u.addMark(m,v,e.create(t))}}i(u.scrollIntoView())}return!0}}function Ty(...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 i0=Ty(nL,rL,kne),aP=Ty(nL,Cne,_ne);const Di={Enter:Ty(Tne,Pne,Nne,Mne),"Mod-Enter":sL,Backspace:i0,"Mod-Backspace":i0,"Shift-Backspace":i0,Delete:aP,"Mod-Delete":aP,"Mod-a":Rne},cL={"Ctrl-h":Di.Backspace,"Alt-Backspace":Di["Mod-Backspace"],"Ctrl-d":Di.Delete,"Ctrl-Alt-Backspace":Di["Mod-Delete"],"Alt-Delete":Di["Mod-Delete"],"Alt-d":Di["Mod-Delete"],"Ctrl-a":Ane,"Ctrl-e":Dne};for(let e in Di)cL[e]=Di[e];const zne=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,s0=zne?cL:Di;var Ea={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:"'"},ev={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Bne=typeof navigator<"u"&&/Mac/.test(navigator.platform),$ne=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Sn=0;Sn<10;Sn++)Ea[48+Sn]=Ea[96+Sn]=String(Sn);for(var Sn=1;Sn<=24;Sn++)Ea[Sn+111]="F"+Sn;for(var Sn=65;Sn<=90;Sn++)Ea[Sn]=String.fromCharCode(Sn+32),ev[Sn]=String.fromCharCode(Sn);for(var a0 in Ea)ev.hasOwnProperty(a0)||(ev[a0]=Ea[a0]);function Vne(e){var t=Bne&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||$ne&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?ev:Ea)[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 Une=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Hne(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))Une?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 Wne(e){let t=Object.create(null);for(let n in e)t[Hne(n)]=e[n];return t}function l0(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 uL(e){let t=Wne(e);return function(n,r){let o=Vne(r),i,s=t[l0(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[l0(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=Ea[r.keyCode])&&i!=o){let a=t[l0(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function Kne(e){const t=Nl(e,(i,s)=>(s.priority??ft.Low)-(i.priority??ft.Low)),n=[],r=[];for(const i of t)Qne(i)?n.push(i):r.push(i);let o;return new cs({key:Gne,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(h=>h.type.name));for(const h of n){if((c=h.ignoredNodes)!=null&&c.includes(a)||(u=h.ignoredMarks)!=null&&u.some(w=>l.has(w)))continue;const p=((d=i.content.firstChild)==null?void 0:d.textContent)??"",m=!o.state.selection.empty&&i.content.childCount===1&&p,v=vy(p,h.regexp)[0];if(m&&v&&h.type==="mark"&&h.replaceSelection){const{from:w,to:S}=o.state.selection,C=o.state.doc.slice(w,S),_=C.content.textBetween(0,C.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(_):h.replaceSelection){const P=[],{getAttributes:O,markType:j}=h,I=_t(O)?O(v,!0):O,F=j.create(I);return C.content.forEach(H=>{if(H.isText){const $=F.addToSet(H.marks);P.push(H.mark($))}}),ae.maxOpen(K.fromArray(P))}}const{nodes:b,transformed:x}=Xne(i.content,h,o.state.schema);x&&(i=h.type==="node"&&h.nodeType.isBlock?new ae(K.fromArray(b),0,0):new ae(K.fromArray(b),i.openStart,i.openEnd))}return rre(i)},handleDOMEvents:{paste:(i,s)=>{var d,h;const a=s;if(!((h=(d=i.props).editable)!=null&&h.call(d,i.state)))return!1;const{clipboardData:l}=a;if(!l)return!1;const c=[...l.items].map(p=>p.getAsFile()).filter(p=>!!p);if(c.length===0)return!1;const{selection:u}=i.state;for(const{fileHandler:p,regexp:m}of r){const v=m?c.filter(b=>m.test(b.type)):c;if(v.length!==0&&p({event:a,files:v,selection:u,view:i,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(i,s)=>{var p,m,v;const a=s;if(!((m=(p=i.props).editable)!=null&&m.call(p,i.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const d=nre(a);if(d.length===0)return!1;const h=((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(S=>x.test(S.type)):d;if(w.length!==0&&b({event:a,files:w,pos:h,view:i,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var Gne=new Ku("pasteRule");function c0(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(h=>{if(u!=null&&u.includes(h.type.name)||ere(h)){s.push(h);return}if(!h.isText){const v=n({fragment:h.content,rule:i,nodes:[]});d||(d=v.transformed);const b=K.fromArray(v.nodes);h.type.validContent(b)?s.push(h.copy(b)):s.push(...v.nodes);return}if(h.marks.some(v=>tre(v)||(c==null?void 0:c.includes(v.type.name)))){s.push(h);return}const p=h.text??"";let m=0;for(const v of vy(p,a)){const b=v[1],x=v[0];if(l&&(b==null?void 0:b.trim())===""||!x)return;const w=v.index,S=w+x.length;w>m&&s.push(h.cut(m,w));let C=h.cut(w,S);if(x&&b){const _=x.search(/\S/),P=w+x.indexOf(b),O=P+b.length;_&&s.push(h.cut(w,w+_)),C=h.cut(P,O)}e({nodes:s,rule:i,textNode:C,match:v,schema:t}),d=!0,m=S}p&&m<p.length&&s.push(h.cut(m))}),{nodes:s,transformed:d}}}function qne(e){const{nodes:t,rule:n,textNode:r,match:o,schema:i}=e,{transformMatch:s,getAttributes:a,markType:l}=n,c=_t(a)?a(o,!1):a,u=r.text??"",d=l.create(c),h=s==null?void 0:s(o);if(h==="")return;if(h===!1){t.push(i.text(u,r.marks));return}const p=d.addToSet(r.marks);t.push(i.text(h??u,p))}function Yne(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 Jne(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:i,nodeType:s,getContent:a}=n,l=_t(i)?i(o,!1):i,c=(a?a(o):r)||void 0;t.push(s.createChecked(l,c))}function Xne(e,t,n){const r=[];switch(t.type){case"mark":return c0(qne,n)({fragment:e,nodes:r,rule:t});case"node":return c0(Jne,n)({fragment:e,nodes:r,rule:t});default:return c0(Yne,n)({fragment:e,nodes:r,rule:t})}}var Zne=["mark","node","text"];function Qne(e){return Wo(Zne,e.type)}function ere(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function tre(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function nre(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 rre(e){const t=ae.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var ore=Object.defineProperty,ire=Object.getOwnPropertyDescriptor,ge=(e,t,n,r)=>{for(var o=r>1?void 0:r?ire(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&&ore(t,n,o),o},dL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},le=(e,t,n)=>(dL(e,t,"read from private field"),n?n.call(e):t.get(e)),Kt=(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)},cn=(e,t,n,r)=>(dL(e,t,"write to private field"),t.set(e,n),n);function sre(e,t){return e===t}function lP(e){const{previousOptions:t,update:n,equals:r=sre}=e,o=Za({...t,...n}),i=we(),s=uh(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=we();for(const u of l){const d=i[u];d!=null&&d.changed&&(c[u]=d.value)}return c};return{changes:Za(i),options:o,pickChanged:a}}var are={[re.DUPLICATE_HELPER_NAMES]:"helper method",[re.DUPLICATE_COMMAND_NAMES]:"command method"};function fL(e){const{name:t,set:n,code:r}=e,o=are[r];Ee(!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 mw(...e){return dh(wne(...e).split(" ")).join(" ")}var cP="__IGNORE__",lre="__ALL__",Yu=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=we(),this.populateMappedHandlers(),this._options=this._initialOptions=UX(e,this.constructor.defaultOptions,t??we(),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 uh(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}=lP({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}=lP({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 ok(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=we();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,cre(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]=Nl(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??m2}};Yu.defaultOptions={};Yu.staticKeys=[];Yu.handlerKeys=[];Yu.handlerKeyOptions={};Yu.customHandlerKeys=[];function cre(e,t,n){const{[lre]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==cP&&(_t(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==cP&&(_t(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var Py=class extends Yu{constructor(...e){super(ure,...e),this["~E"]={},this._extensions=g2(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`${d2(this.name)}Extension`}get store(){return Ee(this._store,{code:re.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."}),Za(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 Ee(t,{code:re.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}};Py.defaultPriority=ft.Default;var Tt=class extends Py{static get[rs](){return mn.PlainExtensionConstructor}get[rs](){return mn.PlainExtension}},gp=class extends Py{static get[rs](){return mn.MarkExtensionConstructor}get[rs](){return mn.MarkExtension}get type(){return Mt(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};gp.disableExtraAttributes=!1;var po=class extends Py{static get[rs](){return mn.NodeExtensionConstructor}get[rs](){return mn.NodeExtension}get type(){return Mt(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};po.disableExtraAttributes=!1;var ure={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function hL(e){return Gu(e)&&qu(e,[mn.PlainExtension,mn.MarkExtension,mn.NodeExtension])}function dre(e){return Gu(e)&&qu(e,[mn.PlainExtensionConstructor,mn.MarkExtensionConstructor,mn.NodeExtensionConstructor])}function pL(e){return Gu(e)&&qu(e,mn.PlainExtension)}function vp(e){return Gu(e)&&qu(e,mn.NodeExtension)}function Ny(e){return Gu(e)&&qu(e,mn.MarkExtension)}function rt(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 fre=class extends Tt{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=we(),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=we(),(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:mw(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(i)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:mw(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 ye(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function Gr(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var hre=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 xh(e){const{type:t,attrs:n,range:r,selection:o}=e;return i=>{const{dispatch:s,tr:a,state:l}=i,c=Ie(t)?l.schema.marks[t]:t;if(Ee(c,{code:re.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:d}=lo(o??r??a.selection,a.doc);return Xg({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 vf(Fne(c,n))(i)}}function pre(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 mre(e,t,n){return({tr:r,dispatch:o,state:i})=>{const s=lo(n??r.selection,r.doc),a=tne(s),l=Ie(e)?i.schema.marks[e]:e;if(Ee(l,{code:re.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),s.empty&&!a||!pre(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 gre(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=Mt(n.steps,n.steps.length-1).getMap().map(l);for(const[d,h]of rn(c))n.addMark(a,u,Mt(i.marks,d).create(h));return r(n),!0}}var Ge=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:dh([...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=!Sa(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=we(),i=new Set;let s=we();const a=c=>{var u;const d=we(),h=()=>c??this.transaction;let p=[];const m=()=>p;for(const[b,x]of Object.entries(o))(u=s[b])!=null&&u.disableChaining||(d[b]=this.chainedFactory({chain:d,command:x.original,getTr:h,getChain:m}));const v=b=>{Ee(b===h(),{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=p;p=[];for(const w of x)if(!w(v)&&b.exitEarly)return;e.dispatch(h())},d.tr=()=>{const b=p;p=[];for(const x of b)x(v);return h()},d.enabled=()=>{for(const b of p)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??{},h={};s={...s,decoratedCommands:d};for(const[p,m]of Object.entries(d)){const v=Ie(m.shortcut)&&m.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(m.shortcut,c.options)}:void 0;this.updateDecorated(p,{...m,name:c.name,...v}),u[p]=c[p].bind(c),m.active&&(h[p]=()=>{var b;return((b=m.active)==null?void 0:b.call(m,c.options,this.store))??!1})}Ig(u)||this.addCommands({active:h,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 Ie(e)?gre(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=lo(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=is(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(Le.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>Ul(t.selection)?(e==null||e(t.insertText(`
|
|
482
|
+
`)),!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:h}=lo(l??a??r.selection,r.doc);if(ky(e)||Wte(e)){const x=h.before(h.depth);return n==null||n(c&&u===d&&Pk(h.parent)?r.replaceWith(x,x+h.parent.nodeSize,e):r.replaceWith(u,d,e)),!0}const p=Ie(e)?o.schema.nodes[e]:e;Ee(p,{code:re.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 tt)return x;const w=Ie(x)?o.schema.marks[x]:x;return Ee(w,{code:re.SCHEMA,message:`The requested mark type ${x} does not exist in the schema.`}),w.create()}),v=p.createAndFill(s,Ie(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 Zg(e,t,n,r)}toggleWrappingNode(e,t,n){return mne(e,t,n)}toggleBlockNodeItem(e){return QD(e)}wrapInNode(e,t,n){return ZD(e,t,n)}applyMark(e,t,n){return mre(e,t,n)}toggleMark(e){return xh(e)}removeMark(e){return tL(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(hw({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 yne(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)Ig(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(){Po.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{...vre,...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 rn(t))fL({name:i,set:r,code:re.DUPLICATE_COMMAND_NAMES}),Ee(!yre.has(i),{code:re.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}}};ge([ye()],Ge.prototype,"customDispatch",1);ge([ye()],Ge.prototype,"insertText",1);ge([ye()],Ge.prototype,"selectText",1);ge([ye()],Ge.prototype,"selectMark",1);ge([ye()],Ge.prototype,"delete",1);ge([ye()],Ge.prototype,"emptyUpdate",1);ge([ye()],Ge.prototype,"forceUpdate",1);ge([ye()],Ge.prototype,"updateNodeAttributes",1);ge([ye()],Ge.prototype,"setContent",1);ge([ye()],Ge.prototype,"resetContent",1);ge([ye()],Ge.prototype,"emptySelection",1);ge([ye()],Ge.prototype,"insertNewLine",1);ge([ye()],Ge.prototype,"insertNode",1);ge([ye()],Ge.prototype,"focus",1);ge([ye()],Ge.prototype,"blur",1);ge([ye()],Ge.prototype,"setBlockNodeType",1);ge([ye()],Ge.prototype,"toggleWrappingNode",1);ge([ye()],Ge.prototype,"toggleBlockNodeItem",1);ge([ye()],Ge.prototype,"wrapInNode",1);ge([ye()],Ge.prototype,"applyMark",1);ge([ye()],Ge.prototype,"toggleMark",1);ge([ye()],Ge.prototype,"removeMark",1);ge([ye()],Ge.prototype,"setMeta",1);ge([ye({description:({t:e})=>e(ka.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(ka.SELECT_ALL_LABEL),shortcut:oe.SelectAll})],Ge.prototype,"selectAll",1);ge([ye({description:({t:e})=>e(ka.COPY_DESCRIPTION),label:({t:e})=>e(ka.COPY_LABEL),shortcut:oe.Copy,icon:"fileCopyLine"})],Ge.prototype,"copy",1);ge([ye({description:({t:e})=>e(ka.PASTE_DESCRIPTION),label:({t:e})=>e(ka.PASTE_LABEL),shortcut:oe.Paste,icon:"clipboardLine"})],Ge.prototype,"paste",1);ge([ye({description:({t:e})=>e(ka.CUT_DESCRIPTION),label:({t:e})=>e(ka.CUT_LABEL),shortcut:oe.Cut,icon:"scissorsFill"})],Ge.prototype,"cut",1);ge([ye()],Ge.prototype,"replaceText",1);ge([Ft()],Ge.prototype,"getAllCommandOptions",1);ge([Ft()],Ge.prototype,"getCommandOptions",1);ge([Ft()],Ge.prototype,"getCommandProp",1);Ge=ge([rt({defaultPriority:ft.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Ge);var vre={forcedUpdates:[]},yre=new Set(["run","chain","original","raw","enabled","tr","new"]),Go=class extends Tt{constructor(){super(...arguments),this.placeholders=ot.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=Dg(),{promise:n,placeholder:r,onFailure:o,onSuccess:i}=e;return new hre(n).validate(s=>this.addPlaceholder(t,r)(s)).success(s=>{const{state:a,tr:l,dispatch:c,view:u,value:d}=s,h=this.store.helpers.findPlaceholder(t);if(!h){const p=new Error("The placeholder has been removed");return(o==null?void 0:o({error:p,state:a,tr:l,dispatch:c,view:u}))??!1}return this.removePlaceholder(t)({state:a,tr:l,view:u,dispatch:()=>{}}),i(d,h,{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=ot.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 h,p;const m=this.placeholderWidgets.get(d.id);m&&((p=(h=m.spec).onDestroy)==null||p.call(h,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:h}of u){const p=this.placeholderWidgets.get(d);if(!p)continue;const m=Ct.widget(p.from,p.spec.element,{...p.spec,data:h});this.placeholders=this.placeholders.remove([p]).add(e.doc,[m]),this.placeholderWidgets.set(d,m)}for(const d of c){const h=this.placeholders.find(void 0,void 0,m=>m.id===d&&m.__type===oc),p=this.placeholderWidgets.get(d);p&&((s=(i=p.spec).onDestroy)==null||s.call(i,this.store.view,p.spec.element)),this.placeholders=this.placeholders.remove(h),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(uP,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(uP,!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===oc);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)?ot.empty:bre(e,ot.empty,{class:Ie(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=Ct.widget(n,u,{id:l,__type:oc,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=Ct.widget(n,c,{id:s,type:a,__type:oc,widget:c})}else l=Ct.inline(n,r,{nodeName:i,class:o},{id:s,__type:oc});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:i}=e,s=Br(n)?t.doc.resolve(n):t.selection.$from,a=Br(n)?s.nodeAfter?{pos:n,end:s.nodeAfter.nodeSize}:void 0:Ate(s);if(!a)return;const l=Ct.node(a.pos,a.end,{nodeName:o,class:r},{id:i,__type:oc});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{...xre,...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:dh([...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:dh([...i,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===ot.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};ge([ye()],Go.prototype,"updateDecorations",1);ge([ye()],Go.prototype,"addPlaceholder",1);ge([ye()],Go.prototype,"updatePlaceholder",1);ge([ye()],Go.prototype,"removePlaceholder",1);ge([ye()],Go.prototype,"clearPlaceholders",1);ge([Ft()],Go.prototype,"findPlaceholder",1);ge([Ft()],Go.prototype,"findAllPlaceholders",1);Go=ge([rt({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:()=>ot.empty}}},defaultPriority:ft.Low})],Go);var xre={added:[],updated:[],clearTrackers:!1,removed:[]},oc="placeholderDecoration",uP="persistentSelectionFocus";function bre(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:i,to:s}=r,a=Ey(r)?Ct.node(i,s,n):Ct.inline(i,s,n);return t.add(o,[a])}var gw=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)}};gw=ge([rt({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:ft.Lowest})],gw);var co=class extends Tt{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",hw);const t=we(),n=we(),r=we(),o=new Set;for(const i of this.store.extensions){vp(i)&&(n[i.name]=a=>Fte({state:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{var l;return(l=yh({state:this.store.getState(),type:i.type,attrs:a}))==null?void 0:l.node.attrs}),Ny(i)&&(n[i.name]=a=>Xg({trState:this.store.getState(),type:i.type,attrs:a}),r[i.name]=a=>{const l=is(this.store.getState().selection.$from,i.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(Ck(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(!Ig(s))for(const[a,l]of rn(s))fL({name:a,set:o,code:re.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 Ek(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=hw({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
|
|
483
|
+
|
|
484
|
+
`,state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,Gs)}getTextBetween(e,t,n=this.store.getState().doc){return n.textBetween(e,t,`
|
|
485
|
+
|
|
486
|
+
`,Gs)}getHTML(e=this.store.getState()){return cne(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};ge([Ft()],co.prototype,"isSelectionEmpty",1);ge([Ft()],co.prototype,"isViewEditable",1);ge([Ft()],co.prototype,"getStateJSON",1);ge([Ft()],co.prototype,"getJSON",1);ge([Ft()],co.prototype,"getRemirrorJSON",1);ge([ye()],co.prototype,"insertHtml",1);ge([Ft()],co.prototype,"getText",1);ge([Ft()],co.prototype,"getTextBetween",1);ge([Ft()],co.prototype,"getHTML",1);co=ge([rt({})],co);var vw=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[Ue.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 EQ({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};vw=ge([rt({defaultPriority:ft.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],vw);var No=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 Ie(e)?Ere[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new cs({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=uL(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Ge),o=a=>l=>km({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(Sre(a.createKeymap(o(a)),n));for(const[c,u]of rn(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),h=km({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),p=_t(u.priority)?u.priority(a.options,this.store):u.priority??ft.Low,m=we();for(const v of h)m[v]=d;t.push([p,m]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return Bte(i)}arrowRightShortcut(e){const t=this.store.markTags[Ue.PreventExits],n=this.store.nodeTags[Ue.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[Ue.PreventExits],n=this.store.nodeTags[Ue.PreventExits];return Jg(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[Ue.PreventExits],n=this.store.nodeTags[Ue.PreventExits];return Jg(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=we();if(!n)for(const[o,i]of rn(s0))r[o]=vf(i);return t&&s0.Backspace&&(r.Backspace=vf(Ty(CQ,s0.Backspace))),e&&(r.Escape=vf(jne)),[ft.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?km({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 Nl(e.map(t=>on(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(!fne(r.selection)||vh({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(Sa(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?sP:pw)(r.selection))return!1;const i=r.selection.$anchor.node();return!Pk(i)||Jte(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?sP:pw)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(vh({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(Sa(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}}};ge([Gr({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],No.prototype,"arrowRightShortcut",1);ge([Gr({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],No.prototype,"arrowLeftShortcut",1);ge([Gr({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],No.prototype,"backspace",1);ge([Ft()],No.prototype,"getNamedShortcut",1);No=ge([rt({defaultPriority:ft.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],No);function wre(e){return Wo(my(oe),e)}function km({shortcut:e,map:t,options:n,store:r}){return Ie(e)?[yw(e,t)]:on(e)?e.map(o=>yw(o,t)):(e=e(n,r),km({shortcut:e,map:t,options:n,store:r}))}function yw(e,t){return wre(e)?t[e]:e}function Sre(e,t){const n={};let r,o;on(e)?[o,r]=e:r=e;for(const[i,s]of rn(r))n[yw(i,t)]=s;return gy(o)?n:[o,n]}var mL={[oe.Copy]:"Mod-c",[oe.Cut]:"Mod-x",[oe.Paste]:"Mod-v",[oe.PastePlain]:"Mod-Shift-v",[oe.SelectAll]:"Mod-a",[oe.Undo]:"Mod-z",[oe.Redo]:Po.isMac?"Shift-Mod-z":"Mod-y",[oe.Bold]:"Mod-b",[oe.Italic]:"Mod-i",[oe.Underline]:"Mod-u",[oe.Strike]:"Mod-d",[oe.Code]:"Mod-`",[oe.Paragraph]:"Mod-Shift-0",[oe.H1]:"Mod-Shift-1",[oe.H2]:"Mod-Shift-2",[oe.H3]:"Mod-Shift-3",[oe.H4]:"Mod-Shift-4",[oe.H5]:"Mod-Shift-5",[oe.H6]:"Mod-Shift-6",[oe.TaskList]:"Mod-Shift-7",[oe.BulletList]:"Mod-Shift-8",[oe.OrderedList]:"Mod-Shift-9",[oe.Quote]:"Mod->",[oe.Divider]:"Mod-Shift-|",[oe.Codeblock]:"Mod-Shift-~",[oe.ClearFormatting]:"Mod-Shift-C",[oe.Superscript]:"Mod-.",[oe.Subscript]:"Mod-,",[oe.LeftAlignment]:"Mod-Shift-L",[oe.CenterAlignment]:"Mod-Shift-E",[oe.RightAlignment]:"Mod-Shift-R",[oe.JustifyAlignment]:"Mod-Shift-J",[oe.InsertLink]:"Mod-k",[oe.Find]:"Mod-f",[oe.FindBackwards]:"Mod-Shift-f",[oe.FindReplace]:"Mod-Shift-H",[oe.AddFootnote]:"Mod-Alt-f",[oe.AddComment]:"Mod-Alt-m",[oe.ContextMenu]:"Mod-Shift-\\",[oe.IncreaseFontSize]:"Mod-Shift-.",[oe.DecreaseFontSize]:"Mod-Shift-,",[oe.IncreaseIndent]:"Tab",[oe.DecreaseIndent]:"Shift-Tab",[oe.Shortcuts]:"Mod-/",[oe.Format]:Po.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},kre={...mL,[oe.Strike]:"Mod-Shift-S",[oe.Code]:"Mod-Shift-M",[oe.Paragraph]:"Mod-Alt-0",[oe.H1]:"Mod-Alt-1",[oe.H2]:"Mod-Alt-2",[oe.H3]:"Mod-Alt-3",[oe.H4]:"Mod-Alt-4",[oe.H5]:"Mod-Alt-5",[oe.H6]:"Mod-Alt-6",[oe.OrderedList]:"Mod-Alt-7",[oe.BulletList]:"Mod-Alt-8",[oe.Quote]:"Mod-Alt-9",[oe.ClearFormatting]:"Mod-\\",[oe.IncreaseIndent]:"Mod-[",[oe.DecreaseIndent]:"Mod-]"},Ere={default:mL,googleDoc:kre},Cre=class extends Tt{get name(){return"nodeViews"}createPlugin(){const e=[],t=we();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(_t(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},_re=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=on(o)?o:[o];n.push(...i)}return Kne(n)}},xw=class extends Tt{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=we(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return Ee(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 Ku(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 cs(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||Sa(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(Mt(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=hL(e)?e:dre(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);Ee(t,{code:re.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(){Ee(this.store.phase>=ir.EditorView,{code:re.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)}};xw=ge([rt({defaultPriority:ft.Highest,handlerKeys:["applyState","appendTransaction"]})],xw);var bw=class extends Tt{constructor(){super(...arguments),this.dynamicAttributes={marks:we(),nodes:we()}}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[Ue.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=Ire(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:we(),[i]:we()}:we(),d=we(),h=Tre({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){h[m.name]={...h[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(vp(m)){const{spec:b,dynamic:x}=dP({createExtensionSpec:(w,S)=>m.createNodeSpec(w,S),extraAttributes:Mt(h,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(Ny(m)){const{spec:b,dynamic:x}=dP({createExtensionSpec:(w,S)=>m.createMarkSpec(w,S),extraAttributes:Mt(h,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 p=new pZ({nodes:u,marks:d,topNode:"doc"});this.addSchema(p,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",Cy(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 rn(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of rn(o)){if(!wa(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),nP(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of rn(this.dynamicAttributes.marks)){const i=Mt(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of rn(o)){if(!wa(s.attrs[a]))continue;const c=is(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:d}=c,h=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,h),nP(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};bw=ge([rt({defaultPriority:ft.Highest})],bw);function Tre(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=we();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=Nre({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 Pre(e){return Vl(e)&&on(e.tags)}function Nre(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(on(t))return t;Ee(Pre(t),{code:re.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,h=u==="mark"?r:u==="node"?n:[...r,...n],p=v=>h.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)p(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(!p(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 dP(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=we();function c(b,x){l[b]=x}let u=!1;function d(){u=!0}const h=Ore(r,o,d,c),p=Mre(r,o),m=jre(r,o),v=n({defaults:h,parse:p,dom:m},a);return Ee(o||u,{code:re.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 Ok(e){return Ie(e)||_t(e)?{default:e}:(Ee(e,{message:`${h2(e)} is not supported`,code:re.EXTENSION_EXTRA_ATTRIBUTES}),e)}function Ore(e,t,n,r){return()=>{n();const o=we();if(t)return o;for(const[i,s]of rn(e)){let l=Ok(s).default;_t(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function Mre(e,t){return n=>{const r=we();if(t)return r;for(const[o,i]of rn(e)){const{parseDOM:s,...a}=Ok(i);if(vi(n)){if(wa(s)){r[o]=n.getAttribute(o)??a.default;continue}if(_t(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function jre(e,t){return n=>{const r=we();if(t)return r;function o(i,s){if(i){if(Ie(i)){r[s]=i;return}if(on(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of rn(i))r[a]=l}}for(const[i,s]of rn(e)){const{toDOM:a,parseDOM:l}=Ok(s);if(wa(a)){const c=Ie(l)?l:i;r[c]=n.attrs[i];continue}if(_t(a)){o(a(n.attrs,Rre(n)),i);continue}o(a,i)}return r}}function Rre(e){return ky(e)?{node:e}:Kte(e)?{mark:e}:{}}function Ire(e){const t=we(),n=we();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 ku=class extends Tt{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return tP(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>tP(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>Mte(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=on(o)?o:[o];n.push(...i)}return[jte(...n)]}getSuggestState(e){return wk(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 Wo(on(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};ge([Ft()],ku.prototype,"getSuggestState",1);ge([Ft()],ku.prototype,"getSuggestMethods",1);ge([Ft()],ku.prototype,"isSuggesterActive",1);ku=ge([rt({customHandlerKeys:["suggester"]})],ku);var ww=class extends Tt{constructor(){super(...arguments),this.allTags=we(),this.plainTags=we(),this.markTags=we(),this.nodeTags=we()}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=we(),t=we(),n=we(),r=we();for(const o of my(Ue))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)Ee(Are(o),{code:re.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),pL(e)&&this.plainTags[o].push(e.name),Ny(e)&&this.markTags[o].push(e.name),vp(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};ww=ge([rt({defaultPriority:ft.Highest})],ww);function Are(e){return Wo(my(Ue),e)}var Dre=new Ku("remirrorFilePlaceholderPlugin");function Lre(){const e=new cs({key:Dre,state:{init(){return{set:ot.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=Ct.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 Fre=class extends Tt{get name(){return"upload"}createExternalPlugins(){return[Lre()]}};function zre(e={}){e={...{exitMarksOnArrowPress:No.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:No.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:No.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:No.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:Go.defaultOptions.persistentSelectionClass},...e};const n=Gb(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=Gb(e,["persistentSelectionClass"]);return[new ww,new bw,new fre,new xw,new vw,new _re,new Cre,new ku,new Ge,new co,new No(n),new gw,new Fre,new Go(r)]}var fP=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])}};fP=ge([rt({defaultOptions:{capture:Po.isDevelopment},staticKeys:["capture"],defaultPriority:ft.Highest})],fP);var Em,jd,Cm,fc,Ps,_m,Tm,Bre=class{constructor(e){Kt(this,Em,Dg()),Kt(this,jd,void 0),Kt(this,Cm,void 0),Kt(this,fc,!0),Kt(this,Ps,py()),Kt(this,_m,void 0),Kt(this,Tm,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;Ee(!this.manager.destroyed,{code:re.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);cn(this,Cm,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);Sa(d)||this.updateViewProps(...d)},this.onChange=(i=we())=>{var s,a;const l=this.eventListenerProps(i);le(this,fc)&&cn(this,fc,!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),le(this,Ps).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),le(this,Ps).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(cn(this,jd,t),cn(this,Tm,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 le(this,_m)??cn(this,_m,le(this,Ps).on.bind(le(this,Ps)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return le(this,fc)}get props(){return le(this,jd).call(this)}get previousState(){return this.previousStateOverride??le(this,Cm)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return le(this,Em)}get initialEditorState(){return le(this,Tm)}updateListener(e){const{state:t,tr:n}=e;return le(this,Ps).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return cn(this,jd,t),this}updateViewProps(...e){const t=Gb(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=_t(n)?n(this.eventListenerProps()):n;let c={};(r||Br(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=dh(mw(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 $X({...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(){le(this,Ps).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=we()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:le(this,fc),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:le(this,Em),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}}};Em=new WeakMap;jd=new WeakMap;Cm=new WeakMap;fc=new WeakMap;Ps=new WeakMap;_m=new WeakMap;Tm=new WeakMap;function $re(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)gL(a,{extension:d});s=Nl(s,(d,h)=>h.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const h=d.constructor,p=d.name,m=i.get(h);Ee(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:re.INTERNAL}),!(l.has(h)||c.has(p))&&(l.add(h),c.add(p),n.push(d),r.set(h,d),m.forEach(v=>v==null?void 0:v.replaceChildExtension(h,d)))}const u=[];for(const d of n)Vre({extension:d,found:l,missing:u});return Ee(Sa(u),{code:re.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:h})=>`The extension '${h.name}' requires '${d.name} in order to run correctly.`).join(`
|
|
487
|
+
`)}),{extensions:n,extensionMap:r}}function gL(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;Ee(hL(a),{code:re.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),Ure({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)gL(e,{names:c,extension:d,parentExtension:a})}}function Vre(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 Ure(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 Hre(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),h=(n=i.onView)==null?void 0:n.bind(i),p=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);d&&u.create.push(d),h&&u.view.push(h),p&&u.update.push(p),m&&u.destroy.push(m),Ny(i)&&a.push(i.name),vp(i)&&i.name!=="doc"&&s.push(i.name),pL(i)&&l.push(i.name)}var Ns,Rd,xo,Ni,Id,Er,Ha,Ad,Wa,Dd,Ka,bo,Ld,Pm=class{constructor(e,t={}){Kt(this,Ns,void 0),Kt(this,Rd,we()),Kt(this,xo,we()),Kt(this,Ni,void 0),Kt(this,Id,void 0),Kt(this,Er,ir.None),Kt(this,Ha,void 0),Kt(this,Ad,!0),Kt(this,Wa,{create:[],view:[],update:[],destroy:[]}),Kt(this,Dd,[]),Kt(this,Ka,py()),Kt(this,bo,void 0),Kt(this,Ld,void 0),this.getState=()=>{var o;return le(this,Er)>=ir.EditorView?this.view.state:(Ee(le(this,bo),{code:re.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=le(this,bo))==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}=$re(e,t);cn(this,Ha,t),cn(this,Ni,Za(n)),cn(this,Id,r),cn(this,Ns,this.createExtensionStore()),cn(this,Er,ir.Create),this.setupLifecycleHandlers();for(const o of le(this,Wa).create){const i=o();i&&le(this,Dd).push(i)}}static create(e,t={}){return new Pm([...y2(e),...zre(t.builtin)],t)}get[rs](){return mn.Manager}get destroyed(){return le(this,Er)===ir.Destroy}get mounted(){return le(this,Er)>=ir.EditorView&&le(this,Er)<ir.Destroy}get output(){var e;return(e=le(this,bo))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!le(this,bo)}get extensions(){return le(this,Ni)}get stringHandlers(){return le(this,Rd)}get store(){return Za(le(this,xo))}get extensionStore(){return Za(le(this,Ns))}get tr(){return this.getExtension(Ge).transaction}get nodes(){return le(this,xo).nodes}get marks(){return le(this,xo).marks}get schema(){return le(this,xo).schema}get extensionTags(){return le(this,xo).tags}get view(){return le(this,xo).view}get settings(){return le(this,Ha)}get document(){return le(this,Ha).document??_y()}setupLifecycleHandlers(){const e=le(this,Ns),t=le(this,Wa),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of le(this,Ni))Hre({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){le(this,Rd)[e]=t}setStoreKey(e,t){le(this,xo)[e]=t}getStoreKey(e){const t=le(this,xo)[e];return Ee(!wa(t),{code:re.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){Ee(le(this,Er)<=ir.EditorView,{code:re.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),le(this,Ns)[e]=t}createExtensionStore(){const e=we(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>le(this,Ni),enumerable:t},phase:{get:()=>le(this,Er),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>Za(le(this,Ha)),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:()=>le(this,Rd),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(le(this,Er)>=ir.EditorView)return this;cn(this,Ad,!0),cn(this,Er,ir.EditorView),le(this,xo).view=e;for(const t of le(this,Wa).view){const n=t(e);n&&le(this,Dd).push(n)}return this}attachFramework(e,t){var n;le(this,bo)!==e&&(le(this,bo)&&(le(this,bo).destroy(),(n=le(this,Ld))==null||n.call(this)),cn(this,bo,e),cn(this,Ld,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return Ee(t,{code:re.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=qD({stringHandler:Ie(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return Qa.create({schema:s,doc:l,plugins:a,selection:lo(o,l)})}addHandler(e,t){return le(this,Ka).on(e,t)}onStateUpdate(e){const t=le(this,Ad);le(this,Ns).currentState=e.state,le(this,Ns).previousState=e.previousState,t&&(cn(this,Er,ir.Runtime),cn(this,Ad,!1));const n={...e,firstUpdate:t};for(const r of le(this,Wa).update)r(n);le(this,Ka).emit("stateUpdate",n)}getExtension(e){const t=le(this,Id).get(e);return Ee(t,{code:re.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!!le(this,Id).get(e)}clone(){const e=le(this,Ni).map(n=>n.clone(n.options)),t=Pm.create(()=>e,le(this,Ha));return le(this,Ka).emit("clone",t),t}recreate(e=[],t={}){const n=le(this,Ni).map(o=>o.clone(o.initialOptions)),r=Pm.create(()=>[...n,...e],t);return le(this,Ka).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;cn(this,Er,ir.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=le(this,bo))==null||r.destroy(),(o=le(this,Ld))==null||o.call(this);for(const s of le(this,Dd))s();for(const s of le(this,Wa).destroy)s();(i=this.view)==null||i.destroy(),le(this,Ka).emit("destroy")}includes(e){const t=[],n=[];for(const r of le(this,Ni))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>Ie(r)?Wo(t,r):Wo(n,r))}},Wre=Pm;Ns=new WeakMap;Rd=new WeakMap;xo=new WeakMap;Ni=new WeakMap;Id=new WeakMap;Er=new WeakMap;Ha=new WeakMap;Ad=new WeakMap;Wa=new WeakMap;Dd=new WeakMap;Ka=new WeakMap;bo=new WeakMap;Ld=new WeakMap;function Kre(e,t){return!(!Gu(e)||!qu(e,mn.Manager))}var Gre=Object.defineProperty,qre=Object.getOwnPropertyDescriptor,Yre=(e,t,n,r)=>{for(var o=r>1?void 0:r?qre(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&&Gre(t,n,o),o},vL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},xe=(e,t,n)=>(vL(e,t,"read from private field"),n?n.call(e):t.get(e)),Cr=(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)},kr=(e,t,n,r)=>(vL(e,t,"write to private field"),t.set(e,n),n),Fd,Jre=class{constructor(){this.portals=new Map,Cr(this,Fd,py()),this.on=e=>xe(this,Fd).on("update",e),this.once=e=>{const t=xe(this,Fd).on("update",n=>{t(),e(n)});return t}}update(){xe(this,Fd).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)??Dg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:Dg()})}remove(e){this.portals.delete(e),this.update()}};Fd=new WeakMap;var Xre=e=>{const{portals:t}=e;return Se.createElement(Se.Fragment,null,t.map(([n,{Component:r,key:o}])=>Mr.createPortal(Se.createElement(r,null),n,o)))};function Zre(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 Pt,zd,Ga,Bd,Nm,$d,hc,Vd,Om,Oi,Wn,Sw,yL=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){Cr(this,Pt,void 0),Cr(this,zd,[]),Cr(this,Ga,void 0),Cr(this,Bd,void 0),Cr(this,Nm,void 0),Cr(this,$d,void 0),Cr(this,hc,void 0),Cr(this,Vd,!1),Cr(this,Om,void 0),Cr(this,Oi,void 0),Cr(this,Wn,void 0),Cr(this,Sw,l=>{l&&(Ee(xe(this,Oi),{code:re.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${xe(this,Pt).type.name}' which doesn't support content.`}),l.append(xe(this,Oi)))}),this.Component=()=>{const l=xe(this,Nm);return Ee(l,{code:re.REACT_NODE_VIEW,message:`The custom react node view provided for ${xe(this,Pt).type.name} doesn't have a valid ReactComponent`}),Se.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:xe(this,Ga),getPosition:xe(this,$d),node:xe(this,Pt),forwardRef:xe(this,Sw),decorations:xe(this,zd)})},this.updateAttributes=l=>{if(!xe(this,Ga).editable)return;const c=xe(this,$d).call(this);if(c==null)return;const u=xe(this,Ga).state.tr.setNodeMarkup(c,void 0,{...xe(this,Pt).attrs,...l});xe(this,Ga).dispatch(u)},Ee(_t(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),kr(this,Pt,t),kr(this,Ga,r),kr(this,Bd,n),kr(this,Nm,o),kr(this,$d,e),kr(this,hc,i),kr(this,Wn,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};kr(this,Om,s??void 0),kr(this,Oi,a),xe(this,Oi)&&xe(this,Wn).append(xe(this,Oi)),this.setDomAttributes(xe(this,Pt),xe(this,Wn)),this.Component.displayName=d2(`${xe(this,Pt).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new yL({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return xe(this,Vd)}get contentDOM(){return xe(this,Om)}get dom(){return xe(this,Wn)}renderComponent(){xe(this,Bd).render({Component:this.Component,container:xe(this,Wn)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=xe(this,hc),n=xe(this,Pt).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${K_(xe(this,Pt).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(xe(this,Pt).isLeaf)return;const n=(t=(e=xe(this,Pt).type.spec).toDOM)==null?void 0:t.call(e,xe(this,Pt));if(!n)return;const{contentDOM:r,dom:o}=Da.renderSpec(document,n);let i;if(vi(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${K_(xe(this,Pt).type.name)}-node-view-content-wrapper`),i.append(r)),vi(r),{wrapper:i,contentDOM:r}}update(e,t){return kk({types:xe(this,Pt).type,node:e})?(xe(this,Pt)===e&&xe(this,zd)===t||(xe(this,Pt).sameMarkup(e)||this.setDomAttributes(e,xe(this,Wn)),kr(this,Pt,e),kr(this,zd,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=xe(this,Pt).type.spec;let r=e.attrs;if(n){const o=n(e);if(Ie(o)||Qre(o))return;Vl(o[1])&&(r=o[1])}for(const[o,i]of rn(r))t.setAttribute(o,i)}selectNode(){kr(this,Vd,!0),xe(this,Wn)&&xe(this,Wn).classList.add(V_),this.renderComponent()}deselectNode(){kr(this,Vd,!1),xe(this,Wn)&&xe(this,Wn).classList.remove(V_),this.renderComponent()}destroy(){xe(this,Bd).remove(xe(this,Wn))}ignoreMutation(e){return e.type==="selection"?!xe(this,Pt).type.spec.selectable:xe(this,Oi)?!xe(this,Oi).contains(e.target):!0}stopEvent(e){var t;if(!xe(this,Wn))return!1;if(_t(xe(this,hc).stopEvent))return xe(this,hc).stopEvent({event:e});const n=e.target;if(!(xe(this,Wn).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=!!xe(this,Pt).type.spec.draggable,a=Te.isSelectable(xe(this,Pt)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",d=e.type==="mousedown",h=e.type.startsWith("drag");return!s&&a&&h&&e.preventDefault(),!(h||o||l||c||u||d&&a)}},hP=yL;Pt=new WeakMap;zd=new WeakMap;Ga=new WeakMap;Bd=new WeakMap;Nm=new WeakMap;$d=new WeakMap;hc=new WeakMap;Vd=new WeakMap;Om=new WeakMap;Oi=new WeakMap;Wn=new WeakMap;Sw=new WeakMap;function Qre(e){return fw(e)||Vl(e)&&fw(e.dom)}var bh=class extends Tt{constructor(){super(...arguments),this.portalContainer=new Jre}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=we(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!vp(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=hP.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=rn({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=hP.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};bh=Yre([rt({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],bh);var eoe=Object.defineProperty,pP=Object.getOwnPropertySymbols,toe=Object.prototype.hasOwnProperty,noe=Object.prototype.propertyIsEnumerable,mP=(e,t,n)=>t in e?eoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gP=(e,t)=>{for(var n in t||(t={}))toe.call(t,n)&&mP(e,n,t[n]);if(pP)for(var n of pP(t))noe.call(t,n)&&mP(e,n,t[n]);return e};function roe(e){const t=g.createContext(null),n=ooe(t);return[o=>{const i=e(o);return Se.createElement(t.Provider,{value:i},o.children)},n,t]}function ooe(e){return(t,n)=>{const r=g.useContext(e),o=ioe(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 ioe(e){const t=g.useRef();return soe(()=>{t.current=e}),t.current}var soe=typeof document<"u"?g.useLayoutEffect:g.useEffect;function aoe(e,t){return roe(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:vP(r),set:yP(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:vP(r),set:yP(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function vP(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 yP(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=>gP(gP({},n),typeof t=="function"?t(n):t))}}var xL={},bL={};(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"]])})(bL);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=bL;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(p){return!p.match(/[^a-f0-9]/i)?parseInt(p,16):NaN}function r(p,m,v){const b=n(p);if(Number.isNaN(b)||v!==void 0&&v!==p.length)throw new SyntaxError(t.errorMessages.get(m));return b}function o(p){const m=r(p,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(p,m){const v=r(p,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(p){return p.charAt(0)==="{"&&p.charAt(p.length-1)==="}"}function a(p){if(!s(p))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=p.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(p,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(p,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
|
|
488
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}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 h(p,m=!1){return p.replace(d,function(v,b,x,w,S,C,_,P,O){if(b!==void 0)return"\\";if(x!==void 0)return o(x);if(w!==void 0)return a(w);if(S!==void 0)return i(S,C);if(_!==void 0)return i(_);if(P==="0")return"\0";if(P!==void 0)return l(P,!m);if(O!==void 0)return u(O);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=h,e.default=h})(xL);const pl=e=>typeof e=="string",loe=e=>typeof e=="function",xP=new Map,wL="en";function Mk(e){return[...Array.isArray(e)?e:[e],wL]}function SL(e,t,n){const r=Mk(e);return tv(()=>nv("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(pl(t)?new Date(t):t)}function kw(e,t,n){const r=Mk(e);return tv(()=>nv("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function bP(e,t,n,{offset:r=0,...o}){const i=Mk(e),s=t?tv(()=>nv("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):tv(()=>nv("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function tv(e,t){const n=e();let r=xP.get(n);return r||(r=t(),xP.set(n,r)),r}function nv(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const kL=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,EL="%__lingui_octothorpe__%",coe=(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=kw(r,s,l);return a.replace(new RegExp(EL,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=bP(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=bP(r,!0,s,a);return i(s-l,c)},select:uoe,number:(s,a)=>kw(r,s,o(a)),date:(s,a)=>SL(r,s,o(a))}},uoe=(e,t)=>t[e]??t.other;function doe(e,t,n){return(r={},o)=>{const i=coe(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,d)=>{if(d==="#"&&c)return u+EL;if(pl(d))return u+d;const[h,p,m]=d;let v={};p==="plural"||p==="selectordinal"||p==="select"?Object.entries(m).forEach(([x,w])=>{v[x]=s(w,p==="plural"||p==="selectordinal")}):v=m;let b;if(p){const x=i[p];b=x(r[h],v)}else b=r[h];return b==null?u:u+b},""):l,a=s(e);return pl(a)&&kL.test(a)?xL.unraw(a.trim()):pl(a)?a.trim():a?String(a):""}}var foe=Object.defineProperty,hoe=(e,t,n)=>t in e?foe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,poe=(e,t,n)=>(hoe(e,t+"",n),n);class moe{constructor(){poe(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 goe=Object.defineProperty,voe=(e,t,n)=>t in e?goe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ic=(e,t,n)=>(voe(e,typeof t!="symbol"?t+"":t,n),n);class yoe extends moe{constructor(t){super(),ic(this,"_locale",""),ic(this,"_locales"),ic(this,"_localeData",{}),ic(this,"_messages",{}),ic(this,"_missing"),ic(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??wL,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=""),pl(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 loe(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return pl(l)&&kL.test(l)?JSON.parse(`"${l}"`):pl(l)?l:doe(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return SL(this._locales||this._locale,t,n)}number(t,n){return kw(this._locales||this._locale,t,n)}}function xoe(e={}){return new yoe(e)}const Oy=xoe();function se(e,t){return t?"other":e==1?"one":"other"}function us(e,t){return t?"other":e==0||e==1?"one":"other"}function xr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function at(e,t){return"other"}function Fa(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const boe=at,woe=se,Soe=us;function koe(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Eoe=se;function Coe(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 _oe(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 Toe(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 Poe=se,Noe=xr;function Ooe(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 Moe(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 joe=se,Roe=se,Ioe=se,Aoe=us,Doe=at;function Loe(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 Foe=at;function zoe(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 Boe=se;function $oe(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 Voe(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 Uoe=se;function Hoe(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 Woe=se,Koe=se,Goe=se;function qoe(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 Yoe(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 Joe(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 Xoe=xr;function Zoe(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 Qoe=se,eie=at,tie=se,nie=se;function rie(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 oie=se,iie=se,sie=xr,aie=se;function lie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function cie(e,t){return t?"other":e>=0&&e<2?"one":"other"}const uie=xr;function die(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 fie=se;function hie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const pie=se,mie=xr;function gie(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 vie(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 yie=xr,xie=se;function bie(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 wie=us;function Sie(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 kie=se,Eie=se;function Cie(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 _ie(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 Tie(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 Pie(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 Nie(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function Oie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Mie=xr,jie=at,Rie=at,Iie=at,Aie=xr;function Die(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 Lie(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 Fie=Fa;function zie(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 Bie=at,$ie=at,Vie=se,Uie=xr,Hie=se,Wie=at,Kie=at;function Gie(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 qie(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Yie=se,Jie=se,Xie=at,Zie=at;function Qie(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 ese=se,tse=se,nse=at;function rse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const ose=at,ise=se,sse=se;function ase(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const lse=se;function cse(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 use=se;function dse(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 fse=se,hse=se,pse=at,mse=us;function gse(e,t){return t&&e==1?"one":"other"}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?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function yse(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 xse=se,bse=us,wse=se;function Sse(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 kse=se,Ese=se;function Cse(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 _se(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function Tse(e,t){return t&&e==1?"one":"other"}function Pse(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 Nse=at,Ose=se,Mse=Fa,jse=se,Rse=se;function Ise(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 Ase=xr,Dse=se,Lse=se,Fse=se,zse=at,Bse=se,$se=us,Vse=se,Use=se,Hse=se;function Wse(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 Kse=se,Gse=at,qse=us,Yse=se;function Jse(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 Xse(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 Zse=se;function Qse(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const eae=xr,tae=se;function nae(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 rae=se,oae=at;function iae(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 sae=se,aae=at,lae=se;function cae(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 uae(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 dae=se,fae=se,hae=Fa,pae=se,mae=at,gae=at;function vae(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 yae(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 xae(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 bae(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 wae(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 Sae=Fa,kae=Fa,Eae=Fa,Cae=Fa,_ae=Fa,Tae=se,Pae=se;function Nae(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 Oae(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 Mae=se,jae=se,Rae=se,Iae=at;function Aae(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 Dae=xr,Lae=se,Fae=se,zae=se,Bae=se,$ae=at,Vae=us,Uae=se;function Hae(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 Wae(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 Kae=se,Gae=at,qae=se,Yae=se;function Jae(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 Xae=se;function Zae(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 Qae=xr,ele=se,tle=se;function nle(e,t){return t&&e==1?"one":"other"}const rle=se,ole=se,ile=us,sle=se,ale=at,lle=se,cle=se,ule=xr,dle=at,fle=at,hle=at;function ple(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const mle=Object.freeze(Object.defineProperty({__proto__:null,_in:boe,af:woe,ak:Soe,am:koe,an:Eoe,ar:Coe,ars:_oe,as:Toe,asa:Poe,ast:Noe,az:Ooe,be:Moe,bem:joe,bez:Roe,bg:Ioe,bho:Aoe,bm:Doe,bn:Loe,bo:Foe,br:zoe,brx:Boe,bs:$oe,ca:Voe,ce:Uoe,ceb:Hoe,cgg:Woe,chr:Koe,ckb:Goe,cs:qoe,cy:Yoe,da:Joe,de:Xoe,dsb:Zoe,dv:Qoe,dz:eie,ee:tie,el:nie,en:rie,eo:oie,es:iie,et:sie,eu:aie,fa:lie,ff:cie,fi:uie,fil:die,fo:fie,fr:hie,fur:pie,fy:mie,ga:gie,gd:vie,gl:yie,gsw:xie,gu:bie,guw:wie,gv:Sie,ha:kie,haw:Eie,he:Cie,hi:_ie,hr:Tie,hsb:Pie,hu:Nie,hy:Oie,ia:Mie,id:jie,ig:Rie,ii:Iie,io:Aie,is:Die,it:Lie,iu:Fie,iw:zie,ja:Bie,jbo:$ie,jgo:Vie,ji:Uie,jmc:Hie,jv:Wie,jw:Kie,ka:Gie,kab:qie,kaj:Yie,kcg:Jie,kde:Xie,kea:Zie,kk:Qie,kkj:ese,kl:tse,km:nse,kn:rse,ko:ose,ks:ise,ksb:sse,ksh:ase,ku:lse,kw:cse,ky:use,lag:dse,lb:fse,lg:hse,lkt:pse,ln:mse,lo:gse,lt:vse,lv:yse,mas:xse,mg:bse,mgo:wse,mk:Sse,ml:kse,mn:Ese,mo:Cse,mr:_se,ms:Tse,mt:Pse,my:Nse,nah:Ose,naq:Mse,nb:jse,nd:Rse,ne:Ise,nl:Ase,nn:Dse,nnh:Lse,no:Fse,nqo:zse,nr:Bse,nso:$se,ny:Vse,nyn:Use,om:Hse,or:Wse,os:Kse,osa:Gse,pa:qse,pap:Yse,pl:Jse,prg:Xse,ps:Zse,pt:Qse,pt_PT:eae,rm:tae,ro:nae,rof:rae,root:oae,ru:iae,rwk:sae,sah:aae,saq:lae,sc:cae,scn:uae,sd:dae,sdh:fae,se:hae,seh:pae,ses:mae,sg:gae,sh:vae,shi:yae,si:xae,sk:bae,sl:wae,sma:Sae,smi:kae,smj:Eae,smn:Cae,sms:_ae,sn:Tae,so:Pae,sq:Nae,sr:Oae,ss:Mae,ssy:jae,st:Rae,su:Iae,sv:Aae,sw:Dae,syr:Lae,ta:Fae,te:zae,teo:Bae,th:$ae,ti:Vae,tig:Uae,tk:Hae,tl:Wae,tn:Kae,to:Gae,tr:qae,ts:Yae,tzm:Jae,ug:Xae,uk:Zae,ur:Qae,uz:ele,ve:tle,vi:nle,vo:rle,vun:ole,wa:ile,wae:sle,wo:ale,xh:lle,xog:cle,yi:ule,yo:dle,yue:fle,zh:hle,zu:ple},Symbol.toStringTag,{value:"Module"}));var gle=Object.defineProperty,vle=Object.getOwnPropertyDescriptor,yle=Object.getOwnPropertyNames,xle=Object.prototype.hasOwnProperty,ble=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of yle(t))!xle.call(e,o)&&o!==n&&gle(e,o,{get:()=>t[o],enumerable:!(r=vle(t,o))||r.enumerable});return e},wle=(e,t,n)=>(ble(e,t,"default"),n),Sle=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"]]}'),CL={};wle(CL,mle);Oy.loadLocaleData("en",{plurals:CL.en});Oy.load("en",Sle);Oy.activate("en");var kle=Object.defineProperty,Ele=Object.getOwnPropertyDescriptor,jk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ele(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&&kle(t,n,o),o},Eu=class extends po{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=we();if(Vl(n))for(const[i,s]of rn(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 Ew(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return Tk(e.doc,t)}};jk([ye()],Eu.prototype,"setDocAttributes",1);jk([Ft()],Eu.prototype,"isDefaultDocNode",1);Eu=jk([rt({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:ft.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],Eu);var _L="SetDocAttribute",TL="RevertSetDocAttribute",Ew=class Cw extends sn{constructor(n,r,o=_L){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 Cw(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 Cw(this.key,this.previous,TL)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{sn.jsonID(_L,Ew),sn.jsonID(TL,Ew)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var Cle=Object.defineProperty,_le=Object.getOwnPropertyDescriptor,PL=(e,t,n,r)=>{for(var o=r>1?void 0:r?_le(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&&Cle(t,n,o),o};function Tle(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function Ple(e,t){const n=t.target;if(n){const r=Tle(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 rv=class extends Tt{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=Ple(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 v2(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 h=is(c,d);h&&s.push(h)}return e(r,{view:t,nodes:i,marks:s,getMark:d=>{const h=Ie(d)?t.state.schema.marks[d]:d;return Ee(h,{code:re.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(p=>p.mark.type===h)},getNode:d=>{var h;const p=Ie(d)?t.state.schema.nodes[d]:d;Ee(p,{code:re.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===p);if(m)return{...m,isRoot:!!((h=i[0])!=null&&h.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 rn(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:h}=u,p=h.resolve(i),m=e.has(l),v=Nle({$pos:p,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 S=Ie(w)?d.nodes[w]:w;return Ee(S,{code:re.EXTENSION,message:"The node being checked does not exist"}),S===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()],rv.prototype,"isInteracting",1);rv=PL([rt({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})],rv);function Nle(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:m2,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=is(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Ie(s)?o.schema.marks[s]:s;return Ee(a,{code:re.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 Ke{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Dt.valid(r)?new Dt(r):Ke.near(r)}content(){return ae.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 Rk(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Ole(t)||!Mle(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&&!Te.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;Ke.jsonID("gapcursor",Dt);class Rk{constructor(t){this.pos=t}map(t){return new Rk(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Dt.valid(n)?new Dt(n):Ke.near(n)}}function Ole(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 Mle(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 jle(){return new cs({props:{decorations:Dle,createSelectionBetween(e,t,n){return t.pos==n.pos&&Dt.valid(n)?new Dt(n):null},handleClick:Ile,handleKeyDown:Rle,handleDOMEvents:{beforeinput:Ale}}})}const Rle=uL({ArrowLeft:tm("horiz",-1),ArrowRight:tm("horiz",1),ArrowUp:tm("vert",-1),ArrowDown:tm("vert",1)});function tm(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 Le){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 Ile(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&&Te.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Dt(r))),!0)}function Ale(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=K.empty;for(let s=r.length-1;s>=0;s--)o=K.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new ae(o,0,0));return i.setSelection(Le.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Dle(e){if(!(e.selection instanceof Dt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ot.create(e.doc,[Ct.widget(e.selection.head,t,{key:"gapcursor"})])}var Lle=Object.defineProperty,Fle=Object.getOwnPropertyDescriptor,zle=(e,t,n,r)=>{for(var o=r>1?void 0:r?Fle(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&&Lle(t,n,o),o},_w=class extends Tt{get name(){return"gapCursor"}createExternalPlugins(){return[jle()]}};_w=zle([rt({})],_w);var ov=200,gn=function(){};gn.prototype.append=function(t){return t.length?(t=gn.from(t),!this.length&&t||t.length<ov&&this.leafAppend(t)||this.length<ov&&t.leafPrepend(this)||this.appendInner(t)):this};gn.prototype.prepend=function(t){return t.length?gn.from(t).append(this):this};gn.prototype.appendInner=function(t){return new Ble(this,t)};gn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?gn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};gn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};gn.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)};gn.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};gn.from=function(t){return t instanceof gn?t:t&&t.length?new NL(t):gn.empty};var NL=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<=ov)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=ov)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}(gn);gn.empty=new NL([]);var Ble=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}(gn);const $le=500;class Oo{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,h)=>{if(!d.step){o||(o=this.remapping(r,h+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new ks(d.map));let p=d.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new ks(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 Oo(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]),h=new ks(t.mapping.maps[u],d,n),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(s++,n=void 0),o||(l=h)}let c=s-r.depth;return c>Ule&&(a=Vle(a,c),s-=c),new Oo(a.append(i),s)}remapping(t,n){let r=new Uc;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 Oo(this.items.append(t.map(n=>new ks(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(h=>{h.selection&&a--},o);let l=n;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(h.step){let v=t.steps[p].invert(t.docs[p]),b=h.selection&&h.selection.map(i.slice(l+1,p));b&&a++,r.push(new ks(m,v,b))}else r.push(new ks(m))},o);let c=[];for(let h=n;h<s;h++)c.push(new ks(i.maps[h]));let u=this.items.slice(0,o).append(c).append(r),d=new Oo(u,a);return d.emptyItemCount()>$le&&(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 ks(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(d))?o[p]=h:o.push(d)}}else s.map&&r--},this.items.length,0),new Oo(gn.from(o.reverse()),i)}}Oo.empty=new Oo(gn.empty,0);function Vle(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let ks=class OL{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 OL(n.getMap().invert(),n,this.selection)}}};class As{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const Ule=20;function Hle(e,t,n,r){let o=n.getMeta(Gi),i;if(o)return o.historyState;n.getMeta(Gle)&&(e=new As(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Gi))return s.getMeta(Gi).redo?new As(e.done.addTransform(n,void 0,r,Mm(t)),e.undone,wP(n.mapping.maps),e.prevTime,e.prevComposition):new As(e.done,e.undone.addTransform(n,void 0,r,Mm(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||!Wle(n,e.prevRanges)),c=s?u0(e.prevRanges,n.mapping):wP(n.mapping.maps);return new As(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Mm(t)),Oo.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new As(e.done.rebased(n,i),e.undone.rebased(n,i),u0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new As(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),u0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Wle(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 wP(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 Kle(e,t,n){let r=Mm(t),o=Gi.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 As(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Gi,{redo:n,historyState:l})}let d0=!1,SP=null;function Mm(e){let t=e.plugins;if(SP!=t){d0=!1,SP=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){d0=!0;break}}return d0}const Gi=new Ku("history"),Gle=new Ku("closeHistory");function qle(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new cs({key:Gi,state:{init(){return new As(Oo.empty,Oo.empty,null,0,-1)},apply(t,n,r){return Hle(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?jm:r=="historyRedo"?Ud:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function ML(e,t){return(n,r)=>{let o=Gi.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=Kle(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const jm=ML(!1,!0),Ud=ML(!0,!0);function Tw(e){let t=Gi.getState(e);return t?t.done.eventCount:0}function Yle(e){let t=Gi.getState(e);return t?t.undone.eventCount:0}var Jle=Object.defineProperty,Xle=Object.getOwnPropertyDescriptor,Hl=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xle(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&&Jle(t,n,o),o},yi=class extends Tt{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=_t(i)?i():n,l=_t(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Po.isMac?()=>!1:this.wrapMethod(Ud,this.options.onRedo),"Mod-z":this.wrapMethod(jm,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(Ud,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(jm,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(Ud,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[qle({depth:e,newGroupDelay:t})]}undo(){return rP(this.wrapMethod(jm,this.options.onUndo))}redo(){return rP(this.wrapMethod(Ud,this.options.onRedo))}undoDepth(e=this.store.getState()){return Tw(e)}redoDepth(e=this.store.getState()){return Yle(e)}};Hl([Gr({shortcut:oe.Undo,command:"undo"})],yi.prototype,"undoShortcut",1);Hl([Gr({shortcut:oe.Redo,command:"redo"})],yi.prototype,"redoShortcut",1);Hl([ye({disableChaining:!0,description:({t:e})=>e(Ug.UNDO_DESCRIPTION),label:({t:e})=>e(Ug.UNDO_LABEL),icon:"arrowGoBackFill"})],yi.prototype,"undo",1);Hl([ye({disableChaining:!0,description:({t:e})=>e(Ug.REDO_DESCRIPTION),label:({t:e})=>e(Ug.REDO_LABEL),icon:"arrowGoForwardFill"})],yi.prototype,"redo",1);Hl([Ft()],yi.prototype,"undoDepth",1);Hl([Ft()],yi.prototype,"redoDepth",1);yi=Hl([rt({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],yi);var Zle=Object.defineProperty,Qle=Object.getOwnPropertyDescriptor,My=(e,t,n,r)=>{for(var o=r>1?void 0:r?Qle(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&&Zle(t,n,o),o},ece={icon:"paragraph",label:({t:e})=>e(Hg.INSERT_LABEL),description:({t:e})=>e(Hg.INSERT_DESCRIPTION)},tce={icon:"paragraph",label:({t:e})=>e(Hg.CONVERT_LABEL),description:({t:e})=>e(Hg.CONVERT_DESCRIPTION)},Il=class extends po{get name(){return"paragraph"}createTags(){return[Ue.LastNodeCompatible,Ue.TextBlock,Ue.Block,Ue.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)}};My([ye(tce)],Il.prototype,"convertParagraph",1);My([ye(ece)],Il.prototype,"insertParagraph",1);My([Gr({shortcut:oe.Paragraph,command:"convertParagraph"})],Il.prototype,"shortcut",1);Il=My([rt({defaultPriority:ft.Medium})],Il);function Ui(e,t,n){return Math.min(Math.max(e,n),t)}class nce extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Hd=nce;function Ik(e){if(typeof e!="string")throw new Hd(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=uce.test(e)?ice(e):e;const n=sce.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(wh(a,2),16)),parseInt(wh(s[3]||"f",2),16)/255]}const r=ace.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=lce.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=cce.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Ui(0,100,a)!==a)throw new Hd(e);if(Ui(0,100,l)!==l)throw new Hd(e);return[...dce(s,a,l),Number.isNaN(c)?1:c]}throw new Hd(e)}function rce(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const kP=e=>parseInt(e.replace(/_/g,""),36),oce="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=kP(t.substring(0,3)),r=kP(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 ice(e){const t=e.toLowerCase().trim(),n=oce[rce(t)];if(!n)throw new Hd(e);return`#${n}`}const wh=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),sce=new RegExp(`^#${wh("([a-f0-9])",3)}([a-f0-9])?$`,"i"),ace=new RegExp(`^#${wh("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),lce=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${wh(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),cce=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,uce=/^[a-z]+$/i,EP=e=>Math.round(e*255),dce=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(EP);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,h=l+u,p=c+u;return[d,h,p].map(EP)};function fce(e){const[t,n,r,o]=Ik(e).map((d,h)=>h===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 hce(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Ui(0,100,t*100).toFixed()}%, ${Ui(0,100,n*100).toFixed()}%, ${parseFloat(Ui(0,1,r).toFixed(3))})`}function Pr(e,t){const[n,r,o,i]=fce(e);return hce(n,r,o-t,i)}function pce(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]=Ik(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function mce(e,t,n,r){return`rgba(${Ui(0,255,e).toFixed()}, ${Ui(0,255,t).toFixed()}, ${Ui(0,255,n).toFixed()}, ${parseFloat(Ui(0,1,r).toFixed(3))})`}function Rm(e,t){return Pr(e,-t)}function iv(e,t){const[n,r,o,i]=Ik(e);return mce(n,r,o,i-t)}function gce(e){return pce(e)>.179}function Gc(e){return gce(e)?"#000":"#fff"}const vce="remirror-editor-wrapper",yce="remirror-button-active",xce="remirror-button",bce="remirror-composite",wce="remirror-dialog",Sce="remirror-dialog-backdrop",kce="remirror-form",Ece="remirror-form-message",Cce="remirror-form-label",_ce="remirror-form-group",Tce="remirror-group",Pce="remirror-input",Nce="remirror-menu",Oce="remirror-menu-pane",Mce="remirror-menu-pane-active",jce="remirror-menu-dropdown-label",Rce="remirror-menu-pane-icon",Ice="remirror-menu-pane-label",Ace="remirror-menu-pane-shortcut",Dce="remirror-menu-button-left",Lce="remirror-menu-button-right",Fce="remirror-menu-button-nested-left",zce="remirror-menu-button-nested-right",Bce="remirror-menu-button",$ce="remirror-menu-bar",Vce="remirror-flex-column",Uce="remirror-flex-row",Hce="remirror-menu-item",Wce="remirror-menu-item-row",Kce="remirror-menu-item-column",Gce="remirror-menu-item-checkbox",qce="remirror-menu-item-radio",Yce="remirror-menu-group",Jce="remirror-floating-popover",Xce="remirror-popover",Zce="remirror-animated-popover",Qce="remirror-role",eue="remirror-separator",tue="remirror-tab",nue="remirror-tab-list",rue="remirror-tabbable",oue="remirror-toolbar",iue="remirror-tooltip",sue="remirror-table-size-editor",aue="remirror-table-size-editor-body",lue="remirror-table-size-editor-cell",cue="remirror-table-size-editor-cell-selected",uue="remirror-table-size-editor-footer",due="remirror-color-picker",fue="remirror-color-picker-cell",hue="remirror-color-picker-cell-selected";var pue=Object.freeze({__proto__:null,ANIMATED_POPOVER:Zce,BUTTON:xce,BUTTON_ACTIVE:yce,COLOR_PICKER:due,COLOR_PICKER_CELL:fue,COLOR_PICKER_CELL_SELECTED:hue,COMPOSITE:bce,DIALOG:wce,DIALOG_BACKDROP:Sce,EDITOR_WRAPPER:vce,FLEX_COLUMN:Vce,FLEX_ROW:Uce,FLOATING_POPOVER:Jce,FORM:kce,FORM_GROUP:_ce,FORM_LABEL:Cce,FORM_MESSAGE:Ece,GROUP:Tce,INPUT:Pce,MENU:Nce,MENU_BAR:$ce,MENU_BUTTON:Bce,MENU_BUTTON_LEFT:Dce,MENU_BUTTON_NESTED_LEFT:Fce,MENU_BUTTON_NESTED_RIGHT:zce,MENU_BUTTON_RIGHT:Lce,MENU_DROPDOWN_LABEL:jce,MENU_GROUP:Yce,MENU_ITEM:Hce,MENU_ITEM_CHECKBOX:Gce,MENU_ITEM_COLUMN:Kce,MENU_ITEM_RADIO:qce,MENU_ITEM_ROW:Wce,MENU_PANE:Oce,MENU_PANE_ACTIVE:Mce,MENU_PANE_ICON:Rce,MENU_PANE_LABEL:Ice,MENU_PANE_SHORTCUT:Ace,POPOVER:Xce,ROLE:Qce,SEPARATOR:eue,TAB:tue,TABBABLE:rue,TABLE_SIZE_EDITOR:sue,TABLE_SIZE_EDITOR_BODY:aue,TABLE_SIZE_EDITOR_CELL:lue,TABLE_SIZE_EDITOR_CELL_SELECTED:cue,TABLE_SIZE_EDITOR_FOOTER:uue,TAB_LIST:nue,TOOLBAR:oue,TOOLTIP:iue});const mue="remirror-image-loader";var gue=Object.freeze({__proto__:null,IMAGE_LOADER:mue});const vue="remirror-list-item-with-custom-mark",yue="remirror-ul-list-content",xue="remirror-editor",bue="remirror-list-item-marker-container",wue="remirror-list-item-checkbox",Sue="remirror-collapsible-list-item-closed",kue="remirror-collapsible-list-item-button",Eue="remirror-list-spine";var Ca=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:kue,COLLAPSIBLE_LIST_ITEM_CLOSED:Sue,EDITOR:xue,LIST_ITEM_CHECKBOX:wue,LIST_ITEM_MARKER_CONTAINER:bue,LIST_ITEM_WITH_CUSTOM_MARKER:vue,LIST_SPINE:Eue,UL_LIST_CONTENT:yue});const Cue="remirror-is-empty";var _ue=Object.freeze({__proto__:null,IS_EMPTY:Cue});const Tue="remirror-editor",Pue="remirror-positioner",Nue="remirror-positioner-widget";var Oue=Object.freeze({__proto__:null,EDITOR:Tue,POSITIONER:Pue,POSITIONER_WIDGET:Nue});const wo={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"]},Hi="#000000",Ak="#ffffff",Mue="#252103",Dk=iv(Hi,.75),jy="#7963d2",Lk="#bcd263",jue="#fff",Rue="#fff",Fk=wo.gray[1],CP="rgba(10,31,68,0.08)",_P="rgba(10,31,68,0.10)",TP="rgba(10,31,68,0.12)",Iue=Rm(iv(Hi,.1),.13),zk={background:Ak,border:Dk,foreground:Hi,muted:Fk,primary:jy,secondary:Lk,primaryText:jue,secondaryText:Rue,text:Mue,faded:Iue},Aue={...zk,background:Pr(Ak,.15),border:Pr(Dk,.15),foreground:Pr(Hi,.15),muted:Pr(Fk,.15),primary:Pr(jy,.15),secondary:Pr(Lk,.15),get text(){return Gc(this.background)},get primaryText(){return Gc(this.primary)},get secondaryText(){return Gc(this.secondary)}},Due={...zk,background:Pr(Ak,.075),border:Pr(Dk,.075),foreground:Pr(Hi,.075),muted:Pr(Fk,.075),primary:Pr(jy,.075),secondary:Pr(Lk,.075),get text(){return Gc(this.background)},get primaryText(){return Gc(this.primary)},get secondaryText(){return Gc(this.secondary)}};({...zk,backdrop:iv(Hi,.1),outline:iv(jy,.6),table:(Rm(Hi,.8),Rm(Hi,.4),wo.gray[3],wo.blue[7],wo.blue[1],wo.blue[5],wo.blue[7],Rm(Hi,.4),wo.blue[5],wo.red[7],wo.red[1],wo.red[5])},`${CP}`,`${_P}`,`${TP}`);var Lue=Object.defineProperty,Fue=Object.getOwnPropertyDescriptor,Bk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Fue(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&&Lue(t,n,o),o},jL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Jt=(e,t,n)=>(jL(e,t,"read from private field"),n?n.call(e):t.get(e)),Ti=(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)},Es=(e,t,n,r)=>(jL(e,t,"write to private field"),t.set(e,n),n),Wd,Kd,pc,Gd,Im,qd,Yd,Jd,Xd,Am=class{constructor(e){Ti(this,Wd,py()),Ti(this,Kd,[]),Ti(this,pc,new Map),Ti(this,Gd,[]),Ti(this,Im,!1),Ti(this,qd,void 0),Ti(this,Yd,void 0),Ti(this,Jd,void 0),Ti(this,Xd,void 0),this.addListener=(t,n)=>Jt(this,Wd).on(t,n),Es(this,qd,e),Es(this,Yd,e.getActive),Es(this,Xd,e.getPosition),Es(this,Jd,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new Am(e)}static fromPositioner(e,t){return Am.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:Jt(this,Yd),getPosition:Jt(this,Xd),hasChanged:this.hasChanged,events:this.events,getID:Jt(this,Jd)}}onActiveChanged(e){this.recentUpdate=e;const t=Jt(this,Yd).call(this,e);Es(this,Kd,t),Es(this,pc,new Map),Es(this,Im,!1),Es(this,Gd,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);Jt(this,Gd).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}Jt(this,Wd).emit("update",n)}getID(e,t){var n;return((n=Jt(this,Jd))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(Jt(this,Im)||(Jt(this,pc).set(t,e),Jt(this,pc).size<Jt(this,Kd).length))return;const n=[];for(const r of Jt(this,Kd).keys()){const o=Jt(this,pc).get(r);Ee(o,{code:re.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=Jt(this,Gd)[r];if(!i)return;n.push({position:Jt(this,Xd).call(this,o),element:o.element,id:i})}Jt(this,Wd).emit("done",n)}clone(e){return Am.create({...Jt(this,qd),..._t(e)?e(Jt(this,qd)):e})}active(e){const t=_t(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},Do=Am;Wd=new WeakMap;Kd=new WeakMap;pc=new WeakMap;Gd=new WeakMap;Im=new WeakMap;qd=new WeakMap;Yd=new WeakMap;Jd=new WeakMap;Xd=new WeakMap;Do.EMPTY=[];function zue(e,t=DL){const{key:n}=(e==null?void 0:e.getMeta(AL))??{};return n===t}function RL(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&zue(t)?!0:t?Lte(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function IL(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(vi(t)&&o){const u=Number.parseFloat(Ss(t,"padding-left").replace("px","")),d=Number.parseFloat(Ss(t,"padding-right").replace("px","")),h=Number.parseFloat(Ss(t,"padding-top").replace("px","")),p=Number.parseFloat(Ss(t,"padding-bottom").replace("px","")),m=Number.parseFloat(Ss(t,"border-left").replace("px","")),v=Number.parseFloat(Ss(t,"border-right").replace("px","")),b=Number.parseFloat(Ss(t,"border-top").replace("px","")),x=Number.parseFloat(Ss(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,S=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=d+v+(t.dir==="rtl"?0:w),a+=h+b,l+=p+x+S}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(q_(u,c.top,c.bottom)&&q_(d,c.left,c.right))return!0;return!1}var Bue="remirror-positioner-widget",AL="positionerUpdate",DL="__all_positioners__",LL={y:-999999,x:-999999,width:0,height:0},PP={...LL,left:-999999,top:-999999,bottom:-999999,right:-999999},$ue={...LL,rect:{...PP,toJSON:()=>PP},visible:!1},Vue=Do.create({hasChanged:RL,getActive(e){const{state:t}=e;if(!Ek(t)||t.selection.$anchor.depth>2)return Do.EMPTY;const n=Sy({predicate:r=>r.type.isBlock,selection:t});return n?[n]:Do.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!vi(r))return $ue;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=IL(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),FL=Vue.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&Pk(n.node)&&n.node.type===Cy(t.state.schema)?[n]:Do.EMPTY}}));FL.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));FL.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 $k(e){return Do.create({hasChanged:RL,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!Ul(n.selection))return Do.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return Do.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),h=Math.min(i.top,s.top),p=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+h-l.top,v=u?1:Math.abs(i.left-s.right),b=new DOMRect(u?s.left:d,h,v,c),x=IL(b,o.dom);return{rect:b,y:m,x:p,height:c,width:v,visible:x}}})}var Uue=$k(e=>!e.selection.empty);$k(e=>e.selection.empty);$k(()=>!0);Uue.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return Do.EMPTY;const r=GD(t);if(!r)return Do.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return Do.EMPTY}}}));var Sh=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:Oue.EDITOR}}init(){this.onScroll=RX(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 ot.empty;const t=Ct.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return ot.create(e.doc,[t])}forceUpdatePositioners(e=DL){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta(AL,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=Bue,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}}))}};Bk([ye()],Sh.prototype,"forceUpdatePositioners",1);Bk([Ft()],Sh.prototype,"getPositionerWidget",1);Sh=Bk([rt({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],Sh);var Hue=Object.defineProperty,Wue=Object.getOwnPropertyDescriptor,Kue=(e,t,n,r)=>{for(var o=r>1?void 0:r?Wue(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&&Hue(t,n,o),o},Pw=class extends po{get name(){return"text"}createTags(){return[Ue.InlineNode]}createNodeSpec(){return{}}};Pw=Kue([rt({disableExtraAttributes:!0,defaultPriority:ft.Medium})],Pw);var Gue={...Eu.defaultOptions,...Il.defaultOptions,...yi.defaultOptions,excludeExtensions:[]};function que(e={}){e={...Gue,...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 yi({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new Eu({content:t})),a.text||l.push(new Pw),a.paragraph||l.push(new Il),a.positioner||l.push(new Sh),a.gapCursor||l.push(new _w),a.events||l.push(new rv),l}var Yue=Object.defineProperty,Jue=Object.getOwnPropertyDescriptor,Xue=(e,t,n,r)=>{for(var o=r>1?void 0:r?Jue(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&&Yue(t,n,o),o},Al=class extends Tt{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:Tk(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>Zue({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>Que({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=ir.EditorView&&this.store.updateAttributes()}};Al=Xue([rt({defaultOptions:{emptyNodeClass:_ue.IS_EMPTY,placeholder:""}})],Al);function Zue(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:Tk(o.doc)}:t}function Que(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=Ct.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),ot.create(n.doc,s)}var ede=Object.defineProperty,tde=Object.getOwnPropertyDescriptor,nde=(e,t,n,r)=>{for(var o=r>1?void 0:r?tde(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&&ede(t,n,o),o},rde={...Al.defaultOptions,...bh.defaultOptions},ode=[...Al.staticKeys,...bh.staticKeys],kh=class extends Tt{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(Al).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Al({emptyNodeClass:e,placeholder:t,priority:ft.Low}),new bh({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};kh=nde([rt({defaultOptions:rde,staticKeys:ode})],kh);var zL={};Object.defineProperty(zL,"__esModule",{value:!0});function ide(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return OP(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return OP(r,o)},e[0]);return n||null}var yd=zL.default=ide,NP=new WeakMap;function OP(e,t){if(e&&t){var n=NP.get(e)||new WeakMap;NP.set(e,n);var r=n.get(t)||function(o){MP(e,o),MP(t,o)};return n.set(t,r),r}return e||t}function MP(e,t){typeof e=="function"?e(t):e.current=t}var BL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},f0=(e,t,n)=>(BL(e,t,"read from private field"),t.get(e)),sde=(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)},ade=(e,t,n,r)=>(BL(e,t,"write to private field"),t.set(e,n),n);function lde(){const[,e]=g.useState(we());return g.useCallback(()=>{e(we())},[])}var $L=g.createContext(null);function Ry(e){const t=g.useContext($L),n=g.useRef(lde());Ee(t,{code:re.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(Vl(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(_t(o))return r("updated",o)}},[r,e]),t}function cde(e=!0){return Ry({autoUpdate:e}).active}function ude(e=!1){return Ry(e?{autoUpdate:!0}:void 0).attrs}function VL(){return Ry().chain.new()}var[dde,Cme]=aoe(({props:e})=>{const t=e.locale??"en",n=e.i18n??Oy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function jP(e,t={}){const{core:n,react:r,...o}=t;return Kre(e)?e:Wre.create(()=>[...y2(e),new kh(r),...que(n)],o)}function fde(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>jP(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>jP(n.current,r.current))}),[o]),o}var hde=typeof yd=="object"&&yd.__esModule&&yd.default?yd.default:yd,mc,pde=class extends Bre{constructor(e){if(super(e),sde(this,mc,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??we();return{[r]:hde(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,Ee(this.rootPropsConfig.count<=1,{code:re.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),ade(this,mc,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(Al).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new ote(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;Ee(i,{code:re.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),Ee(n,{code:re.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(U_,{}))),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(U_,{})),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(){Ee(f0(this,mc),{code:re.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(f0(this,mc),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&f0(this,mc)&&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}};mc=new WeakMap;var UL=typeof document<"u"?g.useLayoutEffect:g.useEffect;function mde(e){const t=g.useRef();return UL(()=>{t.current=e}),t.current}function gde(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!wa(r)&&t.getExtension(kh).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(kh).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=on(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=vde({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),yde(a),a.frameworkOutput}function vde(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new pde(t.current),[]);return n.update(e),n}function yde(e){const{state:t}=e.props,n=g.useRef(!!t),r=mde(t);UL(()=>{const o=t?n.current===!0:n.current===!1;Ee(o,{code:re.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 xde(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=fde(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 Nw=()=>Se.createElement("div",{className:pue.EDITOR_WRAPPER,...Ry().getRootProps()}),bde=e=>(e.hook(),null);function wde(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=gde(a),c=Zre(l.portalContainer),u=n==="start"||n===!0||!t&&wa(n),d=n==="end";return Se.createElement(dde,{i18n:r,locale:o,supportedLocales:i},Se.createElement($L.Provider,{value:l},Se.createElement(Xre,{portals:c}),s.map((h,p)=>Se.createElement(bde,{hook:h,key:p})),u&&Se.createElement(Nw,null),t,d&&Se.createElement(Nw,null)))}function Sde(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 kde(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function kde(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 Ol(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new Ol(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=lk(i,n,r,t);return a?(e&&Ede(e,t,a,o,n),!0):!1}function Ede(e,t,n,r,o){let i=K.empty;for(let u=n.length-1;u>=0;u--)i=K.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 ae(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,h=!0;u<d;u++,h=!1)!h&&Hc(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function Cde(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?_de(t,n,e,i):Tde(t,n,i):!0:!1}}function _de(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 ae(K.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ol(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Wu(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return fp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function Tde(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+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?K.empty:K.from(o))))return!1;let d=i.pos,h=d+s.nodeSize;return r.step(new Ut(d-(a?1:0),h+(l?1:0),d+1,h-1,new ae((a?K.empty:K.from(o.copy(K.empty))).append(l?K.empty:K.from(o.copy(K.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var Pde=Object.defineProperty,Nde=Object.getOwnPropertyDescriptor,mo=(e,t,n,r)=>{for(var o=r>1?void 0:r?Nde(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&&Pde(t,n,o),o};function Ow(e){var t;return!!((t=e.spec.group)!=null&&t.includes(Ue.ListContainerNode))}function Ode(e){var t;return!!((t=e.spec.group)!=null&&t.includes(Ue.ListItemNode))}function _a(e){return Ow(e.type)}function ua(e){return Ode(e.type)}function Vk(e,t){return n=>{const{dispatch:r,tr:o}=n,i=Sk(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Sy({predicate:u=>Ow(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return KL(t)(n);if(Ow(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):Mde(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return Sde(e)(i,r)}}function HL(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var p,m;const i=Ute(e,o.schema),{$from:s,$to:a}=n.selection;if(Ey(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=K.empty;for(let S=s.depth-(v?1:2);S>=s.depth-3;S--)b=K.from(s.node(S).copy(b));const x=((p=i.contentMatch.defaultType)==null?void 0:p.createAndFill())||void 0;b=b.append(K.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 ae(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(Le.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 h=u?[{type:i,attrs:c},{type:u,attrs:d}]:[{type:i,attrs:c}];return Hc(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,h).scrollIntoView()),!0):!1}}function Mde(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,K.from(n.create())))return!1;const l=[];for(let p=0;p<o.childCount;p++){const m=o.child(p);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,h=e.selection.from;return e.replaceRangeWith(u,d,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(h))),!0}function jde({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 ae(K.from(a),0,0)),!0}function Cu({listType:e,itemType:t,tr:n}){const r=sv(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return jde({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Le.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function Rde(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?K.empty:K.from(o))))return!1;const h=s.pos,p=h+a.nodeSize;return r.step(new Ut(h-(l?1:0),p+(c?1:0),h+1,p-1,new ae((l?K.empty:K.from(o.copy(K.empty))).append(c?K.empty:K.from(o.copy(K.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function WL(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&&_a(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&&_a(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)fp(e.doc,c)&&(e.join(c),l=!0);return l}function KL(e){return t=>{const{dispatch:n,tr:r}=t,o=Sk(r,t.state),i=Ide(e,r.selection);return i?(n&&Rde(o,n,i),!0):!1}}function Ide(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 sv(e){const{$from:t,$to:n}=e;return t.blockRange(n,_a)}function Ade(e){const t=e.selection.$from,n=t.blockRange();if(!n||!ua(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&&_a(a)&&l&&ua(l))return Cu({listType:a.type,itemType:l.type,tr:e});if(ua(r)){const c=r,u=t.node(n.depth-3);if(_a(u))return Cu({listType:u.type,itemType:c.type,tr:e})}return!1}function RP({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||!ua(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;Ade(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!ua(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&&ua(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&Cde(n.parent.type)(e.state,e.dispatch)}return rL(e.state,e.dispatch,e),!0}function GL({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Ca.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(Ca.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 Dde(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!ua(n)||!_a(r)?!1:{parentItem:n,parentList:r}}function Lde(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 ae(K.from(r.type.create(null,n.copy())),1,0),1,!0)),new Ol(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function Fde(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 ae(K.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Ol(e.selection.$from,e.selection.$to,t.depth)):t}function zde(e,t,n,r){return Cu({listType:n.type,itemType:r.type,tr:e})?new Ol(e.selection.$from,e.selection.$to,t.depth):t}function Bde(e){let t=sv(e.selection);if(!t)return!1;const n=Dde(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=Lde(e,t),t=Fde(e,t),t=zde(e,t,o,r);const i=Wu(t);return typeof i!="number"||(e.lift(t,i),t=sv(e.selection),t&&WL(e,e.doc.resolve(t.end-2))),!0}var $de=({tr:e,dispatch:t})=>Bde(e)?(t==null||t(e.scrollIntoView()),!0):!1;function Vde(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),!_a(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,!ua(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function Ude(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 Hde(e){const{$from:t,$to:n}=e.selection,r=sv(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!_a(o))return!1;const i=Vde(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=Ude(e.doc,n,r),d=s.content.append(K.fromArray([o.copy(c.content)])).append(u?u.content:K.empty);e.deleteRange(r.start,r.end);const h=l+s.nodeSize-2,p=s.copy(d);return p.check(),e.replaceRangeWith(l-1,h+1,p),e.setSelection(a===o?Le.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Le.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var Wde=({tr:e,dispatch:t})=>Hde(e)?(t==null||t(e.scrollIntoView()),!0):!1,qL=class extends Tt{get name(){return"listItemShared"}createKeymap(){const e={Tab:Wde,"Shift-Tab":$de,Backspace:RP,"Mod-Backspace":RP};if(Po.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 WL(r)?r:null}}}},_u=class extends po{get name(){return"listItem"}createTags(){return[Ue.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(Ca.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=Te.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),GL({mark:r,node:e,updateDOM:Kde,updateMark:Gde})}:{}}createKeymap(){return{Enter:HL(this.type)}}createExtensions(){return[new qL]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!Ey(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=DX(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return KL(e??this.type)}};mo([ye()],_u.prototype,"toggleListItemClosed",1);mo([ye()],_u.prototype,"liftListItemOutOfList",1);_u=mo([rt({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],_u);function Kde(e,t){e.attrs.closed?t.classList.add(Ca.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(Ca.COLLAPSIBLE_LIST_ITEM_CLOSED)}function Gde(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var Eh=class extends po{get name(){return"bulletList"}createTags(){return[Ue.Block,Ue.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(Ca.LIST_SPINE),u.addEventListener("click",d=>{const h=n(),p=t.state.doc.resolve(h+1),m=p.start(p.depth-1),v=Te.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(Ca.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new _u({priority:ft.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return Vk(this.type,Mt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[fk(e,this.type),new ho(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),Cu({listType:this.type,itemType:Mt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};mo([ye({icon:"listUnordered",label:({t:e})=>e(dk.BULLET_LIST_LABEL)})],Eh.prototype,"toggleBulletList",1);mo([Gr({shortcut:oe.BulletList,command:"toggleBulletList"})],Eh.prototype,"listShortcut",1);Eh=mo([rt({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],Eh);var Ch=class extends po{get name(){return"orderedList"}createTags(){return[Ue.Block,Ue.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>vi(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 _u({priority:ft.Low})]}toggleOrderedList(){return Vk(this.type,Mt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[fk(e,this.type,t=>({order:+Mt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+Mt(t,1)),new ho(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Cu({listType:this.type,itemType:Mt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+Mt(n,1);if(a!==1){const l=vh({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};mo([ye({icon:"listOrdered",label:({t:e})=>e(dk.ORDERED_LIST_LABEL)})],Ch.prototype,"toggleOrderedList",1);mo([Gr({shortcut:oe.OrderedList,command:"toggleOrderedList"})],Ch.prototype,"listShortcut",1);Ch=mo([rt({})],Ch);var YL=class extends po{get name(){return"taskListItem"}createTags(){return[Ue.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 vi(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(Ca.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,GL({node:e,mark:r,updateDOM:qde,updateMark:Yde})}}createKeymap(){return{Enter:HL(this.type)}}createExtensions(){return[new qL]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=vh({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[fk(e,this.type,t=>({checked:["x","X"].includes(yf(t,2))})),new ho(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!Cu({listType:Mt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(yf(n,2));if(a){const l=vh({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};mo([ye()],YL.prototype,"toggleCheckboxChecked",1);function qde(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function Yde(e,t){t.checked=!!e.attrs.checked}var JL=class extends po{get name(){return"taskList"}createTags(){return[Ue.Block,Ue.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 YL({})]}toggleTaskList(){return Vk(this.type,Mt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};mo([ye({icon:"checkboxMultipleLine",label:({t:e})=>e(dk.TASK_LIST_LABEL)})],JL.prototype,"toggleTaskList",1);mo([Gr({shortcut:oe.TaskList,command:"toggleTaskList"})],JL.prototype,"listShortcut",1);function Jde(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:h,children:p,...m}=d,v=(h==null?void 0:h[e][l])||a,b=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:b,children:p})}function u(d,h){const p=(h==null?void 0:h[e][l])||a,m=g.useContext(p);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,Xde(o,...t)]}function Xde(...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 h0="rovingFocusGroup.onEntryFocus",Zde={bubbles:!1,cancelable:!0},Iy="RovingFocusGroup",[Mw,XL,Qde]=Qv(Iy),[efe,ZL]=Jde(Iy,[Qde]),[tfe,nfe]=efe(Iy),QL=g.forwardRef((e,t)=>f.jsx(Mw.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Mw.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(rfe,{...e,ref:t})})}));QL.displayName=Iy;var rfe=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,h=g.useRef(null),p=Be(t,h),m=ep(i),[v=null,b]=Fr({prop:s,defaultProp:a,onChange:l}),[x,w]=g.useState(!1),S=tn(c),C=XL(n),_=g.useRef(!1),[P,O]=g.useState(0);return g.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(h0,S),()=>j.removeEventListener(h0,S)},[S]),f.jsx(tfe,{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(()=>O(j=>j+1),[]),onFocusableItemRemove:g.useCallback(()=>O(j=>j-1),[]),children:f.jsx(_e.div,{tabIndex:x||P===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{_.current=!0}),onFocus:te(e.onFocus,j=>{const I=!_.current;if(j.target===j.currentTarget&&I&&!x){const F=new CustomEvent(h0,Zde);if(j.currentTarget.dispatchEvent(F),!F.defaultPrevented){const H=C().filter(A=>A.focusable),$=H.find(A=>A.active),J=H.find(A=>A.id===v),B=[$,J,...H].filter(Boolean).map(A=>A.ref.current);n4(B,u)}}_.current=!1}),onBlur:te(e.onBlur,()=>w(!1))})})}),e4="RovingFocusGroupItem",t4=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Ir(),l=i||a,c=nfe(e4,n),u=c.currentTabStopId===l,d=XL(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return g.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(Mw.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(_e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:te(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:te(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:te(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=sfe(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?afe(x,w+1):x.slice(w+1)}setTimeout(()=>n4(x))}})})})});t4.displayName=e4;var ofe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ife(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sfe(e,t,n){const r=ife(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ofe[r]}function n4(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function afe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lfe=QL,cfe=t4,jw=["Enter"," "],ufe=["ArrowDown","PageUp","Home"],r4=["ArrowUp","PageDown","End"],dfe=[...ufe,...r4],ffe={ltr:[...jw,"ArrowRight"],rtl:[...jw,"ArrowLeft"]},hfe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yp="Menu",[_h,pfe,mfe]=Qv(yp),[Wl,o4]=uo(yp,[mfe,bi,ZL]),Ay=bi(),i4=ZL(),[gfe,Kl]=Wl(yp),[vfe,xp]=Wl(yp),s4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Ay(t),[l,c]=g.useState(null),u=g.useRef(!1),d=tn(i),h=ep(o);return g.useEffect(()=>{const p=()=>{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",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),f.jsx(Hh,{...a,children:f.jsx(gfe,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(vfe,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};s4.displayName=yp;var yfe="MenuAnchor",Uk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ay(n);return f.jsx(Ru,{...o,...r,ref:t})});Uk.displayName=yfe;var Hk="MenuPortal",[xfe,a4]=Wl(Hk,{forceMount:void 0}),l4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Kl(Hk,t);return f.jsx(xfe,{scope:t,forceMount:n,children:f.jsx(an,{present:n||i.open,children:f.jsx(Iu,{asChild:!0,container:o,children:r})})})};l4.displayName=Hk;var io="MenuContent",[bfe,Wk]=Wl(io),c4=g.forwardRef((e,t)=>{const n=a4(io,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Kl(io,e.__scopeMenu),s=xp(io,e.__scopeMenu);return f.jsx(_h.Provider,{scope:e.__scopeMenu,children:f.jsx(an,{present:r||i.open,children:f.jsx(_h.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(wfe,{...o,ref:t}):f.jsx(Sfe,{...o,ref:t})})})})}),wfe=g.forwardRef((e,t)=>{const n=Kl(io,e.__scopeMenu),r=g.useRef(null),o=Be(t,r);return g.useEffect(()=>{const i=r.current;if(i)return Yv(i)},[]),f.jsx(Kk,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Sfe=g.forwardRef((e,t)=>{const n=Kl(io,e.__scopeMenu);return f.jsx(Kk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Kk=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:h,onDismiss:p,disableOutsideScroll:m,...v}=e,b=Kl(io,n),x=xp(io,n),w=Ay(n),S=i4(n),C=pfe(n),[_,P]=g.useState(null),O=g.useRef(null),j=Be(t,O,b.onContentChange),I=g.useRef(0),F=g.useRef(""),H=g.useRef(0),$=g.useRef(null),J=g.useRef("right"),W=g.useRef(0),B=m?np:g.Fragment,A=m?{as:Qi,allowPinchZoom:!0}:void 0,R=D=>{var ne,Oe;const z=F.current+D,V=C().filter(Ae=>!Ae.disabled),G=document.activeElement,Re=(ne=V.find(Ae=>Ae.ref.current===G))==null?void 0:ne.textValue,Y=V.map(Ae=>Ae.textValue),he=Ife(Y,z,Re),ie=(Oe=V.find(Ae=>Ae.textValue===he))==null?void 0:Oe.ref.current;(function Ae(pe){F.current=pe,window.clearTimeout(I.current),pe!==""&&(I.current=window.setTimeout(()=>Ae(""),1e3))})(z),ie&&setTimeout(()=>ie.focus())};g.useEffect(()=>()=>window.clearTimeout(I.current),[]),qv();const N=g.useCallback(D=>{var V,G;return J.current===((V=$.current)==null?void 0:V.side)&&Dfe(D,(G=$.current)==null?void 0:G.area)},[]);return f.jsx(bfe,{scope:n,searchRef:F,onItemEnter:g.useCallback(D=>{N(D)&&D.preventDefault()},[N]),onItemLeave:g.useCallback(D=>{var z;N(D)||((z=O.current)==null||z.focus(),P(null))},[N]),onTriggerLeave:g.useCallback(D=>{N(D)&&D.preventDefault()},[N]),pointerGraceTimerRef:H,onPointerGraceIntentChange:g.useCallback(D=>{$.current=D},[]),children:f.jsx(B,{...A,children:f.jsx(tp,{asChild:!0,trapped:o,onMountAutoFocus:te(i,D=>{var z;D.preventDefault(),(z=O.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx($l,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:f.jsx(lfe,{asChild:!0,...S,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:P,onEntryFocus:te(l,D=>{x.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Wh,{role:"menu","aria-orientation":"vertical","data-state":C4(b.open),"data-radix-menu-content":"",dir:x.dir,...w,...v,ref:j,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,D=>{const V=D.target.closest("[data-radix-menu-content]")===D.currentTarget,G=D.ctrlKey||D.altKey||D.metaKey,Re=D.key.length===1;V&&(D.key==="Tab"&&D.preventDefault(),!G&&Re&&R(D.key));const Y=O.current;if(D.target!==Y||!dfe.includes(D.key))return;D.preventDefault();const ie=C().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);r4.includes(D.key)&&ie.reverse(),jfe(ie)}),onBlur:te(e.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),F.current="")}),onPointerMove:te(e.onPointerMove,Th(D=>{const z=D.target,V=W.current!==D.clientX;if(D.currentTarget.contains(z)&&V){const G=D.clientX>W.current?"right":"left";J.current=G,W.current=D.clientX}}))})})})})})})});c4.displayName=io;var kfe="MenuGroup",Gk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(_e.div,{role:"group",...r,ref:t})});Gk.displayName=kfe;var Efe="MenuLabel",u4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(_e.div,{...r,ref:t})});u4.displayName=Efe;var av="MenuItem",IP="menu.itemSelect",Dy=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=xp(av,e.__scopeMenu),a=Wk(av,e.__scopeMenu),l=Be(t,i),c=g.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const h=new CustomEvent(IP,{bubbles:!0,cancelable:!0});d.addEventListener(IP,p=>r==null?void 0:r(p),{once:!0}),Pj(d,h),h.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(d4,{...o,ref:l,disabled:n,onClick:te(e.onClick,u),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),c.current=!0},onPointerUp:te(e.onPointerUp,d=>{var h;c.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:te(e.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||jw.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Dy.displayName=av;var d4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Wk(av,n),a=i4(n),l=g.useRef(null),c=Be(t,l),[u,d]=g.useState(!1),[h,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[i.children]),f.jsx(_h.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:f.jsx(cfe,{asChild:!0,...a,focusable:!r,children:f.jsx(_e.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:te(e.onPointerMove,Th(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,Th(m=>s.onItemLeave(m))),onFocus:te(e.onFocus,()=>d(!0)),onBlur:te(e.onBlur,()=>d(!1))})})})}),Cfe="MenuCheckboxItem",f4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx(v4,{scope:e.__scopeMenu,checked:n,children:f.jsx(Dy,{role:"menuitemcheckbox","aria-checked":lv(n)?"mixed":n,...o,ref:t,"data-state":Yk(n),onSelect:te(o.onSelect,()=>r==null?void 0:r(lv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});f4.displayName=Cfe;var h4="MenuRadioGroup",[_fe,Tfe]=Wl(h4,{value:void 0,onValueChange:()=>{}}),p4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=tn(r);return f.jsx(_fe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(Gk,{...o,ref:t})})});p4.displayName=h4;var m4="MenuRadioItem",g4=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=Tfe(m4,e.__scopeMenu),i=n===o.value;return f.jsx(v4,{scope:e.__scopeMenu,checked:i,children:f.jsx(Dy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Yk(i),onSelect:te(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});g4.displayName=m4;var qk="MenuItemIndicator",[v4,Pfe]=Wl(qk,{checked:!1}),y4=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Pfe(qk,n);return f.jsx(an,{present:r||lv(i.checked)||i.checked===!0,children:f.jsx(_e.span,{...o,ref:t,"data-state":Yk(i.checked)})})});y4.displayName=qk;var Nfe="MenuSeparator",x4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(_e.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});x4.displayName=Nfe;var Ofe="MenuArrow",b4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ay(n);return f.jsx(Kh,{...o,...r,ref:t})});b4.displayName=Ofe;var Mfe="MenuSub",[_me,w4]=Wl(Mfe),Zd="MenuSubTrigger",S4=g.forwardRef((e,t)=>{const n=Kl(Zd,e.__scopeMenu),r=xp(Zd,e.__scopeMenu),o=w4(Zd,e.__scopeMenu),i=Wk(Zd,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(Uk,{asChild:!0,...c,children:f.jsx(d4,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":C4(n.open),...e,ref:Dv(t,o.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,Th(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:te(e.onPointerLeave,Th(d=>{var p,m;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const v=(m=n.content)==null?void 0:m.dataset.side,b=v==="right",x=b?-5:5,w=h[b?"left":"right"],S=h[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:w,y:h.top},{x:S,y:h.top},{x:S,y:h.bottom},{x:w,y:h.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:te(e.onKeyDown,d=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&d.key===" "||ffe[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});S4.displayName=Zd;var k4="MenuSubContent",E4=g.forwardRef((e,t)=>{const n=a4(io,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Kl(io,e.__scopeMenu),s=xp(io,e.__scopeMenu),a=w4(k4,e.__scopeMenu),l=g.useRef(null),c=Be(t,l);return f.jsx(_h.Provider,{scope:e.__scopeMenu,children:f.jsx(an,{present:r||i.open,children:f.jsx(_h.Slot,{scope:e.__scopeMenu,children:f.jsx(Kk,{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:te(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:te(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),h=hfe[s.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});E4.displayName=k4;function C4(e){return e?"open":"closed"}function lv(e){return e==="indeterminate"}function Yk(e){return lv(e)?"indeterminate":e?"checked":"unchecked"}function jfe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Rfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ife(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=Rfe(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 Afe(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 Dfe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Afe(n,t)}function Th(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Lfe=s4,Ffe=Uk,zfe=l4,Bfe=c4,$fe=Gk,Vfe=u4,Ufe=Dy,Hfe=f4,Wfe=p4,Kfe=g4,Gfe=y4,qfe=x4,Yfe=b4,Jfe=S4,Xfe=E4,Jk="DropdownMenu",[Zfe,Tme]=uo(Jk,[o4]),or=o4(),[Qfe,_4]=Zfe(Jk),T4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=or(t),c=g.useRef(null),[u=!1,d]=Fr({prop:o,defaultProp:i,onChange:s});return f.jsx(Qfe,{scope:t,triggerId:Ir(),triggerRef:c,contentId:Ir(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(h=>!h),[d]),modal:a,children:f.jsx(Lfe,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};T4.displayName=Jk;var P4="DropdownMenuTrigger",N4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=_4(P4,n),s=or(n);return f.jsx(Ffe,{asChild:!0,...s,children:f.jsx(_e.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:Dv(t,i.triggerRef),onPointerDown:te(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:te(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});N4.displayName=P4;var ehe="DropdownMenuPortal",O4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=or(t);return f.jsx(zfe,{...r,...n})};O4.displayName=ehe;var M4="DropdownMenuContent",j4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=_4(M4,n),i=or(n),s=g.useRef(!1);return f.jsx(Bfe,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:te(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)"}})});j4.displayName=M4;var the="DropdownMenuGroup",nhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx($fe,{...o,...r,ref:t})});nhe.displayName=the;var rhe="DropdownMenuLabel",R4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Vfe,{...o,...r,ref:t})});R4.displayName=rhe;var ohe="DropdownMenuItem",I4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Ufe,{...o,...r,ref:t})});I4.displayName=ohe;var ihe="DropdownMenuCheckboxItem",A4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Hfe,{...o,...r,ref:t})});A4.displayName=ihe;var she="DropdownMenuRadioGroup",ahe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Wfe,{...o,...r,ref:t})});ahe.displayName=she;var lhe="DropdownMenuRadioItem",D4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Kfe,{...o,...r,ref:t})});D4.displayName=lhe;var che="DropdownMenuItemIndicator",L4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Gfe,{...o,...r,ref:t})});L4.displayName=che;var uhe="DropdownMenuSeparator",F4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(qfe,{...o,...r,ref:t})});F4.displayName=uhe;var dhe="DropdownMenuArrow",fhe=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Yfe,{...o,...r,ref:t})});fhe.displayName=dhe;var hhe="DropdownMenuSubTrigger",z4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Jfe,{...o,...r,ref:t})});z4.displayName=hhe;var phe="DropdownMenuSubContent",B4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=or(n);return f.jsx(Xfe,{...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)"}})});B4.displayName=phe;var mhe=T4,ghe=N4,vhe=O4,$4=j4,V4=R4,U4=I4,H4=A4,W4=D4,K4=L4,G4=F4,q4=z4,Y4=B4;const yhe=mhe,xhe=ghe,bhe=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(q4,{ref:o,className:ze("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(Wv,{className:"w-4 h-4 ml-auto"})]}));bhe.displayName=q4.displayName;const whe=g.forwardRef(({className:e,...t},n)=>f.jsx(Y4,{ref:n,className:ze("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}));whe.displayName=Y4.displayName;const J4=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>f.jsx(vhe,{container:n,children:f.jsx($4,{ref:o,sideOffset:t,className:ze("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})}));J4.displayName=$4.displayName;const Os=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(U4,{ref:r,className:ze("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}));Os.displayName=U4.displayName;const She=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(H4,{ref:o,className:ze("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(K4,{children:f.jsx(Zh,{className:"w-4 h-4"})})}),t]}));She.displayName=H4.displayName;const khe=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(W4,{ref:r,className:ze("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(K4,{children:f.jsx(u7,{className:"w-2 h-2 fill-current"})})}),t]}));khe.displayName=W4.displayName;const Ehe=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(V4,{ref:r,className:ze("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ehe.displayName=V4.displayName;const Che=g.forwardRef(({className:e,...t},n)=>f.jsx(G4,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",e),...t}));Che.displayName=G4.displayName;var _he=Object.defineProperty,The=Object.getOwnPropertyDescriptor,bp=(e,t,n,r)=>{for(var o=r>1?void 0:r?The(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&&_he(t,n,o),o},Phe={icon:"bold",label:({t:e})=>e(hT.LABEL),description:({t:e})=>e(hT.DESCRIPTION)},Dl=class extends gp{get name(){return"bold"}createTags(){return[Ue.FormattingMark,Ue.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>vi(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>Ie(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[Qg({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return xh({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=lo(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}=lo(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)}};bp([ye(Phe)],Dl.prototype,"toggleBold",1);bp([ye()],Dl.prototype,"setBold",1);bp([ye()],Dl.prototype,"removeBold",1);bp([Gr({shortcut:oe.Bold,command:"toggleBold"})],Dl.prototype,"shortcut",1);Dl=bp([rt({defaultOptions:{weight:void 0},staticKeys:["weight"]})],Dl);var Nhe=Object.defineProperty,Ohe=Object.getOwnPropertyDescriptor,Xk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ohe(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&&Nhe(t,n,o),o},Mhe={icon:"italic",label:({t:e})=>e(pT.LABEL),description:({t:e})=>e(pT.DESCRIPTION)},Ph=class extends gp{get name(){return"italic"}createTags(){return[Ue.FontStyle,Ue.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":xh({type:this.type})}}createInputRules(){return[Qg({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),Qg({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 xh({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};Xk([ye(Mhe)],Ph.prototype,"toggleItalic",1);Xk([Gr({shortcut:oe.Italic,command:"toggleItalic"})],Ph.prototype,"shortcut",1);Ph=Xk([rt({})],Ph);var jhe=Object.defineProperty,Rhe=Object.getOwnPropertyDescriptor,Zk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Rhe(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&&jhe(t,n,o),o},Ihe={icon:"strikethrough",label:({t:e})=>e(mT.LABEL),description:({t:e})=>e(mT.DESCRIPTION)},Nh=class extends gp{get name(){return"strike"}createTags(){return[Ue.FontStyle,Ue.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 xh({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[Qg({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};Zk([ye(Ihe)],Nh.prototype,"toggleStrike",1);Zk([Gr({shortcut:oe.Strike,command:"toggleStrike"})],Nh.prototype,"shortcut",1);Nh=Zk([rt({})],Nh);var Ahe='<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>',Dhe='<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>',Lhe=encodeURIComponent(Ahe),Fhe=encodeURIComponent(Dhe),Kn,$P,zhe=($P=class{constructor(e){zt(this,"dom");jn(this,Kn);zt(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,Je(this,Kn,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(ue(this,Kn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),ue(this,Kn).dataset.dragging="",e){case 0:An(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),An(ue(this,Kn),{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(ue(this,Kn),{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(ue(this,Kn),{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(ue(this,Kn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Fhe}") `});break;case 4:An(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),An(ue(this,Kn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Lhe}") `});break}this.dom.append(ue(this,Kn))}setHandleVisibility(e){const t=e||!!ue(this,Kn).dataset.dragging;ue(this,Kn).style.opacity=t?"1":"0"}dataSetDragging(e){ue(this,Kn).dataset.dragging=e?"true":""}},Kn=new WeakMap,$P),nm=50,X4=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(X4||{}),Bs,$s,Vs,ei,Us,VP,Bhe=(VP=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){zt(this,"dom");jn(this,Bs);jn(this,$s);jn(this,Vs,[]);zt(this,"aspectRatio");jn(this,ei);jn(this,Us);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(h=>new zhe(h));for(const h of c){const p=m=>{this.startResizing(m,t,n,h)};h.dom.addEventListener("mousedown",p),ue(this,Vs).push(()=>h.dom.removeEventListener("mousedown",p)),s.append(h.dom)}const u=()=>{c.forEach(h=>h.setHandleVisibility(!0))},d=()=>{c.forEach(h=>h.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),ue(this,Vs).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,Je(this,$s,e),Je(this,Bs,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:AP(t.width),aspectRatio:`${t.width} / ${t.height}`}):An(n,{width:AP(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),An(n,{maxWidth:"100%",minWidth:`${nm}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),ue(this,Bs).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=ue(this,Bs))==null?void 0:u.getBoundingClientRect().width)||0,a=((d=ue(this,Bs))==null?void 0:d.getBoundingClientRect().height)||0,l=qb(100,!1,h=>{const p=h.pageX,m=h.pageY,v=p-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<nm&&(this.aspectRatio===0&&s&&a?(x=nm,w=a/s*x):this.aspectRatio===1&&(x=nm)),x&&(Je(this,ei,Math.round(x)),this.dom.style.width=`${ue(this,ei)}px`),w&&Je(this,Us,Math.round(w)),(x||w)&&(this.dom.style.aspectRatio=`${ue(this,ei)} / ${ue(this,Us)}`)}),c=h=>{h.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),ue(this,Bs).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const p=n(),m=t.state.tr.setNodeMarkup(p,void 0,{...ue(this,$s).attrs,width:ue(this,ei),height:ue(this,Us)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),ue(this,Vs).push(()=>document.removeEventListener("mousemove",l)),ue(this,Vs).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==ue(this,$s).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==ue(this,ei)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==ue(this,ei)&&e.attrs.height!==ue(this,Us)||!$he(ue(this,$s),e,["width","height"])?!1:(Je(this,$s,e),Je(this,ei,e.attrs.width),Je(this,Us,e.attrs.height),!0)}destroy(){ue(this,Vs).forEach(e=>e())}},Bs=new WeakMap,$s=new WeakMap,Vs=new WeakMap,ei=new WeakMap,Us=new WeakMap,VP);function $he(e,t,n){return e===t||Vhe(e,t,n)&&e.content.eq(t.content)}function Vhe(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 AP(e){return typeof e=="number"?`${e}px`:e||void 0}var Uhe=Object.defineProperty,Hhe=Object.getOwnPropertyDescriptor,Qk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Hhe(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&&Uhe(t,n,o),o},Whe=class extends Bhe{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:X4.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}},Oh=class extends po{get name(){return"image"}createTags(){return[Ue.InlineNode,Ue.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(vi(r)){const i=Ghe({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=JD(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=lo(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=W2(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&&Jhe(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:h=>{i.updatePlaceholder(l[d],h)}})),l=o(a);Br(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 Whe(e,t,n):{}}};Qk([ye()],Oh.prototype,"insertImage",1);Qk([ye()],Oh.prototype,"uploadImage",1);Oh=Qk([rt({defaultOptions:{createPlaceholder:qhe,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:Yhe,enableResizing:!1,preferPastedTextContent:!0}})],Oh);function Khe(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function Ghe({element:e,parse:t}){const{width:n,height:r}=Khe(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 qhe(e,t){const n=document.createElement("div");return n.classList.add(gue.IMAGE_LOADER),n}function Yhe(e){Ee(e.length>0,{code:re.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 Jhe(e){return e.clipboardData!==void 0}function Xhe(e={}){return new cs({view(t){return new Zhe(t,e)}})}class Zhe{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=K2(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 Qhe=Object.defineProperty,epe=Object.getOwnPropertyDescriptor,tpe=(e,t,n,r)=>{for(var o=r>1?void 0:r?epe(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&&Qhe(t,n,o),o},Rw=class extends Tt{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[Xhe({color:e,width:t})]}};Rw=tpe([rt({defaultOptions:{color:"black",width:1}})],Rw);var npe=Object.defineProperty,rpe=Object.getOwnPropertyDescriptor,Z4=(e,t,n,r)=>{for(var o=r>1?void 0:r?rpe(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&&npe(t,n,o),o},{LABEL:ope}=sQ,ipe={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...ope,values:{level:t==null?void 0:t.level}})},spe=[oe.H1,oe.H2,oe.H3,oe.H4,oe.H5,oe.H6],cv=class extends po{get name(){return"heading"}createTags(){return[Ue.Block,Ue.TextBlock,Ue.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 QD({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Ge),n=we(),r=[];for(const o of this.options.levels){const i=spe[o-1]??oe.H1;n[i]=Zg(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=>_Q(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}))}};Z4([ye(ipe)],cv.prototype,"toggleHeading",1);cv=Z4([rt({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],cv);var Q4={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:W3,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,h=0,p=c.length,m=0;p--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){h=m+1;break}return 2>h?"":c.slice(h,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,h=0;for(d=c.length;h<d;h++)u.push(s(c[h]));return u}i()}}])})})(Q4);var ape=Q4.exports;const lpe=Ta(ape);var cpe=Object.defineProperty,upe=Object.getOwnPropertyDescriptor,wp=(e,t,n,r)=>{for(var o=r>1?void 0:r?upe(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&&cpe(t,n,o),o},dpe=["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"],DP="updateLink",fpe=/(?:(?:(?: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,Ll=class extends gp{constructor(){super(...arguments);zt(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[Ue.Link,Ue.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&&Wo(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(!vi(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}=JD(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=is(s,this.type);if(i){const c=l??GD(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!(Ul(o.selection)&&!Ek(o.selection)||Gte(o.selection)||Xg({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:DP,attrs:t,range:n}),hne({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 Xg({trState:r,type:this.type,...t})?tL({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(yf(t)),auto:!n}),transformMatch:t=>{const n=yf(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===DP){const{range:b,attrs:x}=v,{selection:w,doc:S}=r,C={range:b,selection:w,doc:S,attrs:x},{from:_,to:P}=b??w;this.options.onUpdateLink(S.textBetween(_,P),C)}}),!this.options.autoLink||Tw(n)-Tw(r)===1||!t.some(m=>m.docChanged))return;const a=Ite(t,n),l=Zte(a,[Ut,hn]),{mapping:c}=a,{tr:u,doc:d}=r,{updateLink:h,removeLink:p}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:b,to:x})=>{const w=[],S=x-b===2,C=this.getLinkMarksInRange(n.doc,m,v,!0).filter(_=>_.mark.type===this.type).map(({from:_,to:P,text:O})=>({mappedFrom:c.map(_),mappedTo:c.map(P),text:O,from:_,to:P}));C.forEach(({mappedFrom:_,mappedTo:P,from:O,to:j},I)=>this.getLinkMarksInRange(d,_,P,!0).filter(F=>F.mark.type===this.type).forEach(F=>{const H=n.doc.textBetween(O,j,void 0," "),$=d.textBetween(F.from,F.to+1,void 0," ").trim(),J=this.isValidUrl(H);this.isValidUrl($)||(J&&(p({from:F.from,to:F.to}).tr(),C.splice(I,1)),!S&&b===x&&this.findAutoLinks($).map(B=>this.addLinkProperties({...B,from:_+B.start,to:_+B.end})).forEach(({attrs:B,range:A,text:R})=>{h(B,A).tr(),w.push({attrs:B,range:A,text:R})}))})),this.findTextBlocksInRange(d,{from:b,to:x}).forEach(({text:_,positionStart:P})=>{this.findAutoLinks(_).map(O=>this.addLinkProperties({...O,from:P+O.start+1,to:P+O.end+1})).filter(({range:O})=>{const j=b>=O.from&&b<=O.to,I=x>=O.from&&x<=O.to;return j||I||S}).filter(({range:O})=>this.getLinkMarksInRange(u.doc,O.from,O.to,!1).length===0).filter(({range:{from:O},text:j})=>!C.some(({text:I,mappedFrom:F})=>F===O&&I===j)).forEach(({attrs:O,text:j,range:I})=>{h(O,I).tr(),w.push({attrs:O,range:I,text:j})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:_,range:P,text:O})=>{const{doc:j,selection:I}=u;this.options.onUpdateLink(O,{attrs:_,doc:j,range:P,selection:I})})})}),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=is(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 vy(t,this.options.autoLinkRegex)){const o=yf(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=lpe(t);if(r==="")return!0;const o=WX(r.split("."));return n.includes(o)}};wp([Gr({shortcut:oe.InsertLink})],Ll.prototype,"shortcut",1);wp([ye()],Ll.prototype,"updateLink",1);wp([ye()],Ll.prototype,"selectLink",1);wp([ye()],Ll.prototype,"removeLink",1);Ll=wp([rt({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:fpe,autoLinkAllowedTLDs:dpe,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:hpe},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:ft.Medium})],Ll);function hpe({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var ppe=Object.defineProperty,mpe=Object.getOwnPropertyDescriptor,e3=(e,t,n,r)=>{for(var o=r>1?void 0:r?mpe(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&&ppe(t,n,o),o},uv=class extends po{get name(){return"hardBreak"}createTags(){return[Ue.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
|
|
489
|
+
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=Rte(vf(sL),()=>(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}}};e3([ye()],uv.prototype,"insertHardBreak",1);uv=e3([rt({defaultPriority:ft.Low})],uv);const gpe=()=>[new Dl({}),new Ph,new Nh,new Oh({enableResizing:!1}),new Rw({}),new cv({levels:[1,2,3,4,5,6],defaultLevel:1}),new Eh({}),new Ch,new Ll({autoLink:!0}),new uv].slice();function vpe(e){const{manager:t,state:n,setState:r}=xde({extensions:gpe,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function ype({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,autoFocus:a}){const l=r&&Object.entries(r).some(([,h])=>h),[c,u]=g.useState(l),d=g.useMemo(()=>[ke("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:ke("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(wde,{manager:n,initialContent:e,state:t,classNames:d,onChange:o,children:[f.jsx(xpe,{hasOptions:l,options:r,debug:s,setShowToolbar:u}),f.jsx(Nw,{})]})})}const xpe=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,h,p,m,v,b,x,w,S,C,_,P,O,j,I,F,H,$,J,W,B,A,R,N,D;const o=VL(),i=cde(),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:ke("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)||((h=e==null?void 0:e.block)==null?void 0:h.h5)||((p=e==null?void 0:e.block)==null?void 0:p.h6)||i.heading())&&f.jsxs(yhe,{children:[f.jsx(xhe,{asChild:!0,className:"pr-4",children:f.jsxs("button",{children:[i.heading({level:1})&&f.jsx(n_,{size:22}),i.heading({level:2})&&f.jsx(r_,{size:22}),i.heading({level:3})&&f.jsx(o_,{size:22}),i.heading({level:4})&&f.jsx(i_,{size:22}),i.heading({level:5})&&f.jsx(s_,{size:22}),i.heading({level:6})&&f.jsx(a_,{size:22}),!i.heading()&&"Normal"]})}),f.jsxs(J4,{container:a.current,children:[f.jsx(Os,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&f.jsx(Os,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:f.jsx(n_,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&f.jsx(Os,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:f.jsx(r_,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h3)&&f.jsx(Os,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:f.jsx(o_,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h4)&&f.jsx(Os,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:f.jsx(i_,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&f.jsx(Os,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:f.jsx(s_,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&f.jsx(Os,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:f.jsx(a_,{size:16})})]})]}),(((C=e==null?void 0:e.style)==null?void 0:C.bold)||i.bold())&&f.jsx(sc,{icon:f.jsx(s7,{size:18}),stroke:3,isOption:(_=e==null?void 0:e.style)==null?void 0:_.bold,isActive:((P=e==null?void 0:e.style)==null?void 0:P.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((O=e==null?void 0:e.style)==null?void 0:O.lineThrough)||i.strike())&&f.jsx(sc,{icon:f.jsx(R7,{size:18}),stroke:3,isOption:(j=e==null?void 0:e.style)==null?void 0:j.lineThrough,isActive:((I=e==null?void 0:e.style)==null?void 0:I.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((F=e==null?void 0:e.style)==null?void 0:F.italic)||i.italic())&&f.jsx(sc,{icon:f.jsx(g7,{size:18}),stroke:3,isOption:(H=e==null?void 0:e.style)==null?void 0:H.italic,isActive:(($=e==null?void 0:e.style)==null?void 0:$.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((J=e==null?void 0:e.block)==null?void 0:J.ul)||i.bulletList())&&f.jsx(sc,{icon:f.jsx(ER,{size:18}),stroke:3,isActive:((W=e==null?void 0:e.block)==null?void 0:W.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((B=e==null?void 0:e.block)==null?void 0:B.ol)||i.orderedList())&&f.jsx(sc,{icon:f.jsx(b7,{size:18}),stroke:3,isActive:((A=e==null?void 0:e.block)==null?void 0:A.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((R=e==null?void 0:e.inline)==null?void 0:R.a)||i.link())&&f.jsx(sc,{icon:f.jsx(x7,{size:18}),stroke:3,isActive:((N=e==null?void 0:e.inline)==null?void 0:N.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((D=e==null?void 0:e.inline)==null?void 0:D.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:z=>{e2(z).then(V=>{o.insertImage({src:V.src,width:V.width,height:V.height,fileName:ee.createFilename(V.src,V.filename??null,{width:V.width,height:V.height,mimeType:V.mimeType},V.fileHash)??void 0}).focus().run()})}}),f.jsx(kR,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&f.jsx("button",{onMouseDown:z=>z.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),f.jsx(bpe,{})]})]})};function bpe(){const e=VL(),[t,n]=g.useState(),r=ude().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(Zh,{size:14})}),f.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:f.jsx($7,{size:13})})]}):null}function sc({stroke:e,isActive:t,onToggle:n,icon:r}){return f.jsx("button",{className:ke({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function wpe({path:e,autoFocus:t}){const n="richtext",r=Du(),o=It(e),i=st(e,n),s=gS(),a=vS(),l="data"in i?i.data:void 0,{manager:c}=vpe(l&&Bp(l)),{patchPath:u,addPatch:d}=On(e),[h,p]=g.useState(c.createState({content:l&&Bp(l)})),m="data"in i&&i.data,v="clientSideOnly"in i&&i.clientSideOnly;g.useEffect(()=>{v===!1&&p(w=>{try{const S=m?Bp(m):void 0,C=c.createState({content:S,selection:w.selection});return C.doc.eq(w.doc)?w:C}catch(S){return console.error("Error (re)creating editor state with selection, retrying without...",S),c.createState({content:m?Bp(m):void 0})}})},[m,v]);const b=g.useMemo(()=>{var S,C;if(!("data"in o&&o.data.type==="richtext"))return null;const w=o.data;return typeof((C=(S=w.options)==null?void 0:S.inline)==null?void 0:C.img)=="object"&&w.options.inline.img.remote&&s.status==="ready"&&(r!=null&&r.remoteHost)&&a?{publicProjectId:s.publicProjectId,bucket:a,coreVersion:s.coreVersion,schema:w.options.inline.img,remoteHost:r==null?void 0:r.remoteHost}:null},[o,s,r,a]);if(o.status==="error")return f.jsx(qt,{path:e,error:o.error,type:n});if(i.status==="error")return f.jsx(nt,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return f.jsx(Tn,{path:e,type:n});if(o.status==="loading")return f.jsx(gt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return f.jsx(gt,{path:e,type:n});if(o.data.type!==n)return f.jsx(vr,{path:e,expectedType:n,actualType:o.data.type});const x=o.data;return r!=null&&r.remoteHost||console.warn("RichTextField: config.remoteHost is not set. Remote images will not work."),f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx(ype,{autoFocus:t,state:h,options:x.options,manager:c,onChange:w=>{var C;const S=h==null?void 0:h.doc;p(w.state),S&&!w.state.doc.eq(S)&&d(Spe(u,((C=r==null?void 0:r.files)==null?void 0:C.directory)??"/public/val",w.state.doc.toJSON(),b),n)}})]})}function Spe(e,t,n,r){const{blocks:o,files:i}=n?u9(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 kpe({path:e}){const t=st(e,"richtext");if(t.status==="error")return f.jsx(nt,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return f.jsx(Tn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return f.jsx(mr,{path:e});if(t.data===null)return f.jsx(gr,{path:e});const n=Epe(t.data);return n.status==="error"?f.jsx(nt,{path:e,error:n.error,type:"richtext"}):f.jsx("div",{className:"truncate",children:n.value})}function Epe(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 eE({path:e}){const t=It(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(mr,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return f.jsx(gr,{path:e});if(r==="string")return f.jsx(WY,{path:e});if(r==="array")return f.jsx(Npe,{path:e});if(r==="boolean")return f.jsx(qY,{path:e});if(r==="number")return f.jsx(JY,{path:e});if(r==="union")return f.jsx(UJ,{path:e});if(r==="object")return f.jsx(FJ,{path:e});if(r==="image")return f.jsx(XJ,{path:e});if(r==="keyOf")return f.jsx(eX,{path:e});if(r==="date")return f.jsx(nX,{path:e});if(r==="literal")return f.jsx(rX,{path:e});if(r==="record")return f.jsx(iX,{path:e});if(r==="richtext")return f.jsx(kpe,{path:e});if(r==="file")return f.jsx(qJ,{path:e});{const o=r;return f.jsxs("div",{children:["Cannot preview: ",o]})}}function mr({path:e}){return f.jsx("div",{id:e,children:f.jsx(Uo,{size:12,className:"animate-spin"})},e+"-loading")}function gr({path:e}){return f.jsx("div",{id:e,className:"text-text-quartenary",children:"null"},e+"-null")}function Cpe({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 h of e)u.push({path:h,id:d}),d++;a(u)},[e,t]);const l=bq(Vx(oA),Vx(iA),Vx(YS,{coordinateGetter:UY})),c=g.useCallback(u=>{const{active:d,over:h}=u;if((d==null?void 0:d.id)!==(h==null?void 0:h.id)){const p=s.findIndex(v=>v.id===Number(d==null?void 0:d.id)),m=s.findIndex(v=>v.id===Number(h==null?void 0:h.id));a(v=>XS(v,p,m)),o(p,m)}},[s]);return f.jsx(bY,{sensors:l,collisionDetection:Sq,onDragEnd:c,children:f.jsx(RY,{items:s,strategy:MY,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(_pe,{id:d,schema:n,path:u,onClick:r,onDelete:h=>{i(h-1)}},d))})})})}const LP=170;function _pe({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>=LP?l(!0):l(!1))},[e,t]);const{attributes:c,listeners:u,setNodeRef:d,transform:h,transition:p}=BY({id:e,disabled:r===!0}),m=ja()||{},v={transform:ah.Transform.toString(h),transition:p};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:ke("pt-2 my-1",{"opacity-30":r}),disabled:r,onClick:()=>{o(t)},children:f.jsx(p7,{})}),f.jsx("button",{className:"pt-2 my-1 font-serif text-accent",disabled:r,onClick:()=>{o(t)},children:Tpe(e)}),((b=n==null?void 0:n.item)==null?void 0:b.type)==="string"&&f.jsx(mA,{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 bg-bg-primary hover:bg-bg-brand-primary hover:text-text-brand-primary",style:{maxHeight:LP},ref:s,disabled:r,onClick:()=>{o(t)},children:[f.jsx(eE,{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:[r2(t,m)?f.jsx(o2,{}):f.jsx("div",{className:"w-2 h-2"}),f.jsx(L7,{className:"w-4 h-4 mr-2"})]})]})}function Tpe(e){return"#"+(e-1).toString()}function Ppe({path:e}){const t="array",{navigate:n}=Vn(),r=It(e),o=st(e,t),{addPatch:i,patchPath:s}=On(e);if(r.status==="error")return f.jsx(qt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(nt,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(Tn,{path:e,type:t});if(r.status==="loading")return f.jsx(gt,{path:e,type:t});if(r.data.type!=="array")return f.jsx(vr,{path:e,expectedType:"array",actualType:r.data.type});const a=r.data;return f.jsxs("div",{id:e,children:[f.jsx(zr,{path:e}),f.jsx(Cpe,{path:e,onClick:l=>{n(l)},onDelete:async l=>{i([{op:"remove",path:s.concat(l.toString())}],a.type)},onMove:async(l,c)=>{i([{op:"move",from:s.concat(l.toString()),path:s.concat(c.toString())}],a.type)},schema:a,source:o.data||[]})]})}function Npe({path:e}){const t=st(e,"array");return t.status==="error"?f.jsx(nt,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?f.jsx(mr,{path:e}):t.data===null?f.jsx(gr,{path:e}):f.jsx("div",{children:`${t.data.length} items`})}function Ly({path:e,schema:t,autoFocus:n}){if(t.type==="string")return f.jsx(mA,{path:e,autoFocus:n},e);if(t.type==="number")return f.jsx(YY,{path:e},e);if(t.type==="boolean")return f.jsx(KY,{path:e},e);if(t.type==="image")return f.jsx(YJ,{path:e},e);if(t.type==="object")return f.jsx(LJ,{path:e},e);if(t.type==="array")return f.jsx(Ppe,{path:e},e);if(t.type==="record")return f.jsx(oX,{path:e},e);if(t.type==="union")return f.jsx(BJ,{path:e},e);if(t.type==="keyOf")return f.jsx(ZJ,{path:e},e);if(t.type==="richtext")return f.jsx(wpe,{path:e,autoFocus:n},e);if(t.type==="date")return f.jsx(tX,{path:e},e);if(t.type==="file")return f.jsx(GJ,{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 Ope({path:e}){const t=It(e),{path:n,schema:r}=GA(e),{navigate:o}=Vn(),i=wS(),s=Xh(),a=g.useCallback(p=>{if("data"in s){const m=s.data,v=BI(p,i,m);v?o(v):(o(p),console.error(`Error navigating to path: ${p} - no schemas found`))}else console.warn("Schemas not loaded yet"),o(p)},[s,i,o]);if(t.status==="error")return f.jsx(qt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return f.jsx(gt,{path:e,type:"module"});if(t.status==="not-found")return f.jsx(Tn,{path:e,type:"module"});const l=t.data,c=JA(e),u=c.slice(0,-1),d=c[c.length-1],h=_J(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:[c.length>1&&f.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:u.map((p,m)=>m<u.length-1?f.jsxs(g.Fragment,{children:[f.jsx("button",{onClick:()=>{a(p.sourcePath)},children:p.text}),f.jsx("span",{children:f.jsx(Wv,{size:16})})]},m):f.jsx("button",{onClick:()=>{a(p.sourcePath)},children:p.text},m))}),f.jsx("div",{children:f.jsxs("div",{className:"flex items-center justify-between h-6 gap-4 text-xl",children:[!h&&f.jsx("span",{children:d.text}),h&&f.jsxs("span",{children:["#",Number(d.text)]}),f.jsx(YA,{path:e,variant:"module"})]})})]}),f.jsx(Ly,{path:e,schema:l},e)]})}function Mpe(){const e=VW();return f.jsxs(f.Fragment,{children:[f.jsx(jpe,{}),f.jsx(oi,{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(Rpe,{})})})]})}function jpe(){const{navMenu:e,toolsMenu:t}=Fy();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:ke({"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(kg,{size:16,className:ke("transform",{"rotate-180":!e.isOpen})})}),f.jsx("button",{className:ke({"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(kg,{size:16,className:ke("transform",{"rotate-180":t.isOpen})})})]})}function Rpe(){const{currentSourcePath:e}=Vn(),t=e;return f.jsx(Ope,{path:t})}var tE="Dialog",[t3,Pme]=uo(tE),[Ipe,qo]=t3(tE),n3=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]=Fr({prop:r,defaultProp:o,onChange:i});return f.jsx(Ipe,{scope:t,triggerRef:a,contentRef:l,contentId:Ir(),titleId:Ir(),descriptionId:Ir(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};n3.displayName=tE;var r3="DialogTrigger",Ape=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=qo(r3,n),i=Be(t,o.triggerRef);return f.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":iE(o.open),...r,ref:i,onClick:te(e.onClick,o.onOpenToggle)})});Ape.displayName=r3;var nE="DialogPortal",[Dpe,o3]=t3(nE,{forceMount:void 0}),i3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=qo(nE,t);return f.jsx(Dpe,{scope:t,forceMount:n,children:g.Children.map(r,s=>f.jsx(an,{present:n||i.open,children:f.jsx(Iu,{asChild:!0,container:o,children:s})}))})};i3.displayName=nE;var dv="DialogOverlay",s3=g.forwardRef((e,t)=>{const n=o3(dv,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=qo(dv,e.__scopeDialog);return i.modal?f.jsx(an,{present:r||i.open,children:f.jsx(Lpe,{...o,ref:t})}):null});s3.displayName=dv;var Lpe=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=qo(dv,n);return f.jsx(np,{as:Qi,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(_e.div,{"data-state":iE(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Fl="DialogContent",a3=g.forwardRef((e,t)=>{const n=o3(Fl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=qo(Fl,e.__scopeDialog);return f.jsx(an,{present:r||i.open,children:i.modal?f.jsx(Fpe,{...o,ref:t}):f.jsx(zpe,{...o,ref:t})})});a3.displayName=Fl;var Fpe=g.forwardRef((e,t)=>{const n=qo(Fl,e.__scopeDialog),r=g.useRef(null),o=Be(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Yv(i)},[]),f.jsx(l3,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:te(e.onFocusOutside,i=>i.preventDefault())})}),zpe=g.forwardRef((e,t)=>{const n=qo(Fl,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return f.jsx(l3,{...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()}})}),l3=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=qo(Fl,n),l=g.useRef(null),c=Be(t,l);return qv(),f.jsxs(f.Fragment,{children:[f.jsx(tp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx($l,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":iE(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(Bpe,{titleId:a.titleId}),f.jsx(Vpe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),rE="DialogTitle",oE=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=qo(rE,n);return f.jsx(_e.h2,{id:o.titleId,...r,ref:t})});oE.displayName=rE;var c3="DialogDescription",u3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=qo(c3,n);return f.jsx(_e.p,{id:o.descriptionId,...r,ref:t})});u3.displayName=c3;var d3="DialogClose",f3=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=qo(d3,n);return f.jsx(_e.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});f3.displayName=d3;function iE(e){return e?"open":"closed"}var h3="DialogTitleWarning",[Nme,p3]=pU(h3,{contentName:Fl,titleName:rE,docsSlug:"dialog"}),Bpe=({titleId:e})=>{const t=p3(h3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
490
|
+
|
|
491
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
492
|
+
|
|
493
|
+
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},$pe="DialogDescriptionWarning",Vpe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${p3($pe).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},Upe=n3,Hpe=i3,m3=s3,g3=a3,v3=oE,y3=u3,Wpe=f3;const Kpe=Upe,Gpe=Hpe,x3=g.forwardRef(({className:e,...t},n)=>f.jsx(m3,{ref:n,className:ze("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}));x3.displayName=m3.displayName;const b3=g.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},i)=>f.jsxs(Gpe,{container:n,children:[f.jsx(x3,{}),f.jsxs(g3,{ref:i,className:ze("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(Wpe,{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(du,{className:"w-4 h-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));b3.displayName=g3.displayName;const w3=({className:e,...t})=>f.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});w3.displayName="DialogHeader";const qpe=g.forwardRef(({className:e,...t},n)=>f.jsx(v3,{ref:n,className:ze("text-lg font-semibold leading-none tracking-tight",e),...t}));qpe.displayName=v3.displayName;const S3=g.forwardRef(({className:e,...t},n)=>f.jsx(y3,{ref:n,className:ze("text-sm text-text-primary",e),...t}));S3.displayName=y3.displayName;function Ype(){const e=Kr();return f.jsx(Kpe,{open:!0,modal:!0,children:f.jsxs(b3,{container:e,"aria-label":"Login required",className:"bg-bg-primary text-text-primary",children:[f.jsx(w3,{children:f.jsx(oE,{children:f.jsx("span",{children:"Log in required"})})}),f.jsx(S3,{children:"You need to log in to access Val."}),f.jsx(Lt,{asChild:!0,children:f.jsx("a",{href:Qf("/api/val/authorize",{redirect_to:window.origin+Qf("/val")}),children:"Log in"})})]})})}function Jpe(){const{theme:e}=Uv(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=Vn();return g.useEffect(()=>{!t&&l&&(window.innerWidth<cI?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),hR()==="login-required"?f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(Ype,{})}):f.jsx(k3.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:ke("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:ke({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(aG,{})}),f.jsx("div",{children:f.jsx(Mpe,{})}),f.jsx("div",{className:ke({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(nq,{})})})]})})}const k3=Se.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function Fy(){return g.useContext(k3)}const Xpe=({client:e,config:t})=>f.jsx(fR,{client:e,dispatchValEvents:!1,config:t,children:f.jsx(NR,{children:f.jsx(Jpe,{})})}),Zpe=g.createContext(null),p0={didCatch:!1,error:null};class E3 extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=p0}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(p0)}}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&&Qpe(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(p0)}}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(Zpe.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function Qpe(){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 eme=({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 C3({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(eme,{})," encountered an error"]}),f.jsx("button",{onClick:t,children:f.jsx(du,{})})]}),f.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),f.jsx("pre",{children:e.message}),e.stack&&f.jsx(oh,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:f.jsxs(Cl,{value:"error",children:[f.jsx(_l,{children:"Stack trace:"}),f.jsx(Tl,{className:"p-4 bg-bg-secondary",children:e.stack&&f.jsx("pre",{children:e.stack})})]})})]})})})}function tme({root:e,children:t}){return Mr.createPortal(t,e)}const _3=({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(tme,{root:r,children:e})})},T3="/spa/index.css",nme="val-app",rme="val-overlay";function P3(){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 N3(){const[e,t]=g.useState(null);return g.useEffect(()=>{const n=r=>{var a;if(!(r instanceof CustomEvent)){console.warn("Received message of type val-config, but it was not a CustomEvent",r);return}if(r.detail.type!=="val-config"){console.warn("Received message of type val-config, but it did not have the expected type",r.detail);return}const o=r.detail.hash;if(!o){console.warn("Received message of type val-config, but it did not have a hash",r.detail);return}const i=r.detail.config,s=Y9.safeParse(i);s.success?t(s.data):(console.error("Invalid config. Recreating...",s.error),t({project:typeof(i==null?void 0:i.project)=="string"?i.project:void 0,root:typeof(i==null?void 0:i.root)=="string"?i.root:void 0,gitCommit:typeof(i==null?void 0:i.gitCommit)=="string"?i.gitCommit:void 0,ai:i!=null&&i.ai&&i.ai.commitMessages&&typeof i.ai.commitMessages.disabled=="boolean"?{commitMessages:{disabled:i.ai.commitMessages.disabled}}:void 0,files:i!=null&&i.files?{directory:typeof((a=i==null?void 0:i.files)==null?void 0:a.directory)=="string"?i.files.directory:"/public/val"}:void 0,gitBranch:typeof(i==null?void 0:i.gitBranch)=="string"?i.gitBranch:void 0,defaultTheme:(i==null?void 0:i.defaultTheme)==="dark"?"dark":"light"})),window.dispatchEvent(new CustomEvent(q9,{detail:{type:"val-config-received",hash:o}}))};return window.addEventListener(VC,n),()=>{window.removeEventListener(VC,n)}},[]),e}function ome(){const e=N3(),t="/api/val",{client:n}=g.useMemo(()=>({client:wj(t,{...e,contentHostUrl:yM})}),[t,e]);return f.jsxs(f.Fragment,{children:[f.jsx(P3,{}),f.jsxs(_3,{children:[f.jsx("link",{rel:"stylesheet",href:`${t}/static${T3}`}),f.jsx(E3,{fallbackRender:C3,children:f.jsx(Xpe,{client:n,config:e})})]})]})}var sE="Switch",[ime,Ome]=uo(sE),[sme,ame]=ime(sE),O3=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,[h,p]=g.useState(null),m=Be(t,S=>p(S)),v=g.useRef(!1),b=h?u||!!h.closest("form"):!0,[x=!1,w]=Fr({prop:o,defaultProp:i,onChange:c});return f.jsxs(sme,{scope:n,checked:x,disabled:a,children:[f.jsx(_e.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":R3(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onClick:te(e.onClick,S=>{w(C=>!C),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})}),b&&f.jsx(lme,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});O3.displayName=sE;var M3="SwitchThumb",j3=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=ame(M3,n);return f.jsx(_e.span,{"data-state":R3(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});j3.displayName=M3;var lme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=g.useRef(null),s=OS(n),a=aS(t);return g.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&d){const h=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(h)}},[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 R3(e){return e?"checked":"unchecked"}var I3=O3,cme=j3;const A3=g.forwardRef(({className:e,...t},n)=>f.jsx(I3,{className:ze("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(cme,{className:ze("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")})}));A3.displayName=I3.displayName;function ume(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 S=w.getAttribute("data-val-path");if(!S)return;const C=w.getBoundingClientRect();x.push({top:C.top,left:C.left,width:C.width,height:C.height,joinedPaths:S})}),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}=Uv(),[u,d]=g.useState(null),h=Du(),p="val-menu-right-center";g.useEffect(()=>{try{const v=h&&localStorage.getItem("val-menu-drop-zone-"+((h==null?void 0:h.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(p)}catch(v){console.error("Error getting drop zone from local storage",v),d(p)}},[(h==null?void 0:h.project)||"unknown"]);const m=v=>{d(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((h==null?void 0:h.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(dme,{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] w-full 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:ee.splitJoinedSourcePaths(v.joinedPaths).map(x=>{const[w,S]=ee.splitModuleFilePathAndModulePath(x);return f.jsx(ny,{link:!1,toolTip:!1,moduleFilePath:w,patchPath:ee.splitModulePath(S)})})})})},b)),a===null&&f.jsx(hme,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function dme({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:h}=window,{offsetWidth:p,offsetHeight:m}=a.current,v=m,b=p;let x=e.clientX,w=e.clientY;const S=80,C=d-(e.clientX+b);C<0&&(x=x+(C-S));const _=h-(e.clientY+v);_<0&&(w=w+(_-S)),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=p=>{if(p instanceof MouseEvent)o(m=>({x:m.x+p.movementX,y:m.y+p.movementY}));else{const m=p.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},d=()=>{c(!1)},h=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",d),window.addEventListener("click",h),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),window.removeEventListener("click",h)}}},[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:ke("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[f.jsx("div",{className:ke("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:ke("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&&ee.splitJoinedSourcePaths(e.joinedPaths).map(u=>{const[d,h]=ee.splitModuleFilePathAndModulePath(u),p=ee.splitModulePath(h);return f.jsxs(g.Fragment,{children:[f.jsx(ny,{link:!0,toolTip:!0,moduleFilePath:d,patchPath:p}),f.jsx(fme,{path:u})]},u)}),f.jsx(Lt,{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 fme({path:e}){const t=It(e);return!("data"in t)||t.data===void 0?f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx(gt,{path:e})}):f.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:f.jsx(Ly,{path:e,schema:t.data,autoFocus:!0})})}function FP({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=hR(),h=Kr(),{theme:p,setTheme:m}=Uv(),v=Hv(),[b,x]=g.useState(0),w=qh(),S=ja()||{},C=Object.keys(S).length,_=Lu();g.useEffect(()=>{const j=()=>{window.innerWidth<400?x(-56):x(32)};return j(),window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]);const{publishDisabled:P}=Yh(),O=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:fv(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(Ox,{className:"animate-spin",size:16})})}),d==="login-required"&&f.jsx("div",{className:fv(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:Qf("/api/val/authorize",{redirect_to:window.location.href}),children:f.jsx(w7,{size:16})})})}),f.jsx(nh,{isOpen:n&&!r&&!l&&d!=="login-required",children:f.jsxs("div",{className:ke("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(ac,{label:"Pick content",active:i==="select",onClick:()=>s(j=>j==="select"?null:"select"),icon:f.jsx(M7,{size:16})}),f.jsx(ac,{label:"Disable preview mode",disabled:r,icon:r?f.jsx(Ox,{size:16,className:"animate-spin"}):f.jsx(f7,{size:16}),onClick:()=>o(!1)}),f.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),f.jsxs(ns,{children:[f.jsx(rh,{disabled:P,className:ke("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsxs(al,{children:[f.jsx(IS,{children:f.jsxs("div",{className:"relative",children:[w.length>0&&f.jsx("div",{className:"absolute -top-3 -right-3",children:f.jsxs("div",{className:ke("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(kS,{size:16})]})}),f.jsx(AS,{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(hi,{container:h,align:"center",side:O,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(Xv,{children:f.jsx(du,{size:16})})}),!P&&f.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:f.jsx(Ib,{})}),f.jsx(oi,{children:f.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px]",children:f.jsx($I,{loadingStatus:v})})}),!P&&f.jsx("div",{className:"hidden py-4 sm:block",children:f.jsx(Ib,{})})]})]}),f.jsx(ac,{label:"Studio",icon:f.jsx(l_,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsxs(ns,{children:[f.jsx(rh,{className:ke("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsx(bR,{size:16})}),f.jsx(hi,{container:h,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(P7,{size:16})}),f.jsx("span",{children:"Dock to right"}),f.jsx("button",{onClick:()=>{c("val-menu-right-center")},children:f.jsx(T7,{size:16})}),f.jsx("span",{children:"Dock to left"}),f.jsx("button",{onClick:()=>{c("val-menu-left-center")},children:f.jsx(_7,{size:16})}),f.jsx("span",{children:"Dock to bottom"}),f.jsx("button",{onClick:()=>{c("val-menu-center-bottom")},children:f.jsx(C7,{size:16})}),f.jsx("span",{children:"Dark mode"}),f.jsx(A3,{checked:p==="dark",onCheckedChange:j=>{m(j?"dark":"light")}})]})})]})]})}),f.jsx(nh,{isOpen:!(n&&!r)&&!l&&d!=="login-required",children:f.jsxs("div",{className:ke("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(ac,{label:"Enable preview mode",disabled:r,icon:r?f.jsx(Ox,{size:16,className:"animate-spin"}):f.jsx(wR,{size:16}),onClick:()=>{o(!0)}}),f.jsx(ac,{label:"Studio",icon:f.jsx(l_,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsx(ac,{label:"Disable Val",icon:f.jsx(du,{size:16}),onClick:()=>a()})]})})]})}function ac({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return f.jsx("button",{disabled:n,className:ke("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 hme(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:ke("z-[8999] cursor-grab",fv(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:f.jsx(FP,{...e,dropZone:r})}),t&&r&&f.jsxs(f.Fragment,{children:[i&&i!==r&&f.jsx("div",{className:ke("z-[3]",fv(i)),onDrop:a(i),onDragOver:l(i),children:f.jsx(FP,{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(Cs,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx("div",{}),f.jsx(Cs,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(Cs,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function fv(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 Cs=({id:e,onDrop:t,onDragOver:n})=>f.jsx("div",{onDrop:t(e),onDragOver:n(e)});function pme(){const e=N3(),t="/api/val",n=wj("/api/val",{...e,contentHostUrl:yM}),[r,o]=g.useState(!1),[i,s]=g.useState(!1);return g.useEffect(()=>{const a=l=>{l instanceof CustomEvent?(l==null?void 0:l.detail.type)==="draftMode"&&typeof(l==null?void 0:l.detail.value)=="boolean"?o(l.detail.value):l.detail.type==="draftModeLoading"&&typeof l.detail.value=="boolean"?s(l.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",l.detail):console.error("Val: invalid event (val-overlay-spa)",l)};return window.addEventListener("val-overlay-spa",a),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",a)}},[]),f.jsxs(f.Fragment,{children:[f.jsx(P3,{}),f.jsxs(_3,{children:[f.jsx("style",{children:`
|
|
494
|
+
#val-overlay-container {
|
|
495
|
+
visibility: hidden;
|
|
496
|
+
}
|
|
497
|
+
`}),f.jsx("link",{rel:"stylesheet",href:`${t}/static${T3}`}),f.jsx(E3,{fallbackRender:C3,children:f.jsx(fR,{client:n,dispatchValEvents:r,config:e,children:f.jsx(NR,{overlay:!0,children:f.jsx(ume,{draftMode:r,draftModeLoading:i,setDraftMode:a=>{const l=new CustomEvent("val-overlay-provider",{detail:{type:"draftMode",value:a}});window.dispatchEvent(l)},disableOverlay:()=>{location.href=`${window.location.origin}/api/val/disable?redirect_to=${encodeURIComponent(window.location.href)}`}})})})})]})]})}const zP=document.getElementById(nme),BP=document.getElementById(rme);zP?Dm.createRoot(zP).render(Se.createElement(Se.StrictMode,null,Se.createElement(ome,null))):BP?Dm.createRoot(BP).render(Se.createElement(Se.StrictMode,null,Se.createElement(pme,null))):console.error("Val: could not mount Val element. Check your configuration.");
|