@valbuild/ui 0.87.2 → 0.87.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/valbuild-ui.cjs.js +1 -1
- package/dist/valbuild-ui.esm.js +1 -1
- package/package.json +8 -4
- package/server/.tmp/assets/index-BCOSuUrp.js +522 -0
- package/server/.tmp/assets/{index-DXIM1dhC.css → index-Bbc_kSuw.css} +2 -2
- package/server/.tmp/index.html +2 -2
- package/server/dist/valbuild-ui-server.cjs.js +2 -2
- package/server/dist/valbuild-ui-server.esm.js +2 -2
- package/server/.tmp/assets/index-BqgaZ3j-.js +0 -522
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
var e5=Object.defineProperty;var ME=e=>{throw TypeError(e)};var t5=(e,t,n)=>t in e?e5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Kt=(e,t,n)=>t5(e,typeof t!="symbol"?t+"":t,n),RE=(e,t,n)=>t.has(e)||ME("Cannot "+n);var he=(e,t,n)=>(RE(e,t,"read from private field"),n?n.call(e):t.get(e)),Un=(e,t,n)=>t.has(e)?ME("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),rt=(e,t,n,r)=>(RE(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function n5(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 s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{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 s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var r5=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ha(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var CT={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 $h=Symbol.for("react.element"),o5=Symbol.for("react.portal"),s5=Symbol.for("react.fragment"),i5=Symbol.for("react.strict_mode"),a5=Symbol.for("react.profiler"),l5=Symbol.for("react.provider"),c5=Symbol.for("react.context"),u5=Symbol.for("react.forward_ref"),d5=Symbol.for("react.suspense"),f5=Symbol.for("react.memo"),h5=Symbol.for("react.lazy"),AE=Symbol.iterator;function p5(e){return e===null||typeof e!="object"?null:(e=AE&&e[AE]||e["@@iterator"],typeof e=="function"?e:null)}var NT={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_T=Object.assign,PT={};function Wu(e,t,n){this.props=e,this.context=t,this.refs=PT,this.updater=n||NT}Wu.prototype.isReactComponent={};Wu.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")};Wu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function TT(){}TT.prototype=Wu.prototype;function i1(e,t,n){this.props=e,this.context=t,this.refs=PT,this.updater=n||NT}var a1=i1.prototype=new TT;a1.constructor=i1;_T(a1,Wu.prototype);a1.isPureReactComponent=!0;var IE=Array.isArray,OT=Object.prototype.hasOwnProperty,l1={current:null},jT={key:!0,ref:!0,__self:!0,__source:!0};function MT(e,t,n){var r,o={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)OT.call(t,r)&&!jT.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:$h,type:e,key:s,ref:i,props:o,_owner:l1.current}}function m5(e,t){return{$$typeof:$h,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function c1(e){return typeof e=="object"&&e!==null&&e.$$typeof===$h}function g5(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var DE=/\/+/g;function ox(e,t){return typeof e=="object"&&e!==null&&e.key!=null?g5(""+e.key):t.toString(36)}function am(e,t,n,r,o){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case $h:case o5:i=!0}}if(i)return i=e,o=o(i),e=r===""?"."+ox(i,0):r,IE(o)?(n="",e!=null&&(n=e.replace(DE,"$&/")+"/"),am(o,t,n,"",function(c){return c})):o!=null&&(c1(o)&&(o=m5(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(DE,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=r===""?".":r+":",IE(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+ox(s,a);i+=am(s,t,n,l,o)}else if(l=p5(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+ox(s,a++),i+=am(s,t,n,l,o);else if(s==="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 i}function Np(e,t,n){if(e==null)return e;var r=[],o=0;return am(e,r,"","",function(s){return t.call(n,s,o++)}),r}function v5(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 cr={current:null},lm={transition:null},y5={ReactCurrentDispatcher:cr,ReactCurrentBatchConfig:lm,ReactCurrentOwner:l1};function RT(){throw Error("act(...) is not supported in production builds of React.")}Qe.Children={map:Np,forEach:function(e,t,n){Np(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Np(e,function(){t++}),t},toArray:function(e){return Np(e,function(t){return t})||[]},only:function(e){if(!c1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Qe.Component=Wu;Qe.Fragment=s5;Qe.Profiler=a5;Qe.PureComponent=i1;Qe.StrictMode=i5;Qe.Suspense=d5;Qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=y5;Qe.act=RT;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=_T({},e.props),o=e.key,s=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,i=l1.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)OT.call(t,l)&&!jT.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:$h,type:e.type,key:o,ref:s,props:r,_owner:i}};Qe.createContext=function(e){return e={$$typeof:c5,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:l5,_context:e},e.Consumer=e};Qe.createElement=MT;Qe.createFactory=function(e){var t=MT.bind(null,e);return t.type=e,t};Qe.createRef=function(){return{current:null}};Qe.forwardRef=function(e){return{$$typeof:u5,render:e}};Qe.isValidElement=c1;Qe.lazy=function(e){return{$$typeof:h5,_payload:{_status:-1,_result:e},_init:v5}};Qe.memo=function(e,t){return{$$typeof:f5,type:e,compare:t===void 0?null:t}};Qe.startTransition=function(e){var t=lm.transition;lm.transition={};try{e()}finally{lm.transition=t}};Qe.unstable_act=RT;Qe.useCallback=function(e,t){return cr.current.useCallback(e,t)};Qe.useContext=function(e){return cr.current.useContext(e)};Qe.useDebugValue=function(){};Qe.useDeferredValue=function(e){return cr.current.useDeferredValue(e)};Qe.useEffect=function(e,t){return cr.current.useEffect(e,t)};Qe.useId=function(){return cr.current.useId()};Qe.useImperativeHandle=function(e,t,n){return cr.current.useImperativeHandle(e,t,n)};Qe.useInsertionEffect=function(e,t){return cr.current.useInsertionEffect(e,t)};Qe.useLayoutEffect=function(e,t){return cr.current.useLayoutEffect(e,t)};Qe.useMemo=function(e,t){return cr.current.useMemo(e,t)};Qe.useReducer=function(e,t,n){return cr.current.useReducer(e,t,n)};Qe.useRef=function(e){return cr.current.useRef(e)};Qe.useState=function(e){return cr.current.useState(e)};Qe.useSyncExternalStore=function(e,t,n){return cr.current.useSyncExternalStore(e,t,n)};Qe.useTransition=function(){return cr.current.useTransition()};Qe.version="18.3.1";CT.exports=Qe;var m=CT.exports;const _e=Ha(m),u1=n5({__proto__:null,default:_e},[m]);var Vm={},AT={exports:{}},to={},IT={exports:{}},DT={};/**
|
|
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(R,$){var J=R.length;R.push($);e:for(;0<J;){var G=J-1>>>1,ie=R[G];if(0<o(ie,$))R[G]=$,R[J]=ie,J=G;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var $=R[0],J=R.pop();if(J!==$){R[0]=J;e:for(var G=0,ie=R.length,Xe=ie>>>1;G<Xe;){var He=2*(G+1)-1,ce=R[He],pe=He+1,Z=R[pe];if(0>o(ce,J))pe<ie&&0>o(Z,ce)?(R[G]=Z,R[pe]=J,G=pe):(R[G]=ce,R[He]=J,G=He);else if(pe<ie&&0>o(Z,J))R[G]=Z,R[pe]=J,G=pe;else break e}}return $}function o(R,$){var J=R.sortIndex-$.sortIndex;return J!==0?J:R.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],c=[],u=1,f=null,h=3,p=!1,g=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var $=n(c);$!==null;){if($.callback===null)r(c);else if($.startTime<=R)r(c),$.sortIndex=$.expirationTime,t(l,$);else break;$=n(c)}}function E(R){if(v=!1,w(R),!g)if(n(l)!==null)g=!0,H(C);else{var $=n(c);$!==null&&z(E,$.startTime-R)}}function C(R,$){g=!1,v&&(v=!1,x(P),P=-1),p=!0;var J=h;try{for(w($),f=n(l);f!==null&&(!(f.expirationTime>$)||R&&!U());){var G=f.callback;if(typeof G=="function"){f.callback=null,h=f.priorityLevel;var ie=G(f.expirationTime<=$);$=e.unstable_now(),typeof ie=="function"?f.callback=ie:f===n(l)&&r(l),w($)}else r(l);f=n(l)}if(f!==null)var Xe=!0;else{var He=n(c);He!==null&&z(E,He.startTime-$),Xe=!1}return Xe}finally{f=null,h=J,p=!1}}var _=!1,N=null,P=-1,j=5,A=-1;function U(){return!(e.unstable_now()-A<j)}function L(){if(N!==null){var R=e.unstable_now();A=R;var $=!0;try{$=N(!0,R)}finally{$?K():(_=!1,N=null)}}else _=!1}var K;if(typeof b=="function")K=function(){b(L)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,V=W.port2;W.port1.onmessage=L,K=function(){V.postMessage(null)}}else K=function(){y(L,0)};function H(R){N=R,_||(_=!0,K())}function z(R,$){P=y(function(){R(e.unstable_now())},$)}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(R){R.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,H(C))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var $=3;break;default:$=h}var J=h;h=$;try{return R()}finally{h=J}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,$){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var J=h;h=R;try{return $()}finally{h=J}},e.unstable_scheduleCallback=function(R,$,J){var G=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?G+J:G):J=G,R){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=J+ie,R={id:u++,callback:$,priorityLevel:R,startTime:J,expirationTime:ie,sortIndex:-1},J>G?(R.sortIndex=J,t(c,R),n(l)===null&&R===n(c)&&(v?(x(P),P=-1):v=!0,z(E,J-G))):(R.sortIndex=ie,t(l,R),g||p||(g=!0,H(C))),R},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(R){var $=h;return function(){var J=h;h=$;try{return R.apply(this,arguments)}finally{h=J}}}})(DT);IT.exports=DT;var x5=IT.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 b5=m,Jr=x5;function te(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 LT=new Set,$f={};function ic(e,t){fu(e,t),fu(e+"Capture",t)}function fu(e,t){for($f[e]=t,e=0;e<t.length;e++)LT.add(t[e])}var fi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),D0=Object.prototype.hasOwnProperty,w5=/^[: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]*$/,LE={},FE={};function S5(e){return D0.call(FE,e)?!0:D0.call(LE,e)?!1:w5.test(e)?FE[e]=!0:(LE[e]=!0,!1)}function k5(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 E5(e,t,n,r){if(t===null||typeof t>"u"||k5(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 ur(e,t,n,r,o,s,i){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=s,this.removeEmptyString=i}var Fn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Fn[e]=new ur(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Fn[t]=new ur(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Fn[e]=new ur(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Fn[e]=new ur(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){Fn[e]=new ur(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Fn[e]=new ur(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Fn[e]=new ur(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Fn[e]=new ur(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Fn[e]=new ur(e,5,!1,e.toLowerCase(),null,!1,!1)});var d1=/[\-:]([a-z])/g;function f1(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(d1,f1);Fn[t]=new ur(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(d1,f1);Fn[t]=new ur(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(d1,f1);Fn[t]=new ur(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Fn[e]=new ur(e,1,!1,e.toLowerCase(),null,!1,!1)});Fn.xlinkHref=new ur("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Fn[e]=new ur(e,1,!1,e.toLowerCase(),null,!0,!0)});function h1(e,t,n,r){var o=Fn.hasOwnProperty(t)?Fn[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(E5(t,n,o,r)&&(n=null),r||o===null?S5(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 Ei=b5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_p=Symbol.for("react.element"),zc=Symbol.for("react.portal"),$c=Symbol.for("react.fragment"),p1=Symbol.for("react.strict_mode"),L0=Symbol.for("react.profiler"),FT=Symbol.for("react.provider"),zT=Symbol.for("react.context"),m1=Symbol.for("react.forward_ref"),F0=Symbol.for("react.suspense"),z0=Symbol.for("react.suspense_list"),g1=Symbol.for("react.memo"),Yi=Symbol.for("react.lazy"),$T=Symbol.for("react.offscreen"),zE=Symbol.iterator;function xd(e){return e===null||typeof e!="object"?null:(e=zE&&e[zE]||e["@@iterator"],typeof e=="function"?e:null)}var Bt=Object.assign,sx;function zd(e){if(sx===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);sx=t&&t[1]||""}return`
|
|
26
|
+
`+sx+e}var ix=!1;function ax(e,t){if(!e||ix)return"";ix=!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
|
+
`),s=r.stack.split(`
|
|
28
|
+
`),i=o.length-1,a=s.length-1;1<=i&&0<=a&&o[i]!==s[a];)a--;for(;1<=i&&0<=a;i--,a--)if(o[i]!==s[a]){if(i!==1||a!==1)do if(i--,a--,0>a||o[i]!==s[a]){var l=`
|
|
29
|
+
`+o[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{ix=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?zd(e):""}function C5(e){switch(e.tag){case 5:return zd(e.type);case 16:return zd("Lazy");case 13:return zd("Suspense");case 19:return zd("SuspenseList");case 0:case 2:case 15:return e=ax(e.type,!1),e;case 11:return e=ax(e.type.render,!1),e;case 1:return e=ax(e.type,!0),e;default:return""}}function $0(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 $c:return"Fragment";case zc:return"Portal";case L0:return"Profiler";case p1:return"StrictMode";case F0:return"Suspense";case z0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zT:return(e.displayName||"Context")+".Consumer";case FT:return(e._context.displayName||"Context")+".Provider";case m1:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case g1:return t=e.displayName||null,t!==null?t:$0(e.type)||"Memo";case Yi:t=e._payload,e=e._init;try{return $0(e(t))}catch{}}return null}function N5(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 $0(t);case 8:return t===p1?"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 ja(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function BT(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _5(e){var t=BT(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,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Pp(e){e._valueTracker||(e._valueTracker=_5(e))}function VT(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=BT(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Um(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 Bt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function $E(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ja(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 UT(e,t){t=t.checked,t!=null&&h1(e,"checked",t,!1)}function V0(e,t){UT(e,t);var n=ja(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")?U0(e,t.type,n):t.hasOwnProperty("defaultValue")&&U0(e,t.type,ja(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function BE(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 U0(e,t,n){(t!=="number"||Um(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $d=Array.isArray;function Xc(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=""+ja(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 W0(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return Bt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function VE(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if($d(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ja(n)}}function WT(e,t){var n=ja(t.value),r=ja(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 UE(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function HT(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 H0(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?HT(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Tp,KT=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(Tp=Tp||document.createElement("div"),Tp.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Tp.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 yf={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},P5=["Webkit","ms","Moz","O"];Object.keys(yf).forEach(function(e){P5.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yf[t]=yf[e]})});function GT(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yf.hasOwnProperty(e)&&yf[e]?(""+t).trim():t+"px"}function qT(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=GT(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var T5=Bt({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 K0(e,t){if(t){if(T5[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function G0(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 q0=null;function v1(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Y0=null,Zc=null,Qc=null;function WE(e){if(e=Uh(e)){if(typeof Y0!="function")throw Error(te(280));var t=e.stateNode;t&&(t=jv(t),Y0(e.stateNode,e.type,t))}}function YT(e){Zc?Qc?Qc.push(e):Qc=[e]:Zc=e}function JT(){if(Zc){var e=Zc,t=Qc;if(Qc=Zc=null,WE(e),t)for(e=0;e<t.length;e++)WE(t[e])}}function XT(e,t){return e(t)}function ZT(){}var lx=!1;function QT(e,t,n){if(lx)return e(t,n);lx=!0;try{return XT(e,t,n)}finally{lx=!1,(Zc!==null||Qc!==null)&&(ZT(),JT())}}function Vf(e,t){var n=e.stateNode;if(n===null)return null;var r=jv(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(te(231,t,typeof n));return n}var J0=!1;if(fi)try{var bd={};Object.defineProperty(bd,"passive",{get:function(){J0=!0}}),window.addEventListener("test",bd,bd),window.removeEventListener("test",bd,bd)}catch{J0=!1}function O5(e,t,n,r,o,s,i,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var xf=!1,Wm=null,Hm=!1,X0=null,j5={onError:function(e){xf=!0,Wm=e}};function M5(e,t,n,r,o,s,i,a,l){xf=!1,Wm=null,O5.apply(j5,arguments)}function R5(e,t,n,r,o,s,i,a,l){if(M5.apply(this,arguments),xf){if(xf){var c=Wm;xf=!1,Wm=null}else throw Error(te(198));Hm||(Hm=!0,X0=c)}}function ac(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 eO(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 HE(e){if(ac(e)!==e)throw Error(te(188))}function A5(e){var t=e.alternate;if(!t){if(t=ac(e),t===null)throw Error(te(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var s=o.alternate;if(s===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return HE(o),e;if(s===r)return HE(o),t;s=s.sibling}throw Error(te(188))}if(n.return!==r.return)n=o,r=s;else{for(var i=!1,a=o.child;a;){if(a===n){i=!0,n=o,r=s;break}if(a===r){i=!0,r=o,n=s;break}a=a.sibling}if(!i){for(a=s.child;a;){if(a===n){i=!0,n=s,r=o;break}if(a===r){i=!0,r=s,n=o;break}a=a.sibling}if(!i)throw Error(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function tO(e){return e=A5(e),e!==null?nO(e):null}function nO(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=nO(e);if(t!==null)return t;e=e.sibling}return null}var rO=Jr.unstable_scheduleCallback,KE=Jr.unstable_cancelCallback,I5=Jr.unstable_shouldYield,D5=Jr.unstable_requestPaint,Gt=Jr.unstable_now,L5=Jr.unstable_getCurrentPriorityLevel,y1=Jr.unstable_ImmediatePriority,oO=Jr.unstable_UserBlockingPriority,Km=Jr.unstable_NormalPriority,F5=Jr.unstable_LowPriority,sO=Jr.unstable_IdlePriority,_v=null,ys=null;function z5(e){if(ys&&typeof ys.onCommitFiberRoot=="function")try{ys.onCommitFiberRoot(_v,e,void 0,(e.current.flags&128)===128)}catch{}}var Go=Math.clz32?Math.clz32:V5,$5=Math.log,B5=Math.LN2;function V5(e){return e>>>=0,e===0?32:31-($5(e)/B5|0)|0}var Op=64,jp=4194304;function Bd(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 Gm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~o;a!==0?r=Bd(a):(s&=i,s!==0&&(r=Bd(s)))}else i=n&~o,i!==0?r=Bd(i):s!==0&&(r=Bd(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&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-Go(t),o=1<<n,r|=e[n],t&=~o;return r}function U5(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 W5(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-Go(s),a=1<<i,l=o[i];l===-1?(!(a&n)||a&r)&&(o[i]=U5(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function Z0(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function iO(){var e=Op;return Op<<=1,!(Op&4194240)&&(Op=64),e}function cx(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Bh(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Go(t),e[t]=n}function H5(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-Go(n),s=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~s}}function x1(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Go(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var bt=0;function aO(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var lO,b1,cO,uO,dO,Q0=!1,Mp=[],ga=null,va=null,ya=null,Uf=new Map,Wf=new Map,na=[],K5="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 GE(e,t){switch(e){case"focusin":case"focusout":ga=null;break;case"dragenter":case"dragleave":va=null;break;case"mouseover":case"mouseout":ya=null;break;case"pointerover":case"pointerout":Uf.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wf.delete(t.pointerId)}}function wd(e,t,n,r,o,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[o]},t!==null&&(t=Uh(t),t!==null&&b1(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function G5(e,t,n,r,o){switch(t){case"focusin":return ga=wd(ga,e,t,n,r,o),!0;case"dragenter":return va=wd(va,e,t,n,r,o),!0;case"mouseover":return ya=wd(ya,e,t,n,r,o),!0;case"pointerover":var s=o.pointerId;return Uf.set(s,wd(Uf.get(s)||null,e,t,n,r,o)),!0;case"gotpointercapture":return s=o.pointerId,Wf.set(s,wd(Wf.get(s)||null,e,t,n,r,o)),!0}return!1}function fO(e){var t=pl(e.target);if(t!==null){var n=ac(t);if(n!==null){if(t=n.tag,t===13){if(t=eO(n),t!==null){e.blockedOn=t,dO(e.priority,function(){cO(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 cm(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=eb(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);q0=r,n.target.dispatchEvent(r),q0=null}else return t=Uh(n),t!==null&&b1(t),e.blockedOn=n,!1;t.shift()}return!0}function qE(e,t,n){cm(e)&&n.delete(t)}function q5(){Q0=!1,ga!==null&&cm(ga)&&(ga=null),va!==null&&cm(va)&&(va=null),ya!==null&&cm(ya)&&(ya=null),Uf.forEach(qE),Wf.forEach(qE)}function Sd(e,t){e.blockedOn===t&&(e.blockedOn=null,Q0||(Q0=!0,Jr.unstable_scheduleCallback(Jr.unstable_NormalPriority,q5)))}function Hf(e){function t(o){return Sd(o,e)}if(0<Mp.length){Sd(Mp[0],e);for(var n=1;n<Mp.length;n++){var r=Mp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ga!==null&&Sd(ga,e),va!==null&&Sd(va,e),ya!==null&&Sd(ya,e),Uf.forEach(t),Wf.forEach(t),n=0;n<na.length;n++)r=na[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<na.length&&(n=na[0],n.blockedOn===null);)fO(n),n.blockedOn===null&&na.shift()}var eu=Ei.ReactCurrentBatchConfig,qm=!0;function Y5(e,t,n,r){var o=bt,s=eu.transition;eu.transition=null;try{bt=1,w1(e,t,n,r)}finally{bt=o,eu.transition=s}}function J5(e,t,n,r){var o=bt,s=eu.transition;eu.transition=null;try{bt=4,w1(e,t,n,r)}finally{bt=o,eu.transition=s}}function w1(e,t,n,r){if(qm){var o=eb(e,t,n,r);if(o===null)xx(e,t,r,Ym,n),GE(e,r);else if(G5(o,e,t,n,r))r.stopPropagation();else if(GE(e,r),t&4&&-1<K5.indexOf(e)){for(;o!==null;){var s=Uh(o);if(s!==null&&lO(s),s=eb(e,t,n,r),s===null&&xx(e,t,r,Ym,n),s===o)break;o=s}o!==null&&r.stopPropagation()}else xx(e,t,r,null,n)}}var Ym=null;function eb(e,t,n,r){if(Ym=null,e=v1(r),e=pl(e),e!==null)if(t=ac(e),t===null)e=null;else if(n=t.tag,n===13){if(e=eO(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 Ym=e,null}function hO(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(L5()){case y1:return 1;case oO:return 4;case Km:case F5:return 16;case sO:return 536870912;default:return 16}default:return 16}}var ca=null,S1=null,um=null;function pO(){if(um)return um;var e,t=S1,n=t.length,r,o="value"in ca?ca.value:ca.textContent,s=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[s-r];r++);return um=o.slice(e,1<r?1-r:void 0)}function dm(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 Rp(){return!0}function YE(){return!1}function no(e){function t(n,r,o,s,i){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Rp:YE,this.isPropagationStopped=YE,this}return Bt(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=Rp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Rp)},persist:function(){},isPersistent:Rp}),t}var Hu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},k1=no(Hu),Vh=Bt({},Hu,{view:0,detail:0}),X5=no(Vh),ux,dx,kd,Pv=Bt({},Vh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:E1,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!==kd&&(kd&&e.type==="mousemove"?(ux=e.screenX-kd.screenX,dx=e.screenY-kd.screenY):dx=ux=0,kd=e),ux)},movementY:function(e){return"movementY"in e?e.movementY:dx}}),JE=no(Pv),Z5=Bt({},Pv,{dataTransfer:0}),Q5=no(Z5),ez=Bt({},Vh,{relatedTarget:0}),fx=no(ez),tz=Bt({},Hu,{animationName:0,elapsedTime:0,pseudoElement:0}),nz=no(tz),rz=Bt({},Hu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),oz=no(rz),sz=Bt({},Hu,{data:0}),XE=no(sz),iz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},az={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"},lz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cz(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=lz[e])?!!t[e]:!1}function E1(){return cz}var uz=Bt({},Vh,{key:function(e){if(e.key){var t=iz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=dm(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?az[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:E1,charCode:function(e){return e.type==="keypress"?dm(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?dm(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),dz=no(uz),fz=Bt({},Pv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ZE=no(fz),hz=Bt({},Vh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:E1}),pz=no(hz),mz=Bt({},Hu,{propertyName:0,elapsedTime:0,pseudoElement:0}),gz=no(mz),vz=Bt({},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}),yz=no(vz),xz=[9,13,27,32],C1=fi&&"CompositionEvent"in window,bf=null;fi&&"documentMode"in document&&(bf=document.documentMode);var bz=fi&&"TextEvent"in window&&!bf,mO=fi&&(!C1||bf&&8<bf&&11>=bf),QE=" ",eC=!1;function gO(e,t){switch(e){case"keyup":return xz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bc=!1;function wz(e,t){switch(e){case"compositionend":return vO(t);case"keypress":return t.which!==32?null:(eC=!0,QE);case"textInput":return e=t.data,e===QE&&eC?null:e;default:return null}}function Sz(e,t){if(Bc)return e==="compositionend"||!C1&&gO(e,t)?(e=pO(),um=S1=ca=null,Bc=!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 mO&&t.locale!=="ko"?null:t.data;default:return null}}var kz={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 tC(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!kz[e.type]:t==="textarea"}function yO(e,t,n,r){YT(r),t=Jm(t,"onChange"),0<t.length&&(n=new k1("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var wf=null,Kf=null;function Ez(e){TO(e,0)}function Tv(e){var t=Wc(e);if(VT(t))return e}function Cz(e,t){if(e==="change")return t}var xO=!1;if(fi){var hx;if(fi){var px="oninput"in document;if(!px){var nC=document.createElement("div");nC.setAttribute("oninput","return;"),px=typeof nC.oninput=="function"}hx=px}else hx=!1;xO=hx&&(!document.documentMode||9<document.documentMode)}function rC(){wf&&(wf.detachEvent("onpropertychange",bO),Kf=wf=null)}function bO(e){if(e.propertyName==="value"&&Tv(Kf)){var t=[];yO(t,Kf,e,v1(e)),QT(Ez,t)}}function Nz(e,t,n){e==="focusin"?(rC(),wf=t,Kf=n,wf.attachEvent("onpropertychange",bO)):e==="focusout"&&rC()}function _z(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tv(Kf)}function Pz(e,t){if(e==="click")return Tv(t)}function Tz(e,t){if(e==="input"||e==="change")return Tv(t)}function Oz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Jo=typeof Object.is=="function"?Object.is:Oz;function Gf(e,t){if(Jo(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(!D0.call(t,o)||!Jo(e[o],t[o]))return!1}return!0}function oC(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sC(e,t){var n=oC(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=oC(n)}}function wO(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wO(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function SO(){for(var e=window,t=Um();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Um(e.document)}return t}function N1(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 jz(e){var t=SO(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&wO(n.ownerDocument.documentElement,n)){if(r!==null&&N1(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,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=sC(n,s);var i=sC(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.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 Mz=fi&&"documentMode"in document&&11>=document.documentMode,Vc=null,tb=null,Sf=null,nb=!1;function iC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;nb||Vc==null||Vc!==Um(r)||(r=Vc,"selectionStart"in r&&N1(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}),Sf&&Gf(Sf,r)||(Sf=r,r=Jm(tb,"onSelect"),0<r.length&&(t=new k1("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Vc)))}function Ap(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Uc={animationend:Ap("Animation","AnimationEnd"),animationiteration:Ap("Animation","AnimationIteration"),animationstart:Ap("Animation","AnimationStart"),transitionend:Ap("Transition","TransitionEnd")},mx={},kO={};fi&&(kO=document.createElement("div").style,"AnimationEvent"in window||(delete Uc.animationend.animation,delete Uc.animationiteration.animation,delete Uc.animationstart.animation),"TransitionEvent"in window||delete Uc.transitionend.transition);function Ov(e){if(mx[e])return mx[e];if(!Uc[e])return e;var t=Uc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in kO)return mx[e]=t[n];return e}var EO=Ov("animationend"),CO=Ov("animationiteration"),NO=Ov("animationstart"),_O=Ov("transitionend"),PO=new Map,aC="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 Ka(e,t){PO.set(e,t),ic(t,[e])}for(var gx=0;gx<aC.length;gx++){var vx=aC[gx],Rz=vx.toLowerCase(),Az=vx[0].toUpperCase()+vx.slice(1);Ka(Rz,"on"+Az)}Ka(EO,"onAnimationEnd");Ka(CO,"onAnimationIteration");Ka(NO,"onAnimationStart");Ka("dblclick","onDoubleClick");Ka("focusin","onFocus");Ka("focusout","onBlur");Ka(_O,"onTransitionEnd");fu("onMouseEnter",["mouseout","mouseover"]);fu("onMouseLeave",["mouseout","mouseover"]);fu("onPointerEnter",["pointerout","pointerover"]);fu("onPointerLeave",["pointerout","pointerover"]);ic("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ic("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ic("onBeforeInput",["compositionend","keypress","textInput","paste"]);ic("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ic("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ic("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vd="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(" "),Iz=new Set("cancel close invalid load scroll toggle".split(" ").concat(Vd));function lC(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,R5(r,t,void 0,e),e.currentTarget=null}function TO(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 s=void 0;if(t)for(var i=r.length-1;0<=i;i--){var a=r[i],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&o.isPropagationStopped())break e;lC(o,a,c),s=l}else for(i=0;i<r.length;i++){if(a=r[i],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&o.isPropagationStopped())break e;lC(o,a,c),s=l}}}if(Hm)throw e=X0,Hm=!1,X0=null,e}function Ot(e,t){var n=t[ab];n===void 0&&(n=t[ab]=new Set);var r=e+"__bubble";n.has(r)||(OO(t,e,2,!1),n.add(r))}function yx(e,t,n){var r=0;t&&(r|=4),OO(n,e,r,t)}var Ip="_reactListening"+Math.random().toString(36).slice(2);function qf(e){if(!e[Ip]){e[Ip]=!0,LT.forEach(function(n){n!=="selectionchange"&&(Iz.has(n)||yx(n,!1,e),yx(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ip]||(t[Ip]=!0,yx("selectionchange",!1,t))}}function OO(e,t,n,r){switch(hO(t)){case 1:var o=Y5;break;case 4:o=J5;break;default:o=w1}n=o.bind(null,t,n,e),o=void 0,!J0||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 xx(e,t,n,r,o){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var l=i.tag;if((l===3||l===4)&&(l=i.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;i=i.return}for(;a!==null;){if(i=pl(a),i===null)return;if(l=i.tag,l===5||l===6){r=s=i;continue e}a=a.parentNode}}r=r.return}QT(function(){var c=s,u=v1(n),f=[];e:{var h=PO.get(e);if(h!==void 0){var p=k1,g=e;switch(e){case"keypress":if(dm(n)===0)break e;case"keydown":case"keyup":p=dz;break;case"focusin":g="focus",p=fx;break;case"focusout":g="blur",p=fx;break;case"beforeblur":case"afterblur":p=fx;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=JE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Q5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=pz;break;case EO:case CO:case NO:p=nz;break;case _O:p=gz;break;case"scroll":p=X5;break;case"wheel":p=yz;break;case"copy":case"cut":case"paste":p=oz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=ZE}var v=(t&4)!==0,y=!v&&e==="scroll",x=v?h!==null?h+"Capture":null:h;v=[];for(var b=c,w;b!==null;){w=b;var E=w.stateNode;if(w.tag===5&&E!==null&&(w=E,x!==null&&(E=Vf(b,x),E!=null&&v.push(Yf(b,E,w)))),y)break;b=b.return}0<v.length&&(h=new p(h,g,null,n,u),f.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==q0&&(g=n.relatedTarget||n.fromElement)&&(pl(g)||g[hi]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=c,g=g?pl(g):null,g!==null&&(y=ac(g),g!==y||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=c),p!==g)){if(v=JE,E="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(v=ZE,E="onPointerLeave",x="onPointerEnter",b="pointer"),y=p==null?h:Wc(p),w=g==null?h:Wc(g),h=new v(E,b+"leave",p,n,u),h.target=y,h.relatedTarget=w,E=null,pl(u)===c&&(v=new v(x,b+"enter",g,n,u),v.target=w,v.relatedTarget=y,E=v),y=E,p&&g)t:{for(v=p,x=g,b=0,w=v;w;w=vc(w))b++;for(w=0,E=x;E;E=vc(E))w++;for(;0<b-w;)v=vc(v),b--;for(;0<w-b;)x=vc(x),w--;for(;b--;){if(v===x||x!==null&&v===x.alternate)break t;v=vc(v),x=vc(x)}v=null}else v=null;p!==null&&cC(f,h,p,v,!1),g!==null&&y!==null&&cC(f,y,g,v,!0)}}e:{if(h=c?Wc(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var C=Cz;else if(tC(h))if(xO)C=Tz;else{C=_z;var _=Nz}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(C=Pz);if(C&&(C=C(e,c))){yO(f,C,n,u);break e}_&&_(e,h,c),e==="focusout"&&(_=h._wrapperState)&&_.controlled&&h.type==="number"&&U0(h,"number",h.value)}switch(_=c?Wc(c):window,e){case"focusin":(tC(_)||_.contentEditable==="true")&&(Vc=_,tb=c,Sf=null);break;case"focusout":Sf=tb=Vc=null;break;case"mousedown":nb=!0;break;case"contextmenu":case"mouseup":case"dragend":nb=!1,iC(f,n,u);break;case"selectionchange":if(Mz)break;case"keydown":case"keyup":iC(f,n,u)}var N;if(C1)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Bc?gO(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(mO&&n.locale!=="ko"&&(Bc||P!=="onCompositionStart"?P==="onCompositionEnd"&&Bc&&(N=pO()):(ca=u,S1="value"in ca?ca.value:ca.textContent,Bc=!0)),_=Jm(c,P),0<_.length&&(P=new XE(P,e,null,n,u),f.push({event:P,listeners:_}),N?P.data=N:(N=vO(n),N!==null&&(P.data=N)))),(N=bz?wz(e,n):Sz(e,n))&&(c=Jm(c,"onBeforeInput"),0<c.length&&(u=new XE("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:c}),u.data=N))}TO(f,t)})}function Yf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jm(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,s=o.stateNode;o.tag===5&&s!==null&&(o=s,s=Vf(e,n),s!=null&&r.unshift(Yf(e,s,o)),s=Vf(e,t),s!=null&&r.push(Yf(e,s,o))),e=e.return}return r}function vc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function cC(e,t,n,r,o){for(var s=t._reactName,i=[];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=Vf(n,s),l!=null&&i.unshift(Yf(n,l,a))):o||(l=Vf(n,s),l!=null&&i.push(Yf(n,l,a)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var Dz=/\r\n?/g,Lz=/\u0000|\uFFFD/g;function uC(e){return(typeof e=="string"?e:""+e).replace(Dz,`
|
|
30
|
+
`).replace(Lz,"")}function Dp(e,t,n){if(t=uC(t),uC(e)!==t&&n)throw Error(te(425))}function Xm(){}var rb=null,ob=null;function sb(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 ib=typeof setTimeout=="function"?setTimeout:void 0,Fz=typeof clearTimeout=="function"?clearTimeout:void 0,dC=typeof Promise=="function"?Promise:void 0,zz=typeof queueMicrotask=="function"?queueMicrotask:typeof dC<"u"?function(e){return dC.resolve(null).then(e).catch($z)}:ib;function $z(e){setTimeout(function(){throw e})}function bx(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),Hf(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Hf(t)}function xa(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 fC(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 Ku=Math.random().toString(36).slice(2),ps="__reactFiber$"+Ku,Jf="__reactProps$"+Ku,hi="__reactContainer$"+Ku,ab="__reactEvents$"+Ku,Bz="__reactListeners$"+Ku,Vz="__reactHandles$"+Ku;function pl(e){var t=e[ps];if(t)return t;for(var n=e.parentNode;n;){if(t=n[hi]||n[ps]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fC(e);e!==null;){if(n=e[ps])return n;e=fC(e)}return t}e=n,n=e.parentNode}return null}function Uh(e){return e=e[ps]||e[hi],!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(te(33))}function jv(e){return e[Jf]||null}var lb=[],Hc=-1;function Ga(e){return{current:e}}function jt(e){0>Hc||(e.current=lb[Hc],lb[Hc]=null,Hc--)}function _t(e,t){Hc++,lb[Hc]=e.current,e.current=t}var Ma={},Yn=Ga(Ma),br=Ga(!1),jl=Ma;function hu(e,t){var n=e.type.contextTypes;if(!n)return Ma;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function wr(e){return e=e.childContextTypes,e!=null}function Zm(){jt(br),jt(Yn)}function hC(e,t,n){if(Yn.current!==Ma)throw Error(te(168));_t(Yn,t),_t(br,n)}function jO(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(te(108,N5(e)||"Unknown",o));return Bt({},n,r)}function Qm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ma,jl=Yn.current,_t(Yn,e),_t(br,br.current),!0}function pC(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=jO(e,t,jl),r.__reactInternalMemoizedMergedChildContext=e,jt(br),jt(Yn),_t(Yn,e)):jt(br),_t(br,n)}var Js=null,Mv=!1,wx=!1;function MO(e){Js===null?Js=[e]:Js.push(e)}function Uz(e){Mv=!0,MO(e)}function qa(){if(!wx&&Js!==null){wx=!0;var e=0,t=bt;try{var n=Js;for(bt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Js=null,Mv=!1}catch(o){throw Js!==null&&(Js=Js.slice(e+1)),rO(y1,qa),o}finally{bt=t,wx=!1}}return null}var Kc=[],Gc=0,eg=null,tg=0,ho=[],po=0,Ml=null,ei=1,ti="";function ol(e,t){Kc[Gc++]=tg,Kc[Gc++]=eg,eg=e,tg=t}function RO(e,t,n){ho[po++]=ei,ho[po++]=ti,ho[po++]=Ml,Ml=e;var r=ei;e=ti;var o=32-Go(r)-1;r&=~(1<<o),n+=1;var s=32-Go(t)+o;if(30<s){var i=o-o%5;s=(r&(1<<i)-1).toString(32),r>>=i,o-=i,ei=1<<32-Go(t)+o|n<<o|r,ti=s+e}else ei=1<<s|n<<o|r,ti=e}function _1(e){e.return!==null&&(ol(e,1),RO(e,1,0))}function P1(e){for(;e===eg;)eg=Kc[--Gc],Kc[Gc]=null,tg=Kc[--Gc],Kc[Gc]=null;for(;e===Ml;)Ml=ho[--po],ho[po]=null,ti=ho[--po],ho[po]=null,ei=ho[--po],ho[po]=null}var Gr=null,Wr=null,Mt=!1,Vo=null;function AO(e,t){var n=vo(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 mC(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,Gr=e,Wr=xa(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Gr=e,Wr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ml!==null?{id:ei,overflow:ti}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=vo(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Gr=e,Wr=null,!0):!1;default:return!1}}function cb(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ub(e){if(Mt){var t=Wr;if(t){var n=t;if(!mC(e,t)){if(cb(e))throw Error(te(418));t=xa(n.nextSibling);var r=Gr;t&&mC(e,t)?AO(r,n):(e.flags=e.flags&-4097|2,Mt=!1,Gr=e)}}else{if(cb(e))throw Error(te(418));e.flags=e.flags&-4097|2,Mt=!1,Gr=e}}}function gC(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Gr=e}function Lp(e){if(e!==Gr)return!1;if(!Mt)return gC(e),Mt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!sb(e.type,e.memoizedProps)),t&&(t=Wr)){if(cb(e))throw IO(),Error(te(418));for(;t;)AO(e,t),t=xa(t.nextSibling)}if(gC(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Wr=xa(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Wr=null}}else Wr=Gr?xa(e.stateNode.nextSibling):null;return!0}function IO(){for(var e=Wr;e;)e=xa(e.nextSibling)}function pu(){Wr=Gr=null,Mt=!1}function T1(e){Vo===null?Vo=[e]:Vo.push(e)}var Wz=Ei.ReactCurrentBatchConfig;function Ed(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(te(309));var r=n.stateNode}if(!r)throw Error(te(147,e));var o=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var a=o.refs;i===null?delete a[s]:a[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(te(284));if(!n._owner)throw Error(te(290,e))}return e}function Fp(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function vC(e){var t=e._init;return t(e._payload)}function DO(e){function t(x,b){if(e){var w=x.deletions;w===null?(x.deletions=[b],x.flags|=16):w.push(b)}}function n(x,b){if(!e)return null;for(;b!==null;)t(x,b),b=b.sibling;return null}function r(x,b){for(x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function o(x,b){return x=ka(x,b),x.index=0,x.sibling=null,x}function s(x,b,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<b?(x.flags|=2,b):w):(x.flags|=2,b)):(x.flags|=1048576,b)}function i(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,b,w,E){return b===null||b.tag!==6?(b=Px(w,x.mode,E),b.return=x,b):(b=o(b,w),b.return=x,b)}function l(x,b,w,E){var C=w.type;return C===$c?u(x,b,w.props.children,E,w.key):b!==null&&(b.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Yi&&vC(C)===b.type)?(E=o(b,w.props),E.ref=Ed(x,b,w),E.return=x,E):(E=ym(w.type,w.key,w.props,null,x.mode,E),E.ref=Ed(x,b,w),E.return=x,E)}function c(x,b,w,E){return b===null||b.tag!==4||b.stateNode.containerInfo!==w.containerInfo||b.stateNode.implementation!==w.implementation?(b=Tx(w,x.mode,E),b.return=x,b):(b=o(b,w.children||[]),b.return=x,b)}function u(x,b,w,E,C){return b===null||b.tag!==7?(b=El(w,x.mode,E,C),b.return=x,b):(b=o(b,w),b.return=x,b)}function f(x,b,w){if(typeof b=="string"&&b!==""||typeof b=="number")return b=Px(""+b,x.mode,w),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case _p:return w=ym(b.type,b.key,b.props,null,x.mode,w),w.ref=Ed(x,null,b),w.return=x,w;case zc:return b=Tx(b,x.mode,w),b.return=x,b;case Yi:var E=b._init;return f(x,E(b._payload),w)}if($d(b)||xd(b))return b=El(b,x.mode,w,null),b.return=x,b;Fp(x,b)}return null}function h(x,b,w,E){var C=b!==null?b.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:a(x,b,""+w,E);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case _p:return w.key===C?l(x,b,w,E):null;case zc:return w.key===C?c(x,b,w,E):null;case Yi:return C=w._init,h(x,b,C(w._payload),E)}if($d(w)||xd(w))return C!==null?null:u(x,b,w,E,null);Fp(x,w)}return null}function p(x,b,w,E,C){if(typeof E=="string"&&E!==""||typeof E=="number")return x=x.get(w)||null,a(b,x,""+E,C);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case _p:return x=x.get(E.key===null?w:E.key)||null,l(b,x,E,C);case zc:return x=x.get(E.key===null?w:E.key)||null,c(b,x,E,C);case Yi:var _=E._init;return p(x,b,w,_(E._payload),C)}if($d(E)||xd(E))return x=x.get(w)||null,u(b,x,E,C,null);Fp(b,E)}return null}function g(x,b,w,E){for(var C=null,_=null,N=b,P=b=0,j=null;N!==null&&P<w.length;P++){N.index>P?(j=N,N=null):j=N.sibling;var A=h(x,N,w[P],E);if(A===null){N===null&&(N=j);break}e&&N&&A.alternate===null&&t(x,N),b=s(A,b,P),_===null?C=A:_.sibling=A,_=A,N=j}if(P===w.length)return n(x,N),Mt&&ol(x,P),C;if(N===null){for(;P<w.length;P++)N=f(x,w[P],E),N!==null&&(b=s(N,b,P),_===null?C=N:_.sibling=N,_=N);return Mt&&ol(x,P),C}for(N=r(x,N);P<w.length;P++)j=p(N,x,P,w[P],E),j!==null&&(e&&j.alternate!==null&&N.delete(j.key===null?P:j.key),b=s(j,b,P),_===null?C=j:_.sibling=j,_=j);return e&&N.forEach(function(U){return t(x,U)}),Mt&&ol(x,P),C}function v(x,b,w,E){var C=xd(w);if(typeof C!="function")throw Error(te(150));if(w=C.call(w),w==null)throw Error(te(151));for(var _=C=null,N=b,P=b=0,j=null,A=w.next();N!==null&&!A.done;P++,A=w.next()){N.index>P?(j=N,N=null):j=N.sibling;var U=h(x,N,A.value,E);if(U===null){N===null&&(N=j);break}e&&N&&U.alternate===null&&t(x,N),b=s(U,b,P),_===null?C=U:_.sibling=U,_=U,N=j}if(A.done)return n(x,N),Mt&&ol(x,P),C;if(N===null){for(;!A.done;P++,A=w.next())A=f(x,A.value,E),A!==null&&(b=s(A,b,P),_===null?C=A:_.sibling=A,_=A);return Mt&&ol(x,P),C}for(N=r(x,N);!A.done;P++,A=w.next())A=p(N,x,P,A.value,E),A!==null&&(e&&A.alternate!==null&&N.delete(A.key===null?P:A.key),b=s(A,b,P),_===null?C=A:_.sibling=A,_=A);return e&&N.forEach(function(L){return t(x,L)}),Mt&&ol(x,P),C}function y(x,b,w,E){if(typeof w=="object"&&w!==null&&w.type===$c&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case _p:e:{for(var C=w.key,_=b;_!==null;){if(_.key===C){if(C=w.type,C===$c){if(_.tag===7){n(x,_.sibling),b=o(_,w.props.children),b.return=x,x=b;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Yi&&vC(C)===_.type){n(x,_.sibling),b=o(_,w.props),b.ref=Ed(x,_,w),b.return=x,x=b;break e}n(x,_);break}else t(x,_);_=_.sibling}w.type===$c?(b=El(w.props.children,x.mode,E,w.key),b.return=x,x=b):(E=ym(w.type,w.key,w.props,null,x.mode,E),E.ref=Ed(x,b,w),E.return=x,x=E)}return i(x);case zc:e:{for(_=w.key;b!==null;){if(b.key===_)if(b.tag===4&&b.stateNode.containerInfo===w.containerInfo&&b.stateNode.implementation===w.implementation){n(x,b.sibling),b=o(b,w.children||[]),b.return=x,x=b;break e}else{n(x,b);break}else t(x,b);b=b.sibling}b=Tx(w,x.mode,E),b.return=x,x=b}return i(x);case Yi:return _=w._init,y(x,b,_(w._payload),E)}if($d(w))return g(x,b,w,E);if(xd(w))return v(x,b,w,E);Fp(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,b!==null&&b.tag===6?(n(x,b.sibling),b=o(b,w),b.return=x,x=b):(n(x,b),b=Px(w,x.mode,E),b.return=x,x=b),i(x)):n(x,b)}return y}var mu=DO(!0),LO=DO(!1),ng=Ga(null),rg=null,qc=null,O1=null;function j1(){O1=qc=rg=null}function M1(e){var t=ng.current;jt(ng),e._currentValue=t}function db(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 tu(e,t){rg=e,O1=qc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(mr=!0),e.firstContext=null)}function ko(e){var t=e._currentValue;if(O1!==e)if(e={context:e,memoizedValue:t,next:null},qc===null){if(rg===null)throw Error(te(308));qc=e,rg.dependencies={lanes:0,firstContext:e}}else qc=qc.next=e;return t}var ml=null;function R1(e){ml===null?ml=[e]:ml.push(e)}function FO(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,R1(t)):(n.next=o.next,o.next=n),t.interleaved=n,pi(e,r)}function pi(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 Ji=!1;function A1(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function zO(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 ai(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,lt&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,pi(e,n)}return o=r.interleaved,o===null?(t.next=t,R1(r)):(t.next=o.next,o.next=t),r.interleaved=t,pi(e,n)}function fm(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,x1(e,n)}}function yC(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,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 og(e,t,n,r){var o=e.updateQueue;Ji=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,i===null?s=c:i.next=c,i=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==i&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var f=o.baseState;i=0,u=c=l=null,a=s;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 g=e,v=a;switch(h=t,p=n,v.tag){case 1:if(g=v.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=v.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Bt({},f,h);break e;case 2:Ji=!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=f):u=u.next=p,i|=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=f),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);Al|=i,e.lanes=i,e.memoizedState=f}}function xC(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(te(191,o));o.call(r)}}}var Wh={},xs=Ga(Wh),Xf=Ga(Wh),Zf=Ga(Wh);function gl(e){if(e===Wh)throw Error(te(174));return e}function I1(e,t){switch(_t(Zf,t),_t(Xf,e),_t(xs,Wh),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:H0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=H0(t,e)}jt(xs),_t(xs,t)}function gu(){jt(xs),jt(Xf),jt(Zf)}function $O(e){gl(Zf.current);var t=gl(xs.current),n=H0(t,e.type);t!==n&&(_t(Xf,e),_t(xs,n))}function D1(e){Xf.current===e&&(jt(xs),jt(Xf))}var Ft=Ga(0);function sg(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 Sx=[];function L1(){for(var e=0;e<Sx.length;e++)Sx[e]._workInProgressVersionPrimary=null;Sx.length=0}var hm=Ei.ReactCurrentDispatcher,kx=Ei.ReactCurrentBatchConfig,Rl=0,$t=null,sn=null,mn=null,ig=!1,kf=!1,Qf=0,Hz=0;function Wn(){throw Error(te(321))}function F1(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Jo(e[n],t[n]))return!1;return!0}function z1(e,t,n,r,o,s){if(Rl=s,$t=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,hm.current=e===null||e.memoizedState===null?Yz:Jz,e=n(r,o),kf){s=0;do{if(kf=!1,Qf=0,25<=s)throw Error(te(301));s+=1,mn=sn=null,t.updateQueue=null,hm.current=Xz,e=n(r,o)}while(kf)}if(hm.current=ag,t=sn!==null&&sn.next!==null,Rl=0,mn=sn=$t=null,ig=!1,t)throw Error(te(300));return e}function $1(){var e=Qf!==0;return Qf=0,e}function ds(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?$t.memoizedState=mn=e:mn=mn.next=e,mn}function Eo(){if(sn===null){var e=$t.alternate;e=e!==null?e.memoizedState:null}else e=sn.next;var t=mn===null?$t.memoizedState:mn.next;if(t!==null)mn=t,sn=e;else{if(e===null)throw Error(te(310));sn=e,e={memoizedState:sn.memoizedState,baseState:sn.baseState,baseQueue:sn.baseQueue,queue:sn.queue,next:null},mn===null?$t.memoizedState=mn=e:mn=mn.next=e}return mn}function eh(e,t){return typeof t=="function"?t(e):t}function Ex(e){var t=Eo(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=sn,o=r.baseQueue,s=n.pending;if(s!==null){if(o!==null){var i=o.next;o.next=s.next,s.next=i}r.baseQueue=o=s,n.pending=null}if(o!==null){s=o.next,r=r.baseState;var a=i=null,l=null,c=s;do{var u=c.lane;if((Rl&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 f={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=f,i=r):l=l.next=f,$t.lanes|=u,Al|=u}c=c.next}while(c!==null&&c!==s);l===null?i=r:l.next=a,Jo(r,t.memoizedState)||(mr=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do s=o.lane,$t.lanes|=s,Al|=s,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Cx(e){var t=Eo(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do s=e(s,i.action),i=i.next;while(i!==o);Jo(s,t.memoizedState)||(mr=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function BO(){}function VO(e,t){var n=$t,r=Eo(),o=t(),s=!Jo(r.memoizedState,o);if(s&&(r.memoizedState=o,mr=!0),r=r.queue,B1(HO.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||mn!==null&&mn.memoizedState.tag&1){if(n.flags|=2048,th(9,WO.bind(null,n,r,o,t),void 0,null),bn===null)throw Error(te(349));Rl&30||UO(n,t,o)}return o}function UO(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$t.updateQueue,t===null?(t={lastEffect:null,stores:null},$t.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function WO(e,t,n,r){t.value=n,t.getSnapshot=r,KO(t)&&GO(e)}function HO(e,t,n){return n(function(){KO(t)&&GO(e)})}function KO(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Jo(e,n)}catch{return!0}}function GO(e){var t=pi(e,1);t!==null&&qo(t,e,1,-1)}function bC(e){var t=ds();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:eh,lastRenderedState:e},t.queue=e,e=e.dispatch=qz.bind(null,$t,e),[t.memoizedState,e]}function th(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=$t.updateQueue,t===null?(t={lastEffect:null,stores:null},$t.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 qO(){return Eo().memoizedState}function pm(e,t,n,r){var o=ds();$t.flags|=e,o.memoizedState=th(1|t,n,void 0,r===void 0?null:r)}function Rv(e,t,n,r){var o=Eo();r=r===void 0?null:r;var s=void 0;if(sn!==null){var i=sn.memoizedState;if(s=i.destroy,r!==null&&F1(r,i.deps)){o.memoizedState=th(t,n,s,r);return}}$t.flags|=e,o.memoizedState=th(1|t,n,s,r)}function wC(e,t){return pm(8390656,8,e,t)}function B1(e,t){return Rv(2048,8,e,t)}function YO(e,t){return Rv(4,2,e,t)}function JO(e,t){return Rv(4,4,e,t)}function XO(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 ZO(e,t,n){return n=n!=null?n.concat([e]):null,Rv(4,4,XO.bind(null,t,e),n)}function V1(){}function QO(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&F1(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ej(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&F1(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function tj(e,t,n){return Rl&21?(Jo(n,t)||(n=iO(),$t.lanes|=n,Al|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,mr=!0),e.memoizedState=n)}function Kz(e,t){var n=bt;bt=n!==0&&4>n?n:4,e(!0);var r=kx.transition;kx.transition={};try{e(!1),t()}finally{bt=n,kx.transition=r}}function nj(){return Eo().memoizedState}function Gz(e,t,n){var r=Sa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},rj(e))oj(t,n);else if(n=FO(e,t,n,r),n!==null){var o=rr();qo(n,e,r,o),sj(n,t,r)}}function qz(e,t,n){var r=Sa(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(rj(e))oj(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,a=s(i,n);if(o.hasEagerState=!0,o.eagerState=a,Jo(a,i)){var l=t.interleaved;l===null?(o.next=o,R1(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=FO(e,t,o,r),n!==null&&(o=rr(),qo(n,e,r,o),sj(n,t,r))}}function rj(e){var t=e.alternate;return e===$t||t!==null&&t===$t}function oj(e,t){kf=ig=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sj(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,x1(e,n)}}var ag={readContext:ko,useCallback:Wn,useContext:Wn,useEffect:Wn,useImperativeHandle:Wn,useInsertionEffect:Wn,useLayoutEffect:Wn,useMemo:Wn,useReducer:Wn,useRef:Wn,useState:Wn,useDebugValue:Wn,useDeferredValue:Wn,useTransition:Wn,useMutableSource:Wn,useSyncExternalStore:Wn,useId:Wn,unstable_isNewReconciler:!1},Yz={readContext:ko,useCallback:function(e,t){return ds().memoizedState=[e,t===void 0?null:t],e},useContext:ko,useEffect:wC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pm(4194308,4,XO.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pm(4194308,4,e,t)},useInsertionEffect:function(e,t){return pm(4,2,e,t)},useMemo:function(e,t){var n=ds();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ds();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=Gz.bind(null,$t,e),[r.memoizedState,e]},useRef:function(e){var t=ds();return e={current:e},t.memoizedState=e},useState:bC,useDebugValue:V1,useDeferredValue:function(e){return ds().memoizedState=e},useTransition:function(){var e=bC(!1),t=e[0];return e=Kz.bind(null,e[1]),ds().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=$t,o=ds();if(Mt){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),bn===null)throw Error(te(349));Rl&30||UO(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,wC(HO.bind(null,r,s,e),[e]),r.flags|=2048,th(9,WO.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ds(),t=bn.identifierPrefix;if(Mt){var n=ti,r=ei;n=(r&~(1<<32-Go(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Qf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Hz++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Jz={readContext:ko,useCallback:QO,useContext:ko,useEffect:B1,useImperativeHandle:ZO,useInsertionEffect:YO,useLayoutEffect:JO,useMemo:ej,useReducer:Ex,useRef:qO,useState:function(){return Ex(eh)},useDebugValue:V1,useDeferredValue:function(e){var t=Eo();return tj(t,sn.memoizedState,e)},useTransition:function(){var e=Ex(eh)[0],t=Eo().memoizedState;return[e,t]},useMutableSource:BO,useSyncExternalStore:VO,useId:nj,unstable_isNewReconciler:!1},Xz={readContext:ko,useCallback:QO,useContext:ko,useEffect:B1,useImperativeHandle:ZO,useInsertionEffect:YO,useLayoutEffect:JO,useMemo:ej,useReducer:Cx,useRef:qO,useState:function(){return Cx(eh)},useDebugValue:V1,useDeferredValue:function(e){var t=Eo();return sn===null?t.memoizedState=e:tj(t,sn.memoizedState,e)},useTransition:function(){var e=Cx(eh)[0],t=Eo().memoizedState;return[e,t]},useMutableSource:BO,useSyncExternalStore:VO,useId:nj,unstable_isNewReconciler:!1};function zo(e,t){if(e&&e.defaultProps){t=Bt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function fb(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Bt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Av={isMounted:function(e){return(e=e._reactInternals)?ac(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=rr(),o=Sa(e),s=ai(r,o);s.payload=t,n!=null&&(s.callback=n),t=ba(e,s,o),t!==null&&(qo(t,e,o,r),fm(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=rr(),o=Sa(e),s=ai(r,o);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=ba(e,s,o),t!==null&&(qo(t,e,o,r),fm(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=rr(),r=Sa(e),o=ai(n,r);o.tag=2,t!=null&&(o.callback=t),t=ba(e,o,r),t!==null&&(qo(t,e,r,n),fm(t,e,r))}};function SC(e,t,n,r,o,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!Gf(n,r)||!Gf(o,s):!0}function ij(e,t,n){var r=!1,o=Ma,s=t.contextType;return typeof s=="object"&&s!==null?s=ko(s):(o=wr(t)?jl:Yn.current,r=t.contextTypes,s=(r=r!=null)?hu(e,o):Ma),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Av,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s),t}function kC(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&&Av.enqueueReplaceState(t,t.state,null)}function hb(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},A1(e);var s=t.contextType;typeof s=="object"&&s!==null?o.context=ko(s):(s=wr(t)?jl:Yn.current,o.context=hu(e,s)),o.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(fb(e,t,s,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&&Av.enqueueReplaceState(o,o.state,null),og(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function vu(e,t){try{var n="",r=t;do n+=C5(r),r=r.return;while(r);var o=n}catch(s){o=`
|
|
31
|
+
Error generating stack: `+s.message+`
|
|
32
|
+
`+s.stack}return{value:e,source:t,stack:o,digest:null}}function Nx(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function pb(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Zz=typeof WeakMap=="function"?WeakMap:Map;function aj(e,t,n){n=ai(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cg||(cg=!0,Eb=r),pb(e,t)},n}function lj(e,t,n){n=ai(-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(){pb(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){pb(e,t),typeof r!="function"&&(wa===null?wa=new Set([this]):wa.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function EC(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Zz;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=f$.bind(null,e,t,n),t.then(e,e))}function CC(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 NC(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=ai(-1,1),t.tag=2,ba(n,t,1))),n.lanes|=1),e)}var Qz=Ei.ReactCurrentOwner,mr=!1;function tr(e,t,n,r){t.child=e===null?LO(t,null,n,r):mu(t,e.child,n,r)}function _C(e,t,n,r,o){n=n.render;var s=t.ref;return tu(t,o),r=z1(e,t,n,r,s,o),n=$1(),e!==null&&!mr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mi(e,t,o)):(Mt&&n&&_1(t),t.flags|=1,tr(e,t,r,o),t.child)}function PC(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!J1(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,cj(e,t,s,r,o)):(e=ym(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:Gf,n(i,r)&&e.ref===t.ref)return mi(e,t,o)}return t.flags|=1,e=ka(s,r),e.ref=t.ref,e.return=t,t.child=e}function cj(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(Gf(s,r)&&e.ref===t.ref)if(mr=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&(mr=!0);else return t.lanes=e.lanes,mi(e,t,o)}return mb(e,t,n,r,o)}function uj(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},_t(Jc,$r),$r|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,_t(Jc,$r),$r|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,_t(Jc,$r),$r|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,_t(Jc,$r),$r|=r;return tr(e,t,o,n),t.child}function dj(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function mb(e,t,n,r,o){var s=wr(n)?jl:Yn.current;return s=hu(t,s),tu(t,o),n=z1(e,t,n,r,s,o),r=$1(),e!==null&&!mr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mi(e,t,o)):(Mt&&r&&_1(t),t.flags|=1,tr(e,t,n,o),t.child)}function TC(e,t,n,r,o){if(wr(n)){var s=!0;Qm(t)}else s=!1;if(tu(t,o),t.stateNode===null)mm(e,t),ij(t,n,r),hb(t,n,r,o),r=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var l=i.context,c=n.contextType;typeof c=="object"&&c!==null?c=ko(c):(c=wr(n)?jl:Yn.current,c=hu(t,c));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==r||l!==c)&&kC(t,i,r,c),Ji=!1;var h=t.memoizedState;i.state=h,og(t,r,i,o),l=t.memoizedState,a!==r||h!==l||br.current||Ji?(typeof u=="function"&&(fb(t,n,u,r),l=t.memoizedState),(a=Ji||SC(t,n,a,r,h,l,c))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=c,r=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,zO(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:zo(t.type,a),i.props=c,f=t.pendingProps,h=i.context,l=n.contextType,typeof l=="object"&&l!==null?l=ko(l):(l=wr(n)?jl:Yn.current,l=hu(t,l));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==f||h!==l)&&kC(t,i,r,l),Ji=!1,h=t.memoizedState,i.state=h,og(t,r,i,o);var g=t.memoizedState;a!==f||h!==g||br.current||Ji?(typeof p=="function"&&(fb(t,n,p,r),g=t.memoizedState),(c=Ji||SC(t,n,c,r,h,g,l)||!1)?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,g,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,g,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),i.props=r,i.state=g,i.context=l,r=c):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return gb(e,t,n,r,s,o)}function gb(e,t,n,r,o,s){dj(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&pC(t,n,!1),mi(e,t,s);r=t.stateNode,Qz.current=t;var a=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=mu(t,e.child,null,s),t.child=mu(t,null,a,s)):tr(e,t,a,s),t.memoizedState=r.state,o&&pC(t,n,!0),t.child}function fj(e){var t=e.stateNode;t.pendingContext?hC(e,t.pendingContext,t.pendingContext!==t.context):t.context&&hC(e,t.context,!1),I1(e,t.containerInfo)}function OC(e,t,n,r,o){return pu(),T1(o),t.flags|=256,tr(e,t,n,r),t.child}var vb={dehydrated:null,treeContext:null,retryLane:0};function yb(e){return{baseLanes:e,cachePool:null,transitions:null}}function hj(e,t,n){var r=t.pendingProps,o=Ft.current,s=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),_t(Ft,o&1),e===null)return ub(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):(i=r.children,e=r.fallback,s?(r=t.mode,s=t.child,i={mode:"hidden",children:i},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=i):s=Lv(i,r,0,null),e=El(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=yb(n),t.memoizedState=vb,e):U1(t,i));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return e$(e,t,i,r,a,o,n);if(s){s=r.fallback,i=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=ka(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?s=ka(a,s):(s=El(s,i,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,i=e.child.memoizedState,i=i===null?yb(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=vb,r}return s=e.child,e=s.sibling,r=ka(s,{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 U1(e,t){return t=Lv({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function zp(e,t,n,r){return r!==null&&T1(r),mu(t,e.child,null,n),e=U1(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function e$(e,t,n,r,o,s,i){if(n)return t.flags&256?(t.flags&=-257,r=Nx(Error(te(422))),zp(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=Lv({mode:"visible",children:r.children},o,0,null),s=El(s,o,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&mu(t,e.child,null,i),t.child.memoizedState=yb(i),t.memoizedState=vb,s);if(!(t.mode&1))return zp(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(te(419)),r=Nx(s,r,void 0),zp(e,t,i,r)}if(a=(i&e.childLanes)!==0,mr||a){if(r=bn,r!==null){switch(i&-i){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|i)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,pi(e,o),qo(r,e,o,-1))}return Y1(),r=Nx(Error(te(421))),zp(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=h$.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,Wr=xa(o.nextSibling),Gr=t,Mt=!0,Vo=null,e!==null&&(ho[po++]=ei,ho[po++]=ti,ho[po++]=Ml,ei=e.id,ti=e.overflow,Ml=t),t=U1(t,r.children),t.flags|=4096,t)}function jC(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),db(e.return,t,n)}function _x(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function pj(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if(tr(e,t,r.children,n),r=Ft.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&&jC(e,n,t);else if(e.tag===19)jC(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(_t(Ft,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&&sg(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),_x(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&sg(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}_x(t,!0,n,null,s);break;case"together":_x(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function mm(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function mi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Al|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=ka(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ka(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function t$(e,t,n){switch(t.tag){case 3:fj(t),pu();break;case 5:$O(t);break;case 1:wr(t.type)&&Qm(t);break;case 4:I1(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;_t(ng,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(_t(Ft,Ft.current&1),t.flags|=128,null):n&t.child.childLanes?hj(e,t,n):(_t(Ft,Ft.current&1),e=mi(e,t,n),e!==null?e.sibling:null);_t(Ft,Ft.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return pj(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),_t(Ft,Ft.current),r)break;return null;case 22:case 23:return t.lanes=0,uj(e,t,n)}return mi(e,t,n)}var mj,xb,gj,vj;mj=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}};xb=function(){};gj=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,gl(xs.current);var s=null;switch(n){case"input":o=B0(e,o),r=B0(e,r),s=[];break;case"select":o=Bt({},o,{value:void 0}),r=Bt({},r,{value:void 0}),s=[];break;case"textarea":o=W0(e,o),r=W0(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Xm)}K0(n,r);var i;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(i in a)a.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&($f.hasOwnProperty(c)?s||(s=[]):(s=s||[]).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(i in a)!a.hasOwnProperty(i)||l&&l.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in l)l.hasOwnProperty(i)&&a[i]!==l[i]&&(n||(n={}),n[i]=l[i])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&($f.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ot("scroll",e),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};vj=function(e,t,n,r){n!==r&&(t.flags|=4)};function Cd(e,t){if(!Mt)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 Hn(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 n$(e,t,n){var r=t.pendingProps;switch(P1(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Hn(t),null;case 1:return wr(t.type)&&Zm(),Hn(t),null;case 3:return r=t.stateNode,gu(),jt(br),jt(Yn),L1(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Lp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vo!==null&&(_b(Vo),Vo=null))),xb(e,t),Hn(t),null;case 5:D1(t);var o=gl(Zf.current);if(n=t.type,e!==null&&t.stateNode!=null)gj(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(te(166));return Hn(t),null}if(e=gl(xs.current),Lp(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[ps]=t,r[Jf]=s,e=(t.mode&1)!==0,n){case"dialog":Ot("cancel",r),Ot("close",r);break;case"iframe":case"object":case"embed":Ot("load",r);break;case"video":case"audio":for(o=0;o<Vd.length;o++)Ot(Vd[o],r);break;case"source":Ot("error",r);break;case"img":case"image":case"link":Ot("error",r),Ot("load",r);break;case"details":Ot("toggle",r);break;case"input":$E(r,s),Ot("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Ot("invalid",r);break;case"textarea":VE(r,s),Ot("invalid",r)}K0(n,s),o=null;for(var i in s)if(s.hasOwnProperty(i)){var a=s[i];i==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Dp(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Dp(r.textContent,a,e),o=["children",""+a]):$f.hasOwnProperty(i)&&a!=null&&i==="onScroll"&&Ot("scroll",r)}switch(n){case"input":Pp(r),BE(r,s,!0);break;case"textarea":Pp(r),UE(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Xm)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=HT(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[ps]=t,e[Jf]=r,mj(e,t,!1,!1),t.stateNode=e;e:{switch(i=G0(n,r),n){case"dialog":Ot("cancel",e),Ot("close",e),o=r;break;case"iframe":case"object":case"embed":Ot("load",e),o=r;break;case"video":case"audio":for(o=0;o<Vd.length;o++)Ot(Vd[o],e);o=r;break;case"source":Ot("error",e),o=r;break;case"img":case"image":case"link":Ot("error",e),Ot("load",e),o=r;break;case"details":Ot("toggle",e),o=r;break;case"input":$E(e,r),o=B0(e,r),Ot("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=Bt({},r,{value:void 0}),Ot("invalid",e);break;case"textarea":VE(e,r),o=W0(e,r),Ot("invalid",e);break;default:o=r}K0(n,o),a=o;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?qT(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&KT(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Bf(e,l):typeof l=="number"&&Bf(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&($f.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Ot("scroll",e):l!=null&&h1(e,s,l,i))}switch(n){case"input":Pp(e),BE(e,r,!1);break;case"textarea":Pp(e),UE(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ja(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Xc(e,!!r.multiple,s,!1):r.defaultValue!=null&&Xc(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Xm)}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 Hn(t),null;case 6:if(e&&t.stateNode!=null)vj(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(te(166));if(n=gl(Zf.current),gl(xs.current),Lp(t)){if(r=t.stateNode,n=t.memoizedProps,r[ps]=t,(s=r.nodeValue!==n)&&(e=Gr,e!==null))switch(e.tag){case 3:Dp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Dp(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ps]=t,t.stateNode=r}return Hn(t),null;case 13:if(jt(Ft),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Mt&&Wr!==null&&t.mode&1&&!(t.flags&128))IO(),pu(),t.flags|=98560,s=!1;else if(s=Lp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(te(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(te(317));s[ps]=t}else pu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Hn(t),s=!1}else Vo!==null&&(_b(Vo),Vo=null),s=!0;if(!s)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||Ft.current&1?ln===0&&(ln=3):Y1())),t.updateQueue!==null&&(t.flags|=4),Hn(t),null);case 4:return gu(),xb(e,t),e===null&&qf(t.stateNode.containerInfo),Hn(t),null;case 10:return M1(t.type._context),Hn(t),null;case 17:return wr(t.type)&&Zm(),Hn(t),null;case 19:if(jt(Ft),s=t.memoizedState,s===null)return Hn(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)Cd(s,!1);else{if(ln!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=sg(e),i!==null){for(t.flags|=128,Cd(s,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,i=s.alternate,i===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,s.type=i.type,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return _t(Ft,Ft.current&1|2),t.child}e=e.sibling}s.tail!==null&&Gt()>yu&&(t.flags|=128,r=!0,Cd(s,!1),t.lanes=4194304)}else{if(!r)if(e=sg(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Cd(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Mt)return Hn(t),null}else 2*Gt()-s.renderingStartTime>yu&&n!==1073741824&&(t.flags|=128,r=!0,Cd(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Gt(),t.sibling=null,n=Ft.current,_t(Ft,r?n&1|2:n&1),t):(Hn(t),null);case 22:case 23:return q1(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?$r&1073741824&&(Hn(t),t.subtreeFlags&6&&(t.flags|=8192)):Hn(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function r$(e,t){switch(P1(t),t.tag){case 1:return wr(t.type)&&Zm(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gu(),jt(br),jt(Yn),L1(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return D1(t),null;case 13:if(jt(Ft),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));pu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return jt(Ft),null;case 4:return gu(),null;case 10:return M1(t.type._context),null;case 22:case 23:return q1(),null;case 24:return null;default:return null}}var $p=!1,qn=!1,o$=typeof WeakSet=="function"?WeakSet:Set,ye=null;function Yc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ut(e,t,r)}else n.current=null}function bb(e,t,n){try{n()}catch(r){Ut(e,t,r)}}var MC=!1;function s$(e,t){if(rb=qm,e=SO(),N1(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,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,c=0,u=0,f=e,h=null;t:for(;;){for(var p;f!==n||o!==0&&f.nodeType!==3||(a=i+o),f!==s||r!==0&&f.nodeType!==3||(l=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++c===o&&(a=i),h===s&&++u===r&&(l=i),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ob={focusedElem:e,selectionRange:n},qm=!1,ye=t;ye!==null;)if(t=ye,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ye=e;else for(;ye!==null;){t=ye;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var v=g.memoizedProps,y=g.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?v:zo(t.type,v),y);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(E){Ut(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,ye=e;break}ye=t.return}return g=MC,MC=!1,g}function Ef(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 s=o.destroy;o.destroy=void 0,s!==void 0&&bb(t,n,s)}o=o.next}while(o!==r)}}function Iv(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 wb(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 yj(e){var t=e.alternate;t!==null&&(e.alternate=null,yj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ps],delete t[Jf],delete t[ab],delete t[Bz],delete t[Vz])),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 xj(e){return e.tag===5||e.tag===3||e.tag===4}function RC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xj(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 Sb(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=Xm));else if(r!==4&&(e=e.child,e!==null))for(Sb(e,t,n),e=e.sibling;e!==null;)Sb(e,t,n),e=e.sibling}function kb(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(kb(e,t,n),e=e.sibling;e!==null;)kb(e,t,n),e=e.sibling}var On=null,Bo=!1;function Ri(e,t,n){for(n=n.child;n!==null;)bj(e,t,n),n=n.sibling}function bj(e,t,n){if(ys&&typeof ys.onCommitFiberUnmount=="function")try{ys.onCommitFiberUnmount(_v,n)}catch{}switch(n.tag){case 5:qn||Yc(n,t);case 6:var r=On,o=Bo;On=null,Ri(e,t,n),On=r,Bo=o,On!==null&&(Bo?(e=On,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):On.removeChild(n.stateNode));break;case 18:On!==null&&(Bo?(e=On,n=n.stateNode,e.nodeType===8?bx(e.parentNode,n):e.nodeType===1&&bx(e,n),Hf(e)):bx(On,n.stateNode));break;case 4:r=On,o=Bo,On=n.stateNode.containerInfo,Bo=!0,Ri(e,t,n),On=r,Bo=o;break;case 0:case 11:case 14:case 15:if(!qn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&bb(n,t,i),o=o.next}while(o!==r)}Ri(e,t,n);break;case 1:if(!qn&&(Yc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ut(n,t,a)}Ri(e,t,n);break;case 21:Ri(e,t,n);break;case 22:n.mode&1?(qn=(r=qn)||n.memoizedState!==null,Ri(e,t,n),qn=r):Ri(e,t,n);break;default:Ri(e,t,n)}}function AC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new o$),t.forEach(function(r){var o=p$.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Ao(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var s=e,i=t,a=i;e:for(;a!==null;){switch(a.tag){case 5:On=a.stateNode,Bo=!1;break e;case 3:On=a.stateNode.containerInfo,Bo=!0;break e;case 4:On=a.stateNode.containerInfo,Bo=!0;break e}a=a.return}if(On===null)throw Error(te(160));bj(s,i,o),On=null,Bo=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){Ut(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)wj(t,e),t=t.sibling}function wj(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ao(t,e),cs(e),r&4){try{Ef(3,e,e.return),Iv(3,e)}catch(v){Ut(e,e.return,v)}try{Ef(5,e,e.return)}catch(v){Ut(e,e.return,v)}}break;case 1:Ao(t,e),cs(e),r&512&&n!==null&&Yc(n,n.return);break;case 5:if(Ao(t,e),cs(e),r&512&&n!==null&&Yc(n,n.return),e.flags&32){var o=e.stateNode;try{Bf(o,"")}catch(v){Ut(e,e.return,v)}}if(r&4&&(o=e.stateNode,o!=null)){var s=e.memoizedProps,i=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&UT(o,s),G0(a,i);var c=G0(a,s);for(i=0;i<l.length;i+=2){var u=l[i],f=l[i+1];u==="style"?qT(o,f):u==="dangerouslySetInnerHTML"?KT(o,f):u==="children"?Bf(o,f):h1(o,u,f,c)}switch(a){case"input":V0(o,s);break;case"textarea":WT(o,s);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Xc(o,!!s.multiple,p,!1):h!==!!s.multiple&&(s.defaultValue!=null?Xc(o,!!s.multiple,s.defaultValue,!0):Xc(o,!!s.multiple,s.multiple?[]:"",!1))}o[Jf]=s}catch(v){Ut(e,e.return,v)}}break;case 6:if(Ao(t,e),cs(e),r&4){if(e.stateNode===null)throw Error(te(162));o=e.stateNode,s=e.memoizedProps;try{o.nodeValue=s}catch(v){Ut(e,e.return,v)}}break;case 3:if(Ao(t,e),cs(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Hf(t.containerInfo)}catch(v){Ut(e,e.return,v)}break;case 4:Ao(t,e),cs(e);break;case 13:Ao(t,e),cs(e),o=e.child,o.flags&8192&&(s=o.memoizedState!==null,o.stateNode.isHidden=s,!s||o.alternate!==null&&o.alternate.memoizedState!==null||(K1=Gt())),r&4&&AC(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(qn=(c=qn)||u,Ao(t,e),qn=c):Ao(t,e),cs(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(ye=e,u=e.child;u!==null;){for(f=ye=u;ye!==null;){switch(h=ye,p=h.child,h.tag){case 0:case 11:case 14:case 15:Ef(4,h,h.return);break;case 1:Yc(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(v){Ut(r,n,v)}}break;case 5:Yc(h,h.return);break;case 22:if(h.memoizedState!==null){DC(f);continue}}p!==null?(p.return=h,ye=p):DC(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{o=f.stateNode,c?(s=o.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=f.stateNode,l=f.memoizedProps.style,i=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=GT("display",i))}catch(v){Ut(e,e.return,v)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(v){Ut(e,e.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ao(t,e),cs(e),r&4&&AC(e);break;case 21:break;default:Ao(t,e),cs(e)}}function cs(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(xj(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Bf(o,""),r.flags&=-33);var s=RC(e);kb(e,s,o);break;case 3:case 4:var i=r.stateNode.containerInfo,a=RC(e);Sb(e,a,i);break;default:throw Error(te(161))}}catch(l){Ut(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function i$(e,t,n){ye=e,Sj(e)}function Sj(e,t,n){for(var r=(e.mode&1)!==0;ye!==null;){var o=ye,s=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||$p;if(!i){var a=o.alternate,l=a!==null&&a.memoizedState!==null||qn;a=$p;var c=qn;if($p=i,(qn=l)&&!c)for(ye=o;ye!==null;)i=ye,l=i.child,i.tag===22&&i.memoizedState!==null?LC(o):l!==null?(l.return=i,ye=l):LC(o);for(;s!==null;)ye=s,Sj(s),s=s.sibling;ye=o,$p=a,qn=c}IC(e)}else o.subtreeFlags&8772&&s!==null?(s.return=o,ye=s):IC(e)}}function IC(e){for(;ye!==null;){var t=ye;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:qn||Iv(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!qn)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:zo(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&xC(t,s,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}xC(t,i,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 f=u.dehydrated;f!==null&&Hf(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}qn||t.flags&512&&wb(t)}catch(h){Ut(t,t.return,h)}}if(t===e){ye=null;break}if(n=t.sibling,n!==null){n.return=t.return,ye=n;break}ye=t.return}}function DC(e){for(;ye!==null;){var t=ye;if(t===e){ye=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ye=n;break}ye=t.return}}function LC(e){for(;ye!==null;){var t=ye;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Iv(4,t)}catch(l){Ut(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){Ut(t,o,l)}}var s=t.return;try{wb(t)}catch(l){Ut(t,s,l)}break;case 5:var i=t.return;try{wb(t)}catch(l){Ut(t,i,l)}}}catch(l){Ut(t,t.return,l)}if(t===e){ye=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ye=a;break}ye=t.return}}var a$=Math.ceil,lg=Ei.ReactCurrentDispatcher,W1=Ei.ReactCurrentOwner,xo=Ei.ReactCurrentBatchConfig,lt=0,bn=null,tn=null,In=0,$r=0,Jc=Ga(0),ln=0,nh=null,Al=0,Dv=0,H1=0,Cf=null,pr=null,K1=0,yu=1/0,Gs=null,cg=!1,Eb=null,wa=null,Bp=!1,ua=null,ug=0,Nf=0,Cb=null,gm=-1,vm=0;function rr(){return lt&6?Gt():gm!==-1?gm:gm=Gt()}function Sa(e){return e.mode&1?lt&2&&In!==0?In&-In:Wz.transition!==null?(vm===0&&(vm=iO()),vm):(e=bt,e!==0||(e=window.event,e=e===void 0?16:hO(e.type)),e):1}function qo(e,t,n,r){if(50<Nf)throw Nf=0,Cb=null,Error(te(185));Bh(e,n,r),(!(lt&2)||e!==bn)&&(e===bn&&(!(lt&2)&&(Dv|=n),ln===4&&ra(e,In)),Sr(e,r),n===1&<===0&&!(t.mode&1)&&(yu=Gt()+500,Mv&&qa()))}function Sr(e,t){var n=e.callbackNode;W5(e,t);var r=Gm(e,e===bn?In:0);if(r===0)n!==null&&KE(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&KE(n),t===1)e.tag===0?Uz(FC.bind(null,e)):MO(FC.bind(null,e)),zz(function(){!(lt&6)&&qa()}),n=null;else{switch(aO(r)){case 1:n=y1;break;case 4:n=oO;break;case 16:n=Km;break;case 536870912:n=sO;break;default:n=Km}n=Oj(n,kj.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function kj(e,t){if(gm=-1,vm=0,lt&6)throw Error(te(327));var n=e.callbackNode;if(nu()&&e.callbackNode!==n)return null;var r=Gm(e,e===bn?In:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=dg(e,r);else{t=r;var o=lt;lt|=2;var s=Cj();(bn!==e||In!==t)&&(Gs=null,yu=Gt()+500,kl(e,t));do try{u$();break}catch(a){Ej(e,a)}while(!0);j1(),lg.current=s,lt=o,tn!==null?t=0:(bn=null,In=0,t=ln)}if(t!==0){if(t===2&&(o=Z0(e),o!==0&&(r=o,t=Nb(e,o))),t===1)throw n=nh,kl(e,0),ra(e,r),Sr(e,Gt()),n;if(t===6)ra(e,r);else{if(o=e.current.alternate,!(r&30)&&!l$(o)&&(t=dg(e,r),t===2&&(s=Z0(e),s!==0&&(r=s,t=Nb(e,s))),t===1))throw n=nh,kl(e,0),ra(e,r),Sr(e,Gt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(te(345));case 2:sl(e,pr,Gs);break;case 3:if(ra(e,r),(r&130023424)===r&&(t=K1+500-Gt(),10<t)){if(Gm(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){rr(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ib(sl.bind(null,e,pr,Gs),t);break}sl(e,pr,Gs);break;case 4:if(ra(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-Go(r);s=1<<i,i=t[i],i>o&&(o=i),r&=~s}if(r=o,r=Gt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*a$(r/1960))-r,10<r){e.timeoutHandle=ib(sl.bind(null,e,pr,Gs),r);break}sl(e,pr,Gs);break;case 5:sl(e,pr,Gs);break;default:throw Error(te(329))}}}return Sr(e,Gt()),e.callbackNode===n?kj.bind(null,e):null}function Nb(e,t){var n=Cf;return e.current.memoizedState.isDehydrated&&(kl(e,t).flags|=256),e=dg(e,t),e!==2&&(t=pr,pr=n,t!==null&&_b(t)),e}function _b(e){pr===null?pr=e:pr.push.apply(pr,e)}function l$(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],s=o.getSnapshot;o=o.value;try{if(!Jo(s(),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 ra(e,t){for(t&=~H1,t&=~Dv,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Go(t),r=1<<n;e[n]=-1,t&=~r}}function FC(e){if(lt&6)throw Error(te(327));nu();var t=Gm(e,0);if(!(t&1))return Sr(e,Gt()),null;var n=dg(e,t);if(e.tag!==0&&n===2){var r=Z0(e);r!==0&&(t=r,n=Nb(e,r))}if(n===1)throw n=nh,kl(e,0),ra(e,t),Sr(e,Gt()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,sl(e,pr,Gs),Sr(e,Gt()),null}function G1(e,t){var n=lt;lt|=1;try{return e(t)}finally{lt=n,lt===0&&(yu=Gt()+500,Mv&&qa())}}function Il(e){ua!==null&&ua.tag===0&&!(lt&6)&&nu();var t=lt;lt|=1;var n=xo.transition,r=bt;try{if(xo.transition=null,bt=1,e)return e()}finally{bt=r,xo.transition=n,lt=t,!(lt&6)&&qa()}}function q1(){$r=Jc.current,jt(Jc)}function kl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Fz(n)),tn!==null)for(n=tn.return;n!==null;){var r=n;switch(P1(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Zm();break;case 3:gu(),jt(br),jt(Yn),L1();break;case 5:D1(r);break;case 4:gu();break;case 13:jt(Ft);break;case 19:jt(Ft);break;case 10:M1(r.type._context);break;case 22:case 23:q1()}n=n.return}if(bn=e,tn=e=ka(e.current,null),In=$r=t,ln=0,nh=null,H1=Dv=Al=0,pr=Cf=null,ml!==null){for(t=0;t<ml.length;t++)if(n=ml[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=o,r.next=i}n.pending=r}ml=null}return e}function Ej(e,t){do{var n=tn;try{if(j1(),hm.current=ag,ig){for(var r=$t.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}ig=!1}if(Rl=0,mn=sn=$t=null,kf=!1,Qf=0,W1.current=null,n===null||n.return===null){ln=1,nh=t,tn=null;break}e:{var s=e,i=n.return,a=n,l=t;if(t=In,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===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=CC(i);if(p!==null){p.flags&=-257,NC(p,i,a,s,t),p.mode&1&&EC(s,c,t),t=p,l=c;var g=t.updateQueue;if(g===null){var v=new Set;v.add(l),t.updateQueue=v}else g.add(l);break e}else{if(!(t&1)){EC(s,c,t),Y1();break e}l=Error(te(426))}}else if(Mt&&a.mode&1){var y=CC(i);if(y!==null){!(y.flags&65536)&&(y.flags|=256),NC(y,i,a,s,t),T1(vu(l,a));break e}}s=l=vu(l,a),ln!==4&&(ln=2),Cf===null?Cf=[s]:Cf.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var x=aj(s,l,t);yC(s,x);break e;case 1:a=l;var b=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof b.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(wa===null||!wa.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var E=lj(s,a,t);yC(s,E);break e}}s=s.return}while(s!==null)}_j(n)}catch(C){t=C,tn===n&&n!==null&&(tn=n=n.return);continue}break}while(!0)}function Cj(){var e=lg.current;return lg.current=ag,e===null?ag:e}function Y1(){(ln===0||ln===3||ln===2)&&(ln=4),bn===null||!(Al&268435455)&&!(Dv&268435455)||ra(bn,In)}function dg(e,t){var n=lt;lt|=2;var r=Cj();(bn!==e||In!==t)&&(Gs=null,kl(e,t));do try{c$();break}catch(o){Ej(e,o)}while(!0);if(j1(),lt=n,lg.current=r,tn!==null)throw Error(te(261));return bn=null,In=0,ln}function c$(){for(;tn!==null;)Nj(tn)}function u$(){for(;tn!==null&&!I5();)Nj(tn)}function Nj(e){var t=Tj(e.alternate,e,$r);e.memoizedProps=e.pendingProps,t===null?_j(e):tn=t,W1.current=null}function _j(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=r$(n,t),n!==null){n.flags&=32767,tn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ln=6,tn=null;return}}else if(n=n$(n,t,$r),n!==null){tn=n;return}if(t=t.sibling,t!==null){tn=t;return}tn=t=e}while(t!==null);ln===0&&(ln=5)}function sl(e,t,n){var r=bt,o=xo.transition;try{xo.transition=null,bt=1,d$(e,t,n,r)}finally{xo.transition=o,bt=r}return null}function d$(e,t,n,r){do nu();while(ua!==null);if(lt&6)throw Error(te(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(te(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(H5(e,s),e===bn&&(tn=bn=null,In=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Bp||(Bp=!0,Oj(Km,function(){return nu(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=xo.transition,xo.transition=null;var i=bt;bt=1;var a=lt;lt|=4,W1.current=null,s$(e,n),wj(n,e),jz(ob),qm=!!rb,ob=rb=null,e.current=n,i$(n),D5(),lt=a,bt=i,xo.transition=s}else e.current=n;if(Bp&&(Bp=!1,ua=e,ug=o),s=e.pendingLanes,s===0&&(wa=null),z5(n.stateNode),Sr(e,Gt()),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(cg)throw cg=!1,e=Eb,Eb=null,e;return ug&1&&e.tag!==0&&nu(),s=e.pendingLanes,s&1?e===Cb?Nf++:(Nf=0,Cb=e):Nf=0,qa(),null}function nu(){if(ua!==null){var e=aO(ug),t=xo.transition,n=bt;try{if(xo.transition=null,bt=16>e?16:e,ua===null)var r=!1;else{if(e=ua,ua=null,ug=0,lt&6)throw Error(te(331));var o=lt;for(lt|=4,ye=e.current;ye!==null;){var s=ye,i=s.child;if(ye.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ye=c;ye!==null;){var u=ye;switch(u.tag){case 0:case 11:case 15:Ef(8,u,s)}var f=u.child;if(f!==null)f.return=u,ye=f;else for(;ye!==null;){u=ye;var h=u.sibling,p=u.return;if(yj(u),u===c){ye=null;break}if(h!==null){h.return=p,ye=h;break}ye=p}}}var g=s.alternate;if(g!==null){var v=g.child;if(v!==null){g.child=null;do{var y=v.sibling;v.sibling=null,v=y}while(v!==null)}}ye=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,ye=i;else e:for(;ye!==null;){if(s=ye,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Ef(9,s,s.return)}var x=s.sibling;if(x!==null){x.return=s.return,ye=x;break e}ye=s.return}}var b=e.current;for(ye=b;ye!==null;){i=ye;var w=i.child;if(i.subtreeFlags&2064&&w!==null)w.return=i,ye=w;else e:for(i=b;ye!==null;){if(a=ye,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Iv(9,a)}}catch(C){Ut(a,a.return,C)}if(a===i){ye=null;break e}var E=a.sibling;if(E!==null){E.return=a.return,ye=E;break e}ye=a.return}}if(lt=o,qa(),ys&&typeof ys.onPostCommitFiberRoot=="function")try{ys.onPostCommitFiberRoot(_v,e)}catch{}r=!0}return r}finally{bt=n,xo.transition=t}}return!1}function zC(e,t,n){t=vu(n,t),t=aj(e,t,1),e=ba(e,t,1),t=rr(),e!==null&&(Bh(e,1,t),Sr(e,t))}function Ut(e,t,n){if(e.tag===3)zC(e,e,n);else for(;t!==null;){if(t.tag===3){zC(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(wa===null||!wa.has(r))){e=vu(n,e),e=lj(t,e,1),t=ba(t,e,1),e=rr(),t!==null&&(Bh(t,1,e),Sr(t,e));break}}t=t.return}}function f$(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=rr(),e.pingedLanes|=e.suspendedLanes&n,bn===e&&(In&n)===n&&(ln===4||ln===3&&(In&130023424)===In&&500>Gt()-K1?kl(e,0):H1|=n),Sr(e,t)}function Pj(e,t){t===0&&(e.mode&1?(t=jp,jp<<=1,!(jp&130023424)&&(jp=4194304)):t=1);var n=rr();e=pi(e,t),e!==null&&(Bh(e,t,n),Sr(e,n))}function h$(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pj(e,n)}function p$(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(te(314))}r!==null&&r.delete(t),Pj(e,n)}var Tj;Tj=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||br.current)mr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return mr=!1,t$(e,t,n);mr=!!(e.flags&131072)}else mr=!1,Mt&&t.flags&1048576&&RO(t,tg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;mm(e,t),e=t.pendingProps;var o=hu(t,Yn.current);tu(t,n),o=z1(null,t,r,e,o,n);var s=$1();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,wr(r)?(s=!0,Qm(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,A1(t),o.updater=Av,t.stateNode=o,o._reactInternals=t,hb(t,r,e,n),t=gb(null,t,r,!0,s,n)):(t.tag=0,Mt&&s&&_1(t),tr(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(mm(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=g$(r),e=zo(r,e),o){case 0:t=mb(null,t,r,e,n);break e;case 1:t=TC(null,t,r,e,n);break e;case 11:t=_C(null,t,r,e,n);break e;case 14:t=PC(null,t,r,zo(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zo(r,o),mb(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zo(r,o),TC(e,t,r,o,n);case 3:e:{if(fj(t),e===null)throw Error(te(387));r=t.pendingProps,s=t.memoizedState,o=s.element,zO(e,t),og(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=vu(Error(te(423)),t),t=OC(e,t,r,n,o);break e}else if(r!==o){o=vu(Error(te(424)),t),t=OC(e,t,r,n,o);break e}else for(Wr=xa(t.stateNode.containerInfo.firstChild),Gr=t,Mt=!0,Vo=null,n=LO(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(pu(),r===o){t=mi(e,t,n);break e}tr(e,t,r,n)}t=t.child}return t;case 5:return $O(t),e===null&&ub(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,sb(r,o)?i=null:s!==null&&sb(r,s)&&(t.flags|=32),dj(e,t),tr(e,t,i,n),t.child;case 6:return e===null&&ub(t),null;case 13:return hj(e,t,n);case 4:return I1(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=mu(t,null,r,n):tr(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zo(r,o),_C(e,t,r,o,n);case 7:return tr(e,t,t.pendingProps,n),t.child;case 8:return tr(e,t,t.pendingProps.children,n),t.child;case 12:return tr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,_t(ng,r._currentValue),r._currentValue=i,s!==null)if(Jo(s.value,i)){if(s.children===o.children&&!br.current){t=mi(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){i=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=ai(-1,n&-n),l.tag=2;var c=s.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}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),db(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(te(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),db(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}tr(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,tu(t,n),o=ko(o),r=r(o),t.flags|=1,tr(e,t,r,n),t.child;case 14:return r=t.type,o=zo(r,t.pendingProps),o=zo(r.type,o),PC(e,t,r,o,n);case 15:return cj(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zo(r,o),mm(e,t),t.tag=1,wr(r)?(e=!0,Qm(t)):e=!1,tu(t,n),ij(t,r,o),hb(t,r,o,n),gb(null,t,r,!0,e,n);case 19:return pj(e,t,n);case 22:return uj(e,t,n)}throw Error(te(156,t.tag))};function Oj(e,t){return rO(e,t)}function m$(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 vo(e,t,n,r){return new m$(e,t,n,r)}function J1(e){return e=e.prototype,!(!e||!e.isReactComponent)}function g$(e){if(typeof e=="function")return J1(e)?1:0;if(e!=null){if(e=e.$$typeof,e===m1)return 11;if(e===g1)return 14}return 2}function ka(e,t){var n=e.alternate;return n===null?(n=vo(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 ym(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")J1(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case $c:return El(n.children,o,s,t);case p1:i=8,o|=8;break;case L0:return e=vo(12,n,t,o|2),e.elementType=L0,e.lanes=s,e;case F0:return e=vo(13,n,t,o),e.elementType=F0,e.lanes=s,e;case z0:return e=vo(19,n,t,o),e.elementType=z0,e.lanes=s,e;case $T:return Lv(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case FT:i=10;break e;case zT:i=9;break e;case m1:i=11;break e;case g1:i=14;break e;case Yi:i=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=vo(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function El(e,t,n,r){return e=vo(7,e,r,t),e.lanes=n,e}function Lv(e,t,n,r){return e=vo(22,e,r,t),e.elementType=$T,e.lanes=n,e.stateNode={isHidden:!1},e}function Px(e,t,n){return e=vo(6,e,null,t),e.lanes=n,e}function Tx(e,t,n){return t=vo(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function v$(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=cx(0),this.expirationTimes=cx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cx(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function X1(e,t,n,r,o,s,i,a,l){return e=new v$(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=vo(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},A1(s),e}function y$(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:zc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function jj(e){if(!e)return Ma;e=e._reactInternals;e:{if(ac(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(wr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(wr(n))return jO(e,n,t)}return t}function Mj(e,t,n,r,o,s,i,a,l){return e=X1(n,r,!0,e,o,s,i,a,l),e.context=jj(null),n=e.current,r=rr(),o=Sa(n),s=ai(r,o),s.callback=t??null,ba(n,s,o),e.current.lanes=o,Bh(e,o,r),Sr(e,r),e}function Fv(e,t,n,r){var o=t.current,s=rr(),i=Sa(o);return n=jj(n),t.context===null?t.context=n:t.pendingContext=n,t=ai(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ba(o,t,i),e!==null&&(qo(e,o,i,s),fm(e,o,i)),i}function fg(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 $C(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Z1(e,t){$C(e,t),(e=e.alternate)&&$C(e,t)}function x$(){return null}var Rj=typeof reportError=="function"?reportError:function(e){console.error(e)};function Q1(e){this._internalRoot=e}zv.prototype.render=Q1.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));Fv(e,t,null,null)};zv.prototype.unmount=Q1.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Il(function(){Fv(null,e,null,null)}),t[hi]=null}};function zv(e){this._internalRoot=e}zv.prototype.unstable_scheduleHydration=function(e){if(e){var t=uO();e={blockedOn:null,target:e,priority:t};for(var n=0;n<na.length&&t!==0&&t<na[n].priority;n++);na.splice(n,0,e),n===0&&fO(e)}};function eS(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 BC(){}function b$(e,t,n,r,o){if(o){if(typeof r=="function"){var s=r;r=function(){var c=fg(i);s.call(c)}}var i=Mj(t,r,e,0,null,!1,!1,"",BC);return e._reactRootContainer=i,e[hi]=i.current,qf(e.nodeType===8?e.parentNode:e),Il(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=fg(l);a.call(c)}}var l=X1(e,0,!1,null,null,!1,!1,"",BC);return e._reactRootContainer=l,e[hi]=l.current,qf(e.nodeType===8?e.parentNode:e),Il(function(){Fv(t,l,n,r)}),l}function Bv(e,t,n,r,o){var s=n._reactRootContainer;if(s){var i=s;if(typeof o=="function"){var a=o;o=function(){var l=fg(i);a.call(l)}}Fv(t,i,e,o)}else i=b$(n,t,e,o,r);return fg(i)}lO=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bd(t.pendingLanes);n!==0&&(x1(t,n|1),Sr(t,Gt()),!(lt&6)&&(yu=Gt()+500,qa()))}break;case 13:Il(function(){var r=pi(e,1);if(r!==null){var o=rr();qo(r,e,1,o)}}),Z1(e,1)}};b1=function(e){if(e.tag===13){var t=pi(e,134217728);if(t!==null){var n=rr();qo(t,e,134217728,n)}Z1(e,134217728)}};cO=function(e){if(e.tag===13){var t=Sa(e),n=pi(e,t);if(n!==null){var r=rr();qo(n,e,t,r)}Z1(e,t)}};uO=function(){return bt};dO=function(e,t){var n=bt;try{return bt=e,t()}finally{bt=n}};Y0=function(e,t,n){switch(t){case"input":if(V0(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=jv(r);if(!o)throw Error(te(90));VT(r),V0(r,o)}}}break;case"textarea":WT(e,n);break;case"select":t=n.value,t!=null&&Xc(e,!!n.multiple,t,!1)}};XT=G1;ZT=Il;var w$={usingClientEntryPoint:!1,Events:[Uh,Wc,jv,YT,JT,G1]},Nd={findFiberByHostInstance:pl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},S$={bundleType:Nd.bundleType,version:Nd.version,rendererPackageName:Nd.rendererPackageName,rendererConfig:Nd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ei.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=tO(e),e===null?null:e.stateNode},findFiberByHostInstance:Nd.findFiberByHostInstance||x$,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 Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{_v=Vp.inject(S$),ys=Vp}catch{}}to.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=w$;to.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!eS(t))throw Error(te(200));return y$(e,t,null,n)};to.createRoot=function(e,t){if(!eS(e))throw Error(te(299));var n=!1,r="",o=Rj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=X1(e,1,!1,null,null,n,!1,r,o),e[hi]=t.current,qf(e.nodeType===8?e.parentNode:e),new Q1(t)};to.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(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=tO(t),e=e===null?null:e.stateNode,e};to.flushSync=function(e){return Il(e)};to.hydrate=function(e,t,n){if(!$v(t))throw Error(te(200));return Bv(null,e,t,!0,n)};to.hydrateRoot=function(e,t,n){if(!eS(e))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,o=!1,s="",i=Rj;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=Mj(t,null,e,1,n??null,o,!1,s,i),e[hi]=t.current,qf(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 zv(t)};to.render=function(e,t,n){if(!$v(t))throw Error(te(200));return Bv(null,e,t,!1,n)};to.unmountComponentAtNode=function(e){if(!$v(e))throw Error(te(40));return e._reactRootContainer?(Il(function(){Bv(null,null,e,!1,function(){e._reactRootContainer=null,e[hi]=null})}),!0):!1};to.unstable_batchedUpdates=G1;to.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!$v(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return Bv(e,t,n,!1,r)};to.version="18.3.1-next-f1338f8080-20240426";function Aj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Aj)}catch(e){console.error(e)}}Aj(),AT.exports=to;var Hr=AT.exports;const k$=Ha(Hr);var VC=Hr;Vm.createRoot=VC.createRoot,Vm.hydrateRoot=VC.hydrateRoot;var Ij={exports:{}},Vv={};/**
|
|
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 E$=m,C$=Symbol.for("react.element"),N$=Symbol.for("react.fragment"),_$=Object.prototype.hasOwnProperty,P$=E$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,T$={key:!0,ref:!0,__self:!0,__source:!0};function Dj(e,t,n){var r,o={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)_$.call(t,r)&&!T$.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:C$,type:e,key:s,ref:i,props:o,_owner:P$.current}}Vv.Fragment=N$;Vv.jsx=Dj;Vv.jsxs=Dj;Ij.exports=Vv;var d=Ij.exports;function Pb(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 tS(e,t){if(e){if(typeof e=="string")return Pb(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)?Pb(e,t):void 0}}function bs(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=tS(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 s,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){a=!0,s=l},f:function(){try{i||n.return==null||n.return()}finally{if(a)throw s}}}}function nS(e){return e.length>0}var Hh=Object.freeze({kind:"ok",value:void 0});function Dn(e){return e===void 0?Hh:{kind:"ok",value:e}}function Jn(e){return{kind:"err",error:e}}function Gu(e){return e===Hh||e.kind==="ok"}function Uv(e){return e!==Hh&&e.kind==="err"}function Lj(e){var t=[],n=[],r=bs(e),o;try{for(r.s();!(o=r.n()).done;){var s=o.value;Gu(s)?t.push(s.value):n.push(s.error)}}catch(i){r.e(i)}finally{r.f()}return nS(n)?Jn(n):Dn(t)}function O$(e){return Lj(e)}function j$(e){var t=[],n=bs(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value;Uv(o)&&t.push(o.error)}}catch(s){n.e(s)}finally{n.f()}return nS(t)?Jn(t):Hh}function rS(e,t){return function(n){for(var r=Dn(t),o=0;o<n.length&&Gu(r);++o)r=e(r.value,n[o],o);return r}}function mo(e){return function(t){return Gu(t)?Dn(e(t.value)):t}}function Dl(e){return function(t){return Gu(t)?e(t.value):t}}function M$(e){return function(t){return Uv(t)?Jn(e(t.error)):t}}function R$(e,t){return function(n){return e(n)?Dn(n):Jn(t(n))}}var Wv=function(t,n){return function(r){return Gu(r)?t(r.value)?r:Jn(n(r.value)):r}},A$=Object.freeze({__proto__:null,voidOk:Hh,ok:Dn,err:Jn,isOk:Gu,isErr:Uv,allT:Lj,all:O$,allV:j$,flatMapReduce:rS,map:mo,flatMap:Dl,mapErr:M$,fromPredicate:R$,filterOrElse:Wv});function I$(e){if(Array.isArray(e))return e}function D$(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,i,a=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.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&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function L$(){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 Ln(e,t){return I$(e)||D$(e,t)||tS(e,t)||L$()}function F$(e){if(Array.isArray(e))return Pb(e)}function z$(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $$(){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 me(e){return F$(e)||z$(e)||tS(e)||$$()}function se(e){"@babel/helpers - typeof";return se=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},se(e)}function B$(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fj(e){var t=B$(e,"string");return typeof t=="symbol"?t:t+""}function B(e,t,n){return(t=Fj(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function xt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UC(Object(n),!0).forEach(function(r){B(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V$(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,Fj(r.key),r)}}function Bn(e,t,n){return t&&V$(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function hg(e){return hg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hg(e)}function zj(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zj=function(){return!!e})()}function U$(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W$(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 U$(e)}function ro(e,t,n){return t=hg(t),W$(e,zj()?Reflect.construct(t,[],hg(e).constructor):t.apply(e,n))}function Tb(e,t){return Tb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Tb(e,t)}function oo(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&&Tb(e,t)}var so=function(){function e(){$n(this,e)}return Bn(e,[{key:"executeCustomValidateFunctions",value:function(n,r,o){var s=[],i=bs(r),a;try{for(i.s();!(a=i.n()).done;){var l=a.value;try{var c=l(n,o);c&&s.push({message:c,value:n})}catch(u){s.push({message:"Error in custom validate function: ".concat(u instanceof Error?u.message:String(u)),value:n,schemaError:!0})}}}catch(u){i.e(u)}finally{i.f()}return s}},{key:"appendValidationError",value:function(n,r,o,s,i){return n?(n[r]?n[r].push({message:o,value:s,schemaError:i}):n[r]=[{message:o,value:s,schemaError:i}],n):B({},r,[{message:o,value:s,schemaError:i}])}}])}(),$j=Symbol("GetSchema"),Bj=Symbol("Path"),H$=Symbol("GetSource");function WC(e){return e[$j]}var Le="_type",Ct="_ref",Ob="_tag";function K$(e){return se(e)==="object"&&e!==null&&Le in e&&e[Le]==="file"&&Ct in e&&typeof e[Ct]=="string"}var G$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return $n(this,t),r=ro(this,t),r.options=n,r.opt=o,r.isRemote=s,r.customValidateFunctions=i,r}return oo(t,e),Bn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r){return new t(this.options,this.opt,this.isRemote,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return s.length>0?B({},r,s):!1;if(o==null)return B({},r,[].concat(me(s),[{message:"Non-optional file was null or undefined.",value:o}]));if(typeof o[Ct]!="string")return B({},r,[].concat(me(s),[{message:"File did not have a file reference string. Got: ".concat(se(o[Ct])),value:o}]));if(this.isRemote&&o[Le]!=="remote")return B({},r,[].concat(me(s),[{message:"Expected a remote file, but got a local file.",value:o,fixes:["file:upload-remote"]}]));if(this.isRemote&&o[Le]==="remote")return B({},r,[].concat(me(s),[{message:"Remote file was not checked.",value:o,fixes:["file:check-remote"]}]));if(!this.isRemote&&o[Le]==="remote")return B({},r,[].concat(me(s),[{message:"Expected locale file, but found remote.",value:o,fixes:["file:download-remote"]}]));if(o[Le]!=="file")return B({},r,[].concat(me(s),[{message:"File did not have the valid file extension type. Got: ".concat(o[Le]),value:o,fixes:["file:change-extension","file:check-metadata"]}]));var i=this.options||{},a=i.accept,l=o.metadata||{},c=l.mimeType;if(a&&c&&!c.includes("/"))return B({},r,[].concat(me(s),[{message:"Invalid mime type format. Got: ".concat(c),value:o,fixes:["file:change-extension","file:check-metadata"]}]));if(a&&c&&c.includes("/")){var u=a.split(",").map(function(p){return p.trim()}),f=u.some(function(p){if(p==="*/*")return!0;if(p.endsWith("/*")){var g=p.slice(0,-2);return c.startsWith(g)}return p===c});if(!f)return B({},r,[].concat(me(s),[{message:"Mime type mismatch. Found '".concat(c,"' but schema accepts '").concat(a,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}]))}var h=Y.filenameToMimeType(o[Ct]);return h?h!==c?B({},r,[].concat(me(s),[{message:"Mime type and file extension not matching. Mime type is '".concat(c,"' but file extension is '").concat(h,"'"),value:o,fixes:["file:change-extension","file:check-metadata"]}])):o.metadata?B({},r,[].concat(me(s),[{message:"Found metadata, but it could not be validated. File metadata must be an object with the mimeType.",value:o,fixes:["file:check-metadata"]}])):B({},r,[].concat(me(s),[{message:"Missing File metadata.",value:o,fixes:["file:add-metadata"]}])):B({},r,[].concat(me(s),[{message:"Could not determine mime type from file extension. Got: ".concat(o[Ct]),value:o,fixes:["file:change-extension","file:check-metadata"]}]))}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:se(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected object, got '".concat(se(o),"'"),typeError:!0}])}:Ct in o?Le in o&&o[Le]==="file"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Value of this schema must use: 'c.file' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:B({},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:"executeSerialize",value:function(){var r;return{type:"file",options:this.options,opt:this.opt,remote:this.isRemote,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),q$=function(t){return new G$(t)};function Y$(e){return e[Ct].startsWith("/public")?e.patch_id?{url:"/api/val/files"+e[Ct]+"?patch_id=".concat(e.patch_id),metadata:e.metadata}:{url:e[Ct].slice(7),metadata:e.metadata}:{url:e[Ct]+(e.patch_id?"?patch_id=".concat(e.patch_id):""),metadata:e.metadata}}function J$(e){return se(e)==="object"&&e!==null&&e!==void 0&&Bj in e&&"val"in e}function Vj(e){return e[Bj]}function Cl(e,t){if(se(t)==="symbol")throw Error("Cannot create val path of array item with symbol prop: ".concat(t.toString()));if(e)return e.includes(Y.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(Y.ModuleFilePathSep).concat(JSON.stringify(t))}function zr(e,t){if(se(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(Y.ModuleFilePathSep)?"".concat(e,".").concat(JSON.stringify(t)):"".concat(e).concat(Y.ModuleFilePathSep).concat(JSON.stringify(t))}var X$=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[],a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null;return $n(this,t),r=ro(this,t),r.options=n,r.opt=o,r.isRaw=s,r.customValidateFunctions=i,r.renderInput=a,r}return oo(t,e),Bn(t,[{key:"min",value:function(r){return this.minLength(r)}},{key:"minLength",value:function(r){return new t(xt(xt({},this.options),{},{minLength:r}),this.opt,this.isRaw,this.customValidateFunctions,this.renderInput)}},{key:"max",value:function(r){return this.maxLength(r)}},{key:"maxLength",value:function(r){return new t(xt(xt({},this.options),{},{maxLength:r}),this.opt,this.isRaw,this.customValidateFunctions,this.renderInput)}},{key:"regexp",value:function(r,o){return new t(xt(xt({},this.options),{},{regexp:r,regExpMessage:o}),this.opt,this.isRaw,this.customValidateFunctions,this.renderInput)}},{key:"validate",value:function(r){return new t(this.options,this.opt,this.isRaw,this.customValidateFunctions.concat(r),this.renderInput)}},{key:"executeValidate",value:function(r,o){var s,i,a,l=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});return this.opt&&o==null?l.length>0?B({},r,l):!1:typeof o!="string"?B({},r,[{message:"Expected 'string', got '".concat(se(o),"'"),value:o}]):((s=this.options)!==null&&s!==void 0&&s.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}),(i=this.options)!==null&&i!==void 0&&i.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:this.options.regExpMessage||"Expected string to match reg exp: ".concat(this.options.regexp.toString(),", got '").concat(o,"'"),value:o}),l.length>0?B({},r,l):!1)}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:typeof o=="string"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected 'string', got '".concat(se(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0,this.isRaw,this.customValidateFunctions,this.renderInput)}},{key:"raw",value:function(){return new t(this.options,this.opt,!0,this.customValidateFunctions,this.renderInput)}},{key:"executeSerialize",value:function(){var r,o,s,i,a;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:((s=this.options)===null||s===void 0?void 0:s.regexp)&&{message:this.options.regExpMessage,source:this.options.regexp.source,flags:this.options.regexp.flags},customValidate:this.customValidateFunctions&&((i=this.customValidateFunctions)===null||i===void 0?void 0:i.length)>0},opt:this.opt,raw:this.isRaw,customValidate:this.customValidateFunctions&&((a=this.customValidateFunctions)===null||a===void 0?void 0:a.length)>0}}},{key:"render",value:function(r){return new t(this.options,this.opt,this.isRaw,this.customValidateFunctions,r)}},{key:"executeRender",value:function(r,o){return this.renderInput?B({},r,{status:"success",data:{layout:this.renderInput.as}}):{}}}])}(so),Uj=function(t){return new X$(t)},Ll=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $n(this,t),r=ro(this,t),r.items=n,r.opt=o,r.customValidateFunctions=s,r}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.items,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=!1,i=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return i.length>0?B({},r,i):!1;if(o===null)return B({},r,[{message:"Expected 'object', got 'null'"}]);if(se(o)!=="object")return B({},r,[{message:"Expected 'object', got '".concat(se(o),"'")}]);if(Array.isArray(o))return B({},r,[{message:"Expected 'object', got 'array'"}]);var a=bs(i),l;try{for(a.s();!(l=a.n()).done;){var c=l.value;s=this.appendValidationError(s,r,c.message,o,c.schemaError)}}catch(x){a.e(x)}finally{a.f()}for(var u=0,f=Object.entries(this.items);u<f.length;u++){var h=Ln(f[u],2),p=h[0],g=h[1],v=Cl(r,p);if(!v)s=this.appendValidationError(s,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(p),o);else{var y=g.executeValidate(v,o[p]);y&&s?s=xt(xt({},y),s):y&&(s=y)}}return s}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(se(o)!=="object")return{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(se(o),"'"),typeError:!0}])};if(Array.isArray(o))return{success:!1,errors:B({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])};for(var s=[],i=0,a=Object.keys(this.items);i<a.length;i++){var l=a[i],c=Cl(r,l);c?l in o||s.push({message:"Expected key '".concat(l,"' not found in object"),typeError:!0}):s.push({message:"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(l),internalError:!0})}return s.length>0?{success:!1,errors:B({},r,s)}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.items,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"object",items:Object.fromEntries(Object.entries(this.items).map(function(o){var s=Ln(o,2),i=s[0],a=s[1];return[i,a.executeSerialize()]})),opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(r,o){var s={};if(o===null)return s;for(var i in this.items){var a=o[i];if(a!=null){var l=zr(r,i),c=this.items[i].executeRender(l,a);for(var u in c){var f=u;s[f]=c[f]}}}return s}}])}(so),Wj=function(t){return new Ll(t)};Wj({get test(){return Uj()}});var Hv=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $n(this,t),r=ro(this,t),B(r,"renderInput",null),r.item=n,r.opt=o,r.customValidateFunctions=s,r}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.item,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=this.executeAssert(r,o);if(!s.success)return s.errors;if(s.data===null)return!1;for(var i={},a=0,l=Object.entries(s.data);a<l.length;a++){var c=Ln(l[a],2),u=c[0],f=c[1],h=zr(r,Number(u)),p=this.item.executeValidate(h,f);p&&(i=xt(xt({},p),i))}return Object.keys(i).length===0?!1:i}},{key:"executeAssert",value:function(r,o){return o===null&&this.opt?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])}:se(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(se(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected object of type 'array'",typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.item,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"array",item:this.item.executeSerialize(),opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(r,o){var s={};if(o===null)return s;for(var i=0;i<o.length;i++){var a=i,l=o[a];if(l!=null){var c=zr(r,a),u=this.item.executeRender(c,l);for(var f in u){var h=f;s[h]=u[h]}}}if(this.renderInput){var p=this.renderInput,g=p.select,v=p.as;v!=="list"&&(s[r]={status:"error",message:"Unknown layout type: "+v});try{s[r]={status:"success",data:{layout:"list",parent:"array",items:o.map(function(y){var x=g({val:y}),b=x.title,w=x.subtitle,E=x.image;return{title:b,subtitle:w,image:E}})}}}catch(y){s[r]={status:"error",message:y instanceof Error?y.message:"Unknown error"}}}return s}},{key:"render",value:function(r){return this.renderInput=r,this}}])}(so),Z$=function(t){return new Hv(t)},il=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $n(this,t),r=ro(this,t),r.value=n,r.opt=o,r.customValidateFunctions=s,r}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.value,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});return this.opt&&o==null?s.length>0?B({},r,s):!1:typeof o!="string"?B({},r,[].concat(me(s),[{message:"Expected 'string', got '".concat(se(o),"'"),value:o}])):o!==this.value?B({},r,[].concat(me(s),[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),value:o}])):s.length>0?B({},r,s):!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o=="string"&&o===this.value?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected literal '".concat(this.value,"', got '").concat(o,"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.value,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"literal",value:this.value,opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),Q$=function(t){return new il(t)},Hj=function(e){function t(n,r){var o,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return $n(this,t),o=ro(this,t),o.key=n,o.items=r,o.opt=s,o.customValidateFunctions=i,o}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.key,this.items,this.opt,this.customValidateFunctions.concat(r))}},{key:"executeValidate",value:function(r,o){var s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r}),i=o;if(this.opt&&i===null)return s.length>0?B({},r,s):!1;if(!this.key)return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Missing required first argument in union",schemaError:!0}]));var a=this.key;if(!Array.isArray(this.items))return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"A union schema must take more than 1 schema arguments",schemaError:!0}]));if(typeof a=="string"){if(this.items.some(function(P){return!(P instanceof Ll)}))return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Key is a string, so all schema items must be objects",schemaError:!0}]));var l=this.items,c=l.map(function(P){return P.executeSerialize()}),u=c.filter(function(P){return P.type!=="object"||P.items[a].type!=="literal"});if(u.length>0)return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{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 f=c,h=f.filter(function(P){return P.items[a].opt});if(h.length>1)return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Schema cannot have an optional keys: ".concat(a),schemaError:!0}]));if(se(i)!=="object")return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Expected an object",typeError:!0}]));var p=i;if(p[a]===void 0)return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Missing required key: ".concat(a),typeError:!0}]));var g=[],v=bs(f),y;try{for(v.s();!(y=v.n()).done;){var x=y.value,b=x.items[a];if(b.type==="literal")if(!g.includes(b.value))g.push(b.value);else return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Found duplicate key in schema: ".concat(b.value),schemaError:!0}]))}}catch(P){v.e(P)}finally{v.f()}var w=l.find(function(P){return!P.items[a].executeValidate(r,p[a])});if(!w){var E=Cl(r,a);if(!E)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(a));return B({},E,[{message:'Invalid key: "'.concat(a,'". Value was: "').concat(p[a],'". Valid values: ').concat(f.map(function(P){var j=P.items[a];if(j.type==="literal"&&j.value)return'"'.concat(j.value,'"');throw new Error("Expected literal schema, got ".concat(JSON.stringify(j,null,2)))}).join(", "))}])}var C=w.executeValidate(r,p);if(C)return C}else if(a instanceof il){if(this.items.some(function(P){return!(P instanceof il)}))return B({},r,[{message:"Key is a literal schema, so all schema items must be literals",typeError:!0}]);var _=[a].concat(me(this.items));if(typeof i=="string"){var N=_.some(function(P){return!P.executeValidate(r,i)});if(!N)return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Union must match one of the following: ".concat(_.map(function(P){return'"'.concat(P.value,'"')}).join(", "))}]))}}else return s.length>0?B({},r,s):B({},r,[].concat(me(s),[{message:"Expected a string or literal"}]));return s.length>0?B({},r,s):!1}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])};if(!this.key)return{success:!1,errors:B({},r,[{message:"Missing required first argument in union schema",schemaError:!0}])};if(!Array.isArray(this.items))return{success:!1,errors:B({},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 il){var s,i=!1,a={},l=bs((s=[this.key]).concat.apply(s,me(this.items))),c;try{for(l.s();!(c=l.n()).done;){var u=c.value;if(!(u instanceof il))return{success:!1,errors:B({},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(se(o),"'"),typeError:!0}];continue}var f=u.executeAssert(r,o);if(f.success){i=!0;break}else for(var h=0,p=Object.entries(f.errors);h<p.length;h++){var g,v=Ln(p[h],2),y=v[0],x=v[1];a[y]||(a[y]=[]),(g=a[y]).push.apply(g,me(x))}}}catch(W){l.e(W)}finally{l.f()}return i?{success:!0,data:o}:{success:!1,errors:a}}else if(typeof this.key=="string"){var b=!1,w={},E=bs(this.items),C;try{for(E.s();!(C=E.n()).done;){var _=C.value,N=_.executeAssert(r,o);if(N.success){b=!0;break}else for(var P=0,j=Object.entries(N.errors);P<j.length;P++){var A,U=Ln(j[P],2),L=U[0],K=U[1];w[L]||(w[L]=[]),(A=w[L]).push.apply(A,me(K))}}}catch(W){E.e(W)}finally{E.f()}return b?{success:!0,data:o}:{success:!1,errors:w}}else return{success:!1,errors:B({},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:"executeSerialize",value:function(){var r;if(typeof this.key=="string"){var o;return{type:"union",key:this.key,items:this.items.map(function(s){return s.executeSerialize()}),opt:this.opt,customValidate:this.customValidateFunctions&&((o=this.customValidateFunctions)===null||o===void 0?void 0:o.length)>0}}return{type:"union",key:this.key.executeSerialize(),items:this.items.map(function(s){return s.executeSerialize()}),opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(r,o){var s={};if(o===null||this.key instanceof il)return s;var i=this.key;if(typeof i=="string"){var a=this.items.find(function(f){if(f instanceof Ll){var h=f.items[i];if(h instanceof il)return se(o)==="object"&&i in o&&h.value===o[i]}return!1});if(a){var l=a.executeRender(r,o);for(var c in l){var u=c;s[u]=l[u]}return s}s[r]={status:"error",message:"Could not find a matching (object) schema for the union key: ".concat(i)}}return s[r]={status:"error",message:"The schema of this value is wrong. Expected a object union schema, but union key is not a string. Got: '".concat(JSON.stringify(i,null,2),"'")},s}}])}(so),eB=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 Hj(t,r)},oS=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return $n(this,t),r=ro(this,t),r.options=n,r.opt=o,r.isRemote=s,r.customValidateFunctions=i,r}return oo(t,e),Bn(t,[{key:"remote",value:function(){return new t(this.options,this.opt,!0)}},{key:"validate",value:function(r){return new t(this.options,this.opt,this.isRemote,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return s.length>0?B({},r,s):!1;if(o==null)return B({},r,[].concat(me(s),[{message:"Non-optional image was null or undefined.",value:o}]));if(this.isRemote&&o[Le]!=="remote")return B({},r,[].concat(me(s),[{message:"Expected a remote image, but got a local image.",value:o,fixes:["image:upload-remote"]}]));if(this.isRemote&&o[Le]==="remote")return B({},r,[].concat(me(s),[{message:"Remote image was not checked.",value:o,fixes:["image:check-remote"]}]));if(!this.isRemote&&o[Le]==="remote")return B({},r,[].concat(me(s),[{message:"Expected locale image, but found remote.",value:o,fixes:["image:download-remote"]}]));if(typeof o[Ct]!="string")return B({},r,[].concat(me(s),[{message:"Image did not have a file reference string. Got: ".concat(se(o[Ct])),value:o}]));if(o[Le]!=="file")return B({},r,[].concat(me(s),[{message:"Image did not have the valid file extension type. Got: ".concat(o[Le]),value:o,fixes:["image:change-extension","image:check-metadata"]}]));var i=this.options||{},a=i.accept,l=o.metadata||{},c=l.mimeType;if(a&&c&&!c.includes("/"))return B({},r,[].concat(me(s),[{message:"Invalid mime type format. Got: '".concat(c,"'"),value:o,fixes:["image:check-metadata"]}]));if(a&&c&&c.includes("/")){var u=a.split(",").map(function(p){return p.trim()}),f=u.some(function(p){if(p==="*/*")return!0;if(p.endsWith("/*")){var g=p.slice(0,-2);return c.startsWith(g)}return p===c});if(!f)return B({},r,[].concat(me(s),[{message:"Mime type mismatch. Found '".concat(c,"' but schema accepts '").concat(a,"'"),value:o,fixes:["image:check-metadata"]}]))}var h=Y.filenameToMimeType(o[Ct]);return h?h&&c&&h!==c?B({},r,[].concat(me(s),[{message:"Mime type and file extension not matching. Mime type is '".concat(c,"' but file extension is '").concat(h,"'"),value:o,fixes:["image:check-metadata"]}])):o.metadata?o.metadata.hotspot&&(se(o.metadata.hotspot)!=="object"||typeof o.metadata.hotspot.x!="number"||typeof o.metadata.hotspot.y!="number")?B({},r,[].concat(me(s),[{message:"Hotspot must be an object with x and y as numbers.",value:o}])):B({},r,[].concat(me(s),[{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"]}])):B({},r,[].concat(me(s),[{message:"Could not validate Image metadata.",value:o,fixes:["image:add-metadata"]}])):B({},r,[].concat(me(s),[{message:"Could not determine mime type from file extension. Got: ".concat(o[Ct]),value:o,fixes:["image:check-metadata"]}]))}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'object', got 'null'",typeError:!0}])}:se(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(se(o),"'"),typeError:!0}])}:Ct in o?Le in o&&o[Le]==="file"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Value of this schema must use: 'c.image' (error type: missing_file_extension)",typeError:!0}])}:{success:!1,errors:B({},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,this.isRemote)}},{key:"executeSerialize",value:function(){var r;return{type:"image",options:this.options,opt:this.opt,remote:this.isRemote,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),tB=function(t){return new oS(t)},Kv=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $n(this,t),r=ro(this,t),r.options=n,r.opt=o,r.customValidateFunctions=s,r}return oo(t,e),Bn(t,[{key:"maxLength",value:function(r){return new t(xt(xt({},this.options),{},{maxLength:r}),this.opt)}},{key:"minLength",value:function(r){return new t(xt(xt({},this.options),{},{minLength:r}),this.opt)}},{key:"validate",value:function(r){return new t(this.options,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r}),i=this.executeAssert(r,o);if(!i.success)return s.length>0?B({},r,s):i.errors;var a=i.data;if(a===null&&this.opt)return s.length>0?B({},r,s):!1;if(a===null)return B({},r,[].concat(me(s),[{message:"Expected 'array', got 'null'",typeError:!0}]));var l={},c=this.internalValidate(r,a,l);return c?s.length>0?xt(B({},r,s),c):c:Object.keys(l).length>0?s.length>0?xt(B({},r,s),l):l:s.length>0?B({},r,s):!1}},{key:"internalValidate",value:function(r,o,s){var i=this,a=0,l=function(g,v,y){var x=function(O,F,X){y[O]||(y[O]=[]),y[O].push({message:F,typeError:X})},b=bs(v),w;try{for(b.s();!(w=b.n()).done;){var E,C,_,N,P,j,A,U,L,K,W,V=w.value,H=zr(g,v.indexOf(V));if(typeof V=="string"){a+=V.length;continue}if(se(V)!=="object")return B({},H,[{message:"Expected nodes of type 'object' or 'string', got '".concat(se(V),"'"),typeError:!0}]);if(V===null)return B({},H,[{message:"Expected nodes of type 'object' or 'string', got 'null'",typeError:!0}]);if(!("tag"in V))return B({},H,[{message:"Expected node to either have 'tag' or be of type 'string'",typeError:!0}]);if(typeof V.tag!="string")return B({},H,[{message:"Expected 'string', got '".concat(se(V.tag),"'"),typeError:!0}]);if(V.tag==="h1"&&!((E=i.options.block)!==null&&E!==void 0&&E.h1)&&x(H,"'h' block is not valid",!1),V.tag==="h2"&&!((C=i.options.block)!==null&&C!==void 0&&C.h2)&&x(H,"'h2' block is not valid",!1),V.tag==="h3"&&!((_=i.options.block)!==null&&_!==void 0&&_.h3)&&x(H,"'h3' block is not valid",!1),V.tag==="h4"&&!((N=i.options.block)!==null&&N!==void 0&&N.h4)&&x(H,"'h4' block is not valid",!1),V.tag==="h5"&&!((P=i.options.block)!==null&&P!==void 0&&P.h5)&&x(H,"'h5' block is not valid",!1),V.tag==="h6"&&!((j=i.options.block)!==null&&j!==void 0&&j.h6)&&x(H,"'h6' block is not valid",!1),V.tag==="ol"&&!((A=i.options.block)!==null&&A!==void 0&&A.ol)&&x(H,"'ol' block is not valid",!1),V.tag==="ul"&&!((U=i.options.block)!==null&&U!==void 0&&U.ul)&&x(H,"'ul' block is not valid",!1),V.tag==="li"&&!((L=i.options.block)!==null&&L!==void 0&&L.ul)&&!((K=i.options.block)!==null&&K!==void 0&&K.ol)&&x(H,"'li' tag is invalid since neither 'ul' nor 'ol' block is not valid",!1),V.tag==="a"&&!((W=i.options.inline)!==null&&W!==void 0&&W.a)&&x(H,"'a' inline is not valid",!1),V.tag==="img"){var z,R;if(!((z=i.options.inline)!==null&&z!==void 0&&z.img))x(H,"'img' inline is not valid",!1);else if((R=i.options.inline)!==null&&R!==void 0&&R.img){var $,J;if(!("src"in V))return B({},H,[{message:"Expected 'src' in 'img'",typeError:!0}]);var G=zr(H,"src"),ie=se(($=i.options.inline)===null||$===void 0?void 0:$.img)==="object"?(J=i.options.inline)===null||J===void 0?void 0:J.img.executeValidate(G,V.src):new oS({},!1,!1).executeValidate(G,V.src);if(ie)for(var Xe in ie){var He,ce=Xe;y[ce]||(y[ce]=[]),(He=y[ce]).push.apply(He,me(ie[ce]))}}}if("styles"in V&&V.tag!=="span")return B({},H,[{message:"Cannot have styles on '".concat(V.tag,"'. This is only allowed on 'span'"),typeError:!0}]);if("styles"in V){if(!Array.isArray(V.styles))return B({},H,[{message:"Expected 'array', got '".concat(se(V.styles),"'"),typeError:!0}]);for(var pe=zr(H,"styles"),Z=0;Z<V.styles.length;Z++){var Pe,De,ge,$e=V.styles[Z],je=zr(pe,Z);if(typeof $e!="string")return B({},je,[{message:"Expected 'string', got '".concat(se($e),"'"),typeError:!0}]);$e==="bold"&&!((Pe=i.options.style)!==null&&Pe!==void 0&&Pe.bold)&&x(je,"Style 'bold' is not valid",!1),$e==="italic"&&!((De=i.options.style)!==null&&De!==void 0&&De.italic)&&x(je,"Style 'italic' is not valid",!1),$e==="lineThrough"&&!((ge=i.options.style)!==null&&ge!==void 0&&ge.lineThrough)&&x(je,"Style 'lineThrough' is not valid",!1)}}if("children"in V){if(!Array.isArray(V.children))return B({},H,[{message:"Expected 'array', got '".concat(se(V.children),"'"),typeError:!0}]);for(var it=V.children,St=0;St<it.length;St++){var Jt=it[St];if(se(Jt)==="object"){var T=zr(H,"children"),S=l(T,[Jt],y);if(S)return S}else if(typeof Jt=="string"){a+=Jt.length;continue}else return B({},H,[{message:"Expected 'object' or 'string', got '".concat(se(Jt),"'"),typeError:!0}])}}}}catch(k){b.e(k)}finally{b.f()}return!1},c=l(r,o,s),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 f;c[r]||(c[r]=[]),(f=c[r]).push.apply(f,u)}return c}if(Object.keys(s).length>0){if(u.length>0){var h;s[r]||(s[r]=[]),(h=s[r]).push.apply(h,u)}return s}return u.length>0?B({},r,u):!1}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null&&!this.opt)return{success:!1,errors:B({},r,[{message:"Expected 'array', got 'null'",typeError:!0}])};if(!Array.isArray(o))return{success:!1,errors:B({},r,[{message:"Expected 'array', got '".concat(se(o),"'"),typeError:!0}])};for(var s={},i=0;i<o.length;i++)this.recursiveAssert(zr(r,i),o[i],s);return Object.keys(s).length>0?{success:!1,errors:s}:{success:!0,data:o}}},{key:"recursiveAssert",value:function(r,o,s){if(se(o)!=="object"){s[r]||(s[r]=[]),s[r].push({message:"Expected 'object', got '".concat(se(o),"'"),typeError:!0});return}if(Array.isArray(o)){s[r]||(s[r]=[]),s[r].push({message:"Expected 'object', got 'array'",typeError:!0});return}if(o===null){s[r]||(s[r]=[]),s[r].push({message:"Expected 'object', got 'null'",typeError:!0});return}if("tag"in o&&typeof o.tag!="string"){s[r]||(s[r]=[]),s[r].push({message:"Expected 'string', got '".concat(se(o.tag),"'"),typeError:!0});return}if("children"in o)if(Array.isArray(o.children))for(var i=0;i<o.children.length;i++){var a=o.children[i],l=zr(zr(r,"children"),i);if(se(a)==="object")this.recursiveAssert(l,a,s);else{if(typeof a=="string")continue;s[l]||(s[l]=[]),s[l].push({message:"Expected 'object' or 'string', got '".concat(se(a),"'"),typeError:!0})}}else{s[r]||(s[r]=[]),s[r].push({message:"Expected 'array', got '".concat(se(o.children),"'"),typeError:!0});return}if("styles"in o)if(!Array.isArray(o.styles))s[r]||(s[r]=[]),s[r].push({message:"Expected 'array', got '".concat(se(o.styles),"'"),typeError:!0});else for(var c=0;c<o.styles.length;c++){var u=o.styles[c];if(typeof u!="string"){var f=zr(r,c);s[f]||(s[f]=[]),s[f].push({message:"Expected 'string', got '".concat(se(u),"'"),typeError:!0})}}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"executeSerialize",value:function(){var r,o={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&&se(this.options.inline.img)==="object"?this.options.inline.img.executeSerialize():this.options.inline.img}};return{type:"richtext",opt:this.opt,options:o,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),nB=function(t){return new Kv(t??{})},xu=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null;return $n(this,t),r=ro(this,t),B(r,"renderInput",null),r.item=n,r.opt=o,r.customValidateFunctions=s,r.currentRouter=i,r.keySchema=a,r}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.item,this.opt,[].concat(me(this.customValidateFunctions),[r]),this.currentRouter,this.keySchema)}},{key:"executeValidate",value:function(r,o){var s=this,i=!1,a=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return a.length>0?B({},r,a):!1;if(o===null)return B({},r,[].concat(me(a),[{message:"Expected 'object', got 'null'"}]));if(se(o)!=="object")return B({},r,[].concat(me(a),[{message:"Expected 'object', got '".concat(se(o),"'")}]));if(Array.isArray(o))return B({},r,[].concat(me(a),[{message:"Expected 'object', got 'array'"}]));var l=this.getRouterValidations(r,o);if(l)return l;var c=bs(a),u;try{for(c.s();!(u=c.n()).done;){var f=u.value;i=this.appendValidationError(i,r,f.message,o,f.schemaError)}}catch(h){c.e(h)}finally{c.f()}return Object.entries(o).forEach(function(h){var p=Ln(h,2),g=p[0],v=p[1];if(s.keySchema){var y=Cl(r,g);if(!y)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," for key validation"));var x=s.keySchema.executeValidate(y,g);x&&(x[y]=x[y].map(function(E){return xt(xt({},E),{},{keyError:!0})}),i?i[y]?i[y]=[].concat(me(i[y]),me(x[y])):i[y]=x[y]:i=x)}var b=Cl(r,g);if(!b)i=s.appendValidationError(i,r,"Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," at key ").concat(v),o);else{var w=s.item.executeValidate(b,v);w&&i?i=xt(xt({},w),i):w&&(i=w)}}),i}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:se(o)!=="object"?{success:!1,errors:B({},r,[{message:"Expected 'object', got '".concat(se(o),"'"),typeError:!0}])}:Array.isArray(o)?{success:!1,errors:B({},r,[{message:"Expected 'object', got 'array'",typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(this.item,!0,this.customValidateFunctions,this.currentRouter,this.keySchema)}},{key:"router",value:function(r){return new t(this.item,this.opt,this.customValidateFunctions,r,this.keySchema)}},{key:"getRouterValidations",value:function(r,o){if(!this.currentRouter||o===null)return!1;var s=sS(r),i=Ln(s,2),a=i[0],l=i[1];if(l)return B({},r,[{message:"This field was configured as a router, but it is not defined at the root of the module",schemaError:!0}]);var c=this.currentRouter.validate(a,Object.keys(o));return c.length>0?Object.fromEntries(c.map(function(u){if(!u.error.urlPath)return[r,[{message:"Router validation error: ".concat(u.error.message," has no url path"),schemaError:!0}]];var f=Cl(r,u.error.urlPath);if(!f)throw new Error("Internal error: could not create path at ".concat(!r&&typeof r=="string"?"<empty string>":r," for router validation"));return[f,[{message:u.error.message,value:u.error.urlPath,keyError:!0}]]})):!1}},{key:"executeSerialize",value:function(){var r,o,s;return{type:"record",item:this.item.executeSerialize(),key:(r=this.keySchema)===null||r===void 0?void 0:r.executeSerialize(),opt:this.opt,router:(o=this.currentRouter)===null||o===void 0?void 0:o.getRouterId(),customValidate:this.customValidateFunctions&&((s=this.customValidateFunctions)===null||s===void 0?void 0:s.length)>0}}},{key:"executeRender",value:function(r,o){var s={};if(o===null)return s;for(var i in o){var a=o[i];if(a!=null){var l=zr(r,i),c=this.item.executeRender(l,a);for(var u in c){var f=u;s[f]=c[f]}}}if(this.renderInput){var h=this.renderInput,p=h.select,g=h.layout;g!=="list"&&(s[r]={status:"error",message:"Unknown layout type: "+g});try{s[r]={status:"success",data:{layout:"list",parent:"record",items:Object.entries(o).map(function(v){var y=Ln(v,2),x=y[0],b=y[1],w=p({key:x,val:b}),E=w.title,C=w.subtitle,_=w.image;return[x,{title:E,subtitle:C,image:_}]})}}}catch(v){s[r]={status:"error",message:v instanceof Error?v.message:"Unknown error"}}}return s}},{key:"render",value:function(r){return this.renderInput={layout:r.as,select:r.select},this}}])}(so);function rB(e,t){return t?new xu(t,!1,[],null,e):new xu(e,!1,[],null,null)}function oB(e){var t=e[H$],n=t;return n}function sS(e){var t=e.indexOf(Ra);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+Ra.length)]}function Kj(e,t){return t===""?e:"".concat(e).concat(Ra).concat(t)}function Gj(e){return e instanceof Ll||se(e)==="object"&&"type"in e&&e.type==="object"}function qj(e){return e instanceof xu||se(e)==="object"&&"type"in e&&e.type==="record"}function Yj(e){return e instanceof Hv||se(e)==="object"&&"type"in e&&e.type==="array"}function Jj(e){return e instanceof Hj||se(e)==="object"&&"type"in e&&e.type==="union"}function Xj(e){return e instanceof Kv||se(e)==="object"&&"type"in e&&e.type==="richtext"}function Zj(e){return e instanceof oS||se(e)==="object"&&"type"in e&&e.type==="image"}function sB(e,t,n){for(var r=rh(e),o=me(r),s=n,i=t,a=function(){var u=r.shift();if(u===void 0)throw Error("Unexpected undefined part");if(Yj(s)){var f;if(Number.isNaN(Number(u)))throw Error("Invalid path: array schema ".concat(JSON.stringify(s)," must have a number as path, but got ").concat(u,". Path: ").concat(e));if(se(i)!=="object"&&!Array.isArray(i))throw Error("Schema type error: expected source to be type of array, but got ".concat(se(i)));i=i[u],s=s instanceof Hv?(f=s)===null||f===void 0?void 0:f.item:s.item}else if(qj(s)){var h;if(typeof u!="string")throw Error("Invalid path: record schema ".concat(s," must have path: ").concat(u," as string"));if(se(i)!=="object"&&!Array.isArray(i))throw Error("Schema type error: expected source to be type of record, but got ".concat(se(i)));if(!i[u])throw Error("Invalid path: record source did not have key ".concat(u," from path: ").concat(e));i=i[u],s=s instanceof xu?(h=s)===null||h===void 0?void 0:h.item:s.item}else if(Gj(s)){if(se(i)!=="object")throw Error("Schema type error: expected source to be type of object, but got ".concat(se(i)));if(i!==null&&i[u]===void 0)throw Error("Invalid path: object source did not have key ".concat(u," from path: ").concat(e));i=i===null?i:i[u],s=(s instanceof Ll,s.items[u])}else{if(Zj(s))return{v:{path:o.slice(0,o.length-r.length-1).map(function(b){return JSON.stringify(b)}).join("."),schema:s,source:i}};if(Jj(s)){var p=s.key;if(typeof p!="string")return{v:{path:o.map(function(b){return Number.isNaN(Number(b))?JSON.stringify(b):b}).join("."),schema:s,source:i}};var g=i[p];if(!g)throw Error("Invalid path: union source ".concat(s," did not have required key ").concat(p," in path: ").concat(e));var v=s.items.find(function(b){var w;return(b==null||(w=b.items)===null||w===void 0||(w=w[p])===null||w===void 0?void 0:w.value)===g});if(!v)throw Error("Invalid path: union schema ".concat(s," did not have a child object with ").concat(p," of value ").concat(g," in path: ").concat(e));s=v.items[u],i=i[u]}else if(Xj(s)){if("src"in i&&"tag"in i&&i.tag==="img"&&r.length===0){var y,x;s=s instanceof Kv&&(y=s.options)!==null&&y!==void 0&&(y=y.inline)!==null&&y!==void 0&&y.img&&typeof((x=s.options)===null||x===void 0||(x=x.inline)===null||x===void 0?void 0:x.img)!="boolean"?s.options.inline.img:s}i=i[u]}else throw Error("Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(s)))}},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:s,source:i}}function iB(e,t,n){for(var r=rh(e),o=me(r),s=n,i=t,a=function(){var u=r.shift();if(u===void 0)return{v:{status:"error",message:"Unexpected undefined part"}};if(Yj(s)){var f;if(Number.isNaN(Number(u)))return{v:{status:"error",message:"Invalid path: array schema ".concat(JSON.stringify(s)," must have a number as path, but got ").concat(u,". Path: ").concat(e)}};if(i===void 0)return{v:{status:"source-undefined",path:o.slice(0,o.length-r.length-1).map(function(b){return JSON.stringify(b)}).join(".")}};if(se(i)!=="object"&&!Array.isArray(i))return{v:{status:"error",message:"Schema type error: expected source to be type of array, but got ".concat(se(i))}};i=i[u],s=s instanceof Hv?(f=s)===null||f===void 0?void 0:f.item:s.item}else if(qj(s)){var h;if(typeof u!="string")return{v:{status:"error",message:"Invalid path: record schema ".concat(s," must have path: ").concat(u," as string")}};if(i===void 0)return{v:{status:"source-undefined",path:o.slice(0,o.length-r.length-1).map(function(b){return JSON.stringify(b)}).join(".")}};if(se(i)!=="object"&&!Array.isArray(i))return{v:{status:"error",message:"Schema type error: expected source to be type of record, but got ".concat(se(i))}};if(!i[u])return{v:{status:"error",message:"Invalid path: record source did not have key ".concat(u," from path: ").concat(e)}};i=i[u],s=s instanceof xu?(h=s)===null||h===void 0?void 0:h.item:s.item}else if(Gj(s)){if(i===void 0)return{v:{status:"source-undefined",path:o.slice(0,o.length-r.length-1).map(function(b){return JSON.stringify(b)}).join(".")}};if(se(i)!=="object")return{v:{status:"error",message:"Schema type error: expected source to be type of object, but got ".concat(se(i))}};if(i!==null&&i[u]===void 0)return{v:{status:"error",message:"Invalid path: object source did not have key ".concat(u," from path: ").concat(e)}};i=i===null?i:i[u],s=(s instanceof Ll,s.items[u])}else{if(Zj(s))return{v:{status:"ok",path:o.slice(0,o.length-r.length-1).map(function(b){return JSON.stringify(b)}).join("."),schema:s,source:i}};if(Jj(s)){var p=s.key;if(typeof p!="string")return{v:{status:"ok",path:o.map(function(b){return Number.isNaN(Number(b))?JSON.stringify(b):b}).join("."),schema:s,source:i}};var g=i[p];if(!g)return{v:{status:"error",message:"Invalid path: union source ".concat(s," did not have required key ").concat(p," in path: ").concat(e)}};var v=s.items.find(function(b){var w;return(b==null||(w=b.items)===null||w===void 0||(w=w[p])===null||w===void 0?void 0:w.value)===g});if(!v)return{v:{status:"error",message:"Invalid path: union schema ".concat(s," did not have a child object with ").concat(p," of value ").concat(g," in path: ").concat(e)}};s=v.items[u],i=i[u]}else if(Xj(s)){if("src"in i&&"tag"in i&&i.tag==="img"&&r.length===0){var y,x;s=s instanceof Kv&&(y=s.options)!==null&&y!==void 0&&(y=y.inline)!==null&&y!==void 0&&y.img&&typeof((x=s.options)===null||x===void 0||(x=x.inline)===null||x===void 0?void 0:x.img)!="boolean"?s.options.inline.img:s}i=i[u]}else return{v:{status:"error",message:"Invalid path: ".concat(u," resolved to an unexpected schema ").concat(JSON.stringify(s))}}}},l;r.length>0;)if(l=a(),l)return l.v;return r.length>0?{status:"error",message:"Invalid path: ".concat(r.join(".")," is not a valid path")}:{status:"ok",path:o.map(function(c){return Number.isNaN(Number(c))?JSON.stringify(c):c}).join("."),schema:s,source:i}}function aB(e){var t=e.split("/").slice(1);return t}function rh(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 lB(e){return e.split(",")}function cB(e){var t=sS(e),n=Ln(t,2),r=n[0],o=n[1],s=rh(o).slice(0,-1);return s.length>0?Kj(r,Qj(s)):r}function Qj(e){return e.map(function(t){return Number.isInteger(Number(t))?t:JSON.stringify(t)}).join(".")}var uB=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $n(this,t),r=ro(this,t),r.options=n,r.opt=o,r.customValidateFunctions=s,r}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.options,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s,i,a=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});return this.opt&&o==null?a.length>0?B({},r,a):!1:typeof o!="number"?B({},r,[].concat(me(a),[{message:"Expected 'number', got '".concat(se(o),"'"),value:o}])):(s=this.options)!==null&&s!==void 0&&s.max&&o>this.options.max?B({},r,[].concat(me(a),[{message:"Expected 'number' less than ".concat(this.options.max),value:o}])):(i=this.options)!==null&&i!==void 0&&i.min&&o<this.options.min?B({},r,[].concat(me(a),[{message:"Expected 'number' greater than ".concat(this.options.min),value:o}])):a.length>0?B({},r,a):!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'number', got 'null'",typeError:!0}])}:typeof o=="number"?{success:!0,data:o}:{success:!1,errors:B({},r,[{message:"Expected 'number', got '".concat(se(o),"'"),typeError:!0}])}}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"max",value:function(r){return new t(xt(xt({},this.options),{},{max:r}),this.opt)}},{key:"min",value:function(r){return new t(xt(xt({},this.options),{},{min:r}),this.opt)}},{key:"executeSerialize",value:function(){var r;return{type:"number",options:this.options,opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),dB=function(t){return new uB(t)},fB=function(e){function t(){var n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return $n(this,t),n=ro(this,t),n.opt=r,n.customValidateFunctions=o,n}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){return this.opt&&o==null?!1:typeof o!="boolean"?B({},r,[{message:"Expected 'boolean', got '".concat(se(o),"'"),value:o}]):!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'boolean', got 'null'",typeError:!0}])}:typeof o!="boolean"?{success:!1,errors:B({},r,[{message:"Expected 'boolean', got '".concat(se(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"nullable",value:function(){return new t(!0)}},{key:"executeSerialize",value:function(){var r;return{type:"boolean",opt:this.opt,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),hB=function(){return new fB},pB=function(e){function t(n,r){var o,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[];return $n(this,t),o=ro(this,t),o.schema=n,o.sourcePath=r,o.opt=s,o.customValidateFunctions=i,o}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.schema,this.sourcePath,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s=this.executeCustomValidateFunctions(o,this.customValidateFunctions,{path:r});if(this.opt&&o==null)return s.length>0?B({},r,s):!1;if(!this.schema)return B({},r,[].concat(me(s),[{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 B({},r,[].concat(me(s),[{message:"Schema in keyOf must be an 'object' or 'record'. Found '".concat(i.type||"unknown","'")}]));if(i.opt&&o==null)return!1;if(i.type==="record"&&typeof o!="string")return B({},r,[].concat(me(s),[{message:"Type of value in keyof (record) must be 'string'"}]));if(i.type==="object"){var a=i.keys;if(!a.includes(o))return B({},r,[].concat(me(s),[{message:"Value of keyOf (object) must be: ".concat(a.join(", "),". Found: ").concat(o)}]))}return i.type==="record"?typeof o!="string"?B({},r,[].concat(me(s),[{message:"Value of keyOf (record) must be 'string'. Found: ".concat(se(o))}])):B({},r,[].concat(me(s),[{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}}])):s.length>0?B({},r,s):!1}},{key:"executeAssert",value:function(r,o){if(this.opt&&o===null)return{success:!0,data:o};if(o===null)return{success:!1,errors:B({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])};var s=this.schema;if(!s)return{success:!1,errors:B({},r,[{message:"Neither key nor schema was found. keyOf is missing an argument.",typeError:!0}])};var i=s;if(!(i.type==="object"||i.type==="record"))return{success:!1,errors:B({},r,[{message:"Schema of first argument must be either: 'array', 'object' or 'record'. Found '".concat(i.type||"unknown","'"),typeError:!0}])};if(i.type==="record"&&typeof o!="string")return{success:!1,errors:B({},r,[{message:"Value of keyOf (record) must be 'string', got '".concat(se(o),"'"),typeError:!0}])};if(i.type==="object"){var a=i.keys;if(!a.includes(o))return{success:!1,errors:B({},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:"executeSerialize",value:function(){var r,o=this.sourcePath;if(!o)throw new Error("Cannot serialize keyOf schema with empty selector. TIP: keyOf must be used with a Val Module of record schema.");var s=this.schema;if(!s)throw new Error("Cannot serialize keyOf schema with empty selector.");var i;switch(s.type){case"record":i="string";break;case"object":i=s.keys;break;default:throw new Error("Cannot serialize keyOf schema with selector of type '".concat(s.type||"unknown","'"))}return{type:"keyOf",path:o,schema:s,opt:this.opt,values:i,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),mB=function(t){var n=t==null?void 0:t[$j],r=void 0;if(n instanceof Ll){var o=[];try{o=Object.keys((n==null?void 0:n.items)||{})}catch{}r={type:"object",keys:o,opt:n==null?void 0:n.opt}}else n instanceof xu&&(r={type:"record",opt:n==null?void 0:n.opt});return new pB(r,Vj(t))},gB=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return $n(this,t),r=ro(this,t),r.options=n,r.opt=o,r.customValidateFunctions=s,r}return oo(t,e),Bn(t,[{key:"validate",value:function(r){return new t(this.options,this.opt,[].concat(me(this.customValidateFunctions),[r]))}},{key:"executeValidate",value:function(r,o){var s,i,a,l;if(this.opt&&o==null)return!1;if(typeof o!="string")return B({},r,[{message:"Expected 'string', got '".concat(se(o),"'"),value:o}]);if((s=this.options)!==null&&s!==void 0&&s.from&&(i=this.options)!==null&&i!==void 0&&i.to){if(this.options.from>this.options.to)return B({},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 B({},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 B({},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 B({},r,[{message:"Date is after the maximum date ".concat(this.options.to),value:o}]);return!1}},{key:"executeAssert",value:function(r,o){return this.opt&&o===null?{success:!0,data:o}:o===null?{success:!1,errors:B({},r,[{message:"Expected 'string', got 'null'",typeError:!0}])}:typeof o!="string"?{success:!1,errors:B({},r,[{message:"Expected 'string', got '".concat(se(o),"'"),typeError:!0}])}:{success:!0,data:o}}},{key:"from",value:function(r){return new t(xt(xt({},this.options),{},{from:r}),this.opt)}},{key:"to",value:function(r){return new t(xt(xt({},this.options),{},{to:r}),this.opt)}},{key:"nullable",value:function(){return new t(this.options,!0)}},{key:"executeSerialize",value:function(){var r;return{type:"date",opt:this.opt,options:this.options,customValidate:this.customValidateFunctions&&((r=this.customValidateFunctions)===null||r===void 0?void 0:r.length)>0}}},{key:"executeRender",value:function(){return{}}}])}(so),vB=function(t){return new gB(t)};function yB(){return{string:Uj,boolean:hB,array:Z$,object:Wj,number:dB,union:eB,richtext:nB,image:tB,literal:Q$,keyOf:mB,record:rB,file:q$,date:vB}}function xB(e,t){var n=t.publicProjectId,r=t.coreVersion,o=t.validationHash,s=t.fileHash,i=t.filePath,a=t.bucket;return"".concat(e,"/file/p/").concat(n,"/b/").concat(a,"/v/").concat(r,"/h/").concat(o,"/f/").concat(s,"/p/").concat(i)}var bB=/^(https?:\/\/[^/]+)\/file\/p\/([^/]+)\/b\/([^/]+)\/v\/([^/]+)\/h\/([^/]+)\/f\/([^/]+)\/p\/(.+)$/;function eM(e){var t=e.match(bB);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 HC="https://remote.val.build";function wB(e){if(e!=null&&e.patch_id){var t=eM(e[Ct]);if(t.status==="success")return{url:"/api/val/files/"+t.filePath+"?patch_id=".concat(e.patch_id,"&remote=true&ref=").concat(encodeURIComponent(e[Ct])),metadata:e.metadata};console.warn("Internal Val error: failed to split remote ref: ".concat(e[Ct],". The data format is different than what is expected. Check Val versions for mismatches."),t.error)}return{url:e[Ct],metadata:e.metadata}}var Xr=Bn(function e(t){$n(this,e),this.message=t}),SB=[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],kt=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}(kt||{});function kB(e){return new EB}var EB=function(){function e(){$n(this,e),B(this,"A",1779033703),B(this,"B",-1150833019),B(this,"C",1013904242),B(this,"D",-1521486534),B(this,"E",1359893119),B(this,"F",-1694144372),B(this,"G",528734635),B(this,"H",1541459225),B(this,"_size",0),B(this,"_sp",0),(!Up||_d>=kt.allocTotal)&&(Up=new ArrayBuffer(kt.allocTotal),_d=0),this._byte=new Uint8Array(Up,_d,kt.allocBytes),this._word=new Int32Array(Up,_d,kt.allocWords),_d+=kt.allocBytes}return Bn(e,[{key:"update",value:function(n){if(typeof n=="string")return this._utf8(n);if(n==null)throw new TypeError("Invalid type: "+se(n));var r=n.byteOffset,o=n.byteLength,s=o/kt.inputBytes|0,i=0;if(s&&!(r&3)&&!(this._size%kt.inputBytes)){for(var a=new Int32Array(n.buffer,r,s*kt.inputWords);s--;)this._int32(a,i>>2),i+=kt.inputBytes;this._size+=i}var l=n.BYTES_PER_ELEMENT;if(l!==1&&n.buffer){var c=new Uint8Array(n.buffer,r+i,o-i);return this._uint8(c)}return i===o?this:this._uint8(n,i)}},{key:"_uint8",value:function(n,r){var o=this._byte,s=this._word,i=n.length;for(r=r|0;r<i;){for(var a=this._size%kt.inputBytes,l=a;r<i&&l<kt.inputBytes;)o[l++]=n[r++];l>=kt.inputBytes&&this._int32(s),this._size+=l-a}return this}},{key:"_utf8",value:function(n){for(var r=this._byte,o=this._word,s=n.length,i=this._sp,a=0;a<s;){for(var l=this._size%kt.inputBytes,c=l;a<s&&c<kt.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):i?(u=((i&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,i=0):i=u}c>=kt.inputBytes&&(this._int32(o),o[0]=o[kt.inputWords]),this._size+=c-l}return this._sp=i,this}},{key:"_int32",value:function(n,r){var o=this.A,s=this.B,i=this.C,a=this.D,l=this.E,c=this.F,u=this.G,f=this.H,h=0;for(r=r|0;h<kt.inputWords;)rl[h++]=Io(n[r++]);for(h=kt.inputWords;h<kt.workWords;h++)rl[h]=MB(rl[h-2])+rl[h-7]+jB(rl[h-15])+rl[h-16]|0;for(h=0;h<kt.workWords;h++){var p=f+OB(l)+_B(l,c,u)+SB[h]+rl[h]|0,g=TB(o)+PB(o,s,i)|0;f=u,u=c,c=l,l=a+p|0,a=i,i=s,s=o,o=p+g|0}this.A=o+this.A|0,this.B=s+this.B|0,this.C=i+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=f+this.H|0}},{key:"digest",value:function(n){var r=this._byte,o=this._word,s=this._size%kt.inputBytes|0;for(r[s++]=128;s&3;)r[s++]=0;if(s>>=2,s>kt.highIndex){for(;s<kt.inputWords;)o[s++]=0;s=0,this._int32(o)}for(;s<kt.inputWords;)o[s++]=0;var i=this._size*8,a=(i&4294967295)>>>0,l=(i-a)/4294967296;return l&&(o[kt.highIndex]=Io(l)),a&&(o[kt.lowIndex]=Io(a)),this._int32(o),n==="hex"?this._hex():this._bin()}},{key:"_hex",value:function(){var n=this.A,r=this.B,o=this.C,s=this.D,i=this.E,a=this.F,l=this.G,c=this.H;return Ai(n)+Ai(r)+Ai(o)+Ai(s)+Ai(i)+Ai(a)+Ai(l)+Ai(c)}},{key:"_bin",value:function(){var n=this.A,r=this.B,o=this.C,s=this.D,i=this.E,a=this.F,l=this.G,c=this.H,u=this._byte,f=this._word;return f[0]=Io(n),f[1]=Io(r),f[2]=Io(o),f[3]=Io(s),f[4]=Io(i),f[5]=Io(a),f[6]=Io(l),f[7]=Io(c),u.slice(0,32)}}])}(),rl=new Int32Array(kt.workWords),Up,_d=0,Ai=function(t){return(t+4294967296).toString(16).substr(-8)},CB=function(t){return t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255},NB=function(t){return t},Io=RB()?NB:CB,_B=function(t,n,r){return r^t&(n^r)},PB=function(t,n,r){return t&n|r&(t|n)},TB=function(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)},OB=function(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)},jB=function(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3},MB=function(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10};function RB(){var e=new Uint8Array(new Uint16Array([65279]).buffer);return e[0]===254}var iS=function(t){return kB().update(t).digest("hex")},aS={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",avif:"image/avif",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"},tM=Object.fromEntries(Object.entries(aS).map(function(e){var t=Ln(e,2),n=t[0],r=t[1];return[r,n]})),AB=/^data:(.*?);base64,/;function IB(e){var t=AB.exec(e);if(t&&t[1])return t[1]}function DB(e){var t=tM[e];return t||e.split("/")[1]}function LB(e){var t=e.split(".").pop(),n=t&&aS[t];if(n)return n}function nM(e,t,n,r,o){var s="".concat((r==null?void 0:r.width)||"").concat((r==null?void 0:r.height)||"").concat(r==null?void 0:r.mimeType),i={type:t.type,opt:t.opt,options:xt({},t.options)};return e+JSON.stringify(i)+n+s+o}function FB(e,t,n,r,o,s){return iS(s.encode(nM(e,t,n,r,o))).slice(0,4)}function rM(e){return e.slice(0,12)}function zB(e){return rM(iS(new Uint8Array(e)))}function $B(e,t){var n=e.startsWith("/")?e.slice(1).split("/"):e.split("/");if(t.length===0)return{isValid:n.length===0||n.length===1&&n[0]==="",expectedPath:"/"};for(var r=0,o=0,s=!1,i=-1,a=0;a<t.length;a++){var l=t[a];l.startsWith("[[")&&l.endsWith("]]")?(s=!0,i=a,o=1/0):l.startsWith("[...")&&l.endsWith("]")?(s=!0,i=a,r++,o=1/0):l.startsWith("[[")&&l.endsWith("]")?o++:(l.startsWith("[")&&l.endsWith("]"),r++,o++)}if(n.length<r||!s&&n.length>o){var c=t.map(function(g){return g.startsWith("[[")&&g.endsWith("]]")?"[optional:".concat(g.slice(2,-2),"]"):g.startsWith("[...")&&g.endsWith("]")?"[...".concat(g.slice(4,-1),"]"):g.startsWith("[[")&&g.endsWith("]")?"[optional:".concat(g.slice(2,-1),"]"):g.startsWith("[")&&g.endsWith("]")?"[".concat(g.slice(1,-1),"]"):g}).join("/");return{isValid:!1,expectedPath:"/".concat(c)}}for(var u=s?i:t.length,f=0;f<u;f++){var h=t[f],p=n[f];if(h.startsWith("[[")&&h.endsWith("]]")){if(p!==""&&p!==void 0&&p==="")return{isValid:!1,expectedPath:"/".concat(t.join("/"))}}else if(h.startsWith("[")&&h.endsWith("]")){if(p===""||p===void 0)return{isValid:!1,expectedPath:"/".concat(t.join("/"))}}else if(h!==p)return{isValid:!1,expectedPath:"/".concat(t.join("/"))}}return{isValid:!0}}var BB={getRouterId:function(){return"next-app-router"},validate:function(t,n){var r=VB(t),o=[],s=bs(n),i;try{for(s.s();!(i=s.n()).done;){var a=i.value,l=$B(a,r);l.isValid||o.push({error:{message:'URL path "'.concat(a,'" does not match the route pattern for "').concat(t,'"'),urlPath:a,expectedPath:l.expectedPath||null}})}}catch(c){s.e(c)}finally{s.f()}return o}};function VB(e){if(!e||typeof e!="string")return[];for(var t=[/\/app\/(.+)\/page\.val\.ts$/,/\/src\/app\/(.+)\/page\.val\.ts$/,/\/app\/(.+)\/page\.tsx?$/,/\/src\/app\/(.+)\/page\.tsx?$/],n=0,r=t;n<r.length;n++){var o=r[n],s=e.match(o);if(s){var i=s[1];return i.split("/").flatMap(function(a){if(a.startsWith("(")&&a.endsWith(")")&&!a.includes("."))return[];var l=a.match(/^(\([.]+\)(\(.+\))?)(.*)$/);if(l){var c=l[3]||l[4];return c?[c]:[]}return[a]})}}return[]}var Ra="?p=",jb="https://admin.val.build",Y={VERSION:{core:function(){try{return require("../package.json").version}catch{return null}}()},convertFileSource:Y$,convertRemoteSource:wB,getSchema:WC,getValPath:Vj,getSource:oB,resolvePath:sB,safeResolvePath:iB,splitModuleFilePathAndModulePath:sS,joinModuleFilePathAndModulePath:Kj,nextAppRouter:BB,remote:{createRemoteRef:xB,getValidationBasis:nM,getValidationHash:FB,getFileHash:zB,hashToRemoteFileHash:rM,splitRemoteRef:eM},validate:function(t,n,r){var o;return t&&((o=WC(t))===null||o===void 0?void 0:o.executeValidate(n,r))},isVal:J$,isFile:K$,createValPathOfItem:Cl,getSHA256Hash:iS,initSchema:yB,getMimeType:IB,mimeTypeToFileExt:DB,filenameToMimeType:LB,EXT_TO_MIME_TYPES:aS,MIME_TYPES_TO_EXT:tM,ModuleFilePathSep:Ra,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&&UB(n)}).join("/"))},createPatchPath:function(t){return rh(t)},splitModulePath:rh,splitModuleFilePath:aB,splitJoinedSourcePaths:lB,parentOfSourcePath:cB,patchPathToModulePath:Qj,VAL_ENABLE_COOKIE_NAME:"val_enable",VAL_STATE_COOKIE:"val_state",VAL_SESSION_COOKIE:"val_session",createFilename:function(t,n,r,o){var s,i;if(!r||!t)return n;var a=o.slice(0,5),l=(s=Y.getMimeType(t))!==null&&s!==void 0?s:"unknown",c=(i=Y.mimeTypeToFileExt(l))!==null&&i!==void 0?i:"unknown";if(n){var u=n.split(".").slice(0,-1).join(".")||n,f=u.lastIndexOf("_"),h=u.slice(f+1,u.length);h===a&&(u=u.slice(0,f));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 UB(e){try{return JSON.parse(e)}catch{return e}}var Gv={},qv={};qv.byteLength=KB;qv.toByteArray=qB;qv.fromByteArray=XB;var ms=[],lo=[],WB=typeof Uint8Array<"u"?Uint8Array:Array,Ox="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var yc=0,HB=Ox.length;yc<HB;++yc)ms[yc]=Ox[yc],lo[Ox.charCodeAt(yc)]=yc;lo[45]=62;lo[95]=63;function oM(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 KB(e){var t=oM(e),n=t[0],r=t[1];return(n+r)*3/4-r}function GB(e,t,n){return(t+n)*3/4-n}function qB(e){var t,n=oM(e),r=n[0],o=n[1],s=new WB(GB(e,r,o)),i=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)t=lo[e.charCodeAt(l)]<<18|lo[e.charCodeAt(l+1)]<<12|lo[e.charCodeAt(l+2)]<<6|lo[e.charCodeAt(l+3)],s[i++]=t>>16&255,s[i++]=t>>8&255,s[i++]=t&255;return o===2&&(t=lo[e.charCodeAt(l)]<<2|lo[e.charCodeAt(l+1)]>>4,s[i++]=t&255),o===1&&(t=lo[e.charCodeAt(l)]<<10|lo[e.charCodeAt(l+1)]<<4|lo[e.charCodeAt(l+2)]>>2,s[i++]=t>>8&255,s[i++]=t&255),s}function YB(e){return ms[e>>18&63]+ms[e>>12&63]+ms[e>>6&63]+ms[e&63]}function JB(e,t,n){for(var r,o=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),o.push(YB(r));return o.join("")}function XB(e){for(var t,n=e.length,r=n%3,o=[],s=16383,i=0,a=n-r;i<a;i+=s)o.push(JB(e,i,i+s>a?a:i+s));return r===1?(t=e[n-1],o.push(ms[t>>2]+ms[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],o.push(ms[t>>10]+ms[t>>4&63]+ms[t<<2&63]+"=")),o.join("")}var lS={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */lS.read=function(e,t,n,r,o){var s,i,a=o*8-r-1,l=(1<<a)-1,c=l>>1,u=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,s=p&(1<<-u)-1,p>>=-u,u+=a;u>0;s=s*256+e[t+f],f+=h,u-=8);for(i=s&(1<<-u)-1,s>>=-u,u+=r;u>0;i=i*256+e[t+f],f+=h,u-=8);if(s===0)s=1-c;else{if(s===l)return i?NaN:(p?-1:1)*(1/0);i=i+Math.pow(2,r),s=s-c}return(p?-1:1)*i*Math.pow(2,s-r)};lS.write=function(e,t,n,r,o,s){var i,a,l,c=s*8-o-1,u=(1<<c)-1,f=u>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,g=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,i=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+f>=1?t+=h/l:t+=h*Math.pow(2,1-f),t*l>=2&&(i++,l/=2),i+f>=u?(a=0,i=u):i+f>=1?(a=(t*l-1)*Math.pow(2,o),i=i+f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),i=0));o>=8;e[n+p]=a&255,p+=g,a/=256,o-=8);for(i=i<<o|a,c+=o;c>0;e[n+p]=i&255,p+=g,i/=256,c-=8);e[n+p-g]|=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=qv,n=lS,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;var o=2147483647;e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=s(),!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 s(){try{var T=new Uint8Array(1),S={foo:function(){return 42}};return Object.setPrototypeOf(S,Uint8Array.prototype),Object.setPrototypeOf(T,S),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 i(T){if(T>o)throw new RangeError('The value "'+T+'" is invalid for option "size"');var S=new Uint8Array(T);return Object.setPrototypeOf(S,a.prototype),S}function a(T,S,k){if(typeof T=="number"){if(typeof S=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(T)}return l(T,S,k)}a.poolSize=8192;function l(T,S,k){if(typeof T=="string")return h(T,S);if(ArrayBuffer.isView(T))return g(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(it(T,ArrayBuffer)||T&&it(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(it(T,SharedArrayBuffer)||T&&it(T.buffer,SharedArrayBuffer)))return v(T,S,k);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var O=T.valueOf&&T.valueOf();if(O!=null&&O!==T)return a.from(O,S,k);var F=y(T);if(F)return F;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),S,k);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,S,k){return l(T,S,k)},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,S,k){return c(T),T<=0?i(T):S!==void 0?typeof k=="string"?i(T).fill(S,k):i(T).fill(S):i(T)}a.alloc=function(T,S,k){return u(T,S,k)};function f(T){return c(T),i(T<0?0:x(T)|0)}a.allocUnsafe=function(T){return f(T)},a.allocUnsafeSlow=function(T){return f(T)};function h(T,S){if((typeof S!="string"||S==="")&&(S="utf8"),!a.isEncoding(S))throw new TypeError("Unknown encoding: "+S);var k=w(T,S)|0,O=i(k),F=O.write(T,S);return F!==k&&(O=O.slice(0,F)),O}function p(T){for(var S=T.length<0?0:x(T.length)|0,k=i(S),O=0;O<S;O+=1)k[O]=T[O]&255;return k}function g(T){if(it(T,Uint8Array)){var S=new Uint8Array(T);return v(S.buffer,S.byteOffset,S.byteLength)}return p(T)}function v(T,S,k){if(S<0||T.byteLength<S)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<S+(k||0))throw new RangeError('"length" is outside of buffer bounds');var O;return S===void 0&&k===void 0?O=new Uint8Array(T):k===void 0?O=new Uint8Array(T,S):O=new Uint8Array(T,S,k),Object.setPrototypeOf(O,a.prototype),O}function y(T){if(a.isBuffer(T)){var S=x(T.length)|0,k=i(S);return k.length===0||T.copy(k,0,0,S),k}if(T.length!==void 0)return typeof T.length!="number"||St(T.length)?i(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 b(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==a.prototype},a.compare=function(S,k){if(it(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),it(k,Uint8Array)&&(k=a.from(k,k.offset,k.byteLength)),!a.isBuffer(S)||!a.isBuffer(k))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===k)return 0;for(var O=S.length,F=k.length,X=0,ee=Math.min(O,F);X<ee;++X)if(S[X]!==k[X]){O=S[X],F=k[X];break}return O<F?-1:F<O?1:0},a.isEncoding=function(S){switch(String(S).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(S,k){if(!Array.isArray(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return a.alloc(0);var O;if(k===void 0)for(k=0,O=0;O<S.length;++O)k+=S[O].length;var F=a.allocUnsafe(k),X=0;for(O=0;O<S.length;++O){var ee=S[O];if(it(ee,Uint8Array))X+ee.length>F.length?a.from(ee).copy(F,X):Uint8Array.prototype.set.call(F,ee,X);else if(a.isBuffer(ee))ee.copy(F,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=ee.length}return F};function w(T,S){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||it(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 k=T.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&k===0)return 0;for(var F=!1;;)switch(S){case"ascii":case"latin1":case"binary":return k;case"utf8":case"utf-8":return Pe(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k*2;case"hex":return k>>>1;case"base64":return $e(T).length;default:if(F)return O?-1:Pe(T).length;S=(""+S).toLowerCase(),F=!0}}a.byteLength=w;function E(T,S,k){var O=!1;if((S===void 0||S<0)&&(S=0),S>this.length||((k===void 0||k>this.length)&&(k=this.length),k<=0)||(k>>>=0,S>>>=0,k<=S))return"";for(T||(T="utf8");;)switch(T){case"hex":return $(this,S,k);case"utf8":case"utf-8":return W(this,S,k);case"ascii":return z(this,S,k);case"latin1":case"binary":return R(this,S,k);case"base64":return K(this,S,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J(this,S,k);default:if(O)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),O=!0}}a.prototype._isBuffer=!0;function C(T,S,k){var O=T[S];T[S]=T[k],T[k]=O}a.prototype.swap16=function(){var S=this.length;if(S%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var k=0;k<S;k+=2)C(this,k,k+1);return this},a.prototype.swap32=function(){var S=this.length;if(S%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var k=0;k<S;k+=4)C(this,k,k+3),C(this,k+1,k+2);return this},a.prototype.swap64=function(){var S=this.length;if(S%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var k=0;k<S;k+=8)C(this,k,k+7),C(this,k+1,k+6),C(this,k+2,k+5),C(this,k+3,k+4);return this},a.prototype.toString=function(){var S=this.length;return S===0?"":arguments.length===0?W(this,0,S):E.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(S){if(!a.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S?!0:a.compare(this,S)===0},a.prototype.inspect=function(){var S="",k=e.INSPECT_MAX_BYTES;return S=this.toString("hex",0,k).replace(/(.{2})/g,"$1 ").trim(),this.length>k&&(S+=" ... "),"<Buffer "+S+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(S,k,O,F,X){if(it(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),!a.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(k===void 0&&(k=0),O===void 0&&(O=S?S.length:0),F===void 0&&(F=0),X===void 0&&(X=this.length),k<0||O>S.length||F<0||X>this.length)throw new RangeError("out of range index");if(F>=X&&k>=O)return 0;if(F>=X)return-1;if(k>=O)return 1;if(k>>>=0,O>>>=0,F>>>=0,X>>>=0,this===S)return 0;for(var ee=X-F,et=O-k,pt=Math.min(ee,et),Nt=this.slice(F,X),hn=S.slice(k,O),gt=0;gt<pt;++gt)if(Nt[gt]!==hn[gt]){ee=Nt[gt],et=hn[gt];break}return ee<et?-1:et<ee?1:0};function _(T,S,k,O,F){if(T.length===0)return-1;if(typeof k=="string"?(O=k,k=0):k>2147483647?k=2147483647:k<-2147483648&&(k=-2147483648),k=+k,St(k)&&(k=F?0:T.length-1),k<0&&(k=T.length+k),k>=T.length){if(F)return-1;k=T.length-1}else if(k<0)if(F)k=0;else return-1;if(typeof S=="string"&&(S=a.from(S,O)),a.isBuffer(S))return S.length===0?-1:N(T,S,k,O,F);if(typeof S=="number")return S=S&255,typeof Uint8Array.prototype.indexOf=="function"?F?Uint8Array.prototype.indexOf.call(T,S,k):Uint8Array.prototype.lastIndexOf.call(T,S,k):N(T,[S],k,O,F);throw new TypeError("val must be string, number or Buffer")}function N(T,S,k,O,F){var X=1,ee=T.length,et=S.length;if(O!==void 0&&(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le")){if(T.length<2||S.length<2)return-1;X=2,ee/=2,et/=2,k/=2}function pt(Pi,md){return X===1?Pi[md]:Pi.readUInt16BE(md*X)}var Nt;if(F){var hn=-1;for(Nt=k;Nt<ee;Nt++)if(pt(T,Nt)===pt(S,hn===-1?0:Nt-hn)){if(hn===-1&&(hn=Nt),Nt-hn+1===et)return hn*X}else hn!==-1&&(Nt-=Nt-hn),hn=-1}else for(k+et>ee&&(k=ee-et),Nt=k;Nt>=0;Nt--){for(var gt=!0,Ro=0;Ro<et;Ro++)if(pt(T,Nt+Ro)!==pt(S,Ro)){gt=!1;break}if(gt)return Nt}return-1}a.prototype.includes=function(S,k,O){return this.indexOf(S,k,O)!==-1},a.prototype.indexOf=function(S,k,O){return _(this,S,k,O,!0)},a.prototype.lastIndexOf=function(S,k,O){return _(this,S,k,O,!1)};function P(T,S,k,O){k=Number(k)||0;var F=T.length-k;O?(O=Number(O),O>F&&(O=F)):O=F;var X=S.length;O>X/2&&(O=X/2);for(var ee=0;ee<O;++ee){var et=parseInt(S.substr(ee*2,2),16);if(St(et))return ee;T[k+ee]=et}return ee}function j(T,S,k,O){return je(Pe(S,T.length-k),T,k,O)}function A(T,S,k,O){return je(De(S),T,k,O)}function U(T,S,k,O){return je($e(S),T,k,O)}function L(T,S,k,O){return je(ge(S,T.length-k),T,k,O)}a.prototype.write=function(S,k,O,F){if(k===void 0)F="utf8",O=this.length,k=0;else if(O===void 0&&typeof k=="string")F=k,O=this.length,k=0;else if(isFinite(k))k=k>>>0,isFinite(O)?(O=O>>>0,F===void 0&&(F="utf8")):(F=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var X=this.length-k;if((O===void 0||O>X)&&(O=X),S.length>0&&(O<0||k<0)||k>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");for(var ee=!1;;)switch(F){case"hex":return P(this,S,k,O);case"utf8":case"utf-8":return j(this,S,k,O);case"ascii":case"latin1":case"binary":return A(this,S,k,O);case"base64":return U(this,S,k,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,S,k,O);default:if(ee)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),ee=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function K(T,S,k){return S===0&&k===T.length?t.fromByteArray(T):t.fromByteArray(T.slice(S,k))}function W(T,S,k){k=Math.min(T.length,k);for(var O=[],F=S;F<k;){var X=T[F],ee=null,et=X>239?4:X>223?3:X>191?2:1;if(F+et<=k){var pt,Nt,hn,gt;switch(et){case 1:X<128&&(ee=X);break;case 2:pt=T[F+1],(pt&192)===128&&(gt=(X&31)<<6|pt&63,gt>127&&(ee=gt));break;case 3:pt=T[F+1],Nt=T[F+2],(pt&192)===128&&(Nt&192)===128&&(gt=(X&15)<<12|(pt&63)<<6|Nt&63,gt>2047&&(gt<55296||gt>57343)&&(ee=gt));break;case 4:pt=T[F+1],Nt=T[F+2],hn=T[F+3],(pt&192)===128&&(Nt&192)===128&&(hn&192)===128&&(gt=(X&15)<<18|(pt&63)<<12|(Nt&63)<<6|hn&63,gt>65535&><1114112&&(ee=gt))}}ee===null?(ee=65533,et=1):ee>65535&&(ee-=65536,O.push(ee>>>10&1023|55296),ee=56320|ee&1023),O.push(ee),F+=et}return H(O)}var V=4096;function H(T){var S=T.length;if(S<=V)return String.fromCharCode.apply(String,T);for(var k="",O=0;O<S;)k+=String.fromCharCode.apply(String,T.slice(O,O+=V));return k}function z(T,S,k){var O="";k=Math.min(T.length,k);for(var F=S;F<k;++F)O+=String.fromCharCode(T[F]&127);return O}function R(T,S,k){var O="";k=Math.min(T.length,k);for(var F=S;F<k;++F)O+=String.fromCharCode(T[F]);return O}function $(T,S,k){var O=T.length;(!S||S<0)&&(S=0),(!k||k<0||k>O)&&(k=O);for(var F="",X=S;X<k;++X)F+=Jt[T[X]];return F}function J(T,S,k){for(var O=T.slice(S,k),F="",X=0;X<O.length-1;X+=2)F+=String.fromCharCode(O[X]+O[X+1]*256);return F}a.prototype.slice=function(S,k){var O=this.length;S=~~S,k=k===void 0?O:~~k,S<0?(S+=O,S<0&&(S=0)):S>O&&(S=O),k<0?(k+=O,k<0&&(k=0)):k>O&&(k=O),k<S&&(k=S);var F=this.subarray(S,k);return Object.setPrototypeOf(F,a.prototype),F};function G(T,S,k){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+S>k)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(S,k,O){S=S>>>0,k=k>>>0,O||G(S,k,this.length);for(var F=this[S],X=1,ee=0;++ee<k&&(X*=256);)F+=this[S+ee]*X;return F},a.prototype.readUintBE=a.prototype.readUIntBE=function(S,k,O){S=S>>>0,k=k>>>0,O||G(S,k,this.length);for(var F=this[S+--k],X=1;k>0&&(X*=256);)F+=this[S+--k]*X;return F},a.prototype.readUint8=a.prototype.readUInt8=function(S,k){return S=S>>>0,k||G(S,1,this.length),this[S]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(S,k){return S=S>>>0,k||G(S,2,this.length),this[S]|this[S+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(S,k){return S=S>>>0,k||G(S,2,this.length),this[S]<<8|this[S+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(S,k){return S=S>>>0,k||G(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+this[S+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(S,k){return S=S>>>0,k||G(S,4,this.length),this[S]*16777216+(this[S+1]<<16|this[S+2]<<8|this[S+3])},a.prototype.readIntLE=function(S,k,O){S=S>>>0,k=k>>>0,O||G(S,k,this.length);for(var F=this[S],X=1,ee=0;++ee<k&&(X*=256);)F+=this[S+ee]*X;return X*=128,F>=X&&(F-=Math.pow(2,8*k)),F},a.prototype.readIntBE=function(S,k,O){S=S>>>0,k=k>>>0,O||G(S,k,this.length);for(var F=k,X=1,ee=this[S+--F];F>0&&(X*=256);)ee+=this[S+--F]*X;return X*=128,ee>=X&&(ee-=Math.pow(2,8*k)),ee},a.prototype.readInt8=function(S,k){return S=S>>>0,k||G(S,1,this.length),this[S]&128?(255-this[S]+1)*-1:this[S]},a.prototype.readInt16LE=function(S,k){S=S>>>0,k||G(S,2,this.length);var O=this[S]|this[S+1]<<8;return O&32768?O|4294901760:O},a.prototype.readInt16BE=function(S,k){S=S>>>0,k||G(S,2,this.length);var O=this[S+1]|this[S]<<8;return O&32768?O|4294901760:O},a.prototype.readInt32LE=function(S,k){return S=S>>>0,k||G(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},a.prototype.readInt32BE=function(S,k){return S=S>>>0,k||G(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},a.prototype.readFloatLE=function(S,k){return S=S>>>0,k||G(S,4,this.length),n.read(this,S,!0,23,4)},a.prototype.readFloatBE=function(S,k){return S=S>>>0,k||G(S,4,this.length),n.read(this,S,!1,23,4)},a.prototype.readDoubleLE=function(S,k){return S=S>>>0,k||G(S,8,this.length),n.read(this,S,!0,52,8)},a.prototype.readDoubleBE=function(S,k){return S=S>>>0,k||G(S,8,this.length),n.read(this,S,!1,52,8)};function ie(T,S,k,O,F,X){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(S>F||S<X)throw new RangeError('"value" argument is out of bounds');if(k+O>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(S,k,O,F){if(S=+S,k=k>>>0,O=O>>>0,!F){var X=Math.pow(2,8*O)-1;ie(this,S,k,O,X,0)}var ee=1,et=0;for(this[k]=S&255;++et<O&&(ee*=256);)this[k+et]=S/ee&255;return k+O},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(S,k,O,F){if(S=+S,k=k>>>0,O=O>>>0,!F){var X=Math.pow(2,8*O)-1;ie(this,S,k,O,X,0)}var ee=O-1,et=1;for(this[k+ee]=S&255;--ee>=0&&(et*=256);)this[k+ee]=S/et&255;return k+O},a.prototype.writeUint8=a.prototype.writeUInt8=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,1,255,0),this[k]=S&255,k+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,2,65535,0),this[k]=S&255,this[k+1]=S>>>8,k+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,2,65535,0),this[k]=S>>>8,this[k+1]=S&255,k+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,4,4294967295,0),this[k+3]=S>>>24,this[k+2]=S>>>16,this[k+1]=S>>>8,this[k]=S&255,k+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,4,4294967295,0),this[k]=S>>>24,this[k+1]=S>>>16,this[k+2]=S>>>8,this[k+3]=S&255,k+4},a.prototype.writeIntLE=function(S,k,O,F){if(S=+S,k=k>>>0,!F){var X=Math.pow(2,8*O-1);ie(this,S,k,O,X-1,-X)}var ee=0,et=1,pt=0;for(this[k]=S&255;++ee<O&&(et*=256);)S<0&&pt===0&&this[k+ee-1]!==0&&(pt=1),this[k+ee]=(S/et>>0)-pt&255;return k+O},a.prototype.writeIntBE=function(S,k,O,F){if(S=+S,k=k>>>0,!F){var X=Math.pow(2,8*O-1);ie(this,S,k,O,X-1,-X)}var ee=O-1,et=1,pt=0;for(this[k+ee]=S&255;--ee>=0&&(et*=256);)S<0&&pt===0&&this[k+ee+1]!==0&&(pt=1),this[k+ee]=(S/et>>0)-pt&255;return k+O},a.prototype.writeInt8=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,1,127,-128),S<0&&(S=255+S+1),this[k]=S&255,k+1},a.prototype.writeInt16LE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,2,32767,-32768),this[k]=S&255,this[k+1]=S>>>8,k+2},a.prototype.writeInt16BE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,2,32767,-32768),this[k]=S>>>8,this[k+1]=S&255,k+2},a.prototype.writeInt32LE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,4,2147483647,-2147483648),this[k]=S&255,this[k+1]=S>>>8,this[k+2]=S>>>16,this[k+3]=S>>>24,k+4},a.prototype.writeInt32BE=function(S,k,O){return S=+S,k=k>>>0,O||ie(this,S,k,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[k]=S>>>24,this[k+1]=S>>>16,this[k+2]=S>>>8,this[k+3]=S&255,k+4};function Xe(T,S,k,O,F,X){if(k+O>T.length)throw new RangeError("Index out of range");if(k<0)throw new RangeError("Index out of range")}function He(T,S,k,O,F){return S=+S,k=k>>>0,F||Xe(T,S,k,4),n.write(T,S,k,O,23,4),k+4}a.prototype.writeFloatLE=function(S,k,O){return He(this,S,k,!0,O)},a.prototype.writeFloatBE=function(S,k,O){return He(this,S,k,!1,O)};function ce(T,S,k,O,F){return S=+S,k=k>>>0,F||Xe(T,S,k,8),n.write(T,S,k,O,52,8),k+8}a.prototype.writeDoubleLE=function(S,k,O){return ce(this,S,k,!0,O)},a.prototype.writeDoubleBE=function(S,k,O){return ce(this,S,k,!1,O)},a.prototype.copy=function(S,k,O,F){if(!a.isBuffer(S))throw new TypeError("argument should be a Buffer");if(O||(O=0),!F&&F!==0&&(F=this.length),k>=S.length&&(k=S.length),k||(k=0),F>0&&F<O&&(F=O),F===O||S.length===0||this.length===0)return 0;if(k<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),S.length-k<F-O&&(F=S.length-k+O);var X=F-O;return this===S&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(k,O,F):Uint8Array.prototype.set.call(S,this.subarray(O,F),k),X},a.prototype.fill=function(S,k,O,F){if(typeof S=="string"){if(typeof k=="string"?(F=k,k=0,O=this.length):typeof O=="string"&&(F=O,O=this.length),F!==void 0&&typeof F!="string")throw new TypeError("encoding must be a string");if(typeof F=="string"&&!a.isEncoding(F))throw new TypeError("Unknown encoding: "+F);if(S.length===1){var X=S.charCodeAt(0);(F==="utf8"&&X<128||F==="latin1")&&(S=X)}}else typeof S=="number"?S=S&255:typeof S=="boolean"&&(S=Number(S));if(k<0||this.length<k||this.length<O)throw new RangeError("Out of range index");if(O<=k)return this;k=k>>>0,O=O===void 0?this.length:O>>>0,S||(S=0);var ee;if(typeof S=="number")for(ee=k;ee<O;++ee)this[ee]=S;else{var et=a.isBuffer(S)?S:a.from(S,F),pt=et.length;if(pt===0)throw new TypeError('The value "'+S+'" is invalid for argument "value"');for(ee=0;ee<O-k;++ee)this[ee+k]=et[ee%pt]}return this};var pe=/[^+/0-9A-Za-z-_]/g;function Z(T){if(T=T.split("=")[0],T=T.trim().replace(pe,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function Pe(T,S){S=S||1/0;for(var k,O=T.length,F=null,X=[],ee=0;ee<O;++ee){if(k=T.charCodeAt(ee),k>55295&&k<57344){if(!F){if(k>56319){(S-=3)>-1&&X.push(239,191,189);continue}else if(ee+1===O){(S-=3)>-1&&X.push(239,191,189);continue}F=k;continue}if(k<56320){(S-=3)>-1&&X.push(239,191,189),F=k;continue}k=(F-55296<<10|k-56320)+65536}else F&&(S-=3)>-1&&X.push(239,191,189);if(F=null,k<128){if((S-=1)<0)break;X.push(k)}else if(k<2048){if((S-=2)<0)break;X.push(k>>6|192,k&63|128)}else if(k<65536){if((S-=3)<0)break;X.push(k>>12|224,k>>6&63|128,k&63|128)}else if(k<1114112){if((S-=4)<0)break;X.push(k>>18|240,k>>12&63|128,k>>6&63|128,k&63|128)}else throw new Error("Invalid code point")}return X}function De(T){for(var S=[],k=0;k<T.length;++k)S.push(T.charCodeAt(k)&255);return S}function ge(T,S){for(var k,O,F,X=[],ee=0;ee<T.length&&!((S-=2)<0);++ee)k=T.charCodeAt(ee),O=k>>8,F=k%256,X.push(F),X.push(O);return X}function $e(T){return t.toByteArray(Z(T))}function je(T,S,k,O){for(var F=0;F<O&&!(F+k>=S.length||F>=T.length);++F)S[F+k]=T[F];return F}function it(T,S){return T instanceof S||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===S.name}function St(T){return T!==T}var Jt=function(){for(var T="0123456789abcdef",S=new Array(256),k=0;k<16;++k)for(var O=k*16,F=0;F<16;++F)S[O+F]=T[k]+T[F];return S}()})(Gv);var at;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(at||(at={}));var KC;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(KC||(KC={}));const xe=at.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xi=e=>{switch(typeof e){case"undefined":return xe.undefined;case"string":return xe.string;case"number":return Number.isNaN(e)?xe.nan:xe.number;case"boolean":return xe.boolean;case"function":return xe.function;case"bigint":return xe.bigint;case"symbol":return xe.symbol;case"object":return Array.isArray(e)?xe.array:e===null?xe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?xe.promise:typeof Map<"u"&&e instanceof Map?xe.map:typeof Set<"u"&&e instanceof Set?xe.set:typeof Date<"u"&&e instanceof Date?xe.date:xe.object;default:return xe.unknown}},Q=at.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"]);class gi extends Error{get errors(){return this.issues}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}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof gi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,at.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}gi.create=e=>new gi(e);const Mb=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===xe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,at.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${at.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${at.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${at.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.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}"`:at.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.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==="bigint"?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 Q.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 Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,at.assertNever(e)}return{message:n}};let ZB=Mb;function QB(){return ZB}const e6=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function fe(e,t){const n=QB(),r=e6({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Mb?void 0:Mb].filter(o=>!!o)});e.common.issues.push(r)}class sr{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 Fe;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 s=await o.key,i=await o.value;r.push({key:s,value:i})}return sr.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return Fe;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const Fe=Object.freeze({status:"aborted"}),Ud=e=>({status:"dirty",value:e}),Po=e=>({status:"valid",value:e}),GC=e=>e.status==="aborted",qC=e=>e.status==="dirty",bu=e=>e.status==="valid",pg=e=>typeof Promise<"u"&&e instanceof Promise;var ke;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ke||(ke={}));class ks{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const YC=(e,t)=>{if(bu(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 gi(e.common.issues);return this._error=n,this._error}}};function Ge(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:(i,a)=>{const{message:l}=e;return i.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}class nt{get description(){return this._def.description}_getType(t){return Xi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Xi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new sr,ctx:{common:t.parent.common,data:t.data,parsedType:Xi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(pg(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){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xi(t)},o=this._parseSync({data:t,path:r.path,parent:r});return YC(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xi(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return bu(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(o=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>bu(s)?{value:s.value}:{issues:n.common.issues})}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:Xi(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(pg(o)?o:Promise.resolve(o));return YC(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!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 $l({schema:this,typeName:ze.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}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),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return li.create(this,this._def)}nullable(){return Bl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ws.create(this)}promise(){return Sg.create(this,this._def)}or(t){return vg.create([this,t],this._def)}and(t){return yg.create(this,t,this._def)}transform(t){return new $l({...Ge(this._def),schema:this,typeName:ze.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new kg({...Ge(this._def),innerType:this,defaultValue:n,typeName:ze.ZodDefault})}brand(){return new lM({typeName:ze.ZodBranded,type:this,...Ge(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Eg({...Ge(this._def),innerType:this,catchValue:n,typeName:ze.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return uS.create(this,t)}readonly(){return Cg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const t6=/^c[^\s-]{8,}$/i,n6=/^[0-9a-z]+$/,r6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,o6=/^[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,s6=/^[a-z0-9_-]{21}$/i,i6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,a6=/^[-+]?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)?)??$/,l6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,c6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jx;const u6=/^(?:(?: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])$/,d6=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,f6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,h6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,p6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,m6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sM="((\\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])))",g6=new RegExp(`^${sM}$`);function iM(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function v6(e){return new RegExp(`^${iM(e)}$`)}function y6(e){let t=`${sM}T${iM(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 x6(e,t){return!!((t==="v4"||!t)&&u6.test(e)||(t==="v6"||!t)&&f6.test(e))}function b6(e,t){if(!i6.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function w6(e,t){return!!((t==="v4"||!t)&&d6.test(e)||(t==="v6"||!t)&&h6.test(e))}class ni extends nt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==xe.string){const s=this._getOrReturnCtx(t);return fe(s,{code:Q.invalid_type,expected:xe.string,received:s.parsedType}),Fe}const r=new sr;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?fe(o,{code:Q.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&fe(o,{code:Q.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")l6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"email",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")jx||(jx=new RegExp(c6,"u")),jx.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"emoji",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")o6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"uuid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")s6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"nanoid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")t6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"cuid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")n6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"cuid2",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")r6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"ulid",code:Q.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),fe(o,{validation:"url",code:Q.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"regex",code:Q.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?y6(s).test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?g6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?v6(s).test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?a6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"duration",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?x6(t.data,s.version)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"ip",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?b6(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"jwt",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?w6(t.data,s.version)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"cidr",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?p6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"base64",code:Q.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?m6.test(t.data)||(o=this._getOrReturnCtx(t,o),fe(o,{validation:"base64url",code:Q.invalid_string,message:s.message}),r.dirty()):at.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:Q.invalid_string,...ke.errToObj(r)})}_addCheck(t){return new ni({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ke.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ke.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ke.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ke.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ke.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ke.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ke.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ke.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ke.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ke.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ke.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ke.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ke.errToObj(t)})}datetime(t){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:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...ke.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,...ke.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ke.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ke.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ke.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ke.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ke.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ke.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ke.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ke.errToObj(n)})}nonempty(t){return this.min(1,ke.errToObj(t))}trim(){return new ni({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ni({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ni({...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 isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}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}}ni.create=e=>new ni({checks:[],typeName:ze.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ge(e)});function S6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class wu extends nt{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)!==xe.number){const s=this._getOrReturnCtx(t);return fe(s,{code:Q.invalid_type,expected:xe.number,received:s.parsedType}),Fe}let r;const o=new sr;for(const s of this._def.checks)s.kind==="int"?at.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?S6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.not_finite,message:s.message}),o.dirty()):at.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ke.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ke.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ke.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ke.toString(n))}setLimit(t,n,r,o){return new wu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ke.toString(o)}]})}_addCheck(t){return new wu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ke.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ke.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ke.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.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"&&at.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)}}wu.create=e=>new wu({checks:[],typeName:ze.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ge(e)});class oh extends nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==xe.bigint)return this._getInvalidInput(t);let r;const o=new sr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),fe(r,{code:Q.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):at.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return fe(n,{code:Q.invalid_type,expected:xe.bigint,received:n.parsedType}),Fe}gte(t,n){return this.setLimit("min",t,!0,ke.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ke.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ke.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ke.toString(n))}setLimit(t,n,r,o){return new oh({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ke.toString(o)}]})}_addCheck(t){return new oh({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ke.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}}oh.create=e=>new oh({checks:[],typeName:ze.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ge(e)});class Rb extends nt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==xe.boolean){const r=this._getOrReturnCtx(t);return fe(r,{code:Q.invalid_type,expected:xe.boolean,received:r.parsedType}),Fe}return Po(t.data)}}Rb.create=e=>new Rb({typeName:ze.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ge(e)});class mg extends nt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==xe.date){const s=this._getOrReturnCtx(t);return fe(s,{code:Q.invalid_type,expected:xe.date,received:s.parsedType}),Fe}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return fe(s,{code:Q.invalid_date}),Fe}const r=new sr;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),fe(o,{code:Q.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):at.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new mg({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ke.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ke.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}}mg.create=e=>new mg({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ze.ZodDate,...Ge(e)});class JC extends nt{_parse(t){if(this._getType(t)!==xe.symbol){const r=this._getOrReturnCtx(t);return fe(r,{code:Q.invalid_type,expected:xe.symbol,received:r.parsedType}),Fe}return Po(t.data)}}JC.create=e=>new JC({typeName:ze.ZodSymbol,...Ge(e)});class Ab extends nt{_parse(t){if(this._getType(t)!==xe.undefined){const r=this._getOrReturnCtx(t);return fe(r,{code:Q.invalid_type,expected:xe.undefined,received:r.parsedType}),Fe}return Po(t.data)}}Ab.create=e=>new Ab({typeName:ze.ZodUndefined,...Ge(e)});class gg extends nt{_parse(t){if(this._getType(t)!==xe.null){const r=this._getOrReturnCtx(t);return fe(r,{code:Q.invalid_type,expected:xe.null,received:r.parsedType}),Fe}return Po(t.data)}}gg.create=e=>new gg({typeName:ze.ZodNull,...Ge(e)});class sh extends nt{constructor(){super(...arguments),this._any=!0}_parse(t){return Po(t.data)}}sh.create=e=>new sh({typeName:ze.ZodAny,...Ge(e)});class Ib extends nt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Po(t.data)}}Ib.create=e=>new Ib({typeName:ze.ZodUnknown,...Ge(e)});class Aa extends nt{_parse(t){const n=this._getOrReturnCtx(t);return fe(n,{code:Q.invalid_type,expected:xe.never,received:n.parsedType}),Fe}}Aa.create=e=>new Aa({typeName:ze.ZodNever,...Ge(e)});class XC extends nt{_parse(t){if(this._getType(t)!==xe.undefined){const r=this._getOrReturnCtx(t);return fe(r,{code:Q.invalid_type,expected:xe.void,received:r.parsedType}),Fe}return Po(t.data)}}XC.create=e=>new XC({typeName:ze.ZodVoid,...Ge(e)});class ws extends nt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==xe.array)return fe(n,{code:Q.invalid_type,expected:xe.array,received:n.parsedType}),Fe;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(fe(n,{code:i?Q.too_big:Q.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?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&&(fe(n,{code:Q.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&&(fe(n,{code:Q.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((i,a)=>o.type._parseAsync(new ks(n,i,n.path,a)))).then(i=>sr.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new ks(n,i,n.path,a)));return sr.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ws({...this._def,minLength:{value:t,message:ke.toString(n)}})}max(t,n){return new ws({...this._def,maxLength:{value:t,message:ke.toString(n)}})}length(t,n){return new ws({...this._def,exactLength:{value:t,message:ke.toString(n)}})}nonempty(t){return this.min(1,t)}}ws.create=(e,t)=>new ws({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ze.ZodArray,...Ge(t)});function jc(e){if(e instanceof en){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=li.create(jc(r))}return new en({...e._def,shape:()=>t})}else return e instanceof ws?new ws({...e._def,type:jc(e.element)}):e instanceof li?li.create(jc(e.unwrap())):e instanceof Bl?Bl.create(jc(e.unwrap())):e instanceof Fl?Fl.create(e.items.map(t=>jc(t))):e}class en extends nt{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=at.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==xe.object){const c=this._getOrReturnCtx(t);return fe(c,{code:Q.invalid_type,expected:xe.object,received:c.parsedType}),Fe}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Aa&&this._def.unknownKeys==="strip"))for(const c in o.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const u=s[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ks(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof Aa){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&&(fe(o,{code:Q.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 f=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ks(o,f,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>sr.mergeObjectSync(r,c)):sr.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ke.errToObj,new en({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i;const o=((i=(s=this._def).errorMap)==null?void 0:i.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ke.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new en({...this._def,unknownKeys:"strip"})}passthrough(){return new en({...this._def,unknownKeys:"passthrough"})}extend(t){return new en({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new en({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ze.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new en({...this._def,catchall:t})}pick(t){const n={};for(const r of at.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new en({...this._def,shape:()=>n})}omit(t){const n={};for(const r of at.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new en({...this._def,shape:()=>n})}deepPartial(){return jc(this)}partial(t){const n={};for(const r of at.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new en({...this._def,shape:()=>n})}required(t){const n={};for(const r of at.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof li;)s=s._def.innerType;n[r]=s}return new en({...this._def,shape:()=>n})}keyof(){return aM(at.objectKeys(this.shape))}}en.create=(e,t)=>new en({shape:()=>e,unknownKeys:"strip",catchall:Aa.create(),typeName:ze.ZodObject,...Ge(t)});en.strictCreate=(e,t)=>new en({shape:()=>e,unknownKeys:"strict",catchall:Aa.create(),typeName:ze.ZodObject,...Ge(t)});en.lazycreate=(e,t)=>new en({shape:e,unknownKeys:"strip",catchall:Aa.create(),typeName:ze.ZodObject,...Ge(t)});class vg extends nt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new gi(a.ctx.common.issues));return fe(n,{code:Q.invalid_union,unionErrors:i}),Fe}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];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"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new gi(l));return fe(n,{code:Q.invalid_union,unionErrors:a}),Fe}}get options(){return this._def.options}}vg.create=(e,t)=>new vg({options:e,typeName:ze.ZodUnion,...Ge(t)});const Ws=e=>e instanceof bg?Ws(e.schema):e instanceof $l?Ws(e.innerType()):e instanceof wg?[e.value]:e instanceof zl?e.options:e instanceof Lb?at.objectValues(e.enum):e instanceof kg?Ws(e._def.innerType):e instanceof Ab?[void 0]:e instanceof gg?[null]:e instanceof li?[void 0,...Ws(e.unwrap())]:e instanceof Bl?[null,...Ws(e.unwrap())]:e instanceof lM||e instanceof Cg?Ws(e.unwrap()):e instanceof Eg?Ws(e._def.innerType):[];class cS extends nt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==xe.object)return fe(n,{code:Q.invalid_type,expected:xe.object,received:n.parsedType}),Fe;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(fe(n,{code:Q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Fe)}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 s of n){const i=Ws(s.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,s)}}return new cS({typeName:ze.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Ge(r)})}}function Db(e,t){const n=Xi(e),r=Xi(t);if(e===t)return{valid:!0,data:e};if(n===xe.object&&r===xe.object){const o=at.objectKeys(t),s=at.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=Db(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===xe.array&&r===xe.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],l=Db(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===xe.date&&r===xe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class yg extends nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(GC(s)||GC(i))return Fe;const a=Db(s.value,i.value);return a.valid?((qC(s)||qC(i))&&n.dirty(),{status:n.value,value:a.data}):(fe(r,{code:Q.invalid_intersection_types}),Fe)};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(([s,i])=>o(s,i)):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}))}}yg.create=(e,t,n)=>new yg({left:e,right:t,typeName:ze.ZodIntersection,...Ge(n)});class Fl extends nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.array)return fe(r,{code:Q.invalid_type,expected:xe.array,received:r.parsedType}),Fe;if(r.data.length<this._def.items.length)return fe(r,{code:Q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Fe;!this._def.rest&&r.data.length>this._def.items.length&&(fe(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new ks(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>sr.mergeArray(n,i)):sr.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Fl({...this._def,rest:t})}}Fl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fl({items:e,typeName:ze.ZodTuple,rest:null,...Ge(t)})};class xg extends nt{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!==xe.object)return fe(r,{code:Q.invalid_type,expected:xe.object,received:r.parsedType}),Fe;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new ks(r,a,r.path,a)),value:i._parse(new ks(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?sr.mergeObjectAsync(n,o):sr.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof nt?new xg({keyType:t,valueType:n,typeName:ze.ZodRecord,...Ge(r)}):new xg({keyType:ni.create(),valueType:t,typeName:ze.ZodRecord,...Ge(n)})}}class ZC extends nt{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!==xe.map)return fe(r,{code:Q.invalid_type,expected:xe.map,received:r.parsedType}),Fe;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new ks(r,a,r.path,[c,"key"])),value:s._parse(new ks(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Fe;(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 i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Fe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}ZC.create=(e,t,n)=>new ZC({valueType:t,keyType:e,typeName:ze.ZodMap,...Ge(n)});class ih extends nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==xe.set)return fe(r,{code:Q.invalid_type,expected:xe.set,received:r.parsedType}),Fe;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(fe(r,{code:Q.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&&(fe(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Fe;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new ks(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new ih({...this._def,minSize:{value:t,message:ke.toString(n)}})}max(t,n){return new ih({...this._def,maxSize:{value:t,message:ke.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}ih.create=(e,t)=>new ih({valueType:e,minSize:null,maxSize:null,typeName:ze.ZodSet,...Ge(t)});class bg extends nt{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})}}bg.create=(e,t)=>new bg({getter:e,typeName:ze.ZodLazy,...Ge(t)});class wg extends nt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return fe(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),Fe}return{status:"valid",value:t.data}}get value(){return this._def.value}}wg.create=(e,t)=>new wg({value:e,typeName:ze.ZodLiteral,...Ge(t)});function aM(e,t){return new zl({values:e,typeName:ze.ZodEnum,...Ge(t)})}class zl extends nt{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return fe(n,{expected:at.joinValues(r),received:n.parsedType,code:Q.invalid_type}),Fe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return fe(n,{received:n.data,code:Q.invalid_enum_value,options:r}),Fe}return Po(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 zl.create(t,{...this._def,...n})}exclude(t,n=this._def){return zl.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}zl.create=aM;class Lb extends nt{_parse(t){const n=at.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==xe.string&&r.parsedType!==xe.number){const o=at.objectValues(n);return fe(r,{expected:at.joinValues(o),received:r.parsedType,code:Q.invalid_type}),Fe}if(this._cache||(this._cache=new Set(at.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=at.objectValues(n);return fe(r,{received:r.data,code:Q.invalid_enum_value,options:o}),Fe}return Po(t.data)}get enum(){return this._def.values}}Lb.create=(e,t)=>new Lb({values:e,typeName:ze.ZodNativeEnum,...Ge(t)});class Sg extends nt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==xe.promise&&n.common.async===!1)return fe(n,{code:Q.invalid_type,expected:xe.promise,received:n.parsedType}),Fe;const r=n.parsedType===xe.promise?n.data:Promise.resolve(n.data);return Po(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Sg.create=(e,t)=>new Sg({type:e,typeName:ze.ZodPromise,...Ge(t)});class $l extends nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{fe(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return Fe;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Fe:l.status==="dirty"||n.value==="dirty"?Ud(l.value):l});{if(n.value==="aborted")return Fe;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?Fe:a.status==="dirty"||n.value==="dirty"?Ud(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);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"?Fe:(a.status==="dirty"&&n.dirty(),i(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"?Fe:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!bu(i))return Fe;const a=o.transform(i.value,s);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(i=>bu(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):Fe);at.assertNever(o)}}$l.create=(e,t,n)=>new $l({schema:e,typeName:ze.ZodEffects,effect:t,...Ge(n)});$l.createWithPreprocess=(e,t,n)=>new $l({schema:t,effect:{type:"preprocess",transform:e},typeName:ze.ZodEffects,...Ge(n)});class li extends nt{_parse(t){return this._getType(t)===xe.undefined?Po(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}li.create=(e,t)=>new li({innerType:e,typeName:ze.ZodOptional,...Ge(t)});class Bl extends nt{_parse(t){return this._getType(t)===xe.null?Po(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Bl.create=(e,t)=>new Bl({innerType:e,typeName:ze.ZodNullable,...Ge(t)});class kg extends nt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===xe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}kg.create=(e,t)=>new kg({innerType:e,typeName:ze.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ge(t)});class Eg extends nt{_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 pg(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new gi(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new gi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Eg.create=(e,t)=>new Eg({innerType:e,typeName:ze.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ge(t)});class QC extends nt{_parse(t){if(this._getType(t)!==xe.nan){const r=this._getOrReturnCtx(t);return fe(r,{code:Q.invalid_type,expected:xe.nan,received:r.parsedType}),Fe}return{status:"valid",value:t.data}}}QC.create=e=>new QC({typeName:ze.ZodNaN,...Ge(e)});class lM extends nt{_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 uS extends nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Fe:s.status==="dirty"?(n.dirty(),Ud(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Fe: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 uS({in:t,out:n,typeName:ze.ZodPipeline})}}class Cg extends nt{_parse(t){const n=this._def.innerType._parse(t),r=o=>(bu(o)&&(o.value=Object.freeze(o.value)),o);return pg(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Cg.create=(e,t)=>new Cg({innerType:e,typeName:ze.ZodReadonly,...Ge(t)});function eN(e,t){const n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function k6(e,t={},n){return e?sh.create().superRefine((r,o)=>{const s=e(r);if(s instanceof Promise)return s.then(i=>{if(!i){const a=eN(t,r),l=a.fatal??n??!0;o.addIssue({code:"custom",...a,fatal:l})}});if(!s){const i=eN(t,r),a=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:a})}}):sh.create()}var ze;(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"})(ze||(ze={}));const Ii=(e,t={message:`Input not instance of ${e.name}`})=>k6(n=>n instanceof e,t),D=ni.create,vi=wu.create,We=Rb.create,qs=gg.create,Pd=sh.create,E6=Ib.create;Aa.create;const Se=ws.create,M=en.create,we=vg.create,cM=cS.create,yi=yg.create,tN=Fl.create,fs=xg.create,Rs=bg.create,I=wg.create,C6=zl.create;Sg.create;li.create;Bl.create;function dS(e){return e instanceof Error&&e.name==="ZodError"&&"issues"in e&&Array.isArray(e.issues)}var Fb=class extends Error{constructor(n,r){super(n,r);Kt(this,"name");Kt(this,"details");this.name="ZodValidationError",this.details=N6(r)}toString(){return this.message}};function N6(e){if(e){const t=e.cause;if(dS(t))return t.issues}return[]}function uM(e){return e.length!==0}function nN(e){return e.description??""}var _6=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function P6(e){if(e.length===1){let t=e[0];return typeof t=="symbol"&&(t=nN(t)),t.toString()||'""'}return e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(typeof n=="symbol"&&(n=nN(n)),n.includes('"'))return t+'["'+T6(n)+'"]';if(!_6.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function T6(e){return e.replace(/"/g,'\\"')}var O6="; ",j6=99,dM="Validation error",M6=": ",R6=", or ";function A6(e={}){const{issueSeparator:t=O6,unionSeparator:n=R6,prefixSeparator:r=M6,prefix:o=dM,includePath:s=!0,maxIssuesInMessage:i=j6}=e;return a=>{const l=a.slice(0,i).map(c=>xm({issue:c,issueSeparator:t,unionSeparator:n,includePath:s})).join(t);return I6(l,o,r)}}function xm(e){const{issue:t,issueSeparator:n,unionSeparator:r,includePath:o}=e;if(t.code===Q.invalid_union)return t.unionErrors.reduce((s,i)=>{const a=i.issues.map(l=>xm({issue:l,issueSeparator:n,unionSeparator:r,includePath:o})).join(n);return s.includes(a)||s.push(a),s},[]).join(r);if(t.code===Q.invalid_arguments)return[t.message,...t.argumentsError.issues.map(s=>xm({issue:s,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(t.code===Q.invalid_return_type)return[t.message,...t.returnTypeError.issues.map(s=>xm({issue:s,issueSeparator:n,unionSeparator:r,includePath:o}))].join(n);if(o&&uM(t.path)){if(t.path.length===1){const s=t.path[0];if(typeof s=="number")return`${t.message} at index ${s}`}return`${t.message} at "${P6(t.path)}"`}return t.message}function I6(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:dM}function rN(e,t={}){if(!dS(e))throw new TypeError(`Invalid zodError param; expected instance of ZodError. Did you mean to use the "${F6.name}" method instead?`);return fM(e,t)}function fM(e,t={}){const n=e.errors;let r;return uM(n)?r=D6(t)(n):r=e.message,new Fb(r,{cause:e})}function D6(e){return"messageBuilder"in e?e.messageBuilder:A6(e)}var L6=(e={})=>t=>dS(t)?fM(t,e):t instanceof Error?new Fb(t.message,{cause:t}):new Fb("Unknown error");function F6(e,t={}){return L6(t)(e)}function z6(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $6(e){var t=z6(e,"string");return typeof t=="symbol"?t:t+""}function vt(e,t,n){return(t=$6(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oN(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 Uo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oN(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oN(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fS(e,t){if(e){if(typeof e=="string")return zb(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)?zb(e,t):void 0}}function Yv(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=fS(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
49
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return i=l.done,l},e:function(l){a=!0,s=l},f:function(){try{i||n.return==null||n.return()}finally{if(a)throw s}}}}function B6(e,t,n){var r={},o=[],s=0,i=Yv((e==null?void 0:e.content)||[]),a;try{for(i.s();!(a=i.n()).done;){var l=a.value,c=V6([(s++).toString()],l,r,t,n);o.push(c)}}catch(u){i.e(u)}finally{i.f()}return{blocks:o,files:r}}function V6(e,t,n,r,o){if(t.type==="heading"){var s,i,a=((s=t.attrs)===null||s===void 0?void 0:s.level)||1;if(Number.isNaN(a))throw new Error("Invalid header depth");return{tag:"h".concat(a),children:((i=t.content)===null||i===void 0?void 0:i.map(function(c,u){return U6(e.concat("children",u.toString()),c,n,r,o)}))||[]}}else{if(t.type==="paragraph")return hM(e,t,n,r,o);if(t.type==="bulletList")return gM(e,t,n,r,o);if(t.type==="orderedList")return vM(e,t,n,r,o);var l=t;throw new Error("Unhandled node type: ".concat("type"in l?"exhaustiveCheck.type":"unknown"))}}function U6(e,t,n,r,o){if(t.type==="text")return pM(t);if(t.type==="hardBreak")return{tag:"br"};if(t.type==="image")return yM(e,t,n,r,o);var s=t;throw new Error("Unexpected heading child type: ".concat(JSON.stringify(s,null,2)))}function hM(e,t,n,r,o){var s;return{tag:"p",children:((s=t.content)===null||s===void 0?void 0:s.map(function(i,a){if(i.type==="text")return pM(i);if(i.type==="hardBreak")return{tag:"br"};if(i.type==="image")return yM(e.concat("children",a.toString()),i,n,r,o);var l=i;throw new Error("Unexpected paragraph child type: ".concat(JSON.stringify(l,null,2)))}))||[]}}function pM(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 s;return{tag:"a",href:((s=e.marks.find(function(a){return a.type==="link"}))===null||s===void 0?void 0:s.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 i=e.type;throw new Error("Unexpected node type: ".concat(i))}}function mM(e,t,n,r,o){var s;return{tag:"li",children:((s=t.content)===null||s===void 0?void 0:s.map(function(i,a){if(i.type==="paragraph")return hM(e.concat("children",a.toString()),i,n,r,o);if(i.type==="bulletList")return gM(e.concat("children",a.toString()),i,n,r,o);if(i.type==="orderedList")return vM(e.concat("children",a.toString()),i,n,r,o);var l=i;throw new Error("Unexpected list child type: ".concat(l))}))||[]}}function gM(e,t,n,r,o){var s;return{tag:"ul",children:((s=t.content)===null||s===void 0?void 0:s.map(function(i,a){if(i.type==="listItem")return mM(e.concat("children",a.toString()),i,n,r,o);var l=i.type;throw new Error("Unexpected bullet list child type: ".concat(l))}))||[]}}function vM(e,t,n,r,o){var s;return{tag:"ol",children:((s=t.content)===null||s===void 0?void 0:s.map(function(i,a){if(i.type==="listItem")return mM(e.concat("children",a.toString()),i,n,r,o);var l=i.type;throw new Error("Unexpected ordered list child type: ".concat(l))}))||[]}}var sN=function(t){if(t==null)return 0;if(typeof t=="number")return t;var n=parseInt(t,10);return isNaN(n)?0:n},W6=new TextEncoder;function yM(e,t,n,r,o){if(t.attrs&&t.attrs.src.startsWith("data:")){var s=Gv.Buffer.from(t.attrs.src.split(",")[1],"base64"),i=Y.getSHA256Hash(new Uint8Array(s)),a=Y.getMimeType(t.attrs.src);if(a===void 0)throw new Error("Could not detect Mime Type for image: ".concat(t.attrs.src));var l=Y.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},i),c=r!=null&&r.endsWith("/")?r:"".concat(r,"/"),u="".concat(c).concat(l),f=n[u],h=e.concat("src"),p=Y.remote.hashToRemoteFileHash(i),g=o?Y.remote.createRemoteRef(o.remoteHost,Uo(Uo({},o),{},{fileHash:p,validationHash:Y.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,W6),filePath:u.slice(1)})):u;return f?f.patchPaths.push(h):n[u]={value:t.attrs.src,filePathOrRef:g,metadata:{height:sN(t.attrs.height),width:sN(t.attrs.width),mimeType:a},patchPaths:[h]},{tag:"img",src:Uo(Uo(vt({},Ct,g),o?vt({},Le,"remote"):vt(vt({},Le,"file"),Ob,"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,y=Mx("patch_id",v),x=v.split("?")[0],b=!1;if(y)if(b=Mx("remote",v)==="true",b){var w=Mx("ref",v);w?x=decodeURIComponent(w):console.error("Remote image URL does not contain ref: "+v)}else x.startsWith("/api/val/files/public")?x=x.slice(14):console.error("Patched image URL does not start with /api/val/files: "+v);else o&&x.startsWith(o.remoteHost)?b=!0:x.startsWith("/public")?console.error("Unpatched image URL starts with /public: "+v):x="/public".concat(x);var E={tag:"img",src:Uo(Uo({},vt(b?vt({},Le,"remote"):vt(vt({},Le,"file"),Ob,"image"),Ct,x)),{},{metadata:{width:typeof t.attrs.width=="number"?t.attrs.width:0,height:typeof t.attrs.height=="number"?t.attrs.height:0,mimeType:x&&Y.filenameToMimeType(x)||""}},y?{patch_id:y}:{})};return E}else throw new Error("Invalid image node (no attrs): "+JSON.stringify(t))}function Mx(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 xM=M({type:we([I("bold"),I("strike"),I("italic")])}),H6=M({type:I("link"),attrs:M({href:D(),target:we([I("_blank"),qs()]),auto:We()})}),bM=yi(M({type:I("text"),text:D()}),M({marks:Se(we([xM,H6]))}).partial()),wM=yi(M({type:I("hardBreak")}),M({marks:Se(xM)}).partial()),SM=yi(M({type:I("image")}),M({attrs:yi(M({src:D()}),M({align:we([I("center"),I("end"),I("justify"),I("left"),I("match-parent"),I("right"),I("start"),qs()]),alt:we([D(),qs()]),height:we([D(),vi(),qs()]),width:we([D(),vi(),qs()]),rotate:we([D(),qs()]),title:we([D(),qs()]),fileName:we([D(),qs()])}).partial())}).partial()),K6=yi(M({type:I("heading")}),M({attrs:M({level:vi()}),content:Se(we([bM,SM,wM]))}).partial()),kM=Rs(function(){return yi(M({type:I("bulletList")}),M({content:Se(CM)}).partial())}),EM=Rs(function(){return yi(M({type:I("orderedList")}),M({content:Se(CM)}).partial())}),CM=Rs(function(){return yi(M({type:I("listItem")}),M({attrs:M({closed:We(),nested:We()}).partial().optional(),content:Se(we([NM,kM,EM]))}).partial())}),NM=Rs(function(){return yi(M({type:I("paragraph")}),M({content:Se(we([bM,SM,wM]))}).partial())});M({type:I("doc"),content:Se(we([NM,K6,kM,EM]))});function G6(e){if(Array.isArray(e))return zb(e)}function q6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Y6(){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 J6(e){return G6(e)||q6(e)||fS(e)||Y6()}function Wp(e){return{type:"doc",content:e.map(function(t){return X6(t)})}}function X6(e){switch(e.tag){case"h1":return xc(1,e.children);case"h2":return xc(2,e.children);case"h3":return xc(3,e.children);case"h4":return xc(4,e.children);case"h5":return xc(5,e.children);case"h6":return xc(6,e.children);case"p":return TM(e.children);case"ul":return RM(e);case"ol":return AM(e);default:{var t=e;throw Error("Unexpected child node: "+JSON.stringify(t))}}}function xc(e,t){return{type:"heading",attrs:{level:e},content:t.flatMap(_M)}}function Jv(e){return{type:"text",text:e}}function _M(e){return typeof e=="string"?[Jv(e)]:e.tag==="img"?[MM(e)]:e.tag==="br"?[OM()]:e.tag==="a"?jM(e):PM(e)}function PM(e){if(e.styles.length===0&&e.children.length===1){if(typeof e.children[0]=="string")return[Jv(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 TM(e){return{type:"paragraph",content:e.flatMap(function(t){if(typeof t=="string")return[Jv(t)];switch(t.tag){case"span":return PM(t);case"a":return jM(t);case"img":return[MM(t)];case"br":return[OM()];default:{var n=t;throw Error("Unexpected paragraph child: "+JSON.stringify(n))}}})}}function OM(){return{type:"hardBreak",marks:[]}}function jM(e){return e.children.flatMap(_M).map(function(t){return t.type!=="text"?t:Uo(Uo({},t),{},{marks:(t.marks||[]).concat({type:"link",attrs:{href:e.href,auto:!1,target:null}})})})}function MM(e){var t,n,r,o=e.src;if(!(Le in o)||o[Le]!=="file"&&o[Le]!=="remote")throw Error("Expected file source in image node");var s;return o[Le]==="remote"?s=Y.convertRemoteSource(o):s=Y.convertFileSource(o),{type:"image",attrs:{height:(t=o.metadata)===null||t===void 0?void 0:t.height,width:(n=o.metadata)===null||n===void 0?void 0:n.width,alt:(r=o.metadata)===null||r===void 0?void 0:r.alt,src:s.url}}}function RM(e){return{type:"bulletList",content:e.children.map(IM)}}function AM(e){return{type:"orderedList",content:e.children.map(IM)}}function IM(e){return{type:"listItem",content:Z6(e.children)}}function Z6(e){var t=[],n=Yv(e),r;try{for(n.s();!(r=n.n()).done;){var o=r.value,s=t[t.length-1];s||(s={type:"paragraph",content:[]},t.push(s));var i=s.content;if(typeof o=="string")i.push(Jv(o));else switch(o.tag){case"ol":{t.push(AM(o));break}case"ul":{t.push(RM(o));break}case"p":{var a=TM(o.children);s.type==="paragraph"&&a.type==="paragraph"?a.content&&i.push.apply(i,J6(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 Di=Y.VAL_SESSION_COOKIE,bc=Y.VAL_STATE_COOKIE,Td=Y.VAL_ENABLE_COOKIE_NAME;function Fr(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch{o=0}Fr=function(s,i,a,l){function c(u,f){Fr(s,u,function(h){return this._invoke(u,f,h)})}i?o?o(s,i,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[i]=a:(c("next",0),c("throw",1),c("return",2))},Fr(e,t,n,r)}function Wd(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n=typeof Symbol=="function"?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function s(p,g,v,y){var x=g&&g.prototype instanceof a?g:a,b=Object.create(x.prototype);return Fr(b,"_invoke",function(w,E,C){var _,N,P,j=0,A=C||[],U=!1,L={p:0,n:0,v:e,a:K,f:K.bind(e,4),d:function(W,V){return _=W,N=0,P=e,L.n=V,i}};function K(W,V){for(N=W,P=V,t=0;!U&&j&&!H&&t<A.length;t++){var H,z=A[t],R=L.p,$=z[2];W>3?(H=$===V)&&(P=z[(N=z[4])?5:(N=3,3)],z[4]=z[5]=e):z[0]<=R&&((H=W<2&&R<z[1])?(N=0,L.v=V,L.n=z[1]):R<$&&(H=W<3||z[0]>V||V>$)&&(z[4]=W,z[5]=V,L.n=$,N=0))}if(H||W>1)return i;throw U=!0,V}return function(W,V,H){if(j>1)throw TypeError("Generator is already running");for(U&&V===1&&K(V,H),N=V,P=H;(t=N<2?e:P)||!U;){_||(N?N<3?(N>1&&(L.n=-1),K(N,P)):L.n=P:L.v=P);try{if(j=2,_){if(N||(W="next"),t=_[W]){if(!(t=t.call(_,P)))throw TypeError("iterator result is not an object");if(!t.done)return t;P=t.value,N<2&&(N=0)}else N===1&&(t=_.return)&&t.call(_),N<2&&(P=TypeError("The iterator does not provide a '"+W+"' method"),N=1);_=e}else if((t=(U=L.n<0)?P:w.call(E,L))!==i)break}catch(z){_=e,N=1,P=z}finally{j=1}}return{value:t,done:U}}}(p,v,y),!0),b}var i={};function a(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Fr(t={},r,function(){return this}),t),f=c.prototype=a.prototype=Object.create(u);function h(p){return Object.setPrototypeOf?Object.setPrototypeOf(p,c):(p.__proto__=c,Fr(p,o,"GeneratorFunction")),p.prototype=Object.create(f),p}return l.prototype=c,Fr(f,"constructor",c),Fr(c,"constructor",l),l.displayName="GeneratorFunction",Fr(c,o,"GeneratorFunction"),Fr(f),Fr(f,o,"Generator"),Fr(f,r,function(){return this}),Fr(f,"toString",function(){return"[object Generator]"}),(Wd=function(){return{w:s,m:h}})()}function iN(e,t,n,r,o,s,i){try{var a=e[s](i),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,o)}function aN(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var s=e.apply(t,n);function i(l){iN(s,r,o,i,a,"next",l)}function a(l){iN(s,r,o,i,a,"throw",l)}i(void 0)})}}var ci=Rs(function(){return we([D(),vi(),We(),qs(),Se(ci),fs(ci)])}),DM=function(t){return M({op:I("file"),path:t,filePath:D(),value:D(),remote:We(),nestedFilePath:Se(D()).optional(),metadata:ci.optional()})},Q6=cM("op",[M({op:I("add"),path:D(),value:ci}).strict(),M({op:I("remove"),path:D()}).strict(),M({op:I("replace"),path:D(),value:ci}).strict(),M({op:I("move"),from:D(),path:D()}).strict(),M({op:I("copy"),from:D(),path:D()}).strict(),M({op:I("test"),path:D(),value:ci}).strict(),DM(D()).strict()]);Se(Q6);var eV=cM("op",[M({op:I("add"),path:Se(D()),value:ci}).strict(),M({op:I("remove"),path:Se(D()).nonempty()}).strict(),M({op:I("replace"),path:Se(D()),value:ci}).strict(),M({op:I("move"),from:Se(D()).nonempty(),path:Se(D())}).strict(),M({op:I("copy"),from:Se(D()),path:Se(D())}).strict(),M({op:I("test"),path:Se(D()),value:ci}).strict(),DM(Se(D())).strict()]),LM=Se(eV),Xt=D().refine(function(e){return!0}),tV=we([M({type:I("head"),headBaseSha:D()}),M({type:I("patch"),patchId:Xt})]);M({patch:LM,parentRef:tV});var nV=D().transform(function(e){return e}),rV=M({type:I("string"),options:M({maxLength:vi().optional(),minLength:vi().optional(),regexp:M({source:D(),flags:D()}).optional()}).optional(),opt:We(),raw:We()}),$b=M({type:I("literal"),value:D(),opt:We()}),oV=M({type:I("boolean"),opt:We()}),sV=M({type:I("number"),options:M({max:vi().optional(),min:vi().optional()}).optional(),opt:We()}),FM=Rs(function(){return M({type:I("object"),items:fs(Xv),opt:We()})}),iV=Rs(function(){return M({type:I("array"),item:Xv,opt:We()})}),aV=Rs(function(){return we([M({type:I("union"),key:$b,items:Se($b),opt:We()}),M({type:I("union"),key:D(),items:Se(FM),opt:We()})])}),lV=M({ext:we([tN([I("jpg")]),tN([I("webp")])]).optional(),directory:D().optional(),prefix:D().optional(),accept:D().optional()}),zM=M({type:I("image"),options:lV.optional(),opt:We()}),cV=M({style:M({bold:We().optional(),italic:We().optional(),lineThrough:We().optional()}).optional(),block:M({h1:We().optional(),h2:We().optional(),h3:We().optional(),h4:We().optional(),h5:We().optional(),h6:We().optional(),ul:We().optional(),ol:We().optional()}).optional(),inline:M({a:We().optional(),img:we([We(),zM]).optional()}).optional()}),uV=M({type:I("richtext"),options:cV.optional(),opt:We()}),dV=Rs(function(){return M({type:I("record"),item:Xv,opt:We()})}),fV=Rs(function(){return M({type:I("keyOf"),path:nV,schema:we([M({type:I("object"),keys:Se(D()),opt:We().optional()}),M({type:I("record"),opt:We().optional()})]).optional(),values:we([I("string"),Se(D())]),opt:We()})}),hV=M({accept:D().optional()}),pV=M({type:I("file"),options:hV.optional(),opt:We()}),mV=M({type:I("date"),opt:We()}),Xv=we([rV,$b,oV,sV,FM,iV,aV,uV,dV,fV,pV,mV,zM]),hS=M({commitSha:D(),clientCommitSha:D(),parentCommitSha:D(),branch:D(),creator:D(),createdAt:D(),commitMessage:D().nullable()}),al=D().refine(function(e){return!0}),Rx=we([M({type:I("head"),headBaseSha:D()}),M({type:I("patch"),patchId:Xt})]),lN=M({project:D().optional(),root:D().optional(),files:M({directory:D()}).optional(),gitCommit:D().optional(),gitBranch:D().optional()}),gV=we([I("image:change-extension"),I("image:add-metadata"),I("image:check-metadata"),I("image:check-remote"),I("image:upload-remote"),I("image:download-remote"),I("file:change-extension"),I("file:add-metadata"),I("file:check-metadata"),I("file:check-remote"),I("file:upload-remote"),I("file:download-remote"),I("keyof:check-keys")]),vV=M({message:D(),value:E6().optional(),fatal:We().optional(),fixes:Se(gV).optional()}),zs=M({status:I(401),json:M({message:D()})}),yV=M({status:I(404),json:M({message:D()})}),Dt=M({message:D()}),cN=we([M({patchId:Xt,message:D()}),M({parentPatchId:D(),message:D()})]),Ax=M({message:D(),path:al.optional()});we([I("val_session"),I("val_enable"),I("val_state")]);var Hp=M({value:I("true"),options:M({httpOnly:I(!1),sameSite:I("lax")})}),us=Se(D()).max(1,"At most one query param is allowed").transform(function(e){return e[0]}),Ix=us.refine(function(e){return e==="true"||e==="false"},"Value must be true or false").transform(function(e){return e==="true"}),xV={"/draft/enable":{GET:{req:{query:{redirect_to:us.optional()},cookies:vt({},Di,D().optional())},res:we([M({status:I(401),json:Dt}),M({status:I(302),redirectTo:D()}),M({status:I(400),json:M({message:D()})})])}},"/draft/disable":{GET:{req:{query:{redirect_to:us.optional()},cookies:vt({},Di,D().optional())},res:we([M({status:I(401),json:Dt}),M({status:I(302),redirectTo:D()}),M({status:I(400),json:M({message:D()})})])}},"/draft/stat":{GET:{req:{cookies:vt({},Di,D().optional())},res:we([M({status:I(401),json:Dt}),M({status:I(200),json:M({draftMode:We()})})])}},"/enable":{GET:{req:{query:{redirect_to:us.optional()},cookies:vt({},Di,D().optional())},res:we([M({status:I(401),json:Dt}),M({status:I(302),redirectTo:D(),cookies:M(vt(vt({},Td,Hp),bc,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("lax"),expires:Ii(Date)})})))}),M({status:I(302),redirectTo:D(),cookies:M(vt({},Td,Hp))}),M({status:I(400),json:M({message:D()})})])}},"/disable":{GET:{req:{query:{redirect_to:us.optional()},cookies:vt({},Di,D().optional())},res:we([M({status:I(401),json:Dt}),M({status:I(302),redirectTo:D(),cookies:M(vt({},Td,M({value:I("false")})))}),M({status:I(400),json:M({message:D()})})])}},"/authorize":{GET:{req:{query:{redirect_to:us.optional()}},res:we([M({status:I(302),redirectTo:D(),cookies:M(vt(vt({},Td,Hp),bc,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("lax"),expires:Ii(Date)})})))}),M({status:I(400),json:M({message:D()})})])}},"/callback":{GET:{req:{query:{code:us.optional(),state:us.optional()},cookies:vt({},bc,D())},res:M({status:I(302),redirectTo:D(),cookies:M(vt(vt(vt({},bc,M({value:I(null)})),Td,Hp.optional()),Di,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("strict"),path:D(),secure:I(!0),expires:Ii(Date)}).optional()}).optional()))})}},"/session":{GET:{req:{cookies:{val_session:D().optional()}},res:we([M({status:I(200),json:M({mode:we([I("local"),I("proxy")]),enabled:We()})}),M({status:we([I(400),I(401),I(403),I(404),I(500),I(501)]),json:M({message:D()})}),M({status:I(401),json:M({message:D(),details:we([D(),M({reason:D()}),M({sub:D(),exp:vi(),token:D(),org:D(),project:D()})])})}),M({status:I(500),json:M({message:D()})})])}},"/logout":{GET:{req:{query:{redirect_to:us.optional()}},res:we([M({status:I(200),cookies:M(vt(vt({},Di,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("strict"),path:D(),secure:I(!0),expires:Ii(Date)}).optional()}).optional()),bc,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("strict"),path:D(),secure:I(!0),expires:Ii(Date)}).optional()}).optional()))}),M({status:I(302),redirectTo:D(),cookies:M(vt(vt({},Di,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("strict"),path:D(),secure:I(!0),expires:Ii(Date)}).optional()}).optional()),bc,M({value:D(),options:M({httpOnly:I(!0),sameSite:I("strict"),path:D(),secure:I(!0),expires:Ii(Date)}).optional()}).optional()))})])}},"/remote/settings":{GET:{req:{cookies:{val_session:D().optional()}},res:we([M({status:I(200),json:M({publicProjectId:D(),coreVersion:D(),remoteFileBuckets:Se(M({bucket:D()}))})}),M({status:I(400),json:M({errorCode:we([I("project-not-configured"),I("error-could-not-get-settings"),I("project-not-configured"),I("pat-error"),I("api-key-missing")]),message:D()})}),M({status:I(401),json:M({errorCode:I("unauthorized").optional(),message:D()})}),M({status:I(500),json:M({message:D()})})])}},"/stat":{POST:{req:{body:M({sourcesSha:D(),schemaSha:D(),baseSha:D(),patches:Se(D()).optional()}).nullable(),cookies:{val_session:D().optional()}},res:we([M({status:I(401),json:Dt}),M({status:I(500),json:Dt}),M({status:I(503),json:Dt}),M({status:I(200),json:we([M({type:we([I("request-again"),I("no-change"),I("did-change")]),baseSha:D(),schemaSha:D(),sourcesSha:D(),patches:Se(Xt),config:lN,profileId:D().nullable(),mode:we([I("http"),I("fs")])}),M({type:I("use-websocket"),url:D(),nonce:D(),baseSha:D(),schemaSha:D(),sourcesSha:D(),commitSha:D(),patches:Se(Xt),commits:Se(hS),config:lN,profileId:D().nullable(),mode:we([I("http"),I("fs")])})])})])}},"/upload/patches":{POST:{req:{path:D().optional(),body:M({parentRef:Rx,filePath:D(),data:Pd(),type:we([I("file"),I("image")]),metadata:Pd(),remote:We()})},res:we([M({status:I(400),json:Dt}),M({status:I(200),json:M({filePath:D(),patchId:Xt})})])}},"/direct-file-upload-settings":{POST:{req:{cookies:{val_session:D().optional()}},res:we([M({status:I(400),json:Dt}),M({status:I(401),json:Dt}),M({status:I(500),json:Dt}),M({status:I(200),json:M({nonce:D().nullable(),baseUrl:D()})})])}},"/patches":{DELETE:{req:{query:{id:Se(Xt).min(1,"At least one patch id is required")},cookies:{val_session:D().optional()}},res:we([zs,M({status:I(500),json:M({message:D(),errors:Se(cN)})}),M({status:I(200),json:Se(Xt)})])},PUT:{req:{body:M({parentRef:Rx,patches:Se(M({path:al,patchId:Xt,patch:Pd()}))}),cookies:{val_session:D().optional()}},res:we([zs,M({status:I(409),json:M({type:I("patch-head-conflict"),message:D()})}),M({status:I(400),json:M({type:I("patch-error"),message:D(),errors:fs(al,Se(M({error:Dt})))})}),M({status:I(200),json:M({newPatchIds:Se(Xt),parentRef:Rx})})])},GET:{req:{query:{patch_id:Se(Xt).optional(),exclude_patch_ops:Ix.optional()},cookies:{val_session:D().optional()}},res:we([zs,M({status:I(500),json:M({message:D(),patchErrors:Se(cN)})}),M({status:I(500),json:M({message:D(),error:Dt})}),M({status:I(200),json:M({patches:Se(M({path:al,patch:LM.optional(),patchId:Xt,createdAt:D(),authorId:D().nullable(),appliedAt:M({commitSha:D()}).nullable()})),baseSha:D(),error:Dt.optional(),errors:fs(Xt,Dt).optional()})})])}},"/schema":{GET:{req:{cookies:{val_session:D().optional()}},res:we([zs,M({status:I(500),json:M({message:D(),details:Se(Ax)})}),M({status:I(500),json:M({message:D(),details:Se(Dt)})}),M({status:I(200),json:M({schemaSha:D(),schemas:fs(al,Xv)})})])}},"/sources/~":{PUT:{req:{path:D().optional(),query:{validate_sources:Ix.optional(),validate_binary_files:Ix.optional()},cookies:{val_session:D().optional()}},res:we([zs,M({status:I(401),json:Dt}),M({status:I(500),json:M({message:D(),details:we([Se(Ax),Dt])})}),M({status:I(409),json:M({message:D()})}),M({status:I(400),json:M({message:D(),details:Se(Ax)})}),M({status:I(200),json:M({schemaSha:D(),sourcesSha:D(),modules:fs(al,M({render:Pd(),source:Pd(),patches:M({applied:Se(Xt),skipped:Se(Xt).optional(),errors:fs(Xt,Dt).optional()}).optional(),validationErrors:fs(D(),Se(vV)).optional()}))})})])}},"/profiles":{GET:{req:{cookies:{val_session:D().optional()}},res:we([zs,M({status:I(200),json:M({profiles:Se(M({profileId:D(),fullName:D(),email:D().optional(),avatar:M({url:D()}).nullable()}))})})])}},"/commit-summary":{GET:{req:{query:{patch_id:Se(Xt)},cookies:{val_session:D().optional()}},res:we([zs,M({status:I(400),json:M({message:D()})}),M({status:I(200),json:M({patchIds:Se(Xt),baseSha:D(),commitSummary:D().nullable()})})])}},"/save":{POST:{req:{body:M({message:D().optional(),patchIds:Se(Xt)}),cookies:{val_session:D().optional()}},res:we([zs,M({status:I(200),json:M({})}),M({status:I(409),json:M({message:D(),isNotFastForward:I(!0)})}),M({status:I(400),json:we([M({message:D(),details:we([M({sourceFilePatchErrors:fs(al,Se(Dt)),binaryFilePatchErrors:fs(Dt)}),Se(Dt)]).optional()}),M({message:D(),errorCode:we([I("project-not-configured"),I("pat-error")])})])})])}},"/files":{GET:{req:{path:D(),query:{patch_id:Se(Xt).max(1,"At most one patch id is allowed").transform(function(e){return e[0]}).optional(),remote:us.optional()}},res:we([zs,yV,M({status:I(200),body:Ii(ReadableStream)})])}}},$M=function(t,n){var r=xV;return function(){var o=aN(Wd().m(function s(i,a,l){var c,u,f,h,p,g,v,y,x,b,w,E,C,_,N,P,j,A,U;return Wd().w(function(L){for(;;)switch(L.p=L.n){case 0:if(f=l,h=i,f!=null&&f.path&&f.path.length>0&&(h+=f.path),f.query){for(p=[],g=0,v=Object.keys(f.query);g<v.length;g++)if(x=v[g],Array.isArray((y=f.query)===null||y===void 0?void 0:y[x])){w=Yv(((b=f.query)===null||b===void 0?void 0:b[x])||[]);try{for(w.s();!(E=w.n()).done;)C=E.value,C!==void 0&&p.push([x,C.toString()])}catch(K){w.e(K)}finally{w.f()}}else((_=f.query)===null||_===void 0?void 0:_[x])!==void 0&&p.push([x,f==null||(N=f.query)===null||N===void 0?void 0:N[x].toString()]);f!=null&&f.query&&p.length>0&&(h+="?".concat(new URLSearchParams(p).toString()))}if(P=r==null||(c=r[i])===null||c===void 0?void 0:c[a],P){L.n=1;break}return L.a(2,{status:null,json:{message:"Invalid route ".concat(i," with method ").concat(a,". This is most likely a Val bug."),type:"client_side_validation_error",details:{validationError:"Route ".concat(i," with method ").concat(a," not found."),data:{routes:Object.keys(r||{}),methods:Object.keys((r==null?void 0:r[i])||{}),route:i,method:a}}}});case 1:if(j=(u=P.req.body)===null||u===void 0?void 0:u.safeParse(f.body),!(j&&!j.success)){L.n=2;break}return console.error("Got an invalid request body while validating client-side. This is most likely a Val bug.",{path:i,method:a,body:f.body,error:j.error}),L.a(2,{status:null,json:{message:"There was an issue validating your data. This is most likely a Val bug.",type:"client_side_validation_error",details:{validationError:rN(j.error).toString(),data:f.body}}});case 2:return L.p=2,L.n=3,fetch("".concat(t).concat(h),{method:a,headers:{"Content-Type":"application/json"},body:f.body!==void 0?JSON.stringify(f.body):void 0}).then(function(){var K=aN(Wd().m(function W(V){var H,z,R,$,J;return Wd().w(function(G){for(;;)switch(G.n){case 0:if(z=V.headers.get("content-type"),V.status!==413){G.n=1;break}return G.a(2,{status:413,json:{message:"Request too large.",method:a,path:i}});case 1:if(z!=null&&z.includes("application/json")){G.n=2;break}return G.a(2,{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(V.status),details:{validationError:"Invalid content type",data:{status:V.status,contentType:z}}}});case 2:return G.n=3,V.json();case 3:if(R=G.v,$={status:V.status,json:R},V.status!==500){G.n=4;break}return console.error("Server responded with an error",R),G.a(2,{status:500,json:Uo({type:"unknown",message:R.message},R)});case 4:if(J=(H=P.res)===null||H===void 0?void 0:H.safeParse($),!(J&&!J.success)){G.n=5;break}return G.a(2,{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:rN(J.error).toString(),data:$}}});case 5:return G.a(2,{status:V.status,json:R})}},W)}));return function(W){return K.apply(this,arguments)}}());case 3:return A=L.v,L.a(2,A);case 4:return L.p=4,U=L.v,L.a(2,{status:null,json:{message:"Failed to fetch data",type:"network_error",retryable:bV(U),details:U instanceof Error?U.message:JSON.stringify(U)}})}},s,null,[[2,4]])}));return function(s,i,a){return o.apply(this,arguments)}}()};function bV(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 wV(e){if(Array.isArray(e))return e}function SV(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,i,a=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.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&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function kV(){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 EV(e,t){return wV(e)||SV(e,t)||fS(e,t)||kV()}var Su=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(s){var i=EV(s,2),a=i[0],l=i[1];return l?[[a,l.toString()]]:[]}),o=new URLSearchParams(r);return"".concat(t+"?"+o.toString())}return"".concat(t)},BM="val-config",CV=M({contentHostUrl:D().optional(),appHostUrl:D().optional(),project:D().optional(),root:D().optional(),files:M({directory:I("/public/val")}).optional(),gitCommit:D().optional(),gitBranch:D().optional(),defaultTheme:C6(["dark","light"]).optional(),ai:M({commitMessages:M({disabled:We().optional()}).optional()}).optional()}),VM=M({deploymentId:D(),deploymentState:D(),commitSha:D(),updatedAt:D(),createdAt:D()});function NV(e,t){var n={type:"node",name:"/",children:[]},r=Yv(t),o;try{var s=function(){var l=o.value,c=l.urlPath,u=l.moduleFilePath,f=u;if(!c.startsWith("/"))return console.error("urlPath must start with /: ".concat(c)),0;var h=Bb(f,e);if(c==="/"){var p="/";return n.pattern=Bb(f,e),n.page={fullPath:p},n.sourcePath=Y.joinModuleFilePathAndModulePath(f,p),n.moduleFilePath=f,0}var g=c.split("/").slice(1).filter(Boolean),v=n;g.forEach(function(y,x){var b=x<g.length-1,w=x===g.length-1,E="/"+g.slice(0,x+1).join("/"),C=Y.joinModuleFilePathAndModulePath(f,'"'.concat(E,'"')),_=b?Uo(Uo({type:"node",name:y,pattern:h,moduleFilePath:f},w?{page:{fullPath:E},sourcePath:C}:{}),{},{children:[]}):{type:"leaf",name:y,pattern:h,fullPath:E,moduleFilePath:f,sourcePath:C,children:[]},N=v.children.findIndex(function(A){return A.name===y});if(N===-1)v.children.push(_),v.type==="node"&&(v.isLinear=!0,v.children.length>1&&delete v.isLinear),v=_;else{var P=v.children[N];if(P.type==="leaf"&&b){var j=P.sourcePath;v.children[N]={type:"node",name:y,pattern:h,page:{fullPath:E},sourcePath:j,children:P.children,moduleFilePath:f},v=v.children[N]}else P.type==="node"&&w?(P.page={fullPath:E},P.sourcePath=C,P.moduleFilePath=f,P.pattern=h):v=v.children[N]}})},i;for(r.s();!(o=r.n()).done;)i=s()}catch(a){r.e(a)}finally{r.f()}return n}function Bb(e,t){return e.replace(t,"").replace(/\/\([^/]+\)/g,"").replace("/page.val.ts","").replace("/page.val.js","")}function UM(e){if(e===""||e==="/")return[];var t=e.startsWith("/")?e.slice(1):e;return t.split("/").map(function(n){var r=n.startsWith("[[")&&n.endsWith("]]"),o=n.startsWith("[")&&n.endsWith("]"),s=r?2:o?1:0,i=n.indexOf("]",s),a=n.slice(s,s+3)==="...",l=n.slice(s+(a?3:0),i);return r||o?a?{type:"array-param",paramName:l,optional:r}:{type:"string-param",paramName:l,optional:r}:{type:"literal",name:n}})}function _V(e){return e.startsWith("/app")?"/app":e.startsWith("/src/app")?"/src/app":null}function da(e){return Array.isArray(e)}function ku(e){"@babel/helpers - typeof";return ku=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},ku(e)}function kn(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 Re(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Ye(e){Re(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||ku(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 nr(e,t){Re(2,arguments);var n=Ye(e),r=kn(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Xo(e,t){Re(2,arguments);var n=Ye(e),r=kn(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+r+1,0);var i=s.getDate();return o>=i?s:(n.setFullYear(s.getFullYear(),s.getMonth(),o),n)}function PV(e,t){Re(2,arguments);var n=Ye(e).getTime(),r=kn(t);return new Date(n+r)}var TV={};function Ya(){return TV}function Es(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ya(),f=kn((n=(r=(o=(s=t==null?void 0:t.weekStartsOn)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=Ye(e),p=h.getDay(),g=(p<f?7:0)+p-f;return h.setDate(h.getDate()-g),h.setHours(0,0,0,0),h}function Vl(e){return Re(1,arguments),Es(e,{weekStartsOn:1})}function OV(e){Re(1,arguments);var t=Ye(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=Vl(r),s=new Date(0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);var i=Vl(s);return t.getTime()>=o.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function jV(e){Re(1,arguments);var t=OV(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);var r=Vl(n);return r}function ah(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 Eu(e){Re(1,arguments);var t=Ye(e);return t.setHours(0,0,0,0),t}var MV=864e5;function ri(e,t){Re(2,arguments);var n=Eu(e),r=Eu(t),o=n.getTime()-ah(n),s=r.getTime()-ah(r);return Math.round((o-s)/MV)}function Vb(e,t){Re(2,arguments);var n=kn(t),r=n*7;return nr(e,r)}function RV(e,t){Re(2,arguments);var n=kn(t);return Xo(e,n*12)}function AV(e){Re(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(ku(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=Ye(r);(n===void 0||n<o||isNaN(Number(o)))&&(n=o)}),n||new Date(NaN)}function IV(e){Re(1,arguments);var t;if(e&&typeof e.forEach=="function")t=e;else if(ku(e)==="object"&&e!==null)t=Array.prototype.slice.call(e);else return new Date(NaN);var n;return t.forEach(function(r){var o=Ye(r);(n===void 0||n>o||isNaN(o.getDate()))&&(n=o)}),n||new Date(NaN)}function gr(e,t){Re(2,arguments);var n=Eu(e),r=Eu(t);return n.getTime()===r.getTime()}function pS(e){return Re(1,arguments),e instanceof Date||ku(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function DV(e){if(Re(1,arguments),!pS(e)&&typeof e!="number")return!1;var t=Ye(e);return!isNaN(Number(t))}function lh(e,t){Re(2,arguments);var n=Ye(e),r=Ye(t),o=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return o*12+s}var LV=6048e5;function FV(e,t,n){Re(2,arguments);var r=Es(e,n),o=Es(t,n),s=r.getTime()-ah(r),i=o.getTime()-ah(o);return Math.round((s-i)/LV)}function mS(e){Re(1,arguments);var t=Ye(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function kr(e){Re(1,arguments);var t=Ye(e);return t.setDate(1),t.setHours(0,0,0,0),t}function zV(e){Re(1,arguments);var t=Ye(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function gS(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ya(),f=kn((n=(r=(o=(s=t==null?void 0:t.weekStartsOn)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=Ye(e),p=h.getDay(),g=(p<f?-7:0)+6-(p-f);return h.setDate(h.getDate()+g),h.setHours(23,59,59,999),h}function WM(e){return Re(1,arguments),gS(e,{weekStartsOn:1})}function $V(e,t){Re(2,arguments);var n=kn(t);return PV(e,-n)}var BV=864e5;function VV(e){Re(1,arguments);var t=Ye(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/BV)+1}function Ng(e){Re(1,arguments);var t=1,n=Ye(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 HM(e){Re(1,arguments);var t=Ye(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Ng(r),s=new Date(0);s.setUTCFullYear(n,0,4),s.setUTCHours(0,0,0,0);var i=Ng(s);return t.getTime()>=o.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function UV(e){Re(1,arguments);var t=HM(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Ng(n);return r}var WV=6048e5;function HV(e){Re(1,arguments);var t=Ye(e),n=Ng(t).getTime()-UV(t).getTime();return Math.round(n/WV)+1}function _g(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ya(),f=kn((n=(r=(o=(s=t==null?void 0:t.weekStartsOn)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=Ye(e),p=h.getUTCDay(),g=(p<f?7:0)+p-f;return h.setUTCDate(h.getUTCDate()-g),h.setUTCHours(0,0,0,0),h}function KM(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ye(e),f=u.getUTCFullYear(),h=Ya(),p=kn((n=(r=(o=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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 g=new Date(0);g.setUTCFullYear(f+1,0,p),g.setUTCHours(0,0,0,0);var v=_g(g,t),y=new Date(0);y.setUTCFullYear(f,0,p),y.setUTCHours(0,0,0,0);var x=_g(y,t);return u.getTime()>=v.getTime()?f+1:u.getTime()>=x.getTime()?f:f-1}function KV(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ya(),f=kn((n=(r=(o=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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=KM(e,t),p=new Date(0);p.setUTCFullYear(h,0,f),p.setUTCHours(0,0,0,0);var g=_g(p,t);return g}var GV=6048e5;function qV(e,t){Re(1,arguments);var n=Ye(e),r=_g(n,t).getTime()-KV(n,t).getTime();return Math.round(r/GV)+1}function yt(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var Li={y:function(t,n){var r=t.getUTCFullYear(),o=r>0?r:1-r;return yt(n==="yy"?o%100:o,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):yt(r+1,2)},d:function(t,n){return yt(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 yt(t.getUTCHours()%12||12,n.length)},H:function(t,n){return yt(t.getUTCHours(),n.length)},m:function(t,n){return yt(t.getUTCMinutes(),n.length)},s:function(t,n){return yt(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,o=t.getUTCMilliseconds(),s=Math.floor(o*Math.pow(10,r-3));return yt(s,n.length)}},wc={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},YV={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(),s=o>0?o:1-o;return r.ordinalNumber(s,{unit:"year"})}return Li.y(t,n)},Y:function(t,n,r,o){var s=KM(t,o),i=s>0?s:1-s;if(n==="YY"){var a=i%100;return yt(a,2)}return n==="Yo"?r.ordinalNumber(i,{unit:"year"}):yt(i,n.length)},R:function(t,n){var r=HM(t);return yt(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return yt(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 yt(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 yt(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 Li.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 yt(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 s=qV(t,o);return n==="wo"?r.ordinalNumber(s,{unit:"week"}):yt(s,n.length)},I:function(t,n,r){var o=HV(t);return n==="Io"?r.ordinalNumber(o,{unit:"week"}):yt(o,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):Li.d(t,n)},D:function(t,n,r){var o=VV(t);return n==="Do"?r.ordinalNumber(o,{unit:"dayOfYear"}):yt(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 s=t.getUTCDay(),i=(s-o.weekStartsOn+8)%7||7;switch(n){case"e":return String(i);case"ee":return yt(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(t,n,r,o){var s=t.getUTCDay(),i=(s-o.weekStartsOn+8)%7||7;switch(n){case"c":return String(i);case"cc":return yt(i,n.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(t,n,r){var o=t.getUTCDay(),s=o===0?7:o;switch(n){case"i":return String(s);case"ii":return yt(s,n.length);case"io":return r.ordinalNumber(s,{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(),s=o/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,n,r){var o=t.getUTCHours(),s;switch(o===12?s=wc.noon:o===0?s=wc.midnight:s=o/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,n,r){var o=t.getUTCHours(),s;switch(o>=17?s=wc.evening:o>=12?s=wc.afternoon:o>=4?s=wc.morning:s=wc.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{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 Li.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):Li.H(t,n)},K:function(t,n,r){var o=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(o,{unit:"hour"}):yt(o,n.length)},k:function(t,n,r){var o=t.getUTCHours();return o===0&&(o=24),n==="ko"?r.ordinalNumber(o,{unit:"hour"}):yt(o,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):Li.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):Li.s(t,n)},S:function(t,n){return Li.S(t,n)},X:function(t,n,r,o){var s=o._originalDate||t,i=s.getTimezoneOffset();if(i===0)return"Z";switch(n){case"X":return dN(i);case"XXXX":case"XX":return ll(i);case"XXXXX":case"XXX":default:return ll(i,":")}},x:function(t,n,r,o){var s=o._originalDate||t,i=s.getTimezoneOffset();switch(n){case"x":return dN(i);case"xxxx":case"xx":return ll(i);case"xxxxx":case"xxx":default:return ll(i,":")}},O:function(t,n,r,o){var s=o._originalDate||t,i=s.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+uN(i,":");case"OOOO":default:return"GMT"+ll(i,":")}},z:function(t,n,r,o){var s=o._originalDate||t,i=s.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+uN(i,":");case"zzzz":default:return"GMT"+ll(i,":")}},t:function(t,n,r,o){var s=o._originalDate||t,i=Math.floor(s.getTime()/1e3);return yt(i,n.length)},T:function(t,n,r,o){var s=o._originalDate||t,i=s.getTime();return yt(i,n.length)}};function uN(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),s=r%60;if(s===0)return n+String(o);var i=t;return n+String(o)+i+yt(s,2)}function dN(e,t){if(e%60===0){var n=e>0?"-":"+";return n+yt(Math.abs(e)/60,2)}return ll(e,t)}function ll(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e),s=yt(Math.floor(o/60),2),i=yt(o%60,2);return r+s+n+i}var fN=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"})}},GM=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"})}},JV=function(t,n){var r=t.match(/(P+)(p+)?/)||[],o=r[1],s=r[2];if(!s)return fN(t,n);var i;switch(o){case"P":i=n.dateTime({width:"short"});break;case"PP":i=n.dateTime({width:"medium"});break;case"PPP":i=n.dateTime({width:"long"});break;case"PPPP":default:i=n.dateTime({width:"full"});break}return i.replace("{{date}}",fN(o,n)).replace("{{time}}",GM(s,n))},XV={p:GM,P:JV},ZV=["D","DD"],QV=["YY","YYYY"];function e8(e){return ZV.indexOf(e)!==-1}function t8(e){return QV.indexOf(e)!==-1}function hN(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 n8={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"}},r8=function(t,n,r){var o,s=n8[t];return typeof s=="string"?o=s:n===1?o=s.one:o=s.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+o:o+" ago":o};function Dx(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 o8={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},s8={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},i8={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},a8={date:Dx({formats:o8,defaultWidth:"full"}),time:Dx({formats:s8,defaultWidth:"full"}),dateTime:Dx({formats:i8,defaultWidth:"full"})},l8={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},c8=function(t,n,r,o){return l8[t]};function Od(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",o;if(r==="formatting"&&e.formattingValues){var s=e.defaultFormattingWidth||e.defaultWidth,i=n!=null&&n.width?String(n.width):s;o=e.formattingValues[i]||e.formattingValues[s]}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 u8={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},d8={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},f8={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"]},h8={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"]},p8={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"}},m8={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"}},g8=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"},v8={ordinalNumber:g8,era:Od({values:u8,defaultWidth:"wide"}),quarter:Od({values:d8,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:Od({values:f8,defaultWidth:"wide"}),day:Od({values:h8,defaultWidth:"wide"}),dayPeriod:Od({values:p8,defaultWidth:"wide",formattingValues:m8,defaultFormattingWidth:"wide"})};function jd(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],s=t.match(o);if(!s)return null;var i=s[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?x8(a,function(f){return f.test(i)}):y8(a,function(f){return f.test(i)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(i.length);return{value:c,rest:u}}}function y8(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function x8(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function b8(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],s=t.match(e.parsePattern);if(!s)return null;var i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;var a=t.slice(o.length);return{value:i,rest:a}}}var w8=/^(\d+)(th|st|nd|rd)?/i,S8=/\d+/i,k8={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},E8={any:[/^b/i,/^(a|c)/i]},C8={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},N8={any:[/1/i,/2/i,/3/i,/4/i]},_8={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},P8={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]},T8={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},O8={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]},j8={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},M8={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}},R8={ordinalNumber:b8({matchPattern:w8,parsePattern:S8,valueCallback:function(t){return parseInt(t,10)}}),era:jd({matchPatterns:k8,defaultMatchWidth:"wide",parsePatterns:E8,defaultParseWidth:"any"}),quarter:jd({matchPatterns:C8,defaultMatchWidth:"wide",parsePatterns:N8,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:jd({matchPatterns:_8,defaultMatchWidth:"wide",parsePatterns:P8,defaultParseWidth:"any"}),day:jd({matchPatterns:T8,defaultMatchWidth:"wide",parsePatterns:O8,defaultParseWidth:"any"}),dayPeriod:jd({matchPatterns:j8,defaultMatchWidth:"any",parsePatterns:M8,defaultParseWidth:"any"})},qM={code:"en-US",formatDistance:r8,formatLong:a8,formatRelative:c8,localize:v8,match:R8,options:{weekStartsOn:0,firstWeekContainsDate:1}},A8=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,I8=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,D8=/^'([^]*?)'?$/,L8=/''/g,F8=/[a-zA-Z]/;function Ci(e,t,n){var r,o,s,i,a,l,c,u,f,h,p,g,v,y,x,b,w,E;Re(2,arguments);var C=String(t),_=Ya(),N=(r=(o=n==null?void 0:n.locale)!==null&&o!==void 0?o:_.locale)!==null&&r!==void 0?r:qM,P=kn((s=(i=(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:_.firstWeekContainsDate)!==null&&i!==void 0?i:(f=_.locale)===null||f===void 0||(h=f.options)===null||h===void 0?void 0:h.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(P>=1&&P<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var j=kn((p=(g=(v=(y=n==null?void 0:n.weekStartsOn)!==null&&y!==void 0?y:n==null||(x=n.locale)===null||x===void 0||(b=x.options)===null||b===void 0?void 0:b.weekStartsOn)!==null&&v!==void 0?v:_.weekStartsOn)!==null&&g!==void 0?g:(w=_.locale)===null||w===void 0||(E=w.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&p!==void 0?p:0);if(!(j>=0&&j<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!N.localize)throw new RangeError("locale must contain localize property");if(!N.formatLong)throw new RangeError("locale must contain formatLong property");var A=Ye(e);if(!DV(A))throw new RangeError("Invalid time value");var U=ah(A),L=$V(A,U),K={firstWeekContainsDate:P,weekStartsOn:j,locale:N,_originalDate:A},W=C.match(I8).map(function(V){var H=V[0];if(H==="p"||H==="P"){var z=XV[H];return z(V,N.formatLong)}return V}).join("").match(A8).map(function(V){if(V==="''")return"'";var H=V[0];if(H==="'")return z8(V);var z=YV[H];if(z)return!(n!=null&&n.useAdditionalWeekYearTokens)&&t8(V)&&hN(V,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&e8(V)&&hN(V,t,String(e)),z(L,V,N.localize,K);if(H.match(F8))throw new RangeError("Format string contains an unescaped latin alphabet character `"+H+"`");return V}).join("");return W}function z8(e){var t=e.match(D8);return t?t[1].replace(L8,"'"):e}function $8(e){Re(1,arguments);var t=Ye(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 B8=6048e5;function V8(e){Re(1,arguments);var t=Ye(e),n=Vl(t).getTime()-jV(t).getTime();return Math.round(n/B8)+1}function U8(e){Re(1,arguments);var t=Ye(e),n=t.getTime();return n}function W8(e){return Re(1,arguments),Math.floor(U8(e)/1e3)}function H8(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ye(e),f=u.getFullYear(),h=Ya(),p=kn((n=(r=(o=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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 g=new Date(0);g.setFullYear(f+1,0,p),g.setHours(0,0,0,0);var v=Es(g,t),y=new Date(0);y.setFullYear(f,0,p),y.setHours(0,0,0,0);var x=Es(y,t);return u.getTime()>=v.getTime()?f+1:u.getTime()>=x.getTime()?f:f-1}function K8(e,t){var n,r,o,s,i,a,l,c;Re(1,arguments);var u=Ya(),f=kn((n=(r=(o=(s=t==null?void 0:t.firstWeekContainsDate)!==null&&s!==void 0?s:t==null||(i=t.locale)===null||i===void 0||(a=i.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=H8(e,t),p=new Date(0);p.setFullYear(h,0,f),p.setHours(0,0,0,0);var g=Es(p,t);return g}var G8=6048e5;function q8(e,t){Re(1,arguments);var n=Ye(e),r=Es(n,t).getTime()-K8(n,t).getTime();return Math.round(r/G8)+1}function Y8(e){Re(1,arguments);var t=Ye(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function J8(e,t){return Re(1,arguments),FV(Y8(e),kr(e),t)+1}function Ub(e,t){Re(2,arguments);var n=Ye(e),r=Ye(t);return n.getTime()>r.getTime()}function YM(e,t){Re(2,arguments);var n=Ye(e),r=Ye(t);return n.getTime()<r.getTime()}function vS(e,t){Re(2,arguments);var n=Ye(e),r=Ye(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function X8(e,t){Re(2,arguments);var n=Ye(e),r=Ye(t);return n.getFullYear()===r.getFullYear()}function Lx(e,t){Re(2,arguments);var n=kn(t);return nr(e,-n)}function Fx(e,t){Re(2,arguments);var n=Ye(e),r=kn(t),o=n.getFullYear(),s=n.getDate(),i=new Date(0);i.setFullYear(o,r,15),i.setHours(0,0,0,0);var a=$8(i);return n.setMonth(r,Math.min(s,a)),n}function pN(e,t){Re(2,arguments);var n=Ye(e),r=kn(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var Ie=function(){return Ie=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Ie.apply(this,arguments)};function Z8(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function JM(e,t,n){for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function Kh(e){return e.mode==="multiple"}function Gh(e){return e.mode==="range"}function Zv(e){return e.mode==="single"}var Q8={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 e9(e,t){return Ci(e,"LLLL y",t)}function t9(e,t){return Ci(e,"d",t)}function n9(e,t){return Ci(e,"LLLL",t)}function r9(e){return"".concat(e)}function o9(e,t){return Ci(e,"cccccc",t)}function s9(e,t){return Ci(e,"yyyy",t)}var i9=Object.freeze({__proto__:null,formatCaption:e9,formatDay:t9,formatMonthCaption:n9,formatWeekNumber:r9,formatWeekdayName:o9,formatYearCaption:s9}),a9=function(e,t,n){return Ci(e,"do MMMM (EEEE)",n)},l9=function(){return"Month: "},c9=function(){return"Go to next month"},u9=function(){return"Go to previous month"},d9=function(e,t){return Ci(e,"cccc",t)},f9=function(e){return"Week n. ".concat(e)},h9=function(){return"Year: "},p9=Object.freeze({__proto__:null,labelDay:a9,labelMonthDropdown:l9,labelNext:c9,labelPrevious:u9,labelWeekNumber:f9,labelWeekday:d9,labelYearDropdown:h9});function m9(){var e="buttons",t=Q8,n=qM,r={},o={},s=1,i={},a=new Date;return{captionLayout:e,classNames:t,formatters:i9,labels:p9,locale:n,modifiersClassNames:r,modifiers:o,numberOfMonths:s,styles:i,today:a,mode:"default"}}function g9(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,s=e.fromDate,i=e.toDate;return r?s=kr(r):t&&(s=new Date(t,0,1)),o?i=mS(o):n&&(i=new Date(n,11,31)),{fromDate:s?Eu(s):void 0,toDate:i?Eu(i):void 0}}var XM=m.createContext(void 0);function ZM(e){var t,n=e.initialProps,r=m9(),o=g9(n),s=o.fromDate,i=o.toDate,a=(t=n.captionLayout)!==null&&t!==void 0?t:r.captionLayout;a!=="buttons"&&(!s||!i)&&(a="buttons");var l;(Zv(n)||Kh(n)||Gh(n))&&(l=n.onSelect);var c=Ie(Ie(Ie({},r),n),{captionLayout:a,classNames:Ie(Ie({},r.classNames),n.classNames),components:Ie({},n.components),formatters:Ie(Ie({},r.formatters),n.formatters),fromDate:s,labels:Ie(Ie({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:Ie(Ie({},r.modifiers),n.modifiers),modifiersClassNames:Ie(Ie({},r.modifiersClassNames),n.modifiersClassNames),onSelect:l,styles:Ie(Ie({},r.styles),n.styles),toDate:i});return d.jsx(XM.Provider,{value:c,children:e.children})}function Pt(){var e=m.useContext(XM);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function QM(e){var t=Pt(),n=t.locale,r=t.classNames,o=t.styles,s=t.formatters.formatCaption;return d.jsx("div",{className:r.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:s(e.displayMonth,{locale:n})})}function v9(e){return d.jsx("svg",Ie({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:d.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 eR(e){var t,n,r=e.onChange,o=e.value,s=e.children,i=e.caption,a=e.className,l=e.style,c=Pt(),u=(n=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:v9;return d.jsxs("div",{className:a,style:l,children:[d.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),d.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:r,children:s}),d.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[i,d.jsx(u,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function y9(e){var t,n=Pt(),r=n.fromDate,o=n.toDate,s=n.styles,i=n.locale,a=n.formatters.formatMonthCaption,l=n.classNames,c=n.components,u=n.labels.labelMonthDropdown;if(!r)return d.jsx(d.Fragment,{});if(!o)return d.jsx(d.Fragment,{});var f=[];if(X8(r,o))for(var h=kr(r),p=r.getMonth();p<=o.getMonth();p++)f.push(Fx(h,p));else for(var h=kr(new Date),p=0;p<=11;p++)f.push(Fx(h,p));var g=function(y){var x=Number(y.target.value),b=Fx(kr(e.displayMonth),x);e.onChange(b)},v=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:eR;return d.jsx(v,{name:"months","aria-label":u(),className:l.dropdown_month,style:s.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:a(e.displayMonth,{locale:i}),children:f.map(function(y){return d.jsx("option",{value:y.getMonth(),children:a(y,{locale:i})},y.getMonth())})})}function x9(e){var t,n=e.displayMonth,r=Pt(),o=r.fromDate,s=r.toDate,i=r.locale,a=r.styles,l=r.classNames,c=r.components,u=r.formatters.formatYearCaption,f=r.labels.labelYearDropdown,h=[];if(!o)return d.jsx(d.Fragment,{});if(!s)return d.jsx(d.Fragment,{});for(var p=o.getFullYear(),g=s.getFullYear(),v=p;v<=g;v++)h.push(pN(zV(new Date),v));var y=function(b){var w=pN(kr(n),Number(b.target.value));e.onChange(w)},x=(t=c==null?void 0:c.Dropdown)!==null&&t!==void 0?t:eR;return d.jsx(x,{name:"years","aria-label":f(),className:l.dropdown_year,style:a.dropdown_year,onChange:y,value:n.getFullYear(),caption:u(n,{locale:i}),children:h.map(function(b){return d.jsx("option",{value:b.getFullYear(),children:u(b,{locale:i})},b.getFullYear())})})}function b9(e,t){var n=m.useState(e),r=n[0],o=n[1],s=t===void 0?r:t;return[s,o]}function w9(e){var t=e.month,n=e.defaultMonth,r=e.today,o=t||n||r||new Date,s=e.toDate,i=e.fromDate,a=e.numberOfMonths,l=a===void 0?1:a;if(s&&lh(s,o)<0){var c=-1*(l-1);o=Xo(s,c)}return i&&lh(o,i)<0&&(o=i),kr(o)}function S9(){var e=Pt(),t=w9(e),n=b9(t,e.month),r=n[0],o=n[1],s=function(i){var a;if(!e.disableNavigation){var l=kr(i);o(l),(a=e.onMonthChange)===null||a===void 0||a.call(e,l)}};return[r,s]}function k9(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=kr(e),s=kr(Xo(o,r)),i=lh(s,o),a=[],l=0;l<i;l++){var c=Xo(o,l);a.push(c)}return n&&(a=a.reverse()),a}function E9(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.pagedNavigation,o=t.numberOfMonths,s=o===void 0?1:o,i=r?s:1,a=kr(e);if(!n)return Xo(a,i);var l=lh(n,e);if(!(l<s))return Xo(a,i)}}function C9(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.pagedNavigation,o=t.numberOfMonths,s=o===void 0?1:o,i=r?s:1,a=kr(e);if(!n)return Xo(a,-i);var l=lh(a,n);if(!(l<=0))return Xo(a,-i)}}var tR=m.createContext(void 0);function N9(e){var t=Pt(),n=S9(),r=n[0],o=n[1],s=k9(r,t),i=E9(r,t),a=C9(r,t),l=function(f){return s.some(function(h){return vS(f,h)})},c=function(f,h){l(f)||(h&&YM(f,h)?o(Xo(f,1+t.numberOfMonths*-1)):o(f))},u={currentMonth:r,displayMonths:s,goToMonth:o,goToDate:c,previousMonth:a,nextMonth:i,isDateDisplayed:l};return d.jsx(tR.Provider,{value:u,children:e.children})}function qh(){var e=m.useContext(tR);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function mN(e){var t,n=Pt(),r=n.classNames,o=n.styles,s=n.components,i=qh().goToMonth,a=function(u){i(Xo(u,e.displayIndex?-e.displayIndex:0))},l=(t=s==null?void 0:s.CaptionLabel)!==null&&t!==void 0?t:QM,c=d.jsx(l,{id:e.id,displayMonth:e.displayMonth});return d.jsxs("div",{className:r.caption_dropdowns,style:o.caption_dropdowns,children:[d.jsx("div",{className:r.vhidden,children:c}),d.jsx(y9,{onChange:a,displayMonth:e.displayMonth}),d.jsx(x9,{onChange:a,displayMonth:e.displayMonth})]})}function _9(e){return d.jsx("svg",Ie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:d.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 P9(e){return d.jsx("svg",Ie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:d.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 Pg=m.forwardRef(function(e,t){var n=Pt(),r=n.classNames,o=n.styles,s=[r.button_reset,r.button];e.className&&s.push(e.className);var i=s.join(" "),a=Ie(Ie({},o.button_reset),o.button);return e.style&&Object.assign(a,e.style),d.jsx("button",Ie({},e,{ref:t,type:"button",className:i,style:a}))});function T9(e){var t,n,r=Pt(),o=r.dir,s=r.locale,i=r.classNames,a=r.styles,l=r.labels,c=l.labelPrevious,u=l.labelNext,f=r.components;if(!e.nextMonth&&!e.previousMonth)return d.jsx(d.Fragment,{});var h=c(e.previousMonth,{locale:s}),p=[i.nav_button,i.nav_button_previous].join(" "),g=u(e.nextMonth,{locale:s}),v=[i.nav_button,i.nav_button_next].join(" "),y=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:P9,x=(n=f==null?void 0:f.IconLeft)!==null&&n!==void 0?n:_9;return d.jsxs("div",{className:i.nav,style:a.nav,children:[!e.hidePrevious&&d.jsx(Pg,{name:"previous-month","aria-label":h,className:p,style:a.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?d.jsx(y,{className:i.nav_icon,style:a.nav_icon}):d.jsx(x,{className:i.nav_icon,style:a.nav_icon})}),!e.hideNext&&d.jsx(Pg,{name:"next-month","aria-label":g,className:v,style:a.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?d.jsx(x,{className:i.nav_icon,style:a.nav_icon}):d.jsx(y,{className:i.nav_icon,style:a.nav_icon})})]})}function gN(e){var t=Pt().numberOfMonths,n=qh(),r=n.previousMonth,o=n.nextMonth,s=n.goToMonth,i=n.displayMonths,a=i.findIndex(function(g){return vS(e.displayMonth,g)}),l=a===0,c=a===i.length-1,u=t>1&&(l||!c),f=t>1&&(c||!l),h=function(){r&&s(r)},p=function(){o&&s(o)};return d.jsx(T9,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:f,nextMonth:o,previousMonth:r,onPreviousClick:h,onNextClick:p})}function O9(e){var t,n=Pt(),r=n.classNames,o=n.disableNavigation,s=n.styles,i=n.captionLayout,a=n.components,l=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:QM,c;return o?c=d.jsx(l,{id:e.id,displayMonth:e.displayMonth}):i==="dropdown"?c=d.jsx(mN,{displayMonth:e.displayMonth,id:e.id}):i==="dropdown-buttons"?c=d.jsxs(d.Fragment,{children:[d.jsx(mN,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),d.jsx(gN,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=d.jsxs(d.Fragment,{children:[d.jsx(l,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),d.jsx(gN,{displayMonth:e.displayMonth,id:e.id})]}),d.jsx("div",{className:r.caption,style:s.caption,children:c})}function j9(e){var t=Pt(),n=t.footer,r=t.styles,o=t.classNames.tfoot;return n?d.jsx("tfoot",{className:o,style:r.tfoot,children:d.jsx("tr",{children:d.jsx("td",{colSpan:8,children:n})})}):d.jsx(d.Fragment,{})}function M9(e,t,n){for(var r=n?Vl(new Date):Es(new Date,{locale:e,weekStartsOn:t}),o=[],s=0;s<7;s++){var i=nr(r,s);o.push(i)}return o}function R9(){var e=Pt(),t=e.classNames,n=e.styles,r=e.showWeekNumber,o=e.locale,s=e.weekStartsOn,i=e.ISOWeek,a=e.formatters.formatWeekdayName,l=e.labels.labelWeekday,c=M9(o,s,i);return d.jsxs("tr",{style:n.head_row,className:t.head_row,children:[r&&d.jsx("td",{style:n.head_cell,className:t.head_cell}),c.map(function(u,f){return d.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":l(u,{locale:o}),children:a(u,{locale:o})},f)})]})}function A9(){var e,t=Pt(),n=t.classNames,r=t.styles,o=t.components,s=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:R9;return d.jsx("thead",{style:r.head,className:n.head,children:d.jsx(s,{})})}function I9(e){var t=Pt(),n=t.locale,r=t.formatters.formatDay;return d.jsx(d.Fragment,{children:r(e.date,{locale:n})})}var yS=m.createContext(void 0);function D9(e){if(!Kh(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return d.jsx(yS.Provider,{value:t,children:e.children})}return d.jsx(L9,{initialProps:e.initialProps,children:e.children})}function L9(e){var t=e.initialProps,n=e.children,r=t.selected,o=t.min,s=t.max,i=function(c,u,f){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,c,u,f);var g=!!(u.selected&&o&&(r==null?void 0:r.length)===o);if(!g){var v=!!(!u.selected&&s&&(r==null?void 0:r.length)===s);if(!v){var y=r?JM([],r):[];if(u.selected){var x=y.findIndex(function(b){return gr(c,b)});y.splice(x,1)}else y.push(c);(p=t.onSelect)===null||p===void 0||p.call(t,y,c,u,f)}}},a={disabled:[]};r&&a.disabled.push(function(c){var u=s&&r.length>s-1,f=r.some(function(h){return gr(h,c)});return!!(u&&!f)});var l={selected:r,onDayClick:i,modifiers:a};return d.jsx(yS.Provider,{value:l,children:n})}function xS(){var e=m.useContext(yS);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function F9(e,t){var n=t||{},r=n.from,o=n.to;return r&&o?gr(o,e)&&gr(r,e)?void 0:gr(o,e)?{from:o,to:void 0}:gr(r,e)?void 0:Ub(r,e)?{from:e,to:o}:{from:r,to:e}:o?Ub(e,o)?{from:o,to:e}:{from:e,to:o}:r?YM(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}var bS=m.createContext(void 0);function z9(e){if(!Gh(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return d.jsx(bS.Provider,{value:t,children:e.children})}return d.jsx($9,{initialProps:e.initialProps,children:e.children})}function $9(e){var t=e.initialProps,n=e.children,r=t.selected,o=r||{},s=o.from,i=o.to,a=t.min,l=t.max,c=function(p,g,v){var y,x;(y=t.onDayClick)===null||y===void 0||y.call(t,p,g,v);var b=F9(p,r);(x=t.onSelect)===null||x===void 0||x.call(t,b,p,g,v)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(s?(u.range_start=[s],i?(u.range_end=[i],gr(s,i)||(u.range_middle=[{after:s,before:i}])):u.range_end=[s]):i&&(u.range_start=[i],u.range_end=[i]),a&&(s&&!i&&u.disabled.push({after:Lx(s,a-1),before:nr(s,a-1)}),s&&i&&u.disabled.push({after:s,before:nr(s,a-1)}),!s&&i&&u.disabled.push({after:Lx(i,a-1),before:nr(i,a-1)})),l){if(s&&!i&&(u.disabled.push({before:nr(s,-l+1)}),u.disabled.push({after:nr(s,l-1)})),s&&i){var f=ri(i,s)+1,h=l-f;u.disabled.push({before:Lx(s,h)}),u.disabled.push({after:nr(i,h)})}!s&&i&&(u.disabled.push({before:nr(i,-l+1)}),u.disabled.push({after:nr(i,l-1)}))}return d.jsx(bS.Provider,{value:{selected:r,onDayClick:c,modifiers:u},children:n})}function wS(){var e=m.useContext(bS);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function bm(e){return Array.isArray(e)?JM([],e):e!==void 0?[e]:[]}function B9(e){var t={};return Object.entries(e).forEach(function(n){var r=n[0],o=n[1];t[r]=bm(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 V9=Zo.Selected,$s=Zo.Disabled,U9=Zo.Hidden,W9=Zo.Today,zx=Zo.RangeEnd,$x=Zo.RangeMiddle,Bx=Zo.RangeStart,H9=Zo.Outside;function K9(e,t,n){var r,o=(r={},r[V9]=bm(e.selected),r[$s]=bm(e.disabled),r[U9]=bm(e.hidden),r[W9]=[e.today],r[zx]=[],r[$x]=[],r[Bx]=[],r[H9]=[],r);return e.fromDate&&o[$s].push({before:e.fromDate}),e.toDate&&o[$s].push({after:e.toDate}),Kh(e)?o[$s]=o[$s].concat(t.modifiers[$s]):Gh(e)&&(o[$s]=o[$s].concat(n.modifiers[$s]),o[Bx]=n.modifiers[Bx],o[$x]=n.modifiers[$x],o[zx]=n.modifiers[zx]),o}var nR=m.createContext(void 0);function G9(e){var t=Pt(),n=xS(),r=wS(),o=K9(t,n,r),s=B9(t.modifiers),i=Ie(Ie({},o),s);return d.jsx(nR.Provider,{value:i,children:e.children})}function rR(){var e=m.useContext(nR);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function q9(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Y9(e){return!!(e&&typeof e=="object"&&"from"in e)}function J9(e){return!!(e&&typeof e=="object"&&"after"in e)}function X9(e){return!!(e&&typeof e=="object"&&"before"in e)}function Z9(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Q9(e,t){var n,r=t.from,o=t.to;if(r&&o){var s=ri(o,r)<0;s&&(n=[o,r],r=n[0],o=n[1]);var i=ri(e,r)>=0&&ri(o,e)>=0;return i}return o?gr(o,e):r?gr(r,e):!1}function eU(e){return pS(e)}function tU(e){return Array.isArray(e)&&e.every(pS)}function nU(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(eU(n))return gr(e,n);if(tU(n))return n.includes(e);if(Y9(n))return Q9(e,n);if(Z9(n))return n.dayOfWeek.includes(e.getDay());if(q9(n)){var r=ri(n.before,e),o=ri(n.after,e),s=r>0,i=o<0,a=Ub(n.before,n.after);return a?i&&s:s||i}return J9(n)?ri(e,n.after)>0:X9(n)?ri(n.before,e)>0:typeof n=="function"?n(e):!1})}function SS(e,t,n){var r=Object.keys(t).reduce(function(s,i){var a=t[i];return nU(e,a)&&s.push(i),s},[]),o={};return r.forEach(function(s){return o[s]=!0}),n&&!vS(e,n)&&(o.outside=!0),o}function rU(e,t){for(var n=kr(e[0]),r=mS(e[e.length-1]),o,s,i=n;i<=r;){var a=SS(i,t),l=!a.disabled&&!a.hidden;if(!l){i=nr(i,1);continue}if(a.selected)return i;a.today&&!s&&(s=i),o||(o=i),i=nr(i,1)}return s||o}var oU=365;function oR(e,t){var n=t.moveBy,r=t.direction,o=t.context,s=t.modifiers,i=t.retry,a=i===void 0?{count:0,lastFocused:e}:i,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,f=o.locale,h={day:nr,week:Vb,month:Xo,year:RV,startOfWeek:function(y){return o.ISOWeek?Vl(y):Es(y,{locale:f,weekStartsOn:l})},endOfWeek:function(y){return o.ISOWeek?WM(y):gS(y,{locale:f,weekStartsOn:l})}},p=h[n](e,r==="after"?1:-1);r==="before"&&c?p=AV([c,p]):r==="after"&&u&&(p=IV([u,p]));var g=!0;if(s){var v=SS(p,s);g=!v.disabled&&!v.hidden}return g?p:a.count>oU?a.lastFocused:oR(p,{moveBy:n,direction:r,context:o,modifiers:s,retry:Ie(Ie({},a),{count:a.count+1})})}var sR=m.createContext(void 0);function sU(e){var t=qh(),n=rR(),r=m.useState(),o=r[0],s=r[1],i=m.useState(),a=i[0],l=i[1],c=rU(t.displayMonths,n),u=o??(a&&t.isDateDisplayed(a))?a:c,f=function(){l(o),s(void 0)},h=function(y){s(y)},p=Pt(),g=function(y,x){if(o){var b=oR(o,{moveBy:y,direction:x,context:p,modifiers:n});gr(o,b)||(t.goToDate(b,o),h(b))}},v={focusedDay:o,focusTarget:u,blur:f,focus:h,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return d.jsx(sR.Provider,{value:v,children:e.children})}function kS(){var e=m.useContext(sR);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function iU(e,t){var n=rR(),r=SS(e,n,t);return r}var ES=m.createContext(void 0);function aU(e){if(!Zv(e.initialProps)){var t={selected:void 0};return d.jsx(ES.Provider,{value:t,children:e.children})}return d.jsx(lU,{initialProps:e.initialProps,children:e.children})}function lU(e){var t=e.initialProps,n=e.children,r=function(s,i,a){var l,c,u;if((l=t.onDayClick)===null||l===void 0||l.call(t,s,i,a),i.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,s,i,a);return}(u=t.onSelect)===null||u===void 0||u.call(t,s,s,i,a)},o={selected:t.selected,onDayClick:r};return d.jsx(ES.Provider,{value:o,children:n})}function iR(){var e=m.useContext(ES);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function cU(e,t){var n=Pt(),r=iR(),o=xS(),s=wS(),i=kS(),a=i.focusDayAfter,l=i.focusDayBefore,c=i.focusWeekAfter,u=i.focusWeekBefore,f=i.blur,h=i.focus,p=i.focusMonthBefore,g=i.focusMonthAfter,v=i.focusYearBefore,y=i.focusYearAfter,x=i.focusStartOfWeek,b=i.focusEndOfWeek,w=function(z){var R,$,J,G;Zv(n)?(R=r.onDayClick)===null||R===void 0||R.call(r,e,t,z):Kh(n)?($=o.onDayClick)===null||$===void 0||$.call(o,e,t,z):Gh(n)?(J=s.onDayClick)===null||J===void 0||J.call(s,e,t,z):(G=n.onDayClick)===null||G===void 0||G.call(n,e,t,z)},E=function(z){var R;h(e),(R=n.onDayFocus)===null||R===void 0||R.call(n,e,t,z)},C=function(z){var R;f(),(R=n.onDayBlur)===null||R===void 0||R.call(n,e,t,z)},_=function(z){var R;(R=n.onDayMouseEnter)===null||R===void 0||R.call(n,e,t,z)},N=function(z){var R;(R=n.onDayMouseLeave)===null||R===void 0||R.call(n,e,t,z)},P=function(z){var R;(R=n.onDayPointerEnter)===null||R===void 0||R.call(n,e,t,z)},j=function(z){var R;(R=n.onDayPointerLeave)===null||R===void 0||R.call(n,e,t,z)},A=function(z){var R;(R=n.onDayTouchCancel)===null||R===void 0||R.call(n,e,t,z)},U=function(z){var R;(R=n.onDayTouchEnd)===null||R===void 0||R.call(n,e,t,z)},L=function(z){var R;(R=n.onDayTouchMove)===null||R===void 0||R.call(n,e,t,z)},K=function(z){var R;(R=n.onDayTouchStart)===null||R===void 0||R.call(n,e,t,z)},W=function(z){var R;(R=n.onDayKeyUp)===null||R===void 0||R.call(n,e,t,z)},V=function(z){var R;switch(z.key){case"ArrowLeft":z.preventDefault(),z.stopPropagation(),n.dir==="rtl"?a():l();break;case"ArrowRight":z.preventDefault(),z.stopPropagation(),n.dir==="rtl"?l():a();break;case"ArrowDown":z.preventDefault(),z.stopPropagation(),c();break;case"ArrowUp":z.preventDefault(),z.stopPropagation(),u();break;case"PageUp":z.preventDefault(),z.stopPropagation(),z.shiftKey?v():p();break;case"PageDown":z.preventDefault(),z.stopPropagation(),z.shiftKey?y():g();break;case"Home":z.preventDefault(),z.stopPropagation(),x();break;case"End":z.preventDefault(),z.stopPropagation(),b();break}(R=n.onDayKeyDown)===null||R===void 0||R.call(n,e,t,z)},H={onClick:w,onFocus:E,onBlur:C,onKeyDown:V,onKeyUp:W,onMouseEnter:_,onMouseLeave:N,onPointerEnter:P,onPointerLeave:j,onTouchCancel:A,onTouchEnd:U,onTouchMove:L,onTouchStart:K};return H}function uU(){var e=Pt(),t=iR(),n=xS(),r=wS(),o=Zv(e)?t.selected:Kh(e)?n.selected:Gh(e)?r.selected:void 0;return o}function dU(e){return Object.values(Zo).includes(e)}function fU(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(dU(r)){var s=e.classNames["day_".concat(r)];s&&n.push(s)}}),n}function hU(e,t){var n=Ie({},e.styles.day);return Object.keys(t).forEach(function(r){var o;n=Ie(Ie({},n),(o=e.modifiersStyles)===null||o===void 0?void 0:o[r])}),n}function pU(e,t,n){var r,o,s,i=Pt(),a=kS(),l=iU(e,t),c=cU(e,l),u=uU(),f=!!(i.onDayClick||i.mode!=="default");m.useEffect(function(){var _;l.outside||a.focusedDay&&f&&gr(a.focusedDay,e)&&((_=n.current)===null||_===void 0||_.focus())},[a.focusedDay,e,n,f,l.outside]);var h=fU(i,l).join(" "),p=hU(i,l),g=!!(l.outside&&!i.showOutsideDays||l.hidden),v=(s=(o=i.components)===null||o===void 0?void 0:o.DayContent)!==null&&s!==void 0?s:I9,y=d.jsx(v,{date:e,displayMonth:t,activeModifiers:l}),x={style:p,className:h,children:y,role:"gridcell"},b=a.focusTarget&&gr(a.focusTarget,e)&&!l.outside,w=a.focusedDay&&gr(a.focusedDay,e),E=Ie(Ie(Ie({},x),(r={disabled:l.disabled,role:"gridcell"},r["aria-selected"]=l.selected,r.tabIndex=w||b?0:-1,r)),c),C={isButton:f,isHidden:g,activeModifiers:l,selectedDays:u,buttonProps:E,divProps:x};return C}function mU(e){var t=m.useRef(null),n=pU(e.date,e.displayMonth,t);return n.isHidden?d.jsx("div",{role:"gridcell"}):n.isButton?d.jsx(Pg,Ie({name:"day",ref:t},n.buttonProps)):d.jsx("div",Ie({},n.divProps))}function gU(e){var t=e.number,n=e.dates,r=Pt(),o=r.onWeekNumberClick,s=r.styles,i=r.classNames,a=r.locale,l=r.labels.labelWeekNumber,c=r.formatters.formatWeekNumber,u=c(Number(t),{locale:a});if(!o)return d.jsx("span",{className:i.weeknumber,style:s.weeknumber,children:u});var f=l(Number(t),{locale:a}),h=function(p){o(t,n,p)};return d.jsx(Pg,{name:"week-number","aria-label":f,className:i.weeknumber,style:s.weeknumber,onClick:h,children:u})}function vU(e){var t,n,r=Pt(),o=r.styles,s=r.classNames,i=r.showWeekNumber,a=r.components,l=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:mU,c=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:gU,u;return i&&(u=d.jsx("td",{className:s.cell,style:o.cell,children:d.jsx(c,{number:e.weekNumber,dates:e.dates})})),d.jsxs("tr",{className:s.row,style:o.row,children:[u,e.dates.map(function(f){return d.jsx("td",{className:s.cell,style:o.cell,role:"presentation",children:d.jsx(l,{displayMonth:e.displayMonth,date:f})},W8(f))})]})}function vN(e,t,n){for(var r=n!=null&&n.ISOWeek?WM(t):gS(t,n),o=n!=null&&n.ISOWeek?Vl(e):Es(e,n),s=ri(r,o),i=[],a=0;a<=s;a++)i.push(nr(o,a));var l=i.reduce(function(c,u){var f=n!=null&&n.ISOWeek?V8(u):q8(u,n),h=c.find(function(p){return p.weekNumber===f});return h?(h.dates.push(u),c):(c.push({weekNumber:f,dates:[u]}),c)},[]);return l}function yU(e,t){var n=vN(kr(e),mS(e),t);if(t!=null&&t.useFixedWeeks){var r=J8(e,t);if(r<6){var o=n[n.length-1],s=o.dates[o.dates.length-1],i=Vb(s,6-r),a=vN(Vb(s,1),i,t);n.push.apply(n,a)}}return n}function xU(e){var t,n,r,o=Pt(),s=o.locale,i=o.classNames,a=o.styles,l=o.hideHead,c=o.fixedWeeks,u=o.components,f=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,g=yU(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:s,weekStartsOn:f,firstWeekContainsDate:h}),v=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:A9,y=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:vU,x=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:j9;return d.jsxs("table",{id:e.id,className:i.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!l&&d.jsx(v,{}),d.jsx("tbody",{className:i.tbody,style:a.tbody,children:g.map(function(b){return d.jsx(y,{displayMonth:e.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),d.jsx(x,{displayMonth:e.displayMonth})]})}function bU(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var wU=bU()?m.useLayoutEffect:m.useEffect,Vx=!1,SU=0;function yN(){return"react-day-picker-".concat(++SU)}function kU(e){var t,n=e??(Vx?yN():null),r=m.useState(n),o=r[0],s=r[1];return wU(function(){o===null&&s(yN())},[]),m.useEffect(function(){Vx===!1&&(Vx=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function EU(e){var t,n,r=Pt(),o=r.dir,s=r.classNames,i=r.styles,a=r.components,l=qh().displayMonths,c=kU(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,f=[s.month],h=i.month,p=e.displayIndex===0,g=e.displayIndex===l.length-1,v=!p&&!g;o==="rtl"&&(t=[p,g],g=t[0],p=t[1]),p&&(f.push(s.caption_start),h=Ie(Ie({},h),i.caption_start)),g&&(f.push(s.caption_end),h=Ie(Ie({},h),i.caption_end)),v&&(f.push(s.caption_between),h=Ie(Ie({},h),i.caption_between));var y=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:O9;return d.jsxs("div",{className:f.join(" "),style:h,children:[d.jsx(y,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),d.jsx(xU,{id:u,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function CU(e){var t=Pt(),n=t.classNames,r=t.styles;return d.jsx("div",{className:n.months,style:r.months,children:e.children})}function NU(e){var t,n,r=e.initialProps,o=Pt(),s=kS(),i=qh(),a=m.useState(!1),l=a[0],c=a[1];m.useEffect(function(){o.initialFocus&&s.focusTarget&&(l||(s.focus(s.focusTarget),c(!0)))},[o.initialFocus,l,s.focus,s.focusTarget,s]);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 f=Ie(Ie({},o.styles.root),o.style),h=Object.keys(r).filter(function(g){return g.startsWith("data-")}).reduce(function(g,v){var y;return Ie(Ie({},g),(y={},y[v]=r[v],y))},{}),p=(n=(t=r.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:CU;return d.jsx("div",Ie({className:u.join(" "),style:f,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},h,{children:d.jsx(p,{children:i.displayMonths.map(function(g,v){return d.jsx(EU,{displayIndex:v,displayMonth:g},v)})})}))}function _U(e){var t=e.children,n=Z8(e,["children"]);return d.jsx(ZM,{initialProps:n,children:d.jsx(N9,{children:d.jsx(aU,{initialProps:n,children:d.jsx(D9,{initialProps:n,children:d.jsx(z9,{initialProps:n,children:d.jsx(G9,{children:d.jsx(sU,{children:t})})})})})})})}function PU(e){return d.jsx(_U,Ie({},e,{children:d.jsx(NU,{initialProps:e})}))}const aR=D().uuid().refine(e=>!0),TU=we([M({type:I("patches"),patches:Se(aR)}),M({type:I("deployment"),deployment:VM}),M({type:I("commit"),commit:hS}),M({type:I("subscribed")}),M({type:I("error"),message:D(),reconnect:We().optional()})]);M({type:we([I("did-change"),I("no-change"),I("request-again"),I("use-websocket")]),profileId:D().nullable(),config:M({project:D().optional(),files:M({directory:D()}).optional()}),commitSha:D().optional(),sourcesSha:D(),schemaSha:D(),baseSha:D(),patches:Se(aR),commits:Se(hS).optional(),deployments:Se(VM).optional(),mode:we([I("fs"),I("http")])});function OU(e){const[t,n]=m.useState({status:"not-asked"}),r=m.useRef(null),{authenticationState:o,setAuthenticationLoadingIfNotAuthenticated:s,setIsAuthenticated:i}=jU(),[a,l]=m.useState(),c=m.useRef(0);return m.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()),Ux(e,r,c,t,n,s,i,l);else{console.debug("Executing stat in ",t.wait," status: ",t.status,"Now:",Date.now());const u=setTimeout(()=>{Ux(e,r,c,t,n,s,i,l)},t.wait);return()=>clearTimeout(u)}},[e,t]),m.useEffect(()=>{t.status==="not-asked"&&(n({status:"initializing"}),console.debug("Initializing stat"),Ux(e,r,c,t,n,s,i,l))},[e,t.status]),[t,n,o,s,i,a]}const Md=10*1e3;async function Ux(e,t,n,r,o,s,i,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}),s(),e("/stat","POST",{body:c}).then(u=>{if(u.status===401){i("login-required");return}else i("authorized");if(u.status===503){a(!0),o(f=>({status:"error",error:"Service unavailable",retries:("retries"in f?f.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?Md:0});else if(u.json.type==="use-websocket"){o(g=>({...g,status:"updated-request-again",data:u.json,waitStart:Date.now(),wait:Md})),t.current&&(console.debug("Closing existing WebSocket"),t.current.close());const f=u.json.url;console.debug("Connecting to WebSocket",f),t.current=new WebSocket(f);const h=u.json.nonce;t.current.onopen=()=>{var g;(g=t.current)==null||g.send(JSON.stringify({nonce:h,type:"subscribe"}))},t.current.onmessage=g=>{try{const v=TU.safeParse(JSON.parse(g.data));if(!v.success){console.error("Could not parse WebSocket message",v.error);return}const y=v.data;y.type==="error"?o(x=>Rd(x,y.message)):y.type==="patches"?o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,patches:y.patches},waitStart:"waitStart"in x?x.waitStart:Date.now(),wait:"waitStart"in x?Math.max(0,Date.now()-x.waitStart):Md}:x):y.type==="subscribed"?console.debug("Subscribed!"):y.type==="commit"?(console.debug("Commit",y.commit),o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,commits:(x.data.commits||[]).concat(y.commit)},waitStart:"waitStart"in x?x.waitStart:Date.now(),wait:"waitStart"in x?Math.max(0,Date.now()-x.waitStart):Md}:x)):y.type==="deployment"?(console.debug("Deployment",y.deployment),o(x=>"data"in x&&x.data?{status:"ws-message-received",data:{...x.data,deployments:(x.data.deployments||[]).concat({commitSha:y.deployment.commitSha,deploymentId:y.deployment.deploymentId,deploymentState:y.deployment.deploymentState,createdAt:y.deployment.createdAt,updatedAt:y.deployment.updatedAt})},waitStart:"waitStart"in x?x.waitStart:Date.now(),wait:"waitStart"in x?Math.max(0,Date.now()-x.waitStart):Md}:x)):console.warn("Unknown WebSocket message",y)}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(g=>Rd(g,"WebSocket closed")))},t.current.onerror=()=>{console.warn("WebSocket error"),o(g=>Rd(g,"Got an error while syncing with Val (reason: WebSocket error)"))}}}else o(f=>Rd(f,u.json.message))}).catch(u=>{n.current!==0&&n.current!==l||o(f=>Rd(f,u.message))})}function Rd(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 jU(){const[e,t]=m.useState("not-asked"),n=m.useCallback(()=>{e==="not-asked"&&t("loading")},[e]);return{authenticationState:e,setIsAuthenticated:t,setAuthenticationLoadingIfNotAuthenticated:n}}function Hd(e){var t,n,r,o,s;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"&&((s=(o=(r=e.options)==null?void 0:r.inline)==null?void 0:o.img)!=null&&s.remote));if(e.type==="array")return Hd(e.item);if(e.type==="record")return Hd(e.item);if(e.type==="union"){for(const i of e.items)if(Hd(i))return!0;return!1}else if(e.type==="object"){for(const i in e.items)if(Hd(e.items[i]))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 i=e;return console.error(`Val: requiresRemoteFiles: unexpected schema type ${typeof i=="object"&&"type"in i&&i.type}`,e),null}}}function vn(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 s=0,i=r;s<i.length;s++){var a=i[s];t=a(t)}return t}function lR(e){return nS(e)}function Cu(e,t){if(e===t)return!0;if(se(e)==="object"&&se(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(!Cu(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,s=r;o<s.length;o++){var i=Ln(s[o],2),a=i[0],l=i[1],c=t[a];if(c===void 0||!Cu(l,c))return!1}return!0}}return!1}function co(e){return Array.isArray(e)?e.map(co):se(e)==="object"&&e!==null?Object.fromEntries(Object.entries(e).map(function(t){var n=Ln(t,2),r=n[0],o=n[1];return[r,co(o)]})):e}function CS(e){return/^(0|[1-9][0-9]*)$/g.test(e)?Dn(Number(e)):Jn(new Xr('Invalid array index "'.concat(e,'"')))}function MU(e,t){return e==="-"?Dn(t.length):vn(CS(e),Wv(function(n){return n<=t.length},function(){return new Xr("Array index out of bounds")}))}function cR(e,t){return vn(CS(e),Wv(function(n){return n<t.length},function(){return new Xr("Array index out of bounds")}))}function RU(e,t,n){if(Array.isArray(e))return vn(cR(t,e),mo(function(o){var s=e[o];return e[o]=n,s}));if(se(e)==="object"&&e!==null)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];return e[t]=n,Dn(r)}else return Jn(new Xr("Cannot replace object element which does not exist"));return Jn(new Xr("Cannot replace in non-object/array"))}function AU(e,t,n){return lR(t)?vn(NS(e,t),Dl(function(r){var o=Ln(r,2),s=o[0],i=o[1];return RU(s,i,n)}),mo(function(r){return[e,r]})):Dn([n,e])}function uR(e,t){return Array.isArray(e)?vn(CS(t),Dl(function(n){return n>=e.length?Jn(new Xr("Array index out of bounds")):Dn(e[n])})):se(e)==="object"&&e!==null?Object.prototype.hasOwnProperty.call(e,t)?Dn(e[t]):Dn(void 0):Jn(new Xr("Cannot access non-object/array"))}function NS(e,t){for(var n=e,r=t[0],o=0;o<t.length-1;++o,r=t[o]){var s=uR(n,r);if(Uv(s))return s;if(s.value===void 0)return Jn(new Xr("Path refers to non-existing object/array"));n=s.value}return Dn([n,r])}function Wx(e,t){return vn(t,rS(function(n,r){return vn(uR(n,r),Wv(function(o){return o!==void 0},function(){return new Xr("Path refers to non-existing object/array")}))},e))}function IU(e,t){if(Array.isArray(e))return vn(cR(t,e),mo(function(r){var o=e.splice(r,1),s=Ln(o,1),i=s[0];return i}));if(se(e)==="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];return delete e[t],Dn(n)}return Jn(new Xr("Cannot remove from non-object/array"))}function xN(e,t){return vn(NS(e,t),Dl(function(n){var r=Ln(n,2),o=r[0],s=r[1];return IU(o,s)}))}function DU(e,t,n){if(Array.isArray(e))return vn(MU(t,e),mo(function(o){e.splice(o,0,n)}));if(se(e)==="object"&&e!==null){var r;return Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t]),e[t]=n,Dn(r)}return Jn(new Xr("Cannot add to non-object/array"))}function Hx(e,t,n){return lR(t)?vn(NS(e,t),Dl(function(r){var o=Ln(r,2),s=o[0],i=o[1];return DU(s,i,n)}),mo(function(r){return[e,r]})):Dn([n,e])}function Kp(e){var t=Ln(e,1),n=t[0];return n}var LU=function(){function e(){$n(this,e)}return Bn(e,[{key:"get",value:function(n,r){return Wx(n,r)}},{key:"add",value:function(n,r,o){return vn(Hx(n,r,o),mo(Kp))}},{key:"remove",value:function(n,r){return vn(xN(n,r),mo(function(){return n}))}},{key:"replace",value:function(n,r,o){return vn(AU(n,r,o),mo(Kp))}},{key:"move",value:function(n,r,o){return vn(xN(n,r),Dl(function(s){return Hx(n,o,s)}),mo(Kp))}},{key:"copy",value:function(n,r,o){return vn(Wx(n,r),Dl(function(s){return Hx(n,o,co(s))}),mo(Kp))}},{key:"test",value:function(n,r,o){return vn(Wx(n,r),mo(function(s){return Cu(o,s)}))}}])}();function FU(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)?Dn(e):Jn(new Xr("Test failed"));case"file":return Jn(new Xr("Cannot apply a file patch here"))}}function zU(e,t,n){return vn(n,rS(function(r,o){return FU(r,t,o)},e))}function $U(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 Mc(e,t){if(!t||t.length===0)return new Set([e.type]);const n=new Set;let r=e,o=-1;for(const s 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[s];else if(r.type==="union")if(typeof r.key=="string"){const i=r.items;for(const a of i){const l=Mc(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 "+s);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 "+s);break}else{const a=r.type;return console.error(`Unexecpted resolved schema type: ${a} in ${t.join("/")} at ${s}`),new Set([a])}}return r&&(n.add(r.type),r.type==="union"&&(typeof r.key=="string"?n.add("object"):n.add("string"))),n}class Ad{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,s,i,a,l){let c=n.length>0?`${t}?${n.join("/")}`:t;const u=[];for(let f=this.orderedInsertKeys.length-1;f>=0;f--){const h=this.orderedInsertKeys[f];c!==h?c.startsWith(h)?(c=h,this.orderedInsertKeys.splice(f,1),this.orderedInsertKeys.unshift(c)):h.startsWith(c)&&u.push(f):(this.orderedInsertKeys.splice(f,1),this.orderedInsertKeys.unshift(c))}for(const f of u){const h=this.orderedInsertKeys[f];this.orderedInsertKeys.splice(f,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:s}),p)for(const g of p.patches.slice())this.patchSetMetadata[c].patches.unshift(g),g.author!==null&&this.patchSetMetadata[c].authors.unshift(g.author),this.patchSetMetadata[c].opTypes.unshift(g.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:s}),s!==null&&!this.patchSetMetadata[c].authors.includes(s)&&this.patchSetMetadata[c].authors.unshift(s),this.patchSetMetadata[c].lastUpdatedBy=s,this.patchSetMetadata[c].lastUpdated=o,this.patchSetMetadata[c].opTypes.includes(i)||this.patchSetMetadata[c].opTypes.unshift(i),this.patchSetMetadata[c].patches.unshift({patchPath:l,patchId:r,author:s,createdAt:o,opType:i,schemaTypes:a}),this.orderedInsertKeys.includes(c)||this.orderedInsertKeys.unshift(c)}insert(t,n,r,o,s,i){if(!this.insertedPatches.has(o)){if(!n){this.insertPath(t,[],o,s,i,r.op,[],r.path);return}if(this.insertedPatches.add(o),!(r.op==="file"||r.op==="test"))try{if(r.op==="replace"){const a=Mc(n,r.path);this.insertPath(t,r.path,o,s,i,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=Mc(n,a);if(l.size===1&&l.has("array")){if(this.insertPath(t,a,o,s,i,r.op,Array.from(l),r.path),r.op==="move"){const c=r.from.slice(0,-1),u=Mc(n,c);this.insertPath(t,c,o,s,i,r.op,Array.from(u),r.path)}}else if(l.size===1&&l.has("record")){const c=r.path,u=Mc(n,c);if(this.insertPath(t,c,o,s,i,r.op,Array.from(u),r.path),r.op==="move"){const f=r.from,h=Mc(n,f);this.insertPath(t,f,o,s,i,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,s,i,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,s,i,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 BU{constructor(t,n=void 0){this.client=t,this.overlayEmitter=n,this.autoPublish=!1,this.multipleSourcesSep="|",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.renders=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new Ad,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedRenderSnapshots=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.cachedSourcesSnapshot=null,this.cachedSyncStatus=null,this.cachedPendingOpsCountSnapshot=null,this.cachedInitializedAtSnapshot=null,this.cachedAutoPublishSnapshot=null,this.cachedPublishDisabledSnapshot=null,this.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0,this.cachedPatchErrorsSnapshot=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,s,i,a,l){this.mode=t,this.baseSha=n,this.commitSha=a,this.sourcesSha=o,this.authorId=i;const c=Date.now();t==="fs"?this.loadAutoPublish():this.autoPublish=!1;const u=await this.syncWithUpdatedStat(t,n,r,o,s,i,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.renders=null,this.globalServerSidePatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingOps=[],this.pendingClientPatchIds=[],this.patchDataByPatchId={},this.isSyncing=!1,this.patchSets=new Ad,this.authorId=null,this.publishDisabled=!0,this.isPublishing=!1,this.commitSha=null,this.cachedSourceSnapshots=null,this.cachedSchemaSnapshots=null,this.cachedRenderSnapshots=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.cachedGlobalTransientErrorSnapshot=null,this.cachedParentRef=void 0,this.cachedPatchErrorsSnapshot=null,this.invalidateInitializedAt()}subscribe(t,n){const r=n||Tn;return o=>{const s=this.listeners;if(s[t]||(s[t]={}),Array.isArray(r)){const i=[];for(const a of r){s[t][a]||(s[t][a]=[]);const l=s[t][a].push(o)-1;i.push(l)}return()=>{var a,l;for(const c of i)(l=(a=s[t])==null?void 0:a[r[c]])==null||l.splice(c,1)}}else{s[t][r]||(s[t][r]=[]);const i=s[t][r].push(o)-1;return()=>{var a;(a=s[t])==null||a[r].splice(i,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[Tn])}invalidateSource(t){var n,r,o;this.cachedSourceSnapshots!==null&&(this.cachedSourceSnapshots={...this.cachedSourceSnapshots,[t]:void 0}),this.cachedAllSourcesSnapshot=null,this.cachedSourcesSnapshot=null,this.emit((n=this.listeners.sources)==null?void 0:n[t]),this.emit((r=this.listeners.source)==null?void 0:r[t]),this.emit((o=this.listeners["all-sources"])==null?void 0:o[Tn])}invalidatePatchErrors(t){var n;this.cachedPatchErrorsSnapshot=null,this.emit((n=this.listeners["patch-errors"])==null?void 0:n[t])}invalidateRenders(t){var n;this.cachedSourceSnapshots===null&&(this.cachedSourceSnapshots={}),this.cachedRenderSnapshots={...this.cachedRenderSnapshots,[t]:null},this.emit((n=this.listeners.render)==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[Tn])}invalidateGlobalTransientErrors(){var t;this.cachedGlobalTransientErrorSnapshot=null,this.emit((t=this.listeners["global-transient-errors"])==null?void 0:t[Tn])}invalidateNetworkError(){var t;this.cachedNetworkErrorSnapshot=void 0,this.emit((t=this.listeners["network-error"])==null?void 0:t[Tn])}invalidatePatchSets(){var t;this.cachedSerializedPatchSetsSnapshot=null,this.emit((t=this.listeners["patch-sets"])==null?void 0:t[Tn])}invalidatePendingOps(){var t;this.cachedPendingOpsCountSnapshot=null,this.emit((t=this.listeners["pending-ops-count"])==null?void 0:t[Tn])}invalidateAllPatches(){var t;this.cachedPatchData=null,this.emit((t=this.listeners["all-patches"])==null?void 0:t[Tn])}invalidateSchema(){var t,n;this.cachedAllSchemasSnapshot=null,this.cachedSchemaSnapshots=null,this.cachedAllSourcesSnapshot=null,this.emit((t=this.listeners.schema)==null?void 0:t[Tn]),this.invalidateAllValidationErrors();for(const r in((n=this.listeners)==null?void 0:n["validation-error"])||{}){const o=r;this.invalidateValidationError(o)}}invalidateParentRef(){var t;this.cachedParentRef=void 0,this.emit((t=this.listeners["parent-ref"])==null?void 0:t[Tn])}invalidateGlobalServerSidePatchIds(){var t;this.cachedGlobalServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["global-server-side-patch-ids"])==null?void 0:t[Tn])}invalidatePendingClientSidePatchIds(){var t;this.cachedPendingClientSidePatchIdsSnapshot=null,this.emit((t=this.listeners["pending-client-side-patch-ids"])==null?void 0:t[Tn])}invalidateSyncedServerSidePatchIds(){var t;this.cachedSyncedServerSidePatchIdsSnapshot=null,this.emit((t=this.listeners["synced-server-side-patch-ids"])==null?void 0:t[Tn])}invalidateSavedServerSidePatchIds(){var t;this.cachedSavedServerSidePatchIdsSnapshot=null,this.invalidateParentRef(),this.emit((t=this.listeners["saved-server-side-patch-ids"])==null?void 0:t[Tn])}invalidatePublishDisabled(){var t;this.cachedPublishDisabledSnapshot=null,this.emit((t=this.listeners["publish-disabled"])==null?void 0:t[Tn])}invalidateAutoPublish(){var t;this.cachedAutoPublishSnapshot=null,this.emit((t=this.listeners["auto-publish"])==null?void 0:t[Tn])}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:co(n)}:this.cachedSchemaSnapshots[t]={status:"module-schema-not-found"}}return this.cachedSchemaSnapshots[t]}getRenderSnapshot(t){var n;return this.cachedRenderSnapshots===null&&(this.cachedRenderSnapshots={}),this.cachedRenderSnapshots[t]===null&&(this.cachedRenderSnapshots[t]=((n=this.renders)==null?void 0:n[t])||null),this.cachedRenderSnapshots[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:co(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!==void 0&&(this.cachedAllSourcesSnapshot[r]=co(o))}}return this.cachedAllSourcesSnapshot}getSourcesSnapshot(t){var r;const n=t.sort().map(o=>o+this.multipleSourcesSep).join(this.multipleSourcesSep);if(this.cachedSourcesSnapshot===null&&(this.cachedSourcesSnapshot={}),this.cachedSourcesSnapshot[n]===void 0)for(const o of t){const s=this.optimisticClientSources[o]||((r=this.serverSources)==null?void 0:r[o]);s!==void 0&&(this.cachedSourcesSnapshot[n]=[...this.cachedSourcesSnapshot[n]||[],co(s)])}return this.cachedSourcesSnapshot[n]}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]=co(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.cachedSyncStatus[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}getPatchErrorsSnapshot(t){var r;const n=t.sort().join("|");if(this.cachedPatchErrorsSnapshot===null){this.cachedPatchErrorsSnapshot={};const o={};let s=!1;for(const i of t)(r=this.errors.patchErrors)!=null&&r[i]&&(o[i]={...o[i]||{},...co(this.errors.patchErrors[i])},s=!0);s&&(this.cachedPatchErrorsSnapshot[n]=o)}return this.cachedPatchErrorsSnapshot[n]}getAllPatchesSnapshot(){if(!this.cachedPatchData){this.cachedPatchData={};for(const t in this.patchDataByPatchId){const n=t,r=this.patchDataByPatchId[n];r&&(this.cachedPatchData[n]=co(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}getGlobalTransientErrorsSnapshot(){var t;return this.cachedGlobalTransientErrorSnapshot===null&&(this.cachedGlobalTransientErrorSnapshot=((t=this.errors.globalTransientErrorQueue)==null?void 0:t.slice())||[]),this.cachedGlobalTransientErrorSnapshot}getNetworkErrorSnapshot(){return this.cachedNetworkErrorSnapshot===void 0&&(this.cachedNetworkErrorSnapshot=this.errors.hasNetworkErrorTimestamp||null),this.cachedNetworkErrorSnapshot}getParentRefSnapshot(){return this.cachedParentRef===void 0&&(this.cachedParentRef=this.getParentRef()),this.cachedParentRef}addPatchOnClientOnly(t,n,r){var a;const[o]=Y.splitModuleFilePathAndModulePath(t);if(this.serverSources===null||((a=this.serverSources)==null?void 0:a[o])===void 0)return this.addGlobalTransientError(`Content at '${o}' is not yet initialized`,r),{status:"patch-error",message:`Content at '${o}' is not yet initialized`,moduleFilePath:o};this.optimisticClientSources[o]===void 0&&(this.optimisticClientSources[o]=this.serverSources[o]);const s=n.filter(l=>l.op!=="file"),i=zU(co(this.optimisticClientSources[o]),VU,s);if(A$.isErr(i))return console.error("Could not apply patch:",i.error),this.addGlobalTransientError(`Could apply patch: ${i.error.message}`,r),{status:"patch-error",message:i.error.message,moduleFilePath:o};{const l=i.value,c=co(this.optimisticClientSources[o]);return this.optimisticClientSources[o]=l,{status:"optimistic-client-sources-updated",moduleFilePath:o,prevSource:c,patch:n}}}async addPatchAwaitable(t,n,r,o,s){const i=this.addPatchOnClientOnly(t,r,s);if(i.status!=="optimistic-client-sources-updated")return i;const{moduleFilePath:a,patch:l}=i,c={type:"add-patches",data:{[a]:[{patch:l,patchId:o,type:n}]},createdAt:s};let u=0;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);let f=await this.executeAddPatches(c,{},s);for(;f.status==="retry"&&u<3&&(u++,await new Promise(h=>setTimeout(h,500*(u+1))),f=await this.executeAddPatches(c,{},s),f.status==="retry"););return this.syncStatus[t]="done",this.invalidateSyncStatus(t),f.status==="done"?{status:"patch-synced",patchId:o,parentRef:f.parentRef,moduleFilePath:a}:(this.optimisticClientSources[a]=i.prevSource,{status:"patch-sync-error",message:"Could not sync patch. Tried 3 times.",moduleFilePath:a})}addPatch(t,n,r,o){var l,c,u,f,h,p,g,v,y,x,b;const s=this.addPatchOnClientOnly(t,r,o);if(s.status!=="optimistic-client-sources-updated")return s;const i=s.moduleFilePath;this.syncStatus[t]="patches-pending",this.invalidateSyncStatus(t);const a=this.pendingOps[this.pendingOps.length-1];if((a==null?void 0:a.type)==="add-patches"){const w=(((c=(l=a.data)==null?void 0:l[i])==null?void 0:c.length)||0)-1,E=(h=(f=(u=a.data)==null?void 0:u[i])==null?void 0:f[w])==null?void 0:h.patch,C=(v=(g=(p=a.data)==null?void 0:p[i])==null?void 0:g[w])==null?void 0:v.patchId;if($U(E,r)&&((b=(x=(y=a.data)==null?void 0:y[i])==null?void 0:x[w])==null?void 0:b.type)===n&&C&&this.patchDataByPatchId[C])return a.data[i][w].patch=r,a.updatedAt=o,this.invalidatePendingOps(),this.patchDataByPatchId[C].patch=r,this.patchSetInsert(i,C,r,o),this.invalidateSyncStatus(t),this.invalidateSource(i),{status:"patch-merged",patchId:C,moduleFilePath:i};{a.data[i]||(a.data[i]=[]);const _=this.createPatchId();return a.data[i].push({patch:r,type:n,patchId:_}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(_),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[_]={moduleFilePath:i,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(i,_,r,o),this.invalidateSyncStatus(t),this.invalidateSource(i),{status:"patch-added",patchId:_,moduleFilePath:i}}}else{const w=this.createPatchId();return this.pendingOps.push({type:"add-patches",data:{[i]:[{patch:r,type:n,patchId:w}]},createdAt:o}),this.invalidatePendingOps(),this.pendingClientPatchIds.push(w),this.invalidatePendingClientSidePatchIds(),this.patchDataByPatchId[w]={moduleFilePath:i,patch:r,isPending:!0,createdAt:new Date(o).toISOString(),authorId:this.authorId},this.patchSetInsert(i,w,r,o),this.invalidateSyncStatus(t),this.invalidateSource(i),{status:"patch-added",patchId:w,moduleFilePath:i}}}createPatchId(){return crypto.randomUUID()}patchSetInsert(t,n,r,o){var i;const s=new Date(o).toISOString();for(const a of r)this.patchSets.insert(t,((i=this.schemas)==null?void 0:i[t])??void 0,a,n,s,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,s,i,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,s,i,a,l);const u=this.globalServerSidePatchIds===null||!Cu(this.globalServerSidePatchIds,s);if(u){this.globalServerSidePatchIds=s;const f=new Set(s);this.deletePendingPatchId(f),this.deleteSavedButNotYetGlobalServerSidePatchIds(f),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=[],s=[];for(const[l,c]of Object.entries(t.data)){const u=l;for(const f of c)o.push({path:u,patchId:f.patchId,patch:f.patch}),s.push(f.patchId),n[u]||(n[u]=new Set),n[u].add(f.type)}const i=this.getParentRef();if(i===null)return this.addGlobalTransientError("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:i}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return console.warn("Network error: trying again..."),this.addNetworkError(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.addGlobalTransientError("Failed to save changes",r,a.json.message);for(const c of s)this.patchDataByPatchId={...this.patchDataByPatchId,[c]:void 0};const l=new Set(s);this.pendingClientPatchIds=this.pendingClientPatchIds.filter(c=>!l.has(c))}else{const l=new Set(a.json.newPatchIds);this.deletePendingPatchId(l);for(const c of s){const u=c;this.savedButNotYetGlobalServerSidePatchIds.push(u),this.patchDataByPatchId[u]&&(this.patchDataByPatchId[u].isPending=!1)}}return{status:"done",parentRef:i}}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 s=t.patchIds,i=new Set(s),a=await this.client("/patches","DELETE",{query:{id:t.patchIds.reverse()}});if(a.status!==null&&this.resetNetworkError(),a.status===null&&a.json.type==="network_error")return this.addNetworkError(r),{status:"retry",reason:"network-error"};if(a.status!==200)this.addGlobalTransientError("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=>!i.has(c)),this.globalServerSidePatchIds=((l=this.globalServerSidePatchIds)==null?void 0:l.filter(c=>!i.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,s=!1;if(this.initializedAt===null||t){this.patchSets=new Ad,o=!0;const c=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:void 0}});if(c.status!==200)return this.addGlobalTransientError("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&&(s=!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.addGlobalTransientError("Some changes has errors",n,c.json.error.message);for(const u of Object.values(c.json.errors||{}))u&&this.addGlobalTransientError("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 f=[];for(let h=0;h<c.length;h+=100)f.push(c.slice(h,h+100));for(const h of f){const p=await this.client("/patches","GET",{query:{exclude_patch_ops:!1,patch_id:h}});if(p.status!==200)return this.addGlobalTransientError("Failed to get changes (batch)",n,`Did not get ok status (got: ${p.status}): ${p.json.message}`),{status:"retry"};for(const g of p.json.patches)g.patch&&(s=!0,this.patchDataByPatchId[g.patchId]={moduleFilePath:g.path,patch:g.patch,isPending:!1,createdAt:g.createdAt,authorId:g.authorId,isCommitted:g.appliedAt?{commitSha:g.appliedAt.commitSha}:void 0})}}}const i=new Set(r);for(const c of Array.from(this.patchSets.getInsertedPatches())||[])if(!i.has(c)){this.patchSets=new Ad,o=!0;break}const a=[];for(const c of r)if(!this.patchSets.isInserted(c)){const u=this.patchDataByPatchId[c],f=(u==null?void 0:u.moduleFilePath)&&((l=this.schemas)==null?void 0:l[u==null?void 0:u.moduleFilePath]);if(u&&f)for(const h of u.patch)o=!0,this.patchSets.insert(u.moduleFilePath,f,h,c,u.createdAt,u.authorId);else a.push(c)}return s&&this.invalidateAllPatches(),o&&this.invalidatePatchSets(),a.length>0?(this.initializedAt!==null&&(console.debug("Missing data for patch ids",a,{currentPatchIds:r,reset:t}),this.mode!=="fs"&&this.addGlobalTransientError("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(s=>UU.includes(s)))return[r]}return"all"}async sync(t){var i,a,l,c,u,f,h,p,g;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 s=new Set([...this.syncedServerSidePatchIds,...this.savedButNotYetGlobalServerSidePatchIds]);if(this.globalServerSidePatchIds&&this.mode==="http"){for(const v of s)if(!this.globalServerSidePatchIds.includes(v)){this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.pendingClientPatchIds=[],await this.syncPatches(!0,t),o=!0;break}}try{const v={},y=(w,E)=>t-E<=w*1e3,x=(w,E)=>t-E>=w*1e3;if(((i=this.pendingOps[this.pendingOps.length-1])==null?void 0:i.updatedAt)!==void 0&&y(this.MIN_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].updatedAt)&&!x(this.MAX_WAIT_SECONDS,this.pendingOps[this.pendingOps.length-1].createdAt))return{status:"retry",reason:"too-fast"};r=this.pendingOps.slice(),this.pendingOps=[];let b=!1;for(;r[0];){const w=r[0];if(w.type==="add-patches")try{const E=await this.executeAddPatches(w,v,t);if(E.status!=="done")return E}catch{return{status:"retry",reason:"error"}}else if(w.type==="delete-patches")try{const E=await this.executeDeletePatches(w,v,t);if(E.status!=="done")return E;E.syncAllRequired&&n!=="all"&&(n="all")}catch{return{status:"retry",reason:"error"}}b=!0,r.shift()}if(this.invalidatePendingOps(),n!=="all"){const w=this.getChangedModules(v);if(w==="all")n="all";else for(const E of w)n.push(E)}if(this.clientSideSchemaSha===null||this.schemas===null||this.initializedAt===null){const w=await this.syncSchema();if(w.status!=="done")return w}if(n==="all"||n.length>0){const w=n!=="all"&&n.length===1?n[0]:void 0,E=await this.client("/sources/~","PUT",{path:w,query:{validate_sources:!0,validate_binary_files:!1}});if(E.status!==null&&this.resetNetworkError(),E.status===null&&E.json.type==="network_error")return this.addNetworkError(t),{status:"retry",reason:"network-error"};if(E.status!==200)this.addGlobalTransientError("Could not sync content with server. Please wait or reload the application.",t,E.json.message);else{const C=new Set;for(const _ in this.errors.validationErrors){const N=_;(w===void 0||N.startsWith(w))&&(C.add(N),this.errors.validationErrors[N]&&(this.errors.validationErrors={...this.errors.validationErrors,[N]:void 0}))}for(const[_,N]of Object.entries(E.json.modules)){const P=_;if(N){this.serverSources===null&&(this.serverSources={}),this.serverSources[P]=N.source,this.renders===null&&(this.renders={}),this.renders[P]=N.render||null,this.invalidateRenders(P),(Cu(this.serverSources[P],this.optimisticClientSources[P])||this.pendingOps.length===0)&&(this.optimisticClientSources={...this.optimisticClientSources,[P]:void 0}),console.debug("Invalidating source",P),this.invalidateSource(P),(a=this.overlayEmitter)==null||a.call(this,P,N.source),this.invalidatePatchErrors(P),(l=N.patches)!=null&&l.errors&&(this.errors.patchErrors===void 0&&(this.errors.patchErrors={}),this.errors.patchErrors[P]=N.patches.errors);for(const j in N.validationErrors){const A=j;this.errors.validationErrors||(this.errors.validationErrors={}),this.errors.validationErrors[A]=N.validationErrors[A],C.add(A)}for(const j of((c=N.patches)==null?void 0:c.applied)||[])this.syncedServerSidePatchIds.push(j);for(const j of((u=N.patches)==null?void 0:u.skipped)||[])this.syncedServerSidePatchIds.push(j)}else this.addGlobalTransientError(`Could not find '${P}' in server reply`,t,"This is most likely a bug");this.markAllSyncStatusIn(P,"done")}this.invalidateAllValidationErrors();for(const _ of Array.from(C))this.invalidateValidationError(_);E.json.schemaSha!==this.clientSideSchemaSha&&await this.syncSchema()}}if(this.autoPublish&&this.mode==="fs"&&this.globalServerSidePatchIds&&this.globalServerSidePatchIds.length>0){let w=!1;for(const E in this.errors.validationErrors||{}){const C=E;if((h=(f=this.errors)==null?void 0:f.validationErrors)!=null&&h[C]&&((g=(p=this.errors)==null?void 0:p.validationErrors)==null?void 0:g[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),b=!0)}return(o||b)&&(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(i=>i||[]).length>0)return console.debug("Skipping publish since there's validation errors",this.errors.validationErrors),this.addGlobalTransientError("Could not publish changes, since there are validation errors",r),{status:"retry",reason:"validation-error"};if(t.length===0)return this.addGlobalTransientError("Could not publish changes, since there are no changes to publish",Date.now()),{status:"done"};const s=await this.client("/save","POST",{body:{message:n,patchIds:t}});return s.status===null?(this.addGlobalTransientError("Network error: could not publish",Date.now()),{status:"retry"}):s.status!==200?(this.addGlobalTransientError("Failed to publish changes",Date.now(),s.json.message),{status:"retry"}):(this.mode==="fs"&&(this.globalServerSidePatchIds=[],console.debug("Deleting all patch ids")),this.pendingClientPatchIds=[],this.syncedServerSidePatchIds=[],this.savedButNotYetGlobalServerSidePatchIds=[],this.patchDataByPatchId={},this.patchSets=new Ad,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.addGlobalTransientError("Failed to publish changes",Date.now(),o.message),{status:"retry",reason:"error"}}finally{this.isPublishing=!1,this.publishDisabled=!1,this.invalidatePublishDisabled()}}resetNetworkError(){this.errors.hasNetworkErrorTimestamp=null,this.invalidateNetworkError()}addNetworkError(t){this.errors.hasNetworkErrorTimestamp=t,this.invalidateNetworkError()}addGlobalTransientError(t,n,r){this.errors.globalTransientErrorQueue||(this.errors.globalTransientErrorQueue=[]),console.error("Global transient error",t,r||""),this.errors.globalTransientErrorQueue.push({message:t,details:r,timestamp:n,id:crypto.randomUUID()}),this.invalidateGlobalTransientErrors()}removeGlobalTransientErrors(t){if(this.errors.globalTransientErrorQueue){const n=new Set(t);this.errors.globalTransientErrorQueue=this.errors.globalTransientErrorQueue.filter(r=>!n.has(r.id)),this.invalidateGlobalTransientErrors()}}}const VU=new LU,Tn="global",UU=["string","boolean","number","date","richtext","file","image"],WU=(e,t)=>{window.dispatchEvent(new CustomEvent("val-event",{detail:{type:"source-update",moduleFilePath:e,source:t}}))};function HU(e,t,n){var o,s,i;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:((s=r[a.commitSha])==null?void 0:s.creator)||null,createdAt:((i=r[a.commitSha])==null?void 0:i.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 ne(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 bN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function As(...e){return t=>{let n=!1;const r=e.map(o=>{const s=bN(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():bN(e[o],null)}}}}function Ue(...e){return m.useCallback(As(...e),e)}function KU(e,t){const n=m.createContext(t),r=s=>{const{children:i,...a}=s,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function o(s){const i=m.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function dr(e,t=[]){let n=[];function r(s,i){const a=m.createContext(i),l=n.length;n=[...n,i];const c=f=>{var x;const{scope:h,children:p,...g}=f,v=((x=h==null?void 0:h[e])==null?void 0:x[l])||a,y=m.useMemo(()=>g,Object.values(g));return d.jsx(v.Provider,{value:y,children:p})};c.displayName=s+"Provider";function u(f,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[l])||a,g=m.useContext(p);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,u]}const o=()=>{const s=n.map(i=>m.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,GU(o,...t)]}function GU(...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(s){const i=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function qU(e){const t=YU(e),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(XU);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function YU(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=QU(o),a=ZU(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JU=Symbol("radix.slottable");function XU(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JU}function ZU(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function QU(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 eW=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oe=eW.reduce((e,t)=>{const n=qU(`Primitive.${t}`),r=m.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function dR(e,t){e&&Hr.flushSync(()=>e.dispatchEvent(t))}function An(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function tW(e,t=globalThis==null?void 0:globalThis.document){const n=An(e);m.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 nW="DismissableLayer",Wb="dismissableLayer.update",rW="dismissableLayer.pointerDownOutside",oW="dismissableLayer.focusOutside",wN,fR=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lc=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=e,c=m.useContext(fR),[u,f]=m.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=m.useState({}),g=Ue(t,N=>f(N)),v=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(y),b=u?v.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,E=b>=x,C=aW(N=>{const P=N.target,j=[...c.branches].some(A=>A.contains(P));!E||j||(o==null||o(N),i==null||i(N),N.defaultPrevented||a==null||a())},h),_=lW(N=>{const P=N.target;[...c.branches].some(A=>A.contains(P))||(s==null||s(N),i==null||i(N),N.defaultPrevented||a==null||a())},h);return tW(N=>{b===c.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),m.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(wN=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),SN(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=wN)}},[u,h,n,c]),m.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),SN())},[u,c]),m.useEffect(()=>{const N=()=>p({});return document.addEventListener(Wb,N),()=>document.removeEventListener(Wb,N)},[]),d.jsx(Oe.div,{...l,ref:g,style:{pointerEvents:w?E?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,C.onPointerDownCapture)})});lc.displayName=nW;var sW="DismissableLayerBranch",iW=m.forwardRef((e,t)=>{const n=m.useContext(fR),r=m.useRef(null),o=Ue(t,r);return m.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(Oe.div,{...e,ref:o})});iW.displayName=sW;function aW(e,t=globalThis==null?void 0:globalThis.document){const n=An(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){hR(rW,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},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function lW(e,t=globalThis==null?void 0:globalThis.document){const n=An(e),r=m.useRef(!1);return m.useEffect(()=>{const o=s=>{s.target&&!r.current&&hR(oW,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function SN(){const e=new CustomEvent(Wb);document.dispatchEvent(e)}function hR(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?dR(o,s):o.dispatchEvent(s)}var En=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},cW=u1[" useId ".trim().toString()]||(()=>{}),uW=0;function qr(e){const[t,n]=m.useState(cW());return En(()=>{n(r=>r??String(uW++))},[e]),t?`radix-${t}`:""}const dW=["top","right","bottom","left"],Ia=Math.min,Br=Math.max,Tg=Math.round,Gp=Math.floor,Ss=e=>({x:e,y:e}),fW={left:"right",right:"left",bottom:"top",top:"bottom"},hW={start:"end",end:"start"};function Hb(e,t,n){return Br(e,Ia(t,n))}function xi(e,t){return typeof e=="function"?e(t):e}function bi(e){return e.split("-")[0]}function qu(e){return e.split("-")[1]}function _S(e){return e==="x"?"y":"x"}function PS(e){return e==="y"?"height":"width"}const pW=new Set(["top","bottom"]);function vs(e){return pW.has(bi(e))?"y":"x"}function TS(e){return _S(vs(e))}function mW(e,t,n){n===void 0&&(n=!1);const r=qu(e),o=TS(e),s=PS(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Og(i)),[i,Og(i)]}function gW(e){const t=Og(e);return[Kb(e),t,Kb(t)]}function Kb(e){return e.replace(/start|end/g,t=>hW[t])}const kN=["left","right"],EN=["right","left"],vW=["top","bottom"],yW=["bottom","top"];function xW(e,t,n){switch(e){case"top":case"bottom":return n?t?EN:kN:t?kN:EN;case"left":case"right":return t?vW:yW;default:return[]}}function bW(e,t,n,r){const o=qu(e);let s=xW(bi(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Kb)))),s}function Og(e){return e.replace(/left|right|bottom|top/g,t=>fW[t])}function wW(e){return{top:0,right:0,bottom:0,left:0,...e}}function pR(e){return typeof e!="number"?wW(e):{top:e,right:e,bottom:e,left:e}}function jg(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 CN(e,t,n){let{reference:r,floating:o}=e;const s=vs(t),i=TS(t),a=PS(i),l=bi(t),c=s==="y",u=r.x+r.width/2-o.width/2,f=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:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(qu(t)){case"start":p[i]-=h*(n&&c?-1:1);break;case"end":p[i]+=h*(n&&c?-1:1);break}return p}const SW=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=CN(c,r,l),h=r,p={},g=0;for(let v=0;v<a.length;v++){const{name:y,fn:x}=a[v],{x:b,y:w,data:E,reset:C}=await x({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:c,platform:i,elements:{reference:e,floating:t}});u=b??u,f=w??f,p={...p,[y]:{...p[y],...E}},C&&g<=50&&(g++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=CN(c,h,l)),v=-1)}return{x:u,y:f,placement:h,strategy:o,middlewareData:p}};async function ch(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=xi(t,e),g=pR(p),y=a[h?f==="floating"?"reference":"floating":f],x=jg(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=jg(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:l}):b);return{top:(x.top-C.top+g.top)/E.y,bottom:(C.bottom-x.bottom+g.bottom)/E.y,left:(x.left-C.left+g.left)/E.x,right:(C.right-x.right+g.right)/E.x}}const kW=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=xi(e,t)||{};if(c==null)return{};const f=pR(u),h={x:n,y:r},p=TS(o),g=PS(p),v=await i.getDimensions(c),y=p==="y",x=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",E=s.reference[g]+s.reference[p]-h[p]-s.floating[g],C=h[p]-s.reference[p],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let N=_?_[w]:0;(!N||!await(i.isElement==null?void 0:i.isElement(_)))&&(N=a.floating[w]||s.floating[g]);const P=E/2-C/2,j=N/2-v[g]/2-1,A=Ia(f[x],j),U=Ia(f[b],j),L=A,K=N-v[g]-U,W=N/2-v[g]/2+P,V=Hb(L,W,K),H=!l.arrow&&qu(o)!=null&&W!==V&&s.reference[g]/2-(W<L?A:U)-v[g]/2<0,z=H?W<L?W-L:W-K:0;return{[p]:h[p]+z,data:{[p]:V,centerOffset:W-V-z,...H&&{alignmentOffset:z}},reset:H}}}),EW=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...y}=xi(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=bi(o),b=vs(a),w=bi(a)===a,E=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=h||(w||!v?[Og(a)]:gW(a)),_=g!=="none";!h&&_&&C.push(...bW(a,v,g,E));const N=[a,...C],P=await ch(t,y),j=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&j.push(P[x]),f){const W=mW(o,i,E);j.push(P[W[0]],P[W[1]])}if(A=[...A,{placement:o,overflows:j}],!j.every(W=>W<=0)){var U,L;const W=(((U=s.flip)==null?void 0:U.index)||0)+1,V=N[W];if(V&&(!(f==="alignment"?b!==vs(V):!1)||A.every(R=>vs(R.placement)===b?R.overflows[0]>0:!0)))return{data:{index:W,overflows:A},reset:{placement:V}};let H=(L=A.filter(z=>z.overflows[0]<=0).sort((z,R)=>z.overflows[1]-R.overflows[1])[0])==null?void 0:L.placement;if(!H)switch(p){case"bestFit":{var K;const z=(K=A.filter(R=>{if(_){const $=vs(R.placement);return $===b||$==="y"}return!0}).map(R=>[R.placement,R.overflows.filter($=>$>0).reduce(($,J)=>$+J,0)]).sort((R,$)=>R[1]-$[1])[0])==null?void 0:K[0];z&&(H=z);break}case"initialPlacement":H=a;break}if(o!==H)return{reset:{placement:H}}}return{}}}};function NN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _N(e){return dW.some(t=>e[t]>=0)}const CW=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=xi(e,t);switch(r){case"referenceHidden":{const s=await ch(t,{...o,elementContext:"reference"}),i=NN(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:_N(i)}}}case"escaped":{const s=await ch(t,{...o,altBoundary:!0}),i=NN(s,n.floating);return{data:{escapedOffsets:i,escaped:_N(i)}}}default:return{}}}}},mR=new Set(["left","top"]);async function NW(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=bi(n),a=qu(n),l=vs(n)==="y",c=mR.has(i)?-1:1,u=s&&l?-1:1,f=xi(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const _W=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await NW(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},PW=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...l}=xi(e,t),c={x:n,y:r},u=await ch(t,l),f=vs(bi(o)),h=_S(f);let p=c[h],g=c[f];if(s){const y=h==="y"?"top":"left",x=h==="y"?"bottom":"right",b=p+u[y],w=p-u[x];p=Hb(b,p,w)}if(i){const y=f==="y"?"top":"left",x=f==="y"?"bottom":"right",b=g+u[y],w=g-u[x];g=Hb(b,g,w)}const v=a.fn({...t,[h]:p,[f]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:s,[f]:i}}}}}},TW=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=xi(e,t),u={x:n,y:r},f=vs(o),h=_S(f);let p=u[h],g=u[f];const v=xi(a,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(l){const w=h==="y"?"height":"width",E=s.reference[h]-s.floating[w]+y.mainAxis,C=s.reference[h]+s.reference[w]-y.mainAxis;p<E?p=E:p>C&&(p=C)}if(c){var x,b;const w=h==="y"?"width":"height",E=mR.has(bi(o)),C=s.reference[f]-s.floating[w]+(E&&((x=i.offset)==null?void 0:x[f])||0)+(E?0:y.crossAxis),_=s.reference[f]+s.reference[w]+(E?0:((b=i.offset)==null?void 0:b[f])||0)-(E?y.crossAxis:0);g<C?g=C:g>_&&(g=_)}return{[h]:p,[f]:g}}}},OW=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...c}=xi(e,t),u=await ch(t,c),f=bi(o),h=qu(o),p=vs(o)==="y",{width:g,height:v}=s.floating;let y,x;f==="top"||f==="bottom"?(y=f,x=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(x=f,y=h==="end"?"top":"bottom");const b=v-u.top-u.bottom,w=g-u.left-u.right,E=Ia(v-u[y],b),C=Ia(g-u[x],w),_=!t.middlewareData.shift;let N=E,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=b),_&&!h){const A=Br(u.left,0),U=Br(u.right,0),L=Br(u.top,0),K=Br(u.bottom,0);p?P=g-2*(A!==0||U!==0?A+U:Br(u.left,u.right)):N=v-2*(L!==0||K!==0?L+K:Br(u.top,u.bottom))}await l({...t,availableWidth:P,availableHeight:N});const j=await i.getDimensions(a.floating);return g!==j.width||v!==j.height?{reset:{rects:!0}}:{}}}};function Qv(){return typeof window<"u"}function Yu(e){return gR(e)?(e.nodeName||"").toLowerCase():"#document"}function Yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Is(e){var t;return(t=(gR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gR(e){return Qv()?e instanceof Node||e instanceof Yr(e).Node:!1}function Qo(e){return Qv()?e instanceof Element||e instanceof Yr(e).Element:!1}function Cs(e){return Qv()?e instanceof HTMLElement||e instanceof Yr(e).HTMLElement:!1}function PN(e){return!Qv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Yr(e).ShadowRoot}const jW=new Set(["inline","contents"]);function Yh(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=es(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!jW.has(o)}const MW=new Set(["table","td","th"]);function RW(e){return MW.has(Yu(e))}const AW=[":popover-open",":modal"];function ey(e){return AW.some(t=>{try{return e.matches(t)}catch{return!1}})}const IW=["transform","translate","scale","rotate","perspective"],DW=["transform","translate","scale","rotate","perspective","filter"],LW=["paint","layout","strict","content"];function OS(e){const t=jS(),n=Qo(e)?es(e):e;return IW.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||DW.some(r=>(n.willChange||"").includes(r))||LW.some(r=>(n.contain||"").includes(r))}function FW(e){let t=Da(e);for(;Cs(t)&&!Nu(t);){if(OS(t))return t;if(ey(t))return null;t=Da(t)}return null}function jS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const zW=new Set(["html","body","#document"]);function Nu(e){return zW.has(Yu(e))}function es(e){return Yr(e).getComputedStyle(e)}function ty(e){return Qo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Da(e){if(Yu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||PN(e)&&e.host||Is(e);return PN(t)?t.host:t}function vR(e){const t=Da(e);return Nu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cs(t)&&Yh(t)?t:vR(t)}function uh(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vR(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Yr(o);if(s){const a=Gb(i);return t.concat(i,i.visualViewport||[],Yh(o)?o:[],a&&n?uh(a):[])}return t.concat(o,uh(o,[],n))}function Gb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yR(e){const t=es(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Cs(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Tg(n)!==s||Tg(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function MS(e){return Qo(e)?e:e.contextElement}function ru(e){const t=MS(e);if(!Cs(t))return Ss(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=yR(t);let i=(s?Tg(n.width):n.width)/r,a=(s?Tg(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const $W=Ss(0);function xR(e){const t=Yr(e);return!jS()||!t.visualViewport?$W:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BW(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Yr(e)?!1:t}function Ul(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=MS(e);let i=Ss(1);t&&(r?Qo(r)&&(i=ru(r)):i=ru(e));const a=BW(s,n,r)?xR(s):Ss(0);let l=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const h=Yr(s),p=r&&Qo(r)?Yr(r):r;let g=h,v=Gb(g);for(;v&&r&&p!==g;){const y=ru(v),x=v.getBoundingClientRect(),b=es(v),w=x.left+(v.clientLeft+parseFloat(b.paddingLeft))*y.x,E=x.top+(v.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=w,c+=E,g=Yr(v),v=Gb(g)}}return jg({width:u,height:f,x:l,y:c})}function ny(e,t){const n=ty(e).scrollLeft;return t?t.left+n:Ul(Is(e)).left+n}function bR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ny(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function VW(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Is(r),a=t?ey(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Ss(1);const u=Ss(0),f=Cs(r);if((f||!f&&!s)&&((Yu(r)!=="body"||Yh(i))&&(l=ty(r)),Cs(r))){const p=Ul(r);c=ru(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=i&&!f&&!s?bR(i,l):Ss(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 UW(e){return Array.from(e.getClientRects())}function WW(e){const t=Is(e),n=ty(e),r=e.ownerDocument.body,o=Br(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Br(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ny(e);const a=-n.scrollTop;return es(r).direction==="rtl"&&(i+=Br(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const TN=25;function HW(e,t){const n=Yr(e),r=Is(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const u=jS();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=ny(r);if(c<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-p);g<=TN&&(s-=g)}else c<=TN&&(s+=c);return{width:s,height:i,x:a,y:l}}const KW=new Set(["absolute","fixed"]);function GW(e,t){const n=Ul(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Cs(e)?ru(e):Ss(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,c=r*s.y;return{width:i,height:a,x:l,y:c}}function ON(e,t,n){let r;if(t==="viewport")r=HW(e,n);else if(t==="document")r=WW(Is(e));else if(Qo(t))r=GW(t,n);else{const o=xR(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return jg(r)}function wR(e,t){const n=Da(e);return n===t||!Qo(n)||Nu(n)?!1:es(n).position==="fixed"||wR(n,t)}function qW(e,t){const n=t.get(e);if(n)return n;let r=uh(e,[],!1).filter(a=>Qo(a)&&Yu(a)!=="body"),o=null;const s=es(e).position==="fixed";let i=s?Da(e):e;for(;Qo(i)&&!Nu(i);){const a=es(i),l=OS(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&KW.has(o.position)||Yh(i)&&!l&&wR(e,i))?r=r.filter(u=>u!==i):o=a,i=Da(i)}return t.set(e,r),r}function YW(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ey(t)?[]:qW(t,this._c):[].concat(n),r],a=i[0],l=i.reduce((c,u)=>{const f=ON(t,u,o);return c.top=Br(f.top,c.top),c.right=Ia(f.right,c.right),c.bottom=Ia(f.bottom,c.bottom),c.left=Br(f.left,c.left),c},ON(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function JW(e){const{width:t,height:n}=yR(e);return{width:t,height:n}}function XW(e,t,n){const r=Cs(t),o=Is(t),s=n==="fixed",i=Ul(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=Ss(0);function c(){l.x=ny(o)}if(r||!r&&!s)if((Yu(t)!=="body"||Yh(o))&&(a=ty(t)),r){const p=Ul(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?bR(o,a):Ss(0),f=i.left+a.scrollLeft-l.x-u.x,h=i.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:i.width,height:i.height}}function Kx(e){return es(e).position==="static"}function jN(e,t){if(!Cs(e)||es(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Is(e)===n&&(n=n.ownerDocument.body),n}function SR(e,t){const n=Yr(e);if(ey(e))return n;if(!Cs(e)){let o=Da(e);for(;o&&!Nu(o);){if(Qo(o)&&!Kx(o))return o;o=Da(o)}return n}let r=jN(e,t);for(;r&&RW(r)&&Kx(r);)r=jN(r,t);return r&&Nu(r)&&Kx(r)&&!OS(r)?n:r||FW(e)||n}const ZW=async function(e){const t=this.getOffsetParent||SR,n=this.getDimensions,r=await n(e.floating);return{reference:XW(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function QW(e){return es(e).direction==="rtl"}const eH={convertOffsetParentRelativeRectToViewportRelativeRect:VW,getDocumentElement:Is,getClippingRect:YW,getOffsetParent:SR,getElementRects:ZW,getClientRects:UW,getDimensions:JW,getScale:ru,isElement:Qo,isRTL:QW};function kR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function tH(e,t){let n=null,r;const o=Is(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:f,width:h,height:p}=c;if(a||t(),!h||!p)return;const g=Gp(f),v=Gp(o.clientWidth-(u+h)),y=Gp(o.clientHeight-(f+p)),x=Gp(u),w={rootMargin:-g+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Br(0,Ia(1,l))||1};let E=!0;function C(_){const N=_[0].intersectionRatio;if(N!==l){if(!E)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!kR(c,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function nH(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=MS(e),u=o||s?[...c?uh(c):[],...uh(t)]:[];u.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const f=c&&a?tH(c,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(x=>{let[b]=x;b&&b.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let g,v=l?Ul(e):null;l&&y();function y(){const x=Ul(e);v&&!kR(v,x)&&n(),v=x,g=requestAnimationFrame(y)}return n(),()=>{var x;u.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f==null||f(),(x=p)==null||x.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const rH=_W,oH=PW,sH=EW,iH=OW,aH=CW,MN=kW,lH=TW,cH=(e,t,n)=>{const r=new Map,o={platform:eH,...n},s={...o.platform,_c:r};return SW(e,t,{...o,platform:s})};var uH=typeof document<"u",dH=function(){},wm=uH?m.useLayoutEffect:dH;function Mg(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(!Mg(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Mg(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ER(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function RN(e,t){const n=ER(e);return Math.round(t*n)/n}function Gx(e){const t=m.useRef(e);return wm(()=>{t.current=e}),t}function fH(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(r);Mg(h,r)||p(r);const[g,v]=m.useState(null),[y,x]=m.useState(null),b=m.useCallback(R=>{R!==_.current&&(_.current=R,v(R))},[]),w=m.useCallback(R=>{R!==N.current&&(N.current=R,x(R))},[]),E=s||g,C=i||y,_=m.useRef(null),N=m.useRef(null),P=m.useRef(u),j=l!=null,A=Gx(l),U=Gx(o),L=Gx(c),K=m.useCallback(()=>{if(!_.current||!N.current)return;const R={placement:t,strategy:n,middleware:h};U.current&&(R.platform=U.current),cH(_.current,N.current,R).then($=>{const J={...$,isPositioned:L.current!==!1};W.current&&!Mg(P.current,J)&&(P.current=J,Hr.flushSync(()=>{f(J)}))})},[h,t,n,U,L]);wm(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[c]);const W=m.useRef(!1);wm(()=>(W.current=!0,()=>{W.current=!1}),[]),wm(()=>{if(E&&(_.current=E),C&&(N.current=C),E&&C){if(A.current)return A.current(E,C,K);K()}},[E,C,K,A,j]);const V=m.useMemo(()=>({reference:_,floating:N,setReference:b,setFloating:w}),[b,w]),H=m.useMemo(()=>({reference:E,floating:C}),[E,C]),z=m.useMemo(()=>{const R={position:n,left:0,top:0};if(!H.floating)return R;const $=RN(H.floating,u.x),J=RN(H.floating,u.y);return a?{...R,transform:"translate("+$+"px, "+J+"px)",...ER(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:J}},[n,a,H.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:K,refs:V,elements:H,floatingStyles:z}),[u,K,V,H,z])}const hH=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?MN({element:r.current,padding:o}).fn(n):{}:r?MN({element:r,padding:o}).fn(n):{}}}},pH=(e,t)=>({...rH(e),options:[e,t]}),mH=(e,t)=>({...oH(e),options:[e,t]}),gH=(e,t)=>({...lH(e),options:[e,t]}),vH=(e,t)=>({...sH(e),options:[e,t]}),yH=(e,t)=>({...iH(e),options:[e,t]}),xH=(e,t)=>({...aH(e),options:[e,t]}),bH=(e,t)=>({...hH(e),options:[e,t]});var wH="Arrow",CR=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return d.jsx(Oe.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});CR.displayName=wH;var SH=CR;function RS(e){const[t,n]=m.useState(void 0);return En(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;i=c.inlineSize,a=c.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var AS="Popper",[NR,Ds]=dr(AS),[kH,_R]=NR(AS),PR=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return d.jsx(kH,{scope:t,anchor:r,onAnchorChange:o,children:n})};PR.displayName=AS;var TR="PopperAnchor",OR=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=_R(TR,n),i=m.useRef(null),a=Ue(t,i),l=m.useRef(null);return m.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||i.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:d.jsx(Oe.div,{...o,ref:a})});OR.displayName=TR;var IS="PopperContent",[EH,CH]=NR(IS),jR=m.forwardRef((e,t)=>{var Z,Pe,De,ge,$e,je;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=e,y=_R(IS,n),[x,b]=m.useState(null),w=Ue(t,it=>b(it)),[E,C]=m.useState(null),_=RS(E),N=(_==null?void 0:_.width)??0,P=(_==null?void 0:_.height)??0,j=r+(s!=="center"?"-"+s:""),A=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],L=U.length>0,K={padding:A,boundary:U.filter(_H),altBoundary:L},{refs:W,floatingStyles:V,placement:H,isPositioned:z,middlewareData:R}=fH({strategy:"fixed",placement:j,whileElementsMounted:(...it)=>nH(...it,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[pH({mainAxis:o+P,alignmentAxis:i}),l&&mH({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?gH():void 0,...K}),l&&vH({...K}),yH({...K,apply:({elements:it,rects:St,availableWidth:Jt,availableHeight:T})=>{const{width:S,height:k}=St.reference,O=it.floating.style;O.setProperty("--radix-popper-available-width",`${Jt}px`),O.setProperty("--radix-popper-available-height",`${T}px`),O.setProperty("--radix-popper-anchor-width",`${S}px`),O.setProperty("--radix-popper-anchor-height",`${k}px`)}}),E&&bH({element:E,padding:a}),PH({arrowWidth:N,arrowHeight:P}),h&&xH({strategy:"referenceHidden",...K})]}),[$,J]=AR(H),G=An(g);En(()=>{z&&(G==null||G())},[z,G]);const ie=(Z=R.arrow)==null?void 0:Z.x,Xe=(Pe=R.arrow)==null?void 0:Pe.y,He=((De=R.arrow)==null?void 0:De.centerOffset)!==0,[ce,pe]=m.useState();return En(()=>{x&&pe(window.getComputedStyle(x).zIndex)},[x]),d.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:z?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ge=R.transformOrigin)==null?void 0:ge.x,($e=R.transformOrigin)==null?void 0:$e.y].join(" "),...((je=R.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(EH,{scope:n,placedSide:$,onArrowChange:C,arrowX:ie,arrowY:Xe,shouldHideArrow:He,children:d.jsx(Oe.div,{"data-side":$,"data-align":J,...v,ref:w,style:{...v.style,animation:z?void 0:"none"}})})})});jR.displayName=IS;var MR="PopperArrow",NH={top:"bottom",right:"left",bottom:"top",left:"right"},RR=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=CH(MR,r),i=NH[s.placedSide];return d.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:d.jsx(SH,{...o,ref:n,style:{...o.style,display:"block"}})})});RR.displayName=MR;function _H(e){return e!==null}var PH=e=>({name:"transformOrigin",options:e,fn(t){var y,x,b;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[c,u]=AR(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,p=(((b=o.arrow)==null?void 0:b.y)??0)+l/2;let g="",v="";return c==="bottom"?(g=i?f:`${h}px`,v=`${-l}px`):c==="top"?(g=i?f:`${h}px`,v=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,v=i?f:`${p}px`):c==="left"&&(g=`${r.floating.width+l}px`,v=i?f:`${p}px`),{data:{x:g,y:v}}}});function AR(e){const[t,n="center"]=e.split("-");return[t,n]}var Jh=PR,Ju=OR,Xh=jR,Zh=RR,TH="Portal",Xu=m.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=m.useState(!1);En(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?k$.createPortal(d.jsx(Oe.div,{...r,ref:t}),i):null});Xu.displayName=TH;function OH(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var fn=e=>{const{present:t,children:n}=e,r=jH(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=Ue(r.ref,MH(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:s}):null};fn.displayName="Presence";function jH(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),s=m.useRef("none"),i=e?"mounted":"unmounted",[a,l]=OH(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=qp(r.current);s.current=a==="mounted"?c:"none"},[a]),En(()=>{const c=r.current,u=o.current;if(u!==e){const h=s.current,p=qp(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]),En(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,f=p=>{const v=qp(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(l("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=p=>{p.target===t&&(s.current=qp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function qp(e){return(e==null?void 0:e.animationName)||"none"}function MH(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 RH=Symbol("radix.slottable");function AH(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=RH,t}var IH=u1[" useInsertionEffect ".trim().toString()]||En;function Zr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=DH({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const u=m.useRef(e!==void 0);m.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=m.useCallback(u=>{var f;if(a){const h=LH(u)?u(e):u;h!==e&&((f=i.current)==null||f.call(i,h))}else s(u)},[a,e,s,i]);return[l,c]}function DH({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),s=m.useRef(t);return IH(()=>{s.current=t},[t]),m.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function LH(e){return typeof e=="function"}var IR=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),FH="VisuallyHidden",DR=m.forwardRef((e,t)=>d.jsx(Oe.span,{...e,ref:t,style:{...IR,...e.style}}));DR.displayName=FH;var zH=DR,[ry]=dr("Tooltip",[Ds]),oy=Ds(),LR="TooltipProvider",$H=700,qb="tooltip.open",[BH,DS]=ry(LR),FR=e=>{const{__scopeTooltip:t,delayDuration:n=$H,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=m.useRef(!0),a=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(BH,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:m.useCallback(c=>{a.current=c},[]),disableHoverableContent:o,children:s})};FR.displayName=LR;var dh="Tooltip",[VH,Qh]=ry(dh),zR=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,l=DS(dh,e.__scopeTooltip),c=oy(t),[u,f]=m.useState(null),h=qr(),p=m.useRef(0),g=i??l.disableHoverableContent,v=a??l.delayDuration,y=m.useRef(!1),[x,b]=Zr({prop:r,defaultProp:o??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(qb))):l.onClose(),s==null||s(N)},caller:dh}),w=m.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),E=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),C=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),_=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},v)},[v,b]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),d.jsx(Jh,{...c,children:d.jsx(VH,{scope:t,contentId:h,open:x,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?_():E()},[l.isOpenDelayedRef,_,E]),onTriggerLeave:m.useCallback(()=>{g?C():(window.clearTimeout(p.current),p.current=0)},[C,g]),onOpen:E,onClose:C,disableHoverableContent:g,children:n})})};zR.displayName=dh;var Yb="TooltipTrigger",LS=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Qh(Yb,n),s=DS(Yb,n),i=oy(n),a=m.useRef(null),l=Ue(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),d.jsx(Ju,{asChild:!0,...i,children:d.jsx(Oe.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:ne(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ne(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:ne(e.onBlur,o.onClose),onClick:ne(e.onClick,o.onClose)})})});LS.displayName=Yb;var FS="TooltipPortal",[UH,WH]=ry(FS,{forceMount:void 0}),$R=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Qh(FS,t);return d.jsx(UH,{scope:t,forceMount:n,children:d.jsx(fn,{present:n||s.open,children:d.jsx(Xu,{asChild:!0,container:o,children:r})})})};$R.displayName=FS;var _u="TooltipContent",BR=m.forwardRef((e,t)=>{const n=WH(_u,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Qh(_u,e.__scopeTooltip);return d.jsx(fn,{present:r||i.open,children:i.disableHoverableContent?d.jsx(VR,{side:o,...s,ref:t}):d.jsx(HH,{side:o,...s,ref:t})})}),HH=m.forwardRef((e,t)=>{const n=Qh(_u,e.__scopeTooltip),r=DS(_u,e.__scopeTooltip),o=m.useRef(null),s=Ue(t,o),[i,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),p=m.useCallback((g,v)=>{const y=g.currentTarget,x={x:g.clientX,y:g.clientY},b=JH(x,y.getBoundingClientRect()),w=XH(x,b),E=ZH(v.getBoundingClientRect()),C=e7([...w,...E]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const g=y=>p(y,u),v=y=>p(y,l);return l.addEventListener("pointerleave",g),u.addEventListener("pointerleave",v),()=>{l.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",v)}}},[l,u,p,h]),m.useEffect(()=>{if(i){const g=v=>{const y=v.target,x={x:v.clientX,y:v.clientY},b=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),w=!QH(x,i);b?h():w&&(h(),c())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,u,i,c,h]),d.jsx(VR,{...e,ref:s})}),[KH,GH]=ry(dh,{isInside:!1}),qH=AH("TooltipContent"),VR=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=Qh(_u,n),c=oy(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(qb,u),()=>document.removeEventListener(qb,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),d.jsx(lc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:d.jsxs(Xh,{"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:[d.jsx(qH,{children:r}),d.jsx(KH,{scope:n,isInside:!0,children:d.jsx(zH,{id:l.contentId,role:"tooltip",children:o||r})})]})})});BR.displayName=_u;var UR="TooltipArrow",YH=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=oy(n);return GH(UR,n).isInside?null:d.jsx(Zh,{...o,...r,ref:t})});YH.displayName=UR;function JH(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function XH(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 ZH(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 QH(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],l=t[i],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(o=!o)}return o}function e7(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),t7(t)}function t7(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 n7=FR,r7=zR,o7=LS,WR=BR;function HR(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=HR(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function KR(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=HR(e))&&(r&&(r+=" "),r+=t);return r}const zS="-",s7=e=>{const t=a7(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(zS);return a[0]===""&&a.length!==1&&a.shift(),GR(a,t)||i7(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},GR=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?GR(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(zS);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},AN=/^\[(.+)\]$/,i7=e=>{if(AN.test(e)){const t=AN.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},a7=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return c7(Object.entries(e.classGroups),n).forEach(([s,i])=>{Jb(i,r,s,t)}),r},Jb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:IN(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(l7(o)){Jb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Jb(i,IN(t,s),n,r)})})},IN=(e,t)=>{let n=e;return t.split(zS).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},l7=e=>e.isThemeGetter,c7=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,u7=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},qR="!",d7=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const l=[];let c=0,u=0,f;for(let y=0;y<a.length;y++){let x=a[y];if(c===0){if(x===o&&(r||a.slice(y,y+s)===t)){l.push(a.slice(u,y)),u=y+s;continue}if(x==="/"){f=y;continue}}x==="["?c++:x==="]"&&c--}const h=l.length===0?a:a.substring(u),p=h.startsWith(qR),g=p?h.substring(1):h,v=f&&f>u?f-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:i}):i},f7=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},h7=e=>({cache:u7(e.cacheSize),parseClassName:d7(e),...s7(e)}),p7=/\s+/,m7=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(p7);let a="";for(let l=i.length-1;l>=0;l-=1){const c=i[l],{modifiers:u,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let g=!!p,v=r(g?h.substring(0,p):h);if(!v){if(!g){a=c+(a.length>0?" "+a:a);continue}if(v=r(h),!v){a=c+(a.length>0?" "+a:a);continue}g=!1}const y=f7(u).join(":"),x=f?y+qR:y,b=x+v;if(s.includes(b))continue;s.push(b);const w=o(v,g);for(let E=0;E<w.length;++E){const C=w[E];s.push(x+C)}a=c+(a.length>0?" "+a:a)}return a};function g7(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=YR(t))&&(r&&(r+=" "),r+=n);return r}const YR=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=YR(e[r]))&&(n&&(n+=" "),n+=t);return n};function v7(e,...t){let n,r,o,s=i;function i(l){const c=t.reduce((u,f)=>f(u),e());return n=h7(c),r=n.cache.get,o=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=m7(l,n);return o(l,u),u}return function(){return s(g7.apply(null,arguments))}}const Tt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},JR=/^\[(?:([a-z-]+):)?(.+)\]$/i,y7=/^\d+\/\d+$/,x7=new Set(["px","full","screen"]),b7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,w7=/\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$/,S7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,k7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,E7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Bs=e=>ou(e)||x7.has(e)||y7.test(e),Fi=e=>Zu(e,"length",M7),ou=e=>!!e&&!Number.isNaN(Number(e)),qx=e=>Zu(e,"number",ou),Id=e=>!!e&&Number.isInteger(Number(e)),C7=e=>e.endsWith("%")&&ou(e.slice(0,-1)),Ke=e=>JR.test(e),zi=e=>b7.test(e),N7=new Set(["length","size","percentage"]),_7=e=>Zu(e,N7,XR),P7=e=>Zu(e,"position",XR),T7=new Set(["image","url"]),O7=e=>Zu(e,T7,A7),j7=e=>Zu(e,"",R7),Dd=()=>!0,Zu=(e,t,n)=>{const r=JR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},M7=e=>w7.test(e)&&!S7.test(e),XR=()=>!1,R7=e=>k7.test(e),A7=e=>E7.test(e),I7=()=>{const e=Tt("colors"),t=Tt("spacing"),n=Tt("blur"),r=Tt("brightness"),o=Tt("borderColor"),s=Tt("borderRadius"),i=Tt("borderSpacing"),a=Tt("borderWidth"),l=Tt("contrast"),c=Tt("grayscale"),u=Tt("hueRotate"),f=Tt("invert"),h=Tt("gap"),p=Tt("gradientColorStops"),g=Tt("gradientColorStopPositions"),v=Tt("inset"),y=Tt("margin"),x=Tt("opacity"),b=Tt("padding"),w=Tt("saturate"),E=Tt("scale"),C=Tt("sepia"),_=Tt("skew"),N=Tt("space"),P=Tt("translate"),j=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",Ke,t],L=()=>[Ke,t],K=()=>["",Bs,Fi],W=()=>["auto",ou,Ke],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",Ke],J=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[ou,Ke];return{cacheSize:500,separator:":",theme:{colors:[Dd],spacing:[Bs,Fi],blur:["none","",zi,Ke],brightness:G(),borderColor:[e],borderRadius:["none","","full",zi,Ke],borderSpacing:L(),borderWidth:K(),contrast:G(),grayscale:$(),hueRotate:G(),invert:$(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[C7,Fi],inset:U(),margin:U(),opacity:G(),padding:L(),saturate:G(),scale:G(),sepia:$(),skew:G(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",Ke]}],container:["container"],columns:[{columns:[zi]}],"break-after":[{"break-after":J()}],"break-before":[{"break-before":J()}],"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:[...V(),Ke]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],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",Id,Ke]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ke]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",Id,Ke]}],"grid-cols":[{"grid-cols":[Dd]}],"col-start-end":[{col:["auto",{span:["full",Id,Ke]},Ke]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[Dd]}],"row-start-end":[{row:["auto",{span:[Id,Ke]},Ke]}],"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",Ke]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ke]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ke,t]}],"min-w":[{"min-w":[Ke,t,"min","max","fit"]}],"max-w":[{"max-w":[Ke,t,"none","full","min","max","fit","prose",{screen:[zi]},zi]}],h:[{h:[Ke,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ke,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ke,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ke,t,"auto","min","max","fit"]}],"font-size":[{text:["base",zi,Fi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qx]}],"font-family":[{font:[Dd]}],"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",Ke]}],"line-clamp":[{"line-clamp":["none",ou,qx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Bs,Ke]}],"list-image":[{"list-image":["none",Ke]}],"list-style-type":[{list:["none","disc","decimal",Ke]}],"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:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Bs,Fi]}],"underline-offset":[{"underline-offset":["auto",Bs,Ke]}],"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:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ke]}],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",Ke]}],"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:[...V(),P7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},O7]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"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:[...H(),"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:H()}],"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:["",...H()]}],"outline-offset":[{"outline-offset":[Bs,Ke]}],"outline-w":[{outline:[Bs,Fi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Bs,Fi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",zi,j7]}],"shadow-color":[{shadow:[Dd]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",zi,Ke]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"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":[f]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ke]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",Ke]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ke]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Id,Ke]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ke]}],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",Ke]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",Ke]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Bs,Fi,qx]}],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"]}}},D7=v7(I7);function de(...e){return D7(KR(e))}const L7=n7,Kr=r7,yo=o7,vr=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>d.jsx(WR,{ref:r,sideOffset:t,className:de("z-50 overflow-hidden rounded-md border bg-bg-primary px-3 py-2 text-sm text-fg-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}));vr.displayName=WR.displayName;const st=_e.createContext(new Proxy({},{get:()=>{throw new Error("Cannot use ValContext outside of ValProvider")}}));function F7(){return m.useContext(st).client}function ZR({children:e,client:t,dispatchValEvents:n}){var J,G,ie,Xe,He;const[r,o,s,i,a,l]=OU(t),c=m.useMemo(()=>new BU(t,(ce,pe)=>{n&&WU(ce,pe)}),[n]),u="data"in r&&r.data?r.data.config:void 0,[f,h]=m.useState();m.useEffect(()=>{if(f===void 0||f===!0)if(l){const ce=setTimeout(()=>{h(l)},2e3);return()=>{clearTimeout(ce)}}else l||h(!1)},[l,f]);const[p,g]=m.useState((u==null?void 0:u.defaultTheme)||null);m.useEffect(()=>{const ce=localStorage.getItem("val-theme-"+((u==null?void 0:u.project)||"unknown"));ce==="light"||ce==="dark"?g(ce):u!=null&&u.defaultTheme&&((u==null?void 0:u.defaultTheme)==="dark"||(u==null?void 0:u.defaultTheme)==="light"?g(u.defaultTheme):console.warn(`Invalid config default theme: ${u.defaultTheme}`))},[u]);const v=m.useRef(null),y="data"in r&&r.data?r.data.baseSha:void 0,[x,b]=m.useState([]),w=m.useRef(new Set);m.useEffect(()=>{"data"in r&&r.data&&b(ce=>{var pe,Z,Pe,De,ge,$e;return(pe=r.data)!=null&&pe.deployments&&((Z=r.data.deployments)==null?void 0:Z.length)>0||(Pe=r.data)!=null&&Pe.commits&&((De=r.data.commits)==null?void 0:De.length)>0?HU(ce,((ge=r.data)==null?void 0:ge.commits)||[],(($e=r.data)==null?void 0:$e.deployments)||[]).filter(je=>!w.current.has(je.commitSha)):ce})},["data"in r&&((J=r.data)==null?void 0:J.deployments)&&((G=r.data)==null?void 0:G.deployments.length),"data"in r&&((ie=r.data)==null?void 0:ie.commits)&&((Xe=r.data)==null?void 0:Xe.commits.length)]);const E=m.useCallback(ce=>{b(pe=>pe.filter(Z=>Z.commitSha!==ce)),w.current.add(ce)},[]),[C,_]=m.useState(new Set);m.useEffect(()=>{var ce;"data"in r&&((ce=r.data)!=null&&ce.commitSha)&&_(pe=>{var Pe;if(((Pe=r.data)==null?void 0:Pe.commitSha)===void 0||pe.has(r.data.commitSha))return pe;const Z=new Set(pe);return Z.add(r.data.commitSha),Z})},["data"in r&&((He=r.data)==null?void 0:He.commitSha)]);const[N,P]=m.useState({status:"not-asked"}),[j,A]=m.useState(!1),U=m.useSyncExternalStore(c.subscribe("schema"),()=>c.getAllSchemasSnapshot(),()=>c.getAllSchemasSnapshot());m.useEffect(()=>{if(U){const ce=U;let pe=!1;for(const Z of Object.values(ce))if(Hd(Z)){pe=!0;break}A(pe)}},[U]),m.useEffect(()=>{let ce=0;function pe(){ce++,N.status!=="ready"&&ce<10&&t("/remote/settings","GET",{}).then(Z=>{Z.status===200?P({status:"ready",coreVersion:Z.json.coreVersion,buckets:Z.json.remoteFileBuckets.map(Pe=>Pe.bucket),publicProjectId:Z.json.publicProjectId}):("errorCode"in Z.json&&Z.json.errorCode?P({status:"inactive",reason:Z.json.errorCode,message:Z.json.message}):P({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(pe,5e3))}).catch(Z=>{console.error("Error getting remote settings",Z),P({status:"inactive",reason:"unknown-error",message:"An unknown error has occurred"}),setTimeout(pe,5e3)})}j&&(P({status:"loading"}),pe())},[j]);const L=m.useRef("not-initialized"),[K,W]=m.useState(!1),V=cc(c);m.useEffect(()=>{if(V===null&&L.current==="done"&&(L.current="not-initialized"),"data"in r&&r.data&&L.current==="not-initialized"){L.current="in-progress";let ce=null;const pe=async()=>{if("data"in r&&r.data){console.debug("ValSyncEngine init started...",r.data.profileId);const Z=await c.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",Z),Z.status==="retry"?(L.current="retry",ce=setTimeout(pe,4e3)):(console.debug("Val is initialized!",Z),L.current="done",ce&&clearTimeout(ce),W(!0))}else throw L.current="not-initialized",Error("Unexpected state: init was started with stat.data but now it is not there")};return pe(),()=>{ce&&clearTimeout(ce)}}else"data"in r&&r.data&&L.current==="done"&&c.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,c,V]),m.useEffect(()=>{if(!K)return;let ce=null;const pe=async()=>{if(V===null){W(!1),L.current="not-initialized";return}await c.sync(Date.now()),ce&&clearTimeout(ce),ce=setTimeout(pe,1e3)};return pe(),()=>{ce&&clearTimeout(ce)}},[c,V,K]);const[H,z]=m.useState({type:"not-asked"}),R=m.useSyncExternalStore(c.subscribe("pending-ops-count"),()=>c.getPendingOpsSnapshot(),()=>c.getPendingOpsSnapshot());m.useEffect(()=>{const ce=pe=>{R>0&&(pe.preventDefault(),pe.returnValue="")};return window.addEventListener("beforeunload",ce),()=>{window.removeEventListener("beforeunload",ce)}},[R]);const $=z7(t,s,l);return d.jsx(st.Provider,{value:{client:t,publishSummaryState:H,setPublishSummaryState:z,syncEngine:c,profileId:"data"in r&&r.data?r.data.profileId:null,mode:"data"in r&&r.data?r.data.mode:"unknown",serviceUnavailable:f,baseSha:y,observedCommitShas:C,deployments:x,dismissDeployment:E,portalRef:v.current,authenticationState:s,theme:p,setTheme:ce=>{if(ce==="dark"||ce==="light"){try{localStorage.setItem("val-theme-"+((u==null?void 0:u.project)||"unknown"),ce),localStorage.setItem("val-theme-unknown",ce)}catch(pe){console.error("Error setting theme in local storage",pe)}g(ce)}else console.warn(`Cannot set invalid theme theme: ${ce}`)},config:u,profiles:"data"in $&&$.data?$.data:{},remoteFiles:N},children:d.jsx(L7,{children:d.jsxs(ZM,{initialProps:{mode:"default"},children:[d.jsx("div",{"data-val-portal":"true",ref:v,...p?{"data-mode":p}:{}}),e]})})})}function z7(e,t,n){const r=m.useRef(!0),[o,s]=m.useState({status:"not-asked"}),i=m.useCallback(async()=>{s(l=>({status:"loading",data:"data"in l?l.data:void 0}));const a=await e("/profiles","GET",{});if(a.status===200){const l={};for(const c of a.json.profiles)l[c.profileId]={fullName:c.fullName,email:c.email,avatar:c.avatar};s({status:"done",data:l})}else console.error("Could not get profiles",a.json),r.current=!0,s(l=>({status:"error",data:"data"in l?l.data:void 0}))},[e,o]);return m.useEffect(()=>{r.current&&(r.current=!1,o.status==="error"?setTimeout(()=>i(),2e3):o.status==="not-asked"&&i())},[t,e,o,n]),o}function Nn(){return m.useContext(st).portalRef}function sy(){const{theme:e,setTheme:t}=m.useContext(st);return{theme:e,setTheme:t}}function Qu(){const{config:e}=m.useContext(st),t=m.useRef(e&&{...e,remoteHost:HC,appHost:jb,studioPrefix:"/val/~"});return m.useEffect(()=>{e&&(t.current={...e,remoteHost:HC,appHost:jb,studioPrefix:"/val/~"})},[e]),t.current}function $S(){const{remoteFiles:e}=m.useContext(st);return e}function BS(){const{remoteFiles:e}=m.useContext(st),[t,n]=m.useState(null);function r(o){return Math.floor(Math.random()*o)}return m.useEffect(()=>{e.status==="ready"&&e.buckets.length>0&&t===null&&n(e.buckets[r(e.buckets.length)])},[e]),t}function QR(){const{authenticationState:e}=m.useContext(st);return e}function $7(){const{serviceUnavailable:e}=m.useContext(st);return e===!0?"service-unavailable":"connected"}const DN=new TextEncoder,B7=M({patchId:D().refine(e=>e.length>0),filePath:D().refine(e=>e.length>0)});function _n(e){const{syncEngine:t,client:n}=m.useContext(st),[r,o]=Y.splitModuleFilePathAndModulePath(e),s=m.useMemo(()=>Y.createPatchPath(o),[o]),i=m.useCallback((p,g)=>{t.addPatch(r,g,p,Date.now())},[t,r]),a=m.useCallback((p,g,v)=>t.addPatchAwaitable(r,g,p,v,Date.now()),[t,r]),l=m.useCallback((p,g,v)=>{t.addPatch(p,v,g,Date.now())},[t]),c=m.useCallback(async()=>{let p=await n("/direct-file-upload-settings","POST",{}),g=0;for(;p.status===null&&g<5;)console.warn("Failed to get direct file upload settings, retrying...",p),await new Promise(v=>setTimeout(v,500*(g+1))),p=await n("/direct-file-upload-settings","POST",{}),g++;return p.status===200?{status:"success",data:p.json}:{status:"error",error:"Could not get direct file upload settings"}},[n]),u=m.useCallback(async(p,g,v,y,x,b,w)=>{const E=g?{"x-val-auth-nonce":g}:{},{filePath:C,value:_,metadata:N,remote:P}=b;let j;if(P){const L=Y.remote.splitRemoteRef(C);if(L.status==="error")return Promise.reject({status:"error",error:{message:`Could not create correct file path of remote file (${L.error}). This is most likely a Val bug.`}});j="/"+L.filePath}else j=C;const A=JSON.stringify({filePath:j,parentRef:v,data:_,type:x,metadata:N,remote:P}),U=DN.encode(A).length;return w(0,U),new Promise(L=>{const K=new XMLHttpRequest;K.upload.addEventListener("progress",W=>{W.lengthComputable&&w(W.loaded,W.total)}),K.addEventListener("load",()=>{if(K.status>=200&&K.status<300)try{const W=K.responseText,V=JSON.parse(W),H=B7.safeParse(V);H.success?L({status:"done",patchId:H.data.patchId,filePath:H.data.filePath}):L({status:"error",error:{message:`While saving a file we got an unexpected response (${W==null?void 0:W.slice(0,100)}...)`}})}catch(W){L({status:"error",error:{message:`Got an exception while saving a file. Error: ${W instanceof Error?W.message:String(W)}`}})}else L({status:"error",error:{message:"Could not save patch file. HTTP error: "+K.status+" "+K.statusText}})}),K.addEventListener("error",()=>{L({status:"error",error:{message:"Could save source file (network error?)"}})}),K.addEventListener("abort",()=>{L({status:"error",error:{message:"Upload was aborted"}})}),K.responseType="text",K.open("POST",`${p}/patches/${y}/files`),K.setRequestHeader("Content-Type","application/json");for(const[W,V]of Object.entries(E))K.setRequestHeader(W,V);K.send(A)})},[]),f=m.useSyncExternalStore(t.subscribe("parent-ref"),()=>t.getParentRefSnapshot(),()=>t.getParentRefSnapshot()),h=m.useCallback(async(p,g,v,y)=>{if(f===null){v("Cannot upload files yet. Not initialized.");return}const x=await c();if(x.status!=="success"){v(x.error);return}const{baseUrl:b,nonce:w}=x.data,E=[],C=[];for(const j of p)j.op==="file"?(E.push(j),C.push({...j,value:typeof j.value=="string"?Y.getSHA256Hash(DN.encode(j.value)):j.value})):C.push(j);const _=t.createPatchId();let N=0;for(const j of E){const A=await u(b,w,f,_,g,j,(U,L)=>{y(U,L,N,E.length)});if(A.status==="error"){v(A.error.message);return}N++}const P=await a(C,g,_);if(P.status!=="patch-synced"){v(P.message);return}},[c,a,u,f,t]);return{patchPath:s,addPatch:i,addAndUploadPatchWithFileOps:h,addModuleFilePatch:l}}function eA(){const{syncEngine:e}=m.useContext(st);return{deletePatches:m.useCallback(n=>{const r=[];for(let o=0;o<n.length;o+=100)r.push(n.slice(o,o+100));for(const o of r)e.deletePatches(o,Date.now())},[e])}}function V7(){const{deployments:e,dismissDeployment:t,observedCommitShas:n}=m.useContext(st);return{deployments:e,dismissDeployment:t,observedCommitShas:n}}function U7(){const{syncEngine:e}=m.useContext(st);return{status:"success",data:m.useSyncExternalStore(e.subscribe("patch-sets"),()=>e.getSerializedPatchSetsSnapshot(),()=>e.getSerializedPatchSetsSnapshot())}}function W7(){const{syncEngine:e}=m.useContext(st),t=m.useSyncExternalStore(e.subscribe("all-patches"),()=>e.getAllPatchesSnapshot(),()=>e.getAllPatchesSnapshot()),n=ep();return m.useMemo(()=>{const o=new Set;for(const s of n){const i=t[s];i!=null&&i.isCommitted&&o.add(s)}return o},[t,n])}function tA(){const{syncEngine:e}=m.useContext(st);return m.useSyncExternalStore(e.subscribe("global-server-side-patch-ids"),()=>e.getGlobalServerSidePatchIdsSnapshot(),()=>e.getGlobalServerSidePatchIdsSnapshot())}function nA(){const{syncEngine:e}=m.useContext(st);return m.useSyncExternalStore(e.subscribe("pending-client-side-patch-ids"),()=>e.getPendingClientSidePatchIdsSnapshot(),()=>e.getPendingClientSidePatchIdsSnapshot())}function ep(){const{syncEngine:e}=m.useContext(st),t=tA(),n=nA(),r=m.useSyncExternalStore(e.subscribe("saved-server-side-patch-ids"),()=>e.getSavedServerSidePatchIdsSnapshot(),()=>e.getSavedServerSidePatchIdsSnapshot());return m.useMemo(()=>{const s=new Set,i=[];for(const a of t)s.has(a)||i.push(a),s.add(a);for(const a of r)s.has(a)||i.push(a),s.add(a);for(const a of n)s.has(a)||i.push(a),s.add(a);return i},[t,n,r])}function ed(){const{mode:e}=m.useContext(st);return e}function iy(){const{syncEngine:e}=m.useContext(st);return m.useSyncExternalStore(e.subscribe("pending-ops-count"),()=>e.getPendingOpsSnapshot(),()=>e.getPendingOpsSnapshot())>0?"loading":"success"}const H7=we([M({type:I("not-asked"),isGenerating:We().optional()}),M({type:I("manual").or(I("ai")),text:D(),patchIds:Se(D()).nullable(),isGenerating:We()})]);function tp(){const{syncEngine:e,client:t,publishSummaryState:n,setPublishSummaryState:r,config:o}=m.useContext(st),s=ep(),i=m.useSyncExternalStore(e.subscribe("publish-disabled"),()=>e.getPublishDisabledSnapshot(),()=>e.getPublishDisabledSnapshot()),{patchErrors:a}=oA(),l=m.useMemo(()=>{if(a)return Object.values(a).some(y=>y!==null)},[a]),[c,u]=m.useState(!1);m.useEffect(()=>{var y,x;((x=(y=o==null?void 0:o.ai)==null?void 0:y.commitMessages)==null?void 0:x.disabled)===void 0||o.ai.commitMessages.disabled===!1?u(!0):u(!1)},[o]),m.useEffect(()=>{if(n.type==="not-asked"){const y=G7(o==null?void 0:o.project);y&&y.type!=="not-asked"&&s.length>0&&r(y)}},[n,o==null?void 0:o.project,r]);const f=m.useCallback(async()=>{if(s===null)return{type:"error",message:"Empty patch set"};if("isGenerating"in n&&n.isGenerating)return{type:"error",message:"Already generating summary"};r(y=>({...y,isGenerating:!0}));try{const y=await t("/commit-summary","GET",{query:{patch_id:s}});return y.status===200?y.json.commitSummary?{type:"ai",text:y.json.commitSummary}:{type:"error",message:"Commit summary could not be generated"}:{type:"error",message:y.json.message}}finally{r(y=>({...y,isGenerating:!1}))}},[t,s,n]),[h,p]=m.useState(!1),g=m.useCallback(async y=>s===null?{status:"error",message:"No changes to publish"}:h?{status:"error",message:"Already publishing"}:(p(!0),e.publish(s,y,Date.now()).then(x=>(x.status==="done"&&(q7(o==null?void 0:o.project),r(b=>({type:"not-asked",isGenerating:b.isGenerating}))),x)).finally(()=>{p(!1)})),[s,h,o==null?void 0:o.project,e]),v=m.useCallback(y=>{r(x=>{let b;return y.type==="not-asked"?b={type:"not-asked",isGenerating:x.isGenerating}:b={type:y.type,text:y.text,patchIds:s,isGenerating:!!x.isGenerating},K7(b,o==null?void 0:o.project),b})},[s,r,o==null?void 0:o.project]);return{publish:g,publishDisabled:i||l,isPublishing:h,generateSummary:f,canGenerate:c,summary:n,setSummary:v}}function K7(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 G7(e){try{const t=localStorage.getItem("val-publish-summary-"+(e||"unknown"));if(t){const n=H7.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 q7(e){try{localStorage.removeItem("val-publish-summary-"+(e||"unknown"))}catch(t){console.error("Error deleting publish summary from local storage",t)}}function Y7(){const{profileId:e,profiles:t}=m.useContext(st);return e?t[e]??null:null}const cc=e=>m.useSyncExternalStore(e.subscribe("initialized-at"),()=>e.getInitializedAtSnapshot(),()=>e.getInitializedAtSnapshot()).data;function VS(){const{syncEngine:e}=m.useContext(st);return{autoPublish:m.useSyncExternalStore(e.subscribe("auto-publish"),()=>e.getAutoPublishSnapshot(),()=>e.getAutoPublishSnapshot()),setAutoPublish:n=>{e.setAutoPublish(Date.now(),n)}}}function US(e){const{syncEngine:t}=m.useContext(st),[n]=m.useMemo(()=>Y.splitModuleFilePathAndModulePath(e),[e]),r=m.useSyncExternalStore(t.subscribe("render",n),()=>t.getRenderSnapshot(n),()=>t.getRenderSnapshot(n)),o=m.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),s=cc(t);return m.useMemo(()=>{const i=o.status==="success"&&o.optimistic,a=r==null?void 0:r[e];return s===null||i?{status:"loading",data:a&&"data"in a?a==null?void 0:a.data:void 0}:a},[r,s,o,e])}function Vt(e){const{syncEngine:t}=m.useContext(st),[n,r]=m.useMemo(()=>Y.splitModuleFilePathAndModulePath(e),[e]),o=m.useSyncExternalStore(t.subscribe("schema"),()=>t.getSchemaSnapshot(n),()=>t.getSchemaSnapshot(n)),s=m.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),i=m.useMemo(()=>{if(o.status!=="success")return o;if(s.status!=="success")return s;let l=null;try{const c=Y.safeResolvePath(r,s.data,o.data);if(c.status==="error")return{status:"error",error:c.message};if(c.status==="source-undefined")return{status:"source-not-found"};l=c.schema}catch(c){return console.error("Error resolving schema at path",e,r,s.data,o.data,c),{status:"error",error:`Error resolving schema at path: ${c instanceof Error?c.message:String(c)}`}}return l?{status:"success",data:l}:{status:"resolved-schema-not-found"}},[o,s,n,r]);return cc(t)===null?{status:"loading"}:i.status!=="success"?i.status==="resolved-schema-not-found"?{status:"not-found"}:i.status==="no-schemas"?{status:"error",error:"No schemas"}:i.status==="module-schema-not-found"?{status:"not-found"}:{status:"loading"}:i}function Ja(){const{syncEngine:e}=m.useContext(st),t=m.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());if(cc(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,s]of Object.entries(t)){const i=o;s&&(r[i]=s)}return{status:"success",data:r}}function rA(e){const{syncEngine:t}=m.useContext(st);return m.useSyncExternalStore(t.subscribe("validation-error",e),()=>t.getValidationErrorSnapshot(e),()=>t.getValidationErrorSnapshot(e))||[]}function uc(){const{syncEngine:e}=m.useContext(st);return m.useSyncExternalStore(e.subscribe("all-validation-errors"),()=>e.getAllValidationErrorsSnapshot(),()=>e.getAllValidationErrorsSnapshot())}function J7(){const{syncEngine:e}=m.useContext(st);return{globalTransientErrors:m.useSyncExternalStore(e.subscribe("global-transient-errors"),()=>e.getGlobalTransientErrorsSnapshot(),()=>e.getGlobalTransientErrorsSnapshot()),removeGlobalTransientErrors:n=>{e.removeGlobalTransientErrors(n)}}}function X7(){const{syncEngine:e,remoteFiles:t}=m.useContext(st),n=m.useSyncExternalStore(e.subscribe("network-error"),()=>e.getNetworkErrorSnapshot(),()=>e.getNetworkErrorSnapshot());return n!==null?{type:"network-error",networkError:n}:t.status==="inactive"?{type:"remote-files-error",error:t.message,reason:t.reason}:null}function oA(){const{syncEngine:e}=m.useContext(st),[t,n]=m.useState([]),r=m.useSyncExternalStore(e.subscribe("schema"),()=>e.getAllSchemasSnapshot(),()=>e.getAllSchemasSnapshot());return m.useEffect(()=>{n(Object.keys(r))},[r]),{patchErrors:m.useSyncExternalStore(e.subscribe("patch-errors",t),()=>e.getPatchErrorsSnapshot(t),()=>e.getPatchErrorsSnapshot(t))}}function WS(){return{globalErrors:[],skippedPatches:{}}}function HS(){const{profiles:e}=m.useContext(st);return e}function ht(e,t){const{syncEngine:n}=m.useContext(st),[r,o]=e?Y.splitModuleFilePathAndModulePath(e):["",""],s=m.useSyncExternalStore(n.subscribe("source",r),()=>n.getSourceSnapshot(r),()=>n.getSourceSnapshot(r)),i=cc(n);return m.useMemo(()=>{if(i===null)return{status:"loading"};if(s.status==="success"){const l=s.data;return l!==void 0&&t!==void 0?Z7(r,o,t,l,s.optimistic):{status:"not-found"}}return{status:"error",error:s.message||"Unknown error"}},[s,o,r,i,t])}function sA(e,t){const{syncEngine:n}=m.useContext(st),r=m.useSyncExternalStore(n.subscribe("sources",e||[]),()=>n.getSourcesSnapshot(e||[]),()=>n.getSourcesSnapshot(e||[])),o=cc(n);return m.useMemo(()=>{if(o===null)return{status:"loading"};if(!r)return{status:"not-found",data:[],notFoundPaths:e||[]};const s=[],i=[],a=[];if(!e||e.length===0)return{status:"success",data:[]};for(let l=0;l<e.length;l++){const c=e==null?void 0:e[l];if(c===void 0)throw new Error("While resolving shallow modules at paths, we unexpectedly got an undefined module file path");const u=r==null?void 0:r[l];u||a.push(c);const f=lA(c,"",t,u);f.status==="success"?s.push(f.data):i.push({moduleFilePath:c,message:f.error})}return a.length>0?{status:"not-found",data:s,notFoundPaths:a}:i.length>0?{status:"error",data:s,errors:i}:{status:"success",data:s}},[r,t,o,e])}function iA(){const e=Ja();return m.useMemo(()=>{if(e.status==="success"){let t=null;for(const n in e.data){const r=_V(n);if(r){if(t===null)t=r;else if(t!==r)return{status:"error",error:"Found multiple different src folders in the same project"}}}return{status:"success",data:t}}return e},[e])}function KS(){const{syncEngine:e}=m.useContext(st);return m.useSyncExternalStore(e.subscribe("all-sources"),()=>e.getAllSourcesSnapshot(),()=>e.getAllSourcesSnapshot())}function GS(e){const{syncEngine:t}=m.useContext(st),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=m.useSyncExternalStore(t.subscribe("source",n),()=>t.getSourceSnapshot(n),()=>t.getSourceSnapshot(n)),s=cc(t);return m.useMemo(()=>s===null?{status:"loading"}:o.status==="success"?aA(r,o.data):{status:"error",error:o.message||"Unknown error"},[o,s,r,n])}function aA(e,t){let n=t;if(t===void 0)return{status:"not-found"};for(const r of Y.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(da(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 Z7(e,t,n,r,o){const s=aA(t,r);if("data"in s&&s.data!==void 0){const i=lA(e,t,n,s.data);return i.status==="success"?{status:"success",data:i.data,clientSideOnly:o}:i}return s}function lA(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(da(r))return{status:"error",error:"Expected object, got array"};const s={};for(const i of Object.keys(r))s[i]=Yx(e,t,i);return{status:"success",data:s}}else if(o==="array"){if(typeof r!="object"||!da(r))return{status:"error",error:`Expected array, got ${typeof r}`};const s=[];for(let i=0;i<r.length;i++)s.push(Yx(e,t,i));return{status:"success",data:s}}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"||!da(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"||!(Ct in r)||r[Ct]===void 0?{status:"error",error:`Expected object with ${Ct} 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(da(r))return{status:"error",error:"Expected object, got array"};const s={};for(const i of Object.keys(r))s[i]=Yx(e,t,i);return{status:"success",data:s}}else return{status:"error",error:`Unknown schema type: ${o}`}}}function Yx(e,t,n){return t?e+Ra+t+"."+JSON.stringify(n):e+Ra+n}var cA={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 s="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(s=o(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var i="";for(var a in s)t.call(s,a)&&s[a]&&(i=o(i,a));return i}function o(s,i){return i?s?s+" "+i:s+i:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(cA);var Q7=cA.exports;const Te=Ha(Q7);/**
|
|
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 eK=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uA=(...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 tK={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 nK=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>m.createElement("svg",{ref:l,...tK,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:uA("lucide",o),...a},[...i.map(([c,u])=>m.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
|
|
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=m.forwardRef(({className:r,...o},s)=>m.createElement(nK,{ref:s,iconNode:t,className:uA(`lucide-${eK(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 rK=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"}]]);/**
|
|
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 dA=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"}]]);/**
|
|
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 td=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 nd=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 oK=ve("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
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 rd=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 sK=ve("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
|
|
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 iK=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"}]]);/**
|
|
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 aK=ve("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
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 lK=ve("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
|
|
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 fA=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
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 cK=ve("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
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 uK=ve("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
|
|
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 qS=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"}]]);/**
|
|
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 dK=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"}]]);/**
|
|
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 fK=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"}]]);/**
|
|
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 hA=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"}]]);/**
|
|
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 pA=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"}]]);/**
|
|
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 hK=ve("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
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 Rg=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
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 pK=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"}]]);/**
|
|
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 mK=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"}]]);/**
|
|
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 LN=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"}]]);/**
|
|
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 FN=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"}]]);/**
|
|
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 zN=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"}]]);/**
|
|
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 $N=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"}]]);/**
|
|
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 BN=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"}]]);/**
|
|
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 VN=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"}]]);/**
|
|
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 mA=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"}]]);/**
|
|
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 gK=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"}]]);/**
|
|
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 vK=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"}]]);/**
|
|
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 yK=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"}]]);/**
|
|
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 YS=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"}]]);/**
|
|
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 xK=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"}]]);/**
|
|
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 gA=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"}]]);/**
|
|
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 Qr=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 bK=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"}]]);/**
|
|
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 wK=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"}]]);/**
|
|
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 SK=ve("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
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 kK=ve("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
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 Jx=ve("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
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 EK=ve("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
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 Ag=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"}]]);/**
|
|
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 CK=ve("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
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 Xx=ve("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/**
|
|
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 Ig=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"}]]);/**
|
|
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 NK=ve("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/**
|
|
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 JS=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 vA=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"}]]);/**
|
|
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 _K=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"}]]);/**
|
|
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 PK=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"}]]);/**
|
|
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 TK=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"}]]);/**
|
|
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 OK=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"}]]);/**
|
|
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 jK=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"}]]);/**
|
|
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 MK=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"}]]);/**
|
|
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 RK=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"}]]);/**
|
|
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 AK=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"}]]);/**
|
|
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 XS=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"}]]);/**
|
|
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 IK=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"}]]);/**
|
|
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 Pu=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
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 DK=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"}]]);/**
|
|
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 Xb=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"}]]);/**
|
|
386
|
+
* @license lucide-react v0.379.0 - ISC
|
|
387
|
+
*
|
|
388
|
+
* This source code is licensed under the ISC license.
|
|
389
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
+
*/const LK=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"}]]);/**
|
|
391
|
+
* @license lucide-react v0.379.0 - ISC
|
|
392
|
+
*
|
|
393
|
+
* This source code is licensed under the ISC license.
|
|
394
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
+
*/const Dg=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"}]]);/**
|
|
396
|
+
* @license lucide-react v0.379.0 - ISC
|
|
397
|
+
*
|
|
398
|
+
* This source code is licensed under the ISC license.
|
|
399
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
+
*/const FK=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"}]]);/**
|
|
401
|
+
* @license lucide-react v0.379.0 - ISC
|
|
402
|
+
*
|
|
403
|
+
* This source code is licensed under the ISC license.
|
|
404
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
+
*/const yA=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"}]]);/**
|
|
406
|
+
* @license lucide-react v0.379.0 - ISC
|
|
407
|
+
*
|
|
408
|
+
* This source code is licensed under the ISC license.
|
|
409
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
+
*/const Wl=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Tu({isOpen:e,children:t,duration:n=.3,className:r}){return d.jsx("div",{style:{transition:`grid-template-rows ${n}s`},className:Te("grid overflow-hidden",r,{"grid-rows-[0fr]":!e,"grid-rows-[1fr]":e}),children:d.jsx("div",{style:{transition:`visibility ${n}s`},className:Te("min-h-0",{visible:e,invisible:!e}),children:t})})}function _f(e){let t="",n=!1;for(let r=0;r<e.length;r++){const o=e[r]!==e[r].toLowerCase();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 Ou(e){return e.endsWith(".val.ts")||e.endsWith(".val.js")?_f(e.slice(0,-7)):_f(e)}const xA=_e.createContext(new Proxy({},{get:()=>{throw Error("ValRouter context not provided")}})),Zx="/val/~";function UN(e,t){var n;(n=e.getElementById("val-content-area"))==null||n.scrollTo({top:t.offsetTop,behavior:"smooth"})}function bA({children:e,overlay:t}){const[n,r]=m.useState(!1),[o,s]=m.useState(""),i=m.useRef([]);m.useEffect(()=>{const l=()=>{const c=location.pathname.indexOf(Zx);if(c>-1){const u=new URLSearchParams(location.search).get("p"),h=location.pathname.slice(c+Zx.length)+(u?`?p=${u}`:"");s(h);const p=i.current.pop();if(p)setTimeout(()=>{var v,y;const g=(y=(v=document.getElementById("val-shadow-root"))==null?void 0:v.shadowRoot)==null?void 0:y.getElementById("val-content-area");p&&(g==null||g.scrollTo(0,p))},50);else if(location.hash){const g=decodeURIComponent(location.hash.slice(1));window.history.replaceState(null,"",location.pathname+location.search);let v=100;const y=()=>{var x;if(g){const b=(x=document.getElementById("val-shadow-root"))==null?void 0:x.shadowRoot,w=b==null?void 0:b.getElementById(g);w&&b?UN(b,w):v>0&&(v--,setTimeout(y,100))}};y()}}r(!0)};return l(),window.addEventListener("popstate",l),()=>{window.removeEventListener("popstate",l)}},[]);const a=m.useCallback((l,c)=>{var f;const u=`${Zx}${l}`;if(s(l),t)window.location.href=u+(c!=null&&c.scrollToId?`#${c.scrollToId}`:"");else{const h=(f=document.getElementById("val-shadow-root"))==null?void 0:f.shadowRoot,p=h==null?void 0:h.getElementById("val-content-area"),g=p==null?void 0:p.scrollTop,v=c==null?void 0:c.scrollToId;v&&h?setTimeout(()=>{const y=h.getElementById(v);y&&h&&UN(h,y)},100):p==null||p.scrollTo(0,0),g!==void 0&&i.current.push(g),c!=null&&c.replace?window.history.replaceState(null,"",u):window.history.pushState(null,"",u)}},[t]);return d.jsx(xA.Provider,{value:{hardLink:!!t,currentSourcePath:o,navigate:a,ready:n},children:e})}function Cn(){const{navigate:e,currentSourcePath:t,ready:n}=m.useContext(xA);return{navigate:e,currentSourcePath:t,ready:n}}var zK=m.createContext(void 0);function np(e){const t=m.useContext(zK);return e||t||"ltr"}function Zb(e,[t,n]){return Math.min(n,Math.max(t,e))}function $K(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var ZS="ScrollArea",[wA]=dr(ZS),[BK,To]=wA(ZS),SA=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,l]=m.useState(null),[c,u]=m.useState(null),[f,h]=m.useState(null),[p,g]=m.useState(null),[v,y]=m.useState(null),[x,b]=m.useState(0),[w,E]=m.useState(0),[C,_]=m.useState(!1),[N,P]=m.useState(!1),j=Ue(t,U=>l(U)),A=np(o);return d.jsx(BK,{scope:n,type:r,dir:A,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:N,onScrollbarYEnabledChange:P,onCornerWidthChange:b,onCornerHeightChange:E,children:d.jsx(Oe.div,{dir:A,...i,ref:j,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});SA.displayName=ZS;var kA="ScrollAreaViewport",EA=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=To(kA,n),a=m.useRef(null),l=Ue(t,a,i.onViewportChange);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(Oe.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:d.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});EA.displayName=kA;var Ls="ScrollAreaScrollbar",QS=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=To(Ls,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return m.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?d.jsx(VK,{...r,ref:t,forceMount:n}):o.type==="scroll"?d.jsx(UK,{...r,ref:t,forceMount:n}):o.type==="auto"?d.jsx(CA,{...r,ref:t,forceMount:n}):o.type==="always"?d.jsx(ek,{...r,ref:t}):null});QS.displayName=Ls;var VK=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=To(Ls,e.__scopeScrollArea),[s,i]=m.useState(!1);return m.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),i(!0)},u=()=>{l=window.setTimeout(()=>i(!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]),d.jsx(fn,{present:n||s,children:d.jsx(CA,{"data-state":s?"visible":"hidden",...r,ref:t})})}),UK=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=To(Ls,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ly(()=>l("SCROLL_END"),100),[a,l]=$K("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 m.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),m.useEffect(()=>{const c=o.viewport,u=s?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const p=c[u];f!==p&&(l("SCROLL"),i()),f=p};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[o.viewport,s,l,i]),d.jsx(fn,{present:n||a!=="hidden",children:d.jsx(ek,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ne(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ne(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),CA=m.forwardRef((e,t)=>{const n=To(Ls,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=m.useState(!1),a=e.orientation==="horizontal",l=ly(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?c:u)}},10);return ju(n.viewport,l),ju(n.content,l),d.jsx(fn,{present:r||s,children:d.jsx(ek,{"data-state":s?"visible":"hidden",...o,ref:t})})}),ek=m.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=To(Ls,e.__scopeScrollArea),s=m.useRef(null),i=m.useRef(0),[a,l]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=OA(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function f(h,p){return YK(h,i.current,a,p)}return n==="horizontal"?d.jsx(WK,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollLeft,p=WN(h,a,o.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?d.jsx(HK,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollTop,p=WN(h,a);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),WK=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=To(Ls,e.__scopeScrollArea),[i,a]=m.useState(),l=m.useRef(null),c=Ue(t,l,s.onScrollbarXChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(_A,{"data-orientation":"horizontal",...o,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ay(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(h),MA(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Fg(i.paddingLeft),paddingEnd:Fg(i.paddingRight)}})}})}),HK=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=To(Ls,e.__scopeScrollArea),[i,a]=m.useState(),l=m.useRef(null),c=Ue(t,l,s.onScrollbarYChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(_A,{"data-orientation":"vertical",...o,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ay(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(s.viewport){const h=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(h),MA(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Fg(i.paddingTop),paddingEnd:Fg(i.paddingBottom)}})}})}),[KK,NA]=wA(Ls),_A=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=e,p=To(Ls,n),[g,v]=m.useState(null),y=Ue(t,j=>v(j)),x=m.useRef(null),b=m.useRef(""),w=p.viewport,E=r.content-r.viewport,C=An(u),_=An(l),N=ly(f,10);function P(j){if(x.current){const A=j.clientX-x.current.left,U=j.clientY-x.current.top;c({x:A,y:U})}}return m.useEffect(()=>{const j=A=>{const U=A.target;(g==null?void 0:g.contains(U))&&C(A,E)};return document.addEventListener("wheel",j,{passive:!1}),()=>document.removeEventListener("wheel",j,{passive:!1})},[w,g,E,C]),m.useEffect(_,[r,_]),ju(g,N),ju(p.content,N),d.jsx(KK,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:An(s),onThumbPointerUp:An(i),onThumbPositionChange:_,onThumbPointerDown:An(a),children:d.jsx(Oe.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:ne(e.onPointerDown,j=>{j.button===0&&(j.target.setPointerCapture(j.pointerId),x.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),P(j))}),onPointerMove:ne(e.onPointerMove,P),onPointerUp:ne(e.onPointerUp,j=>{const A=j.target;A.hasPointerCapture(j.pointerId)&&A.releasePointerCapture(j.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),x.current=null})})})}),Lg="ScrollAreaThumb",PA=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=NA(Lg,e.__scopeScrollArea);return d.jsx(fn,{present:n||o.hasThumb,children:d.jsx(GK,{ref:t,...r})})}),GK=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=To(Lg,n),i=NA(Lg,n),{onThumbPositionChange:a}=i,l=Ue(t,f=>i.onThumbChange(f)),c=m.useRef(void 0),u=ly(()=>{c.current&&(c.current(),c.current=void 0)},100);return m.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(u(),!c.current){const p=JK(f,a);c.current=p,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,u,a]),d.jsx(Oe.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ne(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,v=f.clientY-p.top;i.onThumbPointerDown({x:g,y:v})}),onPointerUp:ne(e.onPointerUp,i.onThumbPointerUp)})});PA.displayName=Lg;var tk="ScrollAreaCorner",TA=m.forwardRef((e,t)=>{const n=To(tk,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.jsx(qK,{...e,ref:t}):null});TA.displayName=tk;var qK=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=To(tk,n),[s,i]=m.useState(0),[a,l]=m.useState(0),c=!!(s&&a);return ju(o.scrollbarX,()=>{var f;const u=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(u),l(u)}),ju(o.scrollbarY,()=>{var f;const u=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(u),i(u)}),c?d.jsx(Oe.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Fg(e){return e?parseInt(e,10):0}function OA(e,t){const n=e/t;return isNaN(n)?0:n}function ay(e){const t=OA(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function YK(e,t,n,r="ltr"){const o=ay(n),s=o/2,i=t||s,a=o-i,l=n.scrollbar.paddingStart+i,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return jA([l,c],f)(e)}function WN(e,t,n="ltr"){const r=ay(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,l=n==="ltr"?[0,i]:[i*-1,0],c=Zb(e,l);return jA([0,i],[0,a])(c)}function jA(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 MA(e,t){return e>0&&e<t}var JK=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function ly(e,t){const n=An(e),r=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),m.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ju(e,t){const n=An(t);En(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var RA=SA,XK=EA,ZK=TA;const yr=m.forwardRef(({className:e,children:t,innerRef:n,viewportId:r,orientation:o,...s},i)=>d.jsxs(RA,{ref:i,className:de("relative overflow-hidden",e),...s,children:[d.jsx(XK,{className:"h-full w-full rounded-[inherit]",ref:n,id:r,children:t}),d.jsx(nk,{orientation:o}),d.jsx(ZK,{})]}));yr.displayName=RA.displayName;const nk=m.forwardRef(({className:e,orientation:t="vertical",...n},r)=>d.jsx(QS,{ref:r,orientation:t,className:de("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:d.jsx(PA,{className:de("relative rounded-full bg-border",t==="vertical"&&"flex-1")})}));nk.displayName=QS.displayName;var Qx=0;function cy(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??HN()),document.body.insertAdjacentElement("beforeend",e[1]??HN()),Qx++,()=>{Qx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Qx--}},[])}function HN(){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 e0="focusScope.autoFocusOnMount",t0="focusScope.autoFocusOnUnmount",KN={bubbles:!1,cancelable:!0},QK="FocusScope",rp=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,l]=m.useState(null),c=An(o),u=An(s),f=m.useRef(null),h=Ue(t,v=>l(v)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(w){if(p.paused||!a)return;const E=w.target;a.contains(E)?f.current=E:Wi(f.current,{select:!0})},y=function(w){if(p.paused||!a)return;const E=w.relatedTarget;E!==null&&(a.contains(E)||Wi(f.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&Wi(a)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const b=new MutationObserver(x);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,p.paused]),m.useEffect(()=>{if(a){qN.add(p);const v=document.activeElement;if(!a.contains(v)){const x=new CustomEvent(e0,KN);a.addEventListener(e0,c),a.dispatchEvent(x),x.defaultPrevented||(eG(sG(AA(a)),{select:!0}),document.activeElement===v&&Wi(a))}return()=>{a.removeEventListener(e0,c),setTimeout(()=>{const x=new CustomEvent(t0,KN);a.addEventListener(t0,u),a.dispatchEvent(x),x.defaultPrevented||Wi(v??document.body,{select:!0}),a.removeEventListener(t0,u),qN.remove(p)},0)}}},[a,c,u,p]);const g=m.useCallback(v=>{if(!n&&!r||p.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(y&&x){const b=v.currentTarget,[w,E]=tG(b);w&&E?!v.shiftKey&&x===E?(v.preventDefault(),n&&Wi(w,{select:!0})):v.shiftKey&&x===w&&(v.preventDefault(),n&&Wi(E,{select:!0})):x===b&&v.preventDefault()}},[n,r,p.paused]);return d.jsx(Oe.div,{tabIndex:-1,...i,ref:h,onKeyDown:g})});rp.displayName=QK;function eG(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Wi(r,{select:t}),document.activeElement!==n)return}function tG(e){const t=AA(e),n=GN(t,e),r=GN(t.reverse(),e);return[n,r]}function AA(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 GN(e,t){for(const n of e)if(!nG(n,{upTo:t}))return n}function nG(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 rG(e){return e instanceof HTMLInputElement&&"select"in e}function Wi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rG(e)&&t&&e.select()}}var qN=oG();function oG(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=YN(e,t),e.unshift(t)},remove(t){var n;e=YN(e,t),(n=e[0])==null||n.resume()}}}function YN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function sG(e){return e.filter(t=>t.tagName!=="A")}function iG(e){const t=aG(e),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(cG);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function aG(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=dG(o),a=uG(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var lG=Symbol("radix.slottable");function cG(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lG}function uG(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function dG(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 fG=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Sc=new WeakMap,Yp=new WeakMap,Jp={},n0=0,IA=function(e){return e&&(e.host||IA(e.parentNode))},hG=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=IA(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})},pG=function(e,t,n,r){var o=hG(t,Array.isArray(e)?e:[e]);Jp[n]||(Jp[n]=new WeakMap);var s=Jp[n],i=[],a=new Set,l=new Set(o),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};o.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",v=(Sc.get(h)||0)+1,y=(s.get(h)||0)+1;Sc.set(h,v),s.set(h,y),i.push(h),v===1&&g&&Yp.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return u(t),a.clear(),n0++,function(){i.forEach(function(f){var h=Sc.get(f)-1,p=s.get(f)-1;Sc.set(f,h),s.set(f,p),h||(Yp.has(f)||f.removeAttribute(r),Yp.delete(f)),p||f.removeAttribute(n)}),n0--,n0||(Sc=new WeakMap,Sc=new WeakMap,Yp=new WeakMap,Jp={})}},uy=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=fG(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),pG(r,o,n,"aria-hidden")):function(){return null}},gs=function(){return gs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},gs.apply(this,arguments)};function DA(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 mG(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Sm="right-scroll-bar-position",km="width-before-scroll-bar",gG="with-scroll-bars-hidden",vG="--removed-body-scroll-bar-size";function r0(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yG(e,t){var n=m.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 xG=typeof window<"u"?m.useLayoutEffect:m.useEffect,JN=new WeakMap;function bG(e,t){var n=yG(null,function(r){return e.forEach(function(o){return r0(o,r)})});return xG(function(){var r=JN.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||r0(a,null)}),s.forEach(function(a){o.has(a)||r0(a,i)})}JN.set(n,e)},[e]),n}function wG(e){return e}function SG(e,t){t===void 0&&(t=wG);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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var l=function(){var u=i;i=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){i.push(u),c()},filter:function(u){return i=i.filter(u),n}}}};return o}function kG(e){e===void 0&&(e={});var t=SG(null);return t.options=gs({async:!0,ssr:!1},e),t}var LA=function(e){var t=e.sideCar,n=DA(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 m.createElement(r,gs({},n))};LA.isSideCarExport=!0;function EG(e,t){return e.useMedium(t),LA}var FA=kG(),o0=function(){},dy=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:o0,onWheelCapture:o0,onTouchMoveCapture:o0}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,g=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,E=DA(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,_=bG([n,t]),N=gs(gs({},E),o);return m.createElement(m.Fragment,null,u&&m.createElement(C,{sideCar:FA,removeScrollBar:c,shards:f,noRelative:p,noIsolation:g,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),i?m.cloneElement(m.Children.only(a),gs(gs({},N),{ref:_})):m.createElement(b,gs({},N,{className:l,ref:_}),a))});dy.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};dy.classNames={fullWidth:km,zeroRight:Sm};var CG=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NG(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=CG();return t&&e.setAttribute("nonce",t),e}function _G(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function PG(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var TG=function(){var e=0,t=null;return{add:function(n){e==0&&(t=NG())&&(_G(t,n),PG(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},OG=function(){var e=TG();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},zA=function(){var e=OG(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},jG={left:0,top:0,right:0,gap:0},s0=function(e){return parseInt(e||"",10)||0},MG=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[s0(n),s0(r),s0(o)]},RG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jG;var t=MG(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])}},AG=zA(),su="data-scroll-locked",IG=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
411
|
+
.`.concat(gG,` {
|
|
412
|
+
overflow: hidden `).concat(r,`;
|
|
413
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
414
|
+
}
|
|
415
|
+
body[`).concat(su,`] {
|
|
416
|
+
overflow: hidden `).concat(r,`;
|
|
417
|
+
overscroll-behavior: contain;
|
|
418
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
419
|
+
padding-left: `.concat(o,`px;
|
|
420
|
+
padding-top: `).concat(s,`px;
|
|
421
|
+
padding-right: `).concat(i,`px;
|
|
422
|
+
margin-left:0;
|
|
423
|
+
margin-top:0;
|
|
424
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
425
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.`).concat(Sm,` {
|
|
429
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.`).concat(km,` {
|
|
433
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.`).concat(Sm," .").concat(Sm,` {
|
|
437
|
+
right: 0 `).concat(r,`;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.`).concat(km," .").concat(km,` {
|
|
441
|
+
margin-right: 0 `).concat(r,`;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
body[`).concat(su,`] {
|
|
445
|
+
`).concat(vG,": ").concat(a,`px;
|
|
446
|
+
}
|
|
447
|
+
`)},XN=function(){var e=parseInt(document.body.getAttribute(su)||"0",10);return isFinite(e)?e:0},DG=function(){m.useEffect(function(){return document.body.setAttribute(su,(XN()+1).toString()),function(){var e=XN()-1;e<=0?document.body.removeAttribute(su):document.body.setAttribute(su,e.toString())}},[])},LG=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;DG();var s=m.useMemo(function(){return RG(o)},[o]);return m.createElement(AG,{styles:IG(s,!t,o,n?"":"!important")})},Qb=!1;if(typeof window<"u")try{var Xp=Object.defineProperty({},"passive",{get:function(){return Qb=!0,!0}});window.addEventListener("test",Xp,Xp),window.removeEventListener("test",Xp,Xp)}catch{Qb=!1}var kc=Qb?{passive:!1}:!1,FG=function(e){return e.tagName==="TEXTAREA"},$A=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!FG(e)&&n[t]==="visible")},zG=function(e){return $A(e,"overflowY")},$G=function(e){return $A(e,"overflowX")},ZN=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=BA(e,r);if(o){var s=VA(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},BG=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},VG=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},BA=function(e,t){return e==="v"?zG(t):$G(t)},VA=function(e,t){return e==="v"?BG(t):VG(t)},UG=function(e,t){return e==="h"&&t==="rtl"?-1:1},WG=function(e,t,n,r,o){var s=UG(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,l=t.contains(a),c=!1,u=i>0,f=0,h=0;do{if(!a)break;var p=VA(e,a),g=p[0],v=p[1],y=p[2],x=v-y-s*g;(g||x)&&BA(e,a)&&(f+=x,h+=g);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(f)<1||!u&&Math.abs(h)<1)&&(c=!0),c},Zp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},QN=function(e){return[e.deltaX,e.deltaY]},e_=function(e){return e&&"current"in e?e.current:e},HG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KG=function(e){return`
|
|
448
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
449
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
450
|
+
`)},GG=0,Ec=[];function qG(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(GG++)[0],s=m.useState(zA)[0],i=m.useRef(e);m.useEffect(function(){i.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=mG([e.lockRef.current],(e.shards||[]).map(e_),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=m.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var x=Zp(v),b=n.current,w="deltaX"in v?v.deltaX:b[0]-x[0],E="deltaY"in v?v.deltaY:b[1]-x[1],C,_=v.target,N=Math.abs(w)>Math.abs(E)?"h":"v";if("touches"in v&&N==="h"&&_.type==="range")return!1;var P=window.getSelection(),j=P&&P.anchorNode,A=j?j===_||j.contains(_):!1;if(A)return!1;var U=ZN(N,_);if(!U)return!0;if(U?C=N:(C=N==="v"?"h":"v",U=ZN(N,_)),!U)return!1;if(!r.current&&"changedTouches"in v&&(w||E)&&(r.current=C),!C)return!0;var L=r.current||C;return WG(L,y,v,L==="h"?w:E)},[]),l=m.useCallback(function(v){var y=v;if(!(!Ec.length||Ec[Ec.length-1]!==s)){var x="deltaY"in y?QN(y):Zp(y),b=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&HG(C.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(i.current.shards||[]).map(e_).filter(Boolean).filter(function(C){return C.contains(y.target)}),E=w.length>0?a(y,w[0]):!i.current.noIsolation;E&&y.cancelable&&y.preventDefault()}}},[]),c=m.useCallback(function(v,y,x,b){var w={name:v,delta:y,target:x,should:b,shadowParent:YG(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(E){return E!==w})},1)},[]),u=m.useCallback(function(v){n.current=Zp(v),r.current=void 0},[]),f=m.useCallback(function(v){c(v.type,QN(v),v.target,a(v,e.lockRef.current))},[]),h=m.useCallback(function(v){c(v.type,Zp(v),v.target,a(v,e.lockRef.current))},[]);m.useEffect(function(){return Ec.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,kc),document.addEventListener("touchmove",l,kc),document.addEventListener("touchstart",u,kc),function(){Ec=Ec.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,kc),document.removeEventListener("touchmove",l,kc),document.removeEventListener("touchstart",u,kc)}},[]);var p=e.removeScrollBar,g=e.inert;return m.createElement(m.Fragment,null,g?m.createElement(s,{styles:KG(o)}):null,p?m.createElement(LG,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function YG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const JG=EG(FA,qG);var op=m.forwardRef(function(e,t){return m.createElement(dy,gs({},e,{ref:t,sideCar:JG}))});op.classNames=dy.classNames;var fy="Popover",[UA]=dr(fy,[Ds]),sp=Ds(),[XG,Xa]=UA(fy),WA=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,a=sp(t),l=m.useRef(null),[c,u]=m.useState(!1),[f,h]=Zr({prop:r,defaultProp:o??!1,onChange:s,caller:fy});return d.jsx(Jh,{...a,children:d.jsx(XG,{scope:t,contentId:qr(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:i,children:n})})};WA.displayName=fy;var HA="PopoverAnchor",ZG=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Xa(HA,n),s=sp(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return m.useEffect(()=>(i(),()=>a()),[i,a]),d.jsx(Ju,{...s,...r,ref:t})});ZG.displayName=HA;var KA="PopoverTrigger",zg=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Xa(KA,n),s=sp(n),i=Ue(t,o.triggerRef),a=d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":XA(o.open),...r,ref:i,onClick:ne(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(Ju,{asChild:!0,...s,children:a})});zg.displayName=KA;var rk="PopoverPortal",[QG,eq]=UA(rk,{forceMount:void 0}),GA=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=Xa(rk,t);return d.jsx(QG,{scope:t,forceMount:n,children:d.jsx(fn,{present:n||s.open,children:d.jsx(Xu,{asChild:!0,container:o,children:r})})})};GA.displayName=rk;var Mu="PopoverContent",qA=m.forwardRef((e,t)=>{const n=eq(Mu,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=Xa(Mu,e.__scopePopover);return d.jsx(fn,{present:r||s.open,children:s.modal?d.jsx(nq,{...o,ref:t}):d.jsx(rq,{...o,ref:t})})});qA.displayName=Mu;var tq=iG("PopoverContent.RemoveScroll"),nq=m.forwardRef((e,t)=>{const n=Xa(Mu,e.__scopePopover),r=m.useRef(null),o=Ue(t,r),s=m.useRef(!1);return m.useEffect(()=>{const i=r.current;if(i)return uy(i)},[]),d.jsx(op,{as:tq,allowPinchZoom:!0,children:d.jsx(YA,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),rq=m.forwardRef((e,t)=>{const n=Xa(Mu,e.__scopePopover),r=m.useRef(!1),o=m.useRef(!1);return d.jsx(YA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),YA=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=Xa(Mu,n),p=sp(n);return cy(),d.jsx(rp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:d.jsx(lc,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:d.jsx(Xh,{"data-state":XA(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.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)"}})})})}),JA="PopoverClose",Hl=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Xa(JA,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});Hl.displayName=JA;var oq="PopoverArrow",sq=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=sp(n);return d.jsx(Zh,{...o,...r,ref:t})});sq.displayName=oq;function XA(e){return e?"open":"closed"}var iq=WA,aq=zg,lq=GA,ZA=qA;const Cr=iq,Co=aq,ir=m.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(lq,{container:r.container,children:d.jsx(ZA,{ref:o,align:t,sideOffset:n,className:de("z-50 w-72 rounded-md border bg-bg-secondary p-4 text-fg-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})}));ir.displayName=ZA.displayName;function t_({profile:e,size:t="md"}){var c,u,f;const[n,r]=m.useState(((c=e==null?void 0:e.avatar)==null?void 0:c.url)||null);m.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,...s]=((f=e.fullName)==null?void 0:f.split(" "))||[""],i=s[s.length-1]||"",a=`${o[0].toUpperCase()}${i[0].toUpperCase()}`,l=Te("rounded-full text-center inline-block bg-bg-brand-primary text-fg-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?d.jsx("img",{src:n,alt:a,className:l,onError:()=>{r(null)}}):d.jsx("span",{className:l,children:a})}function cq(e,t,n,r){if(t[n]===void 0)return console.error(`Get keysOf source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const i=n,a=[],l=(c,u,f)=>{var h;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===i&&(r?typeof f=="string"&&f===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(r_(f)||QA(f))for(const p in f){const g=f==null?void 0:f[p],v=u.type==="object"?(h=u.items)==null?void 0:h[p]:u.item;g&&l(n_(c,p),v,g)}}else if(u.type==="array"){if(uq(f)){let p=0;for(const g of f)l(n_(c,p),u.item,g),p++}}else if(u.type==="union"){const p=u.key;if(typeof p=="string"&&r_(f)){const g=f[p];if(typeof g=="string"){const v=u.items.filter(y=>y.type==="object").find(y=>{const x=y.items[p];if((x==null?void 0:x.type)==="literal")return x.value===g});v&&l(c,v,f)}}}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 n_(e,t){return e.includes(Ra)?`${e}.${JSON.stringify(t)}`:`${e}${Ra}${JSON.stringify(t)}`}function r_(e){return QA(e)}function QA(e){return typeof e=="object"&&!!e&&!da(e)}function uq(e){return typeof e=="object"&&!!e&&da(e)}function e2(e,t){const n=Ja(),r=iy(),o=KS();return m.useMemo(()=>e!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?cq(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}var dq=Symbol.for("react.lazy"),$g=u1[" use ".trim().toString()];function fq(e){return typeof e=="object"&&e!==null&&"then"in e}function t2(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===dq&&"_payload"in e&&fq(e._payload)}function hq(e){const t=mq(e),n=m.forwardRef((r,o)=>{let{children:s,...i}=r;t2(s)&&typeof $g=="function"&&(s=$g(s._payload));const a=m.Children.toArray(s),l=a.find(vq);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var pq=hq("Slot");function mq(e){const t=m.forwardRef((n,r)=>{let{children:o,...s}=n;if(t2(o)&&typeof $g=="function"&&(o=$g(o._payload)),m.isValidElement(o)){const i=xq(o),a=yq(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gq=Symbol("radix.slottable");function vq(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gq}function yq(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function xq(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)}const o_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,s_=KR,bq=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return s_(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=s==null?void 0:s[c];if(u===null)return null;const h=o_(u)||o_(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...p}=u;return Object.entries(p).every(g=>{let[v,y]=g;return Array.isArray(y)?y.includes({...s,...a}[v]):{...s,...a}[v]===y})?[...c,f,h]:c},[]);return s_(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},ew=bq("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-fg-disabled disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:de("cursor-pointer","border border-border-brand-primary","bg-bg-brand-primary text-fg-brand-primary","hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary-hover","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),destructive:de("cursor-pointer","border border-bg-error-primary","bg-bg-error-primary text-fg-error-primary hover:bg-bg-error-primary-hover disabled:text-fg-error-primary"),outline:de("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary"),secondary:de("cursor-pointer","border border-border-secondary","bg-bg-secondary text-fg-secondary hover:bg-bg-secondary-hover"),ghost:de("cursor-pointer","border border-transparent","bg-bg-background hover:bg-bg-secondary","disabled:bg-bg-disabled disabled:text-fg-disabled disabled:border disabled:border-border-primary","hover:bg-bg-secondary-hover hover:text-fg-secondary"),link:de("cursor-pointer","border border-transparent","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"}}),Je=m.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?pq:"button";return d.jsx(i,{className:de(ew({variant:t,size:n,className:e})),ref:s,...o})});Je.displayName="Button";function wq({path:e,disabled:t}){const[n,r]=Y.splitModuleFilePathAndModulePath(e),o=Y.splitModuleFilePath(n),s=Y.splitModulePath(r),{navigate:i}=Cn();return d.jsxs("div",{className:"w-full",children:[d.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{i(n)},children:o.map((a,l)=>d.jsxs(m.Fragment,{children:[l===0&&d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Te({"text-muted":!(s.length===0&&l===o.length-1)}),children:Ou(a)}),l>0&&l<o.length-1&&d.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),d.jsx("button",{type:"button",disabled:t,title:Y.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{i(Y.joinModuleFilePathAndModulePath(n,r))},children:s.map((a,l)=>d.jsxs(m.Fragment,{children:[d.jsx("span",{className:"text-muted",children:"/"}),d.jsx("span",{className:Te({"text-muted":l===s.length-2}),children:Ou(a)})]},`${a}-${l}`))})]})}function n2({path:e,parentPath:t,variant:n,refs:r,children:o,size:s,onComplete:i,confirmationMessage:a,className:l}){const c=Nn();return d.jsxs(Cr,{children:[d.jsx(Co,{asChild:!0,children:d.jsx(Je,{size:s,variant:n,className:l,children:o})}),d.jsxs(ir,{container:c,className:"flex flex-col gap-2 p-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:a}),d.jsx(Hl,{asChild:!0,children:d.jsx(Sq,{path:e,parentPath:t,refs:r,variant:"destructive",onComplete:i,children:d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(XS,{size:12}),d.jsx("span",{children:"Delete"})]})})})]})]})}function Sq({path:e,parentPath:t,variant:n,refs:r,children:o,size:s,onComplete:i}){const{navigate:a}=Cn(),{addPatch:l,patchPath:c}=_n(e),u=ht(t,"record");return!("data"in u)||u.data===void 0||u.data===null?(console.error("Parent source not found",u,{path:e}),null):d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx(Je,{size:s,variant:n,disabled:r.length>0,onClick:()=>{l([{op:"remove",path:c}],"record"),a(t),i&&i()},children:o})}),d.jsx(vr,{side:"top",children:r.length>0?d.jsxs("div",{children:[d.jsx("p",{children:"Cannot delete record."}),d.jsxs("p",{children:["You must change the following references"," ",d.jsx(yA,{size:10,className:"inline"})," to be able to delete:"]}),d.jsx("ul",{children:r.map(f=>d.jsx("li",{children:d.jsx(wq,{path:f})},f))})]}):d.jsx("p",{children:"Delete record"})})]})}function Kl(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,Kl(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"?Kl(e.items[0]):e.key.value;if(e.type==="date")return Ci(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}const od=m.forwardRef(({className:e,type:t,...n},r)=>d.jsx("input",{type:t,className:de("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}));od.displayName="Input";function kq(e,t){const n={},r=t==null?void 0:t.split("/");(r==null?void 0:r[0])===""&&r.shift();const o=(r==null?void 0:r.filter(i=>i!==""))||[];let s=0;for(let i=0;i<e.length;i++){const a=e[i];if(a.type==="literal"){const l=o[s];if(!l)return{status:"error",message:`Missing required literal part: ${a.name}`};if(a.name!==l)return{status:"error",message:`Invalid path part: expected "${a.name}", got "${l}"`};s++}else if(a.type==="string-param"){const l=o[s];if(!l){if(a.optional)continue;return{status:"error",message:`Missing required parameter: ${a.paramName}`}}n[a.paramName]=l,s++}else if(a.type==="array-param"){const l=o.slice(s);if(l.length===0){if(a.optional)continue;return{status:"error",message:`Missing required catch-all parameter: ${a.paramName}`}}n[a.paramName]=l,s+=l.length}}return s<o.length?{status:"error",message:`Extra path parts found: ${o.slice(s).join("/")}`}:{status:"success",params:n}}function r2({routePattern:e,existingKeys:t,onSubmit:n,submitText:r,defaultParams:o,onCancel:s,defaultValue:i}){const[a,l]=m.useState({});m.useEffect(()=>{o&&l(o)},[o]);const[c,u]=m.useState({});m.useEffect(()=>{if(i){const g=kq(e,i);g.status==="success"&&l(g.params)}},[i,e]);const f=m.useMemo(()=>"/"+e.map(g=>{if(g.type==="string-param"||g.type==="array-param"){const v=a[g.paramName];return Array.isArray(v)?v.join("/"):v}return g.name}).join("/"),[e,a]),p=!m.useMemo(()=>e.every(g=>g.type==="string-param"||g.type==="array-param"?!!a[g.paramName]&&!c[g.paramName]:!0),[e,a,c])||f in t;return d.jsxs("form",{className:"p-4 space-y-3",onSubmit:g=>{g.preventDefault(),n(f)},children:[d.jsx("div",{className:"flex items-center",children:e.map((g,v)=>d.jsx("span",{className:"truncate",children:g.type==="string-param"||g.type==="array-param"?d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{children:"/"}),d.jsxs("span",{className:"flex flex-col",children:[d.jsx("input",{className:de("p-1 bg-transparent border-0 max-w-[10ch]",{"border-border-secondary border-1":c[g.paramName]}),placeholder:g.paramName,value:Eq(a,g.paramName),onChange:y=>{l({...a,[g.paramName]:y.target.value});const x=g.type==="string-param"?y.target.value:y.target.value.replace(/\//g,"");encodeURIComponent(x)!==x?u({...c,[g.paramName]:"Invalid characters"}):u({...c,[g.paramName]:void 0})}}),c[g.paramName]&&d.jsx("span",{className:"text-xs text-fg-error-secondary",children:c[g.paramName]})]})]}):d.jsxs("span",{className:"text-fg-secondary",children:["/",g.name]})},v))}),d.jsxs("div",{className:"flex gap-4",children:[d.jsx(Je,{disabled:p,children:r}),d.jsx(Je,{variant:"ghost",type:"reset",onClick:s,children:"Cancel"})]})]})}function Eq(e,t){const n=e[t];return Array.isArray(n)?n.join("/"):n||""}function o2({path:e,size:t,variant:n,children:r,open:o,setOpen:s,defaultOpen:i,routePattern:a}){const l=ht(e,"record"),c=Vt(e),u=Nn(),{addPatch:f}=_n(e),{navigate:h}=Cn(),[p,g]=m.useState(i??!1);m.useEffect(()=>{o!==void 0&&g(o)},[o]),m.useEffect(()=>{s!==void 0&&s(p)},[p,s]),m.useEffect(()=>{i!==void 0&&g(i)},[i]);const v=m.useCallback(w=>{const E="data"in c?c.data:null;if(E===null||E.type!=="record")return;const C=Y.createPatchPath(b).concat(w);f([{op:"add",path:C,value:Kl(E.item)}],"record"),h(Y.joinModuleFilePathAndModulePath(x,Y.patchPathToModulePath(C))),g(!1)},[f,h,c,e]);if(!("data"in l)||l.data===void 0||l.data===null)return console.error("Source not found",l,{path:e}),null;if(!("data"in c)||c.data===void 0)return console.error("Schema not found",l,{path:e}),null;if(c.data.type!=="record")return console.error("Schema is not a record",c,{path:e}),null;const[x,b]=Y.splitModuleFilePathAndModulePath(e);return d.jsxs(Cr,{open:p,onOpenChange:g,children:[d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx(Co,{onClick:()=>{g(!0)},asChild:!0,children:d.jsx(Je,{size:t,variant:n,children:r})})}),d.jsx(vr,{children:d.jsx("p",{children:"Add"})})]}),d.jsx(ir,{container:u,children:a?d.jsx(r2,{routePattern:a,existingKeys:Object.keys(l.data),onSubmit:v,onCancel:()=>{g(!1)},submitText:"Create"}):d.jsx(Cq,{existingKeys:Object.keys(l.data),onSubmit:v})})]})}function Cq({existingKeys:e,onSubmit:t}){const[n,r]=m.useState(""),o=n===""||n in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:s=>{s.preventDefault(),t(n)},children:[d.jsx(od,{autoFocus:!0,value:n,onChange:s=>{r(s.target.value)}}),d.jsx("div",{children:d.jsx(Je,{type:"submit",disabled:o,variant:"outline",children:"Add"})})]})}function Nq({existingKeys:e,defaultValue:t,onCancel:n,onSubmit:r}){const[o,s]=m.useState(t),i=o===t||o===""||o in e;return d.jsxs("form",{className:"flex flex-col gap-2",onSubmit:a=>{a.preventDefault(),r(o)},children:[d.jsx(od,{type:"text",value:o,onChange:a=>{s(a.target.value)}}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(Je,{disabled:i,variant:"outline",type:"submit",children:"Update"}),d.jsx(Je,{variant:"ghost",type:"reset",onClick:()=>{n(),s(t)},children:"Cancel"})]})]})}function s2({defaultValue:e,path:t,parentPath:n,variant:r,existingKeys:o,routePattern:s,size:i,children:a,onComplete:l}){const{navigate:c}=Cn(),[u,f]=m.useState(!1),h=Nn();m.useEffect(()=>{const w=E=>{E.key==="Escape"&&f(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const{addPatch:p,addModuleFilePatch:g}=_n(t),[v,y]=Y.splitModuleFilePathAndModulePath(n),x=Y.createPatchPath(y),b=m.useCallback(w=>{const E=[{op:"move",from:x.concat(e),path:x.concat(w)}];p(E,"record");for(const _ of o){const[N,P]=Y.splitModuleFilePathAndModulePath(_),j=Y.createPatchPath(P);g(N,[{op:"replace",path:j,value:w}],"record")}const C=Y.joinModuleFilePathAndModulePath(v,Y.patchPathToModulePath(x.concat(w)));c(C,{replace:!0}),l&&l()},[p,g,v,x,c,l]);return d.jsxs(Cr,{open:u,children:[d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx(Je,{asChild:!0,size:i,variant:r,children:d.jsx(Co,{onClick:()=>{f(!0)},children:a})})}),d.jsx(vr,{side:"top",children:"Rename record"})]}),d.jsx(ir,{container:h,className:"text-fg-primary",children:s?d.jsx(r2,{routePattern:s,existingKeys:o,defaultValue:e,onSubmit:w=>{b(w),f(!1)},onCancel:()=>{f(!1)},submitText:"Update"}):d.jsx(Nq,{parentPath:n,defaultValue:e,existingKeys:o,onSubmit:w=>{b(w),f(!1)},onCancel:()=>{f(!1)}})})]})}function _q({moduleFilePaths:e}){const t=sA(e,"record"),n=iA(),r=m.useMemo(()=>{const o=[];if(n.status!=="success")return n;if(n.data===null)return{status:"error",error:"No src folder found"};if(t.status!=="success")return t.status==="not-found"?{status:"error",error:"No data found"}:t.status==="error"?{status:"error",error:`Failed to load ${Object.keys(t.errors).length} modules: ${Object.entries(t.errors).map(([a,l])=>`"${a}": ${l.message}`).join(", ")}`}:t;for(const i of t.data||[])for(const a in i){const[l]=Y.splitModuleFilePathAndModulePath(i[a]);o.push({urlPath:a,moduleFilePath:l})}const s=NV(n.data,o);return{status:t.status,data:s}},[t,n]);return r.status==="loading"||r.status==="not-asked"?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(Qr,{size:16,className:"animate-spin"})}):r.status==="error"?(console.error("Sitemap errors",r.error),null):d.jsx(i2,{node:r.data})}function i2({node:e}){var g;const t=Nn(),{currentSourcePath:n}=Cn(),[r,o]=m.useState(!0),{navigate:s}=Cn(),[i,a]=m.useState(!1),[l,c]=m.useState(!1),u=m.useMemo(()=>e.sourcePath===n,[n,e.sourcePath]),f=m.useMemo(()=>{if(!e.pattern)return;const v=UM(e.pattern);if(v.some(y=>y.type==="string-param"||y.type==="array-param"))return v},[e.pattern]),h=m.useCallback(()=>{var v;e.sourcePath?s(e.sourcePath):e.type==="node"&&((v=e.children)==null?void 0:v.length)>0&&o(y=>!y)},[s,e]),p=e.moduleFilePath;return d.jsxs("div",{children:[d.jsxs("div",{className:"relative flex items-center justify-between w-full h-10 group",children:[d.jsxs("div",{className:"flex items-center my-1",children:[d.jsx("button",{onClick:()=>o(!r),className:de("hidden h-4 w-4 mr-2",{block:((g=e.children)==null?void 0:g.length)>0}),children:d.jsx(rd,{size:16,className:de("transform",{"rotate-90":r})})}),d.jsx("span",{children:e.sourcePath?d.jsxs("button",{onClick:h,className:de("flex items-center gap-1",{}),children:[e.type==="leaf"||e.type==="node"&&e.page?d.jsx(hA,{size:14}):null,d.jsxs("span",{className:de({underline:u}),children:["/",e.name!=="/"&&e.name]})]}):d.jsxs("button",{onClick:h,className:de("flex items-center gap-1",{}),children:[d.jsx(hK,{size:14}),d.jsx("span",{children:d.jsxs("span",{children:["/",e.name!=="/"&&e.name]})})]})})]}),d.jsxs("div",{className:de("absolute right-0 top-0 items-center group-hover:flex h-10 bg-bg-primary",{hidden:!i&&!l,flex:i||l}),children:[e.sourcePath&&d.jsx(Je,{size:"sm",variant:"ghost",onClick:h,className:"flex items-center gap-2",children:d.jsx(YS,{size:12})}),(e.sourcePath||e.type==="leaf"||e.page)&&d.jsxs(Cr,{onOpenChange:a,open:i,children:[d.jsx(Co,{asChild:!0,children:d.jsx(Je,{size:"sm",variant:"ghost",children:d.jsx(qS,{size:12})})}),d.jsx(ir,{container:t,children:d.jsx(Pq,{node:e,routePatternWithParams:f,onClose:()=>a(!1)})})]}),f&&p&&d.jsx(o2,{path:p,size:"sm",variant:"ghost",open:l,setOpen:c,routePattern:f,children:d.jsx(JS,{size:12})})]})]}),d.jsx(Tu,{isOpen:r,className:"pl-3",children:e.children.map((v,y)=>d.jsx(i2,{node:v},y))})]})}function Pq({node:e,onClose:t,routePatternWithParams:n}){const r=m.useMemo(()=>{var i;return e.type==="leaf"?e.fullPath:(i=e.page)==null?void 0:i.fullPath},[e]),o=m.useMemo(()=>e.sourcePath?Y.splitModuleFilePathAndModulePath(e.sourcePath)[0]:void 0,[e==null?void 0:e.sourcePath]),s=e2(o,r);return d.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[o&&e.sourcePath&&d.jsx(n2,{path:e.sourcePath,parentPath:o,refs:s,size:"sm",variant:"ghost",onComplete:t,confirmationMessage:`This will delete the ${r} page.`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(XS,{size:14}),d.jsx("span",{children:"Delete"})]})}),r!==void 0&&e.sourcePath&&o&&d.jsx(s2,{variant:"ghost",size:"sm",existingKeys:s,path:e.sourcePath,defaultValue:r,routePattern:n,parentPath:o,onComplete:t,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(NK,{size:12}),d.jsx("span",{children:"Rename"})]})})]})}function Tq(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 s=r.slice(0,o).join("/"),i=[s,r[o]].join("/"),a=r[o];if(!a)throw new Error("Expected name to be non-empty");if(!t[i]){const l={name:a,fullPath:i,children:[]};o<r.length-1&&(l.isDirectory=!0),t[i]=l,t[s||"/"].children.push(t[i])}}}return t["/"]}function Oq(){const e=Ja();return m.useMemo(()=>{if(e.status==="success"){const t=[],n={};for(const r in e.data){const o=r,s=e.data[o];s.type==="record"&&s.router?(n[s.router]=n[s.router]||[],n[s.router].push(o)):t.push(o)}return{status:e.status,data:{root:Tq(t),sitemap:n}}}return e},[e])}const a2=1280;function jq(){const e=Qu(),[t,n]=m.useState(""),[r,o]=m.useState("");m.useEffect(()=>{async function b(){let w=!1;const E=async C=>{if(!w)try{(await fetch(C)).ok&&(w=!0,n(C))}catch{}};await E("/favicon.ico"),await E("/favicon.svg"),await E("/favicon.png"),await E("/apple-touch-icon.png"),await E("https://valbuild.com/favicon.ico")}if(b(),e!=null&&e.project)o(e.project);else try{let w=new URL(location.origin).hostname;if(w!=="localhost"){const E=w.split(".");E.length>=2&&(w=E.slice(1,-1).join(".")),o(_f(w))}else o("Dev mode")}catch{o("Studio")}},[JSON.stringify(e)]);const s=Ja(),i=Nn(),{theme:a,setTheme:l}=sy(),{navMenu:c}=Zy(),u=Oq(),f=(e==null?void 0:e.appHost)||jb,[h,p]=r.split("/"),g=Y7(),v=`${f}/manage-members/${h}`,x=`${`${f}/~/${h}`}/${p}`;return d.jsxs("nav",{className:"relative min-h-[100svh] bg-bg-primary",children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center p-4 pr-6 h-16 border-b border-border-primary",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[t?d.jsx("img",{src:t,alt:"",className:"w-4 h-4"}):d.jsx("div",{className:"w-4 h-4"}),h&&p?d.jsx("a",{className:"truncate hover:underline",href:x,children:r}):d.jsx("span",{className:"truncate",children:r})]}),d.jsx("button",{className:"lg:hidden",onClick:()=>{c.setOpen(!c.isOpen)},children:d.jsx(Ag,{size:16,className:Te("transform",{"rotate-180":!c.isOpen})})})]}),"data"in s&&d.jsx("div",{className:Te("py-4 pl-2",{}),children:d.jsxs(yr,{children:[d.jsx("div",{className:"max-h-[calc(100svh-32px-64px-32px-16px)] max-w-[320px] px-2",children:"data"in u?d.jsxs(d.Fragment,{children:[d.jsx(Rq,{title:"Site map",defaultOpen:!0,sitemap:u.data.sitemap}),d.jsx(Mq,{title:"Explorer",defaultOpen:!0,node:u.data.root})]}):u.status==="loading"?d.jsx(Aq,{}):null}),d.jsx(nk,{orientation:"horizontal"})]})}),d.jsx("div",{className:"p-4 h-6"}),d.jsx("div",{className:"absolute bottom-0 left-0 w-full",children:d.jsxs(Cr,{children:[d.jsxs(Co,{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:[d.jsx("span",{children:g&&d.jsx(t_,{size:"sm",profile:g})}),d.jsx(qS,{size:16})]}),d.jsx(ir,{className:"p-0 py-2",container:i,side:"top",children:d.jsxs("div",{className:"flex flex-col gap-2 justify-between items-center",children:[g&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center px-4 py-2 w-full",children:[d.jsx(t_,{size:"sm",profile:g}),d.jsxs("div",{className:"text-sm",children:[d.jsx("div",{className:"truncate",children:g.fullName}),g.email&&d.jsx("div",{className:"font-light truncate",children:g.email})]})]}),d.jsx("hr",{className:"mb-1 w-full h-1 border-t border-border-primary"})]}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[a==="dark"?d.jsx(kK,{size:"1rem"}):d.jsx(MK,{size:"1rem"}),d.jsx("button",{className:"",onClick:()=>{l(a==="dark"?"light":"dark")},children:a==="dark"?d.jsx("span",{className:"text-sm",children:"Dark mode"}):d.jsx("span",{className:"text-sm",children:"Light mode"})})]}),g&&d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(FK,{size:"1rem"}),d.jsx("a",{href:v,children:d.jsx("span",{className:"text-sm truncate",children:"Manage members"})})]}),g&&d.jsxs(d.Fragment,{children:[d.jsx("hr",{className:"mt-1 mb-1 w-full h-1 border-t border-border-primary"}),d.jsxs("div",{className:"flex gap-2 items-center px-4 w-full",children:[d.jsx(wK,{size:"1rem"}),d.jsx("a",{href:Su("/api/val/logout",{redirect_to:`${window.location.origin}`}),children:d.jsx("span",{className:"text-sm",children:"Log out"})})]})]})]})})]})})]})}function Mq({title:e,defaultOpen:t,node:n}){return!n||(n==null?void 0:n.children.length)===0?null:d.jsx(l2,{icon:d.jsx(Ig,{size:16}),title:e,defaultOpen:t,children:n.children.sort(c2).map((r,o)=>m.createElement(u2,{...r,name:r.name,key:o,root:!0}))})}function l2({title:e,children:t,defaultOpen:n,icon:r}){const[o,s]=m.useState(n??!0);return d.jsxs("div",{className:"py-2",children:[d.jsxs("button",{className:"flex justify-between items-center py-2 w-full text-sm tracking-tighter uppercase text-fg-secondary",onClick:()=>{s(!o)},children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[r,e]}),d.jsx(rd,{size:16,className:Te("transform",{"rotate-90":o})})]}),d.jsx(Tu,{isOpen:o,className:"pr-1",children:t})]})}function Rq({title:e,defaultOpen:t,sitemap:n}){const r=n["next-app-router"];return r?d.jsx(l2,{title:e,defaultOpen:t,icon:d.jsx(Rg,{size:16}),children:d.jsx(_q,{moduleFilePaths:r})}):null}function Aq(){return d.jsx("div",{className:"flex justify-start items-center w-full h-full",children:d.jsx(Qr,{size:16,className:"animate-spin"})})}function c2(e,t){return e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)}function u2({name:e,fullPath:t,isDirectory:n,children:r,root:o}){const{navigate:s,currentSourcePath:i}=Cn(),{navMenu:a}=Zy(),[l,c]=m.useState(!0),u=uc()||{},f=m.useMemo(()=>{let y=!1;for(const x in u)if(x.startsWith(t)){y=!0;break}return y},[u,t]),h=m.useMemo(()=>{if(n){if(!l)return f}else if(!n)return f;return!1},[f,l,n]),p=t,g=Vt(p),v="data"in g?g.data.type:"loading";return d.jsxs("div",{className:"w-full text-sm",children:[d.jsxs("button",{className:Te("relative flex items-center justify-between w-full ",{"py-2":o,"p-2":!o,underline:i.startsWith(p)&&!n,"font-bold":i.startsWith(p)&&n}),onClick:()=>{n?c(!l):(window.innerWidth<a2&&a.setOpen(!1),s(p))},children:[d.jsxs("div",{className:"flex items-center pr-2",children:[n?d.jsx(rd,{size:16,className:Te("transform mr-2",{"rotate-90":l,hidden:!r.length})}):d.jsx(Iq,{type:v,size:14}),d.jsx("span",{children:Ou(e)})]}),h&&d.jsx("div",{className:"ml-2 w-2 h-2 rounded-full bg-bg-error-secondary"})]}),d.jsx("div",{className:"pl-2",children:d.jsx(Tu,{isOpen:l,children:r.sort(c2).map((y,x)=>m.createElement(u2,{...y,key:x}))})})]})}function Iq({size:e,type:t}){if(t==="loading")return d.jsx(Qr,{size:e,className:"mr-2 animate-spin"});switch(t){case"string":return d.jsx(DK,{size:e,className:"mr-2"});case"number":return d.jsx(mK,{size:e,className:"mr-2"});case"boolean":return d.jsx(AK,{size:e,className:"mr-2"});case"object":return d.jsx(yK,{size:e,className:"mr-2"});case"literal":return d.jsx(lK,{size:e,className:"mr-2"});case"array":return d.jsx(gA,{size:e,className:"mr-2"});case"union":return d.jsx(_K,{size:e,className:"mr-2"});case"richtext":return d.jsx(hA,{size:e,className:"mr-2"});case"record":return d.jsx(RK,{size:e,className:"mr-2"});case"keyOf":return d.jsx(vK,{size:e,className:"mr-2"});case"file":return d.jsx(pA,{size:e,className:"mr-2"});case"date":return d.jsx(dA,{size:e,className:"mr-2"});case"image":return d.jsx(mA,{size:e,className:"mr-2"});default:return d.jsx(iK,{size:e,className:"mr-2"})}}function ok(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var hy="Checkbox",[Dq]=dr(hy),[Lq,sk]=Dq(hy);function Fq(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:s,form:i,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:f}=e,[h,p]=Zr({prop:n,defaultProp:o??!1,onChange:l,caller:hy}),[g,v]=m.useState(null),[y,x]=m.useState(null),b=m.useRef(!1),w=g?!!i||!!g.closest("form"):!0,E={checked:h,disabled:s,setChecked:p,control:g,setControl:v,name:a,form:i,value:u,hasConsumerStoppedPropagationRef:b,required:c,defaultChecked:Ea(o)?!1:o,isFormControl:w,bubbleInput:y,setBubbleInput:x};return d.jsx(Lq,{scope:t,...E,children:zq(f)?f(E):r})}var d2="CheckboxTrigger",f2=m.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:s,value:i,disabled:a,checked:l,required:c,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:g}=sk(d2,e),v=Ue(o,u),y=m.useRef(l);return m.useEffect(()=>{const x=s==null?void 0:s.form;if(x){const b=()=>f(y.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[s,f]),d.jsx(Oe.button,{type:"button",role:"checkbox","aria-checked":Ea(l)?"mixed":l,"aria-required":c,"data-state":v2(l),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:v,onKeyDown:ne(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:ne(n,x=>{f(b=>Ea(b)?!0:!b),g&&p&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})})});f2.displayName=d2;var ik=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l,onCheckedChange:c,form:u,...f}=e;return d.jsx(Fq,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:a,required:i,onCheckedChange:c,name:r,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>d.jsxs(d.Fragment,{children:[d.jsx(f2,{...f,ref:t,__scopeCheckbox:n}),h&&d.jsx(g2,{__scopeCheckbox:n})]})})});ik.displayName=hy;var h2="CheckboxIndicator",p2=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=sk(h2,n);return d.jsx(fn,{present:r||Ea(s.checked)||s.checked===!0,children:d.jsx(Oe.span,{"data-state":v2(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});p2.displayName=h2;var m2="CheckboxBubbleInput",g2=m.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:i,required:a,disabled:l,name:c,value:u,form:f,bubbleInput:h,setBubbleInput:p}=sk(m2,e),g=Ue(n,p),v=ok(s),y=RS(r);m.useEffect(()=>{const b=h;if(!b)return;const w=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(w,"checked").set,_=!o.current;if(v!==s&&C){const N=new Event("click",{bubbles:_});b.indeterminate=Ea(s),C.call(b,Ea(s)?!1:s),b.dispatchEvent(N)}},[h,v,s,o]);const x=m.useRef(Ea(s)?!1:s);return d.jsx(Oe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:a,disabled:l,name:c,value:u,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});g2.displayName=m2;function zq(e){return typeof e=="function"}function Ea(e){return e==="indeterminate"}function v2(e){return Ea(e)?"indeterminate":e?"checked":"unchecked"}const sd=m.forwardRef(({className:e,...t},n)=>{const[r,o]=m.useState();return m.useEffect(()=>{o(t.checked)},[t.checked]),d.jsx(ik,{ref:n,checked:r,onCheckedChange:s=>{o(s),t.onCheckedChange&&t.onCheckedChange(s)},className:de("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-fg-primary",e),...t,children:d.jsxs(p2,{className:de("flex items-center justify-center text-current"),children:[r===!0&&d.jsx(td,{size:12}),r==="indeterminate"&&d.jsx(SK,{size:12})]})})});sd.displayName=ik.displayName;function Em(e,t){const n=new Date(t).getTime(),r=e.getTime(),o=Math.floor((r-n)/1e3),s=Math.floor(o/60),i=Math.floor(o/3600),a=Math.floor(o/86400),l=Math.floor(a/30);return o<60?"just now":s<60?`${s}m ago`:i<24?`${i}h ago`:a===1?"yesterday":a<30?`${a}d ago`:`${l}mo ago`}function y2({onPublish:e,onClose:t}){const[n,r]=m.useState(null),o=ep(),{summary:s,canGenerate:i,setSummary:a,publishDisabled:l,generateSummary:c}=tp(),[u,f]=m.useState(!1),h=()=>{f(!1),s.type!=="not-asked"&&a({...s})};m.useEffect(()=>{s.type!=="not-asked"&&!s.isGenerating&&!Cu(s.patchIds,o)&&f(!0)},[s,o]);const p=m.useCallback(()=>{h(),c().then(y=>{y.type==="ai"?a({type:"ai",text:y.text.trim()}):r(y.message)})},[h,c,a,r]),g="w-full p-2 border rounded bg-bg-secondary",v="text"in s?s.text:"";return d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs("div",{className:"flex items-center justify-between w-full gap-2",children:[d.jsx("span",{className:"font-semibold",children:"Summary"}),i&&d.jsx(i_,{onClick:p,isGenerating:s.isGenerating})]}),n&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:n}),d.jsxs("div",{className:"grid text-xs font-light",children:[d.jsx("div",{"aria-hidden":!0,className:de(g,"invisible whitespace-pre-wrap"),style:{gridArea:"1 / 1 / 2 / 2"},children:v+" "}),d.jsx("textarea",{disabled:!!s.isGenerating,className:de(g,"resize-none overflow-clip disabled:opacity-50"),value:v,style:{gridArea:"1 / 1 / 2 / 2"},placeholder:"Write a summary of your changes"+(i?" or generate one using AI":""),onChange:y=>{h(),a({type:"manual",text:y.currentTarget.value})}})]}),d.jsxs("div",{className:de("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:[d.jsx("span",{children:"Summary might be outdated. "}),d.jsx("button",{className:"underline",onClick:h,children:"Dismiss"})]}),d.jsx("div",{className:"flex items-center justify-end gap-2",children:e?d.jsxs(d.Fragment,{children:[d.jsx(Je,{variant:"outline",onClick:()=>{t()},children:"Close"}),u&&i&&d.jsx(i_,{isGenerating:s.isGenerating,onClick:p}),!u&&d.jsxs(Je,{disabled:l||v.trim()==="",onClick:()=>{s.type!=="not-asked"&&e()},variant:"default",className:"flex items-center gap-2",children:[d.jsxs("span",{children:[" ",l?"Pushing...":"Publish"]}),d.jsx(Dg,{size:16})]})]}):d.jsx(d.Fragment,{children:d.jsx(Je,{variant:"outline",onClick:()=>{t()},children:"Close"})})})]})}function i_({isGenerating:e,onClick:t}){return d.jsx(Je,{className:"truncate",disabled:!!e,onClick:()=>{t()},variant:"outline",children:d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx("span",{children:e?"Generating...":"Generate"}),d.jsx(vA,{size:16})]})})}function a_(e){const t=$q(e),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(Vq);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function $q(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=Wq(o),a=Uq(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bq=Symbol("radix.slottable");function Vq(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bq}function Uq(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Wq(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 py(e){const t=e+"CollectionProvider",[n,r]=dr(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:x}=v,b=_e.useRef(null),w=_e.useRef(new Map).current;return d.jsx(o,{scope:y,itemMap:w,collectionRef:b,children:x})};i.displayName=t;const a=e+"CollectionSlot",l=a_(a),c=_e.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),E=Ue(y,w.collectionRef);return d.jsx(l,{ref:E,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",h=a_(u),p=_e.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,E=_e.useRef(null),C=Ue(y,E),_=s(u,x);return _e.useEffect(()=>(_.itemMap.set(E,{ref:E,...w}),()=>void _.itemMap.delete(E))),d.jsx(h,{[f]:"",ref:C,children:b})});p.displayName=u;function g(v){const y=s(e+"CollectionConsumer",v);return _e.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((_,N)=>w.indexOf(_.ref.current)-w.indexOf(N.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:c,ItemSlot:p},g,r]}var my="Collapsible",[Hq,x2]=dr(my),[Kq,ak]=Hq(my),b2=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[l,c]=Zr({prop:r,defaultProp:o??!1,onChange:i,caller:my});return d.jsx(Kq,{scope:n,disabled:s,contentId:qr(),open:l,onOpenToggle:m.useCallback(()=>c(u=>!u),[c]),children:d.jsx(Oe.div,{"data-state":ck(l),"data-disabled":s?"":void 0,...a,ref:t})})});b2.displayName=my;var w2="CollapsibleTrigger",S2=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ak(w2,n);return d.jsx(Oe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ck(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ne(e.onClick,o.onOpenToggle)})});S2.displayName=w2;var lk="CollapsibleContent",k2=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ak(lk,e.__scopeCollapsible);return d.jsx(fn,{present:n||o.open,children:({present:s})=>d.jsx(Gq,{...r,ref:t,present:s})})});k2.displayName=lk;var Gq=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=ak(lk,n),[a,l]=m.useState(r),c=m.useRef(null),u=Ue(t,c),f=m.useRef(0),h=f.current,p=m.useRef(0),g=p.current,v=i.open||a,y=m.useRef(v),x=m.useRef(void 0);return m.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),En(()=>{const b=c.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const w=b.getBoundingClientRect();f.current=w.height,p.current=w.width,y.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),l(r)}},[i.open,r]),d.jsx(Oe.div,{"data-state":ck(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!v,...s,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&o})});function ck(e){return e?"open":"closed"}var qq=b2,Yq=S2,Jq=k2,ss="Accordion",Xq=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[uk,Zq,Qq]=py(ss),[gy]=dr(ss,[Qq,x2]),dk=x2(),E2=_e.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,s=r;return d.jsx(uk.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?d.jsx(rY,{...s,ref:t}):d.jsx(nY,{...o,ref:t})})});E2.displayName=ss;var[C2,eY]=gy(ss),[N2,tY]=gy(ss,{collapsible:!1}),nY=_e.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:s=!1,...i}=e,[a,l]=Zr({prop:n,defaultProp:r??"",onChange:o,caller:ss});return d.jsx(C2,{scope:e.__scopeAccordion,value:_e.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:_e.useCallback(()=>s&&l(""),[s,l]),children:d.jsx(N2,{scope:e.__scopeAccordion,collapsible:s,children:d.jsx(_2,{...i,ref:t})})})}),rY=_e.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...s}=e,[i,a]=Zr({prop:n,defaultProp:r??[],onChange:o,caller:ss}),l=_e.useCallback(u=>a((f=[])=>[...f,u]),[a]),c=_e.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return d.jsx(C2,{scope:e.__scopeAccordion,value:i,onItemOpen:l,onItemClose:c,children:d.jsx(N2,{scope:e.__scopeAccordion,collapsible:!0,children:d.jsx(_2,{...s,ref:t})})})}),[oY,vy]=gy(ss),_2=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:s="vertical",...i}=e,a=_e.useRef(null),l=Ue(a,t),c=Zq(n),f=np(o)==="ltr",h=ne(e.onKeyDown,p=>{var P;if(!Xq.includes(p.key))return;const g=p.target,v=c().filter(j=>{var A;return!((A=j.ref.current)!=null&&A.disabled)}),y=v.findIndex(j=>j.ref.current===g),x=v.length;if(y===-1)return;p.preventDefault();let b=y;const w=0,E=x-1,C=()=>{b=y+1,b>E&&(b=w)},_=()=>{b=y-1,b<w&&(b=E)};switch(p.key){case"Home":b=w;break;case"End":b=E;break;case"ArrowRight":s==="horizontal"&&(f?C():_());break;case"ArrowDown":s==="vertical"&&C();break;case"ArrowLeft":s==="horizontal"&&(f?_():C());break;case"ArrowUp":s==="vertical"&&_();break}const N=b%x;(P=v[N].ref.current)==null||P.focus()});return d.jsx(oY,{scope:n,disabled:r,direction:o,orientation:s,children:d.jsx(uk.Slot,{scope:n,children:d.jsx(Oe.div,{...i,"data-orientation":s,ref:l,onKeyDown:r?void 0:h})})})}),Bg="AccordionItem",[sY,fk]=gy(Bg),hk=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,s=vy(Bg,n),i=eY(Bg,n),a=dk(n),l=qr(),c=r&&i.value.includes(r)||!1,u=s.disabled||e.disabled;return d.jsx(sY,{scope:n,open:c,disabled:u,triggerId:l,children:d.jsx(qq,{"data-orientation":s.orientation,"data-state":j2(c),...a,...o,ref:t,disabled:u,open:c,onOpenChange:f=>{f?i.onItemOpen(r):i.onItemClose(r)}})})});hk.displayName=Bg;var P2="AccordionHeader",T2=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(ss,n),s=fk(P2,n);return d.jsx(Oe.h3,{"data-orientation":o.orientation,"data-state":j2(s.open),"data-disabled":s.disabled?"":void 0,...r,ref:t})});T2.displayName=P2;var tw="AccordionTrigger",pk=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(ss,n),s=fk(tw,n),i=tY(tw,n),a=dk(n);return d.jsx(uk.ItemSlot,{scope:n,children:d.jsx(Yq,{"aria-disabled":s.open&&!i.collapsible||void 0,"data-orientation":o.orientation,id:s.triggerId,...a,...r,ref:t})})});pk.displayName=tw;var O2="AccordionContent",mk=_e.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=vy(ss,n),s=fk(O2,n),i=dk(n);return d.jsx(Jq,{role:"region","aria-labelledby":s.triggerId,"data-orientation":o.orientation,...i,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});mk.displayName=O2;function j2(e){return e?"open":"closed"}var M2=E2,iY=hk,aY=T2,R2=pk,A2=mk;const La=M2,Ns=m.forwardRef(({className:e,...t},n)=>d.jsx(iY,{ref:n,className:de("border-b",e),...t}));Ns.displayName="AccordionItem";const wi=m.forwardRef(({className:e,children:t,...n},r)=>d.jsx(aY,{className:"flex",children:d.jsxs(R2,{ref:r,className:de("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,d.jsx(nd,{className:"w-4 h-4 transition-transform duration-200 shrink-0"})]})}));wi.displayName=R2.displayName;const _s=m.forwardRef(({className:e,children:t,...n},r)=>d.jsx(A2,{ref:r,className:de("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...n,children:d.jsx("div",{className:"pt-0 pb-4",children:t})}));_s.displayName=A2.displayName;function I2(e,t,n){if(e.length===0)return{success:!1,error:"Empty path"};let r=-1,o="";const s=c=>{o===""?o=c:o+="."+c};if(t===void 0)return{success:!1,error:`Undefined schema in: '${e.join("/")}'.`};if(n===void 0)return{success:!1,error:`Undefined source in: '${e.join("/")}'.`};let i=t,a=n;const l=[{modulePath:o,schema:i,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(i.type==="array"){i=i.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],s(c)}else if(i.type==="record"){i=i.item;const u=Qp(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],s(JSON.stringify(c))}else if(i.type==="object"){i=i.items[c];const u=Qp(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],s(JSON.stringify(c))}else if(i.type==="union"){const u=typeof i.key=="object"&&i.key.type==="literal"?i:void 0,f=typeof i.key=="string"?i:void 0;if(u)return{success:!1,error:"Invalid lookup in string union"};if(f){const h=Qp(e,c,r,a,"union object");if(!h.success)return{success:!1,error:h.error};const p=h.source;let g;for(const v of f.items){const y=v.items[f.key];if(y.type==="literal"){if(p[f.key]===y.value){g=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(!g)return{success:!1,error:`Invalid lookup in union: unknown union type in: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")})`};i=g.items[c],a=p[c],s(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(i.type==="image"||i.type==="file"){const u=Qp(e,c,r,a,"record");if(!u.success)return{success:!1,error:u.error};a=u.source[c],s(JSON.stringify(c))}else return{success:!1,error:`Cannot construct sub-path in schema of '${i.type}' in: '${e.join("/")}'. Path was: '${e.join("/")}' at part ${r} (sliced: ${e.slice(0,r+1).join("/")}`};l.push({modulePath:o,schema:i,source:a})}return{success:!0,modulePath:o,schema:i,source:a,allResolved:l}}function Qp(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 lY(e,t){return(t==null?void 0:t.type)==="array"?e.type!=="string":(t==null?void 0:t.type)==="record"}function D2(e,t,n){if(!n)return null;const[r,o]=Y.splitModuleFilePathAndModulePath(e);if(!o)return r;const s=t[r],i=n[r];if(s===void 0||!i)return null;const a=I2(Y.splitModulePath(o),i,s);if(a.success){for(let l=a.allResolved.length-1;l>=0;l--){const c=a.allResolved[l],u=a.allResolved[l-1];if(lY(c.schema,(u==null?void 0:u.schema)||null))return c.modulePath===""?r:Y.joinModuleFilePathAndModulePath(r,c.modulePath)}return r}else console.error(`Error resolving path: ${a.error} for path: ${e}`);return null}function ip({moduleFilePath:e,patchPath:t,className:n,toolTip:r=!0,link:o=!0}){const s=Qu(),i=m.useRef(null),a=m.useRef(new Map),[l,c]=m.useState([]),[u,f]=m.useState(),h=KS(),p=Ja(),{navigate:g}=Cn();m.useEffect(()=>{const y=e?Y.splitModuleFilePath(e):[],x=t,b=()=>{if(!i.current)return;const E=i.current,C=getComputedStyle(E),_=`${C.fontSize} ${C.fontFamily}`,N=E.offsetWidth,P=y.map(cY).concat(x).map(W=>`/${W}`);f(P.join(""));const j=W=>{const V=`${W}:${_}`,H=a.current.get(V)??uY(W,_);return a.current.set(V,H),H},A="/…",U=j(A),L=[];let K=0;for(let W=P.length-1;W>=0;W--){const V=j(P[W]),z=!(W===0);if(K+V+(z?U:0)<=N){const R=W>y.length?"module-path":"module-file-path";L.unshift({text:P[W],type:R,moduleFilePath:e,modulePathSegments:x.slice(0,W)}),K+=V}else{L.unshift({type:"ellipsis",text:A});break}}c(L)},w=new ResizeObserver(b);return i.current&&(w.observe(i.current),b()),()=>{i.current&&w.unobserve(i.current)}},[e,t]);const v=m.useMemo(()=>{if(!o)return null;const y="data"in p?p.data:{};if(t.length===0){const b=e;return{navPath:b,sourcePath:b}}const x=I2(t,y[e],h[e]);if(x.success){const b=Y.joinModuleFilePathAndModulePath(e,x.modulePath),w=D2(b,h,y);if(w)return{navPath:w,scrollToId:b};console.debug(`Failed to resolve nav path for ${e} and ${t.join(".")}: ${w}`)}else console.debug(`Failed to resolve source path for ${e} and ${t.join(".")}: ${x.error}`);return null},[e,t,h,p]);return d.jsxs(Kr,{open:r===!1?!1:void 0,children:[d.jsx(LS,{asChild:!0,children:d.jsx("a",{href:v&&s?`${s.studioPrefix}${v.navPath}#${v.scrollToId}`:void 0,ref:i,className:Te("inline-block whitespace-nowrap overflow-hidden w-full align-baseline",{"cursor-pointer hover:underline":o},n),onClick:y=>{o&&v&&y.metaKey===!1&&y.ctrlKey===!1&&y.shiftKey===!1&&(y.preventDefault(),g(v.navPath,{scrollToId:v.scrollToId}))},children:l.map((y,x)=>d.jsx("span",{children:y.text},x))})}),d.jsx(vr,{side:"top",children:d.jsx(yr,{orientation:"horizontal",className:"max-w-[calc(100vw-3rem)] whitespace-nowrap",children:u})})]})}function cY(e){const t=Ou(e);return t.slice(0,1).toUpperCase()+t.slice(1)}function uY(e,t){const r=document.createElement("canvas").getContext("2d");return r?(r.font=t,r.measureText(e).width):0}function L2({className:e,loadingStatus:t}){const n=ep(),r=ed(),o=W7(),s=U7(),i=Nn(),[a,l]=m.useState(!1),{canGenerate:c}=tp(),u=uc(),{autoPublish:f}=VS(),h=m.useMemo(()=>{var A;let j=0;for(const U in u)j+=((A=u[U])==null?void 0:A.length)||0;return j},[u]),p=n.length-o.size,{deployments:g,dismissDeployment:v,observedCommitShas:y}=V7(),{globalTransientErrors:x,removeGlobalTransientErrors:b}=J7(),{patchErrors:w}=oA(),[E,C]=m.useState(new Date);m.useEffect(()=>{const j=setInterval(()=>{C(new Date)},6e4);return()=>{clearInterval(j)}},[]);const{deletePatches:_}=eA(),N=F7(),P=async(j,A,U)=>{const L=await N("/patches","GET",{query:{patch_id:[A],exclude_patch_ops:!1}});if(L.status===200){const K=L.json,W=`val-patch-error-report-${j.replace("/","__").replace(/\.val\./,"-")}-${A}.json`,V=new Blob([JSON.stringify({moduleFilePath:j,patchId:A,error:U,patch:K},null,2)],{type:"application/json"}),H=document.createElement("a");H.href=URL.createObjectURL(V),H.download=W,H.click()}else alert("Failed to download report")};return d.jsxs("div",{className:Te("text-sm",e),children:[w&&Object.values(w).some(j=>j!==null)&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[d.jsxs("div",{className:"px-4 text-pretty",children:[d.jsx("div",{children:"Unfortunately, one or more changes have errors."}),d.jsx("div",{children:"No changes can currently be applied."})]}),Object.entries(w).map(([j,A],U)=>d.jsx("div",{className:"pb-4",children:d.jsx(yr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:A&&Object.entries(A).map(([L,K],W)=>d.jsx(M2,{className:"grid grid-cols-2 gap-2",type:"single",collapsible:!0,children:d.jsxs(hk,{value:L,children:[d.jsx("div",{children:d.jsx(Je,{variant:"destructive",onClick:()=>{_([L])},children:d.jsx("span",{className:"flex gap-2 justify-between items-center text-left",children:d.jsx("span",{children:"Remove change and fix issue"})})})}),d.jsx(pk,{asChild:!0,className:"group",children:d.jsxs(Je,{variant:"destructive",children:[d.jsx("span",{className:"text-left truncate group-data-[state=open]:hidden",children:"Report"}),d.jsx("span",{className:"text-left truncate group-data-[state=open]:block hidden",children:"Hide"})]})}),d.jsxs(mk,{children:[d.jsx(Je,{variant:"destructive",onClick:()=>{P(j,L,K.message)},children:d.jsxs("span",{className:"flex gap-2 justify-between items-center text-left",children:[d.jsx("span",{children:"Download debug report"}),d.jsx(cK,{size:14})]})}),d.jsxs("div",{className:"p-4",children:[d.jsx("div",{className:"font-bold",children:"Details"}),d.jsx("div",{children:"Module file path"}),d.jsx("div",{children:d.jsx(l_,{sourcePath:j})}),d.jsx("div",{children:"Error message"}),d.jsx("pre",{children:K.message})]})]})]})},W))})},j+"#"+U))]})}),u&&h>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(yr,{orientation:"horizontal",children:d.jsx(La,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(Ns,{value:"error",className:"border-b-0",children:[d.jsx(wi,{className:" data-[state=open]:mb-4 text-fg-error-primary border-fg-error-primary ",children:d.jsxs("div",{className:"flex justify-between items-center w-full",children:[d.jsxs("div",{children:[h," validation issue",h>1?"s":""]}),d.jsx(Pu,{size:16})]})}),d.jsx(_s,{className:"",children:d.jsx("div",{className:"flex flex-col gap-4",children:Object.entries(u).map(([j,A],U)=>d.jsxs("div",{className:"pb-4",children:[d.jsx("div",{className:"items-start text-left",children:d.jsx(l_,{sourcePath:j})}),d.jsx("div",{children:d.jsx(yr,{orientation:"horizontal",className:"max-w-[280px] text-pretty text-xs",children:A==null?void 0:A.map((L,K)=>d.jsx("div",{className:"",children:d.jsx("div",{children:L.message})},K))})})]},j+"#"+U))})})]})})})}),x&&x.length>0&&d.jsx("div",{className:"sticky top-0 border-b border-border-primary bg-bg-error-primary text-fg-error-primary z-5",children:d.jsx(yr,{orientation:"horizontal",children:d.jsx(La,{type:"single",className:"px-4 font-serif",collapsible:!0,children:d.jsxs(Ns,{value:"error",className:"border-b-0 data-[state=open]:mb-4",children:[d.jsxs(wi,{children:[x.length," transient error",x.length>1?"s":""]}),d.jsx(_s,{className:"w-full",children:d.jsx("div",{className:"flex flex-col gap-2",children:x.map(j=>d.jsxs("div",{className:"flex gap-2 justify-between items-start",children:[d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx("div",{className:"font-bold",children:j.message}),j.details&&d.jsx("div",{children:j.details}),d.jsx("div",{className:"text-[10px] font-thin",children:Em(E,new Date(j.timestamp).toISOString())})]}),d.jsx("button",{onClick:()=>b([j.id]),children:d.jsx(Wl,{size:14})})]},j.id))})})]})})})}),g.length>0&&d.jsx("div",{className:"p-4 border-b border-border-primary",children:d.jsx(dY,{deployments:g,observedCommitShas:y,onDismiss:v})}),r==="http"&&d.jsx("div",{className:"flex justify-end items-center p-4 border-b z-5 border-border-primary",children:d.jsxs(Cr,{open:a,onOpenChange:j=>{l(j)},children:[d.jsx(Co,{asChild:!0,children:d.jsxs(Je,{variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Summary"}),c&&d.jsx(vA,{size:14})]})}),d.jsxs(ir,{container:i,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Hl,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Wl,{size:12})}),d.jsx(y2,{onClose:()=>{l(!1)}})]})]})}),d.jsx("div",{className:"p-4 z-5",children:d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsxs("div",{className:"font-bold",children:[p<=0?"No ":`${p} `,"pending change",p===1?"":"s"]}),(t==="loading"||t==="not-asked")&&d.jsx("div",{className:"",children:d.jsx(Qr,{size:16,className:"animate-spin"})})]}),d.jsxs(Cr,{children:[d.jsx(Co,{asChild:!0,children:d.jsxs(Je,{disabled:n.length===0,variant:"secondary",className:"flex gap-2 items-center text-sm",children:[d.jsx("span",{children:"Undo all"}),d.jsx(Xb,{size:14})]})}),d.jsx(ir,{container:i,className:"z-[9001]",children:d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsx("div",{children:"This will undo all changes to the current state."}),d.jsx("div",{children:d.jsx(Hl,{asChild:!0,children:d.jsxs(Je,{variant:"destructive",className:"flex gap-2 items-center text-sm",onClick:()=>{_(n)},children:[d.jsx("span",{children:"Undo all changes"}),d.jsx(Xb,{size:14})]})})})]})})]})]})}),(!f||h>0)&&d.jsx("div",{className:"flex flex-col gap-[2px]",children:"data"in s&&n.length>0&&s.data.map(j=>d.jsx(mY,{committedPatchIds:o,patchSet:j,patchErrors:(w==null?void 0:w[j.moduleFilePath])??{}},j.moduleFilePath+":"+j.patchPath.join("/")))})]})}function l_({sourcePath:e}){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModulePath(n);return d.jsx(ip,{moduleFilePath:t,patchPath:r})}function dY({deployments:e,observedCommitShas:t,onDismiss:n}){return m.useEffect(()=>{for(const r of e)t.has(r.commitSha)&&setTimeout(()=>{n(r.commitSha)},5e3)},[e,t]),d.jsxs("div",{children:[d.jsxs("div",{className:"flex justify-between items-center p-2 font-bold",children:[d.jsx("span",{children:"Deployments"}),d.jsx(Qr,{size:16,className:"inline animate-spin"})]}),d.jsx("div",{children:e.reverse().map(r=>d.jsx(fY,{deployment:r,isFinished:t.has(r.commitSha),onDismiss:()=>{n(r.commitSha)}},r.commitSha))})]})}function fY({deployment:e,isFinished:t,onDismiss:n}){var i;const r=HS(),o=Nn(),s=e.creator&&r[e.creator];return d.jsxs("div",{className:"flex justify-between items-start p-2",children:[d.jsxs("div",{className:"flex gap-2 items-start",children:[s&&d.jsx("img",{src:(i=s.avatar)==null?void 0:i.url,alt:s.fullName,className:"w-8 h-8 rounded-full"}),d.jsxs(Kr,{children:[d.jsx($R,{container:o}),d.jsx(yo,{children:d.jsx("div",{className:"max-w-[180px] overflow-clip font-light truncate",children:e.commitMessage})}),d.jsx(vr,{className:"max-w-[320px]",children:d.jsx("pre",{className:"font-sans font-light whitespace-break-spaces",children:e.commitMessage})})]})]}),t&&d.jsxs("div",{className:"flex gap-2 items-start",children:[d.jsx("span",{className:"text-xs font-light text-fg-quaternary",children:"Deployed"}),d.jsx("button",{onClick:()=>{n()},children:d.jsx(td,{size:14})})]}),!t&&d.jsx(hY,{since:new Date(e.createdAt)})]})}function hY({since:e}){const[t,n]=m.useState("00"),[r,o]=m.useState("00");return m.useEffect(()=>{let s;const i=()=>{const a=Date.now(),l=Math.floor((a-e.getTime())/1e3),c=Math.floor(l/60),u=l%60;let f;c>4?(f=(60-u)*1e3,n(c.toString()),o(null)):(f=1e3,n(c.toString().padStart(2,"0")),o(u.toString().padStart(2,"0"))),s=setTimeout(i,f)};return i(),()=>{clearTimeout(s)}},[e]),d.jsxs("div",{className:"text-xs font-light text-fg-quaternary",children:[t,r!==null?`:${r}`:" mins"]})}function pY({moduleFilePath:e,patchMetadata:t,committedPatchIds:n}){var u;const r=F2([t.opType],t.createdAt,n.has(t.patchId)),o=HS(),{skippedPatches:s}=WS(),i=void 0,[a]=m.useMemo(()=>[!!s[t.patchId]],[t.patchId,s[t.patchId]]),l=ed();let c=[];if(t.author){const f=o[t.author];if(f){const h=((u=f==null?void 0:f.avatar)==null?void 0:u.url)??null;c=[{fullName:f.fullName,url:h}]}else console.warn("Did not find profile for author: ",t.author,{profilesById:o})}return c.length===0&&l==="http"&&console.warn("No authors",{patchMetadata:t}),d.jsx(nw,{moduleFilePath:e,patchPath:t.patchPath,changeDescription:a?"Skipped":r,authors:c,errors:i,skipped:a,isApplied:n.has(t.patchId)})}function F2(e,t,n){const[r,o]=m.useState(new Date);if(m.useEffect(()=>{const a=setInterval(()=>{o(new Date)},6e4);return()=>{clearInterval(a)}},[]),n)return"Pushed "+Em(r,t);if(e.length>1)return"Updated "+Em(r,t);const s=e[0];let i=s;return s==="add"?i="Added":s==="remove"?i="Removed":s==="replace"?i="Replaced":s==="move"?i="Moved":s==="copy"?i="Copied":s==="test"?i="Tested":s==="file"?i="Updated":console.warn("Unexpected op type: ",s),i+" "+Em(r,t)}function mY({patchSet:e,committedPatchIds:t,patchErrors:n}){const[r,o]=m.useState(!1),s=m.useRef(null),[i,a]=m.useState(!1);m.useEffect(()=>{const v=new IntersectionObserver(y=>{y[0].isIntersecting&&a(!0)},{threshold:0});return s.current&&v.observe(s.current),()=>{v.disconnect()}},[]);const{skippedPatches:l}=WS(),{deletePatches:c}=eA(),u=m.useMemo(()=>e.patches.map(v=>v.patchId),[e.patches.map(v=>v.patchId).join(",")]),f=m.useMemo(()=>{const v=[];for(const y of u){const x=n==null?void 0:n[y];!l[y]&&x&&v.unshift(x.message)}return v},[u,n,l]),h=F2(e.opTypes,e.lastUpdated,!1),p=HS(),g=e.patches.every(v=>t.has(v.patchId));return i?d.jsxs(d.Fragment,{children:[d.jsx(nw,{moduleFilePath:e.moduleFilePath,patchPath:e.patchPath,isApplied:g,authors:e.authors.reduce((v,y)=>v.includes(y)?v:v.concat(y),[]).flatMap(v=>{var x;const y=p[v];if(y){const b=((x=y==null?void 0:y.avatar)==null?void 0:x.url)??null;return[{fullName:y.fullName,url:b}]}return[]}),changeDescription:h,isOpen:r,setOpen:o,errors:f,onDelete:()=>{c(u.filter(v=>!t.has(v)))},amount:new Set(u).size}),d.jsx(Tu,{isOpen:r,children:e.patches.map((v,y)=>d.jsx(pY,{committedPatchIds:t,moduleFilePath:e.moduleFilePath,patchMetadata:v},e.moduleFilePath+":"+e.patchPath.join("/")+v.patchId+y))})]}):d.jsx(nw,{ref:s,isApplied:g})}const nw=m.forwardRef(({moduleFilePath:e,patchPath:t,changeDescription:n,authors:r,isOpen:o,setOpen:s,isSelected:i,setSelected:a,errors:l,skipped:c,onDelete:u,amount:f,isApplied:h},p)=>{const g=Nn();return d.jsxs("div",{ref:p,className:Te("p-6",{"bg-bg-secondary":!o,"bg-bg-tertiary":o,"opacity-50":h}),children:[d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"inline-block w-[calc(320px-24px-8px-16px-24px-48px)] truncate mr-2 ",children:e&&t&&d.jsx(ip,{moduleFilePath:e,patchPath:t,link:!0,toolTip:!0})}),i===void 0&&d.jsx("span",{className:Te("inline-block w-6 h-6 rounded",{"bg-bg-disabled animate-pulse":t===void 0})}),i!==void 0&&!h&&d.jsx(sd,{checked:i,onCheckedChange:v=>{a&&a(v)}}),d.jsxs("div",{className:"inline relative ml-5",children:[f&&d.jsxs(Kr,{children:[d.jsx(yo,{children:d.jsx("span",{className:"absolute -right-5 -top-6 w-6 h-6 text-xs leading-6 text-center rounded-full bg-bg-primary text-fg-primary",children:f>9?"9+":f})}),d.jsx(vr,{side:"left",children:d.jsxs("p",{children:[f," change",f>1?"s":""," in this patch set"]})})]}),u&&!h&&f&&f>0&&d.jsxs(Cr,{children:[d.jsx(Co,{children:d.jsx(Xb,{size:16,className:"inline"})}),d.jsxs(ir,{container:g,className:"flex flex-col gap-2 z-[9001]",children:[d.jsx("div",{className:"text-lg font-bold",children:"Are you sure?"}),d.jsxs("div",{children:["This will undo ",f," change",f>1?"s":"","."]}),d.jsx("div",{children:d.jsx(Hl,{asChild:!0,children:d.jsxs(Je,{variant:"destructive",onClick:u,children:["Undo change",f>1?"s":""]})})})]})]})]})]}),l&&l.length>0&&!c&&d.jsxs("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary rounded-lg",children:[l.slice(0,1).map((v,y)=>d.jsx("div",{title:v,className:"truncate",children:"Invalid change"},y)),l.length>1&&d.jsxs("div",{className:"truncate",children:["+",l.length-1," more"]})]}),(!l||l.length===0)&&c&&d.jsx("div",{className:"p-2 max-w-[240px] bg-bg-error-primary text-fg-primary",children:d.jsx("div",{className:"truncate",children:"Skipped"})}),d.jsxs("div",{className:"flex justify-between items-center pt-2",children:[d.jsxs("span",{className:"flex flex-shrink-0 gap-2",children:[r!==void 0&&r.length>0&&d.jsxs("span",{className:"flex gap-1 mr-2",children:[r.slice(0,2).map((v,y)=>{if(v.url)return d.jsxs(Kr,{children:[d.jsx(yo,{className:"flex-shrink-0 w-6 h-6",children:d.jsx("img",{src:v.url,alt:v.fullName,className:Te("rounded-full",{"-ml-3":r.length>2&&y>0})})}),d.jsx(vr,{children:d.jsx("div",{children:v.fullName})})]},v.url);const x=gY(v.fullName);return d.jsxs(Kr,{children:[d.jsx(yo,{className:Te({"-ml-3":r.length>2&&y>0}),children:d.jsx("span",{className:Te("flex items-center justify-center w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary"),"aria-label":"Initials for: "+v.fullName,children:x})}),d.jsx(vr,{children:d.jsx("div",{children:v.fullName})})]},v.fullName+v.url)}),r.length>2&&d.jsxs(Kr,{children:[d.jsx(yo,{className:Te({"-ml-3":r.length>2}),children:d.jsxs("span",{className:"flex justify-center items-center -ml-3 w-6 h-6 text-xs font-semibold rounded-full bg-bg-primary text-fg-primary",children:["+",r.length-2]})}),d.jsx(vr,{className:"grid grid-cols-[auto,1fr] gap-2",children:r.slice(2).map(v=>d.jsxs(m.Fragment,{children:[v.url?d.jsx("img",{src:v.url,alt:v.fullName,title:v.fullName,className:Te("w-6 h-6 rounded-full")},v.url):d.jsx("div",{}),d.jsx("div",{children:v.fullName})]},v.fullName+v.url))})]})]}),r===void 0&&d.jsx("span",{className:Te("inline-block w-6 h-6 mr-2",{"bg-bg-disabled animate-pulse rounded-3xl":r===void 0})}),n&&d.jsx("span",{className:Te({"text-fg-disabled":c}),children:n})]}),o!==void 0&&d.jsx("button",{className:"inline-block flex-shrink-0",onClick:()=>{s&&s(!o)},children:d.jsx(nd,{size:16,className:Te("transform",{"rotate-180":o})})})]})]})});function gY(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 rw(){const[e,t]=m.useState(!1),{publish:n,publishDisabled:r,isPublishing:o,summary:s}=tp(),i=uc(),a=i!==void 0&&Object.keys(i).length>0,l=tA(),c=nA(),u=ed(),f=Nn(),{autoPublish:h}=VS();return a?d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx(Je,{className:"flex gap-2 items-center",disabled:!0,children:u==="fs"?"Save":d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]})})}),d.jsx(vr,{children:d.jsx("div",{className:"flex flex-col gap-2",children:d.jsx("p",{children:"Fix validation errors to continue"})})})]}):u==="fs"?d.jsxs(Je,{className:"flex gap-2 items-center",disabled:r||a||h||l.length===0||c.length>0,title:a?"Please fix validation errors":"",onClick:()=>{n("No summary provided")},children:[a?d.jsx("span",{children:"Save"}):d.jsx("span",{children:o?"Saving":"Save"}),o&&d.jsx(Qr,{className:"animate-spin",size:16})]}):d.jsx("span",{children:d.jsxs(Cr,{open:e,onOpenChange:p=>{t(p)},children:[d.jsx(Co,{asChild:!0,children:d.jsxs(Je,{className:"flex gap-2 items-center",disabled:r||a||l.length===0||c.length>0,onClick:()=>{t(!0)},children:[!o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Ready"}),d.jsx(Dg,{size:16})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Pushing"}),d.jsx(Qr,{className:"animate-spin",size:16})]})]})}),d.jsxs(ir,{container:f,align:"end",className:"z-[9001] flex flex-col gap-4",children:[d.jsx(Hl,{asChild:!0,className:"self-end cursor-pointer",children:d.jsx(Wl,{size:12})}),d.jsx(y2,{onClose:()=>{t(!1)},onPublish:()=>{if(t(!1),s.type==="not-asked")return;const p=s.text.trim();n(p)}})]})]})})}function vY(){const e=iy(),{isPublishing:t}=tp(),n=uc()||{},{globalErrors:r}=WS(),o=ed(),[s,i]=m.useMemo(()=>{const a=new Set;let l=0;for(const c in n){const[u]=Y.splitModuleFilePathAndModulePath(c);a.add(u),l+=1}return[Array.from(a).sort(),l]},[n]);return d.jsxs("div",{className:"min-h-[100svh] bg-bg-primary",style:{"--menu-width":"320px"},children:[d.jsx("div",{className:"h-16 border-b border-border-primary",children:d.jsx(bY,{})}),t&&d.jsxs("div",{className:"flex gap-2 justify-end items-center p-4 text-right border-t bg-bg-tertiary text-fg-primary border-border-primary",children:[d.jsx("span",{children:"Publishing changes "}),d.jsx(Qr,{size:16,className:"animate-spin"})]}),d.jsx(yr,{children:d.jsxs("div",{className:"max-h-[calc(100svh-64px)]",children:[r&&r.length>0&&r.length!==i&&d.jsx(La,{type:"single",collapsible:!0,children:d.jsxs(Ns,{value:"global-errors",children:[d.jsxs(wi,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:["Cannot ",o==="fs"?"save":"publish"," now. Found"," ",r==null?void 0:r.length," errors in all."," ",r.length-i," were non-validation errors. A developer might need to fix these issues."]}),d.jsx(_s,{children:d.jsx(yr,{children:d.jsx("div",{className:"max-h-[calc(100svh-128px)] max-w-[var(--menu-width)]",children:r==null?void 0:r.map((a,l)=>d.jsx(xY,{error:a},l))})})})]})}),(r==null?void 0:r.length)===i&&s.length>0&&d.jsx(La,{type:"single",collapsible:!0,children:d.jsxs(Ns,{value:"global-errors",children:[d.jsx(wi,{className:"p-4 font-normal text-left rounded data-[state=open]:rounded-b-none bg-bg-error-primary text-fg-error-primary",children:d.jsxs("div",{children:[d.jsxs("div",{children:["Cannot ",o==="fs"?"save":"publish"," now."]}),d.jsx("div",{children:"Found errors in modules"})]})}),d.jsx(_s,{children:d.jsx(yr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[var(--menu-width)]",children:s==null?void 0:s.map((a,l)=>d.jsx(yY,{moduleFilePath:a},l))})})})]})}),e!=="not-asked"&&d.jsx("div",{className:Te("",{}),children:d.jsx(yr,{children:d.jsx("div",{className:"max-h-[calc(100svh-64px)] border-b border-border-primary",children:d.jsx(L2,{loadingStatus:e})})})})]})})]})}function yY({moduleFilePath:e}){const t=Y.splitModuleFilePath(e),n=Cn();return d.jsx("div",{className:"px-4 py-2 border-b bg-bg-error-primary text-fg-error-primary border-border-error-primary",children:d.jsx("button",{className:"underline cursor-pointer",onClick:()=>{n.navigate(e)},children:t.map((r,o)=>d.jsxs(m.Fragment,{children:[d.jsx("span",{className:de("text-fg-brand-secondary",{"ml-1":o>0}),children:"/"}),d.jsx("span",{children:Ou(r)})]},o))})})}function xY({error:e}){const[t,n]=m.useState(!1);return d.jsx("div",{className:de("px-1 py-2 bg-bg-error-primary text-fg-error-primary border-b border-border-error-primary",{truncate:!t,"whitespace-normal":t}),onClick:()=>n(!t),children:e})}function bY(){const{currentSourcePath:e}=Cn(),t=Ja(),[n,r]=Y.splitModuleFilePathAndModulePath(e),o=ht(n,"record"),s=m.useMemo(()=>{if(t.status!=="success")return t;if(o.status!=="success")return o;const f=t.data[n];if(f.type==="record"&&f.router){if(o.data===null)return{status:"success",data:null};const h=Object.keys(o.data),g=Y.splitModulePath(r)[0];for(const v of h)if(g&&g===v)return{status:"success",data:{previewRoute:v}}}return{status:"success",data:null}},["data"in t&&t.data,n,r,o]),{navMenu:i,toolsMenu:a}=Zy(),l=ed(),{setAutoPublish:c,autoPublish:u}=VS();return d.jsx("div",{className:"flex flex-col",children:d.jsxs("div",{className:"flex gap-2 justify-between items-center p-4 w-full",children:[d.jsx("button",{className:"lg:hidden",onClick:()=>{a.setOpen(!a.isOpen)},children:d.jsx(Ag,{size:16,className:Te("transform",{"rotate-180":!i.isOpen})})}),d.jsxs("div",{className:"flex gap-2 justify-end items-center w-full",children:[l==="fs"&&d.jsxs("div",{className:"overflow-hidden flex items-center gap-2 text-[10px] lg:text-xs",children:[d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx("span",{className:"truncate text-fg-secondary",children:"Auto-save"})}),d.jsxs(vr,{children:[d.jsx("p",{children:"When auto-save is enabled Val will save to changes to disk automatically"}),d.jsx("p",{children:"This is a development mode feature"})]})]}),d.jsx(sd,{checked:u,onCheckedChange:c})]}),d.jsx(wY,{maybePreviewRoute:s}),d.jsx(rw,{})]})]})})}function wY({maybePreviewRoute:e}){var n,r;const t=m.useMemo(()=>{var o;return e.status==="success"&&((o=e.data)!=null&&o.previewRoute)?Su("/api/val/enable",{redirect_to:window.origin+e.data.previewRoute}):Su("/api/val/enable",{redirect_to:window.origin})},[e]);return d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx(Je,{className:"flex gap-2 items-center",variant:"secondary",asChild:!0,children:d.jsxs("a",{href:t,children:[d.jsx("span",{children:"Preview"}),e.status==="success"&&((n=e.data)!=null&&n.previewRoute)?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16})]})})}),d.jsx(vr,{children:e.status==="success"&&((r=e.data)!=null&&r.previewRoute)?d.jsxs("p",{children:["Preview your changes in ",e.data.previewRoute]}):d.jsx("p",{children:"Preview your changes on the main page"})})]})}function nn({error:e,path:t}){return d.jsx("div",{id:t,children:d.jsx("div",{className:"p-4 bg-bg-error-primary text-fg-error-primary",children:e})})}function Et({path:e,type:t}){return d.jsx("div",{id:e,className:Te("pt-6",{"w-full flex items-center justify-center":t==="module","text-left":t!=="module"}),children:d.jsx(Qr,{size:t==="module"?24:16,className:"animate-spin"})})}function zn({path:e,type:t}){const[n,r]=m.useState(!1);return m.useEffect(()=>{const o=setTimeout(()=>{r(!0)},2e3);return()=>{clearTimeout(o)}},[]),e.length===0?null:n?d.jsx("div",{className:"pt-6",id:e,children:d.jsx("div",{children:"Could not get data"})}):d.jsx(Et,{path:e,type:t})}function Tr({actualType:e,expectedType:t,path:n}){return d.jsx("div",{id:n,children:d.jsxs("div",{children:["Schema mismatch: actual: ",e," vs expected: ",t," "]})})}function ut({error:e,path:t,schema:n}){const{addPatch:r,patchPath:o}=_n(t);return d.jsxs("div",{id:t,className:"flex justify-between items-center px-2 py-3 rounded-lg bg-bg-error-primary text-fg-primary",children:[d.jsxs("div",{children:["Source error: ",e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[n&&n.status==="success"&&!(n.data.type==="file"||n.data.type==="image")&&d.jsx(Je,{variant:"outline",className:"hover:bg-bg-error-secondary-hover",onClick:()=>{r([{op:"replace",path:o,value:Kl(n.data)}],n.data.type)},children:"Fix"}),d.jsx(Pu,{size:16})]})]})}function SY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const yy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function id(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function gk(e){return"nodeType"in e}function Or(e){var t,n;return e?id(e)?e:gk(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function vk(e){const{Document:t}=Or(e);return e instanceof t}function ap(e){return id(e)?!1:e instanceof Or(e).HTMLElement}function z2(e){return e instanceof Or(e).SVGElement}function ad(e){return e?id(e)?e.document:gk(e)?vk(e)?e:ap(e)||z2(e)?e.ownerDocument:document:document:document}const Ps=yy?m.useLayoutEffect:m.useEffect;function yk(e){const t=m.useRef(e);return Ps(()=>{t.current=e}),m.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 kY(){const e=m.useRef(null),t=m.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function fh(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return Ps(()=>{n.current!==e&&(n.current=e)},t),n}function lp(e,t){const n=m.useRef();return m.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Vg(e){const t=yk(e),n=m.useRef(null),r=m.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function ow(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let i0={};function cp(e,t){return m.useMemo(()=>{if(t)return t;const n=i0[e]==null?0:i0[e]+1;return i0[e]=n,e+"-"+n},[e,t])}function $2(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((s,i)=>{const a=Object.entries(i);for(const[l,c]of a){const u=s[l];u!=null&&(s[l]=u+e*c)}return s},{...t})}}const iu=$2(1),hh=$2(-1);function EY(e){return"clientX"in e&&"clientY"in e}function xk(e){if(!e)return!1;const{KeyboardEvent:t}=Or(e.target);return t&&e instanceof t}function CY(e){if(!e)return!1;const{TouchEvent:t}=Or(e.target);return t&&e instanceof t}function sw(e){if(CY(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 EY(e)?{x:e.clientX,y:e.clientY}:null}const ph=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[ph.Translate.toString(e),ph.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 NY(e){return e.matches(c_)?e:e.querySelector(c_)}const _Y={display:"none"};function PY(e){let{id:t,value:n}=e;return _e.createElement("div",{id:t,style:_Y},n)}function TY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return _e.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function OY(){const[e,t]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const B2=m.createContext(null);function jY(e){const t=m.useContext(B2);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function MY(){const[e]=m.useState(()=>new Set),t=m.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[m.useCallback(r=>{let{type:o,event:s}=r;e.forEach(i=>{var a;return(a=i[o])==null?void 0:a.call(i,s)})},[e]),t]}const RY={draggable:`
|
|
451
|
+
To pick up a draggable item, press the space bar.
|
|
452
|
+
While dragging, use the arrow keys to move the item.
|
|
453
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
454
|
+
`},AY={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 IY(e){let{announcements:t=AY,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=RY}=e;const{announce:s,announcement:i}=OY(),a=cp("DndLiveRegion"),[l,c]=m.useState(!1);if(m.useEffect(()=>{c(!0)},[]),jY(m.useMemo(()=>({onDragStart(f){let{active:h}=f;s(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&s(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;s(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;s(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;s(t.onDragCancel({active:h,over:p}))}}),[s,t])),!l)return null;const u=_e.createElement(_e.Fragment,null,_e.createElement(PY,{id:r,value:o.draggable}),_e.createElement(TY,{id:a,announcement:i}));return n?Hr.createPortal(u,n):u}var an;(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"})(an||(an={}));function Ug(){}function a0(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function DY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ts=Object.freeze({x:0,y:0});function V2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function U2(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function LY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function u_(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 W2(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function d_(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 FY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=d_(t,t.left,t.top),s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=V2(d_(l),o);s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(U2)},zY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=u_(t),s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=u_(l),u=o.reduce((h,p,g)=>h+V2(c[g],p),0),f=Number((u/4).toFixed(4));s.push({id:a,data:{droppableContainer:i,value:f}})}}return s.sort(U2)};function $Y(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),s=Math.min(t.top+t.height,e.top+e.height),i=o-r,a=s-n;if(r<o&&n<s){const l=t.width*t.height,c=e.width*e.height,u=i*a,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const BY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const s of r){const{id:i}=s,a=n.get(i);if(a){const l=$Y(a,t);l>0&&o.push({id:i,data:{droppableContainer:s,value:l}})}}return o.sort(LY)};function VY(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function H2(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ts}function UY(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...n})}}const WY=UY(1);function HY(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 KY(e,t,n){const r=HY(t);if(!r)return e;const{scaleX:o,scaleY:s,x:i,y:a}=r,l=e.left-i-(1-o)*parseFloat(n),c=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,f=s?e.height/s:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const GY={ignoreTransform:!1};function ld(e,t){t===void 0&&(t=GY);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Or(e).getComputedStyle(e);c&&(n=KY(n,c,u))}const{top:r,left:o,width:s,height:i,bottom:a,right:l}=n;return{top:r,left:o,width:s,height:i,bottom:a,right:l}}function f_(e){return ld(e,{ignoreTransform:!0})}function qY(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function YY(e,t){return t===void 0&&(t=Or(e).getComputedStyle(e)),t.position==="fixed"}function JY(e,t){t===void 0&&(t=Or(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})}function xy(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(vk(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!ap(o)||z2(o)||n.includes(o))return n;const s=Or(e).getComputedStyle(o);return o!==e&&JY(o,s)&&n.push(o),YY(o,s)?n:r(o.parentNode)}return e?r(e):n}function K2(e){const[t]=xy(e,1);return t??null}function l0(e){return!yy||!e?null:id(e)?e:gk(e)?vk(e)||e===ad(e).scrollingElement?window:ap(e)?e:null:null}function G2(e){return id(e)?e.scrollX:e.scrollLeft}function q2(e){return id(e)?e.scrollY:e.scrollTop}function iw(e){return{x:G2(e),y:q2(e)}}var gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(gn||(gn={}));function Y2(e){return!yy||!e?!1:e===document.scrollingElement}function J2(e){const t={x:0,y:0},n=Y2(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,s=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:i,isRight:a,maxScroll:r,minScroll:t}}const XY={x:.2,y:.2};function ZY(e,t,n,r,o){let{top:s,left:i,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=XY);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=J2(e),p={x:0,y:0},g={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&s<=t.top+v.height?(p.y=gn.Backward,g.y=r*Math.abs((t.top+v.height-s)/v.height)):!u&&l>=t.bottom-v.height&&(p.y=gn.Forward,g.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(p.x=gn.Forward,g.x=r*Math.abs((t.right-v.width-a)/v.width)):!f&&i<=t.left+v.width&&(p.x=gn.Backward,g.x=r*Math.abs((t.left+v.width-i)/v.width)),{direction:p,speed:g}}function QY(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:i}=window;return{top:0,left:0,right:s,bottom:i,width:s,height:i}}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 X2(e){return e.reduce((t,n)=>iu(t,iw(n)),ts)}function eJ(e){return e.reduce((t,n)=>t+G2(n),0)}function tJ(e){return e.reduce((t,n)=>t+q2(n),0)}function nJ(e,t){if(t===void 0&&(t=ld),!e)return;const{top:n,left:r,bottom:o,right:s}=t(e);K2(e)&&(o<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rJ=[["x",["left","right"],eJ],["y",["top","bottom"],tJ]];class bk{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=xy(n),o=X2(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,i,a]of rJ)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[s]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pf{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 oJ(e){const{EventTarget:t}=Or(e);return e instanceof t?e:ad(e)}function c0(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 uo;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(uo||(uo={}));function h_(e){e.preventDefault()}function sJ(e){e.stopPropagation()}var ot;(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"})(ot||(ot={}));const Z2={start:[ot.Space,ot.Enter],cancel:[ot.Esc],end:[ot.Space,ot.Enter,ot.Tab]},iJ=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ot.Right:return{...n,x:n.x+25};case ot.Left:return{...n,x:n.x-25};case ot.Down:return{...n,y:n.y+25};case ot.Up:return{...n,y:n.y-25}}};class wk{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 Pf(ad(n)),this.windowListeners=new Pf(Or(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(uo.Resize,this.handleCancel),this.windowListeners.add(uo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(uo.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&nJ(r),n(ts)}handleKeyDown(t){if(xk(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:s=Z2,coordinateGetter:i=iJ,scrollBehavior:a="smooth"}=o,{code:l}=t;if(s.end.includes(l)){this.handleEnd(t);return}if(s.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:ts;this.referenceCoordinates||(this.referenceCoordinates=u);const f=i(t,{active:n,context:r.current,currentCoordinates:u});if(f){const h=hh(f,u),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const v of g){const y=t.code,{isTop:x,isRight:b,isLeft:w,isBottom:E,maxScroll:C,minScroll:_}=J2(v),N=QY(v),P={x:Math.min(y===ot.Right?N.right-N.width/2:N.right,Math.max(y===ot.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(y===ot.Down?N.bottom-N.height/2:N.bottom,Math.max(y===ot.Down?N.top:N.top+N.height/2,f.y))},j=y===ot.Right&&!b||y===ot.Left&&!w,A=y===ot.Down&&!E||y===ot.Up&&!x;if(j&&P.x!==f.x){const U=v.scrollLeft+h.x,L=y===ot.Right&&U<=C.x||y===ot.Left&&U>=_.x;if(L&&!h.y){v.scrollTo({left:U,behavior:a});return}L?p.x=v.scrollLeft-U:p.x=y===ot.Right?v.scrollLeft-C.x:v.scrollLeft-_.x,p.x&&v.scrollBy({left:-p.x,behavior:a});break}else if(A&&P.y!==f.y){const U=v.scrollTop+h.y,L=y===ot.Down&&U<=C.y||y===ot.Up&&U>=_.y;if(L&&!h.x){v.scrollTo({top:U,behavior:a});return}L?p.y=v.scrollTop-U:p.y=y===ot.Down?v.scrollTop-C.y:v.scrollTop-_.y,p.y&&v.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,iu(hh(f,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()}}wk.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Z2,onActivation:o}=t,{active:s}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=s.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function p_(e){return!!(e&&"distance"in e)}function m_(e){return!!(e&&"delay"in e)}class Sk{constructor(t,n,r){var o;r===void 0&&(r=oJ(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:s}=t,{target:i}=s;this.props=t,this.events=n,this.document=ad(i),this.documentListeners=new Pf(this.document),this.listeners=new Pf(r),this.windowListeners=new Pf(Or(i)),this.initialCoordinates=(o=sw(s))!=null?o:ts,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(uo.Resize,this.handleCancel),this.windowListeners.add(uo.DragStart,h_),this.windowListeners.add(uo.VisibilityChange,this.handleCancel),this.windowListeners.add(uo.ContextMenu,h_),this.documentListeners.add(uo.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(p_(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(uo.Click,sJ,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(uo.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:i,options:{activationConstraint:a}}=s;if(!o)return;const l=(n=sw(t))!=null?n:ts,c=hh(o,l);if(!r&&a){if(p_(a)){if(a.tolerance!=null&&c0(c,a.tolerance))return this.handleCancel();if(c0(c,a.distance))return this.handleStart()}if(m_(a)&&c0(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),i(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===ot.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const aJ={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Q2 extends Sk{constructor(t){const{event:n}=t,r=ad(n.target);super(t,aJ,r)}}Q2.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 lJ={move:{name:"mousemove"},end:{name:"mouseup"}};var aw;(function(e){e[e.RightClick=2]="RightClick"})(aw||(aw={}));class eI extends Sk{constructor(t){super(t,lJ,ad(t.event.target))}}eI.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===aw.RightClick?!1:(r==null||r({event:n}),!0)}}];const u0={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tI extends Sk{constructor(t){super(t,u0)}static setup(){return window.addEventListener(u0.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(u0.move.name,t)};function t(){}}}tI.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 Tf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tf||(Tf={}));var Wg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Wg||(Wg={}));function cJ(e){let{acceleration:t,activator:n=Tf.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:i=5,order:a=Wg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=e;const p=dJ({delta:f,disabled:!s}),[g,v]=kY(),y=m.useRef({x:0,y:0}),x=m.useRef({x:0,y:0}),b=m.useMemo(()=>{switch(n){case Tf.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Tf.DraggableRect:return o}},[n,o,l]),w=m.useRef(null),E=m.useCallback(()=>{const _=w.current;if(!_)return;const N=y.current.x*x.current.x,P=y.current.y*x.current.y;_.scrollBy(N,P)},[]),C=m.useMemo(()=>a===Wg.TreeOrder?[...c].reverse():c,[a,c]);m.useEffect(()=>{if(!s||!c.length||!b){v();return}for(const _ of C){if((r==null?void 0:r(_))===!1)continue;const N=c.indexOf(_),P=u[N];if(!P)continue;const{direction:j,speed:A}=ZY(_,P,b,t,h);for(const U of["x","y"])p[U][j[U]]||(A[U]=0,j[U]=0);if(A.x>0||A.y>0){v(),w.current=_,g(E,i),y.current=A,x.current=j;return}}y.current={x:0,y:0},x.current={x:0,y:0},v()},[t,E,r,v,s,i,JSON.stringify(b),JSON.stringify(p),g,c,C,u,JSON.stringify(h)])}const uJ={x:{[gn.Backward]:!1,[gn.Forward]:!1},y:{[gn.Backward]:!1,[gn.Forward]:!1}};function dJ(e){let{delta:t,disabled:n}=e;const r=ow(t);return lp(o=>{if(n||!r||!o)return uJ;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[gn.Backward]:o.x[gn.Backward]||s.x===-1,[gn.Forward]:o.x[gn.Forward]||s.x===1},y:{[gn.Backward]:o.y[gn.Backward]||s.y===-1,[gn.Forward]:o.y[gn.Forward]||s.y===1}}},[n,t,r])}function fJ(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return lp(o=>{var s;return t==null?null:(s=r??o)!=null?s:null},[r,t])}function hJ(e,t){return m.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...s]},[]),[e,t])}var mh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(mh||(mh={}));var lw;(function(e){e.Optimized="optimized"})(lw||(lw={}));const g_=new Map;function pJ(e,t){let{dragging:n,dependencies:r,config:o}=t;const[s,i]=m.useState(null),{frequency:a,measure:l,strategy:c}=o,u=m.useRef(e),f=y(),h=fh(f),p=m.useCallback(function(x){x===void 0&&(x=[]),!h.current&&i(b=>b===null?x:b.concat(x.filter(w=>!b.includes(w))))},[h]),g=m.useRef(null),v=lp(x=>{if(f&&!n)return g_;if(!x||x===g_||u.current!==e||s!=null){const b=new Map;for(let w of e){if(!w)continue;if(s&&s.length>0&&!s.includes(w.id)&&w.rect.current){b.set(w.id,w.rect.current);continue}const E=w.node.current,C=E?new bk(l(E),E):null;w.rect.current=C,C&&b.set(w.id,C)}return b}return x},[e,s,n,f,l]);return m.useEffect(()=>{u.current=e},[e]),m.useEffect(()=>{f||p()},[n,f]),m.useEffect(()=>{s&&s.length>0&&i(null)},[JSON.stringify(s)]),m.useEffect(()=>{f||typeof a!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},a))},[a,f,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:s!=null};function y(){switch(c){case mh.Always:return!1;case mh.BeforeDragging:return n;default:return!n}}}function nI(e,t){return lp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function mJ(e,t){return nI(e,t)}function gJ(e){let{callback:t,disabled:n}=e;const r=yk(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function by(e){let{callback:t,disabled:n}=e;const r=yk(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function vJ(e){return new bk(ld(e),e)}function v_(e,t,n){t===void 0&&(t=vJ);const[r,o]=m.useState(null);function s(){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 i=gJ({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),a=by({callback:s});return Ps(()=>{s(),e?(a==null||a.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),i==null||i.disconnect())},[e]),r}function yJ(e){const t=nI(e);return H2(e,t)}const y_=[];function xJ(e){const t=m.useRef(e),n=lp(r=>e?r&&r!==y_&&e&&t.current&&e.parentNode===t.current.parentNode?r:xy(e):y_,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function bJ(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(s=>{const i=l0(s.target);i&&n(a=>a?(a.set(i,iw(i)),new Map(a)):null)},[]);return m.useEffect(()=>{const s=r.current;if(e!==s){i(s);const a=e.map(l=>{const c=l0(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,iw(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(s)};function i(a){a.forEach(l=>{const c=l0(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,i)=>iu(s,i),ts):X2(e):ts,[e,t])}function x_(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==ts;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?hh(e,n.current):ts}function wJ(e){m.useEffect(()=>{if(!yy)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 SJ(e,t){return m.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:s}=r;return n[o]=i=>{s(i,t)},n},{}),[e,t])}function rI(e){return m.useMemo(()=>e?qY(e):null,[e])}const b_=[];function kJ(e,t){t===void 0&&(t=ld);const[n]=e,r=rI(n?Or(n):null),[o,s]=m.useState(b_);function i(){s(()=>e.length?e.map(l=>Y2(l)?r:new bk(t(l),l)):b_)}const a=by({callback:i});return Ps(()=>{a==null||a.disconnect(),i(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function EJ(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ap(t)?t:e}function CJ(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(c=>{for(const{target:u}of c)if(ap(u)){r(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=by({callback:o}),i=m.useCallback(c=>{const u=EJ(c);s==null||s.disconnect(),u&&(s==null||s.observe(u)),r(u?t(u):null)},[t,s]),[a,l]=Vg(i);return m.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const NJ=[{sensor:Q2,options:{}},{sensor:wk,options:{}}],_J={current:{}},Cm={draggable:{measure:f_},droppable:{measure:f_,strategy:mh.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:ld}};class Of 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 PJ={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Of,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ug},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Cm,measureDroppableContainers:Ug,windowRect:null,measuringScheduled:!1},TJ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ug,draggableNodes:new Map,over:null,measureDroppableContainers:Ug},wy=m.createContext(TJ),oI=m.createContext(PJ);function OJ(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Of}}}function jJ(e,t){switch(t.type){case an.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case an.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 an.DragEnd:case an.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case an.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Of(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case an.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new Of(e.droppable.containers);return i.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case an.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Of(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function MJ(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(wy),s=ow(r),i=ow(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&s&&i!=null){if(!xk(s)||document.activeElement===s.target)return;const a=o.get(i);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 f=NY(u);if(f){f.focus();break}}})}},[r,t,o,i,s]),null}function RJ(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),n):n}function AJ(e){return m.useMemo(()=>({draggable:{...Cm.draggable,...e==null?void 0:e.draggable},droppable:{...Cm.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Cm.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 IJ(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const s=m.useRef(!1),{x:i,y:a}=typeof o=="boolean"?{x:o,y:o}:o;Ps(()=>{if(!i&&!a||!t){s.current=!1;return}if(s.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=H2(u,r);if(i||(f.x=0),a||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=K2(c);h&&h.scrollBy({top:f.y,left:f.x})}},[t,i,a,r,n])}const sI=m.createContext({...ts,scaleX:1,scaleY:1});var Zi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Zi||(Zi={}));const DJ=m.memo(function(t){var n,r,o,s;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:u=NJ,collisionDetection:f=BY,measuring:h,modifiers:p,...g}=t;const v=m.useReducer(jJ,void 0,OJ),[y,x]=v,[b,w]=MY(),[E,C]=m.useState(Zi.Uninitialized),_=E===Zi.Initialized,{draggable:{active:N,nodes:P,translate:j},droppable:{containers:A}}=y,U=N!=null?P.get(N):null,L=m.useRef({initial:null,translated:null}),K=m.useMemo(()=>{var Vn;return N!=null?{id:N,data:(Vn=U==null?void 0:U.data)!=null?Vn:_J,rect:L}:null},[N,U]),W=m.useRef(null),[V,H]=m.useState(null),[z,R]=m.useState(null),$=fh(g,Object.values(g)),J=cp("DndDescribedBy",i),G=m.useMemo(()=>A.getEnabled(),[A]),ie=AJ(h),{droppableRects:Xe,measureDroppableContainers:He,measuringScheduled:ce}=pJ(G,{dragging:_,dependencies:[j.x,j.y],config:ie.droppable}),pe=fJ(P,N),Z=m.useMemo(()=>z?sw(z):null,[z]),Pe=Q3(),De=mJ(pe,ie.draggable.measure);IJ({activeNode:N!=null?P.get(N):null,config:Pe.layoutShiftCompensation,initialRect:De,measure:ie.draggable.measure});const ge=v_(pe,ie.draggable.measure,De),$e=v_(pe?pe.parentElement:null),je=m.useRef({activatorEvent:null,active:null,activeNode:pe,collisionRect:null,collisions:null,droppableRects:Xe,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),it=A.getNodeFor((n=je.current.over)==null?void 0:n.id),St=CJ({measure:ie.dragOverlay.measure}),Jt=(r=St.nodeRef.current)!=null?r:pe,T=_?(o=St.rect)!=null?o:ge:null,S=!!(St.nodeRef.current&&St.rect),k=yJ(S?null:ge),O=rI(Jt?Or(Jt):null),F=xJ(_?it??pe:null),X=kJ(F),ee=RJ(p,{transform:{x:j.x-k.x,y:j.y-k.y,scaleX:1,scaleY:1},activatorEvent:z,active:K,activeNodeRect:ge,containerNodeRect:$e,draggingNodeRect:T,over:je.current.over,overlayNodeRect:St.rect,scrollableAncestors:F,scrollableAncestorRects:X,windowRect:O}),et=Z?iu(Z,j):null,pt=bJ(F),Nt=x_(pt),hn=x_(pt,[ge]),gt=iu(ee,Nt),Ro=T?WY(T,ee):null,Pi=K&&Ro?f({active:K,collisionRect:Ro,droppableRects:Xe,droppableContainers:G,pointerCoordinates:et}):null,md=W2(Pi,"id"),[Ti,TE]=m.useState(null),q3=S?ee:iu(ee,hn),Y3=VY(q3,(s=Ti==null?void 0:Ti.rect)!=null?s:null,ge),nx=m.useRef(null),OE=m.useCallback((Vn,Mr)=>{let{sensor:Rr,options:Oi}=Mr;if(W.current==null)return;const ao=P.get(W.current);if(!ao)return;const Ar=Vn.nativeEvent,as=new Rr({active:W.current,activeNode:ao,event:Ar,options:Oi,context:je,onAbort(Pn){if(!P.get(Pn))return;const{onDragAbort:ls}=$.current,Fs={id:Pn};ls==null||ls(Fs),b({type:"onDragAbort",event:Fs})},onPending(Pn,ji,ls,Fs){if(!P.get(Pn))return;const{onDragPending:vd}=$.current,Mi={id:Pn,constraint:ji,initialCoordinates:ls,offset:Fs};vd==null||vd(Mi),b({type:"onDragPending",event:Mi})},onStart(Pn){const ji=W.current;if(ji==null)return;const ls=P.get(ji);if(!ls)return;const{onDragStart:Fs}=$.current,gd={activatorEvent:Ar,active:{id:ji,data:ls.data,rect:L}};Hr.unstable_batchedUpdates(()=>{Fs==null||Fs(gd),C(Zi.Initializing),x({type:an.DragStart,initialCoordinates:Pn,active:ji}),b({type:"onDragStart",event:gd}),H(nx.current),R(Ar)})},onMove(Pn){x({type:an.DragMove,coordinates:Pn})},onEnd:gc(an.DragEnd),onCancel:gc(an.DragCancel)});nx.current=as;function gc(Pn){return async function(){const{active:ls,collisions:Fs,over:gd,scrollAdjustedTranslate:vd}=je.current;let Mi=null;if(ls&&vd){const{cancelDrop:yd}=$.current;Mi={activatorEvent:Ar,active:ls,collisions:Fs,delta:vd,over:gd},Pn===an.DragEnd&&typeof yd=="function"&&await Promise.resolve(yd(Mi))&&(Pn=an.DragCancel)}W.current=null,Hr.unstable_batchedUpdates(()=>{x({type:Pn}),C(Zi.Uninitialized),TE(null),H(null),R(null),nx.current=null;const yd=Pn===an.DragEnd?"onDragEnd":"onDragCancel";if(Mi){const rx=$.current[yd];rx==null||rx(Mi),b({type:yd,event:Mi})}})}}},[P]),J3=m.useCallback((Vn,Mr)=>(Rr,Oi)=>{const ao=Rr.nativeEvent,Ar=P.get(Oi);if(W.current!==null||!Ar||ao.dndKit||ao.defaultPrevented)return;const as={active:Ar};Vn(Rr,Mr.options,as)===!0&&(ao.dndKit={capturedBy:Mr.sensor},W.current=Oi,OE(Rr,Mr))},[P,OE]),jE=hJ(u,J3);wJ(u),Ps(()=>{ge&&E===Zi.Initializing&&C(Zi.Initialized)},[ge,E]),m.useEffect(()=>{const{onDragMove:Vn}=$.current,{active:Mr,activatorEvent:Rr,collisions:Oi,over:ao}=je.current;if(!Mr||!Rr)return;const Ar={active:Mr,activatorEvent:Rr,collisions:Oi,delta:{x:gt.x,y:gt.y},over:ao};Hr.unstable_batchedUpdates(()=>{Vn==null||Vn(Ar),b({type:"onDragMove",event:Ar})})},[gt.x,gt.y]),m.useEffect(()=>{const{active:Vn,activatorEvent:Mr,collisions:Rr,droppableContainers:Oi,scrollAdjustedTranslate:ao}=je.current;if(!Vn||W.current==null||!Mr||!ao)return;const{onDragOver:Ar}=$.current,as=Oi.get(md),gc=as&&as.rect.current?{id:as.id,rect:as.rect.current,data:as.data,disabled:as.disabled}:null,Pn={active:Vn,activatorEvent:Mr,collisions:Rr,delta:{x:ao.x,y:ao.y},over:gc};Hr.unstable_batchedUpdates(()=>{TE(gc),Ar==null||Ar(Pn),b({type:"onDragOver",event:Pn})})},[md]),Ps(()=>{je.current={activatorEvent:z,active:K,activeNode:pe,collisionRect:Ro,collisions:Pi,droppableRects:Xe,draggableNodes:P,draggingNode:Jt,draggingNodeRect:T,droppableContainers:A,over:Ti,scrollableAncestors:F,scrollAdjustedTranslate:gt},L.current={initial:T,translated:Ro}},[K,pe,Pi,Ro,P,Jt,T,Xe,A,Ti,F,gt]),cJ({...Pe,delta:j,draggingRect:Ro,pointerCoordinates:et,scrollableAncestors:F,scrollableAncestorRects:X});const X3=m.useMemo(()=>({active:K,activeNode:pe,activeNodeRect:ge,activatorEvent:z,collisions:Pi,containerNodeRect:$e,dragOverlay:St,draggableNodes:P,droppableContainers:A,droppableRects:Xe,over:Ti,measureDroppableContainers:He,scrollableAncestors:F,scrollableAncestorRects:X,measuringConfiguration:ie,measuringScheduled:ce,windowRect:O}),[K,pe,ge,z,Pi,$e,St,P,A,Xe,Ti,He,F,X,ie,ce,O]),Z3=m.useMemo(()=>({activatorEvent:z,activators:jE,active:K,activeNodeRect:ge,ariaDescribedById:{draggable:J},dispatch:x,draggableNodes:P,over:Ti,measureDroppableContainers:He}),[z,jE,K,ge,x,J,P,Ti,He]);return _e.createElement(B2.Provider,{value:w},_e.createElement(wy.Provider,{value:Z3},_e.createElement(oI.Provider,{value:X3},_e.createElement(sI.Provider,{value:Y3},c)),_e.createElement(MJ,{disabled:(a==null?void 0:a.restoreFocus)===!1})),_e.createElement(IY,{...a,hiddenTextDescribedById:J}));function Q3(){const Vn=(V==null?void 0:V.autoScrollEnabled)===!1,Mr=typeof l=="object"?l.enabled===!1:l===!1,Rr=_&&!Vn&&!Mr;return typeof l=="object"?{...l,enabled:Rr}:{enabled:Rr}}}),LJ=m.createContext(null),w_="button",FJ="Draggable";function zJ(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const s=cp(FJ),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=m.useContext(wy),{role:p=w_,roleDescription:g="draggable",tabIndex:v=0}=o??{},y=(l==null?void 0:l.id)===t,x=m.useContext(y?sI:LJ),[b,w]=Vg(),[E,C]=Vg(),_=SJ(i,t),N=fh(n);Ps(()=>(f.set(t,{id:t,key:s,node:b,activatorNode:E,data:N}),()=>{const j=f.get(t);j&&j.key===s&&f.delete(t)}),[f,t]);const P=m.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":y&&p===w_?!0:void 0,"aria-roledescription":g,"aria-describedby":u.draggable}),[r,p,v,y,g,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:P,isDragging:y,listeners:r?void 0:_,node:b,over:h,setNodeRef:w,setActivatorNodeRef:C,transform:x}}function $J(){return m.useContext(oI)}const BJ="Droppable",VJ={timeout:25};function UJ(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const s=cp(BJ),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=m.useContext(wy),u=m.useRef({disabled:n}),f=m.useRef(!1),h=m.useRef(null),p=m.useRef(null),{disabled:g,updateMeasurementsFor:v,timeout:y}={...VJ,...o},x=fh(v??r),b=m.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),p.current=null},y)},[y]),w=by({callback:b,disabled:g||!i}),E=m.useCallback((P,j)=>{w&&(j&&(w.unobserve(j),f.current=!1),P&&w.observe(P))},[w]),[C,_]=Vg(E),N=fh(t);return m.useEffect(()=>{!w||!C.current||(w.disconnect(),f.current=!1,w.observe(C.current))},[C,w]),m.useEffect(()=>(a({type:an.RegisterDroppable,element:{id:r,key:s,disabled:n,node:C,rect:h,data:N}}),()=>a({type:an.UnregisterDroppable,key:s,id:r})),[r]),m.useEffect(()=>{n!==u.current.disabled&&(a({type:an.SetDroppableDisabled,id:r,key:s,disabled:n}),u.current.disabled=n)},[r,s,n,a]),{active:i,rect:h,isOver:(l==null?void 0:l.id)===r,node:C,over:l,setNodeRef:_}}function kk(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function WJ(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function em(e){return e!==null&&e>=0}function HJ(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 KJ(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const iI=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const s=kk(t,r,n),i=t[o],a=s[o];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},tm={scaleX:1,scaleY:1},GJ=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:s,overIndex:i}=e;const a=(t=s[n])!=null?t:r;if(!a)return null;if(o===n){const c=s[i];return c?{x:0,y:n<i?c.top+c.height-(a.top+a.height):c.top-a.top,...tm}:null}const l=qJ(s,o,n);return o>n&&o<=i?{x:0,y:-a.height-l,...tm}:o<n&&o>=i?{x:0,y:a.height+l,...tm}:{x:0,y:0,...tm}};function qJ(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const aI="Sortable",lI=_e.createContext({activeIndex:-1,containerId:aI,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:iI,disabled:{draggable:!1,droppable:!1}});function YJ(e){let{children:t,id:n,items:r,strategy:o=iI,disabled:s=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=$J(),f=cp(aI,n),h=a.rect!==null,p=m.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),g=i!=null,v=i?p.indexOf(i.id):-1,y=c?p.indexOf(c.id):-1,x=m.useRef(p),b=!HJ(p,x.current),w=y!==-1&&v===-1||b,E=KJ(s);Ps(()=>{b&&g&&u(p)},[b,p,g,u]),m.useEffect(()=>{x.current=p},[p]);const C=m.useMemo(()=>({activeIndex:v,containerId:f,disabled:E,disableTransforms:w,items:p,overIndex:y,useDragOverlay:h,sortedRects:WJ(p,l),strategy:o}),[v,f,E.draggable,E.droppable,w,p,y,l,h,o]);return _e.createElement(lI.Provider,{value:C},t)}const JJ=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return kk(n,r,o).indexOf(t)},XJ=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:s,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==s&&o===i?!1:n?!0:i!==o&&t===l},ZJ={duration:200,easing:"ease"},cI="transform",QJ=ph.Transition.toString({property:cI,duration:0,easing:"linear"}),eX={roleDescription:"sortable"};function tX(e){let{disabled:t,index:n,node:r,rect:o}=e;const[s,i]=m.useState(null),a=m.useRef(n);return Ps(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=ld(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)&&i(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),m.useEffect(()=>{s&&i(null)},[s]),s}function nX(e){let{animateLayoutChanges:t=XJ,attributes:n,disabled:r,data:o,getNewIndex:s=JJ,id:i,strategy:a,resizeObserverConfig:l,transition:c=ZJ}=e;const{items:u,containerId:f,activeIndex:h,disabled:p,disableTransforms:g,sortedRects:v,overIndex:y,useDragOverlay:x,strategy:b}=m.useContext(lI),w=rX(r,p),E=u.indexOf(i),C=m.useMemo(()=>({sortable:{containerId:f,index:E,items:u},...o}),[f,o,E,u]),_=m.useMemo(()=>u.slice(u.indexOf(i)),[u,i]),{rect:N,node:P,isOver:j,setNodeRef:A}=UJ({id:i,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...l}}),{active:U,activatorEvent:L,activeNodeRect:K,attributes:W,setNodeRef:V,listeners:H,isDragging:z,over:R,setActivatorNodeRef:$,transform:J}=zJ({id:i,data:C,attributes:{...eX,...n},disabled:w.draggable}),G=SY(A,V),ie=!!U,Xe=ie&&!g&&em(h)&&em(y),He=!x&&z,ce=He&&Xe?J:null,Z=Xe?ce??(a??b)({rects:v,activeNodeRect:K,activeIndex:h,overIndex:y,index:E}):null,Pe=em(h)&&em(y)?s({id:i,items:u,activeIndex:h,overIndex:y}):E,De=U==null?void 0:U.id,ge=m.useRef({activeId:De,items:u,newIndex:Pe,containerId:f}),$e=u!==ge.current.items,je=t({active:U,containerId:f,isDragging:z,isSorting:ie,id:i,index:E,items:u,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:c,wasDragging:ge.current.activeId!=null}),it=tX({disabled:!je,index:E,node:P,rect:N});return m.useEffect(()=>{ie&&ge.current.newIndex!==Pe&&(ge.current.newIndex=Pe),f!==ge.current.containerId&&(ge.current.containerId=f),u!==ge.current.items&&(ge.current.items=u)},[ie,Pe,f,u]),m.useEffect(()=>{if(De===ge.current.activeId)return;if(De&&!ge.current.activeId){ge.current.activeId=De;return}const Jt=setTimeout(()=>{ge.current.activeId=De},50);return()=>clearTimeout(Jt)},[De]),{active:U,activeIndex:h,attributes:W,data:C,rect:N,index:E,newIndex:Pe,items:u,isOver:j,isSorting:ie,isDragging:z,listeners:H,node:P,overIndex:y,over:R,setNodeRef:G,setActivatorNodeRef:$,setDroppableNodeRef:A,setDraggableNodeRef:V,transform:it??Z,transition:St()};function St(){if(it||$e&&ge.current.newIndex===E)return QJ;if(!(He&&!xk(L)||!c)&&(ie||je))return ph.Transition.toString({...c,property:cI})}}function rX(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 Hg(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 oX=[ot.Down,ot.Right,ot.Up,ot.Left],sX=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:s,over:i,scrollableAncestors:a}}=t;if(oX.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=o.get(f.id);if(h)switch(e.code){case ot.Down:r.top<h.top&&l.push(f);break;case ot.Up:r.top>h.top&&l.push(f);break;case ot.Left:r.left>h.left&&l.push(f);break;case ot.Right:r.left<h.left&&l.push(f);break}});const c=zY({collisionRect:r,droppableRects:o,droppableContainers:l});let u=W2(c,"id");if(u===(i==null?void 0:i.id)&&c.length>1&&(u=c[1].id),u!=null){const f=s.get(n.id),h=s.get(u),p=h?o.get(h.id):null,g=h==null?void 0:h.node.current;if(g&&p&&f&&h){const y=xy(g).some((_,N)=>a[N]!==_),x=uI(f,h),b=iX(f,h),w=y||!x?{x:0,y:0}:{x:b?r.width-p.width:0,y:b?r.height-p.height:0},E={x:p.left,y:p.top};return w.x&&w.y?E:hh(E,w)}}}};function uI(e,t){return!Hg(e)||!Hg(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function iX(e,t){return!Hg(e)||!Hg(t)||!uI(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Nr({}){return null}function aX(e){const[t,n]=m.useState(e.value||e.defaultValue||""),r="flex rounded-md m-1 border border-border-primary 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";return d.jsxs("div",{className:"grid",children:[d.jsx("textarea",{...e,className:de("resize-none overflow-hidden",r,e.className),style:{gridArea:"1 / 1 / 2 / 2"},onInput:o=>{var s;n(o.currentTarget.value),(s=e.onInput)==null||s.call(e,o)}}),d.jsx("div",{className:de("whitespace-pre-wrap invisible",r,e.className),style:{gridArea:"1 / 1 / 2 / 2"},children:t+" "})]})}function dI({path:e,autoFocus:t}){const n="string",r=Vt(e),o=ht(e,"string"),{patchPath:s,addPatch:i}=_n(e),[a,l]=m.useState(null),c="data"in o&&o.data,u="clientSideOnly"in o&&o.clientSideOnly;m.useEffect(()=>{u===!1&&l(typeof c=="string"?c:null)},[c,u]);const f=US(e),[h,p]=m.useState(!1);return m.useEffect(()=>{f&&f.status==="success"&&(f.data.layout==="textarea"?p(!0):p(!1))},[f]),r.status==="error"?d.jsx(nn,{path:e,error:r.error,type:n}):o.status==="error"?d.jsx(ut,{path:e,error:o.error,schema:r}):o.status=="not-found"||r.status==="not-found"?d.jsx(zn,{path:e,type:n}):r.status==="loading"?d.jsx(Et,{path:e,type:n}):!("data"in o)||o.data===void 0?d.jsx(Et,{path:e,type:n}):r.data.type!==n?d.jsx(Tr,{path:e,expectedType:n,actualType:r.data.type}):h?d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(aX,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,defaultValue:a||"",onChange:g=>{l(g.target.value),i([{op:"replace",path:s,value:g.target.value}],n)}})]}):d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(od,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,value:a||"",onChange:g=>{l(g.target.value),i([{op:"replace",path:s,value:g.target.value}],n)}})]})}function lX({path:e}){const t=ht(e,"string");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx("div",{className:"truncate",children:t.data})}function cX({path:e}){const t="boolean",n=Vt(e),r=ht(e,t),{patchPath:o,addPatch:s}=_n(e);if(n.status==="error")return d.jsx(nn,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(ut,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(zn,{path:e,type:t});if(n.status==="loading")return d.jsx(Et,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(Et,{path:e,type:t});if(n.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:n.data.type});const i=r.data,a=i===null?"indeterminate":i;return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(sd,{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),s([{op:"replace",path:o,value:l}],n.data.type)}})]})}function uX({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:s}=_n(e);return typeof t!="boolean"&&t!==null?d.jsx(ut,{path:e,error:"Expected boolean"}):d.jsx(sd,{id:e,disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:s,value:!0}]:t===!1&&n?[{op:"replace",path:s,value:null}]:t===!1?[{op:"replace",path:s,value:!0}]:[{op:"replace",path:s,value:!1}],"boolean")}})}function dX({path:e}){const t=ht(e,"boolean");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):t.data===!0?d.jsx("div",{className:"flex justify-center items-center w-4 h-4 rounded border border-border-primary",children:d.jsx(td,{className:"w-3 h-3"})}):t.data===!1?d.jsx("div",{className:"w-4 h-4 rounded border border-border-primary"}):(console.warn("Unexpected value for boolean field",t.data),d.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function fX({path:e}){const t="number",n=Vt(e),r=ht(e,t),{patchPath:o,addPatch:s}=_n(e);if(n.status==="error")return d.jsx(nn,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(ut,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(zn,{path:e,type:t});if(n.status==="loading")return d.jsx(Et,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(Et,{path:e,type:t});if(n.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:n.data.type});const i=r.data;return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(od,{inputMode:"numeric",value:i||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||s([{op:"replace",path:o,value:l}],t)}})]})}function hX({path:e}){const t=ht(e,"number");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx("div",{className:"truncate",children:t.data})}function pX(e){const t=mX(e),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(vX);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function mX(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=xX(o),a=yX(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gX=Symbol("radix.slottable");function vX(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gX}function yX(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function xX(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 bX=[" ","Enter","ArrowUp","ArrowDown"],wX=[" ","Enter"],Gl="Select",[Sy,ky,SX]=py(Gl),[cd]=dr(Gl,[SX,Ds]),Ey=Ds(),[kX,Za]=cd(Gl),[EX,CX]=cd(Gl),fI=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:p,form:g}=e,v=Ey(t),[y,x]=m.useState(null),[b,w]=m.useState(null),[E,C]=m.useState(!1),_=np(c),[N,P]=Zr({prop:r,defaultProp:o??!1,onChange:s,caller:Gl}),[j,A]=Zr({prop:i,defaultProp:a,onChange:l,caller:Gl}),U=m.useRef(null),L=y?g||!!y.closest("form"):!0,[K,W]=m.useState(new Set),V=Array.from(K).map(H=>H.props.value).join(";");return d.jsx(Jh,{...v,children:d.jsxs(kX,{required:p,scope:t,trigger:y,onTriggerChange:x,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:C,contentId:qr(),value:j,onValueChange:A,open:N,onOpenChange:P,dir:_,triggerPointerDownPosRef:U,disabled:h,children:[d.jsx(Sy.Provider,{scope:t,children:d.jsx(EX,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(H=>{W(z=>new Set(z).add(H))},[]),onNativeOptionRemove:m.useCallback(H=>{W(z=>{const R=new Set(z);return R.delete(H),R})},[]),children:n})}),L?d.jsxs(AI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:f,value:j,onChange:H=>A(H.target.value),disabled:h,form:g,children:[j===void 0?d.jsx("option",{value:""}):null,Array.from(K)]},V):null]})})};fI.displayName=Gl;var hI="SelectTrigger",pI=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Ey(n),i=Za(hI,n),a=i.disabled||r,l=Ue(t,i.onTriggerChange),c=ky(n),u=m.useRef("touch"),[f,h,p]=DI(v=>{const y=c().filter(w=>!w.disabled),x=y.find(w=>w.value===i.value),b=LI(y,v,x);b!==void 0&&i.onValueChange(b.value)}),g=v=>{a||(i.onOpenChange(!0),p()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return d.jsx(Ju,{asChild:!0,...s,children:d.jsx(Oe.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":II(i.value)?"":void 0,...o,ref:l,onClick:ne(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&g(v)}),onPointerDown:ne(o.onPointerDown,v=>{u.current=v.pointerType;const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(g(v),v.preventDefault())}),onKeyDown:ne(o.onKeyDown,v=>{const y=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(y&&v.key===" ")&&bX.includes(v.key)&&(g(),v.preventDefault())})})})});pI.displayName=hI;var mI="SelectValue",gI=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=Za(mI,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,f=Ue(t,l.onValueNodeChange);return En(()=>{c(u)},[c,u]),d.jsx(Oe.span,{...a,ref:f,style:{pointerEvents:"none"},children:II(l.value)?d.jsx(d.Fragment,{children:i}):s})});gI.displayName=mI;var NX="SelectIcon",vI=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return d.jsx(Oe.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});vI.displayName=NX;var _X="SelectPortal",yI=e=>d.jsx(Xu,{asChild:!0,...e});yI.displayName=_X;var ql="SelectContent",xI=m.forwardRef((e,t)=>{const n=Za(ql,e.__scopeSelect),[r,o]=m.useState();if(En(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Hr.createPortal(d.jsx(bI,{scope:e.__scopeSelect,children:d.jsx(Sy.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),s):null}return d.jsx(wI,{...e,ref:t})});xI.displayName=ql;var Fo=10,[bI,Qa]=cd(ql),PX="SelectContentImpl",TX=pX("SelectContent.RemoveScroll"),wI=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:v,avoidCollisions:y,...x}=e,b=Za(ql,n),[w,E]=m.useState(null),[C,_]=m.useState(null),N=Ue(t,Z=>E(Z)),[P,j]=m.useState(null),[A,U]=m.useState(null),L=ky(n),[K,W]=m.useState(!1),V=m.useRef(!1);m.useEffect(()=>{if(w)return uy(w)},[w]),cy();const H=m.useCallback(Z=>{const[Pe,...De]=L().map(je=>je.ref.current),[ge]=De.slice(-1),$e=document.activeElement;for(const je of Z)if(je===$e||(je==null||je.scrollIntoView({block:"nearest"}),je===Pe&&C&&(C.scrollTop=0),je===ge&&C&&(C.scrollTop=C.scrollHeight),je==null||je.focus(),document.activeElement!==$e))return},[L,C]),z=m.useCallback(()=>H([P,w]),[H,P,w]);m.useEffect(()=>{K&&z()},[K,z]);const{onOpenChange:R,triggerPointerDownPosRef:$}=b;m.useEffect(()=>{if(w){let Z={x:0,y:0};const Pe=ge=>{var $e,je;Z={x:Math.abs(Math.round(ge.pageX)-((($e=$.current)==null?void 0:$e.x)??0)),y:Math.abs(Math.round(ge.pageY)-(((je=$.current)==null?void 0:je.y)??0))}},De=ge=>{Z.x<=10&&Z.y<=10?ge.preventDefault():w.contains(ge.target)||R(!1),document.removeEventListener("pointermove",Pe),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",Pe),document.addEventListener("pointerup",De,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Pe),document.removeEventListener("pointerup",De,{capture:!0})}}},[w,R,$]),m.useEffect(()=>{const Z=()=>R(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[R]);const[J,G]=DI(Z=>{const Pe=L().filter($e=>!$e.disabled),De=Pe.find($e=>$e.ref.current===document.activeElement),ge=LI(Pe,Z,De);ge&&setTimeout(()=>ge.ref.current.focus())}),ie=m.useCallback((Z,Pe,De)=>{const ge=!V.current&&!De;(b.value!==void 0&&b.value===Pe||ge)&&(j(Z),ge&&(V.current=!0))},[b.value]),Xe=m.useCallback(()=>w==null?void 0:w.focus(),[w]),He=m.useCallback((Z,Pe,De)=>{const ge=!V.current&&!De;(b.value!==void 0&&b.value===Pe||ge)&&U(Z)},[b.value]),ce=r==="popper"?cw:SI,pe=ce===cw?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return d.jsx(bI,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:ie,selectedItem:P,onItemLeave:Xe,itemTextRefCallback:He,focusSelectedItem:z,selectedItemText:A,position:r,isPositioned:K,searchRef:J,children:d.jsx(op,{as:TX,allowPinchZoom:!0,children:d.jsx(rp,{asChild:!0,trapped:b.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:ne(o,Z=>{var Pe;(Pe=b.trigger)==null||Pe.focus({preventScroll:!0}),Z.preventDefault()}),children:d.jsx(lc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:Z=>Z.preventDefault(),...x,...pe,onPlaced:()=>W(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:ne(x.onKeyDown,Z=>{const Pe=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!Pe&&Z.key.length===1&&G(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ge=L().filter($e=>!$e.disabled).map($e=>$e.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const $e=Z.target,je=ge.indexOf($e);ge=ge.slice(je+1)}setTimeout(()=>H(ge)),Z.preventDefault()}})})})})})})});wI.displayName=PX;var OX="SelectItemAlignedPosition",SI=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Za(ql,n),i=Qa(ql,n),[a,l]=m.useState(null),[c,u]=m.useState(null),f=Ue(t,N=>u(N)),h=ky(n),p=m.useRef(!1),g=m.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:x,focusSelectedItem:b}=i,w=m.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&v&&y&&x){const N=s.trigger.getBoundingClientRect(),P=c.getBoundingClientRect(),j=s.valueNode.getBoundingClientRect(),A=x.getBoundingClientRect();if(s.dir!=="rtl"){const $e=A.left-P.left,je=j.left-$e,it=N.left-je,St=N.width+it,Jt=Math.max(St,P.width),T=window.innerWidth-Fo,S=Zb(je,[Fo,Math.max(Fo,T-Jt)]);a.style.minWidth=St+"px",a.style.left=S+"px"}else{const $e=P.right-A.right,je=window.innerWidth-j.right-$e,it=window.innerWidth-N.right-je,St=N.width+it,Jt=Math.max(St,P.width),T=window.innerWidth-Fo,S=Zb(je,[Fo,Math.max(Fo,T-Jt)]);a.style.minWidth=St+"px",a.style.right=S+"px"}const U=h(),L=window.innerHeight-Fo*2,K=v.scrollHeight,W=window.getComputedStyle(c),V=parseInt(W.borderTopWidth,10),H=parseInt(W.paddingTop,10),z=parseInt(W.borderBottomWidth,10),R=parseInt(W.paddingBottom,10),$=V+H+K+R+z,J=Math.min(y.offsetHeight*5,$),G=window.getComputedStyle(v),ie=parseInt(G.paddingTop,10),Xe=parseInt(G.paddingBottom,10),He=N.top+N.height/2-Fo,ce=L-He,pe=y.offsetHeight/2,Z=y.offsetTop+pe,Pe=V+H+Z,De=$-Pe;if(Pe<=He){const $e=U.length>0&&y===U[U.length-1].ref.current;a.style.bottom="0px";const je=c.clientHeight-v.offsetTop-v.offsetHeight,it=Math.max(ce,pe+($e?Xe:0)+je+z),St=Pe+it;a.style.height=St+"px"}else{const $e=U.length>0&&y===U[0].ref.current;a.style.top="0px";const it=Math.max(He,V+v.offsetTop+($e?ie:0)+pe)+De;a.style.height=it+"px",v.scrollTop=Pe-He+v.offsetTop}a.style.margin=`${Fo}px 0`,a.style.minHeight=J+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,a,c,v,y,x,s.dir,r]);En(()=>w(),[w]);const[E,C]=m.useState();En(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const _=m.useCallback(N=>{N&&g.current===!0&&(w(),b==null||b(),g.current=!1)},[w,b]);return d.jsx(MX,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:d.jsx(Oe.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});SI.displayName=OX;var jX="SelectPopperPosition",cw=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Fo,...s}=e,i=Ey(n);return d.jsx(Xh,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});cw.displayName=jX;var[MX,Ek]=cd(ql,{}),uw="SelectViewport",kI=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Qa(uw,n),i=Ek(uw,n),a=Ue(t,s.onViewportChange),l=m.useRef(0);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(Sy.Slot,{scope:n,children:d.jsx(Oe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ne(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=i;if(h!=null&&h.current&&f){const p=Math.abs(l.current-u.scrollTop);if(p>0){const g=window.innerHeight-Fo*2,v=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),x=Math.max(v,y);if(x<g){const b=x+p,w=Math.min(g,b),E=b-w;f.style.height=w+"px",f.style.bottom==="0px"&&(u.scrollTop=E>0?E:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});kI.displayName=uw;var EI="SelectGroup",[RX,AX]=cd(EI),IX=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=qr();return d.jsx(RX,{scope:n,id:o,children:d.jsx(Oe.div,{role:"group","aria-labelledby":o,...r,ref:t})})});IX.displayName=EI;var CI="SelectLabel",NI=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=AX(CI,n);return d.jsx(Oe.div,{id:o.id,...r,ref:t})});NI.displayName=CI;var Kg="SelectItem",[DX,_I]=cd(Kg),PI=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=Za(Kg,n),l=Qa(Kg,n),c=a.value===r,[u,f]=m.useState(s??""),[h,p]=m.useState(!1),g=Ue(t,b=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,b,r,o)}),v=qr(),y=m.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 d.jsx(DX,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:m.useCallback(b=>{f(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:d.jsx(Sy.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:d.jsx(Oe.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,...i,ref:g,onFocus:ne(i.onFocus,()=>p(!0)),onBlur:ne(i.onBlur,()=>p(!1)),onClick:ne(i.onClick,()=>{y.current!=="mouse"&&x()}),onPointerUp:ne(i.onPointerUp,()=>{y.current==="mouse"&&x()}),onPointerDown:ne(i.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:ne(i.onPointerMove,b=>{var w;y.current=b.pointerType,o?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ne(i.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:ne(i.onKeyDown,b=>{var E;((E=l.searchRef)==null?void 0:E.current)!==""&&b.key===" "||(wX.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})})})})});PI.displayName=Kg;var Kd="SelectItemText",TI=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Za(Kd,n),a=Qa(Kd,n),l=_I(Kd,n),c=CX(Kd,n),[u,f]=m.useState(null),h=Ue(t,x=>f(x),l.onItemTextChange,x=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,x,l.value,l.disabled)}),p=u==null?void 0:u.textContent,g=m.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=c;return En(()=>(v(g),()=>y(g)),[v,y,g]),d.jsxs(d.Fragment,{children:[d.jsx(Oe.span,{id:l.textId,...s,ref:h}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Hr.createPortal(s.children,i.valueNode):null]})});TI.displayName=Kd;var OI="SelectItemIndicator",jI=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return _I(OI,n).isSelected?d.jsx(Oe.span,{"aria-hidden":!0,...r,ref:t}):null});jI.displayName=OI;var dw="SelectScrollUpButton",LX=m.forwardRef((e,t)=>{const n=Qa(dw,e.__scopeSelect),r=Ek(dw,e.__scopeSelect),[o,s]=m.useState(!1),i=Ue(t,r.onScrollButtonChange);return En(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?d.jsx(MI,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});LX.displayName=dw;var fw="SelectScrollDownButton",FX=m.forwardRef((e,t)=>{const n=Qa(fw,e.__scopeSelect),r=Ek(fw,e.__scopeSelect),[o,s]=m.useState(!1),i=Ue(t,r.onScrollButtonChange);return En(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?d.jsx(MI,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});FX.displayName=fw;var MI=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Qa("SelectScrollButton",n),i=m.useRef(null),a=ky(n),l=m.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),En(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),d.jsx(Oe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ne(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ne(o.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ne(o.onPointerLeave,()=>{l()})})}),zX="SelectSeparator",RI=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d.jsx(Oe.div,{"aria-hidden":!0,...r,ref:t})});RI.displayName=zX;var hw="SelectArrow",$X=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ey(n),s=Za(hw,n),i=Qa(hw,n);return s.open&&i.position==="popper"?d.jsx(Zh,{...o,...r,ref:t}):null});$X.displayName=hw;var BX="SelectBubbleInput",AI=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=m.useRef(null),s=Ue(r,o),i=ok(t);return m.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&u){const f=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(f)}},[i,t]),d.jsx(Oe.select,{...n,style:{...IR,...n.style},ref:s,defaultValue:t})});AI.displayName=BX;function II(e){return e===""||e===void 0}function DI(e){const t=An(e),n=m.useRef(""),r=m.useRef(0),o=m.useCallback(i=>{const a=n.current+i;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function LI(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=VX(e,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function VX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var FI=fI,Ck=pI,UX=gI,WX=vI,HX=yI,Nk=xI,zI=kI,$I=NI,_k=PI,BI=TI,KX=jI,VI=RI;const Cy=FI,Ny=UX,up=m.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(Ck,{ref:r,className:de("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,d.jsx(WX,{asChild:!0,children:d.jsx(nd,{className:"w-4 h-4 opacity-50"})})]}));up.displayName=Ck.displayName;const dp=m.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},s)=>d.jsx(HX,{container:r,children:d.jsx(Nk,{ref:s,className:de("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-fg-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:d.jsx(zI,{className:de("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:d.jsx(yr,{orientation:"vertical",children:d.jsx("div",{className:"max-h-[var(--radix-select-content-available-height)]",children:t})})})})}));dp.displayName=Nk.displayName;const GX=m.forwardRef(({className:e,...t},n)=>d.jsx($I,{ref:n,className:de("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));GX.displayName=$I.displayName;const fp=m.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(_k,{ref:r,className:de("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-fg-primary outline-none focus:bg-bg-primary-hover focus:text-fg-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(KX,{children:d.jsx(td,{className:"w-4 h-4"})})}),d.jsx(BI,{children:t})]}));fp.displayName=_k.displayName;const qX=m.forwardRef(({className:e,...t},n)=>d.jsx(VI,{ref:n,className:de("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));qX.displayName=VI.displayName;function Ca(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function YX(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function JX({children:e}){return d.jsx("div",{children:YX(e)})}function UI(e){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.joinModuleFilePathAndModulePath(t,Y.splitModulePath(n).slice(0,-1).join(".")),o=Vt(r);return{path:r,schema:"data"in o?o.data:void 0}}const Nm=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",XX=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",S_=e=>(e==null?void 0:e.type)==="record",ZX=e=>(e==null?void 0:e.type)==="array";function WI({path:e,variant:t}){const n=Vt(e),{path:r,schema:o}=UI(e),[s]=Y.splitModuleFilePathAndModulePath(e),i=HI(e),a=i[i.length-1],l=e2(r,Nm(e,r,o)?a==null?void 0:a.part:void 0),c=iA(),u=S_("data"in n?n.data:void 0)&&c.status==="success"&&c.data&&"data"in n&&n.data.type==="record"&&n.data.router?k_(s,c.data,n.data.router):null,f=Nm(e,r,o)&&c.status==="success"&&c.data&&o&&o.type==="record"&&o.router?k_(s,c.data,o.router):null,h=(f==null?void 0:f.every(x=>x.type==="literal"))||!1,p=!f||!h,g=!f||!h,v=(u==null?void 0:u.every(x=>x.type==="literal"))||!1,y=!u||!v;return d.jsxs("span",{className:"inline-flex gap-2 items-center",children:[Nm(e,r,o)&&d.jsxs(d.Fragment,{children:[d.jsx(E_,{refs:l,variant:t}),g&&d.jsx(s2,{defaultValue:a.text,path:e,parentPath:r,variant:Rf(t),size:Mf(t),routePattern:f,existingKeys:l,children:d.jsx(OK,{size:jf(t)})}),p&&d.jsx(n2,{path:e,parentPath:r,variant:Rf(t),size:Mf(t),refs:l,confirmationMessage:`This will delete the ${a.text} record.`,children:d.jsx(IK,{size:jf(t)})})]}),ZX("data"in n?n.data:void 0)&&d.jsx(QX,{path:e,variant:t}),S_("data"in n?n.data:void 0)&&d.jsxs(d.Fragment,{children:[d.jsx(E_,{refs:l,variant:t}),y&&d.jsx(o2,{path:e,variant:Rf(t),size:Mf(t),routePattern:u,children:d.jsx(JS,{size:jf(t)})})]})]})}function k_(e,t,n){if(n==="next-app-router"){const r=Bb(e,t);return UM(r)}return null}function E_({refs:e,variant:t}){const n=Nn();return e.length===0?null:d.jsxs(Cr,{children:[d.jsxs(Kr,{children:[d.jsx(yo,{asChild:!0,children:d.jsx(Je,{asChild:!0,size:Mf(t),variant:Rf(t),children:d.jsx(Co,{children:d.jsx(yA,{size:jf(t)})})})}),d.jsx(vr,{side:"top",children:"References to this record"})]}),d.jsx(ir,{container:n,children:d.jsx("div",{className:"text-sm",children:d.jsx("ul",{children:e.map(r=>{const[o,s]=Y.splitModuleFilePathAndModulePath(r),i=Y.createPatchPath(s);return d.jsx("li",{children:d.jsx(ip,{moduleFilePath:o,patchPath:i})},r)})})})})]})}function jf(e){return e==="module"?16:12}function Mf(e){return"icon"}function Rf(e){return e==="module"?"outline":"ghost"}function QX({path:e,variant:t}){const{navigate:n}=Cn(),{addPatch:r,patchPath:o}=_n(e),s=Vt(e),i=ht(e,"array"),[a]=Y.splitModuleFilePathAndModulePath(e);if(!("data"in i)||!i.data||!("data"in s))return null;const l=s.data;if(l.type!=="array")return console.error("Cannot add to non-array",i,{parentPath:e}),null;const c=i.data.length;return d.jsx(Je,{title:"Add",size:Mf(t),variant:Rf(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:Kl(l.item)}],l.type),l.item.type!=="string"&&n(Y.joinModuleFilePathAndModulePath(a,Y.patchPathToModulePath(u)))},children:d.jsx(JS,{size:jf(t)})})}function HI(e){const[t,n]=Y.splitModuleFilePathAndModulePath(e),r=Y.splitModuleFilePath(t).map(a=>({text:Ou(a),part:a,sourcePath:t}));if(!n)return r;const o=Y.splitModulePath(n),s=[];let i="";for(let a=0;a<o.length;a++){let l=(i?i+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(i?i+".":"")+o[a]),i=l,s.push({text:o[a],part:o[a],sourcePath:Y.joinModuleFilePathAndModulePath(t,l)})}return r.concat(s)}function Gg({validationErrors:e}){return d.jsxs("div",{className:de("w-full",{"h-6":e.length===0}),children:[e.length>1&&d.jsx(La,{type:"single",collapsible:!0,className:"w-full min-h-6",children:d.jsxs(Ns,{value:"validation-errors",className:"pb-2 w-full border-b-0 group",children:[d.jsx(wi,{className:de("min-h-6","transition-colors duration-200 ease-in-out","group-data-[state=closed]:bg-bg-error-primary rounded-lg","p-2"),children:d.jsxs("div",{className:de("flex items-center justify-between w-full"),children:[d.jsxs("div",{className:"text-fg-primary group-data-[state=closed]:text-fg-error-primary",children:[e.length," validation error",e.length>1?"s":""]}),d.jsx("div",{className:"text-fg-error-primary",children:d.jsx(Pu,{size:16})})]})}),d.jsx(_s,{children:d.jsx("div",{className:"flex flex-col gap-2",children:e.map((t,n)=>d.jsx("div",{className:de("p-2 rounded-lg","bg-bg-error-primary text-fg-error-primary"),children:t.message},n))})})]})}),e.length===1&&e[0]&&d.jsx(eZ,{validationError:e[0]})]})}function eZ({validationError:e}){const[t,n]=m.useState(!1),[r,o]=m.useState(!1),s=m.useRef(null),i=m.useRef(null);return m.useEffect(()=>{const a=()=>{if(s.current){const c=document.createElement("div"),u=window.getComputedStyle(s.current);c.style.cssText=u.cssText,c.style.position="absolute",c.style.visibility="hidden",c.style.left="-9999px",c.style.width=u.width,c.style.webkitLineClamp="unset",c.style.overflow="visible",c.style.display="block",c.textContent=e.message,document.body.appendChild(c);const f=c.getBoundingClientRect().height;document.body.removeChild(c);const h=s.current.getBoundingClientRect().height;o(f>h+1)}},l=setTimeout(a,50);return window.addEventListener("resize",a),()=>{clearTimeout(l),window.removeEventListener("resize",a)}},[e.message]),d.jsxs("div",{ref:i,className:de("flex items-center justify-between w-full transition-all duration-200 ease-in-out","p-2 mt-2","bg-bg-error-primary text-fg-error-primary rounded-lg"),style:{height:t?"auto":void 0},children:[d.jsx("div",{ref:s,className:de("transition-all duration-200 ease-in-out",{"line-clamp-1":!t}),style:{flex:r?"1":"auto",marginRight:r?"8px":"0"},children:e.message}),!r&&d.jsx("div",{className:"text-fg-error-primary",children:d.jsx(Pu,{size:16})}),r&&d.jsxs("button",{className:"flex flex-shrink-0 items-center",onClick:()=>n(!t),children:[d.jsx("div",{className:"text-fg-error-primary",children:d.jsx(Pu,{size:16})}),d.jsx(nd,{size:16,className:de("transform transition-transform duration-200 ease-in-out",{"rotate-180":t})})]})]})}function KI({label:e,children:t,path:n,transparent:r,type:o,foldLevel:s="1"}){var w,E;const i=iy(),a=rA(n),{patchPath:l,addPatch:c}=_n(n),u=Vt(n),f=ht(n,o),[h,p]=m.useState(!0),[g,v]=m.useState(!1);m.useEffect(()=>{var C,_;"data"in f&&f.data===null&&"data"in u&&!u.data.opt&&(((C=u.data)==null?void 0:C.type)==="image"||((_=u.data)==null?void 0:_.type)==="file")&&v(!0)},[f,u]);const y="data"in f?f.data:void 0,x="data"in u&&((w=u.data)==null?void 0:w.type)==="boolean",b="data"in u&&((E=u.data)==null?void 0:E.opt)===!0;return d.jsxs("div",{className:Te("px-4 pt-6 pb-0 border rounded-lg",{"bg-bg-tertiary":!r,"border-bg-error-secondary":a.length>0}),children:[d.jsxs("div",{className:"flex justify-between items-center pb-2",children:[d.jsxs("div",{className:"flex gap-4 items-center",children:[!x&&b&&d.jsx(sd,{disabled:i==="loading",checked:y!==null||g,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&y===null?v(!0):c(y===null?[{op:"replace",path:l,value:Kl({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}],u.data.type)}}),x&&d.jsx(uX,{path:n,isNullable:b,loadingStatus:i,source:y}),typeof e=="string"&&d.jsx(JX,{children:e}),e&&typeof e!="string"&&e]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[y!==null&&d.jsx(WI,{path:n,variant:"field"}),y!==null&&!x&&d.jsxs("button",{onClick:()=>p(C=>!C),className:Te("transform transition-transform",{"rotate-180":h}),children:[s==="1"&&d.jsx(nd,{size:16}),s==="2"&&d.jsx(sK,{size:16})]})]})]}),!x&&d.jsx(La,{type:"single",collapsible:!0,value:h&&(y!==null||g)?"open":"closed",children:d.jsx(Ns,{value:"open",className:"w-full border-b-0",children:d.jsx(_s,{children:t})})}),a.length>0&&d.jsx("div",{className:"pb-8",children:d.jsx(Gg,{validationErrors:a})})]})}function tZ({path:e}){const t="object",n=Vt(e),r=ht(e,t);if(n.status==="error")return d.jsx(nn,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(ut,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(zn,{path:e,type:t});if(n.status==="loading")return d.jsx(Et,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(Et,{path:e,type:t});if(n.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([s,i])=>{const a=Ca(e,s);return d.jsx(KI,{label:s,path:a,type:i.type,children:d.jsx(Yy,{path:a,schema:i},a)},a)})})]})}function nZ({path:e}){const t="object",n=Vt(e);if(n.status==="error")return d.jsx(nn,{path:e,error:n.error,type:t});if(n.status==="loading")return d.jsx(Et,{path:e,type:t});if(n.status==="not-found")return d.jsx(zn,{path:e,type:t});if(n.data.type!=="object")return d.jsx(Tr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return d.jsx(GI,{path:e,schema:r})}function GI({path:e,schema:t}){return d.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=Ca(e,n);return d.jsx(rZ,{label:n,children:d.jsx(xE,{path:r})},n)})})}function rZ({label:e,children:t}){return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"flex whitespace-nowrap text-fg-disabled",children:_f(e)}),t]})}function pw(e){return typeof e.key!="string"}function oZ({path:e}){const t="union",n=Vt(e),r=ht(e,t);if(n.status==="error")return d.jsx(nn,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(ut,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(zn,{path:e,type:t});if(n.status==="loading")return d.jsx(Et,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(Et,{path:e,type:t});if(n.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(pw(n.data))return typeof o!="string"&&o!==null?d.jsx(ut,{path:e,error:"Expected source to be a string, but found: "+typeof o,schema:n}):d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(iZ,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(s=>(s==null?void 0:s.type)==="literal"?[s.value]:(console.warn("Unexpected item in string union",s),[]))})]});if(!pw(n.data))return typeof o!="object"?d.jsx(ut,{path:e,error:"Expected source to be an object, but found: "+typeof o,schema:n}):Array.isArray(o)?d.jsx(ut,{path:e,error:"Expected source to be an object, but found an array",schema:n}):d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(sZ,{path:e,schema:n.data})]})}function sZ({path:e,schema:t}){const n=GS(e),{addPatch:r,patchPath:o}=_n(e),s=Nn(),i=Ca(e,t.key),a=ht(i,"literal");if(!("data"in a)||a.data===void 0)return d.jsx(Et,{path:e,type:"union"});const l=t.items.find(f=>{var p;const h=(p=f.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 d.jsx(Et,{path:e,type:"union"});const c=t.items.flatMap(f=>{var p;const h=(p=f.items)==null?void 0:p[t.key];return h.type==="literal"?[h.value]:(console.error("Expected literal schema in object union",h),[])}),u=m.useRef({});return m.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]),d.jsxs("div",{className:"grid gap-4",children:[d.jsxs(Cy,{value:a.data??void 0,onValueChange:f=>{const h=t.items.find(g=>{var y;const v=(y=g.items)==null?void 0:y[t.key];return v.type==="literal"?v.value===f:(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} = ${f} not found`);return}const p=u.current[e][f]||Kl(h);p[t.key]=f,r([{op:"replace",path:o,value:p}],t.type)},children:[d.jsx(up,{children:d.jsx(Ny,{children:a.data})}),d.jsx(dp,{container:s,className:"w-32",children:c==null?d.jsx(qI,{}):c.map(f=>d.jsx(fp,{value:f,children:f},f))})]}),Object.keys(l==null?void 0:l.items).filter(f=>f!==(t==null?void 0:t.key)).map(f=>{var p,g,v;const h=Ca(e,f);return d.jsx(KI,{path:h,foldLevel:"1",label:f,type:(g=(p=l==null?void 0:l.items)==null?void 0:p[f])==null?void 0:g.type,children:d.jsx(Yy,{path:h,schema:(v=l==null?void 0:l.items)==null?void 0:v[f]},f)},h)})]})}function iZ({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=_n(e),s=Nn();return d.jsxs(Cy,{value:t??"",onValueChange:i=>{r([{op:"replace",path:o,value:i}],"union")},children:[d.jsx(up,{children:d.jsx(Ny,{children:t})}),d.jsx(dp,{className:"w-32",container:s,children:n==null?d.jsx(qI,{}):n.map(i=>d.jsx(fp,{value:i,children:i},i))})]})}function qI(){return d.jsx("div",{children:"Loading..."})}function aZ({path:e}){const t="union",n=GS(e),r=Vt(e);if(n.status==="error")return d.jsx(ut,{path:e,error:n.error,schema:r});if(!("data"in n)||n.data===void 0)return d.jsx(_r,{path:e});if(!("data"in r)||r.data===void 0)return d.jsx(_r,{path:e});if(n.data===null)return d.jsx(Pr,{path:e});if(r.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(pw(o))return typeof n.data!="string"?d.jsx(ut,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,schema:r}):d.jsx("div",{className:"truncate",children:n.data});{const s=n.data;if(!s)return d.jsx(Pr,{path:e});if(typeof s!="object"&&!(typeof s=="object"&&o.key in s))return d.jsx(ut,{path:e,error:"Expected source to be an object, but found: "+typeof s,schema:r});const i=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"&&s!==null&&typeof s=="object"&&o.key in s&&!da(s))return l.value===s[o.key]});return i?d.jsx(GI,{path:e,schema:i}):d.jsx(ut,{path:e,error:"Expected source to have key "+o.key+" but it was not found",schema:r})}}function YI(e){return new Promise((t,n)=>{var s;const r=(s=e.currentTarget.files)==null?void 0:s[0],o=new FileReader;o.addEventListener("load",()=>{const i=o.result;if(typeof i=="string"){const a=new Image;a.addEventListener("load",()=>{const l=Gv.Buffer.from(i.split(",")[1],"base64"),c=Y.getSHA256Hash(l);if(a.naturalWidth&&a.naturalHeight){const u=Y.getMimeType(i);t({src:i,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,fileHash:c,mimeType:u,fileExt:u&&Y.mimeTypeToFileExt(u)})}else t({src:i,filename:r==null?void 0:r.name,fileHash:c})}),a.src=i}else n(i?{message:"Unexpected image result type",result:i}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function lZ(e){return new Promise((t,n)=>{var s;const r=(s=e.currentTarget.files)==null?void 0:s[0],o=new FileReader;o.addEventListener("load",()=>{const i=o.result;if(typeof i=="string"){const a=Gv.Buffer.from(i.split(",")[1],"base64"),l=Y.getSHA256Hash(a),c=Y.getMimeType(i);t({src:i,filename:r==null?void 0:r.name,fileHash:l,mimeType:c,fileExt:c&&Y.mimeTypeToFileExt(c)})}else n(i?{message:"Unexpected file result type",result:i}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function cZ(e){return e.split(".").pop()||""}const uZ=new TextEncoder;async function JI(e,t,n,r,o,s,i,a="/public/val"){const l=Y.createFilename(t,n,o,r);if(!l||!o)return[];const c=`${a}/${l}`,u=Y.remote.hashToRemoteFileHash(r),f=i?Y.remote.createRemoteRef(i.remoteHost,{publicProjectId:i.publicProjectId,coreVersion:i.coreVersion,bucket:i.bucket,validationHash:Y.remote.getValidationHash(i.coreVersion,i.schema,cZ(l),o,u,uZ),fileHash:u,filePath:`${a.slice(1)}/${l}`}):c;return[{value:{[Ct]:f,[Le]:i?"remote":"file",...s!=="file"?{[Ob]:s}:{},metadata:o},op:"replace",path:e},{value:t,metadata:o,op:"file",path:e,filePath:f,remote:i!==null}]}function dZ({path:e}){var U;const t="file",n=Qu(),r=BS(),o=$S(),s=Vt(e),i=ht(e,t),[a,l]=m.useState(!1),[c,u]=m.useState(null),[f,h]=m.useState(null),[p,g]=m.useState(!1),{patchPath:v,addAndUploadPatchWithFileOps:y}=_n(e),[x,b]=m.useState(null),w="data"in i&&i.data,E=i.status==="success"&&i.clientSideOnly;if(m.useEffect(()=>{if(w&&w.metadata&&!E){const L=Le in w&&w[Le]==="remote"?Y.convertRemoteSource({...w,[Le]:"remote"}).url:Y.convertFileSource({...w,[Le]:"file"}).url;h(L),g(!1)}},[i]),m.useEffect(()=>{var L,K,W;s.status==="success"&&s.data.type==="file"&&((K=(L=s.data.options)==null?void 0:L.accept)!=null&&K.startsWith("video/"))&&l(!0),w&&typeof((W=w.metadata)==null?void 0:W.mimeType)=="string"&&(w.metadata.mimeType.startsWith("video/")?l(!0):l(!1))},[s,w]),s.status==="error")return d.jsx(nn,{path:e,error:s.error,type:t});if(i.status==="error")return d.jsx(ut,{path:e,error:i.error,schema:s});if(i.status=="not-found"||s.status==="not-found")return d.jsx(zn,{path:e,type:t});if(s.status==="loading")return d.jsx(Et,{path:e,type:t});if(n===void 0)return d.jsx(Et,{path:e,type:t});if(s.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:s.data.type});const C=i.data;if(C===void 0)return d.jsx(zn,{path:e,type:t});const N=s.data.type==="file"&&s.data.remote&&o.status!=="ready",P=s.data.remote&&o.status==="ready"&&r?{publicProjectId:o.publicProjectId,coreVersion:o.coreVersion,bucket:r,schema:s.data,remoteHost:n.remoteHost}:null;let j=null;if(C!=null&&C._ref)if(s.data.remote){const L=Y.remote.splitRemoteRef(C==null?void 0:C._ref);L.status==="success"&&(j=L.filePath)}else j=C==null?void 0:C._ref;let A=null;return j&&(A=j.split("/").slice(-1)[0]),d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),c&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:c}),d.jsxs("div",{className:"grid gap-2",children:[A&&d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx("div",{className:"text-sm text-fg-secondary",children:A}),p&&d.jsx(Qr,{className:`animate-spin text-fg-secondary ${p?"block":"hidden"}`,size:16}),x!==null&&d.jsxs("div",{className:"text-sm text-fg-secondary",children:[x,"%"]})]}),d.jsxs("div",{className:"flex gap-4 items-center",children:[C&&(a?d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx("video",{className:"w-full h-auto rounded-lg",controls:!0,src:Le in C&&C[Le]==="remote"?Y.convertRemoteSource({...C,[Le]:"remote"}).url:Y.convertFileSource({...C,[Le]:"file"}).url}),d.jsx(Je,{asChild:!0,variant:"secondary",children:d.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})})]}):d.jsxs(d.Fragment,{children:[d.jsx(Je,{asChild:!0,variant:"secondary",children:d.jsx("label",{htmlFor:`file_input:${e}`,children:"Upload"})}),d.jsxs("a",{className:"flex gap-2 items-center",target:"_blank",rel:"noopener noreferrer",download:A,href:Le in C&&C[Le]==="remote"?Y.convertRemoteSource({...C,[Le]:"remote"}).url:Y.convertFileSource({...C,[Le]:"file"}).url,children:[d.jsx("span",{children:" Open file"}),d.jsx(PK,{})]})]})),d.jsx("input",{disabled:N,hidden:!0,id:`file_input:${e}`,type:"file",accept:(U=s.data.options)==null?void 0:U.accept,onChange:L=>{lZ(L).then(K=>{var R;const W="file",V=f;h(K.src),g(!0);const H={src:K.src,filename:K.filename};let z;K.mimeType&&(z={mimeType:K.mimeType}),u(null),JI(v,H.src,H.filename??null,K.fileHash,z,W,P,(R=n.files)==null?void 0:R.directory).then($=>{g(!0),b(0),y($,W,J=>{h(V),u(J)},(J,G,ie,Xe)=>{const He=J*(ie+1)/(G*Xe);b(Math.round(He*100))}).finally(()=>{b(null),g(!1)})}).catch($=>{console.error("Failed to create file patch",$),g(!1),h(V),u("Could not upload file. Please try again later")}),L.target.value=""})}})]})]})]})}function fZ({path:e}){const t=ht(e,"image");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx(pA,{size:12})}function hZ({path:e}){var K,W,V,H;const t="image",n=Qu(),r=$S(),o=BS(),s=Vt(e),i=ht(e,t),[a,l]=m.useState(void 0),[c,u]=m.useState(null),[f,h]=m.useState(null),[p,g]=m.useState(!1),{addPatch:v,patchPath:y,addAndUploadPatchWithFileOps:x}=_n(e),[b,w]=m.useState(null),E="data"in i&&i.data,C=i.status==="success"&&i.clientSideOnly;if(m.useEffect(()=>{if(E)if(E.metadata){if(!C){const R=Le in E&&E[Le]==="remote"?Y.convertRemoteSource({...E,[Le]:"remote"}).url:Y.convertFileSource({...E,[Le]:"file"}).url;h(R),g(!1)}const z=E.metadata;if(typeof z.width!="number"||typeof z.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof z.width} and height was: ${typeof z.height}`);return}if("hotspot"in z){if(typeof z.hotspot=="object"&&z.hotspot&&"x"in z.hotspot&&"y"in z.hotspot){const{x:R,y:$}=z.hotspot;typeof R=="number"&&typeof $=="number"?l({x:R,y:$}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof R} and y: ${typeof $}`)}}else l(void 0)}else l(void 0)},[i]),s.status==="error")return d.jsx(nn,{path:e,error:s.error,type:t});if(i.status==="error")return d.jsx(ut,{path:e,error:i.error,schema:s});if(i.status=="not-found"||s.status==="not-found")return d.jsx(zn,{path:e,type:t});if(s.status==="loading")return d.jsx(Et,{path:e,type:t});if(n===void 0)return d.jsx(Et,{path:e,type:t});if(s.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:s.data.type});const _=i.data;if(_===void 0)return d.jsx(zn,{path:e,type:t});const P=s.data.type==="image"&&s.data.remote&&r.status!=="ready",j=s.data.remote&&r.status==="ready"&&o?{publicProjectId:r.publicProjectId,bucket:o,coreVersion:r.coreVersion,schema:s.data,remoteHost:n.remoteHost}:null,A=Y.createValPathOfItem(e,"metadata"),U=Y.createValPathOfItem(A,"alt"),L=Y.createValPathOfItem(A,"hotspot");return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),c&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:c}),s.data.type==="image"&&s.data.remote&&r.status==="inactive"&&d.jsx("div",{className:"p-4 rounded bg-bg-error-primary text-fg-error-primary",children:pZ(r.reason)}),d.jsxs("div",{className:"flex flex-col gap-2",children:[_&&d.jsxs("div",{className:"",children:[d.jsx("span",{id:U,children:"Alt text"}),d.jsx(od,{value:(K=_.metadata)!=null&&K.alt&&typeof((W=_.metadata)==null?void 0:W.alt)=="string"?(V=_.metadata)==null?void 0:V.alt:"",disabled:P,onChange:z=>{const R=z.target.value;_.metadata&&"alt"in _.metadata?v([{op:"replace",value:R,path:y.concat(["metadata","alt"])}],"string"):_.metadata&&!("alt"in _.metadata)?v([{op:"add",value:R,path:y.concat(["metadata","alt"])}],"string"):_.metadata===void 0?v([{op:"add",value:{...a?{hotspot:a}:{},alt:R},path:y.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof _.metadata}`)}})]}),_&&f&&d.jsxs("div",{className:"relative rounded-lg bg-bg-secondary",children:[p&&d.jsxs("div",{className:"flex absolute inset-0 flex-col justify-center items-center",children:[d.jsx("div",{className:"absolute inset-0 w-full h-full opacity-50 bg-bg-secondary"}),d.jsx(Qr,{size:24,className:"animate-spin"}),d.jsx("div",{className:"mt-2 text-xs font-thin text-[white] z-5",children:b!==null?`${b}%`:""})]}),d.jsx("img",{src:f,draggable:!1,className:"object-contain max-h-[500px] w-full",style:{cursor:"crosshair"},id:L,onClick:z=>{const{width:R,height:$,left:J,top:G}=z.currentTarget.getBoundingClientRect(),ie={x:Math.max((z.clientX-6-J)/R,0),y:Math.max((z.clientY-6-G)/$,0)};_.metadata&&"hotspot"in _.metadata?v([{op:"replace",path:y.concat(["metadata","hotspot"]),value:ie}],"object"):_.metadata?v([{op:"add",path:y.concat(["metadata","hotspot"]),value:ie}],"object"):_.metadata===void 0?v([{op:"add",value:{...ie?{hotspot:ie}:{}},path:y.concat(["metadata"])}],"object"):console.warn(`Expected source.metadata to be an object but got ${typeof _.metadata}`)}}),a&&d.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-primary border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),d.jsx(Je,{asChild:!0,variant:"secondary",children:d.jsx("label",{htmlFor:`img_input:${e}`,children:"Upload"})}),d.jsx("input",{disabled:i.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((H=s.data.options)==null?void 0:H.accept)||"image/*",onChange:z=>{YI(z).then(R=>{var Xe,He;const $="image",J=f;h(R.src),g(!0);const G={src:R.src,filename:R.filename};let ie;R.width&&R.height&&R.mimeType&&(ie={width:R.width,height:R.height,mimeType:R.mimeType,alt:E&&typeof((Xe=E==null?void 0:E.metadata)==null?void 0:Xe.alt)=="string"?E.metadata.alt:void 0}),u(null),JI(y,G.src,G.filename??null,R.fileHash,ie,$,j,(He=n.files)==null?void 0:He.directory).then(ce=>{g(!0),w(0),x(ce,$,pe=>{h(J),u(pe)},(pe,Z,Pe,De)=>{const ge=pe*(Pe+1)/(Z*De);w(Math.round(ge*100))}).finally(()=>{w(null),g(!1)})}).catch(ce=>{console.error("Failed to create file patch",ce),g(!1),h(J),u("Could not upload file. Please try again later")}),z.target.value=""})}})]})]})}function pZ(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://admin.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 mZ({path:e}){const t=ht(e,"image");if(t.status==="error")return d.jsx(ut,{path:e,error:t.error});if(!("data"in t)||t.data===void 0)return d.jsx(_r,{path:e});if(t.data===null)return d.jsx(Pr,{path:e});const n=t.data;return d.jsx("img",{src:Le in n&&n[Le]==="remote"?Y.convertRemoteSource({...n,[Le]:"remote"}).url:Y.convertFileSource({...n,[Le]:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function gZ({path:e}){var h;const t="keyOf",{navigate:n}=Cn(),r=Vt(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:(h=r.data.schema)==null?void 0:h.type,path:r.data.path}:void 0,s=ht(o==null?void 0:o.path,o==null?void 0:o.type),i=ht(e,t),{patchPath:a,addPatch:l}=_n(e),c=Nn();if(r.status==="error")return d.jsx(nn,{path:e,error:r.error,type:t});if(i.status==="error")return d.jsx(ut,{path:e,error:i.error,schema:r});if(s.status==="error")return d.jsx(ut,{path:e,error:s.error,schema:r});if(i.status=="not-found"||r.status==="not-found")return d.jsx(zn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return d.jsx(nn,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&s.status==="not-found")return d.jsx(nn,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in i)||i.data===void 0)return d.jsx(Et,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:r.data.type});if(!s)return d.jsx(nn,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in s&&s.data===null)return d.jsx(nn,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in s&&s.data?Object.keys(s.data):void 0,f=i.data;return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs(Cy,{value:f??"",onValueChange:p=>{l([{op:"replace",path:a,value:p}],t)},children:[d.jsx(up,{children:d.jsx(Ny,{children:f})}),d.jsx(dp,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?d.jsx(vZ,{}):u.map(p=>d.jsx(fp,{value:p,children:p},p))})]}),f&&(o==null?void 0:o.path)&&d.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(Y.createValPathOfItem(o.path,f))},children:d.jsx(YS,{size:16})})]}),u&&u.length>0&&f!==null&&!u.includes(f)&&d.jsxs("div",{className:"flex gap-2 p-2 py-3 mt-2 rounded-md bg-bg-error-primary text-fg-error-primary",children:[d.jsxs("span",{className:"line-clamp-1",children:["Value must be one of: ",u.join(", ")," ",u.join(", "),u.join(", "),u.join(", "),u.join(", "),u.join(", "),u.join(", ")]}),d.jsx("span",{className:"flex-shrink-0",children:d.jsx(Pu,{size:16})})]})]})}function vZ(){return d.jsx("span",{children:"Loading..."})}function yZ({path:e}){const t=ht(e,"keyOf");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx("div",{className:"truncate",children:t.data})}function XI({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const s=o.fromDate&&o.toDate;return d.jsx(PU,{showOutsideDays:r,captionLayout:n,className:de("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 ${s?"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:de(ew({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:de(ew({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-fg-primary hover:bg-primary hover:text-fg-primary focus:text-fg-primary",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:()=>d.jsx(oK,{className:"w-4 h-4"}),IconRight:()=>d.jsx(rd,{className:"w-4 h-4"}),Dropdown:({caption:i,children:a,value:l,onChange:c})=>{const u=f=>{c&&c({target:{value:f}})};return d.jsx("div",{className:"flex flex-row space-x-2",children:d.jsxs(FI,{onValueChange:u,value:String(l),children:[d.jsx(Ck,{asChild:!0,children:d.jsxs(Je,{variant:"ghost",size:"sm",children:[i,d.jsx(nd,{className:"w-4 h-4"})]})}),d.jsx(Nk,{className:"z-50 p-1 rounded-md bg-bg-secondary text-fg-secondary",children:d.jsx(zI,{className:"overflow-y-auto pr-4 pb-4 max-h-48 rounded-md shadow-lg bg-bg-tertiary text-fg-tertiary",children:m.Children.map(a,f=>{if(m.isValidElement(f)){const{value:h,children:p}=f.props;return d.jsx(_k,{value:String(h),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary-hover hover:text-fg-secondary",children:d.jsx(BI,{children:p})},h)}return null})})})]})})}},...o})}XI.displayName="Calendar";function xZ({path:e}){var h,p;const t="date",n=Vt(e),r=ht(e,t),{patchPath:o,addPatch:s}=_n(e),[i,a]=m.useState(null),[l,c]=m.useState(!1),u=Nn();if(m.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const g=new Date(r.data);a(g)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return d.jsx(nn,{path:e,error:n.error,type:t});if(r.status==="error")return d.jsx(ut,{path:e,error:r.error,schema:n});if(r.status=="not-found"||n.status==="not-found")return d.jsx(zn,{path:e,type:t});if(n.status==="loading")return d.jsx(Et,{path:e,type:t});if(!("data"in r)||r.data===void 0)return d.jsx(Et,{path:e,type:t});if(n.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:n.data.type});const f=n.data;return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsxs(Cr,{open:l,onOpenChange:g=>{c(g)},children:[d.jsx(Co,{asChild:!0,onClick:()=>{c(!0)},children:d.jsxs(Je,{variant:"outline",className:Te("w-[280px] justify-start text-left font-normal bg-bg-primary hover:bg-bg-secondary"),children:[d.jsx(dA,{className:"w-4 h-4 mr-2"}),i?Ci(i,"PPP"):d.jsx("span",{children:"Pick a date"})]})}),d.jsx(ir,{className:"w-auto p-0",container:u,children:d.jsx(XI,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:i??void 0,weekStartsOn:1,fromDate:(h=f.options)!=null&&h.from?new Date(f.options.from):void 0,toDate:(p=f.options)!=null&&p.to?new Date(f.options.to):void 0,selected:i||void 0,onSelect:g=>{g&&(a(g),s([{op:"replace",value:g.toISOString().slice(0,10),path:o}],f.type),c(!1))}})})]})]})}function bZ({path:e}){const t=ht(e,"date");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function wZ({path:e}){const t=ht(e,"literal");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx("div",{id:e,className:"truncate",children:t.data})}function ZI(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function QI(){return d.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-secondary"})}function eD({error:e}){return d.jsx("div",{className:"p-4 text-fg-error-primary bg-bg-error-primary",children:d.jsxs("div",{children:["Preview error: ",e]})})}function SZ({path:e}){const t="record",n=uc()||{},{navigate:r}=Cn(),o=Vt(e),s=US(e),i=ht(e,t);if(o.status==="error")return d.jsx(nn,{path:e,error:o.error,type:t});if(i.status==="error")return d.jsx(ut,{path:e,error:i.error,schema:o});if(i.status=="not-found"||o.status==="not-found")return d.jsx(zn,{path:e,type:t});if(o.status==="loading")return d.jsx(Et,{path:e,type:t});if(!("data"in i)||i.data===void 0)return d.jsx(Et,{path:e,type:t});if(o.data.type!==t)return d.jsx(Tr,{path:e,expectedType:t,actualType:o.data.type});const a=i.data,l=s&&"data"in s&&s.data&&s.data.layout==="list"&&s.data.parent==="record"?s.data:void 0;return d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),(s==null?void 0:s.status)==="error"&&d.jsx(eD,{error:s.message,path:e}),l&&d.jsx(EZ,{path:e,...l}),!l&&d.jsx("div",{className:"grid grid-cols-1 gap-4",children:a&&Object.entries(a).map(([c])=>d.jsxs("div",{onClick:()=>r(Ca(e,c)),className:Te("bg-primary-foreground cursor-pointer min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4","hover:bg-bg-secondary-hover"),children:[d.jsxs("div",{className:"flex justify-between items-start",children:[d.jsx("div",{className:"pb-4 font-semibold text-md",children:c}),ZI(Ca(e,c),n)&&d.jsx(QI,{})]}),d.jsx("div",{children:d.jsx(xE,{path:Ca(e,c)})})]},c))})]})}function kZ({title:e,image:t,subtitle:n}){return d.jsxs("div",{className:Te("flex w-full items-start justify-between pl-4 flex-grow text-left"),children:[d.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[d.jsx("div",{className:"text-lg font-medium",children:e}),n&&d.jsx("div",{className:"block overflow-hidden flex-shrink max-h-5 text-sm text-gray-500 text-ellipsis",children:n})]}),t&&d.jsx(CZ,{src:t,alt:e})]})}function EZ({path:e,items:t}){const{navigate:n}=Cn();return d.jsx("div",{className:"flex flex-col space-y-4 w-full",children:t.map(([r,{title:o,subtitle:s,image:i}])=>d.jsx("button",{onClick:()=>n(Ca(e,r)),className:Te("hover:bg-bg-secondary-hover","border rounded-lg cursor-pointer border-border-primary"),children:d.jsx(kZ,{title:o,subtitle:s,image:i})},r))})}function CZ({src:e,alt:t}){var s;const[n,r]=m.useState(!1);if(e==null)return d.jsx("div",{className:"flex-shrink-0 ml-4 w-20 h-20 opacity-25 bg-bg-brand-secondary"});const o=e[Le]==="file"?Y.convertFileSource(e).url:Y.convertRemoteSource(e).url;return d.jsxs("div",{className:"relative flex-shrink-0 ml-4 w-20 h-20",children:[!n&&d.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),d.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(s=e.metadata)!=null&&s.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function NZ({path:e}){const t=ht(e,"record");if(t.status==="error")return d.jsx(ut,{path:e,error:t.error});if(!("data"in t)||t.data===void 0)return d.jsx(_r,{path:e});if(t.data===null)return d.jsx(Pr,{path:e});const n=Object.keys(t.data);return d.jsxs("div",{className:"text-left",children:[d.jsx("span",{className:"text-fg-brand-primary",children:n.length}),d.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let _y=()=>({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 mw={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 s(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)}s.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:s,writable:!0}});var i=function(){function l(u,f){return r(u,"name",{configurable:!0,value:f})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=s;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)},i!==void 0&&(i(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 f={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(f.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,f),l}t=e.exports=a,t.BaseError=s})(mw,mw.exports);var tD=mw.exports,C_="ProseMirror-selectednode",nD="",fa="\0",N_="__state_override__",_Z={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"},qe=_Z,Si=Symbol.for("__remirror__"),wn=(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))(wn||{}),wt=(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))(wt||{}),hr=(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))(hr||{}),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||{}),PZ=function(t){return TZ(t)&&!OZ(t)};function TZ(e){return!!e&&typeof e=="object"}function OZ(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||RZ(e)}var jZ=typeof Symbol=="function"&&Symbol.for,MZ=jZ?Symbol.for("react.element"):60103;function RZ(e){return e.$$typeof===MZ}function AZ(e){return Array.isArray(e)?[]:{}}function gh(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Ru(AZ(e),e,t):e}function IZ(e,t,n){return e.concat(t).map(function(r){return gh(r,n)})}function DZ(e,t){if(!t.customMerge)return Ru;var n=t.customMerge(e);return typeof n=="function"?n:Ru}function LZ(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function __(e){return Object.keys(e).concat(LZ(e))}function rD(e,t){try{return t in e}catch{return!1}}function FZ(e,t){return rD(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function zZ(e,t,n){var r={};return n.isMergeableObject(e)&&__(e).forEach(function(o){r[o]=gh(e[o],n)}),__(t).forEach(function(o){FZ(e,o)||(rD(e,o)&&n.isMergeableObject(t[o])?r[o]=DZ(o,n)(e[o],t[o],n):r[o]=gh(t[o],n))}),r}function Ru(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||IZ,n.isMergeableObject=n.isMergeableObject||PZ,n.cloneUnlessOtherwiseSpecified=gh;var r=Array.isArray(t),o=Array.isArray(e),s=r===o;return s?r?n.arrayMerge(e,t,n):zZ(e,t,n):gh(t,n)}Ru.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Ru(r,o,n)},{})};var $Z=Ru,BZ=$Z;const VZ=Ha(BZ);/*!
|
|
455
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
456
|
+
*
|
|
457
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
458
|
+
* Released under the MIT License.
|
|
459
|
+
*/var oD=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1};/*!
|
|
460
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
461
|
+
*
|
|
462
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
463
|
+
* Released under the MIT License.
|
|
464
|
+
*/var UZ=oD;function P_(e){return UZ(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}var WZ=function(t){var n,r;return!(P_(t)===!1||(n=t.constructor,typeof n!="function")||(r=n.prototype,P_(r)===!1)||r.hasOwnProperty("isPrototypeOf")===!1)};/*!
|
|
465
|
+
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
466
|
+
*
|
|
467
|
+
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
468
|
+
* Released under the MIT License.
|
|
469
|
+
*/var HZ=WZ,KZ=function(t){return HZ(t)||typeof t=="function"||Array.isArray(t)};/*!
|
|
470
|
+
* object.omit <https://github.com/jonschlinkert/object.omit>
|
|
471
|
+
*
|
|
472
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
473
|
+
* Released under the MIT License.
|
|
474
|
+
*/var GZ=KZ,qZ=function(t,n,r){if(!GZ(t))return{};typeof n=="function"&&(r=n,n=[]),typeof n=="string"&&(n=[n]);for(var o=typeof r=="function",s=Object.keys(t),i={},a=0;a<s.length;a++){var l=s[a],c=t[l];(!n||n.indexOf(l)===-1&&(!o||r(c,l,t)))&&(i[l]=c)}return i};const Pk=Ha(qZ);/*!
|
|
475
|
+
* object.pick <https://github.com/jonschlinkert/object.pick>
|
|
476
|
+
*
|
|
477
|
+
* Copyright (c) 2014-2015 Jon Schlinkert, contributors.
|
|
478
|
+
* Licensed under the MIT License
|
|
479
|
+
*/var YZ=oD,JZ=function(t,n){if(!YZ(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,s=-1;++s<o;){var i=n[s];i in t&&(r[i]=t[i])}return r};const gw=Ha(JZ),sD=/^[a-zà-öø-ÿ]+|[A-ZÀ-ÖØ-ß][a-zà-öø-ÿ]+|[a-zà-öø-ÿ]+|[0-9]+|[A-ZÀ-ÖØ-ß]+(?![a-zà-öø-ÿ])/g,XZ=/\S+/g;function ZZ(e,t){const n={parts:[],prefixes:[]},r=e.matchAll(t);let o=0;for(const i of r){if(typeof i.index!="number")continue;const a=i[0];n.parts.push(a);const l=e.slice(o,i.index).trim();n.prefixes.push(l),o=i.index+a.length}const s=e.slice(o).trim();return s&&(n.parts.push(""),n.prefixes.push(s)),n}function iD(e,t){const{keepSpecialCharacters:n=!1,keep:r,prefix:o=""}=t||{},s=e.trim().normalize("NFC"),i=s.includes(" "),l=ZZ(s,i?XZ:sD);return l.parts.map((c,u)=>{let f=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,""),f="")),r&&(f=f.replace(new RegExp(`[^${r.join("")}]`,"g"),"")),u===0?f+h:!f&&!h?"":i&&!f&&o.match(/\s/)?" "+h:(f||o)+h}).filter(Boolean)}function QZ(e){const t=e.matchAll(sD).next().value,n=t?t.index:0;return e.slice(0,n+1).toUpperCase()+e.slice(n+1).toLowerCase()}function aD(e,t){return iD(e,t).reduce((n,r)=>n+QZ(r),"")}function T_(e,t){return iD(e,{...t,prefix:"-"}).join("").toLowerCase()}function vw(e,t,n,r){var o,s=!1,i=0;function a(){o&&clearTimeout(o)}function l(){a(),s=!0}typeof t!="boolean"&&(r=n,n=t,t=void 0);function c(){for(var u=arguments.length,f=new Array(u),h=0;h<u;h++)f[h]=arguments[h];var p=this,g=Date.now()-i;if(s)return;function v(){i=Date.now(),n.apply(p,f)}function y(){o=void 0}r&&!o&&v(),a(),r===void 0&&g>e?v():t!==!0&&(o=setTimeout(r?y:v,r===void 0?e-g:e))}return c.cancel=l,c}function eQ(e,t,n){return n===void 0?vw(e,t,!1):vw(e,n,t!==!1)}function zt(e,t,n){const r=e[t];return lD(!Ty(r),n),r}function lD(e,t){if(!e)throw new tQ(t)}var tQ=class extends tD.BaseError{constructor(){super(...arguments),this.name="AssertionError"}};function cn(e){return Object.entries(e)}function vh(e){return Object.keys(e)}function Py(e){return Object.values(e)}function ns(e,t,n){return e.includes(t,n)}function Ne(e){return Object.assign(Object.create(null),e)}function cD(e){return Object.prototype.toString.call(e)}function uD(e){return cD(e).slice(8,-1)}function hp(e,t){return n=>typeof n!==e?!1:t?t(n):!0}function Tk(e){return t=>uD(t)===e}var Ty=hp("undefined"),Be=hp("string"),eo=hp("number",e=>!Number.isNaN(e)),At=hp("function");function nQ(e){return e===null}function rQ(e){return e===!0||e===!1}function dc(e){if(uD(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})}function oQ(e){return e==null||/^[bns]/.test(typeof e)}function Fa(e){return nQ(e)||Ty(e)}function Zn(e){return!Fa(e)&&(At(e)||hp("object")(e))}var sQ=Tk("RegExp");function iQ(e){return Tk("Map")(e)}function aQ(e){return Tk("Set")(e)}function qg(e){return Zn(e)&&!iQ(e)&&!aQ(e)&&Object.keys(e).length===0}var un=Array.isArray;function za(e){return un(e)&&e.length===0}function O_(e){return un(e)&&e.length>0}function Oy(e,t,n=r=>!!r){t.lastIndex=0;const r=[],o=t.flags;let s;o.includes("g")||(t=new RegExp(t.source,`g${o}`));do s=t.exec(e),s&&r.push(s);while(n(s));return t.lastIndex=0,r}function Yg(){const e=Date.now(),t=Yg.last||e;return Yg.last=e>t?e:t+1}Yg.last=0;function Jg(e=""){return`${e}${Yg().toString(36)}`}function lQ(e){return Pk(e,t=>!Ty(t))}function cQ(e){if(!dc(e))throw new Error("An invalid value was passed into this clone utility. Expected a plain object");return{...e}}function yh(e,t=!1){const n=t?[...e].reverse():e,r=new Set(n);return t?[...r].reverse():[...r]}function dD(){}function uQ(...e){return VZ.all(e,{isMergeableObject:dc})}function dQ({min:e,max:t,value:n}){return n<e?e:n>t?t:n}function fQ(e){return e[e.length-1]}function Yl(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 hQ(e,t,n){try{if(Be(t)&&t in e)return e[t];un(t)&&(t=`['${t.join("']['")}']`);let r=e;return t.replace(/\[\s*(["'])(.*?)\1\s*]|^\s*(\w+)\s*(?=\.|\[|$)|\.\s*(\w*)\s*(?=\.|\[|$)|\[\s*(-?\d+)\s*]/g,(o,s,i,a,l,c)=>(r=r[i||a||l||c],"")),r===void 0?n:r}catch{return n}}function pQ(e,t){const n=cQ(t);let r=n;for(const[o,s]of e.entries()){const i=o>=e.length-1;let a=r[s];if(i){if(un(r)){const l=Number.parseInt(s.toString(),10);eo(l)&&r.splice(l,1)}else Reflect.deleteProperty(r,s);return n}if(oQ(a))return n;a=un(a)?[...a]:{...a},r[s]=a,r=a}return n}function mQ(e){return t=>hQ(t,e)}function fD(e,t,n=!1){const r=[],o=new Set,s=At(t)?t:mQ(t),i=n?[...e].reverse():e;for(const a of i){const l=s(a);o.has(l)||(o.add(l),r.push(a))}return n?r.reverse():r}function hD(e,t){const n=un(e)?e[0]:e;return eo(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 j_(e,...t){const n=t.filter(eo);return e>=Math.min(...n)&&e<=Math.max(...n)}function pD(e){return At(e)?e():e}var mD="https://remirror.io/docs/errors",gQ={[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 vQ(e){return Be(e)&&ns(Py(re),e)}function yQ(e,t){const n=gQ[e],r=n?`${n}
|
|
480
|
+
|
|
481
|
+
`:"",o=t?`${t}
|
|
482
|
+
|
|
483
|
+
`:"";return`${r}${o}For more information visit ${mD}#${e.toLowerCase()}`}var gD=class extends tD.BaseError{constructor({code:e,message:t,disableLogging:n=!1}={}){const r=vQ(e)?e:re.CUSTOM;super(yQ(r,t)),this.errorCode=r,this.url=`${mD}#${r.toLowerCase()}`,n||console.error(this.message)}static create(e={}){return new gD(e)}};function Me(e,t){if(!e)throw gD.create(t)}function vl(e,t={}){return e}function jn(e){this.content=e}jn.prototype={constructor:jn,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),s=r.content.slice();return o==-1?s.push(n||e,t):(s[o+1]=t,n&&(s[o]=n)),new jn(s)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new jn(n)},addToStart:function(e,t){return new jn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new jn(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),s=r.find(e);return o.splice(s==-1?o.length:s,0,t,n),new jn(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=jn.from(e),e.size?new jn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=jn.from(e),e.size?new jn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=jn.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}};jn.from=function(e){if(e instanceof jn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new jn(t)};function vD(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),s=t.child(r);if(o==s){n+=o.nodeSize;continue}if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)n++;return n}if(o.content.size||s.content.size){let i=vD(o.content,s.content,n+1);if(i!=null)return i}n+=o.nodeSize}}function yD(e,t,n,r){for(let o=e.childCount,s=t.childCount;;){if(o==0||s==0)return o==s?null:{a:n,b:r};let i=e.child(--o),a=t.child(--s),l=i.nodeSize;if(i==a){n-=l,r-=l;continue}if(!i.sameMarkup(a))return{a:n,b:r};if(i.isText&&i.text!=a.text){let c=0,u=Math.min(i.text.length,a.text.length);for(;c<u&&i.text[i.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(i.content.size||a.content.size){let c=yD(i.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class q{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,o=0,s){for(let i=0,a=0;a<n;i++){let l=this.content[i],c=a+l.nodeSize;if(c>t&&r(l,o+a,s||null,i)!==!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 s="",i=!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&&(i?i=!1:s+=r),s+=c},0),s}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,o=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),s=1);s<t.content.length;s++)o.push(t.content[s]);return new q(o,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],o=0;if(n>t)for(let s=0,i=0;i<n;s++){let a=this.content[s],l=i+a.nodeSize;l>t&&((i<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-i),Math.min(a.text.length,n-i)):a=a.cut(Math.max(0,t-i-1),Math.min(a.content.size,n-i-1))),r.push(a),o+=a.nodeSize),i=l}return new q(r,o)}cutByIndex(t,n){return t==n?q.empty:t==0&&n==this.content.length?this:new q(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let o=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new q(o,s)}addToStart(t){return new q([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new q(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];t(o,r,n),r+=o.nodeSize}}findDiffStart(t,n=0){return vD(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return yD(this,t,n,r)}findIndex(t){if(t==0)return nm(0,t);if(t==this.size)return nm(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),s=r+o.nodeSize;if(s>=t)return s==t?nm(n+1,s):nm(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return q.empty;let n,r=0;for(let o=0;o<t.length;o++){let s=t[o];r+=s.nodeSize,o&&s.isText&&t[o-1].sameMarkup(s)?(n||(n=t.slice(0,o)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new q(n||t,r)}static from(t){if(!t)return q.empty;if(t instanceof q)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new q([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const d0={index:0,offset:0};function nm(e,t){return d0.index=e,d0.offset=t,d0}function Xg(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(!Xg(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Xg(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class ct{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let o=0;o<t.length;o++){let s=t[o];if(this.eq(s))return t;if(this.type.excludes(s.type))n||(n=t.slice(0,o));else{if(s.type.excludes(this.type))return t;!r&&s.type.rank>this.type.rank&&(n||(n=t.slice(0,o)),n.push(this),r=!0),n&&n.push(s)}}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&&Xg(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 ct.none;if(t instanceof ct)return[t];let n=t.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}ct.none=[];class Zg extends Error{}class le{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=bD(this.content,t+this.openStart,n);return r&&new le(r,this.openStart,this.openEnd)}removeBetween(t,n){return new le(xD(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 le.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 le(q.fromJSON(t,n.content),r,o)}static maxOpen(t,n=!0){let r=0,o=0;for(let s=t.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=t.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new le(t,r,o)}}le.empty=new le(q.empty,0,0);function xD(e,t,n){let{index:r,offset:o}=e.findIndex(t),s=e.maybeChild(r),{index:i,offset:a}=e.findIndex(n);if(o==t||s.isText){if(a!=n&&!e.child(i).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return e.replaceChild(r,s.copy(xD(s.content,t-o-1,n-o-1)))}function bD(e,t,n,r){let{index:o,offset:s}=e.findIndex(t),i=e.maybeChild(o);if(s==t||i.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=bD(i.content,t-s-1,n,i);return a&&e.replaceChild(o,i.copy(a))}function xQ(e,t,n){if(n.openStart>e.depth)throw new Zg("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Zg("Inconsistent open depths");return wD(e,t,n,0)}function wD(e,t,n,r){let o=e.index(r),s=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let i=wD(e,t,n,r+1);return s.copy(s.content.replaceChild(o,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let i=e.parent,a=i.content;return _l(i,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:i,end:a}=bQ(n,e);return _l(s,kD(e,i,a,t,r))}else return _l(s,Qg(e,t,r))}function SD(e,t){if(!t.type.compatibleContent(e.type))throw new Zg("Cannot join "+t.type.name+" onto "+e.type.name)}function yw(e,t,n){let r=e.node(n);return SD(r,t.node(n)),r}function Nl(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 Af(e,t,n,r){let o=(t||e).node(n),s=0,i=t?t.index(n):o.childCount;e&&(s=e.index(n),e.depth>n?s++:e.textOffset&&(Nl(e.nodeAfter,r),s++));for(let a=s;a<i;a++)Nl(o.child(a),r);t&&t.depth==n&&t.textOffset&&Nl(t.nodeBefore,r)}function _l(e,t){return e.type.checkContent(t),e.copy(t)}function kD(e,t,n,r,o){let s=e.depth>o&&yw(e,t,o+1),i=r.depth>o&&yw(n,r,o+1),a=[];return Af(null,e,o,a),s&&i&&t.index(o)==n.index(o)?(SD(s,i),Nl(_l(s,kD(e,t,n,r,o+1)),a)):(s&&Nl(_l(s,Qg(e,t,o+1)),a),Af(t,n,o,a),i&&Nl(_l(i,Qg(n,r,o+1)),a)),Af(r,null,o,a),new q(a)}function Qg(e,t,n){let r=[];if(Af(null,e,n,r),e.depth>n){let o=yw(e,t,n+1);Nl(_l(o,Qg(e,t,n+1)),r)}return Af(t,null,n,r),new q(r)}function bQ(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let s=n-1;s>=0;s--)o=t.node(s).copy(q.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}class Au{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 s=0;s<t;s++)o+=r.child(s).nodeSize;return o}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return ct.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 s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].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 Jl(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,s=n;for(let i=t;;){let{index:a,offset:l}=i.content.findIndex(s),c=s-l;if(r.push(i,a,o+l),!c||(i=i.child(a),i.isText))break;s=c-1,o+=l+1}return new Au(n,r,s)}static resolveCached(t,n){let r=M_.get(t);if(r)for(let s=0;s<r.elts.length;s++){let i=r.elts[s];if(i.pos==n)return i}else M_.set(t,r=new wQ);let o=r.elts[r.i]=Au.resolve(t,n);return r.i=(r.i+1)%SQ,o}}class wQ{constructor(){this.elts=[],this.i=0}}const SQ=12,M_=new WeakMap;class Jl{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 kQ=Object.create(null);let Na=class xw{constructor(t,n,r,o=ct.none){this.type=t,this.attrs=n,this.marks=o,this.content=r||q.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,o=0){this.content.nodesBetween(t,n,r,o,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,o){return this.content.textBetween(t,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Xg(this.attrs,n||t.defaultAttrs||kQ)&&ct.sameSet(this.marks,r||ct.none)}copy(t=null){return t==this.content?this:new xw(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new xw(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 le.empty;let o=this.resolve(t),s=this.resolve(n),i=r?0:o.sharedDepth(n),a=o.start(i),c=o.node(i).content.cut(o.pos-a,s.pos-a);return new le(c,o.depth-i,s.depth-i)}replace(t,n,r){return xQ(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 Au.resolveCached(this,t)}resolveNoCache(t){return Au.resolve(this,t)}rangeHasMark(t,n,r){let o=!1;return n>t&&this.nodesBetween(t,n,s=>(r.isInSet(s.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()+")"),ED(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=q.empty,o=0,s=r.childCount){let i=this.contentMatchAt(t).matchFragment(r,o,s),a=i&&i.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;l<s;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 s=this.contentMatchAt(t).matchType(r),i=s&&s.matchFragment(this.content,n);return i?i.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=ct.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(!ct.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let o=q.fromJSON(t,n.content),s=t.nodeType(n.type).create(n.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Na.prototype.text=void 0;class ev extends Na{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):ED(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 ev(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new ev(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 ED(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Xl{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new EQ(t,n);if(r.next==null)return Xl.empty;let o=CD(r);r.next&&r.err("Unexpected trailing text");let s=jQ(OQ(o));return MQ(s,r),s}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 s=n;o&&s<r;s++)o=o.matchType(t.child(s).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 s(i,a){let l=i.matchFragment(t,r);if(l&&(!n||l.validEnd))return q.from(a.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let h=s(f,a.concat(u));if(h)return h}}return null}return s(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(),s=o.match;if(s.matchType(t)){let i=[];for(let a=o;a.type;a=a.via)i.push(a.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:a,next:l}=s.next[i];!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 s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+t.indexOf(r.next[i].next);return s}).join(`
|
|
484
|
+
`)}}Xl.empty=new Xl(!0);class EQ{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 CD(e){let t=[];do t.push(CQ(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function CQ(e){let t=[];do t.push(NQ(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function NQ(e){let t=TQ(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=_Q(e,t);else break;return t}function R_(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function _Q(e,t){let n=R_(e),r=n;return e.eat(",")&&(e.next!="}"?r=R_(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function PQ(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let s in n){let i=n[s];i.isInGroup(t)&&o.push(i)}return o.length==0&&e.err("No node type or group '"+t+"' found"),o}function TQ(e){if(e.eat("(")){let t=CD(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=PQ(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 OQ(e){let t=[[]];return o(s(e,0),n()),t;function n(){return t.push([])-1}function r(i,a,l){let c={term:l,to:a};return t[i].push(c),c}function o(i,a){i.forEach(l=>l.to=a)}function s(i,a){if(i.type=="choice")return i.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(i.type=="seq")for(let l=0;;l++){let c=s(i.exprs[l],a);if(l==i.exprs.length-1)return c;o(c,a=n())}else if(i.type=="star"){let l=n();return r(a,l),o(s(i.expr,l),l),[r(l)]}else if(i.type=="plus"){let l=n();return o(s(i.expr,a),l),o(s(i.expr,l),l),[r(l)]}else{if(i.type=="opt")return[r(a)].concat(s(i.expr,a));if(i.type=="range"){let l=a;for(let c=0;c<i.min;c++){let u=n();o(s(i.expr,l),u),l=u}if(i.max==-1)o(s(i.expr,l),l);else for(let c=i.min;c<i.max;c++){let u=n();r(l,u),o(s(i.expr,l),u),l=u}return[r(l)]}else{if(i.type=="name")return[r(a,void 0,i.value)];throw new Error("Unknown expr type")}}}}function ND(e,t){return t-e}function A_(e,t){let n=[];return r(t),n.sort(ND);function r(o){let s=e[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let i=0;i<s.length;i++){let{term:a,to:l}=s[i];!a&&n.indexOf(l)==-1&&r(l)}}}function jQ(e){let t=Object.create(null);return n(A_(e,0));function n(r){let o=[];r.forEach(i=>{e[i].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]);A_(e,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=t[r.join(",")]=new Xl(r.indexOf(e.length-1)>-1);for(let i=0;i<o.length;i++){let a=o[i][1].sort(ND);s.next.push({type:o[i][0],next:t[a.join(",")]||n(a)})}return s}}function MQ(e,t){for(let n=0,r=[e];n<r.length;n++){let o=r[n],s=!o.validEnd,i=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];i.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _D(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 PD(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(o===void 0){let s=e[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function TD(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 s=e[o];s.validate&&s.validate(t[o])}}function OD(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new AQ(e,r,t[r]);return n}let bw=class jD{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=OD(t,r.attrs),this.defaultAttrs=_D(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==Xl.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:PD(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Na(this,this.computeAttrs(t),q.from(n),ct.setFrom(r))}createChecked(t=null,n,r){return n=q.from(n),this.checkContent(n),new Na(this,this.computeAttrs(t),n,ct.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=q.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(q.empty,!0);return s?new Na(this,t,n.append(s),ct.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){TD(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:ct.none:t}static compile(t,n){let r=Object.create(null);t.forEach((s,i)=>r[s]=new jD(s,n,i));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function RQ(e,t,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${s}`)}}class AQ{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?RQ(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class pp{constructor(t,n,r,o){this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=OD(t,o.attrs),this.excluded=null;let s=_D(this.attrs);this.instance=s?new ct(this,s):null}create(t=null){return!t&&this.instance?this.instance:new ct(this,PD(this.attrs,t))}static compile(t,n){let r=Object.create(null),o=0;return t.forEach((s,i)=>r[s]=new pp(s,o++,n,i)),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){TD(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class IQ{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=jn.from(t.nodes),n.marks=jn.from(t.marks||{}),this.nodes=bw.compile(this.spec.nodes,this),this.marks=pp.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 s=this.nodes[o],i=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[i]||(r[i]=Xl.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?I_(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:I_(this,i.split(" "))}this.nodeFromJSON=o=>Na.fromJSON(this,o),this.markFromJSON=o=>ct.fromJSON(this,o),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 bw){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 ev(r,r.defaultAttrs,t,ct.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function I_(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],s=e.marks[o],i=s;if(s)n.push(s);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(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function DQ(e){return e.tag!=null}function LQ(e){return e.style!=null}class Iu{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(DQ(o))this.tags.push(o);else if(LQ(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=t.nodes[o.node];return s.contentMatch.matchType(s)})}parse(t,n={}){let r=new L_(this,n,!1);return r.addAll(t,ct.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new L_(this,n,!0);return r.addAll(t,ct.none,n.from,n.to),le.maxOpen(r.finish())}matchTag(t,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if($Q(t,s.tag)&&(s.namespace===void 0||t.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(t);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(t,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],a=i.style;if(!(a.indexOf(t)!=0||i.context&&!r.matchesContext(i.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(i.getAttrs){let l=i.getAttrs(n);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(t){let n=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<n.length;i++){let a=n[i];if((a.priority==null?50:a.priority)<s)break}n.splice(i,0,o)}for(let o in t.marks){let s=t.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=F_(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in t.nodes){let s=t.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=F_(i)),i.node||i.ignore||i.mark||(i.node=o)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Iu(t,Iu.schemaRules(t)))}}const MD={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},FQ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},RD={ol:!0,ul:!0},xh=1,ww=2,If=4;function D_(e,t,n){return t!=null?(t?xh:0)|(t==="full"?ww:0):e&&e.whitespace=="pre"?xh|ww:n&~If}class rm{constructor(t,n,r,o,s,i){this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=i,this.content=[],this.activeMarks=ct.none,this.match=s||(i&If?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(q.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(t.type))?(this.match=r,o):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&xh)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=q.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!MD.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class L_{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,i=D_(null,n.preserveWhitespace,0)|(r?If:0);o?s=new rm(o.type,o.attrs,ct.none,!0,n.topMatch||o.type.contentMatch,i):r?s=new rm(null,null,ct.none,!0,null,i):s=new rm(t.schema.topNodeType,null,ct.none,!0,null,i),this.nodes=[s],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,s=o.options&ww?"full":this.localPreserveWS||(o.options&xh)>0,{schema:i}=this.parser;if(s==="full"||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
485
|
+
`);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(i.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(i.text(a[l]),n,!/\S/.test(a[l]));r=""}else 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 a=o.content[o.content.length-1],l=t.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let o=this.localPreserveWS,s=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let i=t.nodeName.toLowerCase(),a;RD.hasOwnProperty(i)&&this.parser.normalizeLists&&zQ(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(a=this.parser.matchTag(t,this,r));e:if(l?l.ignore:FQ.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let c,u=this.needsBlock;if(MD.hasOwnProperty(i))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let f=l&&l.skip?n:this.readStyles(t,n);f&&this.addAll(t,f),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(t,n);c&&this.addElementByRule(t,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
486
|
+
`),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],i=r.getPropertyValue(s);if(i)for(let a=void 0;;){let l=this.parser.matchStyle(s,i,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 s,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let l=this.enter(i,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(i&&i.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,!1));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)}s&&this.sync(a)&&this.open--}addAll(t,n,r,o){let s=r||0;for(let i=r?t.childNodes[r]:t.firstChild,a=o==null?null:t.childNodes[o];i!=a;i=i.nextSibling,++s)this.findAtPoint(t,s),this.addDOM(i,n);this.findAtPoint(t,s)}findPlace(t,n,r){let o,s;for(let i=this.open,a=0;i>=0;i--){let l=this.nodes[i],c=l.findWrapping(t);if(c&&(!o||o.length>c.length+a)&&(o=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(s);for(let i=0;i<o.length;i++)n=this.enterInner(o[i],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let o=this.findPlace(t,n,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(t.type));let i=ct.none;for(let a of o.concat(t.marks))(s.type?s.type.allowsMarkType(a.type):z_(a.type,t.type))&&(i=a.addToSet(i));return s.content.push(t.mark(i)),!0}return!1}enter(t,n,r,o){let s=this.findPlace(t.create(n),r,!1);return s&&(s=this.enterInner(t,n,r,!0,o)),s}enterInner(t,n,r,o=!1,s){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(t);let a=D_(t,s,i.options);i.options&If&&i.content.length==0&&(a|=If);let l=ct.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):z_(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new rm(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;this.localPreserveWS&&(this.nodes[n].options|=xh)}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),s=-(r?r.depth+1:0)+(o?0:1),i=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(i(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return i(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 zQ(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&RD.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function $Q(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function F_(e){let t={};for(let n in e)t[n]=e[n];return t}function z_(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let s=[],i=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||s.indexOf(u)<0&&i(u))return!0}};if(i(o.contentMatch))return!0}}class el{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=f0(n).createDocumentFragment());let o=r,s=[];return t.forEach(i=>{if(s.length||i.marks.length){let a=0,l=0;for(;a<s.length&&l<i.marks.length;){let c=i.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)o=s.pop()[1];for(;l<i.marks.length;){let c=i.marks[l++],u=this.serializeMark(c,i.isInline,n);u&&(s.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:o}=_m(f0(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 s=this.serializeMark(t.marks[o],t.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(t,n,r={}){let o=this.marks[t.type.name];return o&&_m(f0(r),o(t,n),null,t.attrs)}static renderSpec(t,n,r=null,o){return _m(t,n,r,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new el(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=$_(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return $_(t.marks)}}function $_(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function f0(e){return e.document||window.document}const B_=new WeakMap;function BQ(e){let t=B_.get(e);return t===void 0&&B_.set(e,t=VQ(e)),t}function VQ(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 _m(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],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=BQ(r))&&s.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 i=o.indexOf(" ");i>0&&(n=o.slice(0,i),o=o.slice(i+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 f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?l.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&l.style?l.style.cssText=c[f]:l.setAttribute(f,c[f])}}for(let f=u;f<t.length;f++){let h=t[f];if(h===0){if(f<t.length-1||f>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:g}=_m(e,h,n,r);if(l.appendChild(p),g){if(a)throw new RangeError("Multiple content holes");a=g}}}return{dom:l,contentDOM:a}}const AD=65535,ID=Math.pow(2,16);function UQ(e,t){return e+t*ID}function V_(e){return e&AD}function WQ(e){return(e-(e&AD))/ID}const DD=1,LD=2,Pm=4,FD=8;class Sw{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&FD)>0}get deletedBefore(){return(this.delInfo&(DD|Pm))>0}get deletedAfter(){return(this.delInfo&(LD|Pm))>0}get deletedAcross(){return(this.delInfo&Pm)>0}}class Ur{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Ur.empty)return Ur.empty}recover(t){let n=0,r=V_(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+WQ(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,s=this.inverted?2:1,i=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+s],u=this.ranges[a+i],f=l+c;if(t<=f){let h=c?t==l?-1:t==f?1:n:n,p=l+o+(h<0?0:u);if(r)return p;let g=t==(n<0?l:f)?null:UQ(a/3,t-l),v=t==l?LD:t==f?DD:Pm;return(n<0?t!=l:t!=f)&&(v|=FD),new Sw(p,v,g)}o+=u-c}return r?t+o:new Sw(t+o,0,null)}touches(t,n){let r=0,o=V_(n),s=this.inverted?2:1,i=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+s],u=l+c;if(t<=u&&a==o*3)return!0;r+=this.ranges[a+i]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],a=i-(this.inverted?s:0),l=i+(this.inverted?0:s),c=this.ranges[o+n],u=this.ranges[o+r];t(a,a+c,l,l+u),s+=u-c}}invert(){return new Ur(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Ur.empty:new Ur(t<0?[0,-t,0]:[0,0,t])}}Ur.empty=new Ur([]);class bh{constructor(t,n,r=0,o=t?t.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new bh(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),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 bh;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 s=this.from;s<this.to;s++){let i=this._maps[s],a=i.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,t=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,t=a.pos}return r?t:new Sw(t,o,null)}}const h0=Object.create(null);class dn{getMap(){return Ur.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=h0[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 h0)throw new RangeError("Duplicate use of step JSON ID "+t);return h0[t]=n,n.prototype.jsonID=t,n}}class qt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new qt(t,null)}static fail(t){return new qt(null,t)}static fromReplace(t,n,r,o){try{return qt.ok(t.replace(n,r,o))}catch(s){if(s instanceof Zg)return qt.fail(s.message);throw s}}}function Ok(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let s=e.child(o);s.content.size&&(s=s.copy(Ok(s.content,t,s))),s.isInline&&(s=t(s,n,o)),r.push(s)}return q.fromArray(r)}class oi extends dn{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)),s=new le(Ok(n.content,(i,a)=>!i.isAtom||!a.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),n.openStart,n.openEnd);return qt.fromReplace(t,this.from,this.to,s)}invert(){return new Ko(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 oi(n.pos,r.pos,this.mark)}merge(t){return t instanceof oi&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new oi(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 oi(n.from,n.to,t.markFromJSON(n.mark))}}dn.jsonID("addMark",oi);class Ko extends dn{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 le(Ok(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),t),n.openStart,n.openEnd);return qt.fromReplace(t,this.from,this.to,r)}invert(){return new oi(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 Ko(n.pos,r.pos,this.mark)}merge(t){return t instanceof Ko&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ko(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 Ko(n.from,n.to,t.markFromJSON(n.mark))}}dn.jsonID("removeMark",Ko);class ha extends dn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return qt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qt.fromReplace(t,this.pos,this.pos+1,new le(q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new ha(this.pos,n.marks[o]);return new ha(this.pos,this.mark)}}return new Zl(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ha(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 ha(n.pos,t.markFromJSON(n.mark))}}dn.jsonID("addNodeMark",ha);class Zl extends dn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return qt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return qt.fromReplace(t,this.pos,this.pos+1,new le(q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ha(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Zl(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 Zl(n.pos,t.markFromJSON(n.mark))}}dn.jsonID("removeNodeMark",Zl);class yn extends dn{constructor(t,n,r,o=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=o}apply(t){return this.structure&&kw(t,this.from,this.to)?qt.fail("Structure replace would overwrite content"):qt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Ur([this.from,this.to-this.from,this.slice.size])}invert(t){return new yn(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 yn(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof yn)||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?le.empty:new le(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new yn(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?le.empty:new le(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new yn(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 yn(n.from,n.to,le.fromJSON(t,n.slice),!!n.structure)}}dn.jsonID("replace",yn);class Yt extends dn{constructor(t,n,r,o,s,i,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=a}apply(t){if(this.structure&&(kw(t,this.from,this.gapFrom)||kw(t,this.gapTo,this.to)))return qt.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return qt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?qt.fromReplace(t,this.from,this.to,r):qt.fail("Content does not fit in gap")}getMap(){return new Ur([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 Yt(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),s=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new Yt(n.pos,r.pos,o,s,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 Yt(n.from,n.to,n.gapFrom,n.gapTo,le.fromJSON(t,n.slice),n.insert,!!n.structure)}}dn.jsonID("replaceAround",Yt);function kw(e,t,n){let r=e.resolve(t),o=n-t,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function HQ(e,t,n,r){let o=[],s=[],i,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,t),p=Math.min(c+l.nodeSize,n),g=r.addToSet(f);for(let v=0;v<f.length;v++)f[v].isInSet(g)||(i&&i.to==h&&i.mark.eq(f[v])?i.to=p:o.push(i=new Ko(h,p,f[v])));a&&a.to==h?a.to=p:s.push(a=new oi(h,p,r))}}),o.forEach(l=>e.step(l)),s.forEach(l=>e.step(l))}function KQ(e,t,n,r){let o=[],s=0;e.doc.nodesBetween(t,n,(i,a)=>{if(!i.isInline)return;s++;let l=null;if(r instanceof pp){let c=i.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(l=[r]):l=i.marks;if(l&&l.length){let c=Math.min(a+i.nodeSize,n);for(let u=0;u<l.length;u++){let f=l[u],h;for(let p=0;p<o.length;p++){let g=o[p];g.step==s-1&&f.eq(o[p].style)&&(h=g)}h?(h.to=c,h.step=s):o.push({style:f,from:Math.max(a,t),to:c,step:s})}}}),o.forEach(i=>e.step(new Ko(i.from,i.to,i.style)))}function jk(e,t,n,r=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),i=[],a=t+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)i.push(new yn(a,u,le.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||e.step(new Ko(a,u,c.marks[h]));if(o&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,g;for(;h=p.exec(c.text);)g||(g=new le(q.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new yn(a+h.index,a+h.index+h[0].length,g))}}a=u}if(!r.validEnd){let l=r.fillBefore(q.empty,!0);e.replace(a,a,new le(l,0,0))}for(let l=i.length-1;l>=0;l--)e.step(i[l])}function GQ(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function ud(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,o=0,s=0;;--r){let i=e.$from.node(r),a=e.$from.index(r)+o,l=e.$to.indexAfter(r)-s;if(r<e.depth&&i.canReplace(a,l,n))return r;if(r==0||i.type.spec.isolating||!GQ(i,a,l))break;a&&(o=1),l<i.childCount&&(s=1)}return null}function qQ(e,t,n){let{$from:r,$to:o,depth:s}=t,i=r.before(s+1),a=o.after(s+1),l=i,c=a,u=q.empty,f=0;for(let g=s,v=!1;g>n;g--)v||r.index(g)>0?(v=!0,u=q.from(r.node(g).copy(u)),f++):l--;let h=q.empty,p=0;for(let g=s,v=!1;g>n;g--)v||o.after(g+1)<o.end(g)?(v=!0,h=q.from(o.node(g).copy(h)),p++):c++;e.step(new Yt(l,c,i,a,new le(u.append(h),f,p),u.size-f,!0))}function Mk(e,t,n=null,r=e){let o=YQ(e,t),s=o&&JQ(r,t);return s?o.map(U_).concat({type:t,attrs:n}).concat(s.map(U_)):null}function U_(e){return{type:e,attrs:null}}function YQ(e,t){let{parent:n,startIndex:r,endIndex:o}=e,s=n.contentMatchAt(r).findWrapping(t);if(!s)return null;let i=s.length?s[0]:t;return n.canReplaceWith(r,o,i)?s:null}function JQ(e,t){let{parent:n,startIndex:r,endIndex:o}=e,s=n.child(r),i=t.contentMatch.findWrapping(s.type);if(!i)return null;let l=(i.length?i[i.length-1]:t).contentMatch;for(let c=r;l&&c<o;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:i}function XQ(e,t,n){let r=q.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let a=n[i].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=q.from(n[i].type.create(n[i].attrs,r))}let o=t.start,s=t.end;e.step(new Yt(o,s,o,s,new le(r,0,0),n.length,!0))}function ZQ(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,(i,a)=>{let l=typeof o=="function"?o(i):o;if(i.isTextblock&&!i.hasMarkup(r,l)&&QQ(e.doc,e.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",g=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!g?c=!1:!p&&g&&(c=!0)}c===!1&&$D(e,i,a,s),jk(e,e.mapping.slice(s).map(a,1),r,void 0,c===null);let u=e.mapping.slice(s),f=u.map(a,1),h=u.map(a+i.nodeSize,1);return e.step(new Yt(f,h,f+1,h-1,new le(q.from(r.create(l,null,i.marks)),0,0),1,!0)),c===!0&&zD(e,i,a,s),!1}})}function zD(e,t,n,r){t.forEach((o,s)=>{if(o.isText){let i,a=/\r?\n|\r/g;for(;i=a.exec(o.text);){let l=e.mapping.slice(r).map(n+1+s+i.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function $D(e,t,n,r){t.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+s);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
487
|
+
`))}})}function QQ(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function eee(e,t,n,r,o){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let i=n.create(r,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,i);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Yt(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new le(q.from(i),0,0),1,!0))}function au(e,t,n=1,r){let o=e.resolve(t),s=o.depth-n,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>s;c--,u--){let f=o.node(c),h=o.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),g=r&&r[u+1];g&&(p=p.replaceChild(0,g.type.create(g.attrs)));let v=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!v.type.validContent(p))return!1}let a=o.indexAfter(s),l=r&&r[0];return o.node(s).canReplaceWith(a,a,l?l.type:o.node(s+1).type)}function tee(e,t,n=1,r){let o=e.doc.resolve(t),s=q.empty,i=q.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){s=q.from(o.node(a).copy(s));let u=r&&r[c];i=q.from(u?u.type.create(u.attrs,i):o.node(a).copy(i))}e.step(new yn(t,t,new le(s.append(i),n,n),!0))}function mp(e,t){let n=e.resolve(t),r=n.index();return ree(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function nee(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 s=t.child(o),i=s.type==r?e.type.schema.nodes.text:s.type;if(n=n.matchType(i),!n||!e.type.allowsMarks(s.marks))return!1}return n.validEnd}function ree(e,t){return!!(e&&t&&!e.isLeaf&&nee(e,t))}function oee(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,s=e.doc.resolve(t-n),i=s.node().type;if(o&&i.inlineContent){let u=i.whitespace=="pre",f=!!i.contentMatch.matchType(o);u&&!f?r=!1:!u&&f&&(r=!0)}let a=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);$D(e,u.node(),u.before(),a)}i.inlineContent&&jk(e,t+n-1,i,s.node().contentMatchAt(s.index()),r==null);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new yn(c,l.map(t+n,-1),le.empty,!0)),r===!0){let u=e.doc.resolve(c);zD(e,u.node(),u.before(),e.steps.length)}return e}function BD(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 s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function VD(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let i=r.depth;i>=0;i--){let a=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,l=r.index(i)+(a>0?1:0),c=r.node(i),u=!1;if(s==1)u=c.canReplace(l,l,o);else{let f=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=f&&c.canReplaceWith(l,l,f[0])}if(u)return a==0?r.pos:a<0?r.before(i+1):r.after(i+1)}return null}function Rk(e,t,n=t,r=le.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),s=e.resolve(n);return UD(o,s,r)?new yn(t,n,r):new see(o,s,r).fit()}function UD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class see{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=q.empty;for(let o=0;o<=t.depth;o++){let s=t.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(t.indexAfter(o))})}for(let o=t.depth;o>0;o--)this.placed=q.from(t.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;let s=this.placed,i=r.depth,a=o.depth;for(;i&&a&&s.childCount==1;)s=s.firstChild.content,i--,a--;let l=new le(s,i,a);return t>-1?new Yt(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new yn(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 s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){t=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=p0(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,f=null;if(n==1&&(i?c.matchType(i.type)||(f=c.fillBefore(q.from(i),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(n==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,o=p0(t,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new le(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=p0(t,n);if(o.childCount<=1&&n>0){let s=t.size-n<=n+o.size;this.unplaced=new le(Gd(t,n-1,1),n-1,s?n-1:r)}else this.unplaced=new le(Gd(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let v=0;v<s.length;v++)this.openFrontierNode(s[v]);let i=this.unplaced,a=r?r.content:i.content,l=i.openStart-t,c=0,u=[],{match:f,type:h}=this.frontier[n];if(o){for(let v=0;v<o.childCount;v++)u.push(o.child(v));f=f.matchFragment(o)}let p=a.size+t-(i.content.size-i.openEnd);for(;c<a.childCount;){let v=a.child(c),y=f.matchType(v.type);if(!y)break;c++,(c>1||l==0||v.content.size)&&(f=y,u.push(WD(v.mark(h.allowedMarks(v.marks)),c==1?l:0,c==a.childCount?p:-1)))}let g=c==a.childCount;g||(p=-1),this.placed=qd(this.placed,n,q.from(u)),this.frontier[n].match=f,g&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let v=0,y=a;v<p;v++){let x=y.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),y=x.content}this.unplaced=g?t==0?le.empty:new le(Gd(i.content,t-1,1),t-1,p<0?i.openEnd:t-1):new le(Gd(i.content,t,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!m0(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],s=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),i=m0(t,n,o,r,s);if(i){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=m0(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:i,move:s?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=qd(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let o=t.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,t.index(r));this.openFrontierNode(o.type,o.attrs,s)}return t}openFrontierNode(t,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=qd(this.placed,this.depth,q.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(q.empty,!0);n.childCount&&(this.placed=qd(this.placed,this.frontier.length,n))}}function Gd(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Gd(e.firstChild.content,t-1,n)))}function qd(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(qd(e.lastChild.content,t-1,n)))}function p0(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function WD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,WD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(q.empty,!0)))),e.copy(r)}function m0(e,t,n,r,o){let s=e.node(t),i=o?e.indexAfter(t):e.index(t);if(i==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,i);return a&&!iee(n,s.content,i)?a:null}function iee(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function aee(e){return e.spec.defining||e.spec.definingForContent}function lee(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(UD(o,s,r))return e.step(new yn(t,n,r));let i=KD(o,s);i[i.length-1]==0&&i.pop();let a=-(o.depth+1);i.unshift(a);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let g=o.node(h).type.spec;if(g.defining||g.definingAsContext||g.isolating)break;i.indexOf(h)>-1?a=h:o.before(h)==p&&i.splice(1,0,-h)}let l=i.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let g=h.firstChild;if(c.push(g),p==r.openStart)break;h=g.content}for(let h=u-1;h>=0;h--){let p=c[h],g=aee(p.type);if(g&&!p.sameMarkup(o.node(Math.abs(a)-1)))u=h;else if(g||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),g=c[p];if(g)for(let v=0;v<i.length;v++){let y=i[(v+l)%i.length],x=!0;y<0&&(x=!1,y=-y);let b=o.node(y-1),w=o.index(y-1);if(b.canReplaceWith(w,w,g.type,g.marks))return e.replace(o.before(y),x?s.after(y):n,new le(HD(r.content,0,r.openStart,p),p,r.openEnd))}}let f=e.steps.length;for(let h=i.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>f));h--){let p=i[h];p<0||(t=o.before(p),n=s.after(p))}}function HD(e,t,n,r,o){if(t<n){let s=e.firstChild;e=e.replaceChild(0,s.copy(HD(s.content,t+1,n,r,s)))}if(t>r){let s=o.contentMatchAt(0),i=s.fillBefore(e).append(e);e=i.append(s.matchFragment(i).fillBefore(q.empty,!0))}return e}function cee(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=BD(e.doc,t,r.type);o!=null&&(t=n=o)}e.replaceRange(t,n,new le(q.from(r),0,0))}function uee(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),s=KD(r,o);for(let i=0;i<s.length;i++){let a=s[i],l=i==s.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 i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}function KD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let o=r;o>=0;o--){let s=e.start(o);if(s<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;(s==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==s-1)&&n.push(o)}return n}class lu extends dn{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 qt.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return qt.fromReplace(t,this.pos,this.pos+1,new le(q.from(o),0,n.isLeaf?0:1))}getMap(){return Ur.empty}invert(t){return new lu(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 lu(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 lu(n.pos,n.attr,n.value)}}dn.jsonID("attr",lu);class wh extends dn{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 qt.ok(r)}getMap(){return Ur.empty}invert(t){return new wh(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 wh(n.attr,n.value)}}dn.jsonID("docAttr",wh);let Du=class extends Error{};Du=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Du.prototype=Object.create(Error.prototype);Du.prototype.constructor=Du;Du.prototype.name="TransformError";class dee{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new bh}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Du(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=le.empty){let o=Rk(this.doc,t,n,r);return o&&this.step(o),this}replaceWith(t,n,r){return this.replace(t,n,new le(q.from(r),0,0))}delete(t,n){return this.replace(t,n,le.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return lee(this,t,n,r),this}replaceRangeWith(t,n,r){return cee(this,t,n,r),this}deleteRange(t,n){return uee(this,t,n),this}lift(t,n){return qQ(this,t,n),this}join(t,n=1){return oee(this,t,n),this}wrap(t,n){return XQ(this,t,n),this}setBlockType(t,n=t,r,o=null){return ZQ(this,t,n,r,o),this}setNodeMarkup(t,n,r=null,o){return eee(this,t,n,r,o),this}setNodeAttribute(t,n,r){return this.step(new lu(t,n,r)),this}setDocAttribute(t,n){return this.step(new wh(t,n)),this}addNodeMark(t,n){return this.step(new ha(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof ct)n.isInSet(r.marks)&&this.step(new Zl(t,n));else{let o=r.marks,s,i=[];for(;s=n.isInSet(o);)i.push(new Zl(t,s)),o=s.removeFromSet(o);for(let a=i.length-1;a>=0;a--)this.step(i[a])}return this}split(t,n=1,r){return tee(this,t,n,r),this}addMark(t,n,r){return HQ(this,t,n,r),this}removeMark(t,n,r){return KQ(this,t,n,r),this}clearIncompatible(t,n,r){return jk(this,t,n,r),this}}const g0=Object.create(null);class tt{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new fee(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=le.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let s=t.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){let{$from:l,$to:c}=i[a],u=t.mapping.slice(s);t.replaceRange(u.map(l.pos),u.map(c.pos),a?le.empty:n),a==0&&K_(t,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:a}=o[s],l=t.mapping.slice(r),c=l.map(i.pos),u=l.map(a.pos);s?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),K_(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let o=t.parent.inlineContent?new Ve(t):Rc(t.node(0),t.parent,t.pos,t.index(),n,r);if(o)return o;for(let s=t.depth-1;s>=0;s--){let i=n<0?Rc(t.node(0),t.node(s),t.before(s+1),t.index(s),n,r):Rc(t.node(0),t.node(s),t.after(s+1),t.index(s)+1,n,r);if(i)return i}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new or(t.node(0))}static atStart(t){return Rc(t,t,0,0,1)||new or(t)}static atEnd(t){return Rc(t,t,t.content.size,t.childCount,-1)||new or(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=g0[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 g0)throw new RangeError("Duplicate use of selection JSON ID "+t);return g0[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Ve.between(this.$anchor,this.$head).getBookmark()}}tt.prototype.visible=!0;class fee{constructor(t,n){this.$from=t,this.$to=n}}let W_=!1;function H_(e){!W_&&!e.parent.inlineContent&&(W_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ve extends tt{constructor(t,n=t){H_(t),H_(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 tt.near(r);let o=t.resolve(n.map(this.anchor));return new Ve(o.parent.inlineContent?o:r,r)}replace(t,n=le.empty){if(super.replace(t,n),n==le.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Ve&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new jy(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 Ve(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 s=tt.findFrom(n,r,!0)||tt.findFrom(n,-r,!0);if(s)n=s.$head;else return tt.near(n,r)}return t.parent.inlineContent||(o==0?t=n:(t=(tt.findFrom(t,-r,!0)||tt.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=o<0&&(t=n))),new Ve(t,n)}}tt.jsonID("text",Ve);class jy{constructor(t,n){this.anchor=t,this.head=n}map(t){return new jy(t.map(this.anchor),t.map(this.head))}resolve(t){return Ve.between(t.resolve(this.anchor),t.resolve(this.head))}}class Ae extends tt{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),s=t.resolve(o);return r?tt.near(s):new Ae(s)}content(){return new le(q.from(this.node),0,0)}eq(t){return t instanceof Ae&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ak(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ae(t.resolve(n.anchor))}static create(t,n){return new Ae(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}Ae.prototype.visible=!1;tt.jsonID("node",Ae);class Ak{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new jy(r,r):new Ak(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Ae.isSelectable(r)?new Ae(n):tt.near(n)}}class or extends tt{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=le.empty){if(n==le.empty){t.delete(0,t.doc.content.size);let r=tt.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new or(t)}map(t){return new or(t)}eq(t){return t instanceof or}getBookmark(){return hee}}tt.jsonID("all",or);const hee={map(){return this},resolve(e){return new or(e)}};function Rc(e,t,n,r,o,s=!1){if(t.inlineContent)return Ve.create(e,n);for(let i=r-(o>0?0:1);o>0?i<t.childCount:i>=0;i+=o){let a=t.child(i);if(a.isAtom){if(!s&&Ae.isSelectable(a))return Ae.create(e,n-(o<0?a.nodeSize:0))}else{let l=Rc(e,a,n+o,o<0?a.childCount:0,o,s);if(l)return l}n+=a.nodeSize*o}return null}function K_(e,t,n){let r=e.steps.length-1;if(r<t)return;let o=e.steps[r];if(!(o instanceof yn||o instanceof Yt))return;let s=e.mapping.maps[r],i;s.forEach((a,l,c,u)=>{i==null&&(i=u)}),e.setSelection(tt.near(e.doc.resolve(i),n))}const G_=1,om=2,q_=4;class pee extends dee{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|G_)&~om,this.storedMarks=null,this}get selectionSet(){return(this.updated&G_)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=om,this}ensureMarks(t){return ct.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&om)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~om,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)||ct.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),!t)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(n);s=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(t,s)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(tt.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|=q_,this}get scrolledIntoView(){return(this.updated&q_)>0}}function Y_(e,t){return!t||!e?e:e.bind(t)}class Yd{constructor(t,n,r){this.name=t,this.init=Y_(n.init,r),this.apply=Y_(n.apply,r)}}const mee=[new Yd("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Yd("selection",{init(e,t){return e.selection||tt.atStart(t.doc)},apply(e){return e.selection}}),new Yd("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Yd("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class v0{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=mee.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 Yd(r.key,r.spec.state,r))})}}class yl{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 s=!1;for(let i=0;i<this.config.plugins.length;i++){let a=this.config.plugins[i];if(a.spec.appendTransaction){let l=o?o[i].n:0,c=o?o[i].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",t),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<i?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}o&&(o[i]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new yl(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(t,this[s.name],this,n)}return n}get tr(){return new pee(this)}static create(t){let n=new v0(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new yl(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 v0(this.schema,t.plugins),r=n.fields,o=new yl(n);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].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],s=o.spec.state;s&&s.toJSON&&(n[r]=s.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 v0(t.schema,t.plugins),s=new yl(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=Na.fromJSON(t.schema,n.doc);else if(i.name=="selection")s.selection=tt.fromJSON(s.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(s.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==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[i.name]=c.fromJSON.call(l,t,n[a],s);return}}s[i.name]=i.init(t,s)}}),s}}function GD(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):r=="handleDOMEvents"&&(o=GD(o,t,{})),n[r]=o}return n}class Ni{constructor(t){this.spec=t,this.props={},t.props&&GD(t.props,this,this.props),this.key=t.key?t.key.key:qD("plugin")}getState(t){return t[this.key]}}const y0=Object.create(null);function qD(e){return e in y0?e+"$"+ ++y0[e]:(y0[e]=0,e+"$")}class dd{constructor(t="key"){this.key=qD(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function YD(){return typeof document<"u"?document:null}function JD(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||"___",s=!!t.flat;r.forEach(function(l){var c=new RegExp(["\\",l[0],"[^\\",l[0],"\\",l[1],"]*\\",l[1]].join("")),u=[];function f(h,p,g){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 g,v=0;h!=g;)if(g=h,h=h.replace(c,f),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 i=new RegExp("\\"+o+"([0-9]+)\\"+o);function a(l,c,u){for(var f=[],h,p=0;h=i.exec(l);){if(p++>1e4)throw Error("Circular references in parenthesis");f.push(l.slice(0,h.index)),f.push(a(c[h[1]],c)),l=l.slice(h.index+h[0].length)}return f.push(l),f}return s?n:a(n[0],n)}function XD(e,t){if(t&&t.flat){var n=t&&t.escape||"___",r=e[0],o;if(!r)return"";for(var s=new RegExp("\\"+n+"([0-9]+)\\"+n),i=0;r!=o;){if(i++>1e4)throw Error("Circular references in "+e);o=r,r=r.replace(s,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 ZD(e,t){return Array.isArray(e)?XD(e,t):JD(e,t)}ZD.parse=JD;ZD.stringify=XD;const gee={id:"extension.command.copy.label",message:"Copy",comment:"Label for copy command."},vee={id:"extension.command.copy.description",message:"Copy the selected text",comment:"Description for copy command."},yee={id:"extension.command.cut.label",message:"Cut",comment:"Label for cut command."},xee={id:"extension.command.cut.description",message:"Cut the selected text",comment:"Description for cut command."},bee={id:"extension.command.paste.label",message:"Paste",comment:"Label for paste command."},wee={id:"extension.command.paste.description",message:"Paste content into the editor",comment:"Description for paste command."},See={id:"extension.command.select-all.label",message:"Select all",comment:"Label for select all command."},kee={id:"extension.command.select-all.description",message:"Select all content within the editor",comment:"Description for select all command."};var $a=Object.freeze({__proto__:null,COPY_DESCRIPTION:vee,COPY_LABEL:gee,CUT_DESCRIPTION:xee,CUT_LABEL:yee,PASTE_DESCRIPTION:wee,PASTE_LABEL:bee,SELECT_ALL_DESCRIPTION:kee,SELECT_ALL_LABEL:See});const Eee={id:"extension.command.toggle-bold.label",message:"Bold",comment:"Label for bold formatting command."},Cee={id:"extension.command.toggle-bold.description",message:"Add bold formatting to the selected text",comment:"Description for bold formatting command."};var J_=Object.freeze({__proto__:null,DESCRIPTION:Cee,LABEL:Eee});const Nee={id:"extension.command.toggle-heading.label",message:`{level, select, 1 {Heading 1}
|
|
488
|
+
2 {Heading 2}
|
|
489
|
+
3 {Heading 3}
|
|
490
|
+
4 {Heading 4}
|
|
491
|
+
5 {Heading 5}
|
|
492
|
+
6 {Heading 6}
|
|
493
|
+
other {Heading}}`,comment:"Label for heading command with support for levels."};var _ee=Object.freeze({__proto__:null,LABEL:Nee});const Pee={id:"extension.command.undo.label",message:"Undo",comment:"Label for undo."},Tee={id:"extension.command.undo.description",message:"Undo the most recent action",comment:"Description for undo."},Oee={id:"extension.command.redo.label",message:"Redo",comment:"Label for redo."},jee={id:"extension.command.redo.description",message:"Redo the most recent action",comment:"Description for redo."};var tv=Object.freeze({__proto__:null,REDO_DESCRIPTION:jee,REDO_LABEL:Oee,UNDO_DESCRIPTION:Tee,UNDO_LABEL:Pee});const Mee={id:"extension.command.toggle-italic.label",message:"Italic",comment:"Label for italic formatting command."},Ree={id:"extension.command.toggle-italic.description",message:"Italicize the selected text",comment:"Description for italic formatting command."};var X_=Object.freeze({__proto__:null,DESCRIPTION:Ree,LABEL:Mee});const Aee={id:"extension.command.toggle-ordered-list.label",message:"Ordered list",comment:"Label for inserting an ordered list into the editor."},Iee={id:"extension.command.toggle-bullet-list.description",message:"Bulleted list",comment:"Description for inserting a bullet list into the editor."},Dee={id:"extension.command.toggle-task-list.description",message:"Tasked list",comment:"Description for inserting a task list into the editor."};var Ik=Object.freeze({__proto__:null,BULLET_LIST_LABEL:Iee,ORDERED_LIST_LABEL:Aee,TASK_LIST_LABEL:Dee});const Lee={id:"extension.command.insert-paragraph.label",message:"Insert Paragraph",comment:"Label for inserting a paragraph."},Fee={id:"extension.command.insert-paragraph.description",message:"Insert a new paragraph",comment:"Description for inserting a paragraph."},zee={id:"extension.command.convert-paragraph.label",message:"Convert Paragraph",comment:"Label for converting the current node into a paragraph."},$ee={id:"extension.command.convert-paragraph.description",message:"Convert current block into a paragraph block.",comment:"Description for converting a paragraph."};var nv=Object.freeze({__proto__:null,CONVERT_DESCRIPTION:$ee,CONVERT_LABEL:zee,INSERT_DESCRIPTION:Fee,INSERT_LABEL:Lee});const Bee={id:"extension.command.toggle-strike.label",message:"Strikethrough",comment:"Label for strike formatting command."},Vee={id:"extension.command.toggle-strike.description",message:"Strikethrough the selected text",comment:"Description for strike formatting command."};var Z_=Object.freeze({__proto__:null,DESCRIPTION:Vee,LABEL:Bee});class Oo{constructor(t,n,r={}){this.match=t,this.match=t,this.handler=typeof n=="string"?Uee(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function Uee(e){return function(t,n,r,o){let s=e;if(n[1]){let i=n[0].lastIndexOf(n[1]);s+=n[0].slice(i+n[1].length),r+=i;let a=r-o;a>0&&(s=n[0].slice(i-a,i)+s,r=o)}return t.tr.insertText(s,r,o)}}const Wee=500;function Hee({rules:e}){let t=new Ni({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,s){return Q_(n,r,o,s,e,t)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&Q_(n,r.pos,r.pos,"",e,t)})}}},isInputRules:!0});return t}function Q_(e,t,n,r,o,s){if(e.composing)return!1;let i=e.state,a=i.doc.resolve(t),l=a.parent.textBetween(Math.max(0,a.parentOffset-Wee),a.parentOffset,null,"")+r;for(let c=0;c<o.length;c++){let u=o[c];if(!u.inCodeMark&&a.marks().some(g=>g.type.spec.code))continue;if(a.parent.type.spec.code){if(!u.inCode)continue}else if(u.inCode==="only")continue;let f=u.match.exec(l);if(!f||f[0].length<r.length)continue;let h=t-(f[0].length-r.length);if(!u.inCodeMark){let g=!1;if(i.doc.nodesBetween(h,a.pos,v=>{v.isInline&&v.marks.some(y=>y.type.spec.code)&&(g=!0)}),g)continue}let p=u.handler(i,f,h,n);if(p)return u.undoable&&p.setMeta(s,{transform:p,from:t,to:n,text:r}),e.dispatch(p),!0}return!1}const Kee=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let o=n[r],s;if(o.spec.isInputRules&&(s=o.getState(e))){if(t){let i=e.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l--)i.step(a.steps[l].invert(a.docs[l]));if(s.text){let l=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,e.schema.text(s.text,l))}else i.delete(s.from,s.to);t(i)}return!0}}return!1};new Oo(/--$/,"—",{inCodeMark:!1});new Oo(/\.\.\.$/,"…",{inCodeMark:!1});new Oo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Oo(/"$/,"”",{inCodeMark:!1});new Oo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Oo(/'$/,"’",{inCodeMark:!1});function Dk(e,t,n=null,r){return new Oo(e,(o,s,i,a)=>{let l=n instanceof Function?n(s):n,c=o.tr.delete(i,a),u=c.doc.resolve(i),f=u.blockRange(),h=f&&Mk(f,t,l);if(!h)return null;c.wrap(f,h);let p=c.doc.resolve(i-1).nodeBefore;return p&&p.type==t&&mp(c.doc,i-1)&&(!r||r(s,p))&&c.join(i-1),c})}function Gee(e,t,n=null){return new Oo(e,(r,o,s,i)=>{let a=r.doc.resolve(s),l=n instanceof Function?n(o):n;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?r.tr.delete(s,i).setBlockType(s,s,t,l):null})}const Mn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Lu=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Ew=null;const Ys=function(e,t,n){let r=Ew||(Ew=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},qee=function(){Ew=null},Ql=function(e,t,n,r){return n&&(eP(e,t,n,r,-1)||eP(e,t,n,r,1))},Yee=/^(img|br|input|textarea|hr)$/i;function eP(e,t,n,r,o){for(var s;;){if(e==n&&t==r)return!0;if(t==(o<0?0:go(e))){let i=e.parentNode;if(!i||i.nodeType!=1||gp(e)||Yee.test(e.nodeName)||e.contentEditable=="false")return!1;t=Mn(e)+(o<0?0:1),e=i}else if(e.nodeType==1){let i=e.childNodes[t+(o<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((s=i.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)t+=o;else return!1;else e=i,t=o<0?go(e):0}else return!1}}function go(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Jee(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=go(e)}else if(e.parentNode&&!gp(e))t=Mn(e),e=e.parentNode;else return null}}function Xee(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&&!gp(e))t=Mn(e)+1,e=e.parentNode;else return null}}function Zee(e,t,n){for(let r=t==0,o=t==go(e);r||o;){if(e==n)return!0;let s=Mn(e);if(e=e.parentNode,!e)return!1;r=r&&s==0,o=o&&s==go(e)}}function gp(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 My=function(e){return e.focusNode&&Ql(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function hl(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Qee(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function ete(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(go(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(go(r.startContainer),r.startOffset)}}}const Ts=typeof navigator<"u"?navigator:null,tP=typeof document<"u"?document:null,tl=Ts&&Ts.userAgent||"",Cw=/Edge\/(\d+)/.exec(tl),QD=/MSIE \d/.exec(tl),Nw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tl),Er=!!(QD||Nw||Cw),_a=QD?document.documentMode:Nw?+Nw[1]:Cw?+Cw[1]:0,bo=!Er&&/gecko\/(\d+)/i.test(tl);bo&&+(/Firefox\/(\d+)/.exec(tl)||[0,0])[1];const _w=!Er&&/Chrome\/(\d+)/.exec(tl),xn=!!_w,eL=_w?+_w[1]:0,Xn=!Er&&!!Ts&&/Apple Computer/.test(Ts.vendor),Fu=Xn&&(/Mobile\/\w+/.test(tl)||!!Ts&&Ts.maxTouchPoints>2),fo=Fu||(Ts?/Mac/.test(Ts.platform):!1),tL=Ts?/Win/.test(Ts.platform):!1,si=/Android \d/.test(tl),vp=!!tP&&"webkitFontSmoothing"in tP.documentElement.style,tte=vp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function nte(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 Vs(e,t){return typeof e=="number"?e:e[t]}function rte(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 nP(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let i=n||e.dom;i;){if(i.nodeType!=1){i=Lu(i);continue}let a=i,l=a==s.body,c=l?nte(s):rte(a),u=0,f=0;if(t.top<c.top+Vs(r,"top")?f=-(c.top-t.top+Vs(o,"top")):t.bottom>c.bottom-Vs(r,"bottom")&&(f=t.bottom-t.top>c.bottom-c.top?t.top+Vs(o,"top")-c.top:t.bottom-c.bottom+Vs(o,"bottom")),t.left<c.left+Vs(r,"left")?u=-(c.left-t.left+Vs(o,"left")):t.right>c.right-Vs(r,"right")&&(u=t.right-c.right+Vs(o,"right")),u||f)if(l)s.defaultView.scrollBy(u,f);else{let p=a.scrollLeft,g=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let v=a.scrollLeft-p,y=a.scrollTop-g;t={left:t.left-v,top:t.top-y,right:t.right-v,bottom:t.bottom-y}}let h=l?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(h))break;i=h=="absolute"?i.offsetParent:Lu(i)}}function ote(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,o;for(let s=(t.left+t.right)/2,i=n+1;i<Math.min(innerHeight,t.bottom);i+=5){let a=e.root.elementFromPoint(s,i);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:nL(e.dom)}}function nL(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Lu(r));return t}function ste({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;rL(n,r==0?0:r-t)}function rL(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:s}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Cc=null;function ite(e){if(e.setActive)return e.setActive();if(Cc)return e.focus(Cc);let t=nL(e);e.focus(Cc==null?{get preventScroll(){return Cc={preventScroll:!0},!0}}:void 0),Cc||(Cc=!1,rL(t,0))}function oL(e,t){let n,r=2e8,o,s=0,i=t.top,a=t.top,l,c;for(let u=e.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Ys(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let g=h[p];if(g.top<=i&&g.bottom>=a){i=Math.max(g.bottom,i),a=Math.min(g.top,a);let v=g.left>t.left?g.left-t.left:g.right<t.left?t.left-g.right:0;if(v<r){n=u,r=v,o=v&&n.nodeType==3?{left:g.right<t.left?g.right:g.left,top:t.top}:t,u.nodeType==1&&v&&(s=f+(t.left>=(g.left+g.right)/2?1:0));continue}}else g.top>t.top&&!l&&g.left<=t.left&&g.right>=t.left&&(l=u,c={left:Math.max(g.left,Math.min(g.right,t.left)),top:g.top});!n&&(t.left>=g.right&&t.top>=g.top||t.left>=g.left&&t.top>=g.bottom)&&(s=f+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?ate(n,o):!n||r&&n.nodeType==1?{node:e,offset:s}:oL(n,o)}function ate(e,t){let n=e.nodeValue.length,r=document.createRange(),o;for(let s=0;s<n;s++){r.setEnd(e,s+1),r.setStart(e,s);let i=Hi(r,1);if(i.top!=i.bottom&&Lk(t,i)){o={node:e,offset:s+(t.left>=(i.left+i.right)/2?1:0)};break}}return r.detach(),o||{node:e,offset:0}}function Lk(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function lte(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function cte(e,t,n){let{node:r,offset:o}=oL(t,n),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return e.docView.posFromDOM(r,o,s)}function ute(e,t,n,r){let o=-1;for(let s=t,i=!1;s!=e.dom;){let a=e.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!i&&l.left>r.left||l.top>r.top?o=a.posBefore:(!i&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),i=!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;s=a.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}function sL(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)),s=o;;){let i=e.childNodes[s];if(i.nodeType==1){let a=i.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Lk(t,c))return sL(i,t,c)}}if((s=(s+1)%r)==o)break}return e}function dte(e,t){let n=e.dom.ownerDocument,r,o=0,s=ete(n,t.left,t.top);s&&({node:r,offset:o}=s);let i=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),a;if(!i||!e.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=e.dom.getBoundingClientRect();if(!Lk(t,c)||(i=sL(e.dom,t,c),!i))return null}if(Xn)for(let c=i;r&&c;c=Lu(c))c.draggable&&(r=void 0);if(i=lte(i,t),r){if(bo&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=t.left&&f.bottom>t.top&&o++}let c;vp&&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=ute(e,r,o,t))}a==null&&(a=cte(e,i,t));let l=e.docView.nearestDesc(i,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function rP(e){return e.top<e.bottom||e.left<e.right}function Hi(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(rP(r))return r}return Array.prototype.find.call(n,rP)||e.getBoundingClientRect()}const fte=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function iL(e,t,n){let{node:r,offset:o,atom:s}=e.docView.domFromPos(t,n<0?-1:1),i=vp||bo;if(r.nodeType==3)if(i&&(fte.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let l=Hi(Ys(r,o,o),n);if(bo&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Hi(Ys(r,o-1,o-1),-1);if(c.top==l.top){let u=Hi(Ys(r,o,o+1),-1);if(u.top!=l.top)return Ld(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++,Ld(Hi(Ys(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==go(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return x0(l.getBoundingClientRect(),!1)}if(s==null&&o<go(r)){let l=r.childNodes[o];if(l.nodeType==1)return x0(l.getBoundingClientRect(),!0)}return x0(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==go(r))){let l=r.childNodes[o-1],c=l.nodeType==3?Ys(l,go(l)-(i?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Ld(Hi(c,1),!1)}if(s==null&&o<go(r)){let l=r.childNodes[o];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Ys(l,0,i?0:1):l.nodeType==1?l:null:null;if(c)return Ld(Hi(c,-1),!0)}return Ld(Hi(r.nodeType==3?Ys(r):r,-n),n>=0)}function Ld(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 x0(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 aL(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 hte(e,t,n){let r=t.selection,o=n=="up"?r.$from:r.$to;return aL(e,t,()=>{let{node:s}=e.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let i=iL(e,o.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Ys(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"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const pte=/[\u0590-\u08ac]/;function mte(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,a=e.domSelection();return a?!pte.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:i:aL(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:f}=e.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:g,focusOffset:v}=e.domSelectionRange(),y=g&&!p.contains(g.nodeType==1?g:g.parentNode)||l==g&&c==v;try{a.collapse(u,f),l&&(l!=u||c!=f)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let oP=null,sP=null,iP=!1;function gte(e,t,n){return oP==t&&sP==n?iP:(oP=t,sP=n,iP=n=="up"||n=="down"?hte(e,t,n):mte(e,t,n))}const wo=0,aP=1,xl=2,Os=3;class yp{constructor(t,n,r,o){this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=wo,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 s,i;if(t==this.contentDOM)s=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(t==this.contentDOM)s=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;s=t.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(t==this.dom&&this.contentDOM)o=n>Mn(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 s=t;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==t.childNodes.length)for(let s=t;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.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 s=this.getDesc(o),i;if(s&&(!n||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(t.nodeType==1?t:t.parentNode):i==t))r=!1;else return s}}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 s=this.getDesc(o);if(s)return s.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==t&&s!=r){for(;!o.border&&o.children.length;)for(let i=0;i<o.children.length;i++){let a=o.children[i];if(a.size){o=a;break}}return o}if(t<s)return o.descAt(t-r-o.border);r=s}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],a=s+i.size;if(a>t||i instanceof cL){o=t-s;break}s=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof lL&&s.side>=0;r--);if(n<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&n&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Mn(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Mn(s.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,s=-1;for(let i=r,a=0;;a++){let l=this.children[a],c=i+l.size;if(o==-1&&t<=c){let u=i+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=i;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=Mn(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 f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=Mn(f.dom);break}n+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:n,fromOffset:o,toOffset:s}}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 s=Math.min(t,n),i=Math.max(t,n);for(let p=0,g=0;p<this.children.length;p++){let v=this.children[p],y=g+v.size;if(s>g&&i<y)return v.setSelection(t-g-v.border,n-g-v.border,r,o);g=y}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(),f=!1;if((bo||Xn)&&t==n){let{node:p,offset:g}=a;if(p.nodeType==3){if(f=!!(g&&p.nodeValue[g-1]==`
|
|
494
|
+
`),f&&g==p.nodeValue.length)for(let v=p,y;v;v=v.parentNode){if(y=v.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:Mn(y)+1});break}let x=v.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let v=p.childNodes[g-1];f=v&&(v.nodeName=="BR"||v.contentEditable=="false")}}if(bo&&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||f&&Xn)&&Ql(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Ql(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||t==n)&&!(f&&bo)){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(t>n){let g=a;a=l,l=g}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 s=this.children[o],i=r+s.size;if(r==i?t<=i&&n>=r:t<i&&n>r){let a=r+s.border,l=i-s.border;if(t>=a&&n<=l){this.dirty=t==r||n==i?xl:aP,t==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Os:s.markDirty(t-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?xl:Os}r=i}this.dirty=xl}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?xl:aP;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class lL extends yp{constructor(t,n,r,o){let s,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(i.nodeType!=1){let a=document.createElement("span");a.appendChild(i),i=a}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(t,[],i,null),this.widget=n,this.widget=n,s=this}matchesWidget(t){return this.dirty==wo&&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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class vte extends yp{constructor(t,n,r,o){super(t,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ec extends yp{constructor(t,n,r,o,s){super(t,[],r,o),this.mark=n,this.spec=s}static create(t,n,r,o){let s=o.nodeViews[n.type.name],i=s&&s(n,o,r);return(!i||!i.dom)&&(i=el.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ec(t,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&Os||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Os&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=wo){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=wo}}slice(t,n,r){let o=ec.create(this.parent,this.mark,!0,r),s=this.children,i=this.size;n<i&&(s=Tw(s,n,i,r)),t>0&&(s=Tw(s,0,t,r));for(let a=0;a<s.length;a++)s[a].parent=o;return o.children=s,o}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Pa extends yp{constructor(t,n,r,o,s,i,a,l,c){super(t,[],s,i),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(t,n,r,o,s,i){let a=s.nodeViews[n.type.name],l,c=a&&a(n,s,()=>{if(!l)return i;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,f=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:f}=el.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=fL(u,r,n),c?l=new yte(t,n,r,o,u,f||null,h,c,s,i+1):n.isText?new Ry(t,n,r,o,u,h,s):new Pa(t,n,r,o,u,f||null,h,s,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>q.empty)}return t}matchesNode(t,n,r){return this.dirty==wo&&t.eq(this.node)&&rv(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,s=t.composing?this.localCompositionInfo(t,n):null,i=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new bte(this,i&&i.node,t);kte(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!f&&l.syncToMarks(u==this.node.childCount?ct.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,o)},(c,u,f,h)=>{l.syncToMarks(c.marks,r,t);let p;l.findNodeMatch(c,u,f,h)||a&&t.state.selection.from>o&&t.state.selection.to<o+c.nodeSize&&(p=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,u,f,p,t)||l.updateNextNode(c,u,f,t,h,o)||l.addNode(c,u,f,t,o),o+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==xl)&&(i&&this.protectLocalComposition(t,i),uL(this.contentDOM,this.children,t),Fu&&Ete(this.dom))}localCompositionInfo(t,n){let{from:r,to:o}=t.state.selection;if(!(t.state.selection instanceof Ve)||r<n||o>n+this.node.content.size)return null;let s=t.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let i=s.nodeValue,a=Cte(this.node.content,i,r-n,o-n);return a<0?null:{node:s,pos:a,text:i}}else return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let i=new vte(this,s,n,o);t.input.compositionNodes.push(i),this.children=Tw(this.children,r,r+o.length,t,i)}update(t,n,r,o){return this.dirty==Os||!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=wo}updateOuterDeco(t){if(rv(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=dL(this.dom,this.nodeDOM,Pw(this.outerDeco,this.node,n),Pw(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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function lP(e,t,n,r,o){fL(r,t,e);let s=new Pa(void 0,e,t,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class Ry extends Pa{constructor(t,n,r,o,s,i,a){super(t,n,r,o,s,null,i,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==Os||this.dirty!=wo&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=wo||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=wo,!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),s=document.createTextNode(o.text);return new Ry(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Os)}get domAtom(){return!1}isText(t){return this.node.text==t}}class cL extends yp{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==wo&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class yte extends Pa{constructor(t,n,r,o,s,i,a,l,c,u){super(t,n,r,o,s,i,a,c,u),this.spec=l}update(t,n,r,o){if(this.dirty==Os)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let s=this.spec.update(t,n,r);return s&&this.updateInner(t,n,r,o),s}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 uL(e,t,n){let r=e.firstChild,o=!1;for(let s=0;s<t.length;s++){let i=t[s],a=i.dom;if(a.parentNode==e){for(;a!=r;)r=cP(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(i instanceof ec){let l=r?r.previousSibling:e.lastChild;uL(i.contentDOM,i.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=cP(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Df=function(e){e&&(this.nodeName=e)};Df.prototype=Object.create(null);const bl=[new Df];function Pw(e,t,n){if(e.length==0)return bl;let r=n?bl[0]:new Df,o=[r];for(let s=0;s<e.length;s++){let i=e[s].type.attrs;if(i){i.nodeName&&o.push(r=new Df(i.nodeName));for(let a in i){let l=i[a];l!=null&&(n&&o.length==1&&o.push(r=new Df(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 dL(e,t,n,r){if(n==bl&&r==bl)return t;let o=t;for(let s=0;s<r.length;s++){let i=r[s],a=n[s];if(s){let l;a&&a.nodeName==i.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==i.nodeName||(l=document.createElement(i.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=bl[0]),o=l}xte(o,a||bl[0],i)}return o}function xte(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 s=0;s<r.length;s++)o.indexOf(r[s])==-1&&e.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&e.classList.add(o[s]);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 fL(e,t,n){return dL(e,e,bl,Pw(t,n,e.nodeType!=1))}function rv(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 cP(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class bte{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=wte(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,s=this.stack.length>>1,i=Math.min(s,t.length);for(;o<i&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=wo,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<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[s])&&!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=ec.create(this.top,t[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(t,n,r,o){let s=-1,i;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(t,n,r))s=this.top.children.indexOf(i,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)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,n,r,o,s){let i=this.top.children[o];return i.dirty==Os&&i.dom==i.contentDOM&&(i.dirty=xl),i.update(t,n,r,s)?(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,s,i){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Pa){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let u=l.dom,f,h=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=Os&&rv(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&&(f=this.recreateWrapper(l,t,n,r,o,i)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=xl,f.updateChildren(o,i+1),f.dirty=wo),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,o,s,i){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!rv(r,t.outerDeco)||!o.eq(t.innerDeco))return null;let a=Pa.create(this.top,n,r,o,s,i);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,s){let i=Pa.create(this.top,t,n,r,o,s);i.contentDOM&&i.updateChildren(o,s+1),this.top.children.splice(this.index++,0,i),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 s=new lL(this.top,t,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof ec;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Ry)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Xn||xn)&&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 cL(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 wte(e,t){let n=t,r=n.children.length,o=e.childCount,s=new Map,i=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof ec)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,s.set(a,o),i.push(a)}}return{index:o,matched:s,matches:i.reverse()}}function Ste(e,t){return e.type.side-t.type.side}function kte(e,t,n,r){let o=t.locals(e),s=0;if(o.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,o,t.forChild(s,u),c),s+=u.nodeSize}return}let i=0,a=[],l=null;for(let c=0;;){let u,f;for(;i<o.length&&o[i].to==s;){let y=o[i++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(Ste);for(let y=0;y<f.length;y++)n(f[y],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 y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;i<o.length&&o[i].from<=s&&o[i].to>s;)a.push(o[i++]);let g=s+h.nodeSize;if(h.isText){let y=g;i<o.length&&o[i].from<y&&(y=o[i].from);for(let x=0;x<a.length;x++)a[x].to<y&&(y=a[x].to);y<g&&(l=h.cut(y-s),h=h.cut(0,y-s),g=y,p=-1)}else for(;i<o.length&&o[i].to<g;)i++;let v=h.isInline&&!h.isLeaf?a.filter(y=>!y.inline):a.slice();r(h,v,t.forChild(s,h),p),s=g}}function Ete(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 Cte(e,t,n,r){for(let o=0,s=0;o<e.childCount&&s<=r;){let i=e.child(o++),a=s;if(s+=i.nodeSize,!i.isText)continue;let l=i.text;for(;o<e.childCount;){let c=e.child(o++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=n){if(s>=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 Tw(e,t,n,r,o){let s=[];for(let i=0,a=0;i<e.length;i++){let l=e[i],c=a,u=a+=l.size;c>=n||u<=t?s.push(l):(c<t&&s.push(l.slice(0,t-c,r)),o&&(s.push(o),o=void 0),u>n&&s.push(l.slice(n-c,l.size,r)))}return s}function Fk(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),s=o&&o.size==0,i=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let a=r.resolve(i),l,c;if(My(n)){for(l=i;o&&!o.node;)o=o.parent;let f=o.node;if(o&&f.isAtom&&Ae.isSelectable(f)&&o.parent&&!(f.isInline&&Zee(n.focusNode,n.focusOffset,o.dom))){let h=o.posBefore;c=new Ae(i==h?a:r.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=i,h=i;for(let p=0;p<n.rangeCount;p++){let g=n.getRangeAt(p);f=Math.min(f,e.docView.posFromDOM(g.startContainer,g.startOffset,1)),h=Math.max(h,e.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(f<0)return null;[l,i]=h==e.state.selection.anchor?[h,f]:[f,h],a=r.resolve(i)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let f=t=="pointer"||e.state.selection.head<a.pos&&!s?1:-1;c=zk(e,u,a,f)}return c}function hL(e){return e.editable?e.hasFocus():mL(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ui(e,t=!1){let n=e.state.selection;if(pL(e,n),!!hL(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&xn){let r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Ql(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)_te(e);else{let{anchor:r,head:o}=n,s,i;uP&&!(n instanceof Ve)&&(n.$from.parent.inlineContent||(s=dP(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(i=dP(e,n.to))),e.docView.setSelection(r,o,e,t),uP&&(s&&fP(s),i&&fP(i)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Nte(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const uP=Xn||xn&&eL<63;function dP(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Xn&&o&&o.contentEditable=="false")return b0(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return b0(o);if(s)return b0(s)}}function b0(e){return e.contentEditable="true",Xn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function fP(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Nte(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(()=>{(!hL(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function _te(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,Mn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Er&&_a<=11&&(n.disabled=!0,n.disabled=!1)}function pL(e,t){if(t instanceof Ae){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(hP(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else hP(e)}function hP(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function zk(e,t,n,r){return e.someProp("createSelectionBetween",o=>o(e,t,n))||Ve.between(t,n,r)}function pP(e){return e.editable&&!e.hasFocus()?!1:mL(e)}function mL(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 Pte(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Ql(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ow(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return s&&tt.findFrom(s,t)}function Qi(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function mP(e,t,n){let r=e.state.selection;if(r instanceof Ve)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let i=e.state.doc.resolve(o.pos+s.nodeSize*(t<0?-1:1));return Qi(e,new Ve(r.$anchor,i))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let o=Ow(e.state,t);return o&&o instanceof Ae?Qi(e,o):!1}else if(!(fo&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,i;if(!s||s.isText)return!1;let a=t<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(i=e.docView.descAt(a))&&!i.contentDOM?Ae.isSelectable(s)?Qi(e,new Ae(t<0?e.state.doc.resolve(o.pos-s.nodeSize):o)):vp?Qi(e,new Ve(e.state.doc.resolve(t<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ae&&r.node.isInline)return Qi(e,new Ve(t>0?r.$to:r.$from));{let o=Ow(e.state,t);return o?Qi(e,o):!1}}}function ov(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Lf(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Nc(e,t){return t<0?Tte(e):Ote(e)}function Tte(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,s,i=!1;for(bo&&n.nodeType==1&&r<ov(n)&&Lf(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Lf(a,-1))o=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(gL(n))break;{let a=n.previousSibling;for(;a&&Lf(a,-1);)o=n.parentNode,s=Mn(a),a=a.previousSibling;if(a)n=a,r=ov(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}i?jw(e,n,r):o&&jw(e,o,s)}function Ote(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o=ov(n),s,i;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Lf(a,1))s=n,i=++r;else break}else{if(gL(n))break;{let a=n.nextSibling;for(;a&&Lf(a,1);)s=a.parentNode,i=Mn(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=ov(n);else{if(n=n.parentNode,n==e.dom)break;r=o=0}}}s&&jw(e,s,i)}function gL(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function jte(e,t){for(;e&&t==e.childNodes.length&&!gp(e);)t=Mn(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 Mte(e,t){for(;e&&!t&&!gp(e);)t=Mn(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 jw(e,t,n){if(t.nodeType!=3){let s,i;(i=jte(t,n))?(t=i,n=0):(s=Mte(t,n))&&(t=s,n=s.nodeValue.length)}let r=e.domSelection();if(!r)return;if(My(r)){let s=document.createRange();s.setEnd(t,n),s.setStart(t,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&ui(e)},50)}function gP(e,t){let n=e.state.doc.resolve(t);if(!(xn||tL)&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let s=e.coordsAtPos(t-1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(t<n.end()){let s=e.coordsAtPos(t+1),i=(s.top+s.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function vP(e,t,n){let r=e.state.selection;if(r instanceof Ve&&!r.empty||n.indexOf("s")>-1||fo&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let i=Ow(e.state,t);if(i&&i instanceof Ae)return Qi(e,i)}if(!o.parent.inlineContent){let i=t<0?o:s,a=r instanceof or?tt.near(i,t):tt.findFrom(i,t);return a?Qi(e,a):!1}return!1}function yP(e,t){if(!(e.state.selection instanceof Ve))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 s=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let i=e.state.tr;return t<0?i.delete(n.pos-s.nodeSize,n.pos):i.delete(n.pos,n.pos+s.nodeSize),e.dispatch(i),!0}return!1}function xP(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Rte(e){if(!Xn||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;xP(e,r,"true"),setTimeout(()=>xP(e,r,"false"),20)}return!1}function Ate(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function Ite(e,t){let n=t.keyCode,r=Ate(t);if(n==8||fo&&n==72&&r=="c")return yP(e,-1)||Nc(e,-1);if(n==46&&!t.shiftKey||fo&&n==68&&r=="c")return yP(e,1)||Nc(e,1);if(n==13||n==27)return!0;if(n==37||fo&&n==66&&r=="c"){let o=n==37?gP(e,e.state.selection.from)=="ltr"?-1:1:-1;return mP(e,o,r)||Nc(e,o)}else if(n==39||fo&&n==70&&r=="c"){let o=n==39?gP(e,e.state.selection.from)=="ltr"?1:-1:1;return mP(e,o,r)||Nc(e,o)}else{if(n==38||fo&&n==80&&r=="c")return vP(e,-1,r)||Nc(e,-1);if(n==40||fo&&n==78&&r=="c")return Rte(e)||vP(e,1,r)||Nc(e,1);if(r==(fo?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function $k(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:o,openEnd:s}=t;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let i=e.someProp("clipboardSerializer")||el.fromSchema(e.state.schema),a=SL(),l=a.createElement("div");l.appendChild(i.serializeFragment(r,{document:a}));let c=l.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=wL[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let g=a.createElement(u[p]);for(;l.firstChild;)g.appendChild(l.firstChild);l.appendChild(g),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
|
|
495
|
+
|
|
496
|
+
`);return{dom:l,text:h,slice:t}}function vL(e,t,n,r,o){let s=o.parent.type.spec.code,i,a;if(!n&&!t)return null;let l=!!t&&(r||s||!n);if(l){if(e.someProp("transformPastedText",h=>{t=h(t,s||r,e)}),s)return a=new le(q.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
497
|
+
`))),0,0),e.someProp("transformPasted",h=>{a=h(a,e,!0)}),a;let f=e.someProp("clipboardTextParser",h=>h(t,o,r,e));if(f)a=f;else{let h=o.marks(),{schema:p}=e.state,g=el.fromSchema(p);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(v=>{let y=i.appendChild(document.createElement("p"));v&&y.appendChild(g.serializeNode(p.text(v,h)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),i=zte(n),vp&&$te(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=i.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;i=h}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||Iu.fromSchema(e.state.schema)).parseSlice(i,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Dte.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Bte(bP(a,+u[1],+u[2]),u[4]);else if(a=le.maxOpen(Lte(a.content,o),!0),a.openStart||a.openEnd){let f=0,h=0;for(let p=a.content.firstChild;f<a.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=bP(a,f,h)}return e.someProp("transformPasted",f=>{a=f(a,e,l)}),a}const Dte=/^(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 Lte(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)),s,i=[];if(e.forEach(a=>{if(!i)return;let l=o.findWrapping(a.type),c;if(!l)return i=null;if(c=i.length&&s.length&&xL(l,s,a,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=bL(i[i.length-1],s.length));let u=yL(a,l);i.push(u),o=o.matchType(u.type),s=l}}),i)return q.from(i)}return e}function yL(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,q.from(e));return e}function xL(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let s=xL(e,t,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(q.from(yL(n,e,o+1))))}}function bL(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,bL(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(q.empty,!0);return e.copy(n.append(r))}function Mw(e,t,n,r,o,s){let i=t<0?e.firstChild:e.lastChild,a=i.content;return e.childCount>1&&(s=0),o<r-1&&(a=Mw(a,t,n,r,o+1,s)),o>=n&&(a=t<0?i.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(i.contentMatchAt(i.childCount).fillBefore(q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,i.copy(a))}function bP(e,t,n){return t<e.openStart&&(e=new le(Mw(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new le(Mw(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const wL={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 wP=null;function SL(){return wP||(wP=document.implementation.createHTMLDocument("title"))}let w0=null;function Fte(e){let t=window.trustedTypes;return t?(w0||(w0=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),w0.createHTML(e)):e}function zte(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=SL().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),o;if((o=r&&wL[r[1].toLowerCase()])&&(e=o.map(s=>"<"+s+">").join("")+e+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Fte(e),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function $te(e){let t=e.querySelectorAll(xn?"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 Bte(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:s,openEnd:i}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=q.from(l.create(r[a+1],o)),s++,i++}return new le(o,s,i)}const ar={},lr={},Vte={touchstart:!0,touchmove:!0};class Ute{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Wte(e){for(let t in ar){let n=ar[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{Kte(e,r)&&!Bk(e,r)&&(e.editable||!(r.type in lr))&&n(e,r)},Vte[t]?{passive:!0}:void 0)}Xn&&e.dom.addEventListener("input",()=>null),Rw(e)}function pa(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Hte(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 Rw(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>Bk(e,r))})}function Bk(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function Kte(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 Gte(e,t){!Bk(e,t)&&ar[t.type]&&(e.editable||!(t.type in lr))&&ar[t.type](e,t)}lr.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!EL(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(si&&xn&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Fu&&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,hl(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||Ite(e,n)?n.preventDefault():pa(e,"key")};lr.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};lr.keypress=(e,t)=>{let n=t;if(EL(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||fo&&n.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Ve)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),s=()=>e.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,o,s))&&e.dispatch(s()),n.preventDefault()}};function Ay(e){return{left:e.clientX,top:e.clientY}}function qte(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 s=e.state.doc.resolve(r);for(let i=s.depth+1;i>0;i--)if(e.someProp(t,a=>i>s.depth?a(e,n,s.nodeAfter,s.before(i),o,!0):a(e,n,s.node(i),s.before(i),o,!1)))return!0;return!1}function cu(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 Yte(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Ae.isSelectable(r)?(cu(e,new Ae(n)),!0):!1}function Jte(e,t){if(t==-1)return!1;let n=e.state.selection,r,o;n instanceof Ae&&(r=n.node);let s=e.state.doc.resolve(t);for(let i=s.depth+1;i>0;i--){let a=i>s.depth?s.nodeAfter:s.node(i);if(Ae.isSelectable(a)){r&&n.$from.depth>0&&i>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(i);break}}return o!=null?(cu(e,Ae.create(e.state.doc,o)),!0):!1}function Xte(e,t,n,r,o){return Vk(e,"handleClickOn",t,n,r)||e.someProp("handleClick",s=>s(e,t,r))||(o?Jte(e,n):Yte(e,n))}function Zte(e,t,n,r){return Vk(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",o=>o(e,t,r))}function Qte(e,t,n,r){return Vk(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",o=>o(e,t,r))||ene(e,n,r)}function ene(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(cu(e,Ve.create(r,0,r.content.size)),!0):!1;let o=r.resolve(t);for(let s=o.depth+1;s>0;s--){let i=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(i.inlineContent)cu(e,Ve.create(r,a+1,a+1+i.content.size));else if(Ae.isSelectable(i))cu(e,Ae.create(r,a));else continue;return!0}}function Uk(e){return sv(e)}const kL=fo?"metaKey":"ctrlKey";ar.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Uk(e),o=Date.now(),s="singleClick";o-e.input.lastClick.time<500&&qte(n,e.input.lastClick)&&!n[kL]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?s="doubleClick":e.input.lastClick.type=="doubleClick"&&(s="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s,button:n.button};let i=e.posAtCoords(Ay(n));i&&(s=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new tne(e,i,n,!!r)):(s=="doubleClick"?Zte:Qte)(e,i.pos,i.inside,n)?n.preventDefault():pa(e,"pointer"))};class tne{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[kL],this.allowDefault=r.shiftKey;let s,i;if(n.inside>-1)s=t.state.doc.nodeAt(n.inside),i=n.inside;else{let u=t.state.doc.resolve(n.pos);s=u.parent,i=u.depth?u.before():0}const a=o?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=t.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof Ae&&c.from<=i&&c.to>i)&&(this.mightDrag={node:s,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bo&&!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)),pa(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(()=>ui(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(Ay(t))),this.updateAllowDefault(t),this.allowDefault||!n?pa(this.view,"pointer"):Xte(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Xn&&this.mightDrag&&!this.mightDrag.node.isAtom||xn&&!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)?(cu(this.view,tt.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):pa(this.view,"pointer")}move(t){this.updateAllowDefault(t),pa(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)}}ar.touchstart=e=>{e.input.lastTouch=Date.now(),Uk(e),pa(e,"pointer")};ar.touchmove=e=>{e.input.lastTouch=Date.now(),pa(e,"pointer")};ar.contextmenu=e=>Uk(e);function EL(e,t){return e.composing?!0:Xn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const nne=si?5e3:-1;lr.compositionstart=lr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Ve&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||xn&&tL&&rne(e)))e.markCursor=e.state.storedMarks||n.marks(),sv(e,!0),e.markCursor=null;else if(sv(e,!t.selection.empty),bo&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let i=s<0?o.lastChild:o.childNodes[s-1];if(!i)break;if(i.nodeType==3){let a=e.domSelection();a&&a.collapse(i,i.nodeValue.length);break}else o=i,s=-1}}e.input.composing=!0}CL(e,nne)};function rne(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}lr.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++,CL(e,20))};function CL(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>sv(e),t))}function NL(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=sne());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function one(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Jee(t.focusNode,t.focusOffset),r=Xee(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=e.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function sne(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function sv(e,t=!1){if(!(si&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),NL(e),t||e.docView&&e.docView.dirty){let n=Fk(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function ine(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 Sh=Er&&_a<15||Fu&&tte<604;ar.copy=lr.cut=(e,t)=>{let n=t,r=e.state.selection,o=n.type=="cut";if(r.empty)return;let s=Sh?null:n.clipboardData,i=r.content(),{dom:a,text:l}=$k(e,i);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):ine(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ane(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function lne(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?kh(e,r.value,null,o,t):kh(e,r.textContent,r.innerHTML,o,t)},50)}function kh(e,t,n,r,o){let s=vL(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,o,s||le.empty)))return!0;if(!s)return!1;let i=ane(s),a=i?e.state.tr.replaceSelectionWith(i,r):e.state.tr.replaceSelection(s);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function _L(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," "):""}lr.paste=(e,t)=>{let n=t;if(e.composing&&!si)return;let r=Sh?null:n.clipboardData,o=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&kh(e,_L(r),r.getData("text/html"),o,n)?n.preventDefault():lne(e,n)};class PL{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const cne=fo?"altKey":"ctrlKey";function TL(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[cne]}ar.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=e.state.selection,s=o.empty?null:e.posAtCoords(Ay(n)),i;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof Ae?o.to-1:o.to))){if(r&&r.mightDrag)i=Ae.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=e.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(i=Ae.create(e.state.doc,f.posBefore))}}let a=(i||e.state.selection).content(),{dom:l,text:c,slice:u}=$k(e,a);(!n.dataTransfer.files.length||!xn||eL>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Sh?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Sh||n.dataTransfer.setData("text/plain",c),e.dragging=new PL(u,TL(e,n),i)};ar.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};lr.dragover=lr.dragenter=(e,t)=>t.preventDefault();lr.drop=(e,t)=>{try{une(e,t,e.dragging)}finally{e.dragging=null}};function une(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ay(t));if(!r)return;let o=e.state.doc.resolve(r.pos),s=n&&n.slice;s?e.someProp("transformPasted",p=>{s=p(s,e,!1)}):s=vL(e,_L(t.dataTransfer),Sh?null:t.dataTransfer.getData("text/html"),!1,o);let i=!!(n&&TL(e,t));if(e.someProp("handleDrop",p=>p(e,t,s||le.empty,i))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?VD(e.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let l=e.state.tr;if(i){let{node:p}=n;p?p.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=l.doc;if(u?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(f))return;let h=l.doc.resolve(c);if(u&&Ae.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new Ae(h));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((g,v,y,x)=>p=x),l.setSelection(zk(e,h,l.doc.resolve(p)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}ar.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())&&ui(e)},20))};ar.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)};ar.beforeinput=(e,t)=>{if(xn&&si&&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",s=>s(e,hl(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 lr)ar[e]=lr[e];function Eh(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 iv{constructor(t,n){this.toDOM=t,this.spec=n||Pl,this.side=this.spec.side||0}map(t,n,r,o){let{pos:s,deleted:i}=t.mapResult(n.from+o,this.side<0?-1:1);return i?null:new Rt(s-r,s-r,this)}valid(){return!0}eq(t){return this==t||t instanceof iv&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Eh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Ta{constructor(t,n){this.attrs=t,this.spec=n||Pl}map(t,n,r,o){let s=t.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,i=t.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=i?null:new Rt(s,i,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Ta&&Eh(this.attrs,t.attrs)&&Eh(this.spec,t.spec)}static is(t){return t.type instanceof Ta}destroy(){}}class Wk{constructor(t,n){this.attrs=t,this.spec=n||Pl}map(t,n,r,o){let s=t.mapResult(n.from+o,1);if(s.deleted)return null;let i=t.mapResult(n.to+o,-1);return i.deleted||i.pos<=s.pos?null:new Rt(s.pos-r,i.pos-r,this)}valid(t,n){let{index:r,offset:o}=t.content.findIndex(n.from),s;return o==n.from&&!(s=t.child(r)).isText&&o+s.nodeSize==n.to}eq(t){return this==t||t instanceof Wk&&Eh(this.attrs,t.attrs)&&Eh(this.spec,t.spec)}destroy(){}}class Rt{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Rt(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 Rt(t,t,new iv(n,r))}static inline(t,n,r,o){return new Rt(t,n,new Ta(r,o))}static node(t,n,r,o){return new Rt(t,n,new Wk(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ta}get widget(){return this.type instanceof iv}}const Ac=[],Pl={};class ft{constructor(t,n){this.local=t.length?t:Ac,this.children=n.length?n:Ac}static create(t,n){return n.length?av(n,t,0,Pl):Gn}find(t,n,r){let o=[];return this.findInner(t??0,n??1e9,o,0,r),o}findInner(t,n,r,o,s){for(let i=0;i<this.local.length;i++){let a=this.local[i];a.from<=n&&a.to>=t&&(!s||s(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>t){let a=this.children[i]+1;this.children[i+2].findInner(t-a,n-a,r,o+a,s)}}map(t,n,r){return this==Gn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||Pl)}mapInner(t,n,r,o,s){let i;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(i||(i=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?dne(this.children,i||[],t,n,r,o,s):i?new ft(i.sort(Tl),Ac):Gn}add(t,n){return n.length?this==Gn?ft.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let o,s=0;t.forEach((a,l)=>{let c=l+r,u;if(u=jL(n,a,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<l;)s+=3;o[s]==l?o[s+2]=o[s+2].addInner(a,u,c+1):o.splice(s,0,l,l+a.nodeSize,av(u,a,c+1,Pl)),s+=3}});let i=OL(s?ML(n):n,-r);for(let a=0;a<i.length;a++)i[a].type.valid(t,i[a])||i.splice(a--,1);return new ft(i.length?this.local.concat(i).sort(Tl):this.local,o||this.children)}remove(t){return t.length==0||this==Gn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let i,a=r[s]+n,l=r[s+1]+n;for(let u=0,f;u<t.length;u++)(f=t[u])&&f.from>a&&f.to<l&&(t[u]=null,(i||(i=[])).push(f));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(i,a+1);c!=Gn?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,i;s<t.length;s++)if(i=t[s])for(let a=0;a<o.length;a++)o[a].eq(i,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 ft(o,r):Gn}forChild(t,n){if(this==Gn)return this;if(n.isLeaf)return ft.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 s=t+1,i=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<i&&l.to>s&&l.type instanceof Ta){let c=Math.max(s,l.from)-s,u=Math.min(i,l.to)-s;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new ft(o.sort(Tl),Ac);return r?new oa([a,r]):a}return r||Gn}eq(t){if(this==t)return!0;if(!(t instanceof ft)||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 Hk(this.localsInner(t))}localsInner(t){if(this==Gn)return Ac;if(t.inlineContent||!this.local.some(Ta.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ta||n.push(this.local[r]);return n}forEachSet(t){t(this)}}ft.empty=new ft([],[]);ft.removeOverlap=Hk;const Gn=ft.empty;class oa{constructor(t){this.members=t}map(t,n){const r=this.members.map(o=>o.map(t,n,Pl));return oa.from(r)}forChild(t,n){if(n.isLeaf)return ft.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(t,n);s!=Gn&&(s instanceof oa?r=r.concat(s.members):r.push(s))}return oa.from(r)}eq(t){if(!(t instanceof oa)||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 s=this.members[o].localsInner(t);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let i=0;i<s.length;i++)n.push(s[i])}}return n?Hk(r?n:n.sort(Tl)):Ac}static from(t){switch(t.length){case 0:return Gn;case 1:return t[0];default:return new oa(t.every(n=>n instanceof ft)?t:t.reduce((n,r)=>n.concat(r instanceof ft?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function dne(e,t,n,r,o,s,i){let a=e.slice();for(let c=0,u=s;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,g,v)=>{let y=v-g-(p-h);for(let x=0;x<a.length;x+=3){let b=a[x+1];if(b<0||h>b+u-f)continue;let w=a[x]+u-f;p>=w?a[x+1]=h<=w?-2:-1:h>=u&&y&&(a[x]+=y,a[x+1]+=y)}f+=y}),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]+s),f=u-o;if(f<0||f>=r.content.size){l=!0;continue}let h=n.map(e[c+1]+s,-1),p=h-o,{index:g,offset:v}=r.content.findIndex(f),y=r.maybeChild(g);if(y&&v==f&&v+y.nodeSize==p){let x=a[c+2].mapInner(n,y,u+1,e[c]+s+1,i);x!=Gn?(a[c]=f,a[c+1]=p,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=fne(a,e,t,n,o,s,i),u=av(c,r,0,i);t=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ft(t.sort(Tl),a)}function OL(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 Rt(o.from+t,o.to+t,o.type))}return n}function fne(e,t,n,r,o,s,i){function a(l,c){for(let u=0;u<l.local.length;u++){let f=l.local[u].map(r,o,c);f?n.push(f):i.onRemove&&i.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]+s+1);return n}function jL(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let s=0,i;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[s]=null);return o}function ML(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function av(e,t,n,r){let o=[],s=!1;t.forEach((a,l)=>{let c=jL(e,a,l+n);if(c){s=!0;let u=av(c,a,n+l+1,r);u!=Gn&&o.push(l,l+a.nodeSize,u)}});let i=OL(s?ML(e):e,-n).sort(Tl);for(let a=0;a<i.length;a++)i[a].type.valid(t,i[a])||(r.onRemove&&r.onRemove(i[a].spec),i.splice(a--,1));return i.length||o.length?new ft(i,o):Gn}function Tl(e,t){return e.from-t.from||e.to-t.to}function Hk(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 s=t[o];if(s.from==r.from){s.to!=r.to&&(t==e&&(t=e.slice()),t[o]=s.copy(s.from,r.to),SP(t,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,s.from),SP(t,o,r.copy(s.from,r.to)));break}}}return t}function SP(e,t,n){for(;t<e.length&&Tl(n,e[t])>0;)t++;e.splice(t,0,n)}function S0(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Gn&&t.push(r)}),e.cursorWrapper&&t.push(ft.create(e.state.doc,[e.cursorWrapper.deco])),oa.from(t)}const hne={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pne=Er&&_a<=11;class mne{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 gne{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new mne,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]);Er&&_a<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),pne&&(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,hne)),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(pP(this.view)){if(this.suppressingSelectionUpdates)return ui(this.view);if(Er&&_a<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Ql(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 s=t.focusNode;s;s=Lu(s))n.add(s);for(let s=t.anchorNode;s;s=Lu(s))if(n.has(s)){r=s;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)&&pP(t)&&!this.ignoreSelectionChange(r),s=-1,i=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],l);f&&(s=s<0?f.from:Math.min(f.from,s),i=i<0?f.to:Math.max(f.to,i),f.typeOver&&(a=!0))}if(bo&&l.length){let u=l.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||xne(t,f)!=p)&&h.remove()}}}else if((xn||Xn)&&l.some(u=>u.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let u of l)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let c=null;s<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&My(r)&&(c=Fk(t))&&c.eq(tt.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,ui(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||o)&&(s>-1&&(t.docView.markDirty(s,i),vne(t)),this.handleDOMChange(s,i,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||ui(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 f=t.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let o=t.previousSibling,s=t.nextSibling;if(Er&&_a<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=t.addedNodes[u];(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(o=f),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(s=h)}let i=o&&o.parentNode==t.target?Mn(o)+1:0,a=r.localPosFromDOM(t.target,i,-1),l=s&&s.parentNode==t.target?Mn(s):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 kP=new WeakMap,EP=!1;function vne(e){if(!kP.has(e)&&(kP.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=bo,EP)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."),EP=!0}}function CP(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,s=t.endOffset,i=e.domAtPos(e.state.selection.anchor);return Ql(i.node,i.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function yne(e,t){if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return CP(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?CP(e,n):null}function xne(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 bne(e,t,n){let{node:r,fromOffset:o,toOffset:s,from:i,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}],My(l)||c.push({node:l.focusNode,offset:l.focusOffset})),xn&&e.input.lastKeyCode===8)for(let y=s;y>o;y--){let x=r.childNodes[y-1],b=x.pmViewDesc;if(x.nodeName=="BR"&&!b){s=y;break}if(!b||b.size)break}let f=e.state.doc,h=e.someProp("domParser")||Iu.fromSchema(e.state.schema),p=f.resolve(i),g=null,v=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:wne,context:p});if(c&&c[0].pos!=null){let y=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=y),g={anchor:y+i,head:x+i}}return{doc:v,sel:g,from:i,to:a}}function wne(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Xn&&/^(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||Xn&&/^(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 Sne=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function kne(e,t,n,r,o){let s=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let N=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,P=Fk(e,N);if(P&&!e.state.selection.eq(P)){if(xn&&si&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",A=>A(e,hl(13,"Enter"))))return;let j=e.state.tr.setSelection(P);N=="pointer"?j.setMeta("pointer",!0):N=="key"&&j.scrollIntoView(),s&&j.setMeta("composition",s),e.dispatch(j)}return}let i=e.state.doc.resolve(t),a=i.sharedDepth(n);t=i.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=bne(e,t,n),u=e.state.doc,f=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 g=Nne(f.content,c.doc.content,c.from,h,p);if(g&&e.input.domChangeCount++,(Fu&&e.input.lastIOSEnter>Date.now()-225||si)&&o.some(N=>N.nodeType==1&&!Sne.test(N.nodeName))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",N=>N(e,hl(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!g)if(r&&l instanceof Ve&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))g={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let N=NP(e,e.state.doc,c.sel);if(N&&!N.eq(e.state.selection)){let P=e.state.tr.setSelection(N);s&&P.setMeta("composition",s),e.dispatch(P)}}return}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof Ve&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Er&&_a<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>c.from&&c.doc.textBetween(g.start-c.from-1,g.start-c.from+1)==" "&&(g.start--,g.endA--,g.endB--);let v=c.doc.resolveNoCache(g.start-c.from),y=c.doc.resolveNoCache(g.endB-c.from),x=u.resolve(g.start),b=v.sameParent(y)&&v.parent.inlineContent&&x.end()>=g.endA;if((Fu&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!b&&v.pos<c.doc.content.size&&(!v.sameParent(y)||!v.parent.inlineContent)&&v.pos<y.pos&&!/\S/.test(c.doc.textBetween(v.pos,y.pos,"","")))&&e.someProp("handleKeyDown",N=>N(e,hl(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>g.start&&Cne(u,g.start,g.endA,v,y)&&e.someProp("handleKeyDown",N=>N(e,hl(8,"Backspace")))){si&&xn&&e.domObserver.suppressSelectionUpdates();return}xn&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),si&&!b&&v.start()!=y.start()&&y.parentOffset==0&&v.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==g.endA&&(g.endB-=2,y=c.doc.resolveNoCache(g.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(N){return N(e,hl(13,"Enter"))})},20));let w=g.start,E=g.endA,C=N=>{let P=N||e.state.tr.replace(w,E,c.doc.slice(g.start-c.from,g.endB-c.from));if(c.sel){let j=NP(e,P.doc,c.sel);j&&!(xn&&e.composing&&j.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(j.head==w||j.head==P.mapping.map(E)-1)||Er&&j.empty&&j.head==w)&&P.setSelection(j)}return s&&P.setMeta("composition",s),P.scrollIntoView()},_;if(b)if(v.pos==y.pos){Er&&_a<=11&&v.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>ui(e),20));let N=C(e.state.tr.delete(w,E)),P=u.resolve(g.start).marksAcross(u.resolve(g.endA));P&&N.ensureMarks(P),e.dispatch(N)}else if(g.endA==g.endB&&(_=Ene(v.parent.content.cut(v.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,g.endA-x.start())))){let N=C(e.state.tr);_.type=="add"?N.addMark(w,E,_.mark):N.removeMark(w,E,_.mark),e.dispatch(N)}else if(v.parent.child(v.index()).isText&&v.index()==y.index()-(y.textOffset?0:1)){let N=v.parent.textBetween(v.parentOffset,y.parentOffset),P=()=>C(e.state.tr.insertText(N,w,E));e.someProp("handleTextInput",j=>j(e,w,E,N,P))||e.dispatch(P())}else e.dispatch(C());else e.dispatch(C())}function NP(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:zk(e,t.resolve(n.anchor),t.resolve(n.head))}function Ene(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,o=n,s=r,i,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(o.length==1&&s.length==0)a=o[0],i="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&s.length==1)a=s[0],i="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(q.from(c).eq(e))return{mark:a,type:i}}function Cne(e,t,n,r,o){if(n-t<=o.pos-r.pos||k0(r,!0,!1)<o.pos)return!1;let s=e.resolve(t);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==t+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let i=e.resolve(k0(s,!0,!0));return!i.parent.isTextblock||i.pos>n||k0(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function k0(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 s=e.node(r).maybeChild(e.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function Nne(e,t,n,r,o){let s=e.findDiffStart(t,n);if(s==null)return null;let{a:i,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(o=="end"){let l=Math.max(0,s-Math.min(i,a));r-=i+l-s}if(i<s&&e.size<t.size){let l=r<=s&&r>=i?s-r:0;s-=l,s&&s<t.size&&_P(t.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-i),i=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<e.size&&_P(e.textBetween(s-1,s+1))&&(s+=l?1:-1),i=s+(i-a),a=s}return{start:s,endA:i,endB:a}}function _P(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 RL{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 Ute,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(MP),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=OP(this),TP(this),this.nodeViews=jP(this),this.docView=lP(this.state.doc,PP(this),S0(this),this.dom,this),this.domObserver=new gne(this,(r,o,s,i)=>kne(this,r,o,s,i)),this.domObserver.start(),Wte(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&&Rw(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(MP),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,s=!1,i=!1;t.storedMarks&&this.composing&&(NL(this),i=!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=jP(this);Pne(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Rw(this),this.editable=OP(this),TP(this);let l=S0(this),c=PP(this),u=o.plugins!=t.plugins&&!o.doc.eq(t.doc)?"reset":t.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(t.doc,c,l);(f||!t.selection.eq(o.selection))&&(i=!0);let h=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&ote(this);if(i){this.domObserver.stop();let p=f&&(Er||xn)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&_ne(o.selection,t.selection);if(f){let g=xn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=one(this)),(s||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=lP(t.doc,c,l,this.dom,this)),g&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Pte(this))?ui(this,p):(pL(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&&ste(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ae){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&nP(this,n.getBoundingClientRect(),t)}else nP(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 s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new PL(t.slice,t.move,o<0?void 0:Ae.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 i=0;i<this.directPlugins.length;i++){let a=this.directPlugins[i].props[t];if(a!=null&&(o=n?n(a):a))return o}let s=this.state.plugins;if(s)for(let i=0;i<s.length;i++){let a=s[i].props[t];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Er){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&&ite(this.dom),ui(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 dte(this,t)}coordsAtPos(t,n=1){return iL(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 gte(this,n||this.state,t)}pasteHTML(t,n){return kh(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return kh(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return $k(this,t)}destroy(){this.docView&&(Hte(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],S0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,qee())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return Gte(this,t)}domSelectionRange(){let t=this.domSelection();return t?Xn&&this.root.nodeType===11&&Qee(this.dom.ownerDocument)==this.dom&&yne(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}RL.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function PP(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"),[Rt.node(0,e.state.doc.content.size,t)]}function TP(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:Rt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function OP(e){return!e.someProp("editable",t=>t(e.state)===!1)}function _ne(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 jP(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 Pne(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 MP(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 Tne=e=>{if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")};const One=Ha(Tne);function jne(e){return!!(e.prev&&e.next&&e.prev.text.full!==e.next.text.full)}function Mne(e){return!!(e.prev&&e.next&&e.prev.range.cursor!==e.next.range.cursor)}function Rne(e){return!!(!e.prev&&e.next)}function Ane(e){return!!(e.prev&&!e.next)}function Ine(e){return!!(e.prev&&e.next&&e.prev.range.from!==e.next.range.from)}function Dne(e){return e==="invalid-exit-split"}var Lne=["jump-backward-exit","jump-forward-exit"],Fne=["jump-backward-change","jump-forward-change"];function zne(e){var t,n;return ns(Lne,(t=e.exit)==null?void 0:t.exitReason)||ns(Fne,(n=e.change)==null?void 0:n.changeReason)}function RP(e){return!!(e&&e.query.full.length>=e.suggester.matchOffset)}function AP(e){return Zn(e)&&e instanceof Ve}function xr(e){const{match:t,changeReason:n,exitReason:r}=e;return{...t,changeReason:n,exitReason:r}}function $ne(e,t){const{invalidPrefixCharacters:n,validPrefixCharacters:r}=t;return n?!new RegExp(Iw(n)).test(e):new RegExp(Iw(r)).test(e)}function Bne(e){const{text:t,regexp:n,$pos:r,suggester:o}=e,s=r.start();let i;return Oy(t,n).forEach(a=>{const l=a.input.slice(Math.max(0,a.index-1),a.index);if($ne(l,o)){const c=a.index+s,u=a[0],f=a[1];if(!Be(u)||!Be(f))return;const h=c+u.length,p=Math.min(h,r.pos),g=p-c;c<r.pos&&h>=r.pos&&(i={range:{from:c,to:h,cursor:p},match:a,query:{partial:u.slice(f.length,g),full:u.slice(f.length)},text:{partial:u.slice(0,g),full:u},textAfter:r.doc.textBetween(h,r.end(),fa,fa),textBefore:r.doc.textBetween(s,c,fa,fa),suggester:o})}}),i}function AL(e){const{$pos:t,suggester:n}=e,{char:r,name:o,startOfLine:s,supportedCharacters:i,matchOffset:a,multiline:l,caseInsensitive:c,unicode:u}=n,f=Jne({char:r,matchOffset:a,startOfLine:s,supportedCharacters:i,multiline:l,caseInsensitive:c,unicode:u}),h=t.doc.textBetween(t.before(),t.end(),fa,fa);return Bne({suggester:n,text:h,regexp:f,$pos:t})}function IL(e){const{state:t,match:n}=e;try{return AL({$pos:t.doc.resolve(n.range.cursor),suggester:n.suggester})}catch{return}}function DL(e){const{prev:t,next:n,state:r}=e;return!n&&t.range.from>=r.doc.nodeSize?{exit:xr({match:t,exitReason:"delete"})}:!n||!t.query.partial?{exit:xr({match:t,exitReason:"invalid-exit-split"})}:t.range.to===n.range.cursor?{exit:xr({match:n,exitReason:"exit-end"})}:t.query.partial?{exit:xr({match:n,exitReason:"exit-split"})}:{}}function Vne(e){const{prev:t,next:n,state:r}=e,o=Ne(),s=IL({state:r,match:t}),{exit:i}=s&&s.query.full!==t.query.full?DL({prev:t,next:s,state:r}):o;return t.range.from<n.range.from?{exit:i??xr({match:t,exitReason:"jump-forward-exit"}),change:xr({match:n,changeReason:"jump-forward-change"})}:{exit:i??xr({match:t,exitReason:"jump-backward-exit"}),change:xr({match:n,changeReason:"jump-backward-change"})}}function Une(e){const{match:t,state:n,$pos:r}=e,{selection:o}=n,s=IL({match:t,state:n});return!s||s.text.full!==t.text.full?DL({prev:t,next:s,state:n}):!o.empty&&(o.from<=t.range.from||o.to>=t.range.to)?{exit:xr({match:t,exitReason:"selection-outside"})}:r.pos>t.range.to?{exit:xr({match:t,exitReason:"move-end"})}:r.pos<=t.range.from?{exit:xr({match:t,exitReason:"move-start"})}:{}}function Wne(e){const{prev:t,next:n,state:r,$pos:o}=e,s=Ne();if(!t&&!n)return s;const i={prev:t,next:n};return Ine(i)?Vne({prev:i.prev,next:i.next,state:r}):Rne(i)?{change:xr({match:i.next,changeReason:"start"})}:Ane(i)?Une({$pos:o,match:i.prev,state:r}):jne(i)?{change:xr({match:i.next,changeReason:"change-character"})}:Mne(i)?{change:xr({match:i.next,changeReason:r.selection.empty?"move":"selection-inside"})}:s}function IP(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 Aw(e,t){const{$from:n,$to:r}=e;return LL(e,t)?!0:hD(n.pos,r.pos).some(o=>Hne(n.doc.resolve(o),t))}function LL(e,t){const{$from:n,$to:r}=e,o=new Set((n.marksAcross(r)??[]).map(s=>s.type.name));return t.some(s=>o.has(s))}function Hne(e,t){const n=new Set(e.marks().map(r=>r.type.name));return t.some(r=>n.has(r))}function Kne(e,t){const{$cursor:n}=t,{validMarks:r,validNodes:o,invalidMarks:s,invalidNodes:i}=e;return!r&&!o&&za(s)&&za(i)?!0:!(r&&!LL(t,r)||o&&!IP(n,o)||!r&&Aw(t,s)||!o&&IP(n,i))}function DP(e){const{suggesters:t,$pos:n,selectionEmpty:r}=e;for(const o of t)if(!(o.emptySelectionsOnly&&!r))try{const s=AL({suggester:o,$pos:n});if(!s)continue;const i={$from:n.doc.resolve(s.range.from),$to:n.doc.resolve(s.range.to),$cursor:n};if(Kne(o,i)&&o.isValidPosition(i,s))return s}catch{}}function Iw(e){return sQ(e)?e.source:e}function Gne(e){return e?"^":""}function qne(e,t){return`(?:${Iw(e)}){${t},}`}function Yne(e){return Be(e)?new RegExp(One(e)):e}function Jne(e){const{char:t,matchOffset:n,startOfLine:r,supportedCharacters:o,captureChar:s=!0,caseInsensitive:i=!1,multiline:a=!1,unicode:l=!1}=e,c=`g${a?"m":""}${i?"i":""}${l?"u":""}`;let u=Yne(t).source;return s&&(u=`(${u})`),new RegExp(`${Gne(r)}${u}${qne(o,n)}`,c)}var Xne={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},FL="__ignore_prosemirror_suggest_update__",zh,uu,on,Zs,wl,$o,Zt,Qs,Sl,du,Zne=(du=class{constructor(t){Un(this,zh,!1);Un(this,uu,!1);Un(this,on);Un(this,Zs);Un(this,wl);Un(this,$o,Ne());Kt(this,"view");Un(this,Zt,ft.empty);Un(this,Qs,!1);Un(this,Sl,!1);Kt(this,"setMarkRemoved",()=>{rt(this,Qs,!0)});Kt(this,"findNextTextSelection",t=>{const n=t.$from.doc,r=Math.min(n.nodeSize-2,t.to+1),o=n.resolve(r),s=tt.findFrom(o,1,!0);if(AP(s))return s});Kt(this,"ignoreNextExit",()=>{rt(this,uu,!0)});Kt(this,"addIgnored",({from:t,name:n,specific:r=!1})=>{const o=he(this,on).find(c=>c.name===n);if(!o)throw new Error(`No suggester exists for the name provided: ${n}`);const s=Be(o.char)?o.char.length:1,i=t+s,a=o.ignoredClassName?{class:o.ignoredClassName}:{},l=Rt.inline(t,i,{nodeName:o.ignoredTag,...a},{name:n,specific:r,char:o.char});rt(this,Zt,he(this,Zt).add(this.view.state.doc,[l]))});Kt(this,"removeIgnored",({from:t,name:n})=>{const r=he(this,on).find(i=>i.name===n);if(!r)throw new Error(`No suggester exists for the name provided: ${n}`);const o=Be(r.char)?r.char.length:1,s=he(this,Zt).find(t,t+o)[0];!s||s.spec.name!==n||rt(this,Zt,he(this,Zt).remove([s]))});Kt(this,"clearIgnored",t=>{if(!t){rt(this,Zt,ft.empty);return}const r=he(this,Zt).find().filter(({spec:o})=>o.name===t);rt(this,Zt,he(this,Zt).remove(r))});Kt(this,"findMatchAtPosition",(t,n)=>{const r=n?he(this,on).filter(o=>o.name===n):he(this,on);return DP({suggesters:r,$pos:t,selectionEmpty:!0})});Kt(this,"setLastChangeFromAppend",()=>{rt(this,Sl,!0)});const n=LP();rt(this,on,t.map(n)),rt(this,on,Yl(he(this,on),(r,o)=>o.priority-r.priority))}static create(t){return new du(t)}get decorationSet(){return he(this,Zt)}get removed(){return he(this,Qs)}get match(){return he(this,Zs)?he(this,Zs):he(this,wl)&&he(this,$o).exit?he(this,wl):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 he(this,uu)?(rt(this,uu,!1),!1):!0}updateWithNextSelection(t){var r,o,s;const n=this.findNextTextSelection(t.selection);if(n)for(const i of he(this,on)){const a=(r=he(this,$o).change)==null?void 0:r.suggester.name,l=(o=he(this,$o).exit)==null?void 0:o.suggester.name;(s=i.checkNextValidSelection)==null||s.call(i,n.$from,t,{change:a,exit:l})}}changeHandler(t,n){const{change:r,exit:o}=he(this,$o),s=this.match;if(!r&&!o||!RP(s))return;const i=n===(o==null?void 0:o.suggester.appendTransaction)&&this.shouldRunExit(),a=n===(r==null?void 0:r.suggester.appendTransaction);if(!(!i&&!a)){if(r&&o&&zne({change:r,exit:o})){const l=this.createProps(o),c=this.createProps(r),u=o.range.from<r.range.from;i&&o.suggester.onChange(l,t),a&&r.suggester.onChange(c,t),i&&rt(this,Qs,!1);return}r&&a&&r.suggester.onChange(this.createProps(r),t),o&&i&&(o.suggester.onChange(this.createProps(o),t),rt(this,Qs,!1),Dne(o.exitReason)&&rt(this,$o,Ne()))}}mapIgnoredDecorations(t){const n=he(this,Zt).map(t.mapping,t.doc),o=n.find().filter(({from:s,to:i,spec:a})=>{const l=Be(a.char)?a.char.length:1;return i-s!==l});rt(this,Zt,n.remove(o))}shouldIgnoreMatch({range:t,suggester:{name:n}}){return he(this,Zt).find().some(({spec:s,from:i})=>i!==t.from?!1:s.specific?s.name===n:!0)}resetState(){rt(this,$o,Ne()),rt(this,Zs,void 0),rt(this,Qs,!1),rt(this,Sl,!1)}updateReasons(t){const{$pos:n,state:r}=t;he(this,zh);const o=he(this,on),s=r.selection.empty,i=AP(r.selection)?DP({suggesters:o,$pos:n,selectionEmpty:s}):void 0;rt(this,Zs,i&&this.shouldIgnoreMatch(i)?void 0:i),rt(this,$o,Wne({next:he(this,Zs),prev:he(this,wl),state:r,$pos:n}))}addSuggester(t){const n=he(this,on).find(o=>o.name===t.name),r=LP();if(n)rt(this,on,he(this,on).map(o=>o===n?r(t):o));else{const o=[...he(this,on),r(t)];rt(this,on,Yl(o,(s,i)=>i.priority-s.priority))}return()=>this.removeSuggester(t.name)}removeSuggester(t){const n=Be(t)?t:t.name;rt(this,on,he(this,on).filter(r=>r.name!==n)),this.clearIgnored(n)}toJSON(){return this.match}apply(t){const{exit:n,change:r}=he(this,$o);if(he(this,Sl)&&(rt(this,Sl,!1),!(n!=null&&n.suggester.appendTransaction)&&!(r!=null&&r.suggester.appendTransaction)))return this;const{tr:o,state:s}=t,i=o.docChanged||o.selectionSet;return o.getMeta(FL)||!i&&!he(this,Qs)?this:(rt(this,zh,o.docChanged),this.mapIgnoredDecorations(o),n&&this.resetState(),rt(this,wl,he(this,Zs)),this.updateReasons({$pos:o.selection.$from,state:s}),this)}createDecorations(t){const n=this.match;if(!RP(n))return he(this,Zt);const{disableDecorations:r}=n.suggester;if(At(r)?r(t,n):r)return he(this,Zt);const{range:s,suggester:i}=n,{name:a,suggestTag:l,suggestClassName:c}=i,{from:u,to:f}=s;return this.shouldIgnoreMatch(n)?he(this,Zt):he(this,Zt).add(t.doc,[Rt.inline(u,f,{nodeName:l,class:a?`${c} suggest-${a}`:c},{name:a})])}},zh=new WeakMap,uu=new WeakMap,on=new WeakMap,Zs=new WeakMap,wl=new WeakMap,$o=new WeakMap,Zt=new WeakMap,Qs=new WeakMap,Sl=new WeakMap,du);function LP(){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={...Xne,...t};return e.add(t.name),n}}var zL=new dd("suggest");function Kk(e){return zL.getState(e)}function FP(e,t){return Kk(e).addSuggester(t)}function zP(e){e.setMeta(FL,!0)}function Qne(e,t){return Kk(e).removeSuggester(t)}function ere(...e){const t=Zne.create(e);return new Ni({key:zL,view:n=>(t.init(n),{update:r=>t.changeHandler(r.state.tr,!1)}),state:{init:()=>t,apply:(n,r,o,s)=>t.apply({tr:n,state:s})},appendTransaction:(n,r,o)=>{const s=o.tr;return t.updateWithNextSelection(s),t.changeHandler(s,!0),s.docChanged||s.steps.length>0||s.selectionSet||s.storedMarksSet?(t.setLastChangeFromAppend(),s):null},props:{decorations:n=>t.createDecorations(n)}})}function Gk(e,t){const n=Object.getPrototypeOf(t);let r=e.selection,o=e.doc,s=e.storedMarks;const i=Ne();for(const[a,l]of Object.entries(t))i[a]={value:l};return Object.create(n,{...i,storedMarks:{get(){return s}},selection:{get(){return r}},doc:{get(){return o}},tr:{get(){return r=e.selection,o=e.doc,s=e.storedMarks,e}}})}function Ff(e){return({state:t,dispatch:n,view:r,tr:o})=>e(Gk(o,t),n,r)}function $P(e){return t=>{var n;return Me(t.dispatch===void 0||t.dispatch===((n=t.view)==null?void 0:n.dispatch),{code:re.NON_CHAINABLE_COMMAND}),e(t)}}function tre(...e){return({state:t,dispatch:n,view:r,tr:o,...s})=>{for(const i of e)if(i({state:t,dispatch:n,view:r,tr:o,...s}))return!0;return!1}}var Ba={get isBrowser(){return!!(typeof window<"u"&&typeof window.document<"u"&&window.navigator&&window.navigator.userAgent)},get isIos(){return Ba.isBrowser&&/iPod|iPhone|iPad/.test(navigator.platform)},get isMac(){return Ba.isBrowser&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)},get isDevelopment(){return!1}};function $i(e,t){var n;const r=_re(e);return((n=r==null?void 0:r.getComputedStyle(e))==null?void 0:n.getPropertyValue(t))??""}function Kn(e,t){return Object.assign(e.style,t)}function Dw(e){return Zn(e)&&eo(e.nodeType)&&Be(e.nodeName)}function js(e){return Dw(e)&&e.nodeType===1}function qk(e){const{types:t,node:n}=e;if(!n)return!1;const r=o=>o===n.type||o===n.type.name;return un(t)?t.some(r):r(t)}function nre(e,t){const{tr:n}=t;return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Iy(e){const{predicate:t,selection:n}=e,r=BL(n)?n.selection.$from:Xk(n)?n.$from:n;for(let o=r.depth;o>0;o--){const s=r.node(o),i=o>0?r.before(o):0,a=r.start(o),l=i+s.nodeSize;if(t(s,i))return{pos:i,depth:o,node:s,start:a,end:l}}}function rre(e){const{depth:t}=e,n=t>0?e.before(t):0,r=e.node(t),o=e.start(t),s=n+r.nodeSize;return{pos:n,start:o,node:r,end:s,depth:t}}function Ch(e){const{types:t,selection:n}=e;return Iy({predicate:r=>qk({types:t,node:r}),selection:n})}function ore(e){const{types:t,selection:n}=e;if(!(!Ly(n)||!qk({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 Yk(e){return Xk(e)?e.empty:e.selection.empty}function sre(e){return e.docChanged||e.selectionSet}function ire(e){return!!Nh(e)}function Nh(e){const{state:t,type:n,attrs:r}=e,{selection:o,doc:s}=t,i=Be(n)?s.type.schema.nodes[n]:n;Me(i,{code:re.SCHEMA,message:`No node exists for ${n}`});const a=ore({selection:o,types:n})??Iy({predicate:l=>l.type===i,selection:o});return!r||qg(r)||!a||a.node.hasMarkup(i,{...a.node.attrs,...r})?a:void 0}function lv(...e){return t=>{if(!O_(e))return!1;const[n,...r]=e;let o=!1;const s=(...l)=>()=>{if(!O_(l))return!1;o=!0;const[,...c]=l;return lv(...l)({...t,next:s(...c)})},i=s(...r),a=n({...t,next:i});return o||a?a:i()}}function are(e,t){const n=new Map,r=Ne();for(const o of e)for(const[s,i]of cn(o)){const l=[...n.get(s)??[],i],c=lv(...l);n.set(s,l),r[s]=t(c)}return r}function lre(e){return are(e,t=>(n,r,o)=>t({state:n,dispatch:r,view:o,tr:n.tr,next:()=>!1}))}function Jk(e,t){const n=e.attrs??{};return Object.entries(t).every(([r,o])=>n[r]===o)}function cre(e){return UL(e,[oi,Yt,yn,Ko])}function fd(e){return Zn(e)}function hd(e,t){return un(t)?ns(t,e[Si]):t===e[Si]}function ure(e){return Zn(e)&&e instanceof bw}function dre(e,t){return Be(e)?zt(t.nodes,e):e}function $L(e){return Zn(e)&&e instanceof pp}function fre(e,t){return Be(e)?zt(t.marks,e):e}function Dy(e){return Zn(e)&&e instanceof Na}function hre(e){return Zn(e)&&e instanceof q}function pre(e){return Zn(e)&&e instanceof ct}function BL(e){return Zn(e)&&e instanceof yl}function fc(e){return Zn(e)&&e instanceof Ve}function mre(e){return Zn(e)&&e instanceof or}function Xk(e){return Zn(e)&&e instanceof tt}function gre(e){return Zn(e)&&e instanceof Au}function BP(e){const{trState:t,from:n,to:r,type:o,attrs:s={}}=e,{doc:i}=t,a=fre(o,i.type.schema);if(Object.keys(s).length===0)return i.rangeHasMark(n,r,a);let l=!1;return r>n&&i.nodesBetween(n,r,c=>l?!1:(l=(c.marks??[]).some(f=>f.type!==a?!1:Jk(f,s)),!l)),l}function Ly(e){return Zn(e)&&e instanceof Ae}function cv(e){const{trState:t,type:n,attrs:r={},from:o,to:s}=e,{selection:i,doc:a,storedMarks:l}=t,c=Be(n)?a.type.schema.marks[n]:n;if(Me(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}),o&&s)try{return Math.max(o,s)<a.nodeSize&&BP({...e,from:o,to:s})}catch{return!1}return i.empty?(l??i.$from.marks()).some(f=>f.type!==n?!1:Jk(f,r??{})):BP({...e,from:i.from,to:i.to})}function Zk(e,t={}){const n=vre(e.type.schema);if(!n)return!1;const{ignoreAttributes:r,ignoreDocAttributes:o}=t;return r?VL(n,e):o?n.content.eq(e.content):n.eq(e)}function VL(e,t){if(e===t)return!0;const n=e.type===t.type&&ct.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=[],s=[];e.content.forEach(i=>o.push(i)),t.content.forEach(i=>s.push(i));for(const[i,a]of o.entries()){const l=s[i];if(!l||!VL(a,l))return!1}return!0}return n&&r()}function vre(e){var t;return((t=e.nodes.doc)==null?void 0:t.createAndFill())??void 0}function Fy(e){for(const t of Object.values(e.nodes))if(t.name!=="doc"&&(t.isBlock||t.isTextblock))return t;Me(!1,{code:re.SCHEMA,message:"No default block node found for the provided schema."})}function yre(e){return e.type===Fy(e.type.schema)}function Qk(e){return!!e&&e.type.isBlock&&!e.textContent&&!e.childCount}function ki(e,t,n){const r=e.parent.childAfter(e.parentOffset);if(!r.node)return;const o=Be(t)?t:t.name,s=r.node.marks.find(({type:f})=>f.name===o);let i=e.index(),a=e.start()+r.offset,l=i+1,c=a+r.node.nodeSize;if(!s)return n&&c<n.pos?ki(e.doc.resolve(c+1),t,n):void 0;for(;i>0&&s.isInSet(e.parent.child(i-1).marks);)i-=1,a-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&s.isInSet(e.parent.child(l).marks);)c+=e.parent.child(l).nodeSize,l+=1;const u=e.doc.textBetween(a,c,nD,`
|
|
498
|
+
|
|
499
|
+
`);return{from:a,to:c,text:u,mark:s}}function UL(e,t){return t.length===0||t.some(n=>e instanceof n)}function xre(e){return fD(e,({from:n,to:r,prevFrom:o,prevTo:s})=>`${n}_${r}_${o}_${s}`).filter((n,r,o)=>!o.some((s,i)=>r===i?!1:n.prevFrom>=s.prevFrom&&n.prevTo<=s.prevTo&&n.from>=s.from&&n.to<=s.to))}function bre(e,t=[]){const n=[],{steps:r,mapping:o}=e,s=o.invert();r.forEach((a,l)=>{if(!UL(a,t))return;const c=[],u=a.getMap(),f=o.slice(l);if(u.ranges.length===0&&cre(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=f.map(h.from,-1),g=f.map(h.to);n.push({from:p,to:g,prevFrom:s.map(p,-1),prevTo:s.map(g)})})});const i=Yl(n,(a,l)=>a.from-l.from);return xre(i)}function wre(e){var t;return((t=e.content.firstChild)==null?void 0:t.textContent)??""}function Sre(e,t){if(!fc(e.selection))return;let{from:n,to:r}=e.selection;const o=(i,a)=>wre(Ve.between(e.doc.resolve(i),e.doc.resolve(a)).content());for(let i=o(n-1,n);i&&!t.test(i);n--,i=o(n-1,n));for(let i=o(r,r+1);i&&!t.test(i);r++,i=o(r,r+1));if(n===r)return;const s=e.doc.textBetween(n,r,nD,`
|
|
500
|
+
|
|
501
|
+
`);return{from:n,to:r,text:s}}function WL(e){return Sre(e,/\W/)}function zf(e,t=0){const n=un(e)?e[t]:e;return lD(Be(n),`No match string found for match ${e}`),n??""}function kre(e){return fc(e)?e.$cursor:void 0}function Ere(e,t){return Dy(e)?t?e.type===t.nodes.doc:e.type.name==="doc":!1}function Cre(e){return Zn(e)&&eo(e.anchor)&&eo(e.head)}function No(e,t){const n=t.nodeSize-2,r=0;let o;const s=l=>dQ({min:r,max:n,value:l});if(Xk(e))return e;if(e==="all")return new or(t);if(e==="start"?o=r:e==="end"?o=n:gre(e)?o=e.pos:o=e,eo(o))return o=s(o),Ve.near(t.resolve(o));if(Cre(o)){const l=s(o.anchor),c=s(o.head);return Ve.between(t.resolve(l),t.resolve(c))}const i=s(o.from),a=s(o.to);return Ve.between(t.resolve(i),t.resolve(a))}var Nre=3;function HL(e){const{content:t,schema:n,document:r,stringHandler:o,onError:s,attempts:i=0}=e,a=s&&i<=Nre||i===0;if(Me(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."}),Be(t))return Me(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(BL(t))return t.doc;if(Dy(t))return t;try{return n.nodeFromJSON(t)}catch(l){const c=Rre({schema:n,error:l,json:t}),u=s==null?void 0:s(c);return Me(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)}`}),HL({...e,content:u,attempts:i+1})}}function zy(){const e=YD();if(e)return e;throw new Error(`Unable to retrieve the document from the global scope.
|
|
502
|
+
It seems that you are running Remirror in a non-browser environment. Remirror need browser APIs to work.
|
|
503
|
+
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).
|
|
504
|
+
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).
|
|
505
|
+
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 KL(e){var t;return(e==null?void 0:e.defaultView)??(typeof window<"u"?window:void 0)??((t=YD())==null?void 0:t.defaultView)}function _re(e){return KL(e==null?void 0:e.ownerDocument)}function Pre(e){const t=KL(e)??zy().defaultView;if(t)return t;throw new Error("Unable to retrieve the window from the global scope")}function Tre(e,t=zy()){const n=Ere(e,e.type.schema)?e.content:q.from(e);return el.fromSchema(e.type.schema).serializeFragment(n,{document:t})}function Ore(e,t){return new(Pre(t)).DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body}function jre(e,t=zy()){const n=t.createElement("div");return n.append(Tre(e,t)),n.innerHTML}function Lw(e){const{content:t,schema:n,document:r,fragment:o=!1,...s}=e,i=Ore(t,r),a=Iu.fromSchema(n);return o?a.parseSlice(i,{...VP,...s}).content:a.parse(i,{...VP,...s})}var VP={preserveWhitespace:!1};function GL(e,t){const n=vh(t.defaults());return Pk({...e},n)}var Mre={remove(e,t){let n=e;for(const r of t)r.invalidParentNode||(n=pQ(r.path,n));return n}};function Rre({json:e,schema:t,...n}){const r=new Set(vh(t.marks)),o=new Set(vh(t.nodes)),s=qL({json:e,path:[],validNodes:o,validMarks:r});return{json:e,invalidContent:s,transformers:Mre,...n}}function qL(e){const{json:t,validMarks:n,validNodes:r,path:o=[]}=e,s={validMarks:n,validNodes:r},i=[],{type:a,marks:l,content:c}=t;let{invalidParentMark:u=!1,invalidParentNode:f=!1}=e;if(l){const h=[];for(const[p,g]of l.entries()){const v=Be(g)?g:g.type;n.has(v)||(h.unshift({name:v,path:[...o,"marks",`${p}`],type:"mark",invalidParentMark:u,invalidParentNode:f}),u=!0)}i.push(...h)}if(r.has(a)||(i.push({name:a,type:"node",path:o,invalidParentMark:u,invalidParentNode:f}),f=!0),c){const h=[];for(const[p,g]of c.entries())h.unshift(...qL({...s,json:g,path:[...o,"content",`${p}`],invalidParentMark:u,invalidParentNode:f}));i.unshift(...h)}return i}function Are(e){return!!(fc(e)&&e.$cursor&&e.$cursor.parentOffset>=e.$cursor.parent.content.size)}function Fw(e){return!!(fc(e)&&e.$cursor&&e.$cursor.parentOffset<=0)}function UP(e){const t=tt.atStart(e.$anchor.doc);return!!(Fw(e)&&t.anchor===e.anchor)}function Ire(e){return({dispatch:t,tr:n})=>{const{type:r,attrs:o=Ne(),appendText:s,range:i}=e,a=i?Ve.between(n.doc.resolve(i.from),n.doc.resolve(i.to)):n.selection,{$from:l,from:c,to:u}=a;let f=l.depth===0?n.doc.type.allowsMarkType(r):!1;return n.doc.nodesBetween(c,u,h=>{if(f)return!1;if(h.inlineContent&&h.type.allowsMarkType(r)){f=!0;return}}),f?(t==null||t(n.addMark(c,u,r.create(o))&&s?n.insertText(s):n),!0):!1}}function Dre({tr:e,dispatch:t}){const{$from:n,$to:r}=e.selection,o=n.blockRange(r),s=o&&ud(o);return!eo(s)||!o?!1:(t==null||t(e.lift(o,s).scrollIntoView()),!0)}function YL(e,t={},n){return function(r){const{tr:o,dispatch:s,state:i}=r,a=Be(e)?zt(i.schema.nodes,e):e,{from:l,to:c}=No(n??o.selection,o.doc),u=o.doc.resolve(l),f=o.doc.resolve(c),h=u.blockRange(f),p=h&&Mk(h,a,t);return!p||!h?!1:(s==null||s(o.wrap(h,p).scrollIntoView()),!0)}}function Lre(e,t={},n){return r=>{const{tr:o,state:s}=r,i=Be(e)?zt(s.schema.nodes,e):e;return Nh({state:o,type:i,attrs:t})?Dre(r):YL(e,t,n)(r)}}function uv(e,t,n,r=!0){return function(o){const{tr:s,dispatch:i,state:a}=o,l=Be(e)?zt(a.schema.nodes,e):e,{from:c,to:u}=No(n??s.selection,s.doc);let f=!1,h;return s.doc.nodesBetween(c,u,(p,g)=>{if(f)return!1;if(!p.isTextblock||p.hasMarkup(l,t))return;if(p.type===l){f=!0,h=p.attrs;return}const v=s.doc.resolve(g),y=v.index();f=v.parent.canReplaceWith(y,y+1,l),f&&(h=v.parent.attrs)}),f?(i==null||i(s.setBlockType(c,u,l,{...r?h:{},...t}).scrollIntoView()),!0):!1}}function JL(e){return t=>{const{tr:n,state:r}=t,{type:o,attrs:s,preserveAttrs:i=!0}=e,a=Nh({state:n,type:o,attrs:s}),l=e.toggleType??Fy(r.schema);if(a)return uv(l,{...i?a.node.attrs:{},...s})(t);const c=Nh({state:n,type:l,attrs:s});return uv(o,{...i?c==null?void 0:c.node.attrs:{},...s})(t)}}function Fre(e=0){const t=navigator.userAgent.match(/Chrom(e|ium)\/(\d+)\./);return t?Number.parseInt(zt(t,2),10)>=e:!1}function zre(e,t){let{head:n,empty:r,anchor:o}=e;for(const s of t.steps)n=s.getMap().map(n);r?t.setSelection(Ve.near(t.doc.resolve(n))):t.setSelection(Ve.between(t.doc.resolve(o),t.doc.resolve(n)))}function $re(e){const{attrs:t={},appendText:n="",content:r="",keepSelection:o=!1,range:s}=e;return({state:i,tr:a,dispatch:l})=>{var c;const u=i.schema,f=No(e.selection??s??a.selection,a.doc),h=f.$from.index(),{from:p,to:g,$from:v}=f,y=Be(e.type)?u.nodes[e.type]??u.marks[e.type]:e.type;if(Me(Be(e.type)?y:!0,{code:re.SCHEMA,message:`Schema contains no marks or nodes with name ${y}`}),ure(y)){if(!v.parent.canReplaceWith(h,h,y))return!1;a.replaceWith(p,g,y.create(t,r?u.text(r):void 0))}else Me(r,{message:"`replaceText` cannot be called without content when using a mark type"}),a.replaceWith(p,g,u.text(r,$L(y)?[y.create(t)]:void 0));return n&&a.insertText(n),o&&zre(i.selection,a),l&&(Fre(60)&&((c=document.getSelection())==null||c.empty()),l(a)),!0}}function XL(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 i=e.start()+n.offset+o;return XL(e.doc.resolve(i+1))}function ZL(e){return({dispatch:t,tr:n,state:r})=>{const{type:o,expand:s=!0,range:i}=e,a=No(e.selection??i??n.selection,n.doc);let{from:l,to:c,$from:u,$to:f}=a;const h=Be(o)?r.schema.marks[o]:o;h!==null&&Me(h,{code:re.SCHEMA,message:`Mark type: ${o} does not exist on the current schema.`});const p=h??XL(u);if(!p)return!1;const g=ki(u,p,f);return s&&g&&(l=Math.max(0,Math.min(l,g.from)),c=Math.min(Math.max(c,g.to),n.doc.nodeSize-2)),t==null||t(n.removeMark(l,eo(c)?c:l,$L(h)?h:void 0)),!0}}function dv(e){const{regexp:t,type:n,getAttributes:r,ignoreWhitespace:o=!1,beforeDispatch:s,updateCaptured:i,shouldSkip:a,invalidMarks:l}=e;let c;const u=new Oo(t,(f,h,p,g)=>{const{tr:v,schema:y}=f;c||(c=Be(n)?y.marks[n]:n,Me(c,{code:re.SCHEMA,message:`Mark type: ${n} does not exist on the current schema.`}));let x=h[1],b=h[0];const w=Bre({captureGroup:x,fullMatch:b,end:g,start:p,rule:u,state:f,ignoreWhitespace:o,invalidMarks:l,shouldSkip:a,updateCaptured:i});if(!w)return null;({start:p,end:g,captureGroup:x,fullMatch:b}=w);const E=At(r)?r(h):r;let C=g,_=[];if(x){const N=b.search(/\S/),P=p+b.indexOf(x),j=P+x.length;_=v.storedMarks??[],j<g&&v.delete(j,g),P>p&&v.delete(p+N,P),C=p+N+x.length}return v.addMark(p,C,c.create(E)),v.setStoredMarks(_),s==null||s({tr:v,match:h,start:p,end:g}),v});return u}function Bre({captureGroup:e,fullMatch:t,end:n,start:r,rule:o,ignoreWhitespace:s,shouldSkip:i,updateCaptured:a,state:l,invalidMarks:c}){var u;if(t==null)return null;const f=(a==null?void 0:a({captureGroup:e,fullMatch:t,start:r,end:n}))??{};e=f.captureGroup??e,t=f.fullMatch??t,r=f.start??r,n=f.end??n;const h=l.doc.resolve(r),p=l.doc.resolve(n);return c&&Aw({$from:h,$to:p},c)||o.invalidMarks&&Aw({$from:h,$to:p},o.invalidMarks)||s&&(e==null?void 0:e.trim())===""||i!=null&&i({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 Vre=function(){const t=Array.prototype.slice.call(arguments).filter(Boolean),n={},r=[];t.forEach(s=>{(s?s.split(" "):[]).forEach(a=>{if(a.startsWith("atm_")){const[,l]=a.split("_");n[l]=a}else r.push(a)})});const o=[];for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(n[s]);return o.push(...r),o.join(" ")},Ure=Vre;const QL=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Wre(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const e4=(e,t,n)=>{let r=Wre(e,n);if(!r)return!1;let o=t4(r);if(!o){let i=r.blockRange(),a=i&&ud(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(o4(e,o,t,-1))return!0;if(r.parent.content.size==0&&(zu(s,"end")||Ae.isSelectable(s)))for(let i=r.depth;;i--){let a=Rk(e.doc,r.before(i),r.after(i),le.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(zu(s,"end")?tt.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Ae.create(l.doc,o.pos-s.nodeSize)),t(l.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1};function zu(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 Hre=(e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=t4(r)}let i=s&&s.nodeBefore;return!i||!Ae.isSelectable(i)?!1:(t&&t(e.tr.setSelection(Ae.create(e.doc,s.pos-i.nodeSize)).scrollIntoView()),!0)};function t4(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 Kre(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Gre=(e,t,n)=>{let r=Kre(e,n);if(!r)return!1;let o=n4(r);if(!o)return!1;let s=o.nodeAfter;if(o4(e,o,t,1))return!0;if(r.parent.content.size==0&&(zu(s,"start")||Ae.isSelectable(s))){let i=Rk(e.doc,r.before(),r.after(),le.empty);if(i&&i.slice.size<i.to-i.from){if(t){let a=e.tr.step(i);a.setSelection(zu(s,"start")?tt.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Ae.create(a.doc,a.mapping.map(o.pos))),t(a.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(t&&t(e.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},qre=(e,t,n)=>{let{$head:r,empty:o}=e.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;s=n4(r)}let i=s&&s.nodeAfter;return!i||!Ae.isSelectable(i)?!1:(t&&t(e.tr.setSelection(Ae.create(e.doc,s.pos)).scrollIntoView()),!0)};function n4(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 Yre=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
506
|
+
`).scrollIntoView()),!0)};function eE(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 r4=(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),s=n.indexAfter(-1),i=eE(o.contentMatchAt(s));if(!i||!o.canReplaceWith(s,s,i))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,i.createAndFill());l.setSelection(tt.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Jre=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof or||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=eE(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let i=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=e.tr.insert(i,s.createAndFill());a.setSelection(Ve.create(a.doc,i+1)),t(a.scrollIntoView())}return!0},Xre=(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 s=n.before();if(au(e.doc,s))return t&&t(e.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&ud(r);return o==null?!1:(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};function Zre(e){return(t,n)=>{let{$from:r,$to:o}=t.selection;if(t.selection instanceof Ae&&t.selection.node.isBlock)return!r.parentOffset||!au(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],i,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=eE(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(l&&a?{type:a}:null),i=p;break}else{if(p==1)return!1;s.unshift(null)}let u=t.tr;(t.selection instanceof Ve||t.selection instanceof or)&&u.deleteSelection();let f=u.mapping.map(r.pos),h=au(u.doc,f,s.length,s);if(h||(s[0]=a?{type:a}:null,h=au(u.doc,f,s.length,s)),!h)return!1;if(u.split(f,s.length,s),!l&&c&&r.node(i).type!=a){let p=u.mapping.map(r.before(i)),g=u.doc.resolve(p);a&&r.node(i-1).canReplaceWith(g.index(),g.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(i)),a)}return n&&n(u.scrollIntoView()),!0}}const Qre=Zre(),eoe=(e,t)=>{let{$from:n,to:r}=e.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),t&&t(e.tr.setSelection(Ae.create(e.doc,o))),!0)},toe=(e,t)=>(t&&t(e.tr.setSelection(new or(e.doc))),!0);function noe(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,s=t.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(s,s+1)||!(o.isTextblock||mp(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function o4(e,t,n,r){let o=t.nodeBefore,s=t.nodeAfter,i,a,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&noe(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(i=(a=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&a.matchType(i[0]||s.type).validEnd){if(n){let p=t.pos+s.nodeSize,g=q.empty;for(let x=i.length-1;x>=0;x--)g=q.from(i[x].create(null,g));g=q.from(o.copy(g));let v=e.tr.step(new Yt(t.pos-1,p,t.pos,p,new le(g,1,0),i.length,!0)),y=v.doc.resolve(p+2*i.length);y.nodeAfter&&y.nodeAfter.type==o.type&&mp(v.doc,y.pos)&&v.join(y.pos),n(v.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&l?null:tt.findFrom(t,1),f=u&&u.$from.blockRange(u.$to),h=f&&ud(f);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(f,h).scrollIntoView()),!0;if(c&&zu(s,"start",!0)&&zu(o,"end")){let p=o,g=[];for(;g.push(p),!p.isTextblock;)p=p.lastChild;let v=s,y=1;for(;!v.isTextblock;v=v.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,v.content)){if(n){let x=q.empty;for(let w=g.length-1;w>=0;w--)x=q.from(g[w].copy(x));let b=e.tr.step(new Yt(t.pos-g.length,t.pos+s.nodeSize,t.pos+y,t.pos+s.nodeSize-y,new le(x,g.length,0),0,!0));n(b.scrollIntoView())}return!0}}return!1}function s4(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(t.tr.setSelection(Ve.create(t.doc,e<0?o.start(s):o.end(s)))),!0):!1}}const roe=s4(-1),ooe=s4(1);function soe(e,t,n,r){for(let o=0;o<t.length;o++){let{$from:s,$to:i}=t[o],a=s.depth==0?e.inlineContent&&e.type.allowsMarkType(n):!1;if(e.nodesBetween(s.pos,i.pos,(l,c)=>{if(a)return!1;a=l.inlineContent&&l.type.allowsMarkType(n)}),a)return!0}return!1}function ioe(e,t=null,n){return function(r,o){let{empty:s,$cursor:i,ranges:a}=r.selection;if(s&&!i||!soe(r.doc,a,e))return!1;if(o)if(i)e.isInSet(r.storedMarks||i.marks())?o(r.tr.removeStoredMark(e)):o(r.tr.addStoredMark(e.create(t)));else{let l,c=r.tr;l=!a.some(u=>r.doc.rangeHasMark(u.$from.pos,u.$to.pos,e));for(let u=0;u<a.length;u++){let{$from:f,$to:h}=a[u];if(!l)c.removeMark(f.pos,h.pos,e);else{let p=f.pos,g=h.pos,v=f.nodeAfter,y=h.nodeBefore,x=v&&v.isText?/^\s*/.exec(v.text)[0].length:0,b=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;p+x<g&&(p+=x,g-=b),c.addMark(p,g,e.create(t))}}o(c.scrollIntoView())}return!0}}function $y(...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 E0=$y(QL,e4,Hre),WP=$y(QL,Gre,qre);const Xs={Enter:$y(Yre,Jre,Xre,Qre),"Mod-Enter":r4,Backspace:E0,"Mod-Backspace":E0,"Shift-Backspace":E0,Delete:WP,"Mod-Delete":WP,"Mod-a":toe},i4={"Ctrl-h":Xs.Backspace,"Alt-Backspace":Xs["Mod-Backspace"],"Ctrl-d":Xs.Delete,"Ctrl-Alt-Backspace":Xs["Mod-Delete"],"Alt-Delete":Xs["Mod-Delete"],"Alt-d":Xs["Mod-Delete"],"Ctrl-a":roe,"Ctrl-e":ooe};for(let e in Xs)i4[e]=Xs[e];const aoe=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,C0=aoe?i4:Xs;var Va={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:"'"},fv={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},loe=typeof navigator<"u"&&/Mac/.test(navigator.platform),coe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rn=0;Rn<10;Rn++)Va[48+Rn]=Va[96+Rn]=String(Rn);for(var Rn=1;Rn<=24;Rn++)Va[Rn+111]="F"+Rn;for(var Rn=65;Rn<=90;Rn++)Va[Rn]=String.fromCharCode(Rn+32),fv[Rn]=String.fromCharCode(Rn);for(var N0 in Va)fv.hasOwnProperty(N0)||(fv[N0]=Va[N0]);function uoe(e){var t=loe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||coe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?fv:Va)[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 doe=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),foe=typeof navigator<"u"&&/Win/.test(navigator.platform);function hoe(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,o,s,i;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))i=!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))s=!0;else if(/^mod$/i.test(l))doe?i=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),i&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function poe(e){let t=Object.create(null);for(let n in e)t[hoe(n)]=e[n];return t}function _0(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function a4(e){let t=poe(e);return function(n,r){let o=uoe(r),s,i=t[_0(o,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=t[_0(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(foe&&r.ctrlKey&&r.altKey)&&(s=Va[r.keyCode])&&s!=o){let a=t[_0(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function moe(e){const t=Yl(e,(s,i)=>(i.priority??wt.Low)-(s.priority??wt.Low)),n=[],r=[];for(const s of t)Soe(s)?n.push(s):r.push(s);let o;return new Ni({key:goe,view:s=>(o=s,{}),props:{transformPasted:s=>{var c,u,f;const i=o.state.selection.$from,a=i.node().type.name,l=new Set(i.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(b=>l.has(b)))continue;const p=((f=s.content.firstChild)==null?void 0:f.textContent)??"",g=!o.state.selection.empty&&s.content.childCount===1&&p,v=Oy(p,h.regexp)[0];if(g&&v&&h.type==="mark"&&h.replaceSelection){const{from:b,to:w}=o.state.selection,E=o.state.doc.slice(b,w),C=E.content.textBetween(0,E.content.size);if(typeof h.replaceSelection!="boolean"?h.replaceSelection(C):h.replaceSelection){const _=[],{getAttributes:N,markType:P}=h,j=At(N)?N(v,!0):N,A=P.create(j);return E.content.forEach(U=>{if(U.isText){const L=A.addToSet(U.marks);_.push(U.mark(L))}}),le.maxOpen(q.fromArray(_))}}const{nodes:y,transformed:x}=boe(s.content,h,o.state.schema);x&&(s=h.type==="node"&&h.nodeType.isBlock?new le(q.fromArray(y),0,0):new le(q.fromArray(y),s.openStart,s.openEnd))}return Noe(s)},handleDOMEvents:{paste:(s,i)=>{var f,h;const a=i;if(!((h=(f=s.props).editable)!=null&&h.call(f,s.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}=s.state;for(const{fileHandler:p,regexp:g}of r){const v=g?c.filter(y=>g.test(y.type)):c;if(v.length!==0&&p({event:a,files:v,selection:u,view:s,type:"paste"}))return a.preventDefault(),!0}return!1},drop:(s,i)=>{var p,g,v;const a=i;if(!((g=(p=s.props).editable)!=null&&g.call(p,s.state)))return!1;const{dataTransfer:l,clientX:c,clientY:u}=a;if(!l)return!1;const f=Coe(a);if(f.length===0)return!1;const h=((v=s.posAtCoords({left:c,top:u}))==null?void 0:v.pos)??s.state.selection.anchor;for(const{fileHandler:y,regexp:x}of r){const b=x?f.filter(w=>x.test(w.type)):f;if(b.length!==0&&y({event:a,files:b,pos:h,view:s,type:"drop"}))return a.preventDefault(),!0}return!1}}}})}var goe=new dd("pasteRule");function P0(e,t){return function n(r){const{fragment:o,rule:s,nodes:i}=r,{regexp:a,ignoreWhitespace:l,ignoredMarks:c,ignoredNodes:u}=s;let f=!1;return o.forEach(h=>{if(u!=null&&u.includes(h.type.name)||koe(h)){i.push(h);return}if(!h.isText){const v=n({fragment:h.content,rule:s,nodes:[]});f||(f=v.transformed);const y=q.fromArray(v.nodes);h.type.validContent(y)?i.push(h.copy(y)):i.push(...v.nodes);return}if(h.marks.some(v=>Eoe(v)||(c==null?void 0:c.includes(v.type.name)))){i.push(h);return}const p=h.text??"";let g=0;for(const v of Oy(p,a)){const y=v[1],x=v[0];if(l&&(y==null?void 0:y.trim())===""||!x)return;const b=v.index,w=b+x.length;b>g&&i.push(h.cut(g,b));let E=h.cut(b,w);if(x&&y){const C=x.search(/\S/),_=b+x.indexOf(y),N=_+y.length;C&&i.push(h.cut(b,b+C)),E=h.cut(_,N)}e({nodes:i,rule:s,textNode:E,match:v,schema:t}),f=!0,g=w}p&&g<p.length&&i.push(h.cut(g))}),{nodes:i,transformed:f}}}function voe(e){const{nodes:t,rule:n,textNode:r,match:o,schema:s}=e,{transformMatch:i,getAttributes:a,markType:l}=n,c=At(a)?a(o,!1):a,u=r.text??"",f=l.create(c),h=i==null?void 0:i(o);if(h==="")return;if(h===!1){t.push(s.text(u,r.marks));return}const p=f.addToSet(r.marks);t.push(s.text(h??u,p))}function yoe(e){const{nodes:t,rule:n,textNode:r,match:o,schema:s}=e,{transformMatch:i}=n,a=i==null?void 0:i(o);if(a===""||a===!1)return;const l=a??r.text??"";t.push(s.text(l,r.marks))}function xoe(e){const{nodes:t,rule:n,textNode:r,match:o}=e,{getAttributes:s,nodeType:i,getContent:a}=n,l=At(s)?s(o,!1):s,c=(a?a(o):r)||void 0;t.push(i.createChecked(l,c))}function boe(e,t,n){const r=[];switch(t.type){case"mark":return P0(voe,n)({fragment:e,nodes:r,rule:t});case"node":return P0(xoe,n)({fragment:e,nodes:r,rule:t});default:return P0(yoe,n)({fragment:e,nodes:r,rule:t})}}var woe=["mark","node","text"];function Soe(e){return ns(woe,e.type)}function koe(e){var t;return e.type.spec.code||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function Eoe(e){var t;return e.type.name==="code"||((t=e.type.spec.group)==null?void 0:t.split(" ").includes("code"))}function Coe(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 Noe(e){const t=le.maxOpen(e.content);return t.openStart<e.openStart||t.openEnd<e.openEnd?t:e}var _oe=Object.defineProperty,Poe=Object.getOwnPropertyDescriptor,be=(e,t,n,r)=>{for(var o=r>1?void 0:r?Poe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&_oe(t,n,o),o},l4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ue=(e,t,n)=>(l4(e,t,"read from private field"),n?n.call(e):t.get(e)),Qt=(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)},pn=(e,t,n,r)=>(l4(e,t,"write to private field"),t.set(e,n),n);function Toe(e,t){return e===t}function HP(e){const{previousOptions:t,update:n,equals:r=Toe}=e,o=vl({...t,...n}),s=Ne(),i=vh(t);for(const l of i){const c=t[l],u=o[l];if(r(c,u)){s[l]={changed:!1};continue}s[l]={changed:!0,previousValue:c,value:u}}const a=l=>{const c=Ne();for(const u of l){const f=s[u];f!=null&&f.changed&&(c[u]=f.value)}return c};return{changes:vl(s),options:o,pickChanged:a}}var Ooe={[re.DUPLICATE_HELPER_NAMES]:"helper method",[re.DUPLICATE_COMMAND_NAMES]:"command method"};function c4(e){const{name:t,set:n,code:r}=e,o=Ooe[r];Me(!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 zw(...e){return yh(Ure(...e).split(" ")).join(" ")}var KP="__IGNORE__",joe="__ALL__",pd=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=Ne(),this.populateMappedHandlers(),this._options=this._initialOptions=uQ(e,this.constructor.defaultOptions,t??Ne(),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 vh(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:s}=HP({previousOptions:n,update:e});this.updateDynamicOptions(o),(t=this.onSetOptions)==null||t.call(this,{reason:"set",changes:r,options:o,pickChanged:s,initialOptions:this._initialOptions})}resetOptions(){var e;const t=this.getDynamicOptions(),{changes:n,options:r,pickChanged:o}=HP({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 Pk(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=Ne();for(const t of this.constructor.handlerKeys)e[t]=(...n)=>{var r;const{handlerKeyOptions:o}=this.constructor,s=(r=o[t])==null?void 0:r.reducer;let i=s==null?void 0:s.getDefault(...n);for(const[,a]of this._mappedHandlers[t]){const l=a(...n);if(i=s?s.accumulator(i,l,...n):l,Moe(o,i,t))return i}return i};return e}addHandler(e,t,n=wt.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]=Yl(this._mappedHandlers[e],([t],[n])=>n-t)}addCustomHandler(e,t){var n;return((n=this.onAddCustomHandler)==null?void 0:n.call(this,{[e]:t}))??dD}};pd.defaultOptions={};pd.staticKeys=[];pd.handlerKeys=[];pd.handlerKeyOptions={};pd.customHandlerKeys=[];function Moe(e,t,n){const{[joe]:r}=e,o=e[n];return!r&&!o?!1:!!(o&&o.earlyReturnValue!==KP&&(At(o.earlyReturnValue)?o.earlyReturnValue(t)===!0:t===o.earlyReturnValue)||r&&r.earlyReturnValue!==KP&&(At(r.earlyReturnValue)?r.earlyReturnValue(t)===!0:t===r.earlyReturnValue))}var By=class extends pd{constructor(...e){super(Roe,...e),this["~E"]={},this._extensions=fD(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`${aD(this.name)}Extension`}get store(){return Me(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."}),vl(this._store,{})}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 Me(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}};By.defaultPriority=wt.Default;var It=class extends By{static get[Si](){return wn.PlainExtensionConstructor}get[Si](){return wn.PlainExtension}},xp=class extends By{static get[Si](){return wn.MarkExtensionConstructor}get[Si](){return wn.MarkExtension}get type(){return zt(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};xp.disableExtraAttributes=!1;var jo=class extends By{static get[Si](){return wn.NodeExtensionConstructor}get[Si](){return wn.NodeExtension}get type(){return zt(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};jo.disableExtraAttributes=!1;var Roe={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function u4(e){return fd(e)&&hd(e,[wn.PlainExtension,wn.MarkExtension,wn.NodeExtension])}function Aoe(e){return fd(e)&&hd(e,[wn.PlainExtensionConstructor,wn.MarkExtensionConstructor,wn.NodeExtensionConstructor])}function d4(e){return fd(e)&&hd(e,wn.PlainExtension)}function bp(e){return fd(e)&&hd(e,wn.NodeExtension)}function Vy(e){return fd(e)&&hd(e,wn.MarkExtension)}function dt(e){return t=>{const{defaultOptions:n,customHandlerKeys:r,handlerKeys:o,staticKeys:s,defaultPriority:i,handlerKeyOptions:a,...l}=e,c=t;n&&(c.defaultOptions=n),i&&(c.defaultPriority=i),a&&(c.handlerKeyOptions=a),c.staticKeys=s??[],c.handlerKeys=o??[],c.customHandlerKeys=r??[];for(const[u,f]of Object.entries(l))c[u]||(c[u]=f);return c}}var Ioe=class extends It{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=Ne(),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=Ne(),(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),s={...o,class:zw(...r.classNames??[],o==null?void 0:o.class)};this.attributeList.unshift(s)}for(const r of this.attributeList)this.attributeObject={...this.attributeObject,...r,class:zw(this.attributeObject.class,r.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function Ht(e={}){return(t,n,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[n]=e}}function Ee(e={}){return(t,n,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[n]=e}}function io(e){return(t,n,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[n]=e}}var Doe=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>t=>{let n=!0;const{view:r,tr:o,dispatch:s}=t;if(!r)return!1;for(const a of this.validateHandlers)if(!a({...t,dispatch:()=>{}})){n=!1;break}return!s||!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})}),s(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 _h(e){const{type:t,attrs:n,range:r,selection:o}=e;return s=>{const{dispatch:i,tr:a,state:l}=s,c=Be(t)?l.schema.marks[t]:t;if(Me(c,{code:re.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||o){const{from:u,to:f}=No(o??r??a.selection,a.doc);return cv({trState:a,type:t,...r})?i==null||i(a.removeMark(u,f,c)):i==null||i(a.addMark(u,f,c.create(n))),!0}return Ff(ioe(c,n))(s)}}function Loe(e,t,n){for(const{$from:r,$to:o}of n){let s=r.depth===0?t.type.allowsMarkType(e):!1;if(t.nodesBetween(r.pos,o.pos,i=>{if(s)return!1;s=i.inlineContent&&i.type.allowsMarkType(e)}),s)return!0}return!1}function Foe(e,t,n){return({tr:r,dispatch:o,state:s})=>{const i=No(n??r.selection,r.doc),a=kre(i),l=Be(e)?s.schema.marks[e]:e;if(Me(l,{code:re.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),i.empty&&!a||!Loe(l,r.doc,i.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:f}of i.ranges){if(c)break;c=r.doc.rangeHasMark(u.pos,f.pos,l)}for(const{$from:u,$to:f}of i.ranges)c&&r.removeMark(u.pos,f.pos,l),t&&r.addMark(u.pos,f.pos,l.create(t));return o(r),!0}}function zoe(e,t={}){return({tr:n,dispatch:r,state:o})=>{const s=o.schema,i=n.selection,{from:a=i.from,to:l=a??i.to,marks:c={}}=t;if(!r)return!0;n.insertText(e,a,l);const u=zt(n.steps,n.steps.length-1).getMap().map(l);for(const[f,h]of cn(c))n.addMark(a,u,zt(s.marks,f).create(h));return r(n),!0}}var Ze=class extends It{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{const{forcedUpdates:n}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:yh([...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=!za(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=Ne(),s=new Set;let i=Ne();const a=c=>{var u;const f=Ne(),h=()=>c??this.transaction;let p=[];const g=()=>p;for(const[y,x]of Object.entries(o))(u=i[y])!=null&&u.disableChaining||(f[y]=this.chainedFactory({chain:f,command:x.original,getTr:h,getChain:g}));const v=y=>{Me(y===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 f.run=(y={})=>{const x=p;p=[];for(const b of x)if(!b(v)&&y.exitEarly)return;e.dispatch(h())},f.tr=()=>{const y=p;p=[];for(const x of y)x(v);return h()},f.enabled=()=>{for(const y of p)if(!y())return!1;return!0},f.new=y=>a(y),f};for(const c of n){const u=((t=c.createCommands)==null?void 0:t.call(c))??{},f=c.decoratedCommands??{},h={};i={...i,decoratedCommands:f};for(const[p,g]of Object.entries(f)){const v=Be(g.shortcut)&&g.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(g.shortcut,c.options)}:void 0;this.updateDecorated(p,{...g,name:c.name,...v}),u[p]=c[p].bind(c),g.active&&(h[p]=()=>{var y;return((y=g.active)==null?void 0:y.call(g,c.options,this.store))??!1})}qg(u)||this.addCommands({active:h,names:s,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 Be(e)?zoe(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=No(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=ki(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,s=this.store.manager.createState({content:e,selection:t});return s?(o==null||o(r.replaceRangeWith(0,r.doc.nodeSize-2,s.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(Ve.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>fc(t.selection)?(e==null||e(t.insertText(`
|
|
507
|
+
`)),!0):!1}insertNode(e,t={}){return({dispatch:n,tr:r,state:o})=>{var s;const{attrs:i,range:a,selection:l,replaceEmptyParentBlock:c=!1}=t,{from:u,to:f,$from:h}=No(l??a??r.selection,r.doc);if(Dy(e)||hre(e)){const x=h.before(h.depth);return n==null||n(c&&u===f&&Qk(h.parent)?r.replaceWith(x,x+h.parent.nodeSize,e):r.replaceWith(u,f,e)),!0}const p=Be(e)?o.schema.nodes[e]:e;Me(p,{code:re.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});const g=(s=t.marks)==null?void 0:s.map(x=>{if(x instanceof ct)return x;const b=Be(x)?o.schema.marks[x]:x;return Me(b,{code:re.SCHEMA,message:`The requested mark type ${x} does not exist in the schema.`}),b.create()}),v=p.createAndFill(i,Be(t.content)?o.schema.text(t.content):t.content,g);if(!v)return!1;const y=u!==f;return n==null||n(y?r.replaceRangeWith(u,f,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:s=0,to:i=s}=r.selection;e={from:s,to:i}}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 uv(e,t,n,r)}toggleWrappingNode(e,t,n){return Lre(e,t,n)}toggleBlockNodeItem(e){return JL(e)}wrapInNode(e,t,n){return YL(e,t,n)}applyMark(e,t,n){return Foe(e,t,n)}toggleMark(e){return _h(e)}removeMark(e){return ZL(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(Lw({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 $re(e)}getAllCommandOptions(){const e={};for(const[t,n]of this.decorated)qg(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(){Ba.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{...$oe,...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[s,i]of cn(t))c4({name:s,set:r,code:re.DUPLICATE_COMMAND_NAMES}),Me(!Boe.has(s),{code:re.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),n[s]=this.createUnchainedCommand(i,o[s])}unchainedFactory(e){return(...t)=>{const{shouldDispatch:n=!0,command:r}=e,{view:o}=this.store,{state:s}=o;let i;return n&&(i=o.dispatch),r(...t)({state:s,dispatch:i,view:o,tr:s.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:s}=e,i=s(),{view:a}=this.store,{state:l}=a;return i.push(c=>r(...t)({state:l,dispatch:c,view:a,tr:o()})),n}}};be([Ee()],Ze.prototype,"customDispatch",1);be([Ee()],Ze.prototype,"insertText",1);be([Ee()],Ze.prototype,"selectText",1);be([Ee()],Ze.prototype,"selectMark",1);be([Ee()],Ze.prototype,"delete",1);be([Ee()],Ze.prototype,"emptyUpdate",1);be([Ee()],Ze.prototype,"forceUpdate",1);be([Ee()],Ze.prototype,"updateNodeAttributes",1);be([Ee()],Ze.prototype,"setContent",1);be([Ee()],Ze.prototype,"resetContent",1);be([Ee()],Ze.prototype,"emptySelection",1);be([Ee()],Ze.prototype,"insertNewLine",1);be([Ee()],Ze.prototype,"insertNode",1);be([Ee()],Ze.prototype,"focus",1);be([Ee()],Ze.prototype,"blur",1);be([Ee()],Ze.prototype,"setBlockNodeType",1);be([Ee()],Ze.prototype,"toggleWrappingNode",1);be([Ee()],Ze.prototype,"toggleBlockNodeItem",1);be([Ee()],Ze.prototype,"wrapInNode",1);be([Ee()],Ze.prototype,"applyMark",1);be([Ee()],Ze.prototype,"toggleMark",1);be([Ee()],Ze.prototype,"removeMark",1);be([Ee()],Ze.prototype,"setMeta",1);be([Ee({description:({t:e})=>e($a.SELECT_ALL_DESCRIPTION),label:({t:e})=>e($a.SELECT_ALL_LABEL),shortcut:oe.SelectAll})],Ze.prototype,"selectAll",1);be([Ee({description:({t:e})=>e($a.COPY_DESCRIPTION),label:({t:e})=>e($a.COPY_LABEL),shortcut:oe.Copy,icon:"fileCopyLine"})],Ze.prototype,"copy",1);be([Ee({description:({t:e})=>e($a.PASTE_DESCRIPTION),label:({t:e})=>e($a.PASTE_LABEL),shortcut:oe.Paste,icon:"clipboardLine"})],Ze.prototype,"paste",1);be([Ee({description:({t:e})=>e($a.CUT_DESCRIPTION),label:({t:e})=>e($a.CUT_LABEL),shortcut:oe.Cut,icon:"scissorsFill"})],Ze.prototype,"cut",1);be([Ee()],Ze.prototype,"replaceText",1);be([Ht()],Ze.prototype,"getAllCommandOptions",1);be([Ht()],Ze.prototype,"getCommandOptions",1);be([Ht()],Ze.prototype,"getCommandProp",1);Ze=be([dt({defaultPriority:wt.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],Ze);var $oe={forcedUpdates:[]},Boe=new Set(["run","chain","original","raw","enabled","tr","new"]),rs=class extends It{constructor(){super(...arguments),this.placeholders=ft.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{const t=Jg(),{promise:n,placeholder:r,onFailure:o,onSuccess:s}=e;return new Doe(n).validate(i=>this.addPlaceholder(t,r)(i)).success(i=>{const{state:a,tr:l,dispatch:c,view:u,value:f}=i,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:()=>{}}),s(f,h,{state:a,tr:l,dispatch:c,view:u})}).failure(i=>(this.removePlaceholder(t)({...i,dispatch:()=>{}}),(o==null?void 0:o(i))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init:()=>{},apply:e=>{var t,n,r,o,s,i;const{added:a,clearTrackers:l,removed:c,updated:u}=this.getMeta(e);if(l){this.placeholders=ft.empty;for(const[,f]of this.placeholderWidgets)(n=(t=f.spec).onDestroy)==null||n.call(t,this.store.view,f.spec.element);this.placeholderWidgets.clear();return}this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:f=>{var h,p;const g=this.placeholderWidgets.get(f.id);g&&((p=(h=g.spec).onDestroy)==null||p.call(h,this.store.view,g.spec.element))}});for(const[,f]of this.placeholderWidgets)(o=(r=f.spec).onUpdate)==null||o.call(r,this.store.view,f.from,f.spec.element,f.spec.data);for(const f of a){if(f.type==="inline"){this.addInlinePlaceholder(f,e);continue}if(f.type==="node"){this.addNodePlaceholder(f,e);continue}if(f.type==="widget"){this.addWidgetPlaceholder(f,e);continue}}for(const{id:f,data:h}of u){const p=this.placeholderWidgets.get(f);if(!p)continue;const g=Rt.widget(p.from,p.spec.element,{...p.spec,data:h});this.placeholders=this.placeholders.remove([p]).add(e.doc,[g]),this.placeholderWidgets.set(f,g)}for(const f of c){const h=this.placeholders.find(void 0,void 0,g=>g.id===f&&g.__type===_c),p=this.placeholderWidgets.get(f);p&&((i=(s=p.spec).onDestroy)==null||i.call(s,this.store.view,p.spec.element)),this.placeholders=this.placeholders.remove(h),this.placeholderWidgets.delete(f)}}},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(GP,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(GP,!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===_c);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)?ft.empty:Uoe(e,ft.empty,{class:Be(o)?o:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){const{pos:n,createElement:r,onDestroy:o,onUpdate:s,className:i,nodeName:a,id:l,type:c}=e,u=(r==null?void 0:r(this.store.view,n))??document.createElement(a);u.classList.add(i);const f=Rt.widget(n,u,{id:l,__type:_c,type:c,element:u,onDestroy:o,onUpdate:s});this.placeholderWidgets.set(l,f),this.placeholders=this.placeholders.add(t.doc,[f])}addInlinePlaceholder(e,t){const{from:n=t.selection.from,to:r=t.selection.to,className:o,nodeName:s,id:i,type:a}=e;let l;if(n===r){const c=document.createElement(s);c.classList.add(o),l=Rt.widget(n,c,{id:i,type:a,__type:_c,widget:c})}else l=Rt.inline(n,r,{nodeName:s,class:o},{id:i,__type:_c});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){const{pos:n,className:r,nodeName:o,id:s}=e,i=eo(n)?t.doc.resolve(n):t.selection.$from,a=eo(n)?i.nodeAfter?{pos:n,end:i.nodeAfter.nodeSize}:void 0:rre(i);if(!a)return;const l=Rt.node(a.pos,a.end,{nodeName:o,class:r},{id:s,__type:_c});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){const{placeholderNodeName:n,placeholderClassName:r}=this.options,{nodeName:o=n,className:s,...i}=t,a=(s?[r,s]:[r]).join(" ");return{nodeName:o,className:a,...i,id:e}}getMeta(e){const t=e.getMeta(this.pluginKey)??{};return{...Voe,...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:s}=this.getMeta(n);return this.setMeta(n,{added:[...s,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:i}=this.getMeta(n);return this.setMeta(n,{updated:yh([...i,{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:s}=this.getMeta(n);return this.setMeta(n,{removed:yh([...s,t])}),!0}clearPlaceholdersTransaction(e){const{tr:t,checkOnly:n=!1}=e;return this.getPluginState()===ft.empty?!1:(n||this.setMeta(t,{clearTrackers:!0}),!0)}};be([Ee()],rs.prototype,"updateDecorations",1);be([Ee()],rs.prototype,"addPlaceholder",1);be([Ee()],rs.prototype,"updatePlaceholder",1);be([Ee()],rs.prototype,"removePlaceholder",1);be([Ee()],rs.prototype,"clearPlaceholders",1);be([Ht()],rs.prototype,"findPlaceholder",1);be([Ht()],rs.prototype,"findAllPlaceholders",1);rs=be([dt({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:()=>ft.empty}}},defaultPriority:wt.Low})],rs);var Voe={added:[],updated:[],clearTrackers:!1,removed:[]},_c="placeholderDecoration",GP="persistentSelectionFocus";function Uoe(e,t,n){const{selection:r,doc:o}=e;if(r.empty)return t;const{from:s,to:i}=r,a=Ly(r)?Rt.node(s,i,n):Rt.inline(s,i,n);return t.add(o,[a])}var $w=class extends It{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)}};$w=be([dt({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:wt.Lowest})],$w);var _o=class extends It{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",Lw);const t=Ne(),n=Ne(),r=Ne(),o=new Set;for(const s of this.store.extensions){bp(s)&&(n[s.name]=a=>ire({state:this.store.getState(),type:s.type,attrs:a}),r[s.name]=a=>{var l;return(l=Nh({state:this.store.getState(),type:s.type,attrs:a}))==null?void 0:l.node.attrs}),Vy(s)&&(n[s.name]=a=>cv({trState:this.store.getState(),type:s.type,attrs:a}),r[s.name]=a=>{const l=ki(this.store.getState().selection.$from,s.type);if(!l||!a)return l==null?void 0:l.mark.attrs;if(Jk(l.mark,a))return l.mark.attrs});const i=((e=s.createHelpers)==null?void 0:e.call(s))??{};for(const a of Object.keys(s.decoratedHelpers??{}))i[a]=s[a].bind(s);if(!qg(i))for(const[a,l]of cn(i))c4({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 Yk(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=Lw({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(o,t)(n)}}getText({lineBreakDivider:e=`
|
|
508
|
+
|
|
509
|
+
`,state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,fa)}getTextBetween(e,t,n=this.store.getState().doc){return n.textBetween(e,t,`
|
|
510
|
+
|
|
511
|
+
`,fa)}getHTML(e=this.store.getState()){return jre(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};be([Ht()],_o.prototype,"isSelectionEmpty",1);be([Ht()],_o.prototype,"isViewEditable",1);be([Ht()],_o.prototype,"getStateJSON",1);be([Ht()],_o.prototype,"getJSON",1);be([Ht()],_o.prototype,"getRemirrorJSON",1);be([Ee()],_o.prototype,"insertHtml",1);be([Ht()],_o.prototype,"getText",1);be([Ht()],_o.prototype,"getTextBetween",1);be([Ht()],_o.prototype,"getHTML",1);_o=be([dt({})],_o);var Bw=class extends It{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[qe.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 s of o.createInputRules())s.shouldSkip=this.options.shouldSkipInputRule,s.invalidMarks=r,n.push(s);return Hee({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};Bw=be([dt({defaultPriority:wt.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],Bw);var Wo=class extends It{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(s=>s!==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 Be(e)?Goe[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new Ni({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=a4(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension(Ze),o=a=>l=>Tm({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(Hoe(a.createKeymap(o(a)),n));for(const[c,u]of cn(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const f=a[c].bind(a),h=Tm({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),p=At(u.priority)?u.priority(a.options,this.store):u.priority??wt.Low,g=Ne();for(const v of h)g[v]=f;t.push([p,g]),u.command&&r.updateDecorated(u.command,{shortcut:h})}}}const s=this.sortKeymaps([...this.extraKeyBindings,...t]);return lre(s)}arrowRightShortcut(e){const t=this.store.markTags[qe.PreventExits],n=this.store.nodeTags[qe.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[qe.PreventExits],n=this.store.nodeTags[qe.PreventExits];return lv(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[qe.PreventExits],n=this.store.nodeTags[qe.PreventExits];return lv(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=Ne();if(!n)for(const[o,s]of cn(C0))r[o]=Ff(s);return t&&C0.Backspace&&(r.Backspace=Ff($y(Kee,C0.Backspace))),e&&(r.Escape=Ff(eoe)),[wt.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?Tm({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 Yl(e.map(t=>un(t)?t:[wt.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!Are(r.selection)||Ch({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(za(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?UP:Fw)(r.selection))return!1;const s=r.selection.$anchor.node();return!Qk(s)||yre(s)||e.includes(s.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:s.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:s}=r;if(!(n?UP:Fw)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(Ch({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(za(l))return!1;if(!s)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),s(o),!0}}};be([io({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],Wo.prototype,"arrowRightShortcut",1);be([io({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],Wo.prototype,"arrowLeftShortcut",1);be([io({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],Wo.prototype,"backspace",1);be([Ht()],Wo.prototype,"getNamedShortcut",1);Wo=be([dt({defaultPriority:wt.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],Wo);function Woe(e){return ns(Py(oe),e)}function Tm({shortcut:e,map:t,options:n,store:r}){return Be(e)?[Vw(e,t)]:un(e)?e.map(o=>Vw(o,t)):(e=e(n,r),Tm({shortcut:e,map:t,options:n,store:r}))}function Vw(e,t){return Woe(e)?t[e]:e}function Hoe(e,t){const n={};let r,o;un(e)?[o,r]=e:r=e;for(const[s,i]of cn(r))n[Vw(s,t)]=i;return Ty(o)?n:[o,n]}var f4={[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]:Ba.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]:Ba.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},Koe={...f4,[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-]"},Goe={default:f4,googleDoc:Koe},qoe=class extends It{get name(){return"nodeViews"}createPlugin(){const e=[],t=Ne();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(At(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},Yoe=class extends It{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(),s=un(o)?o:[o];n.push(...s)}return moe(n)}},Uw=class extends It{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=Ne(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return Me(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 s of r)s.onApplyState&&this.applyStateHandlers.push(s.onApplyState.bind(s)),s.onInitState&&this.initStateHandlers.push(s.onInitState.bind(s)),s.onAppendTransaction&&this.appendTransactionHandlers.push(s.onAppendTransaction.bind(s)),this.extractExtensionPlugins(s);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 s of this.appendTransactionHandlers)s(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 s of this.applyStateHandlers)s(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 dd(e.name);this.pluginKeys[e.name]=o;const s=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=s,this.stateGetters.set(e.name,s),this.stateGetters.set(e.constructor,s);const i={...e.createPlugin(),key:o},a=new Ni(i);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||za(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(zt(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=u4(e)?e:Aoe(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);Me(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(){Me(this.store.phase>=hr.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)}};Uw=be([dt({defaultPriority:wt.Highest,handlerKeys:["applyState","appendTransaction"]})],Uw);var Ww=class extends It{constructor(){super(...arguments),this.dynamicAttributes={marks:Ne(),nodes:Ne()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:s,disableExtraAttributes:i,nodeOverride:a,markOverride:l}=e,c=g=>!!(g&&t[qe.Block].includes(g));if(e.schema){const{nodes:g,marks:v}=rse(e.schema);this.addSchema(e.schema,g,v);return}const u=c(s)?{doc:Ne(),[s]:Ne()}:Ne(),f=Ne(),h=Joe({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const g of o){h[g.name]={...h[g.name],...g.options.extraAttributes};const v=i===!0||g.options.disableExtraAttributes===!0||g.constructor.disableExtraAttributes===!0;if(bp(g)){const{spec:y,dynamic:x}=qP({createExtensionSpec:(b,w)=>g.createNodeSpec(b,w),extraAttributes:zt(h,g.name),override:{...a,...g.options.nodeOverride},ignoreExtraAttributes:v,name:g.constructorName,tags:g.tags});g.spec=y,u[g.name]=y,Object.keys(x).length>0&&(this.dynamicAttributes.nodes[g.name]=x)}if(Vy(g)){const{spec:y,dynamic:x}=qP({createExtensionSpec:(b,w)=>g.createMarkSpec(b,w),extraAttributes:zt(h,g.name),override:{...l,...g.options.markOverride},ignoreExtraAttributes:v,name:g.constructorName,tags:g.tags??[]});g.spec=y,f[g.name]=y,Object.keys(x).length>0&&(this.dynamicAttributes.marks[g.name]=x)}}const p=new IQ({nodes:u,marks:f,topNode:"doc"});this.addSchema(p,u,f)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(s=>s.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((s,i)=>(this.checkAndUpdateDynamicNodes(s,i,r),this.checkAndUpdateDynamicMarks(s,i,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",Fy(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 cn(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[s,i]of cn(o)){if(!Fa(e.attrs[s]))continue;const a={...e.attrs,[s]:i(e)};n.setNodeMarkup(t,void 0,a),zP(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of cn(this.dynamicAttributes.marks)){const s=zt(this.store.schema.marks,r),i=e.marks.find(a=>a.type.name===r);if(i)for(const[a,l]of cn(o)){if(!Fa(i.attrs[a]))continue;const c=ki(n.doc.resolve(t),s);if(!c)continue;const{from:u,to:f}=c,h=s.create({...i.attrs,[a]:l(i)});n.removeMark(u,f,s).addMark(u,f,h),zP(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};Ww=be([dt({defaultPriority:wt.Highest})],Ww);function Joe(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:s}=e,i=Ne();if(t.disableExtraAttributes)return i;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=Zoe({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:s});for(const u of c){const f=i[u]??{};i[u]={...f,...l.attributes}}}return i}function Xoe(e){return dc(e)&&un(e.tags)}function Zoe(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(un(t))return t;Me(Xoe(t),{code:re.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:s=[],names:i=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,f=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 i)p(v)&&f.add(v);const g=new Map;for(const v of s)if(!(c!=null&&c.includes(v)))for(const y of o[v]){if(!p(y))continue;if(a==="any"){f.add(y);continue}const x=g.get(y)??new Set;x.add(v),g.set(y,x)}for(const[v,y]of g)y.size===s.length&&f.add(v);return[...f]}function qP(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:s,tags:i,override:a}=e,l=Ne();function c(y,x){l[y]=x}let u=!1;function f(){u=!0}const h=Qoe(r,o,f,c),p=ese(r,o),g=tse(r,o),v=n({defaults:h,parse:p,dom:g},a);return Me(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 '${s}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...i].join(" ")||void 0,{spec:v,dynamic:l}}function tE(e){return Be(e)||At(e)?{default:e}:(Me(e,{message:`${cD(e)} is not supported`,code:re.EXTENSION_EXTRA_ATTRIBUTES}),e)}function Qoe(e,t,n,r){return()=>{n();const o=Ne();if(t)return o;for(const[s,i]of cn(e)){let l=tE(i).default;At(l)&&(r(s,l),l=null),o[s]=l===void 0?{}:{default:l}}return o}}function ese(e,t){return n=>{const r=Ne();if(t)return r;for(const[o,s]of cn(e)){const{parseDOM:i,...a}=tE(s);if(js(n)){if(Fa(i)){r[o]=n.getAttribute(o)??a.default;continue}if(At(i)){r[o]=i(n)??a.default;continue}r[o]=n.getAttribute(i)??a.default}}return r}}function tse(e,t){return n=>{const r=Ne();if(t)return r;function o(s,i){if(s){if(Be(s)){r[i]=s;return}if(un(s)){const[a,l]=s;r[a]=l??n.attrs[i];return}for(const[a,l]of cn(s))r[a]=l}}for(const[s,i]of cn(e)){const{toDOM:a,parseDOM:l}=tE(i);if(Fa(a)){const c=Be(l)?l:s;r[c]=n.attrs[s];continue}if(At(a)){o(a(n.attrs,nse(n)),s);continue}o(a,s)}return r}}function nse(e){return Dy(e)?{node:e}:pre(e)?{mark:e}:{}}function rse(e){const t=Ne(),n=Ne();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 $u=class extends It{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return FP(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>FP(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>Qne(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(),s=un(o)?o:[o];n.push(...s)}return[ere(...n)]}getSuggestState(e){return Kk(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:s,findNextTextSelection:i,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:s,findNextTextSelection:i,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return ns(un(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};be([Ht()],$u.prototype,"getSuggestState",1);be([Ht()],$u.prototype,"getSuggestMethods",1);be([Ht()],$u.prototype,"isSuggesterActive",1);$u=be([dt({customHandlerKeys:["suggester"]})],$u);var Hw=class extends It{constructor(){super(...arguments),this.allTags=Ne(),this.plainTags=Ne(),this.markTags=Ne(),this.nodeTags=Ne()}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=Ne(),t=Ne(),n=Ne(),r=Ne();for(const o of Py(qe))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)Me(ose(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),d4(e)&&this.plainTags[o].push(e.name),Vy(e)&&this.markTags[o].push(e.name),bp(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};Hw=be([dt({defaultPriority:wt.Highest})],Hw);function ose(e){return ns(Py(qe),e)}var sse=new dd("remirrorFilePlaceholderPlugin");function ise(){const e=new Ni({key:sse,state:{init(){return{set:ft.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 s=document.createElement("placeholder"),i=Rt.widget(o.pos,s,{id:o.id});n=n.add(t.doc,[i]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,s=>s.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 ase=class extends It{get name(){return"upload"}createExternalPlugins(){return[ise()]}};function lse(e={}){e={...{exitMarksOnArrowPress:Wo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:Wo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:Wo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:Wo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:rs.defaultOptions.persistentSelectionClass},...e};const n=gw(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=gw(e,["persistentSelectionClass"]);return[new Hw,new Ww,new Ioe,new Uw,new Bw,new Yoe,new qoe,new $u,new Ze,new _o,new Wo(n),new $w,new ase,new rs(r)]}var YP=class extends It{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]=(...s)=>i=>{var a;const l=o(...s)(i);return i.dispatch&&l&&this.setCommandMeta(i.tr,{type:"command",chain:i.dispatch!==((a=i.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,s]of Object.entries(r))r[o]=(...i)=>a=>{var l;const c=s(...i)(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])}};YP=be([dt({defaultOptions:{capture:Ba.isDevelopment},staticKeys:["capture"],defaultPriority:wt.Highest})],YP);var Om,Jd,jm,Ic,Ki,Mm,Rm,cse=class{constructor(e){Qt(this,Om,Jg()),Qt(this,Jd,void 0),Qt(this,jm,void 0),Qt(this,Ic,!0),Qt(this,Ki,_y()),Qt(this,Mm,void 0),Qt(this,Rm,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=s=>{var i,a;Me(!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."}),s=((a=(i=this.props).onDispatchTransaction)==null?void 0:a.call(i,s,this.getState()))??s;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(s);pn(this,jm,l),this.updateState({state:c,tr:s,transactions:u});const f=this.manager.store.getForcedUpdates(s);za(f)||this.updateViewProps(...f)},this.onChange=(s=Ne())=>{var i,a;const l=this.eventListenerProps(s);ue(this,Ic)&&pn(this,Ic,!1),(a=(i=this.props).onChange)==null||a.call(i,l)},this.onBlur=s=>{var i,a;const l=this.eventListenerProps();(a=(i=this.props).onBlur)==null||a.call(i,l,s),ue(this,Ki).emit("blur",l,s)},this.onFocus=s=>{var i,a;const l=this.eventListenerProps();(a=(i=this.props).onFocus)==null||a.call(i,l,s),ue(this,Ki).emit("focus",l,s)},this.setContent=(s,{triggerChange:i=!1}={})=>{const{doc:a}=this.manager.createState({content:s}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(i)return this.updateState({state:c,triggerChange:i});this.view.updateState(c)},this.clearContent=({triggerChange:s=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:s})},this.createStateFromContent=(s,i)=>this.manager.createState({content:s,selection:i}),this.focus=s=>{this.manager.store.commands.focus(s)},this.blur=s=>{this.manager.store.commands.blur(s)};const{getProps:t,initialEditorState:n,element:r}=e;if(pn(this,Jd,t),pn(this,Rm,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 ue(this,Mm)??pn(this,Mm,ue(this,Ki).on.bind(ue(this,Ki)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return ue(this,Ic)}get props(){return ue(this,Jd).call(this)}get previousState(){return this.previousStateOverride??ue(this,jm)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return ue(this,Om)}get initialEditorState(){return ue(this,Rm)}updateListener(e){const{state:t,tr:n}=e;return ue(this,Ki).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return pn(this,Jd,t),this}updateViewProps(...e){const t=gw(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:s,editable:i}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=At(n)?n(this.eventListenerProps()):n;let c={};(r||eo(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=yh(zw(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),f={role:"textbox",...c,"aria-multiline":"true",...i??!0?{}:{"aria-readonly":"true"},"aria-label":s??"",...a,class:u};return lQ({...f,...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(){ue(this,Ki).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=Ne()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:ue(this,Ic),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:ue(this,Om),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Om=new WeakMap;Jd=new WeakMap;jm=new WeakMap;Ic=new WeakMap;Ki=new WeakMap;Mm=new WeakMap;Rm=new WeakMap;function use(e,t){const n=[],r=new WeakMap,o=[],s=new WeakMap;let i=[];const a={duplicateMap:s,parentExtensions:o,gatheredExtensions:i,settings:t};for(const f of e)h4(a,{extension:f});i=Yl(i,(f,h)=>h.priority-f.priority);const l=new WeakSet,c=new Set;for(const f of i){const h=f.constructor,p=f.name,g=s.get(h);Me(g,{message:`No entries were found for the ExtensionConstructor ${f.name}`,code:re.INTERNAL}),!(l.has(h)||c.has(p))&&(l.add(h),c.add(p),n.push(f),r.set(h,f),g.forEach(v=>v==null?void 0:v.replaceChildExtension(h,f)))}const u=[];for(const f of n)dse({extension:f,found:l,missing:u});return Me(za(u),{code:re.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:f,extension:h})=>`The extension '${h.name}' requires '${f.name} in order to run correctly.`).join(`
|
|
512
|
+
`)}),{extensions:n,extensionMap:r}}function h4(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:s,settings:i}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;Me(u4(a),{code:re.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=i.priority)==null?void 0:n[a.name]),r.push(a),fse({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],s.push(a);for(const f of u)h4(e,{names:c,extension:f,parentExtension:a})}}function dse(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 fse(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,s=t.get(o),i=r?[r]:[];t.set(o,s?[...s,...i]:i)}function hse(e){var t,n,r,o;const{extension:s,nodeNames:i,markNames:a,plainNames:l,store:c,handlers:u}=e;s.setStore(c);const f=(t=s.onCreate)==null?void 0:t.bind(s),h=(n=s.onView)==null?void 0:n.bind(s),p=(r=s.onStateUpdate)==null?void 0:r.bind(s),g=(o=s.onDestroy)==null?void 0:o.bind(s);f&&u.create.push(f),h&&u.view.push(h),p&&u.update.push(p),g&&u.destroy.push(g),Vy(s)&&a.push(s.name),bp(s)&&s.name!=="doc"&&i.push(s.name),d4(s)&&l.push(s.name)}var Gi,Xd,Do,Hs,Zd,Dr,cl,Qd,ul,ef,dl,Lo,tf,Am=class{constructor(e,t={}){Qt(this,Gi,void 0),Qt(this,Xd,Ne()),Qt(this,Do,Ne()),Qt(this,Hs,void 0),Qt(this,Zd,void 0),Qt(this,Dr,hr.None),Qt(this,cl,void 0),Qt(this,Qd,!0),Qt(this,ul,{create:[],view:[],update:[],destroy:[]}),Qt(this,ef,[]),Qt(this,dl,_y()),Qt(this,Lo,void 0),Qt(this,tf,void 0),this.getState=()=>{var o;return ue(this,Dr)>=hr.EditorView?this.view.state:(Me(ue(this,Lo),{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=ue(this,Lo))==null?void 0:o.initialEditorState)},this.updateState=o=>{const s=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:s,state:o})};const{extensions:n,extensionMap:r}=use(e,t);pn(this,cl,t),pn(this,Hs,vl(n)),pn(this,Zd,r),pn(this,Gi,this.createExtensionStore()),pn(this,Dr,hr.Create),this.setupLifecycleHandlers();for(const o of ue(this,ul).create){const s=o();s&&ue(this,ef).push(s)}}static create(e,t={}){return new Am([...pD(e),...lse(t.builtin)],t)}get[Si](){return wn.Manager}get destroyed(){return ue(this,Dr)===hr.Destroy}get mounted(){return ue(this,Dr)>=hr.EditorView&&ue(this,Dr)<hr.Destroy}get output(){var e;return(e=ue(this,Lo))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!ue(this,Lo)}get extensions(){return ue(this,Hs)}get stringHandlers(){return ue(this,Xd)}get store(){return vl(ue(this,Do))}get extensionStore(){return vl(ue(this,Gi))}get tr(){return this.getExtension(Ze).transaction}get nodes(){return ue(this,Do).nodes}get marks(){return ue(this,Do).marks}get schema(){return ue(this,Do).schema}get extensionTags(){return ue(this,Do).tags}get view(){return ue(this,Do).view}get settings(){return ue(this,cl)}get document(){return ue(this,cl).document??zy()}setupLifecycleHandlers(){const e=ue(this,Gi),t=ue(this,ul),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const s of ue(this,Hs))hse({extension:s,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){ue(this,Xd)[e]=t}setStoreKey(e,t){ue(this,Do)[e]=t}getStoreKey(e){const t=ue(this,Do)[e];return Me(!Fa(t),{code:re.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){Me(ue(this,Dr)<=hr.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."}),ue(this,Gi)[e]=t}createExtensionStore(){const e=Ne(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>ue(this,Hs),enumerable:t},phase:{get:()=>ue(this,Dr),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>vl(ue(this,cl)),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:()=>ue(this,Xd),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(ue(this,Dr)>=hr.EditorView)return this;pn(this,Qd,!0),pn(this,Dr,hr.EditorView),ue(this,Do).view=e;for(const t of ue(this,ul).view){const n=t(e);n&&ue(this,ef).push(n)}return this}attachFramework(e,t){var n;ue(this,Lo)!==e&&(ue(this,Lo)&&(ue(this,Lo).destroy(),(n=ue(this,tf))==null||n.call(this)),pn(this,Lo,e),pn(this,tf,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return Me(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:s=this.settings.stringHandler}=e,{schema:i,plugins:a}=this.store,l=HL({stringHandler:Be(s)?this.stringHandlers[s]:s,document:this.document,content:r,onError:t,schema:i,selection:o});return yl.create({schema:i,doc:l,plugins:a,selection:No(o,l)})}addHandler(e,t){return ue(this,dl).on(e,t)}onStateUpdate(e){const t=ue(this,Qd);ue(this,Gi).currentState=e.state,ue(this,Gi).previousState=e.previousState,t&&(pn(this,Dr,hr.Runtime),pn(this,Qd,!1));const n={...e,firstUpdate:t};for(const r of ue(this,ul).update)r(n);ue(this,dl).emit("stateUpdate",n)}getExtension(e){const t=ue(this,Zd).get(e);return Me(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!!ue(this,Zd).get(e)}clone(){const e=ue(this,Hs).map(n=>n.clone(n.options)),t=Am.create(()=>e,ue(this,cl));return ue(this,dl).emit("clone",t),t}recreate(e=[],t={}){const n=ue(this,Hs).map(o=>o.clone(o.initialOptions)),r=Am.create(()=>[...n,...e],t);return ue(this,dl).emit("recreate",r),r}destroy(){var e,t,n,r,o,s;pn(this,Dr,hr.Destroy);for(const i of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=i.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=ue(this,Lo))==null||r.destroy(),(o=ue(this,tf))==null||o.call(this);for(const i of ue(this,ef))i();for(const i of ue(this,ul).destroy)i();(s=this.view)==null||s.destroy(),ue(this,dl).emit("destroy")}includes(e){const t=[],n=[];for(const r of ue(this,Hs))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>Be(r)?ns(t,r):ns(n,r))}},pse=Am;Gi=new WeakMap;Xd=new WeakMap;Do=new WeakMap;Hs=new WeakMap;Zd=new WeakMap;Dr=new WeakMap;cl=new WeakMap;Qd=new WeakMap;ul=new WeakMap;ef=new WeakMap;dl=new WeakMap;Lo=new WeakMap;tf=new WeakMap;function mse(e,t){return!(!fd(e)||!hd(e,wn.Manager))}var gse=Object.getOwnPropertyDescriptor,vse=(e,t,n,r)=>{for(var o=r>1?void 0:r?gse(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=i(o)||o);return o},p4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ce=(e,t,n)=>(p4(e,t,"read from private field"),n?n.call(e):t.get(e)),Lr=(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)},Ir=(e,t,n,r)=>(p4(e,t,"write to private field"),t.set(e,n),n),nf,yse=class{constructor(){this.portals=new Map,Lr(this,nf,_y()),this.on=e=>Ce(this,nf).on("update",e),this.once=e=>{const t=Ce(this,nf).on("update",n=>{t(),e(n)});return t}}update(){Ce(this,nf).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)??Jg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:Jg()})}remove(e){this.portals.delete(e),this.update()}};nf=new WeakMap;var xse=e=>{const{portals:t}=e;return _e.createElement(_e.Fragment,null,t.map(([n,{Component:r,key:o}])=>Hr.createPortal(_e.createElement(r,null),n,o)))};function bse(e){const[t,n]=m.useState(()=>Array.from(e.portals.entries()));return m.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),m.useMemo(()=>t,[t])}var Lt,rf,fl,of,Im,sf,Dc,af,Dm,Ks,Qn,Kw,m4=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:s}){Lr(this,Lt,void 0),Lr(this,rf,[]),Lr(this,fl,void 0),Lr(this,of,void 0),Lr(this,Im,void 0),Lr(this,sf,void 0),Lr(this,Dc,void 0),Lr(this,af,!1),Lr(this,Dm,void 0),Lr(this,Ks,void 0),Lr(this,Qn,void 0),Lr(this,Kw,l=>{l&&(Me(Ce(this,Ks),{code:re.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${Ce(this,Lt).type.name}' which doesn't support content.`}),l.append(Ce(this,Ks)))}),this.Component=()=>{const l=Ce(this,Im);return Me(l,{code:re.REACT_NODE_VIEW,message:`The custom react node view provided for ${Ce(this,Lt).type.name} doesn't have a valid ReactComponent`}),_e.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:Ce(this,fl),getPosition:Ce(this,sf),node:Ce(this,Lt),forwardRef:Ce(this,Kw),decorations:Ce(this,rf)})},this.updateAttributes=l=>{if(!Ce(this,fl).editable)return;const c=Ce(this,sf).call(this);if(c==null)return;const u=Ce(this,fl).state.tr.setNodeMarkup(c,void 0,{...Ce(this,Lt).attrs,...l});Ce(this,fl).dispatch(u)},Me(At(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),Ir(this,Lt,t),Ir(this,fl,r),Ir(this,of,n),Ir(this,Im,o),Ir(this,sf,e),Ir(this,Dc,s),Ir(this,Qn,this.createDom());const{contentDOM:i,wrapper:a}=this.createContentDom()??{};Ir(this,Dm,i??void 0),Ir(this,Ks,a),Ce(this,Ks)&&Ce(this,Qn).append(Ce(this,Ks)),this.setDomAttributes(Ce(this,Lt),Ce(this,Qn)),this.Component.displayName=aD(`${Ce(this,Lt).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,s,i)=>new m4({options:r,node:o,view:s,getPosition:i,portalContainer:t,ReactComponent:n})}get selected(){return Ce(this,af)}get contentDOM(){return Ce(this,Dm)}get dom(){return Ce(this,Qn)}renderComponent(){Ce(this,of).render({Component:this.Component,container:Ce(this,Qn)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=Ce(this,Dc),n=Ce(this,Lt).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${T_(Ce(this,Lt).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(Ce(this,Lt).isLeaf)return;const n=(t=(e=Ce(this,Lt).type.spec).toDOM)==null?void 0:t.call(e,Ce(this,Lt));if(!n)return;const{contentDOM:r,dom:o}=el.renderSpec(document,n);let s;if(js(o))return s=o,o===r&&(s=document.createElement("span"),s.classList.add(`${T_(Ce(this,Lt).type.name)}-node-view-content-wrapper`),s.append(r)),js(r),{wrapper:s,contentDOM:r}}update(e,t){return qk({types:Ce(this,Lt).type,node:e})?(Ce(this,Lt)===e&&Ce(this,rf)===t||(Ce(this,Lt).sameMarkup(e)||this.setDomAttributes(e,Ce(this,Qn)),Ir(this,Lt,e),Ir(this,rf,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=Ce(this,Lt).type.spec;let r=e.attrs;if(n){const o=n(e);if(Be(o)||wse(o))return;dc(o[1])&&(r=o[1])}for(const[o,s]of cn(r))t.setAttribute(o,s)}selectNode(){Ir(this,af,!0),Ce(this,Qn)&&Ce(this,Qn).classList.add(C_),this.renderComponent()}deselectNode(){Ir(this,af,!1),Ce(this,Qn)&&Ce(this,Qn).classList.remove(C_),this.renderComponent()}destroy(){Ce(this,of).remove(Ce(this,Qn))}ignoreMutation(e){return e.type==="selection"?!Ce(this,Lt).type.spec.selectable:Ce(this,Ks)?!Ce(this,Ks).contains(e.target):!0}stopEvent(e){var t;if(!Ce(this,Qn))return!1;if(At(Ce(this,Dc).stopEvent))return Ce(this,Dc).stopEvent({event:e});const n=e.target;if(!(Ce(this,Qn).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 i=!!Ce(this,Lt).type.spec.draggable,a=Ae.isSelectable(Ce(this,Lt)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",f=e.type==="mousedown",h=e.type.startsWith("drag");return!i&&a&&h&&e.preventDefault(),!(h||o||l||c||u||f&&a)}},JP=m4;Lt=new WeakMap;rf=new WeakMap;fl=new WeakMap;of=new WeakMap;Im=new WeakMap;sf=new WeakMap;Dc=new WeakMap;af=new WeakMap;Dm=new WeakMap;Ks=new WeakMap;Qn=new WeakMap;Kw=new WeakMap;function wse(e){return Dw(e)||dc(e)&&Dw(e.dom)}var Ph=class extends It{constructor(){super(...arguments),this.portalContainer=new yse}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=Ne(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!bp(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=JP.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=cn({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=JP.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};Ph=vse([dt({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],Ph);var Sse=Object.defineProperty,XP=Object.getOwnPropertySymbols,kse=Object.prototype.hasOwnProperty,Ese=Object.prototype.propertyIsEnumerable,ZP=(e,t,n)=>t in e?Sse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QP=(e,t)=>{for(var n in t||(t={}))kse.call(t,n)&&ZP(e,n,t[n]);if(XP)for(var n of XP(t))Ese.call(t,n)&&ZP(e,n,t[n]);return e};function Cse(e){const t=m.createContext(null),n=Nse(t);return[o=>{const s=e(o);return _e.createElement(t.Provider,{value:s},o.children)},n,t]}function Nse(e){return(t,n)=>{const r=m.useContext(e),o=_se(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 s=t(r);if(!o||!n)return s;const i=t(o);return n(i,s)?i:s}}function _se(e){const t=m.useRef();return Pse(()=>{t.current=e}),t.current}var Pse=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Tse(e,t){return Cse(n=>{const r=m.useRef(null),o=m.useRef(),s=void 0,[i,a]=m.useState(()=>e({get:eT(r),set:tT(o),previousContext:void 0,props:n,state:s})),l=[...Object.values(n),s];return m.useEffect(()=>{l.length!==0&&a(c=>e({get:eT(r),set:tT(o),previousContext:c,props:n,state:s}))},l),r.current=i,o.current=a,i})}function eT(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 tT(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=>QP(QP({},n),typeof t=="function"?t(n):t))}}var g4={},v4={};(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"]])})(v4);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=v4;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,g,v){const y=n(p);if(Number.isNaN(y)||v!==void 0&&v!==p.length)throw new SyntaxError(t.errorMessages.get(g));return y}function o(p){const g=r(p,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(g)}function s(p,g){const v=r(p,t.ErrorType.MalformedUnicode,4);if(g!==void 0){const y=r(g,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,y)}return String.fromCharCode(v)}function i(p){return p.charAt(0)==="{"&&p.charAt(p.length-1)==="}"}function a(p){if(!i(p))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const g=p.slice(1,-1),v=r(g,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(y){throw y instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):y}}function l(p,g=!1){if(g)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",`
|
|
513
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(p){return c.get(p)||p}const f=/\\(?:(\\)|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,g=!1){return p.replace(f,function(v,y,x,b,w,E,C,_,N){if(y!==void 0)return"\\";if(x!==void 0)return o(x);if(b!==void 0)return a(b);if(w!==void 0)return s(w,E);if(C!==void 0)return s(C);if(_==="0")return"\0";if(_!==void 0)return l(_,!g);if(N!==void 0)return u(N);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=h,e.default=h})(g4);const Ol=e=>typeof e=="string",Ose=e=>typeof e=="function",nT=new Map,y4="en";function nE(e){return[...Array.isArray(e)?e:[e],y4]}function x4(e,t,n){const r=nE(e);return hv(()=>pv("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(Ol(t)?new Date(t):t)}function Gw(e,t,n){const r=nE(e);return hv(()=>pv("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function rT(e,t,n,{offset:r=0,...o}){const s=nE(e),i=t?hv(()=>pv("plural-ordinal",s),()=>new Intl.PluralRules(s,{type:"ordinal"})):hv(()=>pv("plural-cardinal",s),()=>new Intl.PluralRules(s,{type:"cardinal"}));return o[n]??o[i.select(n-r)]??o.other}function hv(e,t){const n=e();let r=nT.get(n);return r||(r=t(),nT.set(n,r)),r}function pv(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const b4=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,w4="%__lingui_octothorpe__%",jse=(e,t,n={})=>{const r=t||e,o=i=>typeof i=="object"?i:n[i]||{style:i},s=(i,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=Gw(r,i,l);return a.replace(new RegExp(w4,"g"),c)};return{plural:(i,a)=>{const{offset:l=0}=a,c=rT(r,!1,i,a);return s(i-l,c)},selectordinal:(i,a)=>{const{offset:l=0}=a,c=rT(r,!0,i,a);return s(i-l,c)},select:Mse,number:(i,a)=>Gw(r,i,o(a)),date:(i,a)=>x4(r,i,o(a))}},Mse=(e,t)=>t[e]??t.other;function Rse(e,t,n){return(r={},o)=>{const s=jse(t,n,o),i=(l,c=!1)=>Array.isArray(l)?l.reduce((u,f)=>{if(f==="#"&&c)return u+w4;if(Ol(f))return u+f;const[h,p,g]=f;let v={};p==="plural"||p==="selectordinal"||p==="select"?Object.entries(g).forEach(([x,b])=>{v[x]=i(b,p==="plural"||p==="selectordinal")}):v=g;let y;if(p){const x=s[p];y=x(r[h],v)}else y=r[h];return y==null?u:u+y},""):l,a=i(e);return Ol(a)&&b4.test(a)?g4.unraw(a.trim()):Ol(a)?a.trim():a?String(a):""}}var Ase=Object.defineProperty,Ise=(e,t,n)=>t in e?Ase(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dse=(e,t,n)=>(Ise(e,t+"",n),n);class Lse{constructor(){Dse(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 Fse=Object.defineProperty,zse=(e,t,n)=>t in e?Fse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pc=(e,t,n)=>(zse(e,typeof t!="symbol"?t+"":t,n),n);class $se extends Lse{constructor(t){super(),Pc(this,"_locale",""),Pc(this,"_locales"),Pc(this,"_localeData",{}),Pc(this,"_messages",{}),Pc(this,"_missing"),Pc(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??y4,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=""),Ol(t)||(n=t.values||n,o=t.message,t=t.id);const s=this.messages[t],i=s===void 0,a=this._missing;if(a&&i)return Ose(a)?a(this._locale,t):a;i&&this.emit("missing",{id:t,locale:this._locale});let l=s||o||t;return Ol(l)&&b4.test(l)?JSON.parse(`"${l}"`):Ol(l)?l:Rse(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return x4(this._locales||this._locale,t,n)}number(t,n){return Gw(this._locales||this._locale,t,n)}}function Bse(e={}){return new $se(e)}const Uy=Bse();function ae(e,t){return t?"other":e==1?"one":"other"}function _i(e,t){return t?"other":e==0||e==1?"one":"other"}function jr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function mt(e,t){return"other"}function nl(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const Vse=mt,Use=ae,Wse=_i;function Hse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Kse=ae;function Gse(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 qse(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 Yse(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 Jse=ae,Xse=jr;function Zse(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),s=r.slice(-2),i=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||s==20||s==50||s==70||s==80?"one":o==3||o==4||i==100||i==200||i==300||i==400||i==500||i==600||i==700||i==800||i==900?"few":r==0||o==6||s==40||s==60||s==90?"many":"other":e==1?"one":"other"}function Qse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),s=r&&n[0].slice(-2);return t?(o==2||o==3)&&s!=12&&s!=13?"few":"other":o==1&&s!=11?"one":o>=2&&o<=4&&(s<12||s>14)?"few":r&&o==0||o>=5&&o<=9||s>=11&&s<=14?"many":"other"}const eie=ae,tie=ae,nie=ae,rie=_i,oie=mt;function sie(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 iie=mt;function aie(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),s=r&&n[0].slice(-2),i=r&&n[0].slice(-6);return t?"other":o==1&&s!=11&&s!=71&&s!=91?"one":o==2&&s!=12&&s!=72&&s!=92?"two":(o==3||o==4||o==9)&&(s<10||s>19)&&(s<70||s>79)&&(s<90||s>99)?"few":e!=0&&r&&i==0?"many":"other"}const lie=ae;function cie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":s&&i==1&&a!=11||l==1&&c!=11?"one":s&&i>=2&&i<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function uie(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 die=ae;function fie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=o.slice(-1);return t?"other":s&&(r==1||r==2||r==3)||s&&i!=4&&i!=6&&i!=9||!s&&a!=4&&a!=6&&a!=9?"one":"other"}const hie=ae,pie=ae,mie=ae;function gie(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 vie(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 yie(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 xie=jr;function bie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-2),a=o.slice(-2);return t?"other":s&&i==1||a==1?"one":s&&i==2||a==2?"two":s&&(i==3||i==4)||a==3||a==4?"few":"other"}const wie=ae,Sie=mt,kie=ae,Eie=ae;function Cie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,s=o&&n[0].slice(-1),i=o&&n[0].slice(-2);return t?s==1&&i!=11?"one":s==2&&i!=12?"two":s==3&&i!=13?"few":"other":e==1&&r?"one":"other"}const Nie=ae,_ie=ae,Pie=jr,Tie=ae;function Oie(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function jie(e,t){return t?"other":e>=0&&e<2?"one":"other"}const Mie=jr;function Rie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":s&&(r==1||r==2||r==3)||s&&i!=4&&i!=6&&i!=9||!s&&a!=4&&a!=6&&a!=9?"one":"other"}const Aie=ae;function Iie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Die=ae,Lie=jr;function Fie(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 zie(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 $ie=jr,Bie=ae;function Vie(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 Uie=_i;function Wie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=r.slice(-1),i=r.slice(-2);return t?"other":o&&s==1?"one":o&&s==2?"two":o&&(i==0||i==20||i==40||i==60||i==80)?"few":o?"other":"many"}const Hie=ae,Kie=ae;function Gie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=Number(n[0])==e,i=s&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&s&&i==0?"many":"other"}function qie(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 Yie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":s&&i==1&&a!=11||l==1&&c!=11?"one":s&&i>=2&&i<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Jie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-2),a=o.slice(-2);return t?"other":s&&i==1||a==1?"one":s&&i==2||a==2?"two":s&&(i==3||i==4)||a==3||a==4?"few":"other"}function Xie(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function Zie(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Qie=jr,eae=mt,tae=mt,nae=mt,rae=jr;function oae(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,s=r.slice(-1),i=r.slice(-2);return t?"other":o&&s==1&&i!=11||!o?"one":"other"}function sae(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 iae=nl;function aae(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=Number(n[0])==e,i=s&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&s&&i==0?"many":"other"}const lae=mt,cae=mt,uae=ae,dae=jr,fae=ae,hae=mt,pae=mt;function mae(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 gae(e,t){return t?"other":e>=0&&e<2?"one":"other"}const vae=ae,yae=ae,xae=mt,bae=mt;function wae(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 Sae=ae,kae=ae,Eae=mt;function Cae(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Nae=mt,_ae=ae,Pae=ae;function Tae(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const Oae=ae;function jae(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),s=r&&n[0].slice(-3),i=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&&s==0&&(i>=1e3&&i<=2e4||i==4e4||i==6e4||i==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 Mae=ae;function Rae(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 Aae=ae,Iae=ae,Dae=mt,Lae=_i;function Fae(e,t){return t&&e==1?"one":"other"}function zae(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,s=o&&n[0].slice(-1),i=o&&n[0].slice(-2);return t?"other":s==1&&(i<11||i>19)?"one":s>=2&&s<=9&&(i<11||i>19)?"few":r!=0?"many":"other"}function $ae(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,s=Number(n[0])==e,i=s&&n[0].slice(-1),a=s&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":s&&i==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":i==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const Bae=ae,Vae=_i,Uae=ae;function Wae(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?i==1&&a!=11?"one":i==2&&a!=12?"two":(i==7||i==8)&&a!=17&&a!=18?"many":"other":s&&i==1&&a!=11||l==1&&c!=11?"one":"other"}const Hae=ae,Kae=ae;function Gae(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,s=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||s>=2&&s<=19?"few":"other"}function qae(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function Yae(e,t){return t&&e==1?"one":"other"}function Jae(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 Xae=mt,Zae=ae,Qae=nl,ele=ae,tle=ae;function nle(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 rle=jr,ole=ae,sle=ae,ile=ae,ale=mt,lle=ae,cle=_i,ule=ae,dle=ae,fle=ae;function hle(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 ple=ae,mle=mt,gle=_i,vle=ae;function yle(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=r.slice(-1),i=r.slice(-2);return t?"other":e==1&&o?"one":o&&s>=2&&s<=4&&(i<12||i>14)?"few":o&&r!=1&&(s==0||s==1)||o&&s>=5&&s<=9||o&&i>=12&&i<=14?"many":"other"}function xle(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,s=Number(n[0])==e,i=s&&n[0].slice(-1),a=s&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":s&&i==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":i==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const ble=ae;function wle(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const Sle=jr,kle=ae;function Ele(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,s=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||s>=2&&s<=19?"few":"other"}const Cle=ae,Nle=mt;function _le(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=r.slice(-1),i=r.slice(-2);return t?"other":o&&s==1&&i!=11?"one":o&&s>=2&&s<=4&&(i<12||i>14)?"few":o&&s==0||o&&s>=5&&s<=9||o&&i>=11&&i<=14?"many":"other"}const Ple=ae,Tle=mt,Ole=ae;function jle(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 Mle(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 Rle=ae,Ale=ae,Ile=nl,Dle=ae,Lle=mt,Fle=mt;function zle(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":s&&i==1&&a!=11||l==1&&c!=11?"one":s&&i>=2&&i<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function $le(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 Ble(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 Vle(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 Ule(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=r.slice(-2);return t?"other":o&&s==1?"one":o&&s==2?"two":o&&(s==3||s==4)||!o?"few":"other"}const Wle=nl,Hle=nl,Kle=nl,Gle=nl,qle=nl,Yle=ae,Jle=ae;function Xle(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),s=r&&n[0].slice(-2);return t?e==1?"one":o==4&&s!=14?"many":"other":e==1?"one":"other"}function Zle(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":s&&i==1&&a!=11||l==1&&c!=11?"one":s&&i>=2&&i<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const Qle=ae,ece=ae,tce=ae,nce=mt;function rce(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,s=o&&n[0].slice(-1),i=o&&n[0].slice(-2);return t?(s==1||s==2)&&i!=11&&i!=12?"one":"other":e==1&&r?"one":"other"}const oce=jr,sce=ae,ice=ae,ace=ae,lce=ae,cce=mt,uce=_i,dce=ae;function fce(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 hce(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",s=!n[1],i=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":s&&(r==1||r==2||r==3)||s&&i!=4&&i!=6&&i!=9||!s&&a!=4&&a!=6&&a!=9?"one":"other"}const pce=ae,mce=mt,gce=ae,vce=ae;function yce(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 xce=ae;function bce(e,t){var n=String(e).split("."),r=n[0],o=!n[1],s=Number(n[0])==e,i=s&&n[0].slice(-1),a=s&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?i==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 wce=jr,Sce=ae,kce=ae;function Ece(e,t){return t&&e==1?"one":"other"}const Cce=ae,Nce=ae,_ce=_i,Pce=ae,Tce=mt,Oce=ae,jce=ae,Mce=jr,Rce=mt,Ace=mt,Ice=mt;function Dce(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Lce=Object.freeze(Object.defineProperty({__proto__:null,_in:Vse,af:Use,ak:Wse,am:Hse,an:Kse,ar:Gse,ars:qse,as:Yse,asa:Jse,ast:Xse,az:Zse,be:Qse,bem:eie,bez:tie,bg:nie,bho:rie,bm:oie,bn:sie,bo:iie,br:aie,brx:lie,bs:cie,ca:uie,ce:die,ceb:fie,cgg:hie,chr:pie,ckb:mie,cs:gie,cy:vie,da:yie,de:xie,dsb:bie,dv:wie,dz:Sie,ee:kie,el:Eie,en:Cie,eo:Nie,es:_ie,et:Pie,eu:Tie,fa:Oie,ff:jie,fi:Mie,fil:Rie,fo:Aie,fr:Iie,fur:Die,fy:Lie,ga:Fie,gd:zie,gl:$ie,gsw:Bie,gu:Vie,guw:Uie,gv:Wie,ha:Hie,haw:Kie,he:Gie,hi:qie,hr:Yie,hsb:Jie,hu:Xie,hy:Zie,ia:Qie,id:eae,ig:tae,ii:nae,io:rae,is:oae,it:sae,iu:iae,iw:aae,ja:lae,jbo:cae,jgo:uae,ji:dae,jmc:fae,jv:hae,jw:pae,ka:mae,kab:gae,kaj:vae,kcg:yae,kde:xae,kea:bae,kk:wae,kkj:Sae,kl:kae,km:Eae,kn:Cae,ko:Nae,ks:_ae,ksb:Pae,ksh:Tae,ku:Oae,kw:jae,ky:Mae,lag:Rae,lb:Aae,lg:Iae,lkt:Dae,ln:Lae,lo:Fae,lt:zae,lv:$ae,mas:Bae,mg:Vae,mgo:Uae,mk:Wae,ml:Hae,mn:Kae,mo:Gae,mr:qae,ms:Yae,mt:Jae,my:Xae,nah:Zae,naq:Qae,nb:ele,nd:tle,ne:nle,nl:rle,nn:ole,nnh:sle,no:ile,nqo:ale,nr:lle,nso:cle,ny:ule,nyn:dle,om:fle,or:hle,os:ple,osa:mle,pa:gle,pap:vle,pl:yle,prg:xle,ps:ble,pt:wle,pt_PT:Sle,rm:kle,ro:Ele,rof:Cle,root:Nle,ru:_le,rwk:Ple,sah:Tle,saq:Ole,sc:jle,scn:Mle,sd:Rle,sdh:Ale,se:Ile,seh:Dle,ses:Lle,sg:Fle,sh:zle,shi:$le,si:Ble,sk:Vle,sl:Ule,sma:Wle,smi:Hle,smj:Kle,smn:Gle,sms:qle,sn:Yle,so:Jle,sq:Xle,sr:Zle,ss:Qle,ssy:ece,st:tce,su:nce,sv:rce,sw:oce,syr:sce,ta:ice,te:ace,teo:lce,th:cce,ti:uce,tig:dce,tk:fce,tl:hce,tn:pce,to:mce,tr:gce,ts:vce,tzm:yce,ug:xce,uk:bce,ur:wce,uz:Sce,ve:kce,vi:Ece,vo:Cce,vun:Nce,wa:_ce,wae:Pce,wo:Tce,xh:Oce,xog:jce,yi:Mce,yo:Rce,yue:Ace,zh:Ice,zu:Dce},Symbol.toStringTag,{value:"Module"}));var Fce=Object.defineProperty,zce=Object.getOwnPropertyDescriptor,$ce=Object.getOwnPropertyNames,Bce=Object.prototype.hasOwnProperty,Vce=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $ce(t))!Bce.call(e,o)&&o!==n&&Fce(e,o,{get:()=>t[o],enumerable:!(r=zce(t,o))||r.enumerable});return e},Uce=(e,t,n)=>(Vce(e,t,"default"),n),Wce=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"]]}'),S4={};Uce(S4,Lce);Uy.loadLocaleData("en",{plurals:S4.en});Uy.load("en",Wce);Uy.activate("en");var Hce=Object.defineProperty,Kce=Object.getOwnPropertyDescriptor,rE=(e,t,n,r)=>{for(var o=r>1?void 0:r?Kce(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Hce(t,n,o),o},Bu=class extends jo{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=Ne();if(dc(n))for(const[s,i]of cn(n))o[s]={default:i};else for(const s of n)o[s]={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 qw(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return Zk(e.doc,t)}};rE([Ee()],Bu.prototype,"setDocAttributes",1);rE([Ht()],Bu.prototype,"isDefaultDocNode",1);Bu=rE([dt({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:wt.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],Bu);var k4="SetDocAttribute",E4="RevertSetDocAttribute",qw=class Yw extends dn{constructor(n,r,o=k4){super();Kt(this,"key");Kt(this,"stepType");Kt(this,"value");Kt(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new Yw(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return qt.ok(n.type.create(r,n.content,n.marks))}invert(){return new Yw(this.key,this.previous,E4)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{dn.jsonID(k4,qw),dn.jsonID(E4,qw)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var Gce=Object.defineProperty,qce=Object.getOwnPropertyDescriptor,C4=(e,t,n,r)=>{for(var o=r>1?void 0:r?qce(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Gce(t,n,o),o};function Yce(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function Jce(e,t){const n=t.target;if(n){const r=Yce(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),s=o.node().isLeaf?0:1,i=o.start()-s;return{pos:r,inside:i}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var mv=class extends It{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=Jce(t,r);if(!o)return!1;const s=[],i=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const f of hD(u,1))s.push({node:f>c.depth&&c.nodeAfter?c.nodeAfter:c.node(f),pos:c.before(f)});for(const{type:f}of c.marksAcross(c)??[]){const h=ki(c,f);h&&i.push(h)}return e(r,{view:t,nodes:s,marks:i,getMark:f=>{const h=Be(f)?t.state.schema.marks[f]:f;return Me(h,{code:re.EXTENSION,message:`The mark ${f} being checked does not exist within the editor schema.`}),i.find(p=>p.mark.type===h)},getNode:f=>{var h;const p=Be(f)?t.state.schema.nodes[f]:f;Me(p,{code:re.EXTENSION,message:"The node being checked does not exist"});const g=s.find(({node:v})=>v.type===p);if(g)return{...g,isRoot:!!((h=s[0])!=null&&h.node.eq(g.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,s]of cn(r))this.addHandler(o,s)}}createPlugin(){const e=new WeakMap,t=(n,r,o,s,i,a,l,c)=>{const u=this.store.currentState,{schema:f,doc:h}=u,p=h.resolve(s),g=e.has(l),v=Xce({$pos:p,handled:g,view:o,state:u});let y=!1;g||(y=n(l,v)||y);const x={...v,pos:s,direct:c,nodeWithPosition:{node:i,pos:a},getNode:b=>{const w=Be(b)?f.nodes[b]:b;return Me(w,{code:re.EXTENSION,message:"The node being checked does not exist"}),w===i.type?{node:i,pos:a}:void 0}};return e.set(l,!0),r(l,x)||y};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,s)=>this.options.textInput({from:r,to:o,text:s})||!1,handleClickOn:(n,r,o,s,i,a)=>t(this.options.clickMark,this.options.click,n,r,o,s,i,a),handleDoubleClickOn:(n,r,o,s,i,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,s,i,a),handleTripleClickOn:(n,r,o,s,i,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,s,i,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(s){const i=s.editable;i!==r&&(o.editable(i),r=i)}}}}}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())}};C4([Ht()],mv.prototype,"isInteracting",1);mv=C4([dt({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:wt.High})],mv);function Xce(e){const{handled:t,view:n,$pos:r,state:o}=e,s={getMark:dD,markRanges:[],view:n,state:o};if(t)return s;for(const{type:i}of r.marksAcross(r)??[]){const a=ki(r,i);a&&s.markRanges.push(a)}return s.getMark=i=>{const a=Be(i)?o.schema.marks[i]:i;return Me(a,{code:re.EXTENSION,message:`The mark ${i} being checked does not exist within the editor schema.`}),s.markRanges.find(l=>l.mark.type===a)},s}class Wt extends tt{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Wt.valid(r)?new Wt(r):tt.near(r)}content(){return le.empty}eq(t){return t instanceof Wt&&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 Wt(t.resolve(n.pos))}getBookmark(){return new oE(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Zce(t)||!Qce(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&&Wt.valid(t))return t;let o=t.pos,s=null;for(let i=t.depth;;i--){let a=t.node(i);if(n>0?t.indexAfter(i)<a.childCount:t.index(i)>0){s=a.child(n>0?t.indexAfter(i):t.index(i)-1);break}else if(i==0)return null;o+=n;let l=t.doc.resolve(o);if(Wt.valid(l))return l}for(;;){let i=n>0?s.firstChild:s.lastChild;if(!i){if(s.isAtom&&!s.isText&&!Ae.isSelectable(s)){t=t.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=i,o+=n;let a=t.doc.resolve(o);if(Wt.valid(a))return a}return null}}}Wt.prototype.visible=!1;Wt.findFrom=Wt.findGapCursorFrom;tt.jsonID("gapcursor",Wt);class oE{constructor(t){this.pos=t}map(t){return new oE(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Wt.valid(n)?new Wt(n):tt.near(n)}}function N4(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Zce(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||N4(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Qce(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||N4(o.type))return!0;if(o.inlineContent)return!1}}return!0}function eue(){return new Ni({props:{decorations:oue,createSelectionBetween(e,t,n){return t.pos==n.pos&&Wt.valid(n)?new Wt(n):null},handleClick:nue,handleKeyDown:tue,handleDOMEvents:{beforeinput:rue}}})}const tue=a4({ArrowLeft:sm("horiz",-1),ArrowRight:sm("horiz",1),ArrowUp:sm("vert",-1),ArrowDown:sm("vert",1)});function sm(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,s){let i=r.selection,a=t>0?i.$to:i.$from,l=i.empty;if(i instanceof Ve){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=Wt.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new Wt(c))),!0):!1}}function nue(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Wt.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Ae.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Wt(r))),!0)}function rue(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Wt))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=q.empty;for(let i=r.length-1;i>=0;i--)o=q.from(r[i].createAndFill(null,o));let s=e.state.tr.replace(n.pos,n.pos,new le(o,0,0));return s.setSelection(Ve.near(s.doc.resolve(n.pos+1))),e.dispatch(s),!1}function oue(e){if(!(e.selection instanceof Wt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ft.create(e.doc,[Rt.widget(e.selection.head,t,{key:"gapcursor"})])}var sue=Object.getOwnPropertyDescriptor,iue=(e,t,n,r)=>{for(var o=r>1?void 0:r?sue(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=i(o)||o);return o},Jw=class extends It{get name(){return"gapCursor"}createExternalPlugins(){return[eue()]}};Jw=iue([dt({})],Jw);var gv=200,Sn=function(){};Sn.prototype.append=function(t){return t.length?(t=Sn.from(t),!this.length&&t||t.length<gv&&this.leafAppend(t)||this.length<gv&&t.leafPrepend(this)||this.appendInner(t)):this};Sn.prototype.prepend=function(t){return t.length?Sn.from(t).append(this):this};Sn.prototype.appendInner=function(t){return new aue(this,t)};Sn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Sn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};Sn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Sn.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)};Sn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,i){return o.push(t(s,i))},n,r),o};Sn.from=function(t){return t instanceof Sn?t:t&&t.length?new _4(t):Sn.empty};var _4=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,s){return o==0&&s==this.length?this:new t(this.values.slice(o,s))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,s,i,a){for(var l=s;l<i;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,s,i,a){for(var l=s-1;l>=i;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=gv)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=gv)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}(Sn);Sn.empty=new _4([]);var aue=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,s,i){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),i)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,i+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,s,i){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,i+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,i)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},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}(Sn);const lue=500;class Ho{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,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let i=t.tr,a,l,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){o||(o=this.remapping(r,h+1),s=o.maps.length),s--,u.push(f);return}if(o){u.push(new Bi(f.map));let p=f.step.map(o.slice(s)),g;p&&i.maybeStep(p).doc&&(g=i.mapping.maps[i.mapping.maps.length-1],c.push(new Bi(g,void 0,void 0,c.length+u.length))),s--,g&&o.appendMap(g,s)}else i.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(s)):f.selection,l=new Ho(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:i,selection:a}}addTransform(t,n,r,o){let s=[],i=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 f=t.steps[u].invert(t.docs[u]),h=new Bi(t.mapping.maps[u],f,n),p;(p=l&&l.merge(h))&&(h=p,u?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(i++,n=void 0),o||(l=h)}let c=i-r.depth;return c>uue&&(a=cue(a,c),i-=c),new Ho(a.append(s),i)}remapping(t,n){let r=new bh;return this.items.forEach((o,s)=>{let i=o.mirrorOffset!=null&&s-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,i)},t,n),r}addMaps(t){return this.eventCount==0?this:new Ho(this.items.append(t.map(n=>new Bi(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=t.mapping,i=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},o);let l=n;this.items.forEach(h=>{let p=s.getMirror(--l);if(p==null)return;i=Math.min(i,p);let g=s.maps[p];if(h.step){let v=t.steps[p].invert(t.docs[p]),y=h.selection&&h.selection.map(s.slice(l+1,p));y&&a++,r.push(new Bi(g,v,y))}else r.push(new Bi(g))},o);let c=[];for(let h=n;h<i;h++)c.push(new Bi(s.maps[h]));let u=this.items.slice(0,o).append(c).append(r),f=new Ho(u,a);return f.emptyItemCount()>lue&&(f=f.compress(this.items.length-r.length)),f}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=[],s=0;return this.items.forEach((i,a)=>{if(a>=t)o.push(i),i.selection&&s++;else if(i.step){let l=i.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=i.selection&&i.selection.map(n.slice(r));u&&s++;let f=new Bi(c.invert(),l,u),h,p=o.length-1;(h=o.length&&o[p].merge(f))?o[p]=h:o.push(f)}}else i.map&&r--},this.items.length,0),new Ho(Sn.from(o.reverse()),s)}}Ho.empty=new Ho(Sn.empty,0);function cue(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let Bi=class P4{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 P4(n.getMap().invert(),n,this.selection)}}};class ea{constructor(t,n,r,o,s){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const uue=20;function due(e,t,n,r){let o=n.getMeta(di),s;if(o)return o.historyState;n.getMeta(pue)&&(e=new ea(e.done,e.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(i&&i.getMeta(di))return i.getMeta(di).redo?new ea(e.done.addTransform(n,void 0,r,Lm(t)),e.undone,oT(n.mapping.maps),e.prevTime,e.prevComposition):new ea(e.done,e.undone.addTransform(n,void 0,r,Lm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!i&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!fue(n,e.prevRanges)),c=i?T0(e.prevRanges,n.mapping):oT(n.mapping.maps);return new ea(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Lm(t)),Ho.empty,c,n.time,a??e.prevComposition)}else return(s=n.getMeta("rebased"))?new ea(e.done.rebased(n,s),e.undone.rebased(n,s),T0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ea(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),T0(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function fue(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<t.length;s+=2)r<=t[s+1]&&o>=t[s]&&(n=!0)}),n}function oT(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,s,i)=>t.push(s,i));return t}function T0(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),s=t.map(e[r+1],-1);o<=s&&n.push(o,s)}return n}function hue(e,t,n){let r=Lm(t),o=di.get(t).spec.config,s=(n?e.undone:e.done).popEvent(t,r);if(!s)return null;let i=s.selection.resolve(s.transform.doc),a=(n?e.done:e.undone).addTransform(s.transform,t.selection.getBookmark(),o,r),l=new ea(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(i).setMeta(di,{redo:n,historyState:l})}let O0=!1,sT=null;function Lm(e){let t=e.plugins;if(sT!=t){O0=!1,sT=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){O0=!0;break}}return O0}const di=new dd("history"),pue=new dd("closeHistory");function mue(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ni({key:di,state:{init(){return new ea(Ho.empty,Ho.empty,null,0,-1)},apply(t,n,r){return due(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?Fm:r=="historyRedo"?lf:null;return!o||!t.editable?!1:(n.preventDefault(),o(t.state,t.dispatch))}}}})}function T4(e,t){return(n,r)=>{let o=di.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let s=hue(o,n,e);s&&r(t?s.scrollIntoView():s)}return!0}}const Fm=T4(!1,!0),lf=T4(!0,!0);function Xw(e){let t=di.getState(e);return t?t.done.eventCount:0}function gue(e){let t=di.getState(e);return t?t.undone.eventCount:0}var vue=Object.defineProperty,yue=Object.getOwnPropertyDescriptor,hc=(e,t,n,r)=>{for(var o=r>1?void 0:r?yue(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&vue(t,n,o),o},Ms=class extends It{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:s,getDispatch:i}=this.options,a=At(s)?s():n,l=At(i)&&r?i():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":Ba.isMac?()=>!1:this.wrapMethod(lf,this.options.onRedo),"Mod-z":this.wrapMethod(Fm,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(lf,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(Fm,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(lf,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[mue({depth:e,newGroupDelay:t})]}undo(){return $P(this.wrapMethod(Fm,this.options.onUndo))}redo(){return $P(this.wrapMethod(lf,this.options.onRedo))}undoDepth(e=this.store.getState()){return Xw(e)}redoDepth(e=this.store.getState()){return gue(e)}};hc([io({shortcut:oe.Undo,command:"undo"})],Ms.prototype,"undoShortcut",1);hc([io({shortcut:oe.Redo,command:"redo"})],Ms.prototype,"redoShortcut",1);hc([Ee({disableChaining:!0,description:({t:e})=>e(tv.UNDO_DESCRIPTION),label:({t:e})=>e(tv.UNDO_LABEL),icon:"arrowGoBackFill"})],Ms.prototype,"undo",1);hc([Ee({disableChaining:!0,description:({t:e})=>e(tv.REDO_DESCRIPTION),label:({t:e})=>e(tv.REDO_LABEL),icon:"arrowGoForwardFill"})],Ms.prototype,"redo",1);hc([Ht()],Ms.prototype,"undoDepth",1);hc([Ht()],Ms.prototype,"redoDepth",1);Ms=hc([dt({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],Ms);var xue=Object.defineProperty,bue=Object.getOwnPropertyDescriptor,Wy=(e,t,n,r)=>{for(var o=r>1?void 0:r?bue(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&xue(t,n,o),o},wue={icon:"paragraph",label:({t:e})=>e(nv.INSERT_LABEL),description:({t:e})=>e(nv.INSERT_DESCRIPTION)},Sue={icon:"paragraph",label:({t:e})=>e(nv.CONVERT_LABEL),description:({t:e})=>e(nv.CONVERT_DESCRIPTION)},tc=class extends jo{get name(){return"paragraph"}createTags(){return[qe.LastNodeCompatible,qe.TextBlock,qe.Block,qe.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)}};Wy([Ee(Sue)],tc.prototype,"convertParagraph",1);Wy([Ee(wue)],tc.prototype,"insertParagraph",1);Wy([io({shortcut:oe.Paragraph,command:"convertParagraph"})],tc.prototype,"shortcut",1);tc=Wy([dt({defaultPriority:wt.Medium})],tc);function ii(e,t,n){return Math.min(Math.max(e,n),t)}class kue extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var cf=kue;function O4(e){if(typeof e!="string")throw new cf(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=jue.test(e)?Nue(e):e;const n=_ue.exec(t);if(n){const i=Array.from(n).slice(1);return[...i.slice(0,3).map(a=>parseInt(Th(a,2),16)),parseInt(Th(i[3]||"f",2),16)/255]}const r=Pue.exec(t);if(r){const i=Array.from(r).slice(1);return[...i.slice(0,3).map(a=>parseInt(a,16)),parseInt(i[3]||"ff",16)/255]}const o=Tue.exec(t);if(o){const i=Array.from(o).slice(1);return[...i.slice(0,3).map(a=>parseInt(a,10)),parseFloat(i[3]||"1")]}const s=Oue.exec(t);if(s){const[i,a,l,c]=Array.from(s).slice(1).map(parseFloat);if(ii(0,100,a)!==a)throw new cf(e);if(ii(0,100,l)!==l)throw new cf(e);return[...Mue(i,a,l),Number.isNaN(c)?1:c]}throw new cf(e)}function Eue(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const iT=e=>parseInt(e.replace(/_/g,""),36),Cue="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=iT(t.substring(0,3)),r=iT(t.substring(3)).toString(16);let o="";for(let s=0;s<6-r.length;s++)o+="0";return e[n]=`${o}${r}`,e},{});function Nue(e){const t=e.toLowerCase().trim(),n=Cue[Eue(t)];if(!n)throw new cf(e);return`#${n}`}const Th=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),_ue=new RegExp(`^#${Th("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Pue=new RegExp(`^#${Th("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Tue=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Th(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Oue=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,jue=/^[a-z]+$/i,aT=e=>Math.round(e*255),Mue=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(aT);const o=(e%360+360)%360/60,s=(1-Math.abs(2*r-1))*(t/100),i=s*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=s,l=i):o>=1&&o<2?(a=i,l=s):o>=2&&o<3?(l=s,c=i):o>=3&&o<4?(l=i,c=s):o>=4&&o<5?(a=i,c=s):o>=5&&o<6&&(a=s,c=i);const u=r-s/2,f=a+u,h=l+u,p=c+u;return[f,h,p].map(aT)};function Rue(e){const[t,n,r,o]=O4(e).map((f,h)=>h===3?f:f/255),s=Math.max(t,n,r),i=Math.min(t,n,r),a=(s+i)/2;if(s===i)return[0,0,a,o];const l=s-i,c=a>.5?l/(2-s-i):l/(s+i);return[60*(t===s?(n-r)/l+(n<r?6:0):n===s?(r-t)/l+2:(t-n)/l+4),c,a,o]}function Aue(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${ii(0,100,t*100).toFixed()}%, ${ii(0,100,n*100).toFixed()}%, ${parseFloat(ii(0,1,r).toFixed(3))})`}function Vr(e,t){const[n,r,o,s]=Rue(e);return Aue(n,r,o-t,s)}function Iue(e,t,n,r){return`rgba(${ii(0,255,e).toFixed()}, ${ii(0,255,t).toFixed()}, ${ii(0,255,n).toFixed()}, ${parseFloat(ii(0,1,r).toFixed(3))})`}function zm(e,t){return Vr(e,-t)}function vv(e,t){const[n,r,o,s]=O4(e);return Iue(n,r,o,s-t)}const Due="remirror-editor-wrapper",Lue="remirror-button-active",Fue="remirror-button",zue="remirror-composite",$ue="remirror-dialog",Bue="remirror-dialog-backdrop",Vue="remirror-form",Uue="remirror-form-message",Wue="remirror-form-label",Hue="remirror-form-group",Kue="remirror-group",Gue="remirror-input",que="remirror-menu",Yue="remirror-menu-pane",Jue="remirror-menu-pane-active",Xue="remirror-menu-dropdown-label",Zue="remirror-menu-pane-icon",Que="remirror-menu-pane-label",ede="remirror-menu-pane-shortcut",tde="remirror-menu-button-left",nde="remirror-menu-button-right",rde="remirror-menu-button-nested-left",ode="remirror-menu-button-nested-right",sde="remirror-menu-button",ide="remirror-menu-bar",ade="remirror-flex-column",lde="remirror-flex-row",cde="remirror-menu-item",ude="remirror-menu-item-row",dde="remirror-menu-item-column",fde="remirror-menu-item-checkbox",hde="remirror-menu-item-radio",pde="remirror-menu-group",mde="remirror-floating-popover",gde="remirror-popover",vde="remirror-animated-popover",yde="remirror-role",xde="remirror-separator",bde="remirror-tab",wde="remirror-tab-list",Sde="remirror-tabbable",kde="remirror-toolbar",Ede="remirror-tooltip",Cde="remirror-table-size-editor",Nde="remirror-table-size-editor-body",_de="remirror-table-size-editor-cell",Pde="remirror-table-size-editor-cell-selected",Tde="remirror-table-size-editor-footer",Ode="remirror-color-picker",jde="remirror-color-picker-cell",Mde="remirror-color-picker-cell-selected";var Rde=Object.freeze({__proto__:null,ANIMATED_POPOVER:vde,BUTTON:Fue,BUTTON_ACTIVE:Lue,COLOR_PICKER:Ode,COLOR_PICKER_CELL:jde,COLOR_PICKER_CELL_SELECTED:Mde,COMPOSITE:zue,DIALOG:$ue,DIALOG_BACKDROP:Bue,EDITOR_WRAPPER:Due,FLEX_COLUMN:ade,FLEX_ROW:lde,FLOATING_POPOVER:mde,FORM:Vue,FORM_GROUP:Hue,FORM_LABEL:Wue,FORM_MESSAGE:Uue,GROUP:Kue,INPUT:Gue,MENU:que,MENU_BAR:ide,MENU_BUTTON:sde,MENU_BUTTON_LEFT:tde,MENU_BUTTON_NESTED_LEFT:rde,MENU_BUTTON_NESTED_RIGHT:ode,MENU_BUTTON_RIGHT:nde,MENU_DROPDOWN_LABEL:Xue,MENU_GROUP:pde,MENU_ITEM:cde,MENU_ITEM_CHECKBOX:fde,MENU_ITEM_COLUMN:dde,MENU_ITEM_RADIO:hde,MENU_ITEM_ROW:ude,MENU_PANE:Yue,MENU_PANE_ACTIVE:Jue,MENU_PANE_ICON:Zue,MENU_PANE_LABEL:Que,MENU_PANE_SHORTCUT:ede,POPOVER:gde,ROLE:yde,SEPARATOR:xde,TAB:bde,TABBABLE:Sde,TABLE_SIZE_EDITOR:Cde,TABLE_SIZE_EDITOR_BODY:Nde,TABLE_SIZE_EDITOR_CELL:_de,TABLE_SIZE_EDITOR_CELL_SELECTED:Pde,TABLE_SIZE_EDITOR_FOOTER:Tde,TAB_LIST:wde,TOOLBAR:kde,TOOLTIP:Ede});const Ade="remirror-image-loader";var Ide=Object.freeze({__proto__:null,IMAGE_LOADER:Ade});const Dde="remirror-list-item-with-custom-mark",Lde="remirror-ul-list-content",Fde="remirror-editor",zde="remirror-list-item-marker-container",$de="remirror-list-item-checkbox",Bde="remirror-collapsible-list-item-closed",Vde="remirror-collapsible-list-item-button",Ude="remirror-list-spine";var Ua=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:Vde,COLLAPSIBLE_LIST_ITEM_CLOSED:Bde,EDITOR:Fde,LIST_ITEM_CHECKBOX:$de,LIST_ITEM_MARKER_CONTAINER:zde,LIST_ITEM_WITH_CUSTOM_MARKER:Dde,LIST_SPINE:Ude,UL_LIST_CONTENT:Lde});const Wde="remirror-is-empty";var Hde=Object.freeze({__proto__:null,IS_EMPTY:Wde});const Kde="remirror-editor",Gde="remirror-positioner",qde="remirror-positioner-widget";var Yde=Object.freeze({__proto__:null,EDITOR:Kde,POSITIONER:Gde,POSITIONER_WIDGET:qde});const Jde={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"]},ma="#000000",j4="#ffffff",M4=vv(ma,.75),sE="#7963d2",R4="#bcd263",A4=Jde.gray[1];zm(vv(ma,.1),.13);Vr(j4,.15),Vr(M4,.15),Vr(ma,.15),Vr(A4,.15),Vr(sE,.15),Vr(R4,.15);Vr(j4,.075),Vr(M4,.075),Vr(ma,.075),Vr(A4,.075),Vr(sE,.075),Vr(R4,.075);vv(ma,.1),vv(sE,.6),zm(ma,.8),zm(ma,.4),zm(ma,.4);var Xde=Object.defineProperty,Zde=Object.getOwnPropertyDescriptor,iE=(e,t,n,r)=>{for(var o=r>1?void 0:r?Zde(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Xde(t,n,o),o},I4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},rn=(e,t,n)=>(I4(e,t,"read from private field"),n?n.call(e):t.get(e)),Us=(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)},Vi=(e,t,n,r)=>(I4(e,t,"write to private field"),t.set(e,n),n),uf,df,Lc,ff,$m,hf,pf,mf,gf,Bm=class{constructor(e){Us(this,uf,_y()),Us(this,df,[]),Us(this,Lc,new Map),Us(this,ff,[]),Us(this,$m,!1),Us(this,hf,void 0),Us(this,pf,void 0),Us(this,mf,void 0),Us(this,gf,void 0),this.addListener=(t,n)=>rn(this,uf).on(t,n),Vi(this,hf,e),Vi(this,pf,e.getActive),Vi(this,gf,e.getPosition),Vi(this,mf,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new Bm(e)}static fromPositioner(e,t){return Bm.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:rn(this,pf),getPosition:rn(this,gf),hasChanged:this.hasChanged,events:this.events,getID:rn(this,mf)}}onActiveChanged(e){this.recentUpdate=e;const t=rn(this,pf).call(this,e);Vi(this,df,t),Vi(this,Lc,new Map),Vi(this,$m,!1),Vi(this,ff,[]);const n=[];for(const[r,o]of t.entries()){const s=this.getID(o,r);rn(this,ff).push(s),n.push({setElement:i=>this.addProps({...e,data:o,element:i},r),id:s,data:o})}rn(this,uf).emit("update",n)}getID(e,t){var n;return((n=rn(this,mf))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(rn(this,$m)||(rn(this,Lc).set(t,e),rn(this,Lc).size<rn(this,df).length))return;const n=[];for(const r of rn(this,df).keys()){const o=rn(this,Lc).get(r);Me(o,{code:re.INTERNAL,message:"Something went wrong when retrieving the parameters"});const s=rn(this,ff)[r];if(!s)return;n.push({position:rn(this,gf).call(this,o),element:o.element,id:s})}rn(this,uf).emit("done",n)}clone(e){return Bm.create({...rn(this,hf),...At(e)?e(rn(this,hf)):e})}active(e){const t=At(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},Yo=Bm;uf=new WeakMap;df=new WeakMap;Lc=new WeakMap;ff=new WeakMap;$m=new WeakMap;hf=new WeakMap;pf=new WeakMap;mf=new WeakMap;gf=new WeakMap;Yo.EMPTY=[];function Qde(e,t=z4){const{key:n}=(e==null?void 0:e.getMeta(F4))??{};return n===t}function D4(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&Qde(t)?!0:t?sre(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function L4(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let s=0,i=0,a=0,l=0;if(js(t)&&o){const u=Number.parseFloat($i(t,"padding-left").replace("px","")),f=Number.parseFloat($i(t,"padding-right").replace("px","")),h=Number.parseFloat($i(t,"padding-top").replace("px","")),p=Number.parseFloat($i(t,"padding-bottom").replace("px","")),g=Number.parseFloat($i(t,"border-left").replace("px","")),v=Number.parseFloat($i(t,"border-right").replace("px","")),y=Number.parseFloat($i(t,"border-top").replace("px","")),x=Number.parseFloat($i(t,"border-bottom").replace("px","")),b=t.offsetWidth-t.clientWidth,w=t.offsetHeight-t.clientHeight;s+=u+g+(t.dir==="rtl"?b:0),i+=f+v+(t.dir==="rtl"?0:b),a+=h+y,l+=p+x+w}const c=new DOMRect(r.left+s,r.top+a,r.width-i,r.height-l);for(const[u,f]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(j_(u,c.top,c.bottom)&&j_(f,c.left,c.right))return!0;return!1}var efe="remirror-positioner-widget",F4="positionerUpdate",z4="__all_positioners__",$4={y:-999999,x:-999999,width:0,height:0},lT={...$4,left:-999999,top:-999999,bottom:-999999,right:-999999},tfe={...$4,rect:{...lT,toJSON:()=>lT},visible:!1},nfe=Yo.create({hasChanged:D4,getActive(e){const{state:t}=e;if(!Yk(t)||t.selection.$anchor.depth>2)return Yo.EMPTY;const n=Iy({predicate:r=>r.type.isBlock,selection:t});return n?[n]:Yo.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!js(r))return tfe;const o=r.getBoundingClientRect(),s=t.dom.getBoundingClientRect(),i=o.height,a=o.width,l=t.dom.scrollLeft+o.left-s.left,c=t.dom.scrollTop+o.top-s.top,u=L4(o,t.dom);return{y:c,x:l,height:i,width:a,rect:o,visible:u}}}),B4=nfe.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&Qk(n.node)&&n.node.type===Fy(t.state.schema)?[n]:Yo.EMPTY}}));B4.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));B4.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:s}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,s)}}}));function aE(e){return Yo.create({hasChanged:D4,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!fc(n.selection))return Yo.EMPTY;try{const{head:o,anchor:s}=n.selection;return[{from:r.coordsAtPos(s),to:r.coordsAtPos(o)}]}catch{return Yo.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:s,to:i}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(i.bottom-s.top),u=c>s.bottom-s.top,f=Math.min(s.left,i.left),h=Math.min(s.top,i.top),p=a.scrollLeft+(u?i.left-l.left:f-l.left),g=a.scrollTop+h-l.top,v=u?1:Math.abs(s.left-i.right),y=new DOMRect(u?i.left:f,h,v,c),x=L4(y,o.dom);return{rect:y,y:g,x:p,height:c,width:v,visible:x}}})}var rfe=aE(e=>!e.selection.empty);aE(e=>e.selection.empty);aE(()=>!0);rfe.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return Yo.EMPTY;const r=WL(t);if(!r)return Yo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return Yo.EMPTY}}}));var Oh=class extends It{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:Yde.EDITOR}}init(){this.onScroll=eQ(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 ft.empty;const t=Rt.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return ft.create(e.doc,[t])}forceUpdatePositioners(e=z4){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta(F4,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=efe,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}}))}};iE([Ee()],Oh.prototype,"forceUpdatePositioners",1);iE([Ht()],Oh.prototype,"getPositionerWidget",1);Oh=iE([dt({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],Oh);var ofe=Object.getOwnPropertyDescriptor,sfe=(e,t,n,r)=>{for(var o=r>1?void 0:r?ofe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=i(o)||o);return o},Zw=class extends jo{get name(){return"text"}createTags(){return[qe.InlineNode]}createNodeSpec(){return{}}};Zw=sfe([dt({disableExtraAttributes:!0,defaultPriority:wt.Medium})],Zw);var ife={...Bu.defaultOptions,...tc.defaultOptions,...Ms.defaultOptions,excludeExtensions:[]};function afe(e={}){e={...ife,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:s,excludeExtensions:i}=e,a={};for(const c of i??[])a[c]=!0;const l=[];if(!a.history){const c=new Ms({depth:n,getDispatch:r,getState:o,newGroupDelay:s});l.push(c)}return a.doc||l.push(new Bu({content:t})),a.text||l.push(new Zw),a.paragraph||l.push(new tc),a.positioner||l.push(new Oh),a.gapCursor||l.push(new Jw),a.events||l.push(new mv),l}var lfe=Object.getOwnPropertyDescriptor,cfe=(e,t,n,r)=>{for(var o=r>1?void 0:r?lfe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=i(o)||o);return o},nc=class extends It{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:Zk(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>ufe({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>dfe({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=hr.EditorView&&this.store.updateAttributes()}};nc=cfe([dt({defaultOptions:{emptyNodeClass:Hde.IS_EMPTY,placeholder:""}})],nc);function ufe(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:Zk(o.doc)}:t}function dfe(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:s}=t.options;if(!r)return null;const i=[];return n.doc.descendants((a,l)=>{const c=Rt.node(l,l+a.nodeSize,{class:o,"data-placeholder":s});i.push(c)}),ft.create(n.doc,i)}var ffe=Object.getOwnPropertyDescriptor,hfe=(e,t,n,r)=>{for(var o=r>1?void 0:r?ffe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=i(o)||o);return o},pfe={...nc.defaultOptions,...Ph.defaultOptions},mfe=[...nc.staticKeys,...Ph.staticKeys],jh=class extends It{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(nc).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:s,nodeViewComponents:i}=this.options;return[new nc({emptyNodeClass:e,placeholder:t,priority:wt.Low}),new Ph({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:s,nodeViewComponents:i})]}};jh=hfe([dt({defaultOptions:pfe,staticKeys:mfe})],jh);var V4={};Object.defineProperty(V4,"__esModule",{value:!0});function gfe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return uT(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return uT(r,o)},e[0]);return n||null}var Fd=V4.default=gfe,cT=new WeakMap;function uT(e,t){if(e&&t){var n=cT.get(e)||new WeakMap;cT.set(e,n);var r=n.get(t)||function(o){dT(e,o),dT(t,o)};return n.set(t,r),r}return e||t}function dT(e,t){typeof e=="function"?e(t):e.current=t}var U4=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},j0=(e,t,n)=>(U4(e,t,"read from private field"),t.get(e)),vfe=(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)},yfe=(e,t,n,r)=>(U4(e,t,"write to private field"),t.set(e,n),n);function xfe(){const[,e]=m.useState(Ne());return m.useCallback(()=>{e(Ne())},[])}var W4=m.createContext(null);function Hy(e){const t=m.useContext(W4),n=m.useRef(xfe());Me(t,{code:re.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return m.useEffect(()=>{let o=e;if(o){if(dc(o)){const{autoUpdate:s}=o;o=s?()=>n.current():void 0}if(At(o))return r("updated",o)}},[r,e]),t}function bfe(e=!0){return Hy({autoUpdate:e}).active}function wfe(e=!1){return Hy(e?{autoUpdate:!0}:void 0).attrs}function H4(){return Hy().chain.new()}var[Sfe]=Tse(({props:e})=>{const t=e.locale??"en",n=e.i18n??Uy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function fT(e,t={}){const{core:n,react:r,...o}=t;return mse(e)?e:pse.create(()=>[...pD(e),new jh(r),...afe(n)],o)}function kfe(e,t={}){const n=m.useRef(e),r=m.useRef(t),[o,s]=m.useState(()=>fT(e,t));return n.current=e,r.current=t,m.useEffect(()=>o.addHandler("destroy",()=>{s(()=>fT(n.current,r.current))}),[o]),o}var Efe=typeof Fd=="object"&&Fd.__esModule&&Fd.default?Fd.default:Fd,Fc,Cfe=class extends cse{constructor(e){if(super(e),vfe(this,Fc,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,...s}=t??Ne();return{[r]:Efe(o,this.onRef),key:this.uid,...s,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,Me(this.rootPropsConfig.count<=1,{code:re.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),yfe(this,Fc,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(nc).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new RL(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:s}=this.props;Me(s,{code:re.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),Me(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(N_,{}))),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(N_,{})),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(){Me(j0(this,Fc),{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(j0(this,Fc),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&j0(this,Fc)&&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}};Fc=new WeakMap;var K4=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Nfe(e){const t=m.useRef();return K4(()=>{t.current=e}),t.current}function _fe(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;m.useRef(!0).current&&!Fa(r)&&t.getExtension(jh).setOptions({placeholder:r}),m.useEffect(()=>{r!=null&&t.getExtension(jh).setOptions({placeholder:r})},[r,t]);const[i]=m.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=un(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=Pfe({initialEditorState:i,getProps:()=>e});return m.useEffect(()=>()=>{a.destroy()},[a]),m.useEffect(()=>{a.onUpdate()},[o,a]),Tfe(a),a.frameworkOutput}function Pfe(e){const t=m.useRef(e);t.current=e;const n=m.useMemo(()=>new Cfe(t.current),[]);return n.update(e),n}function Tfe(e){const{state:t}=e.props,n=m.useRef(!!t),r=Nfe(t);K4(()=>{const o=t?n.current===!0:n.current===!1;Me(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 Ofe(e={}){const{content:t,document:n,selection:r,extensions:o,...s}=e,i=kfe(o??(()=>[]),s),[a,l]=m.useState(()=>i.createState({selection:r,content:t??i.createEmptyDoc()})),c=m.useCallback(({state:f})=>{l(f)},[]),u=m.useCallback(()=>i.output,[i]);return m.useMemo(()=>({state:a,setState:l,manager:i,onChange:c,getContext:u}),[u,i,c,a])}var Qw=()=>_e.createElement("div",{className:Rde.EDITOR_WRAPPER,...Hy().getRootProps()}),jfe=e=>(e.hook(),null);function Mfe(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:s,hooks:i=[],...a}=e,l=_fe(a),c=bse(l.portalContainer),u=n==="start"||n===!0||!t&&Fa(n),f=n==="end";return _e.createElement(Sfe,{i18n:r,locale:o,supportedLocales:s},_e.createElement(W4.Provider,{value:l},_e.createElement(xse,{portals:c}),i.map((h,p)=>_e.createElement(jfe,{hook:h,key:p})),u&&_e.createElement(Qw,null),t,f&&_e.createElement(Qw,null)))}function Rfe(e,t=null){return function(n,r){let{$from:o,$to:s}=n.selection,i=o.blockRange(s);if(!i)return!1;let a=r?n.tr:null;return Afe(a,i,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function Afe(e,t,n,r=null){let o=!1,s=t,i=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=i.resolve(t.start-2);s=new Jl(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new Jl(t.$from,i.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=Mk(s,n,r,t);return a?(e&&Ife(e,t,a,o,n),!0):!1}function Ife(e,t,n,r,o){let s=q.empty;for(let u=n.length-1;u>=0;u--)s=q.from(n[u].type.create(n[u].attrs,s));e.step(new Yt(t.start-(r?2:0),t.end,t.start,t.end,new le(s,0,0),n.length,!0));let i=0;for(let u=0;u<n.length;u++)n[u].type==o&&(i=u+1);let a=n.length-i,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,f=t.endIndex,h=!0;u<f;u++,h=!1)!h&&au(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function Dfe(e){return function(t,n){let{$from:r,$to:o}=t.selection,s=r.blockRange(o,i=>i.childCount>0&&i.firstChild.type==e);return s?n?r.node(s.depth-1).type==e?Lfe(t,n,e,s):Ffe(t,n,s):!0:!1}}function Lfe(e,t,n,r){let o=e.tr,s=r.end,i=r.$to.end(r.depth);s<i&&(o.step(new Yt(s-1,i,s,i,new le(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Jl(o.doc.resolve(r.$from.pos),o.doc.resolve(i),r.depth));const a=ud(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(s,-1)-1);return mp(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),t(o.scrollIntoView()),!0}function Ffe(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,g=n.endIndex-1,v=n.startIndex;g>v;g--)p-=o.child(g).nodeSize,r.delete(p-1,p+1);let s=r.doc.resolve(n.start),i=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,i.content.append(l?q.empty:q.from(o))))return!1;let f=s.pos,h=f+i.nodeSize;return r.step(new Yt(f-(a?1:0),h+(l?1:0),f+1,h-1,new le((a?q.empty:q.from(o.copy(q.empty))).append(l?q.empty:q.from(o.copy(q.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var zfe=Object.defineProperty,$fe=Object.getOwnPropertyDescriptor,Mo=(e,t,n,r)=>{for(var o=r>1?void 0:r?$fe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&zfe(t,n,o),o};function e1(e){var t;return!!((t=e.spec.group)!=null&&t.includes(qe.ListContainerNode))}function Bfe(e){var t;return!!((t=e.spec.group)!=null&&t.includes(qe.ListItemNode))}function Wa(e){return e1(e.type)}function Oa(e){return Bfe(e.type)}function lE(e,t){return n=>{const{dispatch:r,tr:o}=n,s=Gk(o,n.state),{$from:i,$to:a}=o.selection,l=i.blockRange(a);if(!l)return!1;const c=Iy({predicate:u=>e1(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return Y4(t)(n);if(e1(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):Vfe(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return Rfe(e)(s,r)}}function G4(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var p,g;const s=dre(e,o.schema),{$from:i,$to:a}=n.selection;if(Ly(n.selection)&&n.selection.node.isBlock||i.depth<2||!i.sameParent(a))return!1;const l=i.node(-1);if(l.type!==s)return!1;if(i.parent.content.size===0&&i.node(-1).childCount===i.indexAfter(-1)){if(i.depth===2||i.node(-3).type!==s||i.index(-2)!==i.node(-2).childCount-1)return!1;if(r){const v=i.index(-1)>0;let y=q.empty;for(let w=i.depth-(v?1:2);w>=i.depth-3;w--)y=q.from(i.node(w).copy(y));const x=((p=s.contentMatch.defaultType)==null?void 0:p.createAndFill())||void 0;y=y.append(q.from(s.createAndFill(null,x)||void 0));const b=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;n.replace(i.before(v?void 0:-1),i.after(-b),new le(y,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(i.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&i.sameParent(a)&&a.pos===a.end()){if(r){const v=i.after(-1),y=((g=s.contentMatch.defaultType)==null?void 0:g.createAndFill())||void 0,x=s.createAndFill(null,y);x&&(n.insert(v,x),n.setSelection(Ve.near(n.doc.resolve(v+1)))),n.delete(i.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===i.end()?l.contentMatchAt(0).defaultType:null,f={...i.node().attrs};n.delete(i.pos,a.pos);const h=u?[{type:s,attrs:c},{type:u,attrs:f}]:[{type:s,attrs:c}];return au(n.doc,i.pos,2)?(r&&r(n.split(i.pos,2,h).scrollIntoView()),!0):!1}}function Vfe(e,t,n,r){const o=t.node,s=e.doc.resolve(t.start),i=s.node(-1),a=s.index(-1);if(!i||!i.canReplace(a,a+1,q.from(n.create())))return!1;const l=[];for(let p=0;p<o.childCount;p++){const g=o.child(p);if(!r.validContent(g.content))return!1;const v=r.createChecked(null,g.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,f=u+o.nodeSize,h=e.selection.from;return e.replaceRangeWith(u,f,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(h))),!0}function Ufe({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,s=n.doc.slice(r.start,r.end);if(o.type===e&&((l=s.content.firstChild)==null?void 0:l.type)===t)return!1;const i=[];for(let c=0;c<s.content.childCount;c++){const u=s.content.child(c);if(!t.validContent(u.content))return!1;const f=t.createChecked(null,u.content);i.push(f)}const a=e.createChecked(null,i);return n.replaceRange(r.start,r.end,new le(q.from(a),0,0)),!0}function Vu({listType:e,itemType:t,tr:n}){const r=yv(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:s,to:i}=n.selection;return Ufe({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Ve.between(n.doc.resolve(o?s:s+2),n.doc.resolve(o?i:i+2))),n.scrollIntoView(),!0):!1}function Wfe(e,t,n){const r=e.tr,o=n.parent,s=r.mapping.maps.length;for(let g=n.end,v=n.endIndex-1,y=n.startIndex;v>y;v--)g-=o.child(v).nodeSize,r.delete(g-1,g+1);const i=r.doc.resolve(n.start),a=i.nodeAfter;if(!a||r.mapping.slice(s).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=i.node(-1),f=i.index(-1);if(!u.canReplace(f+(l?0:1),f+1,a.content.append(c?q.empty:q.from(o))))return!1;const h=i.pos,p=h+a.nodeSize;return r.step(new Yt(h-(l?1:0),p+(c?1:0),h+1,p-1,new le((l?q.empty:q.from(o.copy(q.empty))).append(c?q.empty:q.from(o.copy(q.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function q4(e,t){const n=t||e.selection.$from;let r=[],o,s,i,a;for(let c=n.depth;c>=0;c--){if(s=n.node(c),o=n.index(c),i=s.maybeChild(o-1),a=s.maybeChild(o),i&&a&&i.type.name===a.type.name&&Wa(i)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),i=s.maybeChild(o-1),a=s.maybeChild(o),i&&a&&i.type.name===a.type.name&&Wa(i)){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)mp(e.doc,c)&&(e.join(c),l=!0);return l}function Y4(e){return t=>{const{dispatch:n,tr:r}=t,o=Gk(r,t.state),s=Hfe(e,r.selection);return s?(n&&Wfe(o,n,s),!0):!1}}function Hfe(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,s=>{var i;return((i=s.firstChild)==null?void 0:i.type)===e})}function yv(e){const{$from:t,$to:n}=e;return t.blockRange(n,Wa)}function Kfe(e){const t=e.selection.$from,n=t.blockRange();if(!n||!Oa(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),s=t.index(n.depth-1),i=t.index(n.depth-2),a=r.maybeChild(i-1),l=a==null?void 0:a.lastChild;if(o!==0||s!==0)return!1;if(a&&Wa(a)&&l&&Oa(l))return Vu({listType:a.type,itemType:l.type,tr:e});if(Oa(r)){const c=r,u=t.node(n.depth-3);if(Wa(u))return Vu({listType:u.type,itemType:c.type,tr:e})}return!1}function hT({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!Oa(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;Kfe(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!Oa(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),s=t.index(n.depth-2),i=n.depth-2>=1&&Oa(t.node(n.depth-2));r===0&&o===0&&s<=1&&i&&Dfe(n.parent.type)(e.state,e.dispatch)}return e4(e.state,e.dispatch,e),!0}function J4({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(Ua.LIST_ITEM_MARKER_CONTAINER),o.append(t);const s=document.createElement("div"),i=document.createElement("li");i.classList.add(Ua.LIST_ITEM_WITH_CUSTOM_MARKER),i.append(o),i.append(s);const a=l=>l.type!==e.type?!1:(e=l,n(e,i),r(e,t),!0);return a(e),{dom:i,contentDOM:s,update:a}}function Gfe(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!Oa(n)||!Wa(r)?!1:{parentItem:n,parentList:r}}function qfe(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,s=t.$to.end(t.depth);return o<s?(e.step(new Yt(o-1,s,o,s,new le(q.from(r.type.create(null,n.copy())),1,0),1,!0)),new Jl(e.doc.resolve(t.$from.pos),e.doc.resolve(s),t.depth)):t}function Yfe(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,s=t.$to.end(t.depth-1);return o+1<s?(e.step(new Yt(o-1,s,o+1,s,new le(q.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new Jl(e.selection.$from,e.selection.$to,t.depth)):t}function Jfe(e,t,n,r){return Vu({listType:n.type,itemType:r.type,tr:e})?new Jl(e.selection.$from,e.selection.$to,t.depth):t}function Xfe(e){let t=yv(e.selection);if(!t)return!1;const n=Gfe(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=qfe(e,t),t=Yfe(e,t),t=Jfe(e,t,o,r);const s=ud(t);return typeof s!="number"||(e.lift(t,s),t=yv(e.selection),t&&q4(e,e.doc.resolve(t.end-2))),!0}var Zfe=({tr:e,dispatch:t})=>Xfe(e)?(t==null||t(e.scrollIntoView()),!0):!1;function Qfe(e,t,n){let r,o,s,i;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,i=a.resolve(n.start).start(n.depth),s=i+1;for(let l=0;l<n.startIndex-1;l++)s+=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),!Wa(o))return!1;i=u+1;for(let f=0;f<l-1;f++)i+=c.child(f).nodeSize;if(r=o.child(o.childCount-1),s=i+o.nodeSize-r.nodeSize-1,!Oa(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:s,previousListStart:i}}function ehe(e,t,n){let r,o;const s=n.start,i=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return i+1>=a?(r=e.slice(s,a),o=null):(r=e.slice(s,i),o=e.slice(i+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function the(e){const{$from:t,$to:n}=e.selection,r=yv(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!Wa(o))return!1;const s=Qfe(o,t,r);if(!s)return!1;const{previousItem:i,previousList:a,previousItemStart:l}=s,{selectedSlice:c,unselectedSlice:u}=ehe(e.doc,n,r),f=i.content.append(q.fromArray([o.copy(c.content)])).append(u?u.content:q.empty);e.deleteRange(r.start,r.end);const h=l+i.nodeSize-2,p=i.copy(f);return p.check(),e.replaceRangeWith(l-1,h+1,p),e.setSelection(a===o?Ve.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Ve.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var nhe=({tr:e,dispatch:t})=>the(e)?(t==null||t(e.scrollIntoView()),!0):!1,X4=class extends It{get name(){return"listItemShared"}createKeymap(){const e={Tab:nhe,"Shift-Tab":Zfe,Backspace:hT,"Mod-Backspace":hT};if(Ba.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 q4(r)?r:null}}}},Uu=class extends jo{get name(){return"listItem"}createTags(){return[qe.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:wt.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(Ua.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),s=Ae.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(s)),this.store.commands.toggleListItemClosed(),!0}),J4({mark:r,node:e,updateDOM:rhe,updateMark:ohe})}:{}}createKeymap(){return{Enter:G4(this.type)}}createExtensions(){return[new X4]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!Ly(n)||n.node.type.name!==this.name)return!1;const{node:o,from:s}=n;return e=rQ(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(s,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return Y4(e??this.type)}};Mo([Ee()],Uu.prototype,"toggleListItemClosed",1);Mo([Ee()],Uu.prototype,"liftListItemOutOfList",1);Uu=Mo([dt({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],Uu);function rhe(e,t){e.attrs.closed?t.classList.add(Ua.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(Ua.COLLAPSIBLE_LIST_ITEM_CLOSED)}function ohe(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var Mh=class extends jo{get name(){return"bulletList"}createTags(){return[qe.Block,qe.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(),s=t.state.doc.resolve(o+1),i=s.node(s.depth-1);if(!(((c=i==null?void 0:i.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(Ua.LIST_SPINE),u.addEventListener("click",f=>{const h=n(),p=t.state.doc.resolve(h+1),g=p.start(p.depth-1),v=Ae.create(t.state.doc,g-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),f.preventDefault(),f.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(Ua.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new Uu({priority:wt.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return lE(this.type,zt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[Dk(e,this.type),new Oo(e,(t,n,r,o)=>{const s=t.tr;return s.deleteRange(r,o),Vu({listType:this.type,itemType:zt(this.store.schema.nodes,"listItem"),tr:s})?s:null})]}};Mo([Ee({icon:"listUnordered",label:({t:e})=>e(Ik.BULLET_LIST_LABEL)})],Mh.prototype,"toggleBulletList",1);Mo([io({shortcut:oe.BulletList,command:"toggleBulletList"})],Mh.prototype,"listShortcut",1);Mh=Mo([dt({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],Mh);var Rh=class extends jo{get name(){return"orderedList"}createTags(){return[qe.Block,qe.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>js(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 Uu({priority:wt.Low})]}toggleOrderedList(){return lE(this.type,zt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[Dk(e,this.type,t=>({order:+zt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+zt(t,1)),new Oo(e,(t,n,r,o)=>{const s=t.tr;if(s.deleteRange(r,o),!Vu({listType:this.type,itemType:zt(this.store.schema.nodes,"listItem"),tr:s}))return null;const a=+zt(n,1);if(a!==1){const l=Ch({selection:s.selection,types:this.type});l&&s.setNodeMarkup(l.pos,void 0,{order:a})}return s})]}};Mo([Ee({icon:"listOrdered",label:({t:e})=>e(Ik.ORDERED_LIST_LABEL)})],Rh.prototype,"toggleOrderedList",1);Mo([io({shortcut:oe.OrderedList,command:"toggleOrderedList"})],Rh.prototype,"listShortcut",1);Rh=Mo([dt({})],Rh);var Z4=class extends jo{get name(){return"taskListItem"}createTags(){return[qe.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 js(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:wt.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(Ua.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),s=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:s})}),r.checked=e.attrs.checked,J4({node:e,mark:r,updateDOM:she,updateMark:ihe})}}createKeymap(){return{Enter:G4(this.type)}}createExtensions(){return[new X4]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const s=Ch({selection:n??r.selection.$from,types:this.type});if(!s)return!1;const{node:i,pos:a}=s,l={...i.attrs,checked:t??!i.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[Dk(e,this.type,t=>({checked:["x","X"].includes(zf(t,2))})),new Oo(e,(t,n,r,o)=>{const s=t.tr;if(s.deleteRange(r,o),!Vu({listType:zt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:s}))return null;const a=["x","X"].includes(zf(n,2));if(a){const l=Ch({selection:s.selection,types:this.type});l&&s.setNodeMarkup(l.pos,void 0,{checked:a})}return s})]}};Mo([Ee()],Z4.prototype,"toggleCheckboxChecked",1);function she(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function ihe(e,t){t.checked=!!e.attrs.checked}var Q4=class extends jo{get name(){return"taskList"}createTags(){return[qe.Block,qe.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:wt.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new Z4({})]}toggleTaskList(){return lE(this.type,zt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};Mo([Ee({icon:"checkboxMultipleLine",label:({t:e})=>e(Ik.TASK_LIST_LABEL)})],Q4.prototype,"toggleTaskList",1);Mo([io({shortcut:oe.TaskList,command:"toggleTaskList"})],Q4.prototype,"listShortcut",1);var M0="rovingFocusGroup.onEntryFocus",ahe={bubbles:!1,cancelable:!0},wp="RovingFocusGroup",[t1,eF,lhe]=py(wp),[che,tF]=dr(wp,[lhe]),[uhe,dhe]=che(wp),nF=m.forwardRef((e,t)=>d.jsx(t1.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(t1.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(fhe,{...e,ref:t})})}));nF.displayName=wp;var fhe=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,h=m.useRef(null),p=Ue(t,h),g=np(s),[v,y]=Zr({prop:i,defaultProp:a??null,onChange:l,caller:wp}),[x,b]=m.useState(!1),w=An(c),E=eF(n),C=m.useRef(!1),[_,N]=m.useState(0);return m.useEffect(()=>{const P=h.current;if(P)return P.addEventListener(M0,w),()=>P.removeEventListener(M0,w)},[w]),d.jsx(uhe,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(P=>y(P),[y]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>N(P=>P+1),[]),onFocusableItemRemove:m.useCallback(()=>N(P=>P-1),[]),children:d.jsx(Oe.div,{tabIndex:x||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{C.current=!0}),onFocus:ne(e.onFocus,P=>{const j=!C.current;if(P.target===P.currentTarget&&j&&!x){const A=new CustomEvent(M0,ahe);if(P.currentTarget.dispatchEvent(A),!A.defaultPrevented){const U=E().filter(H=>H.focusable),L=U.find(H=>H.active),K=U.find(H=>H.id===v),V=[L,K,...U].filter(Boolean).map(H=>H.ref.current);sF(V,u)}}C.current=!1}),onBlur:ne(e.onBlur,()=>b(!1))})})}),rF="RovingFocusGroupItem",oF=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,l=qr(),c=s||l,u=dhe(rF,n),f=u.currentTabStopId===c,h=eF(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:v}=u;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),d.jsx(t1.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:d.jsx(Oe.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:ne(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:ne(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:ne(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=mhe(y,u.orientation,u.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=h().filter(E=>E.focusable).map(E=>E.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const E=w.indexOf(y.currentTarget);w=u.loop?ghe(w,E+1):w.slice(E+1)}setTimeout(()=>sF(w))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:v!=null}):i})})});oF.displayName=rF;var hhe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function phe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mhe(e,t,n){const r=phe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return hhe[r]}function sF(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ghe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var vhe=nF,yhe=oF;function xhe(e){const t=bhe(e),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(She);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function bhe(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=Ehe(o),a=khe(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var whe=Symbol("radix.slottable");function She(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===whe}function khe(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Ehe(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 n1=["Enter"," "],Che=["ArrowDown","PageUp","Home"],iF=["ArrowUp","PageDown","End"],Nhe=[...Che,...iF],_he={ltr:[...n1,"ArrowRight"],rtl:[...n1,"ArrowLeft"]},Phe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sp="Menu",[Ah,The,Ohe]=py(Sp),[pc,aF]=dr(Sp,[Ohe,Ds,tF]),Ky=Ds(),lF=tF(),[jhe,mc]=pc(Sp),[Mhe,kp]=pc(Sp),cF=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=Ky(t),[l,c]=m.useState(null),u=m.useRef(!1),f=An(s),h=np(o);return m.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),d.jsx(Jh,{...a,children:d.jsx(jhe,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c,children:d.jsx(Mhe,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:i,children:r})})})};cF.displayName=Sp;var Rhe="MenuAnchor",cE=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ky(n);return d.jsx(Ju,{...o,...r,ref:t})});cE.displayName=Rhe;var uE="MenuPortal",[Ahe,uF]=pc(uE,{forceMount:void 0}),dF=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=mc(uE,t);return d.jsx(Ahe,{scope:t,forceMount:n,children:d.jsx(fn,{present:n||s.open,children:d.jsx(Xu,{asChild:!0,container:o,children:r})})})};dF.displayName=uE;var So="MenuContent",[Ihe,dE]=pc(So),fF=m.forwardRef((e,t)=>{const n=uF(So,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=mc(So,e.__scopeMenu),i=kp(So,e.__scopeMenu);return d.jsx(Ah.Provider,{scope:e.__scopeMenu,children:d.jsx(fn,{present:r||s.open,children:d.jsx(Ah.Slot,{scope:e.__scopeMenu,children:i.modal?d.jsx(Dhe,{...o,ref:t}):d.jsx(Lhe,{...o,ref:t})})})})}),Dhe=m.forwardRef((e,t)=>{const n=mc(So,e.__scopeMenu),r=m.useRef(null),o=Ue(t,r);return m.useEffect(()=>{const s=r.current;if(s)return uy(s)},[]),d.jsx(fE,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lhe=m.forwardRef((e,t)=>{const n=mc(So,e.__scopeMenu);return d.jsx(fE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Fhe=xhe("MenuContent.ScrollLock"),fE=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...v}=e,y=mc(So,n),x=kp(So,n),b=Ky(n),w=lF(n),E=The(n),[C,_]=m.useState(null),N=m.useRef(null),P=Ue(t,N,y.onContentChange),j=m.useRef(0),A=m.useRef(""),U=m.useRef(0),L=m.useRef(null),K=m.useRef("right"),W=m.useRef(0),V=g?op:m.Fragment,H=g?{as:Fhe,allowPinchZoom:!0}:void 0,z=$=>{var Z,Pe;const J=A.current+$,G=E().filter(De=>!De.disabled),ie=document.activeElement,Xe=(Z=G.find(De=>De.ref.current===ie))==null?void 0:Z.textValue,He=G.map(De=>De.textValue),ce=Jhe(He,J,Xe),pe=(Pe=G.find(De=>De.textValue===ce))==null?void 0:Pe.ref.current;(function De(ge){A.current=ge,window.clearTimeout(j.current),ge!==""&&(j.current=window.setTimeout(()=>De(""),1e3))})(J),pe&&setTimeout(()=>pe.focus())};m.useEffect(()=>()=>window.clearTimeout(j.current),[]),cy();const R=m.useCallback($=>{var G,ie;return K.current===((G=L.current)==null?void 0:G.side)&&Zhe($,(ie=L.current)==null?void 0:ie.area)},[]);return d.jsx(Ihe,{scope:n,searchRef:A,onItemEnter:m.useCallback($=>{R($)&&$.preventDefault()},[R]),onItemLeave:m.useCallback($=>{var J;R($)||((J=N.current)==null||J.focus(),_(null))},[R]),onTriggerLeave:m.useCallback($=>{R($)&&$.preventDefault()},[R]),pointerGraceTimerRef:U,onPointerGraceIntentChange:m.useCallback($=>{L.current=$},[]),children:d.jsx(V,{...H,children:d.jsx(rp,{asChild:!0,trapped:o,onMountAutoFocus:ne(s,$=>{var J;$.preventDefault(),(J=N.current)==null||J.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:d.jsx(lc,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:d.jsx(vhe,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:ne(l,$=>{x.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(Xh,{role:"menu","aria-orientation":"vertical","data-state":PF(y.open),"data-radix-menu-content":"",dir:x.dir,...b,...v,ref:P,style:{outline:"none",...v.style},onKeyDown:ne(v.onKeyDown,$=>{const G=$.target.closest("[data-radix-menu-content]")===$.currentTarget,ie=$.ctrlKey||$.altKey||$.metaKey,Xe=$.key.length===1;G&&($.key==="Tab"&&$.preventDefault(),!ie&&Xe&&z($.key));const He=N.current;if($.target!==He||!Nhe.includes($.key))return;$.preventDefault();const pe=E().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);iF.includes($.key)&&pe.reverse(),qhe(pe)}),onBlur:ne(e.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(j.current),A.current="")}),onPointerMove:ne(e.onPointerMove,Ih($=>{const J=$.target,G=W.current!==$.clientX;if($.currentTarget.contains(J)&&G){const ie=$.clientX>W.current?"right":"left";K.current=ie,W.current=$.clientX}}))})})})})})})});fF.displayName=So;var zhe="MenuGroup",hE=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(Oe.div,{role:"group",...r,ref:t})});hE.displayName=zhe;var $he="MenuLabel",hF=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(Oe.div,{...r,ref:t})});hF.displayName=$he;var xv="MenuItem",pT="menu.itemSelect",Gy=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=m.useRef(null),i=kp(xv,e.__scopeMenu),a=dE(xv,e.__scopeMenu),l=Ue(t,s),c=m.useRef(!1),u=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(pT,{bubbles:!0,cancelable:!0});f.addEventListener(pT,p=>r==null?void 0:r(p),{once:!0}),dR(f,h),h.defaultPrevented?c.current=!1:i.onClose()}};return d.jsx(pF,{...o,ref:l,disabled:n,onClick:ne(e.onClick,u),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),c.current=!0},onPointerUp:ne(e.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:ne(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||n1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Gy.displayName=xv;var pF=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=dE(xv,n),a=lF(n),l=m.useRef(null),c=Ue(t,l),[u,f]=m.useState(!1),[h,p]=m.useState("");return m.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[s.children]),d.jsx(Ah.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:d.jsx(yhe,{asChild:!0,...a,focusable:!r,children:d.jsx(Oe.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:ne(e.onPointerMove,Ih(g=>{r?i.onItemLeave(g):(i.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,Ih(g=>i.onItemLeave(g))),onFocus:ne(e.onFocus,()=>f(!0)),onBlur:ne(e.onBlur,()=>f(!1))})})})}),Bhe="MenuCheckboxItem",mF=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return d.jsx(bF,{scope:e.__scopeMenu,checked:n,children:d.jsx(Gy,{role:"menuitemcheckbox","aria-checked":bv(n)?"mixed":n,...o,ref:t,"data-state":mE(n),onSelect:ne(o.onSelect,()=>r==null?void 0:r(bv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});mF.displayName=Bhe;var gF="MenuRadioGroup",[Vhe,Uhe]=pc(gF,{value:void 0,onValueChange:()=>{}}),vF=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=An(r);return d.jsx(Vhe,{scope:e.__scopeMenu,value:n,onValueChange:s,children:d.jsx(hE,{...o,ref:t})})});vF.displayName=gF;var yF="MenuRadioItem",xF=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=Uhe(yF,e.__scopeMenu),s=n===o.value;return d.jsx(bF,{scope:e.__scopeMenu,checked:s,children:d.jsx(Gy,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":mE(s),onSelect:ne(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});xF.displayName=yF;var pE="MenuItemIndicator",[bF,Whe]=pc(pE,{checked:!1}),wF=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Whe(pE,n);return d.jsx(fn,{present:r||bv(s.checked)||s.checked===!0,children:d.jsx(Oe.span,{...o,ref:t,"data-state":mE(s.checked)})})});wF.displayName=pE;var Hhe="MenuSeparator",SF=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(Oe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});SF.displayName=Hhe;var Khe="MenuArrow",kF=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Ky(n);return d.jsx(Zh,{...o,...r,ref:t})});kF.displayName=Khe;var Ghe="MenuSub",[Yge,EF]=pc(Ghe),vf="MenuSubTrigger",CF=m.forwardRef((e,t)=>{const n=mc(vf,e.__scopeMenu),r=kp(vf,e.__scopeMenu),o=EF(vf,e.__scopeMenu),s=dE(vf,e.__scopeMenu),i=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=m.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return m.useEffect(()=>u,[u]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),d.jsx(cE,{asChild:!0,...c,children:d.jsx(pF,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":PF(n.open),...e,ref:As(t,o.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,Ih(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:ne(e.onPointerLeave,Ih(f=>{var p,g;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const v=(g=n.content)==null?void 0:g.dataset.side,y=v==="right",x=y?-5:5,b=h[y?"left":"right"],w=h[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+x,y:f.clientY},{x:b,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:b,y:h.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,f=>{var p;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||_he[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});CF.displayName=vf;var NF="MenuSubContent",_F=m.forwardRef((e,t)=>{const n=uF(So,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=mc(So,e.__scopeMenu),i=kp(So,e.__scopeMenu),a=EF(NF,e.__scopeMenu),l=m.useRef(null),c=Ue(t,l);return d.jsx(Ah.Provider,{scope:e.__scopeMenu,children:d.jsx(fn,{present:r||s.open,children:d.jsx(Ah.Slot,{scope:e.__scopeMenu,children:d.jsx(fE,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;i.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ne(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:ne(e.onKeyDown,u=>{var p;const f=u.currentTarget.contains(u.target),h=Phe[i.dir].includes(u.key);f&&h&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});_F.displayName=NF;function PF(e){return e?"open":"closed"}function bv(e){return e==="indeterminate"}function mE(e){return bv(e)?"indeterminate":e?"checked":"unchecked"}function qhe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Yhe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Jhe(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Yhe(e,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Xhe(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],l=t[i],c=a.x,u=a.y,f=l.x,h=l.y;u>r!=h>r&&n<(f-c)*(r-u)/(h-u)+c&&(o=!o)}return o}function Zhe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Xhe(n,t)}function Ih(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Qhe=cF,epe=cE,tpe=dF,npe=fF,rpe=hE,ope=hF,spe=Gy,ipe=mF,ape=vF,lpe=xF,cpe=wF,upe=SF,dpe=kF,fpe=CF,hpe=_F,qy="DropdownMenu",[ppe]=dr(qy,[aF]),fr=aF(),[mpe,TF]=ppe(qy),OF=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,l=fr(t),c=m.useRef(null),[u,f]=Zr({prop:o,defaultProp:s??!1,onChange:i,caller:qy});return d.jsx(mpe,{scope:t,triggerId:qr(),triggerRef:c,contentId:qr(),open:u,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:a,children:d.jsx(Qhe,{...l,open:u,onOpenChange:f,dir:r,modal:a,children:n})})};OF.displayName=qy;var jF="DropdownMenuTrigger",MF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=TF(jF,n),i=fr(n);return d.jsx(epe,{asChild:!0,...i,children:d.jsx(Oe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:As(t,s.triggerRef),onPointerDown:ne(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ne(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});MF.displayName=jF;var gpe="DropdownMenuPortal",RF=e=>{const{__scopeDropdownMenu:t,...n}=e,r=fr(t);return d.jsx(tpe,{...r,...n})};RF.displayName=gpe;var AF="DropdownMenuContent",IF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=TF(AF,n),s=fr(n),i=m.useRef(!1);return d.jsx(npe,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var l;i.current||(l=o.triggerRef.current)==null||l.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(i.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)"}})});IF.displayName=AF;var vpe="DropdownMenuGroup",ype=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(rpe,{...o,...r,ref:t})});ype.displayName=vpe;var xpe="DropdownMenuLabel",DF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(ope,{...o,...r,ref:t})});DF.displayName=xpe;var bpe="DropdownMenuItem",LF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(spe,{...o,...r,ref:t})});LF.displayName=bpe;var wpe="DropdownMenuCheckboxItem",FF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(ipe,{...o,...r,ref:t})});FF.displayName=wpe;var Spe="DropdownMenuRadioGroup",kpe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(ape,{...o,...r,ref:t})});kpe.displayName=Spe;var Epe="DropdownMenuRadioItem",zF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(lpe,{...o,...r,ref:t})});zF.displayName=Epe;var Cpe="DropdownMenuItemIndicator",$F=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(cpe,{...o,...r,ref:t})});$F.displayName=Cpe;var Npe="DropdownMenuSeparator",BF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(upe,{...o,...r,ref:t})});BF.displayName=Npe;var _pe="DropdownMenuArrow",Ppe=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(dpe,{...o,...r,ref:t})});Ppe.displayName=_pe;var Tpe="DropdownMenuSubTrigger",VF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(fpe,{...o,...r,ref:t})});VF.displayName=Tpe;var Ope="DropdownMenuSubContent",UF=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=fr(n);return d.jsx(hpe,{...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)"}})});UF.displayName=Ope;var jpe=OF,Mpe=MF,Rpe=RF,WF=IF,HF=DF,KF=LF,GF=FF,qF=zF,YF=$F,JF=BF,XF=VF,ZF=UF;const Ape=jpe,Ipe=Mpe,Dpe=m.forwardRef(({className:e,inset:t,children:n,...r},o)=>d.jsxs(XF,{ref:o,className:de("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,d.jsx(rd,{className:"ml-auto w-4 h-4"})]}));Dpe.displayName=XF.displayName;const Lpe=m.forwardRef(({className:e,...t},n)=>d.jsx(ZF,{ref:n,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary p-1 text-fg-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}));Lpe.displayName=ZF.displayName;const QF=m.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>d.jsx(Rpe,{container:n,children:d.jsx(WF,{ref:o,sideOffset:t,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary p-1 text-fg-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})}));QF.displayName=WF.displayName;const qi=m.forwardRef(({className:e,inset:t,...n},r)=>d.jsx(KF,{ref:r,className:de("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-primary focus:text-fg-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));qi.displayName=KF.displayName;const Fpe=m.forwardRef(({className:e,children:t,checked:n,...r},o)=>d.jsxs(GF,{ref:o,className:de("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:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(YF,{children:d.jsx(td,{className:"w-4 h-4"})})}),t]}));Fpe.displayName=GF.displayName;const zpe=m.forwardRef(({className:e,children:t,...n},r)=>d.jsxs(qF,{ref:r,className:de("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:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(YF,{children:d.jsx(aK,{className:"w-2 h-2 fill-current"})})}),t]}));zpe.displayName=qF.displayName;const $pe=m.forwardRef(({className:e,inset:t,...n},r)=>d.jsx(HF,{ref:r,className:de("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));$pe.displayName=HF.displayName;const Bpe=m.forwardRef(({className:e,...t},n)=>d.jsx(JF,{ref:n,className:de("-mx-1 my-1 h-px bg-muted",e),...t}));Bpe.displayName=JF.displayName;var Vpe=Object.defineProperty,Upe=Object.getOwnPropertyDescriptor,Ep=(e,t,n,r)=>{for(var o=r>1?void 0:r?Upe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Vpe(t,n,o),o},Wpe={icon:"bold",label:({t:e})=>e(J_.LABEL),description:({t:e})=>e(J_.DESCRIPTION)},rc=class extends xp{get name(){return"bold"}createTags(){return[qe.FormattingMark,qe.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>js(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>Be(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[dv({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return _h({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=No(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}=No(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)}};Ep([Ee(Wpe)],rc.prototype,"toggleBold",1);Ep([Ee()],rc.prototype,"setBold",1);Ep([Ee()],rc.prototype,"removeBold",1);Ep([io({shortcut:oe.Bold,command:"toggleBold"})],rc.prototype,"shortcut",1);rc=Ep([dt({defaultOptions:{weight:void 0},staticKeys:["weight"]})],rc);var Hpe=Object.defineProperty,Kpe=Object.getOwnPropertyDescriptor,gE=(e,t,n,r)=>{for(var o=r>1?void 0:r?Kpe(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Hpe(t,n,o),o},Gpe={icon:"italic",label:({t:e})=>e(X_.LABEL),description:({t:e})=>e(X_.DESCRIPTION)},Dh=class extends xp{get name(){return"italic"}createTags(){return[qe.FontStyle,qe.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":_h({type:this.type})}}createInputRules(){return[dv({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),dv({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 _h({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};gE([Ee(Gpe)],Dh.prototype,"toggleItalic",1);gE([io({shortcut:oe.Italic,command:"toggleItalic"})],Dh.prototype,"shortcut",1);Dh=gE([dt({})],Dh);var qpe=Object.defineProperty,Ype=Object.getOwnPropertyDescriptor,vE=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ype(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&qpe(t,n,o),o},Jpe={icon:"strikethrough",label:({t:e})=>e(Z_.LABEL),description:({t:e})=>e(Z_.DESCRIPTION)},Lh=class extends xp{get name(){return"strike"}createTags(){return[qe.FontStyle,qe.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 _h({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[dv({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};vE([Ee(Jpe)],Lh.prototype,"toggleStrike",1);vE([io({shortcut:oe.Strike,command:"toggleStrike"})],Lh.prototype,"shortcut",1);Lh=vE([dt({})],Lh);var Xpe='<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>',Zpe='<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>',Qpe=encodeURIComponent(Xpe),eme=encodeURIComponent(Zpe),er,kT,tme=(kT=class{constructor(e){Kt(this,"dom");Un(this,er);Kt(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,rt(this,er,n),this.type=e,this.createHandle(e)}createHandle(e){switch(Kn(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),Kn(he(this,er),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),he(this,er).dataset.dragging="",e){case 0:Kn(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Kn(he(this,er),{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:Kn(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),Kn(he(this,er),{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:Kn(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),Kn(he(this,er),{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:Kn(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),Kn(he(this,er),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${eme}") `});break;case 4:Kn(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),Kn(he(this,er),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${Qpe}") `});break}this.dom.append(he(this,er))}setHandleVisibility(e){const t=e||!!he(this,er).dataset.dragging;he(this,er).style.opacity=t?"1":"0"}dataSetDragging(e){he(this,er).dataset.dragging=e?"true":""}},er=new WeakMap,kT),im=50,e3=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(e3||{}),sa,ia,aa,hs,la,ET,nme=(ET=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:s}){Kt(this,"dom");Un(this,sa);Un(this,ia);Un(this,aa,[]);Kt(this,"aspectRatio");Un(this,hs);Un(this,la);const i=this.createWrapper(e,s),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(h=>new tme(h));for(const h of c){const p=g=>{this.startResizing(g,t,n,h)};h.dom.addEventListener("mousedown",p),he(this,aa).push(()=>h.dom.removeEventListener("mousedown",p)),i.append(h.dom)}const u=()=>{c.forEach(h=>h.setHandleVisibility(!0))},f=()=>{c.forEach(h=>h.setHandleVisibility(!1))};i.addEventListener("mouseover",u),i.addEventListener("mouseout",f),he(this,aa).push(()=>i.removeEventListener("mouseover",u),()=>i.removeEventListener("mouseout",f)),i.append(a),this.dom=i,rt(this,ia,e),rt(this,sa,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?Kn(n,{width:mT(t.width),aspectRatio:`${t.width} / ${t.height}`}):Kn(n,{width:mT(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),Kn(n,{maxWidth:"100%",minWidth:`${im}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,f;e.preventDefault(),r.dataSetDragging(!0),he(this,sa).style.pointerEvents="none";const o=e.pageX,s=e.pageY,i=((u=he(this,sa))==null?void 0:u.getBoundingClientRect().width)||0,a=((f=he(this,sa))==null?void 0:f.getBoundingClientRect().height)||0,l=vw(100,!1,h=>{const p=h.pageX,g=h.pageY,v=p-o,y=g-s;let x=null,b=null;if(this.aspectRatio===0&&i&&a)switch(r.type){case 0:case 3:x=i+v,b=a/i*x;break;case 1:case 4:x=i-v,b=a/i*x;break;case 2:b=a+y,x=i/a*b;break}else if(this.aspectRatio===1)switch(r.type){case 0:x=i+v;break;case 1:x=i-v;break;case 2:b=a+y;break;case 3:x=i+v,b=a+y;break;case 4:x=i-v,b=a+y;break}typeof x=="number"&&x<im&&(this.aspectRatio===0&&i&&a?(x=im,b=a/i*x):this.aspectRatio===1&&(x=im)),x&&(rt(this,hs,Math.round(x)),this.dom.style.width=`${he(this,hs)}px`),b&&rt(this,la,Math.round(b)),(x||b)&&(this.dom.style.aspectRatio=`${he(this,hs)} / ${he(this,la)}`)}),c=h=>{h.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),he(this,sa).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const p=n(),g=t.state.tr.setNodeMarkup(p,void 0,{...he(this,ia).attrs,width:he(this,hs),height:he(this,la)});t.dispatch(g)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),he(this,aa).push(()=>document.removeEventListener("mousemove",l)),he(this,aa).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==he(this,ia).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==he(this,hs)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==he(this,hs)&&e.attrs.height!==he(this,la)||!rme(he(this,ia),e,["width","height"])?!1:(rt(this,ia,e),rt(this,hs,e.attrs.width),rt(this,la,e.attrs.height),!0)}destroy(){he(this,aa).forEach(e=>e())}},sa=new WeakMap,ia=new WeakMap,aa=new WeakMap,hs=new WeakMap,la=new WeakMap,ET);function rme(e,t,n){return e===t||ome(e,t,n)&&e.content.eq(t.content)}function ome(e,t,n){const r=e.attrs,o=t.attrs,s={};for(const a of n)s[a]=null;e.attrs={...r,...s},t.attrs={...o,...s};const i=e.sameMarkup(t);return e.attrs=r,t.attrs=o,i}function mT(e){return typeof e=="number"?`${e}px`:e||void 0}var sme=Object.defineProperty,ime=Object.getOwnPropertyDescriptor,yE=(e,t,n,r)=>{for(var o=r>1?void 0:r?ime(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&sme(t,n,o),o},ame=class extends nme{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:e3.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),Kn(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},Fh=class extends jo{get name(){return"image"}createTags(){return[qe.InlineNode,qe.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(js(r)){const s=cme({element:r,parse:e.parse});return n&&((o=s.src)!=null&&o.startsWith("file:///"))?!1:s}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=GL(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:s}=No(t??n.selection,n.doc),i=this.type.create(e);return r==null||r(n.replaceRangeWith(o,s,i)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return s=>{const{tr:i}=s;let a=i.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,f)=>{n(l,c,u,f)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=BD(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(s)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&fme(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:s,chain:i}=this.store,a=e.map((u,f)=>({file:u,progress:h=>{s.updatePlaceholder(l[f],h)}})),l=o(a);eo(n)&&i.selectText(n);for(const u of l)i.uploadImage(u);return i.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 ame(e,t,n):{}}};yE([Ee()],Fh.prototype,"insertImage",1);yE([Ee()],Fh.prototype,"uploadImage",1);Fh=yE([dt({defaultOptions:{createPlaceholder:ume,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:dme,enableResizing:!1,preferPastedTextContent:!0}})],Fh);function lme(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function cme({element:e,parse:t}){const{width:n,height:r}=lme(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 ume(e,t){const n=document.createElement("div");return n.classList.add(Ide.IMAGE_LOADER),n}function dme(e){Me(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(s=>{const i=new FileReader;i.addEventListener("load",a=>{var l;t+=1,o(t/e.length),s({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),i.readAsDataURL(r)}));return n}function fme(e){return e.clipboardData!==void 0}function hme(e={}){return new Ni({view(t){return new pme(t,e)}})}class pme{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 s=i=>{this[o](i)};return t.dom.addEventListener(o,s),{name:o,handler:s}})}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,o=this.editorView.dom,s=o.getBoundingClientRect(),i=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(n){let f=t.nodeBefore,h=t.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let g=p.getBoundingClientRect(),v=f?g.bottom:g.top;f&&h&&(v=(v+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:g.left,right:g.right,top:v-y,bottom:v+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*i;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let f=l.getBoundingClientRect(),h=f.width/l.offsetWidth,p=f.height/l.offsetHeight;c=f.left-l.scrollLeft*h,u=f.top-l.scrollTop*p}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/a+"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,s=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!s){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=VD(this.editorView.state.doc,i,this.editorView.dragging.slice);a!=null&&(i=a)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}var mme=Object.getOwnPropertyDescriptor,gme=(e,t,n,r)=>{for(var o=r>1?void 0:r?mme(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=i(o)||o);return o},r1=class extends It{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[hme({color:e,width:t})]}};r1=gme([dt({defaultOptions:{color:"black",width:1}})],r1);var vme=Object.defineProperty,yme=Object.getOwnPropertyDescriptor,t3=(e,t,n,r)=>{for(var o=r>1?void 0:r?yme(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&vme(t,n,o),o},{LABEL:xme}=_ee,bme={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({...xme,values:{level:t==null?void 0:t.level}})},wme=[oe.H1,oe.H2,oe.H3,oe.H4,oe.H5,oe.H6],wv=class extends jo{get name(){return"heading"}createTags(){return[qe.Block,qe.TextBlock,qe.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 JL({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension(Ze),n=Ne(),r=[];for(const o of this.options.levels){const s=wme[o-1]??oe.H1;n[s]=uv(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(s)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>Gee(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}))}};t3([Ee(bme)],wv.prototype,"toggleHeading",1);wv=t3([dt({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],wv);var n3={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:r5,function(){return function(n){function r(s){if(o[s])return o[s].exports;var i=o[s]={i:s,l:!1,exports:{}};return n[s].call(i.exports,i,i.exports,r),i.l=!0,i.exports}var o={};return r.m=n,r.c=o,r.d=function(s,i,a){r.o(s,i)||Object.defineProperty(s,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(s){var i=s&&s.__esModule?function(){return s.default}:function(){return s};return r.d(i,"a",i),i},r.o=function(s,i){return Object.prototype.hasOwnProperty.call(s,i)},r.p="",r(r.s=0)}([function(n,r,o){function s(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function i(c){typeof c!="string"&&s();for(var u=0,f=0,h=0,p=c.length,g=0;p--&&++g&&!(u&&-1<a.indexOf(c[g]));)c[g]==="."&&(++u,f=g);for(u=g,g=f;g--;)if(l.indexOf(c[g])!==-1){h=g+1;break}return 2>h?"":c.slice(h,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return i(c);if(Array.isArray(c)){var u=[],f,h=0;for(f=c.length;h<f;h++)u.push(i(c[h]));return u}s()}}])})})(n3);var Sme=n3.exports;const kme=Ha(Sme);var Eme=Object.defineProperty,Cme=Object.getOwnPropertyDescriptor,Cp=(e,t,n,r)=>{for(var o=r>1?void 0:r?Cme(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Eme(t,n,o),o},Nme=["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"],gT="updateLink",_me=/(?:(?:(?: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,oc=class extends xp{constructor(){super(...arguments);Kt(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[qe.Link,qe.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=s=>{const{defaultTarget:i,supportedTargets:a}=this.options,l=i?[...a,i]:a;return s&&ns(l,s)?{target:s}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:s=>{if(!js(s))return!1;const i=s.getAttribute("href"),a=s.textContent,l=this.options.autoLink&&(s.hasAttribute(r)||i===a||(i==null?void 0:i.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(s),href:i,auto:l,...o(s.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:s=>{const{auto:i,target:a,...l}=GL(s.attrs,t),c=s.attrs.auto?{[r]:""}:{};return["a",{...t.dom(s),...l,rel:"noopener noreferrer nofollow",...c,...o(s.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:s,$from:i}=t.selection,a=!1;const l=ki(i,this.type);if(s){const c=l??WL(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!(fc(o.selection)&&!Yk(o.selection)||mre(o.selection)||cv({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:gT,attrs:t,range:n}),Ire({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 cv({trState:r,type:this.type,...t})?ZL({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(zf(t)),auto:!n}),transformMatch:t=>{const n=zf(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,s={...o,...r};if(this.options.onClick(t,s))return!0;if(!this.store.view.editable)return;let i=!1;if(this.options.openLinkOnClick){i=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(i=!0,this.store.commands.selectText(r)),i}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(g=>!!g.getMeta(this.name)).forEach(g=>{const v=g.getMeta(this.name);if(v.command===gT){const{range:y,attrs:x}=v,{selection:b,doc:w}=r,E={range:y,selection:b,doc:w,attrs:x},{from:C,to:_}=y??b;this.options.onUpdateLink(w.textBetween(C,_),E)}}),!this.options.autoLink||Xw(n)-Xw(r)===1||!t.some(g=>g.docChanged))return;const a=nre(t,n),l=bre(a,[Yt,yn]),{mapping:c}=a,{tr:u,doc:f}=r,{updateLink:h,removeLink:p}=this.store.chain(u);if(l.forEach(({prevFrom:g,prevTo:v,from:y,to:x})=>{const b=[],w=x-y===2,E=this.getLinkMarksInRange(n.doc,g,v,!0).filter(C=>C.mark.type===this.type).map(({from:C,to:_,text:N})=>({mappedFrom:c.map(C),mappedTo:c.map(_),text:N,from:C,to:_}));E.forEach(({mappedFrom:C,mappedTo:_,from:N,to:P},j)=>this.getLinkMarksInRange(f,C,_,!0).filter(A=>A.mark.type===this.type).forEach(A=>{const U=n.doc.textBetween(N,P,void 0," "),L=f.textBetween(A.from,A.to+1,void 0," ").trim(),K=this.isValidUrl(U);this.isValidUrl(L)||(K&&(p({from:A.from,to:A.to}).tr(),E.splice(j,1)),!w&&y===x&&this.findAutoLinks(L).map(V=>this.addLinkProperties({...V,from:C+V.start,to:C+V.end})).forEach(({attrs:V,range:H,text:z})=>{h(V,H).tr(),b.push({attrs:V,range:H,text:z})}))})),this.findTextBlocksInRange(f,{from:y,to:x}).forEach(({text:C,positionStart:_})=>{this.findAutoLinks(C).map(N=>this.addLinkProperties({...N,from:_+N.start+1,to:_+N.end+1})).filter(({range:N})=>{const P=y>=N.from&&y<=N.to,j=x>=N.from&&x<=N.to;return P||j||w}).filter(({range:N})=>this.getLinkMarksInRange(u.doc,N.from,N.to,!1).length===0).filter(({range:{from:N},text:P})=>!E.some(({text:j,mappedFrom:A})=>A===N&&j===P)).forEach(({attrs:N,text:P,range:j})=>{h(N,j).tr(),b.push({attrs:N,range:j,text:P})})}),window.requestAnimationFrame(()=>{b.forEach(({attrs:C,range:_,text:N})=>{const{doc:P,selection:j}=u;this.options.onUpdateLink(N,{attrs:C,doc:P,range:_,selection:j})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const s=[];if(n===r){const i=Math.max(n-1,0),a=t.resolve(i),l=ki(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&s.push(l)}else t.nodesBetween(n,r,(i,a)=>{const c=(i.marks??[]).find(({type:u,attrs:f})=>u===this.type&&f.auto===o);c&&s.push({from:a,to:a+i.nodeSize,mark:c,text:i.textContent})});return s}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,s)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:s})}),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 Oy(t,this.options.autoLinkRegex)){const o=zf(r);if(!o)continue;const s=this.buildHref(o);!this.isValidTLD(s)&&!s.startsWith("tel:")||n.push({text:o,href:s,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=kme(t);if(r==="")return!0;const o=fQ(r.split("."));return n.includes(o)}};Cp([io({shortcut:oe.InsertLink})],oc.prototype,"shortcut",1);Cp([Ee()],oc.prototype,"updateLink",1);Cp([Ee()],oc.prototype,"selectLink",1);Cp([Ee()],oc.prototype,"removeLink",1);oc=Cp([dt({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:_me,autoLinkAllowedTLDs:Nme,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:Pme},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:wt.Medium})],oc);function Pme({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var Tme=Object.defineProperty,Ome=Object.getOwnPropertyDescriptor,r3=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ome(t,n):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(r?i(t,n,o):i(o))||o);return r&&o&&Tme(t,n,o),o},Sv=class extends jo{get name(){return"hardBreak"}createTags(){return[qe.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
|
|
514
|
+
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=tre(Ff(r4),()=>(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}}};r3([Ee()],Sv.prototype,"insertHardBreak",1);Sv=r3([dt({defaultPriority:wt.Low})],Sv);const jme=()=>[new rc({}),new Dh,new Lh,new Fh({enableResizing:!1}),new r1({}),new wv({levels:[1,2,3,4,5,6],defaultLevel:1}),new Mh({}),new Rh,new oc({autoLink:!0}),new Sv].slice();function Mme(e){const{manager:t,state:n,setState:r}=Ofe({extensions:jme,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function Rme({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:s,debug:i,disabled:a,autoFocus:l}){const c=r&&Object.entries(r).some(([,p])=>p),[u,f]=m.useState(c),h=m.useMemo(()=>[Te("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[u]);return d.jsx("div",{autoFocus:l,onFocus:()=>{s&&s(!0)},onBlur:()=>{s&&s(!1)},className:Te("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:d.jsxs(Mfe,{manager:n,initialContent:e,state:t,classNames:h,onChange:o,editable:!a,children:[d.jsx(Ame,{hasOptions:c,options:r,debug:i,setShowToolbar:f}),d.jsx(Qw,{})]})})}const Ame=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,f,h,p,g,v,y,x,b,w,E,C,_,N,P,j,A,U,L,K,W,V,H,z,R,$;const o=H4(),s=bfe(),i=t||s.heading()||s.image()||s.link()||s.bulletList()||s.orderedList()||s.bold()||s.italic()||s.strike();m.useEffect(()=>{r(i)},[i]);const a=m.useRef(null);return d.jsxs("div",{children:[d.jsx("div",{className:"h-0",ref:a}),d.jsxs("div",{className:Te("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:!i}),children:[d.jsx("div",{className:"flex items-center justify-between",children:d.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)||((f=e==null?void 0:e.block)==null?void 0:f.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)||s.heading())&&d.jsxs(Ape,{children:[d.jsx(Ipe,{asChild:!0,className:"pr-4",children:d.jsxs("button",{children:[s.heading({level:1})&&d.jsx(LN,{size:22}),s.heading({level:2})&&d.jsx(FN,{size:22}),s.heading({level:3})&&d.jsx(zN,{size:22}),s.heading({level:4})&&d.jsx($N,{size:22}),s.heading({level:5})&&d.jsx(BN,{size:22}),s.heading({level:6})&&d.jsx(VN,{size:22}),!s.heading()&&"Normal"]})}),d.jsxs(QF,{container:a.current,children:[d.jsx(qi,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((g=e==null?void 0:e.block)==null?void 0:g.h1)&&d.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:d.jsx(LN,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&d.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:d.jsx(FN,{size:16})}),((y=e==null?void 0:e.block)==null?void 0:y.h3)&&d.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:d.jsx(zN,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h4)&&d.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:d.jsx($N,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h5)&&d.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:d.jsx(BN,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h6)&&d.jsx(qi,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:d.jsx(VN,{size:16})})]})]}),(((E=e==null?void 0:e.style)==null?void 0:E.bold)||s.bold())&&d.jsx(Tc,{icon:d.jsx(rK,{size:18}),stroke:3,isOption:(C=e==null?void 0:e.style)==null?void 0:C.bold,isActive:((_=e==null?void 0:e.style)==null?void 0:_.bold)||s.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((N=e==null?void 0:e.style)==null?void 0:N.lineThrough)||s.strike())&&d.jsx(Tc,{icon:d.jsx(jK,{size:18}),stroke:3,isOption:(P=e==null?void 0:e.style)==null?void 0:P.lineThrough,isActive:((j=e==null?void 0:e.style)==null?void 0:j.lineThrough)||s.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((A=e==null?void 0:e.style)==null?void 0:A.italic)||s.italic())&&d.jsx(Tc,{icon:d.jsx(gK,{size:18}),stroke:3,isOption:(U=e==null?void 0:e.style)==null?void 0:U.italic,isActive:((L=e==null?void 0:e.style)==null?void 0:L.italic)||s.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((K=e==null?void 0:e.block)==null?void 0:K.ul)||s.bulletList())&&d.jsx(Tc,{icon:d.jsx(gA,{size:18}),stroke:3,isActive:((W=e==null?void 0:e.block)==null?void 0:W.ul)||s.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((V=e==null?void 0:e.block)==null?void 0:V.ol)||s.orderedList())&&d.jsx(Tc,{icon:d.jsx(xK,{size:18}),stroke:3,isActive:((H=e==null?void 0:e.block)==null?void 0:H.ol)||s.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((z=e==null?void 0:e.inline)==null?void 0:z.a)||s.link())&&d.jsx(Tc,{icon:d.jsx(YS,{size:18}),stroke:3,isActive:((R=e==null?void 0:e.inline)==null?void 0:R.a)||s.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),((($=e==null?void 0:e.inline)==null?void 0:$.img)||s.image())&&d.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[d.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:J=>{YI(J).then(G=>{o.insertImage({src:G.src,width:G.width,height:G.height,fileName:Y.createFilename(G.src,G.filename??null,{width:G.width,height:G.height,mimeType:G.mimeType},G.fileHash)??void 0}).focus().run(),J.target.value=""})}}),d.jsx(mA,{size:18,className:`${s.image()&&"stroke-[3px]"}`})]}),n&&d.jsx("button",{onMouseDown:J=>J.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),d.jsx(Ime,{})]})]})};function Ime(){const e=H4(),[t,n]=m.useState(),r=wfe().link();return m.useEffect(()=>{const s=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(s)},[r==null?void 0:r.href]),r!==void 0?d.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[d.jsx("input",{className:"bg-transparent text-accent",onChange:s=>{n(s.target.value)},defaultValue:t,placeholder:"https://"}),d.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:d.jsx(td,{size:14})}),d.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:d.jsx(LK,{size:13})})]}):null}function Tc({stroke:e,isActive:t,onToggle:n,icon:r}){return d.jsx("button",{className:Te({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function Dme({path:e,autoFocus:t}){const n="richtext",r=Qu(),o=Vt(e),s=ht(e,n),i=$S(),a=BS(),l="data"in s?s.data:void 0,{manager:c}=Mme(l&&Wp(l)),u=m.useRef(!1),{patchPath:f,addPatch:h,addAndUploadPatchWithFileOps:p}=_n(e),[g,v]=m.useState(c.createState({content:l?Wp(l):void 0})),y="data"in s&&s.data,x="clientSideOnly"in s&&s.clientSideOnly;m.useEffect(()=>{x===!1&&v(E=>{try{const C=y?Wp(y):void 0,_=c.createState({content:C,selection:E.selection});return _.doc.eq(E.doc)?E:_}catch(C){return console.error("Error (re)creating editor state with selection, retrying without...",C),c.createState({content:y?Wp(y):void 0})}})},[y,x]);const b=m.useMemo(()=>{var C,_;if(!("data"in o&&o.data.type==="richtext"))return null;const E=o.data;return typeof((_=(C=E.options)==null?void 0:C.inline)==null?void 0:_.img)=="object"&&E.options.inline.img.remote&&i.status==="ready"&&(r!=null&&r.remoteHost)&&a?{publicProjectId:i.publicProjectId,bucket:a,coreVersion:i.coreVersion,schema:E.options.inline.img,remoteHost:r==null?void 0:r.remoteHost}:null},[o,i,r,a]);if(o.status==="error")return d.jsx(nn,{path:e,error:o.error,type:n});if(s.status==="error")return d.jsx(ut,{path:e,error:s.error,schema:o});if(s.status=="not-found"||o.status==="not-found")return d.jsx(zn,{path:e,type:n});if(o.status==="loading")return d.jsx(Et,{path:e,type:n});if(!("data"in s)||s.data===void 0)return d.jsx(Et,{path:e,type:n});if(o.data.type!==n)return d.jsx(Tr,{path:e,expectedType:n,actualType:o.data.type});const w=o.data;return r!=null&&r.remoteHost||console.warn("RichTextField: config.remoteHost is not set. Remote images will not work."),d.jsxs("div",{id:e,children:[d.jsx(Nr,{path:e}),d.jsx(Rme,{autoFocus:t,disabled:u.current,state:g,options:w.options,manager:c,onChange:async E=>{var _;const C=g==null?void 0:g.doc;if(!u.current&&(v(E.state),C&&!E.state.doc.eq(C))){const N=Lme(f,((_=r==null?void 0:r.files)==null?void 0:_.directory)??"/public/val",E.state.doc.toJSON(),b);N.some(P=>P.op==="file")?(u.current=!0,await p(N,"image",P=>{alert("Error uploading image. Please try again later."),console.error("Error uploading image",P)},(P,j,A,U)=>{console.log(`Uploading ${P}/${j} (${A}/${U})`)}).finally(()=>{u.current=!1})):h(N,"richtext")}}})]})}function Lme(e,t,n,r){const{blocks:o,files:s}=n?B6(n,t,r):{blocks:[],files:{}};return[{op:"replace",path:e,value:o},...Object.values(s).flatMap(({value:i,filePathOrRef:a,metadata:l,patchPaths:c})=>c.map(u=>({op:"file",path:e,filePath:a,value:i,metadata:l,nestedFilePath:u,remote:!!r})))]}function Fme({path:e}){const t=ht(e,"richtext");if(t.status==="error")return d.jsx(ut,{path:e,error:t.error});if(t.status=="not-found")return d.jsx(zn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return d.jsx(_r,{path:e});if(t.data===null)return d.jsx(Pr,{path:e});const n=zme(t.data);return n.status==="error"?d.jsx(ut,{path:e,error:n.error}):d.jsx("div",{className:"truncate",children:n.value})}function zme(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 xE({path:e}){const t=Vt(e),n=ht(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return d.jsx(_r,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return d.jsx(Pr,{path:e});if(r==="string")return d.jsx(lX,{path:e});if(r==="array")return d.jsx(Hme,{path:e});if(r==="boolean")return d.jsx(dX,{path:e});if(r==="number")return d.jsx(hX,{path:e});if(r==="union")return d.jsx(aZ,{path:e});if(r==="object")return d.jsx(nZ,{path:e});if(r==="image")return d.jsx(mZ,{path:e});if(r==="keyOf")return d.jsx(yZ,{path:e});if(r==="date")return d.jsx(bZ,{path:e});if(r==="literal")return d.jsx(wZ,{path:e});if(r==="record")return d.jsx(NZ,{path:e});if(r==="richtext")return d.jsx(Fme,{path:e});if(r==="file")return d.jsx(fZ,{path:e});{const o=r;return d.jsxs("div",{children:["Cannot preview: ",o]})}}function _r({path:e}){return d.jsx("div",{id:e,children:d.jsx(Qr,{size:12,className:"animate-spin"})},e+"-loading")}function Pr({path:e}){return d.jsx("div",{id:e,className:"text-fg-quaternary",children:"<empty>"},e+"-null")}function $me({source:e,render:t,path:n,schema:r,disabled:o,onClick:s,onMove:i,onDelete:a,onDuplicate:l}){const[c,u]=m.useState([]);m.useEffect(()=>{const p=[];let g=1;for(const v of e)p.push({path:v,id:g}),g++;u(p)},[e,n]);const f=DY(a0(eI),a0(tI),a0(wk,{coordinateGetter:sX})),h=m.useCallback(p=>{const{active:g,over:v}=p;if((g==null?void 0:g.id)!==(v==null?void 0:v.id)){const y=c.findIndex(b=>b.id===Number(g==null?void 0:g.id)),x=c.findIndex(b=>b.id===Number(v==null?void 0:v.id));u(b=>kk(b,y,x)),i(y,x)}},[c]);return d.jsx(DJ,{sensors:f,collisionDetection:FY,onDragEnd:h,children:d.jsx(YJ,{items:c,strategy:GJ,disabled:o,children:d.jsx("div",{className:"flex flex-col gap-y-4 w-full",children:c.map(({path:p,id:g})=>d.jsx(Bme,{id:g,schema:r,disabled:o,renderLayout:t==null?void 0:t.layout,render:t==null?void 0:t.items[g-1],path:p,onClick:s,onDelete:v=>{a(v-1)},onDuplicate:v=>{l(v-1)}},g))})})})}const vT=170;function Bme({id:e,path:t,schema:n,disabled:r,render:o,onClick:s,onDelete:i,onDuplicate:a}){var E,C,_;const l=Nn(),c=m.useRef(null),[u,f]=m.useState(!1);m.useEffect(()=>{c.current&&(c.current.getBoundingClientRect().height>=vT?f(!0):f(!1))},[e,t]);const{attributes:h,listeners:p,setNodeRef:g,transform:v,transition:y}=nX({id:e,disabled:r===!0}),x=uc()||{},b={transform:ph.Transform.toString(v),transition:y},w=!(((E=x[t])==null?void 0:E.length)>0);return d.jsxs("div",{"touch-action":"manipulation",ref:g,style:b,className:de("relative flex disabled:opacity-55 flex-1",{"items-start":!w,"items-center":w}),children:[d.jsx("button",{...h,...p,className:de("pb-1 pr-2",{"opacity-30":r,"mt-2.5":!w}),disabled:r,onClick:()=>{s(t)},children:d.jsx(pK,{})}),!o&&((C=n==null?void 0:n.item)==null?void 0:C.type)==="string"&&d.jsxs("div",{className:de("flex-grow w-full",{"p-2 border border-bg-error-secondary rounded-lg":!!x[t]}),children:[d.jsx(dI,{path:t}),x[t]&&d.jsx("div",{className:"px-2",children:d.jsx(Gg,{validationErrors:x[t]})})]}),(o||((_=n==null?void 0:n.item)==null?void 0:_.type)!=="string")&&d.jsxs("button",{className:de("flex-grow","relative flex text-left border rounded-lg border-border bg-card gap-y-2 bg-bg-primary","hover:bg-bg-secondary-hover","overflow-y-clip"),style:{maxHeight:vT},ref:c,disabled:r,onClick:()=>{s(t)},children:[o&&d.jsx(Vme,{...o}),!o&&d.jsx("div",{className:"flex-grow p-4 w-full",children:d.jsx(xE,{path:t})}),u&&d.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}})]}),ZI(t,x)&&d.jsx("div",{className:de("absolute right-3",{"top-2":w,"top-0":!w}),children:d.jsx(QI,{})}),d.jsxs(Cr,{children:[d.jsx(Co,{className:de("flex hover:bg-bg-secondary-hover px-2 hover:rounded-lg",{"items-start mt-4":!w,"items-center py-2":w}),children:d.jsx(uK,{size:16})}),d.jsxs(ir,{className:"p-2",container:l,side:"top",children:[d.jsxs("button",{className:de("flex items-center gap-x-2"),onClick:()=>{i(e)},children:[d.jsx("span",{children:d.jsx(XS,{className:"w-4 h-4"})}),d.jsx("span",{children:"Delete"})]}),d.jsxs("button",{className:de("flex items-center gap-x-2"),onClick:()=>{a(e)},children:[d.jsx("span",{children:d.jsx(fA,{className:"w-4 h-4"})}),d.jsx("span",{children:"Duplicate"})]})]})]})]})}function Vme({title:e,image:t,subtitle:n}){return d.jsxs("div",{className:de("flex w-full items-center justify-between pl-4 flex-grow"),children:[d.jsxs("div",{className:"flex flex-col flex-shrink py-4 overflow-x-clip",children:[d.jsx("div",{className:"text-lg font-medium",children:e}),n&&d.jsx("div",{className:"block overflow-hidden flex-shrink max-h-5 text-sm text-gray-500 text-ellipsis",children:n})]}),t&&d.jsx(Ume,{src:t,alt:e})]})}function Ume({src:e,alt:t}){var s;const[n,r]=m.useState(!1);if(e==null)return d.jsx("div",{className:"flex-shrink-0 ml-4 w-20 h-20 opacity-25 bg-bg-brand-secondary"});const o=e[Le]==="file"?Y.convertFileSource(e).url:Y.convertRemoteSource(e).url;return d.jsxs("div",{className:"relative flex-shrink-0 ml-4 w-20 h-20",children:[!n&&d.jsx("div",{className:"absolute inset-0 opacity-25 bg-bg-brand-secondary animate-in"}),d.jsx("img",{src:o,alt:t,onLoad:()=>r(!0),onError:()=>r(!1),className:`absolute inset-0 object-cover w-full h-full rounded-r-lg ${n?"opacity-100":"opacity-0"}`,style:{objectPosition:(s=e.metadata)!=null&&s.hotspot?`${e.metadata.hotspot.x}% ${e.metadata.hotspot.y}%`:"",transition:"opacity 0.2s ease-in-out"}})]})}function Wme({path:e}){const t="array",{navigate:n}=Cn(),r=Vt(e),o=US(e),s=ht(e,t),i=GS(e),{addPatch:a,patchPath:l}=_n(e);if(r.status==="error")return d.jsx(nn,{path:e,error:r.error,type:t});if(s.status==="error")return d.jsx(ut,{path:e,error:s.error,schema:r});if(s.status=="not-found"||r.status==="not-found")return d.jsx(zn,{path:e,type:t});if(r.status==="loading")return d.jsx(Et,{path:e,type:t});if(r.data.type!=="array")return d.jsx(Tr,{path:e,expectedType:"array",actualType:r.data.type});const c=r.data,u=o&&"data"in o?o.data:void 0,f=u&&(s.status==="success"&&s.clientSideOnly||s.status==="loading");return d.jsxs("div",{id:e,className:"relative w-full",children:[d.jsx(Nr,{path:e}),(o==null?void 0:o.status)==="error"&&d.jsx(eD,{error:o.message,path:e}),f&&d.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-bg-disabled z-[40] opacity-40",children:d.jsx(Qr,{className:"animate-spin"})}),d.jsx($me,{path:e,disabled:f,onClick:h=>{n(h)},onDelete:async h=>{a([{op:"remove",path:l.concat(h.toString())}],c.type)},onDuplicate:async h=>{var p;"data"in i&&i.data&&Array.isArray(i.data)&&a([{op:"add",path:l.concat(h.toString()),value:((p=i.data)==null?void 0:p[h])??null}],c.type)},onMove:async(h,p)=>{a([{op:"move",from:l.concat(h.toString()),path:l.concat(p.toString())}],c.type)},schema:c,render:(u==null?void 0:u.layout)==="list"&&u.parent==="array"?u:void 0,source:s.data||[]})]})}function Hme({path:e}){const t=ht(e,"array");return t.status==="error"?d.jsx(ut,{path:e,error:t.error}):!("data"in t)||t.data===void 0?d.jsx(_r,{path:e}):t.data===null?d.jsx(Pr,{path:e}):d.jsx("div",{children:`${t.data.length} items`})}function Yy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return d.jsx(dI,{path:e,autoFocus:n},e);if(t.type==="number")return d.jsx(fX,{path:e},e);if(t.type==="boolean")return d.jsx(cX,{path:e},e);if(t.type==="image")return d.jsx(hZ,{path:e},e);if(t.type==="object")return d.jsx(tZ,{path:e},e);if(t.type==="array")return d.jsx(Wme,{path:e},e);if(t.type==="record")return d.jsx(SZ,{path:e},e);if(t.type==="union")return d.jsx(oZ,{path:e},e);if(t.type==="keyOf")return d.jsx(gZ,{path:e},e);if(t.type==="richtext")return d.jsx(Dme,{path:e,autoFocus:n},e);if(t.type==="date")return d.jsx(xZ,{path:e},e);if(t.type==="file")return d.jsx(dZ,{path:e},e);if(t.type==="literal")return d.jsx(nn,{path:e,error:"Literal fields are not editable"});{const r=t;return d.jsx(nn,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function Kme({path:e}){const t=Vt(e),{path:n,schema:r}=UI(e),{navigate:o}=Cn(),s=KS(),i=Ja(),a=rA(e),l=m.useCallback(x=>{if("data"in i){const b=i.data,w=D2(x,s,b);w?o(w):(o(x),console.error(`Error navigating to path: ${x} - no schemas found`))}else console.warn("Schemas not loaded yet"),o(x)},[i,s,o]);if(t.status==="error")return d.jsx(nn,{path:e,error:t.error,type:"module"});if(t.status==="loading")return d.jsx(Et,{path:e,type:"module"});if(t.status==="not-found")return d.jsx(zn,{path:e,type:"module"});const c=t.data,u=HI(e),f=u.slice(0,-1),h=u[u.length-1],p=XX(e,n,r),g=Nm(e,n,r),v=a.filter(x=>!!x.keyError),y=a.filter(x=>!x.keyError);return d.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[d.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[u.length>1&&d.jsx("div",{className:"inline-flex items-center text-sm text-fg-quaternary",children:f.map((x,b)=>b<f.length-1?d.jsxs(m.Fragment,{children:[d.jsx("button",{onClick:()=>{l(x.sourcePath)},children:x.text}),d.jsx("span",{children:d.jsx(rd,{size:16})})]},b):d.jsx("button",{onClick:()=>{l(x.sourcePath)},children:x.text},b))}),d.jsxs("div",{className:de({"border rounded-lg border-bg-error-secondary p-4":v.length>0}),children:[d.jsxs("div",{className:"flex gap-4 justify-between items-center h-6 text-xl",children:[!p&&d.jsx("span",{children:d.jsx("span",{children:h.text})}),p&&d.jsxs("span",{children:["#",Number(h.text)]}),d.jsx(WI,{path:e,variant:"module"})]}),v.length>0&&d.jsx(Gg,{validationErrors:v})]})]}),d.jsxs("div",{children:[g&&y.length>0&&d.jsx(Gg,{validationErrors:a}),d.jsx("div",{className:de({"border rounded-lg border-bg-error-secondary p-4 mt-4":y.length>0}),children:d.jsx(Yy,{path:e,schema:c},e)})]})]})}function Gme({value:e}){return console.warn("Exhaustive check failed for value:",e),null}function qme(e){const t=Yme(e),n=m.forwardRef((r,o)=>{const{children:s,...i}=r,a=m.Children.toArray(s),l=a.find(Xme);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Yme(e){const t=m.forwardRef((n,r)=>{const{children:o,...s}=n;if(m.isValidElement(o)){const i=Qme(o),a=Zme(s,o.props);return o.type!==m.Fragment&&(a.ref=r?As(r,i):i),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Jme=Symbol("radix.slottable");function Xme(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Jme}function Zme(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Qme(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 Jy="Dialog",[o3]=dr(Jy),[ege,is]=o3(Jy),s3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=m.useRef(null),l=m.useRef(null),[c,u]=Zr({prop:r,defaultProp:o??!1,onChange:s,caller:Jy});return d.jsx(ege,{scope:t,triggerRef:a,contentRef:l,contentId:qr(),titleId:qr(),descriptionId:qr(),open:c,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(f=>!f),[u]),modal:i,children:n})};s3.displayName=Jy;var i3="DialogTrigger",tge=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(i3,n),s=Ue(t,o.triggerRef);return d.jsx(Oe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":kE(o.open),...r,ref:s,onClick:ne(e.onClick,o.onOpenToggle)})});tge.displayName=i3;var bE="DialogPortal",[nge,a3]=o3(bE,{forceMount:void 0}),l3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=is(bE,t);return d.jsx(nge,{scope:t,forceMount:n,children:m.Children.map(r,i=>d.jsx(fn,{present:n||s.open,children:d.jsx(Xu,{asChild:!0,container:o,children:i})}))})};l3.displayName=bE;var kv="DialogOverlay",c3=m.forwardRef((e,t)=>{const n=a3(kv,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=is(kv,e.__scopeDialog);return s.modal?d.jsx(fn,{present:r||s.open,children:d.jsx(oge,{...o,ref:t})}):null});c3.displayName=kv;var rge=qme("DialogOverlay.RemoveScroll"),oge=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(kv,n);return d.jsx(op,{as:rge,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(Oe.div,{"data-state":kE(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),sc="DialogContent",u3=m.forwardRef((e,t)=>{const n=a3(sc,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=is(sc,e.__scopeDialog);return d.jsx(fn,{present:r||s.open,children:s.modal?d.jsx(sge,{...o,ref:t}):d.jsx(ige,{...o,ref:t})})});u3.displayName=sc;var sge=m.forwardRef((e,t)=>{const n=is(sc,e.__scopeDialog),r=m.useRef(null),o=Ue(t,n.contentRef,r);return m.useEffect(()=>{const s=r.current;if(s)return uy(s)},[]),d.jsx(d3,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault())})}),ige=m.forwardRef((e,t)=>{const n=is(sc,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return d.jsx(d3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),d3=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=is(sc,n),l=m.useRef(null),c=Ue(t,l);return cy(),d.jsxs(d.Fragment,{children:[d.jsx(rp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:d.jsx(lc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":kE(a.open),...i,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(age,{titleId:a.titleId}),d.jsx(cge,{contentRef:l,descriptionId:a.descriptionId})]})]})}),wE="DialogTitle",SE=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(wE,n);return d.jsx(Oe.h2,{id:o.titleId,...r,ref:t})});SE.displayName=wE;var f3="DialogDescription",h3=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(f3,n);return d.jsx(Oe.p,{id:o.descriptionId,...r,ref:t})});h3.displayName=f3;var p3="DialogClose",m3=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=is(p3,n);return d.jsx(Oe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>o.onOpenChange(!1))})});m3.displayName=p3;function kE(e){return e?"open":"closed"}var g3="DialogTitleWarning",[Jge,v3]=KU(g3,{contentName:sc,titleName:wE,docsSlug:"dialog"}),age=({titleId:e})=>{const t=v3(g3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
515
|
+
|
|
516
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
517
|
+
|
|
518
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},lge="DialogDescriptionWarning",cge=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${v3(lge).contentName}}.`;return m.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},uge=s3,dge=l3,y3=c3,x3=u3,b3=SE,w3=h3,fge=m3;const S3=uge,EE=dge,Xy=m.forwardRef(({className:e,...t},n)=>d.jsx(y3,{ref:n,className:de("fixed inset-0 z-50 bg-bg-primary 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}));Xy.displayName=y3.displayName;const CE=m.forwardRef(({className:e,children:t,container:n,hideClose:r,...o},s)=>d.jsxs(EE,{container:n,children:[d.jsx(Xy,{}),d.jsxs(x3,{ref:s,className:de("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-fg-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:d.jsxs(fge,{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-fg-primary",children:[d.jsx(Wl,{className:"w-4 h-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));CE.displayName=x3.displayName;const k3=({className:e,...t})=>d.jsx("div",{className:de("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});k3.displayName="DialogHeader";const E3=m.forwardRef(({className:e,...t},n)=>d.jsx(b3,{ref:n,className:de("text-lg font-semibold leading-none tracking-tight",e),...t}));E3.displayName=b3.displayName;const C3=m.forwardRef(({className:e,...t},n)=>d.jsx(w3,{ref:n,className:de("text-sm text-fg-primary",e),...t}));C3.displayName=w3.displayName;function hge(){const e=$7(),t=X7();return d.jsxs(d.Fragment,{children:[d.jsx(gge,{}),d.jsxs(yr,{viewportId:"val-content-area",children:[t!==null&&d.jsx(d.Fragment,{children:t.type==="network-error"?d.jsx(d.Fragment,{children:d.jsx("div",{className:"absolute w-full h-16 top-0 p-4 text-center text-fg-error-primary bg-bg-error-primary z-[50]",children:"Network error - retrying..."})}):t.type==="remote-files-error"?d.jsx(pge,{error:t}):d.jsx(Gme,{value:t})}),d.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?d.jsxs("div",{className:"p-8 mt-20 text-center text-fg-error-primary bg-bg-error-primary",children:[d.jsx("p",{children:"Could not connect to the content service."}),d.jsx("p",{children:"Please try again later"})]}):d.jsx(vge,{})})]})]})}function pge({error:e}){const t=Nn();return d.jsx(S3,{defaultOpen:!0,children:d.jsxs(EE,{children:[d.jsx(Xy,{}),d.jsxs(CE,{container:t,className:"max-w-lg p-6 rounded-lg bg-bg-primary text-fg-primary",children:[d.jsx(E3,{className:"text-lg font-medium mb-4",children:"Personal access token file required"}),d.jsxs("div",{children:[d.jsx("p",{children:"This project uses remote files, which means you need to be authenticated to update them."}),d.jsx("p",{children:"To do this locally in this dev environment, you need a Personal Access Token (PAT) stored in a file."}),d.jsx("p",{children:"Run the command in the root directory of your project to create the token file."})]}),d.jsx(mge,{code:"npx -p @valbuild/cli val login"}),d.jsx("div",{children:d.jsxs(La,{type:"multiple",children:[d.jsxs(Ns,{value:"why-pat",children:[d.jsx(wi,{children:"Why a personal token file?"}),d.jsxs(_s,{children:[d.jsx("p",{children:"Remote files are stored in a remote file server that requires authentication. A personal access token (PAT) is a secure way to authenticate and update remote files."}),d.jsx("p",{children:"Note: this is only required in local development. In production, users are authenticated through the application."})]})]}),d.jsxs(Ns,{value:"details",children:[d.jsx(wi,{children:"More details"}),d.jsx(_s,{children:d.jsxs("p",{children:['The underlying error message was: "',e.error,'".']})})]})]})})]})]})})}function mge({code:e}){const t=()=>{navigator.clipboard.writeText(e)};return d.jsxs("div",{className:"relative bg-bg-secondary rounded-md p-4 my-4",children:[d.jsx("pre",{className:"overflow-x-auto",children:d.jsx("code",{children:e})}),d.jsx(Je,{variant:"secondary",size:"sm",className:"absolute top-2 right-2",onClick:t,children:d.jsx(fA,{size:16,className:"mr-2"})})]})}function gge(){const{navMenu:e,toolsMenu:t}=Zy();return d.jsxs("div",{className:"flex justify-between items-center px-4 w-full h-16 border-b border-border-primary",children:[d.jsx("button",{className:Te({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:d.jsx(Ag,{size:16,className:Te("transform",{"rotate-180":!e.isOpen})})}),d.jsx("button",{className:Te({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:d.jsx(Ag,{size:16,className:Te("transform",{"rotate-180":t.isOpen})})})]})}function vge(){const{currentSourcePath:e}=Cn(),t=e;return d.jsx(Kme,{path:t})}function yge(){const e=Nn();return d.jsx(S3,{open:!0,modal:!0,children:d.jsxs(EE,{children:[d.jsx(Xy,{}),d.jsxs(CE,{container:e,"aria-label":"Login required",className:"bg-bg-secondary text-fg-secondary",children:[d.jsx(k3,{children:d.jsx(SE,{children:d.jsx("span",{children:"Log in required"})})}),d.jsx(C3,{children:"You need to log in to access Val."}),d.jsx(Je,{asChild:!0,children:d.jsx("a",{href:Su("/api/val/authorize",{redirect_to:window.origin+Su("/val")}),children:"Log in"})})]})]})})}function xge(){const{theme:e}=sy(),[t,n]=m.useState(!1),[r,o]=m.useState(!1),[s,i]=m.useState(!1),{currentSourcePath:a,ready:l}=Cn();return m.useEffect(()=>{!t&&l&&(window.innerWidth<a2?(a||o(!0),n(!0)):(i(!0),o(!0),n(!0)))},[t,l,a]),QR()==="login-required"?d.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:d.jsx(yge,{})}):d.jsx(N3.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:s,setOpen:i}},children:d.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:Te("font-sans bg-bg-primary text-fg-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&s,"xl:grid-cols-[320px,1fr]":r&&!s,"xl:grid-cols-[1fr,320px]":!r&&s}),...e?{"data-mode":e}:{},children:[d.jsx("div",{className:Te({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:d.jsx(jq,{})}),d.jsx("div",{children:d.jsx(hge,{})}),d.jsx("div",{className:Te({hidden:!s,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":s}),children:d.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:d.jsx(vY,{})})})]})})}const N3=_e.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function Zy(){return m.useContext(N3)}const bge=({client:e,config:t})=>d.jsx(ZR,{client:e,dispatchValEvents:!1,config:t,children:d.jsx(bA,{children:d.jsx(xge,{})})}),wge=m.createContext(null),R0={didCatch:!1,error:null};class _3 extends m.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=R0}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:s,reason:"imperative-api"}),this.setState(R0)}}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&&Sge(t.resetKeys,o)){var s,i;(s=(i=this.props).onReset)===null||s===void 0||s.call(i,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState(R0)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:s,error:i}=this.state;let a=t;if(s){const l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=m.createElement(r,l);else if(o!==void 0)a=o;else throw i}return m.createElement(wge.Provider,{value:{didCatch:s,error:i,resetErrorBoundary:this.resetErrorBoundary}},a)}}function Sge(){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 kge=({className:e})=>d.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[d.jsx("g",{filter:"url(#filter0_d_21_1677)",children:d.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))"})}),d.jsx("g",{filter:"url(#filter1_i_21_1677)",children:d.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),d.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"}),d.jsxs("defs",{children:[d.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[d.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),d.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"}),d.jsx("feOffset",{}),d.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),d.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),d.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"}),d.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),d.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),d.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[d.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),d.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),d.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"}),d.jsx("feOffset",{}),d.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),d.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),d.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"}),d.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function P3({error:e,resetErrorBoundary:t}){return console.error(e),d.jsx("div",{className:"flex absolute top-0 left-0 justify-center items-center w-screen h-screen bg-bg-primary text-fg-primary",children:d.jsx("div",{className:"p-10 w-full h-full",children:d.jsxs("div",{className:"overflow-scroll p-10 w-full h-full bg-card text-fg-primary",children:[d.jsxs("div",{className:"flex justify-between items-center",children:[d.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[d.jsx(kge,{})," encountered an error"]}),d.jsx("button",{onClick:t,children:d.jsx(Wl,{})})]}),d.jsx("div",{className:"text-4xl font-normal",children:"Message:"}),d.jsx("pre",{children:e.message}),e.stack&&d.jsx(La,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:d.jsxs(Ns,{value:"error",children:[d.jsx(wi,{children:"Stack trace:"}),d.jsx(_s,{className:"p-4 bg-bg-secondary",children:e.stack&&d.jsx("pre",{children:e.stack})})]})})]})})})}function Ege({root:e,children:t}){return Hr.createPortal(t,e)}const T3=({children:e,style:t})=>{const n=m.useRef(null),[r,o]=m.useState(null);return m.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const s=n.current.attachShadow({mode:"open"});o(s)}},[]),d.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&d.jsx(Ege,{root:r,children:e})})},O3="/spa/index.css",NE="val-app",j3="val-overlay",M3="$$BUILD_$$REPLACE_WITH_VERSION$$";function R3(){return d.jsxs(d.Fragment,{children:[d.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),d.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),d.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 A3(){const[e,t]=m.useState(null),n=m.useMemo(yT,[]);return m.useEffect(()=>{const r=o=>{o.key===BM&&t(yT())};return window.addEventListener("storage",r),()=>{window.removeEventListener("storage",r)}},[]),e||n}function yT(){const e=sessionStorage.getItem(BM);if(e){const t=CV.safeParse(JSON.parse(e));return t.error?(console.error("Error parsing config from session storage",t.error),null):t.data}return null}function Cge(){const e=A3(),t="/api/val",{client:n}=m.useMemo(()=>({client:$M(t,{...e})}),[t,e]);return d.jsxs(d.Fragment,{children:[d.jsx(R3,{}),d.jsxs(T3,{children:[d.jsx("link",{rel:"stylesheet",href:`${t}/static${`/${M3}`}${O3}`,onLoad:()=>{window.dispatchEvent(new CustomEvent("val-css-loaded",{detail:{type:"val-css-loaded"}}))}}),d.jsx(_3,{fallbackRender:P3,children:d.jsx(bge,{client:n,config:e})})]})]})}var Qy="Switch",[Nge]=dr(Qy),[_ge,Pge]=Nge(Qy),I3=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l="on",onCheckedChange:c,form:u,...f}=e,[h,p]=m.useState(null),g=Ue(t,w=>p(w)),v=m.useRef(!1),y=h?u||!!h.closest("form"):!0,[x,b]=Zr({prop:o,defaultProp:s??!1,onChange:c,caller:Qy});return d.jsxs(_ge,{scope:n,checked:x,disabled:a,children:[d.jsx(Oe.button,{type:"button",role:"switch","aria-checked":x,"aria-required":i,"data-state":z3(x),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:g,onClick:ne(e.onClick,w=>{b(E=>!E),y&&(v.current=w.isPropagationStopped(),v.current||w.stopPropagation())})}),y&&d.jsx(F3,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:i,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});I3.displayName=Qy;var D3="SwitchThumb",L3=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=Pge(D3,n);return d.jsx(Oe.span,{"data-state":z3(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});L3.displayName=D3;var Tge="SwitchBubbleInput",F3=m.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},s)=>{const i=m.useRef(null),a=Ue(i,s),l=ok(n),c=RS(t);return m.useEffect(()=>{const u=i.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});p.call(u,n),u.dispatchEvent(g)}},[l,n,r]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:a,style:{...o.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});F3.displayName=Tge;function z3(e){return e?"checked":"unchecked"}var $3=I3,Oge=L3;const B3=m.forwardRef(({className:e,...t},n)=>d.jsx($3,{className:de("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-primary disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-bg-tertiary data-[state=unchecked]:bg-bg-secondary-hover",e),...t,ref:n,children:d.jsx(Oge,{className:de("pointer-events-none block h-[18px] w-5 rounded-full bg-bg-primary shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));B3.displayName=$3.displayName;var A0,ex="HoverCard",[V3]=dr(ex,[Ds]),tx=Ds(),[jge,_E]=V3(ex),U3=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:s,openDelay:i=700,closeDelay:a=300}=e,l=tx(t),c=m.useRef(0),u=m.useRef(0),f=m.useRef(!1),h=m.useRef(!1),[p,g]=Zr({prop:r,defaultProp:o??!1,onChange:s,caller:ex}),v=m.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>g(!0),i)},[i,g]),y=m.useCallback(()=>{clearTimeout(c.current),!f.current&&!h.current&&(u.current=window.setTimeout(()=>g(!1),a))},[a,g]),x=m.useCallback(()=>g(!1),[g]);return m.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),d.jsx(jge,{scope:t,open:p,onOpenChange:g,onOpen:v,onClose:y,onDismiss:x,hasSelectionRef:f,isPointerDownOnContentRef:h,children:d.jsx(Jh,{...l,children:n})})};U3.displayName=ex;var W3="HoverCardTrigger",H3=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=_E(W3,n),s=tx(n);return d.jsx(Ju,{asChild:!0,...s,children:d.jsx(Oe.a,{"data-state":o.open?"open":"closed",...r,ref:t,onPointerEnter:ne(e.onPointerEnter,Cv(o.onOpen)),onPointerLeave:ne(e.onPointerLeave,Cv(o.onClose)),onFocus:ne(e.onFocus,o.onOpen),onBlur:ne(e.onBlur,o.onClose),onTouchStart:ne(e.onTouchStart,i=>i.preventDefault())})})});H3.displayName=W3;var Mge="HoverCardPortal",[Xge,Rge]=V3(Mge,{forceMount:void 0}),Ev="HoverCardContent",PE=m.forwardRef((e,t)=>{const n=Rge(Ev,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,s=_E(Ev,e.__scopeHoverCard);return d.jsx(fn,{present:r||s.open,children:d.jsx(Age,{"data-state":s.open?"open":"closed",...o,onPointerEnter:ne(e.onPointerEnter,Cv(s.onOpen)),onPointerLeave:ne(e.onPointerLeave,Cv(s.onClose)),ref:t})})});PE.displayName=Ev;var Age=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,...a}=e,l=_E(Ev,n),c=tx(n),u=m.useRef(null),f=Ue(t,u),[h,p]=m.useState(!1);return m.useEffect(()=>{if(h){const g=document.body;return A0=g.style.userSelect||g.style.webkitUserSelect,g.style.userSelect="none",g.style.webkitUserSelect="none",()=>{g.style.userSelect=A0,g.style.webkitUserSelect=A0}}},[h]),m.useEffect(()=>{if(u.current){const g=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var y;((y=document.getSelection())==null?void 0:y.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",g),()=>{document.removeEventListener("pointerup",g),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{u.current&&Lge(u.current).forEach(v=>v.setAttribute("tabindex","-1"))}),d.jsx(lc,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:ne(s,g=>{g.preventDefault()}),onDismiss:l.onDismiss,children:d.jsx(Xh,{...c,...a,onPointerDown:ne(a.onPointerDown,g=>{g.currentTarget.contains(g.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,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)"}})})}),Ige="HoverCardArrow",Dge=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=tx(n);return d.jsx(Zh,{...o,...r,ref:t})});Dge.displayName=Ige;function Cv(e){return t=>t.pointerType==="touch"?void 0:e()}function Lge(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 Fge=U3,K3=PE;const zge=Fge,$ge=m.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>d.jsx(K3,{ref:o,align:t,sideOffset:n,className:de("z-50 w-64 text-xs rounded-md border bg-bg-secondary p-4 text-fg-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}));$ge.displayName=K3.displayName;function I0({size:e}){return d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("circle",{cx:"12",cy:"12",r:"11"}),d.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"12",className:"animate-rotate-clock-minute-hand origin-center"}),d.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12",className:"animate-rotate-clock-hour-hand origin-center"})]})}function Bge(e){const[t,n]=m.useState(null),[r,o]=m.useState([]),[s,i]=m.useState({x:0,y:0});m.useEffect(()=>{const v=()=>{i({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),m.useEffect(()=>{if(t==="select"){let v;const y=()=>{const x=[];document.querySelectorAll("[data-val-path]").forEach(b=>{const w=b.getAttribute("data-val-path");if(!w)return;if(b.tagName==="SOURCE"||b.tagName==="TRACK"){const C=b.parentElement;if(!C||!(C.tagName==="VIDEO"||C.tagName==="PICTURE"||C.tagName==="AUDIO"))return;const _=C.getBoundingClientRect();x.push({top:_.top,left:_.left,width:_.width,height:_.height,joinedPaths:w});return}const E=b.getBoundingClientRect();x.push({top:E.top,left:E.left,width:E.width,height:E.height,joinedPaths:w})}),o(x),v=setTimeout(y,1e3)};return y(),()=>{clearTimeout(v)}}else o([])},[t,s]);const[a,l]=m.useState(null);m.useEffect(()=>{if(t==="select"&&a===null){const v=y=>{y.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=sy(),[u,f]=m.useState(null),h=Qu(),p="val-menu-right-center";m.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")f(v);else throw new Error("Invalid drop zone: "+v);else f(p)}catch(v){console.error("Error getting drop zone from local storage",v),f(p)}},[(h==null?void 0:h.project)||"unknown"]);const g=v=>{f(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(y){console.error("Error setting drop zone to local storage",y)}};return d.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[d.jsx(Vge,{editMode:a,setMode:n,setEditMode:l}),r.map((v,y)=>d.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)+s.y,left:(v==null?void 0:v.left)+s.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:d.jsx("div",{className:"relative top-0 left-0 w-full",children:d.jsx("div",{className:"absolute top-[0px] right-[0px] w-full truncate bg-bg-brand-primary text-fg-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:Y.splitJoinedSourcePaths(v.joinedPaths).map(x=>{const[b,w]=Y.splitModuleFilePathAndModulePath(x);return d.jsx(ip,{link:!1,toolTip:!1,moduleFilePath:b,patchPath:Y.splitModulePath(w)},x)})})})},y)),a===null&&d.jsx(Hge,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:g})]})}function Vge({editMode:e,setMode:t,setEditMode:n}){const[r,o]=m.useState({x:window.innerWidth,y:window.innerHeight}),[s,i]=m.useState(window.innerWidth),a=m.useRef(null);m.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:f,innerHeight:h}=window,{offsetWidth:p,offsetHeight:g}=a.current,v=g,y=p;let x=e.clientX,b=e.clientY;const w=80,E=f-(e.clientX+y);E<0&&(x=x+(E-w));const C=h-(e.clientY+v);C<0&&(b=b+(C-w)),o({x,y:b})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),m.useEffect(()=>{const u=()=>{i(window.innerWidth),s<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=m.useState(!1);return m.useEffect(()=>{if(l){const u=p=>{if(p instanceof MouseEvent)o(g=>({x:g.x+p.movementX,y:g.y+p.movementY}));else{const g=p.touches[0];o(()=>({x:g.clientX,y:g.clientY}))}},f=()=>{c(!1)},h=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",f),window.addEventListener("click",h),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",f),window.removeEventListener("click",h)}}},[l]),m.useEffect(()=>{const u=f=>{f.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),d.jsxs("div",{className:Te("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[d.jsx("div",{className:Te("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))}}),d.jsxs("div",{className:Te("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-fg-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":s<1024,"min-w-[500px]":s>=1024}),ref:a,style:{top:r.y,left:r.x},children:[d.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),d.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[d.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),d.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&&Y.splitJoinedSourcePaths(e.joinedPaths).map(u=>{const[f,h]=Y.splitModuleFilePathAndModulePath(u),p=Y.splitModulePath(h);return d.jsxs(m.Fragment,{children:[d.jsx(ip,{link:!0,toolTip:!0,moduleFilePath:f,patchPath:p}),d.jsx(Uge,{path:u})]},u)}),d.jsx(Je,{className:"self-end",type:"submit",children:"Done"})]}),d.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),d.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}const o1="p-2 rounded-md disabled:bg-bg-disabled transition-colors border",s1="hover:bg-bg-primary-hover border-bg-primary";function Uge({path:e}){const t=Vt(e);return!("data"in t)||t.data===void 0?d.jsx("div",{className:"flex flex-col gap-4",children:d.jsx(Et,{path:e})}):d.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:d.jsx(Yy,{path:e,schema:t.data,autoFocus:!0})})}function xT({dropZone:e}){return e==="val-menu-left-top"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Xx,{className:"w-4 h-4"}),d.jsx("span",{children:"Left Top"})]}):e==="val-menu-left-center"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(EK,{className:"w-4 h-4"}),d.jsx("span",{children:"Left Center"})]}):e==="val-menu-left-bottom"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Jx,{className:"w-4 h-4"}),d.jsx("span",{children:"Left Bottom"})]}):e==="val-menu-center-top"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Xx,{className:"w-4 h-4"}),d.jsx("span",{children:"Center Top"})]}):e==="val-menu-center-bottom"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Jx,{className:"w-4 h-4"}),d.jsx("span",{children:"Center Bottom"})]}):e==="val-menu-right-top"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Xx,{className:"w-4 h-4"}),d.jsx("span",{children:"Right Top"})]}):e==="val-menu-right-center"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(CK,{className:"w-4 h-4"}),d.jsx("span",{children:"Right Center"})]}):e==="val-menu-right-bottom"?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Jx,{className:"w-4 h-4"}),d.jsx("span",{children:"Right Bottom"})]}):(console.warn("Unknown drop zone:",e),null)}function bT({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:s,setMode:i,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",f=QR(),h=Nn(),{theme:p,setTheme:g}=sy(),v=iy(),[y,x]=m.useState(0),b=ep(),w=uc()||{},E=Object.keys(w).length,C=ed();m.useEffect(()=>{const A=()=>{window.innerWidth<400?x(-56):x(32)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[]);const{publishDisabled:_}=tp(),N=Wge(),P=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",j=["val-menu-left-top","val-menu-left-center","val-menu-left-bottom","val-menu-center-top","val-menu-center-bottom","val-menu-right-top","val-menu-right-center","val-menu-right-bottom"];return d.jsxs("div",{className:"p-4 right-16",children:[l&&d.jsx("div",{className:Nv(e)+" p-4",children:d.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:d.jsx(I0,{size:16})})}),f==="login-required"&&d.jsx("div",{className:Nv(e)+" p-4",children:d.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:d.jsx("a",{href:Su("/api/val/authorize",{redirect_to:window.location.href}),children:d.jsx(bK,{size:16})})})}),d.jsx(Tu,{isOpen:n&&!r&&!l&&f!=="login-required",children:d.jsxs("div",{className:Te("flex relative rounded bg-bg-primary border border-border-primary text-fg-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[d.jsx(Oc,{label:"Pick content",active:s==="select",onClick:()=>i(A=>A==="select"?null:"select"),icon:d.jsx(TK,{size:16})}),d.jsx(Oc,{label:"Disable preview mode",disabled:r,icon:r?d.jsx(I0,{size:16}):d.jsx(dK,{size:16}),onClick:()=>o(!1)}),d.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),d.jsxs(Cr,{children:[d.jsx(zg,{disabled:_,className:Te(o1,s1),children:d.jsxs(zge,{children:[d.jsx(H3,{children:d.jsxs("div",{className:"relative",children:[b.length>0&&d.jsx("div",{className:"absolute -top-3 -right-3",children:d.jsxs("div",{className:Te("w-4 h-4 text-[9px] leading-4 text-center rounded-full",{"bg-bg-brand-primary":E===0,"bg-bg-error-primary text-fg-error-primary":E>0}),children:[E===0&&b.length>9&&d.jsx("span",{children:"9+"}),E===0&&b.length<=9&&d.jsx("span",{children:b.length}),E>9&&d.jsx("span",{children:"9+"}),E<=9&&E>0&&d.jsx("span",{children:E})]})}),d.jsx(Dg,{size:16})]})}),d.jsx(PE,{children:d.jsxs("div",{className:"p-2 rounded bg-bg-primary text-fg-primary",children:[E>0&&d.jsxs("div",{className:"text-fg-error-primary",children:["Cannot ",C==="fs"?"save":"publish"," due to"," ",E," validation error",E>1&&"s"]}),b.length>0&&E==0&&d.jsxs("div",{children:[b.length," patch",b.length>1&&"es"," ready to publish"]})]})})]})}),d.jsxs(ir,{container:h,align:"center",side:P,sideOffset:y,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[d.jsx("div",{className:"absolute top-4 right-4 sm:hidden",children:d.jsx(Hl,{children:d.jsx(Wl,{size:16})})}),!_&&d.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:d.jsx(rw,{})}),d.jsx(yr,{children:d.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px]",children:d.jsx(L2,{loadingStatus:v})})}),!_&&d.jsx("div",{className:"hidden py-4 sm:block",children:d.jsx(rw,{})})]})]}),d.jsx(Oc,{label:"Studio",icon:N.status==="success"&&N.data?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16}),href:window.origin+"/val/~"+(N.status==="success"&&N.data?N.data:"")}),d.jsxs(Cr,{children:[d.jsx(zg,{className:Te(o1,s1),children:d.jsx(qS,{size:16})}),d.jsx(ir,{container:h,className:"z-[9003]",children:d.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2 items-center",children:[d.jsx("span",{children:"Position"}),d.jsxs(Cy,{value:e,onValueChange:A=>{c(A)},children:[d.jsx(up,{children:d.jsx(Ny,{children:d.jsx(xT,{dropZone:e})})}),d.jsx(dp,{container:h,className:"z-[9004]",children:j.map(A=>d.jsx(fp,{value:A,children:d.jsx(xT,{dropZone:A})},A))})]}),d.jsx("span",{children:"Dark mode"}),d.jsx(B3,{checked:p==="dark",onCheckedChange:A=>{g(A?"dark":"light")}})]})})]})]})}),d.jsx(Tu,{isOpen:!(n&&!r)&&!l&&f!=="login-required",children:d.jsxs("div",{className:Te("flex relative rounded bg-bg-primary text-fg-primary gap-2 justify-center items-center",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[d.jsx(Oc,{label:"Enable preview mode",disabled:r,icon:r?d.jsx(I0,{size:16}):d.jsx(fK,{size:16}),onClick:()=>{o(!0)}}),d.jsx(Oc,{label:"Studio",icon:N.status==="success"&&N.data?d.jsx(Rg,{size:16}):d.jsx(Ig,{size:16}),href:window.origin+"/val/~"+(N.status==="success"&&N.data?N.data:"")}),d.jsx(Oc,{label:"Disable Val",icon:d.jsx(Wl,{size:16}),onClick:()=>a()})]})})]})}function Wge(){const e=Ja(),t="data"in e&&e.data?Object.keys(e.data):[],n=sA(t,"record"),[r,o]=m.useState(null);return m.useEffect(()=>{o(window.location.pathname);const i=()=>{o(window.location.pathname)};return window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)}},[]),m.useMemo(()=>{if(r){for(const i of n.data||[])for(const[a,l]of Object.entries(i))if(a===r){const[c]=Y.splitModuleFilePathAndModulePath(l),u="data"in e?e.data[c]:void 0;if((u==null?void 0:u.type)==="record"&&u.router!==void 0)return{status:"success",data:Y.joinModuleFilePathAndModulePath(c,JSON.stringify(a))}}}return{status:"not-found"}},["data"in e&&e.data,n,r])}function Oc({icon:e,onClick:t,disabled:n,active:r,label:o,href:s}){const i=s?"a":"button";return d.jsx(i,{href:s,disabled:n,className:Te(o1,{"bg-bg-brand-primary text-fg-brand-primary border-border-brand-primary hover:bg-bg-brand-primary-hover hover:text-fg-brand-primary":r,[s1]:!r}),onClick:t,"aria-label":o,title:o,children:e})}function Hge(e){const[t,n]=m.useState(!1),{dropZone:r,setDropZone:o}=e,[s,i]=m.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),i(c)};return d.jsxs(d.Fragment,{children:[r&&d.jsx("div",{className:Te("z-[8999] cursor-grab",Nv(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:d.jsx(bT,{...e,dropZone:r})}),t&&r&&d.jsxs(d.Fragment,{children:[s&&s!==r&&d.jsx("div",{className:Te("z-[3]",Nv(s)),onDrop:a(s),onDragOver:l(s),children:d.jsx(bT,{ghost:!0,...e,dropZone:s})}),d.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[d.jsx(Ui,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx(Ui,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx(Ui,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx(Ui,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx("div",{}),d.jsx(Ui,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx(Ui,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx(Ui,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l}),d.jsx(Ui,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:s,onDrop:a,onDragOver:l})]})]})]})}function Nv(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 Ui=({id:e,onDrop:t,onDragOver:n})=>d.jsx("div",{onDrop:t(e),onDragOver:n(e)});function Kge(){const e=A3(),t="/api/val",n=$M("/api/val",{...e}),[r,o]=m.useState(!1),[s,i]=m.useState(!1);return m.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"?i(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)}},[]),d.jsxs(d.Fragment,{children:[d.jsx(R3,{}),d.jsxs(T3,{children:[d.jsx("style",{children:`
|
|
519
|
+
#val-overlay-container {
|
|
520
|
+
visibility: hidden;
|
|
521
|
+
}
|
|
522
|
+
`}),d.jsx("link",{rel:"stylesheet",href:`${t}/static${`/${M3}`}${O3}`}),d.jsx(_3,{fallbackRender:P3,children:d.jsx(ZR,{client:n,dispatchValEvents:r,config:e,children:d.jsx(bA,{overlay:!0,children:d.jsx(Bge,{draftMode:r,draftModeLoading:s,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 wT=document.getElementById(NE),ST=document.getElementById(j3);let ta=null;wT?(ta=document.createElement("div"),Vm.createRoot(ta).render(_e.createElement(_e.StrictMode,null,_e.createElement(Cge,null))),wT.appendChild(ta),window.dispatchEvent(new CustomEvent("val-ui-created"))):ST?(ta=document.createElement("div"),Vm.createRoot(ta).render(_e.createElement(_e.StrictMode,null,_e.createElement(Kge,null))),ST.appendChild(ta),window.dispatchEvent(new CustomEvent("val-ui-created"))):console.error("Val: could not mount Val element. Check your configuration.");function G3(e){if(!ta){console.error("Val: could not mount Val element. Check your configuration.");return}if(!e){console.error(`Val: could not find element with id ${NE}`);return}if(e.childElementCount>0){console.error("Val: could not append root element, mount point is not empty.");return}e==null||e.appendChild(ta),window.dispatchEvent(new CustomEvent("val-ui-created"))}window.addEventListener("val-append-studio",()=>{G3(document.getElementById(NE))});window.addEventListener("val-append-overlay",()=>{G3(document.getElementById(j3))});
|